Ver código fonte

Merge pull request #409 from buildrob202/Marlin_v1

Implement automatic cold-end/extruder motor fan control based on nozzle temperature
ErikZalm 12 anos atrás
pai
commit
b2eeebd9c3
6 arquivos alterados com 363 adições e 285 exclusões
  1. 3
    0
      Marlin/Configuration.h
  2. 19
    9
      Marlin/Configuration_adv.h
  3. 23
    36
      Marlin/Marlin_main.cpp
  4. 10
    14
      Marlin/stepper.cpp
  5. 81
    3
      Marlin/temperature.cpp
  6. 227
    223
      README.md

+ 3
- 0
Marlin/Configuration.h Ver arquivo

@@ -51,6 +51,9 @@
51 51
 #define MOTHERBOARD 7
52 52
 #endif
53 53
 
54
+// This defines the number of extruders
55
+#define EXTRUDERS 1
56
+
54 57
 //// The following define selects which power supply you have. Please choose the one that matches your setup
55 58
 // 1 = ATX
56 59
 // 2 = X-Box 360 203Watts (the blue wire connected to PS_ON and the red wire to VCC)

+ 19
- 9
Marlin/Configuration_adv.h Ver arquivo

@@ -63,21 +63,31 @@
63 63
 //This is for controlling a fan to cool down the stepper drivers
64 64
 //it will turn on when any driver is enabled
65 65
 //and turn off after the set amount of seconds from last driver being disabled again
66
-//#define CONTROLLERFAN_PIN 23 //Pin used for the fan to cool controller, comment out to disable this function
67
-#define CONTROLLERFAN_SEC 60 //How many seconds, after all motors were disabled, the fan should run
66
+#define CONTROLLERFAN_PIN -1 //Pin used for the fan to cool controller (-1 to disable)
67
+#define CONTROLLERFAN_SECS 60 //How many seconds, after all motors were disabled, the fan should run
68
+#define CONTROLLERFAN_SPEED 255  // == full speed
68 69
 
69 70
 // When first starting the main fan, run it at full speed for the
70 71
 // given number of milliseconds.  This gets the fan spinning reliably
71 72
 // before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu)
72 73
 //#define FAN_KICKSTART_TIME 100
73 74
 
75
+// Extruder cooling fans
76
+// Configure fan pin outputs to automatically turn on/off when the associated
77
+// extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE.
78
+// Multiple extruders can be assigned to the same pin in which case 
79
+// the fan will turn on when any selected extruder is above the threshold.
80
+#define EXTRUDER_0_AUTO_FAN_PIN   -1
81
+#define EXTRUDER_1_AUTO_FAN_PIN   -1
82
+#define EXTRUDER_2_AUTO_FAN_PIN   -1
83
+#define EXTRUDER_AUTO_FAN_TEMPERATURE 50
84
+#define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
85
+
86
+
74 87
 //===========================================================================
75 88
 //=============================Mechanical Settings===========================
76 89
 //===========================================================================
77 90
 
78
-// This defines the number of extruders
79
-#define EXTRUDERS 1
80
-
81 91
 #define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing
82 92
 
83 93
 
@@ -210,9 +220,9 @@
210 220
 //  However, THIS FEATURE IS UNSAFE!, as it will only work if interrupts are disabled. And the code could hang in an interrupt routine with interrupts disabled.
211 221
 //#define WATCHDOG_RESET_MANUAL
212 222
 #endif
213
-
214
-// Enable the option to stop SD printing when hitting and endstops, needs to be enabled from the LCD menu when this option is enabled.
215
-//#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
223
+
224
+// Enable the option to stop SD printing when hitting and endstops, needs to be enabled from the LCD menu when this option is enabled.
225
+//#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
216 226
 
217 227
 // extruder advance constant (s2/mm3)
218 228
 //
@@ -276,7 +286,7 @@ const unsigned int dropsegments=5; //everything with less than this number of st
276 286
 #else
277 287
   #define BLOCK_BUFFER_SIZE 16 // maximize block buffer
278 288
 #endif
279
-
289
+
280 290
 
281 291
 //The ASCII buffer for recieving from the serial:
282 292
 #define MAX_CMD_SIZE 96

+ 23
- 36
Marlin/Marlin_main.cpp Ver arquivo

@@ -319,7 +319,7 @@ void setup_photpin()
319 319
 void setup_powerhold()
320 320
 {
321 321
  #ifdef SUICIDE_PIN
322
-   #if (SUICIDE_PIN> -1)
322
+   #if (SUICIDE_PIN> 0)
323 323
       SET_OUTPUT(SUICIDE_PIN);
324 324
       WRITE(SUICIDE_PIN, HIGH);
325 325
    #endif
@@ -410,14 +410,10 @@ void setup()
410 410
   servo_init();
411 411
 
412 412
   lcd_init();
413
-
414
-  #ifdef CONTROLLERFAN_PIN
413
+  
414
+  #if CONTROLLERFAN_PIN > 0
415 415
     SET_OUTPUT(CONTROLLERFAN_PIN); //Set pin used for driver cooling fan
416
-  #endif
417
-
418
-  #ifdef EXTRUDERFAN_PIN
419
-    SET_OUTPUT(EXTRUDERFAN_PIN); //Set pin used for extruder cooling fan
420
-  #endif
416
+  #endif 
421 417
 }
422 418
 
423 419
 
@@ -1040,6 +1036,10 @@ void process_commands()
1040 1036
             break;
1041 1037
           }
1042 1038
         }
1039
+      #if FAN_PIN > 0
1040
+        if (pin_number == FAN_PIN)
1041
+          fanSpeed = pin_status;
1042
+      #endif
1043 1043
         if (pin_number > -1)
1044 1044
         {
1045 1045
           pinMode(pin_number, OUTPUT);
@@ -2064,7 +2064,12 @@ void prepare_arc_move(char isclockwise) {
2064 2064
   previous_millis_cmd = millis();
2065 2065
 }
2066 2066
 
2067
-#ifdef CONTROLLERFAN_PIN
2067
+#if CONTROLLERFAN_PIN > 0
2068
+
2069
+#if CONTROLLERFAN_PIN == FAN_PIN 
2070
+   #error "You cannot set CONTROLLERFAN_PIN equal to FAN_PIN"
2071
+#endif
2072
+
2068 2073
 unsigned long lastMotor = 0; //Save the time for when a motor was turned on last
2069 2074
 unsigned long lastMotorCheck = 0;
2070 2075
 
@@ -2085,35 +2090,17 @@ void controllerFan()
2085 2090
     {
2086 2091
       lastMotor = millis(); //... set time to NOW so the fan will turn on
2087 2092
     }
2088
-
2089
-    if ((millis() - lastMotor) >= (CONTROLLERFAN_SEC*1000UL) || lastMotor == 0) //If the last time any driver was enabled, is longer since than CONTROLLERSEC...
2090
-    {
2091
-      WRITE(CONTROLLERFAN_PIN, LOW); //... turn the fan off
2092
-    }
2093
-    else
2094
-    {
2095
-      WRITE(CONTROLLERFAN_PIN, HIGH); //... turn the fan on
2096
-    }
2097
-  }
2098
-}
2099
-#endif
2100
-
2101
-#ifdef EXTRUDERFAN_PIN
2102
-unsigned long lastExtruderCheck = 0;
2103
-
2104
-void extruderFan()
2105
-{
2106
-  if ((millis() - lastExtruderCheck) >= 2500) //Not a time critical function, so we only check every 2500ms
2107
-  {
2108
-    lastExtruderCheck = millis();
2109
-
2110
-    if (degHotend(active_extruder) < EXTRUDERFAN_DEC)
2093
+    
2094
+    if ((millis() - lastMotor) >= (CONTROLLERFAN_SECS*1000UL) || lastMotor == 0) //If the last time any driver was enabled, is longer since than CONTROLLERSEC...   
2111 2095
     {
2112
-      WRITE(EXTRUDERFAN_PIN, LOW); //... turn the fan off
2096
+        digitalWrite(CONTROLLERFAN_PIN, 0); 
2097
+        analogWrite(CONTROLLERFAN_PIN, 0); 
2113 2098
     }
2114 2099
     else
2115 2100
     {
2116
-      WRITE(EXTRUDERFAN_PIN, HIGH); //... turn the fan on
2101
+        // allows digital or PWM fan output to be used (see M42 handling)
2102
+        digitalWrite(CONTROLLERFAN_PIN, CONTROLLERFAN_SPEED);
2103
+        analogWrite(CONTROLLERFAN_PIN, CONTROLLERFAN_SPEED); 
2117 2104
     }
2118 2105
   }
2119 2106
 }
@@ -2137,11 +2124,11 @@ void manage_inactivity()
2137 2124
       }
2138 2125
     }
2139 2126
   }
2140
-  #if( KILL_PIN>-1 )
2127
+  #if KILL_PIN > 0
2141 2128
     if( 0 == READ(KILL_PIN) )
2142 2129
       kill();
2143 2130
   #endif
2144
-  #ifdef CONTROLLERFAN_PIN
2131
+  #if CONTROLLERFAN_PIN > 0
2145 2132
     controllerFan(); //Check if fan should be turned on to cool stepper drivers down
2146 2133
   #endif
2147 2134
   #ifdef EXTRUDER_RUNOUT_PREVENT

+ 10
- 14
Marlin/stepper.cpp Ver arquivo

@@ -69,9 +69,9 @@ volatile long endstops_stepsTotal,endstops_stepsDone;
69 69
 static volatile bool endstop_x_hit=false;
70 70
 static volatile bool endstop_y_hit=false;
71 71
 static volatile bool endstop_z_hit=false;
72
-#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
73
-bool abort_on_endstop_hit = false;
74
-#endif
72
+#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
73
+bool abort_on_endstop_hit = false;
74
+#endif
75 75
 
76 76
 static bool old_x_min_endstop=false;
77 77
 static bool old_x_max_endstop=false;
@@ -184,20 +184,20 @@ void checkHitEndstops()
184 184
      SERIAL_ECHOPAIR(" Z:",(float)endstops_trigsteps[Z_AXIS]/axis_steps_per_unit[Z_AXIS]);
185 185
      LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Z");
186 186
    }
187
-   SERIAL_ECHOLN("");
187
+   SERIAL_ECHOLN("");
188 188
    endstop_x_hit=false;
189 189
    endstop_y_hit=false;
190
-   endstop_z_hit=false;
191
-#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
192
-   if (abort_on_endstop_hit)
193
-   {
190
+   endstop_z_hit=false;
191
+#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
192
+   if (abort_on_endstop_hit)
193
+   {
194 194
      card.sdprinting = false;
195 195
      card.closefile();
196
-     quickStop();
196
+     quickStop();
197 197
      setTargetHotend0(0);
198 198
      setTargetHotend1(0);
199 199
      setTargetHotend2(0);
200
-   }
200
+   }
201 201
 #endif
202 202
  }
203 203
 }
@@ -879,10 +879,6 @@ void st_init()
879 879
     disable_e2();
880 880
   #endif  
881 881
 
882
-  #ifdef CONTROLLERFAN_PIN
883
-    SET_OUTPUT(CONTROLLERFAN_PIN); //Set pin used for driver cooling fan
884
-  #endif
885
-  
886 882
   // waveform generation = 0100 = CTC
887 883
   TCCR1B &= ~(1<<WGM13);
888 884
   TCCR1B |=  (1<<WGM12);

+ 81
- 3
Marlin/temperature.cpp Ver arquivo

@@ -99,8 +99,9 @@ static volatile bool temp_meas_ready = false;
99 99
 #ifdef FAN_SOFT_PWM
100 100
   static unsigned char soft_pwm_fan;
101 101
 #endif
102
-
103
-
102
+#if EXTRUDER_0_AUTO_FAN_PIN > 0 || EXTRUDER_1_AUTO_FAN_PIN > 0 || EXTRUDER_2_AUTO_FAN_PIN > 0
103
+  static unsigned long extruder_autofan_last_check;
104
+#endif  
104 105
   
105 106
 #if EXTRUDERS > 3
106 107
 # error Unsupported number of extruders
@@ -306,6 +307,76 @@ int getHeaterPower(int heater) {
306 307
   return soft_pwm[heater];
307 308
 }
308 309
 
310
+#if EXTRUDER_0_AUTO_FAN_PIN > 0 || EXTRUDER_1_AUTO_FAN_PIN > 0 || EXTRUDER_2_AUTO_FAN_PIN > 0
311
+
312
+  #if FAN_PIN > 0
313
+    #if EXTRUDER_0_AUTO_FAN_PIN == FAN_PIN 
314
+       #error "You cannot set EXTRUDER_0_AUTO_FAN_PIN equal to FAN_PIN"
315
+    #endif
316
+    #if EXTRUDER_1_AUTO_FAN_PIN == FAN_PIN 
317
+       #error "You cannot set EXTRUDER_1_AUTO_FAN_PIN equal to FAN_PIN"
318
+    #endif
319
+    #if EXTRUDER_2_AUTO_FAN_PIN == FAN_PIN 
320
+       #error "You cannot set EXTRUDER_2_AUTO_FAN_PIN equal to FAN_PIN"
321
+    #endif
322
+  #endif 
323
+
324
+void setExtruderAutoFanState(int pin, bool state)
325
+{
326
+  unsigned char newFanSpeed = (state != 0) ? EXTRUDER_AUTO_FAN_SPEED : 0;
327
+  // this idiom allows both digital and PWM fan outputs (see M42 handling).
328
+  pinMode(pin, OUTPUT);
329
+  digitalWrite(pin, newFanSpeed);
330
+  analogWrite(pin, newFanSpeed);
331
+}
332
+
333
+void checkExtruderAutoFans()
334
+{
335
+  uint8_t fanState = 0;
336
+
337
+  // which fan pins need to be turned on?      
338
+  #if EXTRUDER_0_AUTO_FAN_PIN > 0
339
+    if (current_temperature[0] > EXTRUDER_AUTO_FAN_TEMPERATURE) 
340
+      fanState |= 1;
341
+  #endif
342
+  #if EXTRUDER_1_AUTO_FAN_PIN > 0
343
+    if (current_temperature[1] > EXTRUDER_AUTO_FAN_TEMPERATURE) 
344
+    {
345
+      if (EXTRUDER_1_AUTO_FAN_PIN == EXTRUDER_0_AUTO_FAN_PIN) 
346
+        fanState |= 1;
347
+      else
348
+        fanState |= 2;
349
+    }
350
+  #endif
351
+  #if EXTRUDER_2_AUTO_FAN_PIN > 0
352
+    if (current_temperature[2] > EXTRUDER_AUTO_FAN_TEMPERATURE) 
353
+    {
354
+      if (EXTRUDER_2_AUTO_FAN_PIN == EXTRUDER_0_AUTO_FAN_PIN) 
355
+        fanState |= 1;
356
+      else if (EXTRUDER_2_AUTO_FAN_PIN == EXTRUDER_1_AUTO_FAN_PIN) 
357
+        fanState |= 2;
358
+      else
359
+        fanState |= 4;
360
+    }
361
+  #endif
362
+  
363
+  // update extruder auto fan states
364
+  #if EXTRUDER_0_AUTO_FAN_PIN > 0
365
+    setExtruderAutoFanState(EXTRUDER_0_AUTO_FAN_PIN, (fanState & 1) != 0);
366
+  #endif 
367
+  #if EXTRUDER_1_AUTO_FAN_PIN > 0
368
+    if (EXTRUDER_1_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN) 
369
+      setExtruderAutoFanState(EXTRUDER_1_AUTO_FAN_PIN, (fanState & 2) != 0);
370
+  #endif 
371
+  #if EXTRUDER_2_AUTO_FAN_PIN > 0
372
+    if (EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN 
373
+        && EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_1_AUTO_FAN_PIN)
374
+      setExtruderAutoFanState(EXTRUDER_2_AUTO_FAN_PIN, (fanState & 4) != 0);
375
+  #endif 
376
+}
377
+
378
+#endif // any extruder auto fan pins set
379
+
309 380
 void manage_heater()
310 381
 {
311 382
   float pid_input;
@@ -398,8 +469,15 @@ void manage_heater()
398 469
     #endif
399 470
 
400 471
   } // End extruder for loop
401
-  
402 472
 
473
+  #if EXTRUDER_0_AUTO_FAN_PIN > 0 || EXTRUDER_1_AUTO_FAN_PIN > 0 || EXTRUDER_2_AUTO_FAN_PIN > 0
474
+  if(millis() - extruder_autofan_last_check > 2500)  // only need to check fan state very infrequently
475
+  {
476
+    checkExtruderAutoFans();
477
+    extruder_autofan_last_check = millis();
478
+  }  
479
+  #endif       
480
+  
403 481
   #ifndef PIDTEMPBED
404 482
   if(millis() - previous_millis_bed_heater < BED_CHECK_INTERVAL)
405 483
     return;

+ 227
- 223
README.md Ver arquivo

@@ -1,223 +1,227 @@
1
-WARNING: 
2
---------
3
-THIS IS RELEASE CANDIDATE 2 FOR MARLIN 1.0.0
4
-
5
-The configuration is now split in two files
6
-Configuration.h for the normal settings
7
-Configuration_adv.h for the advanced settings
8
-
9
-Gen7T is not supported.
10
-
11
-Quick Information
12
-===================
13
-This RepRap firmware is a mashup between <a href="https://github.com/kliment/Sprinter">Sprinter</a>, <a href="https://github.com/simen/grbl/tree">grbl</a> and many original parts.
14
-
15
-Derived from Sprinter and Grbl by Erik van der Zalm.
16
-Sprinters lead developers are Kliment and caru.
17
-Grbls lead developer is Simen Svale Skogsrud. Sonney Jeon (Chamnit) improved some parts of grbl
18
-A fork by bkubicek for the Ultimaker was merged, and further development was aided by him.
19
-Some features have been added by:
20
-Lampmaker, Bradley Feldman, and others...
21
-
22
-
23
-Features:
24
-
25
-*   Interrupt based movement with real linear acceleration
26
-*   High steprate
27
-*   Look ahead (Keep the speed high when possible. High cornering speed)
28
-*   Interrupt based temperature protection
29
-*   preliminary support for Matthew Roberts advance algorithm 
30
-    For more info see: http://reprap.org/pipermail/reprap-dev/2011-May/003323.html
31
-*   Full endstop support
32
-*   SD Card support
33
-*   SD Card folders (works in pronterface)
34
-*   SD Card autostart support
35
-*   LCD support (ideally 20x4) 
36
-*   LCD menu system for autonomous SD card printing, controlled by an click-encoder. 
37
-*   EEPROM storage of e.g. max-velocity, max-acceleration, and similar variables
38
-*   many small but handy things originating from bkubicek's fork.
39
-*   Arc support
40
-*   Temperature oversampling
41
-*   Dynamic Temperature setpointing aka "AutoTemp"
42
-*   Support for QTMarlin, a very beta GUI for PID-tuning and velocity-acceleration testing. https://github.com/bkubicek/QTMarlin
43
-*   Endstop trigger reporting to the host software.
44
-*   Updated sdcardlib
45
-*   Heater power reporting. Useful for PID monitoring.
46
-*   PID tuning
47
-*   CoreXY kinematics (www.corexy.com/theory.html)
48
-*   Configurable serial port to support connection of wireless adaptors.
49
-
50
-The default baudrate is 250000. This baudrate has less jitter and hence errors than the usual 115200 baud, but is less supported by drivers and host-environments.
51
-
52
-
53
-Differences and additions to the already good Sprinter firmware:
54
-================================================================
55
-
56
-*Look-ahead:*
57
-
58
-Marlin has look-ahead. While sprinter has to break and re-accelerate at each corner, 
59
-lookahead will only decelerate and accelerate to a velocity, 
60
-so that the change in vectorial velocity magnitude is less than the xy_jerk_velocity.
61
-This is only possible, if some future moves are already processed, hence the name. 
62
-It leads to less over-deposition at corners, especially at flat angles.
63
-
64
-*Arc support:*
65
-
66
-Slic3r can find curves that, although broken into segments, were ment to describe an arc.
67
-Marlin is able to print those arcs. The advantage is the firmware can choose the resolution,
68
-and can perform the arc with nearly constant velocity, resulting in a nice finish. 
69
-Also, less serial communication is needed.
70
-
71
-*Temperature Oversampling:*
72
-
73
-To reduce noise and make the PID-differential term more useful, 16 ADC conversion results are averaged.
74
-
75
-*AutoTemp:*
76
-
77
-If your gcode contains a wide spread of extruder velocities, or you realtime change the building speed, the temperature should be changed accordingly.
78
-Usually, higher speed requires higher temperature.
79
-This can now be performed by the AutoTemp function
80
-By calling M109 S<mintemp> T<maxtemp> F<factor> you enter the autotemp mode.
81
-
82
-You can leave it by calling M109 without any F.
83
-If active, the maximal extruder stepper rate of all buffered moves will be calculated, and named "maxerate" [steps/sec].
84
-The wanted temperature then will be set to t=tempmin+factor*maxerate, while being limited between tempmin and tempmax.
85
-If the target temperature is set manually or by gcode to a value less then tempmin, it will be kept without change.
86
-Ideally, your gcode can be completely free of temperature controls, apart from a M109 S T F in the start.gcode, and a M109 S0 in the end.gcode.
87
-
88
-*EEPROM:*
89
-
90
-If you know your PID values, the acceleration and max-velocities of your unique machine, you can set them, and finally store them in the EEPROM.
91
-After each reboot, it will magically load them from EEPROM, independent what your Configuration.h says.
92
-
93
-*LCD Menu:*
94
-
95
-If your hardware supports it, you can build yourself a LCD-CardReader+Click+encoder combination. It will enable you to realtime tune temperatures,
96
-accelerations, velocities, flow rates, select and print files from the SD card, preheat, disable the steppers, and do other fancy stuff.
97
-One working hardware is documented here: http://www.thingiverse.com/thing:12663 
98
-Also, with just a 20x4 or 16x2 display, useful data is shown.
99
-
100
-*SD card folders:*
101
-
102
-If you have an SD card reader attached to your controller, also folders work now. Listing the files in pronterface will show "/path/subpath/file.g".
103
-You can write to file in a subfolder by specifying a similar text using small letters in the path.
104
-Also, backup copies of various operating systems are hidden, as well as files not ending with ".g".
105
-
106
-*SD card folders:*
107
-
108
-If you place a file auto[0-9].g into the root of the sd card, it will be automatically executed if you boot the printer. The same file will be executed by selecting "Autostart" from the menu.
109
-First *0 will be performed, than *1 and so on. That way, you can heat up or even print automatically without user interaction.
110
-
111
-*Endstop trigger reporting:*
112
-
113
-If an endstop is hit while moving towards the endstop, the location at which the firmware thinks that the endstop was triggered is outputed on the serial port.
114
-This is useful, because the user gets a warning message.
115
-However, also tools like QTMarlin can use this for finding acceptable combinations of velocity+acceleration.
116
-
117
-*Coding paradigm:*
118
-
119
-Not relevant from a user side, but Marlin was split into thematic junks, and has tried to partially enforced private variables.
120
-This is intended to make it clearer, what interacts which what, and leads to a higher level of modularization.
121
-We think that this is a useful prestep for porting this firmware to e.g. an ARM platform in the future.
122
-A lot of RAM (with enabled LCD ~2200 bytes) was saved by storing char []="some message" in Program memory.
123
-In the serial communication, a #define based level of abstraction was enforced, so that it is clear that
124
-some transfer is information (usually beginning with "echo:"), an error "error:", or just normal protocol,
125
-necessary for backwards compatibility.
126
-
127
-*Interrupt based temperature measurements:*
128
-
129
-An interrupt is used to manage ADC conversions, and enforce checking for critical temperatures.
130
-This leads to less blocking in the heater management routine.
131
-
132
-
133
-Non-standard M-Codes, different to an old version of sprinter:
134
-==============================================================
135
-Movement:
136
-
137
-*   G2  - CW ARC
138
-*   G3  - CCW ARC
139
-
140
-General:
141
-
142
-*   M17  - Enable/Power all stepper motors. Compatibility to ReplicatorG.
143
-*   M18  - Disable all stepper motors; same as M84.Compatibility to ReplicatorG.
144
-*   M30  - Print time since last M109 or SD card start to serial
145
-*   M42  - Change pin status via gcode
146
-*   M80  - Turn on Power Supply
147
-*   M81  - Turn off Power Supply
148
-*   M114 - Output current position to serial port 
149
-*   M119 - Output Endstop status to serial port
150
-
151
-Movement variables:
152
-
153
-*   M202 - Set max acceleration in units/s^2 for travel moves (M202 X1000 Y1000) Unused in Marlin!!
154
-*   M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec
155
-*   M204 - Set default acceleration: S normal moves T filament only moves (M204 S3000 T7000) im mm/sec^2  also sets minimum segment time in ms (B20000) to prevent buffer underruns and M20 minimum feedrate
156
-*   M206 - set home offsets.  This sets the X,Y,Z coordinates of the endstops (and is added to the {X,Y,Z}_HOME_POS configuration options (and is also added to the coordinates, if any, provided to G82, as with earlier firmware)
157
-*   M220 - set build speed mulitplying S:factor in percent ; aka "realtime tuneing in the gcode". So you can slow down if you have islands in one height-range, and speed up otherwise.
158
-*   M221 - set the extrude multiplying S:factor in percent
159
-*   M400 - Finish all buffered moves.
160
-
161
-Temperature variables:
162
-*   M301 - Set PID parameters P I and D
163
-*   M302 - Allow cold extrudes
164
-*   M303 - PID relay autotune S<temperature> sets the target temperature. (default target temperature = 150C)
165
-
166
-Advance:
167
-
168
-*   M200 - Set filament diameter for advance
169
-*   M205 - advanced settings:  minimum travel speed S=while printing T=travel only,  B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk
170
-
171
-EEPROM:
172
-
173
-*   M500 - stores paramters in EEPROM. This parameters are stored:  axis_steps_per_unit,  max_feedrate, max_acceleration  ,acceleration,retract_acceleration,
174
-  minimumfeedrate,mintravelfeedrate,minsegmenttime,  jerk velocities, PID
175
-*   M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).  
176
-*   M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
177
-*   M503 - print the current settings (from memory not from eeprom)
178
-
179
-MISC:
180
-
181
-*   M240 - Trigger a camera to take a photograph
182
-*   M999 - Restart after being stopped by error
183
-
184
-Configuring and compilation:
185
-============================
186
-
187
-Install the arduino software IDE/toolset v23 (Some configurations also work with 1.x.x)
188
-   http://www.arduino.cc/en/Main/Software
189
-
190
-For gen6/gen7 and sanguinololu the Sanguino directory in the Marlin dir needs to be copied to the arduino environment.
191
-  copy ArduinoAddons\Arduino_x.x.x\sanguino <arduino home>\hardware\Sanguino
192
-
193
-Install Ultimaker's RepG 25 build
194
-    http://software.ultimaker.com
195
-For SD handling and as better substitute (apart from stl manipulation) download
196
-the very nice Kliment's printrun/pronterface  https://github.com/kliment/Printrun
197
-
198
-Copy the Ultimaker Marlin firmware
199
-   https://github.com/ErikZalm/Marlin/tree/Marlin_v1
200
-   (Use the download button)
201
-
202
-Start the arduino IDE.
203
-Select Tools -> Board -> Arduino Mega 2560    or your microcontroller
204
-Select the correct serial port in Tools ->Serial Port
205
-Open Marlin.pde
206
-
207
-Click the Verify/Compile button
208
-
209
-Click the Upload button
210
-If all goes well the firmware is uploading
211
-
212
-Start Ultimaker's Custom RepG 25
213
-Make sure Show Experimental Profiles is enabled in Preferences
214
-Select Sprinter as the Driver
215
-
216
-Press the Connect button.
217
-
218
-KNOWN ISSUES: RepG will display:  Unknown: marlin x.y.z
219
-
220
-That's ok.  Enjoy Silky Smooth Printing.
221
-
222
-
223
-
1
+==========================
2
+Marlin 3D Printer Firmware
3
+==========================
4
+
5
+Notes: 
6
+-----
7
+
8
+The configuration is now split in two files:
9
+  Configuration.h for the normal settings
10
+  Configuration_adv.h for the advanced settings
11
+
12
+Gen7T is not supported.
13
+
14
+Quick Information
15
+===================
16
+This RepRap firmware is a mashup between <a href="https://github.com/kliment/Sprinter">Sprinter</a>, <a href="https://github.com/simen/grbl/tree">grbl</a> and many original parts.
17
+
18
+Derived from Sprinter and Grbl by Erik van der Zalm.
19
+Sprinters lead developers are Kliment and caru.
20
+Grbls lead developer is Simen Svale Skogsrud. Sonney Jeon (Chamnit) improved some parts of grbl
21
+A fork by bkubicek for the Ultimaker was merged, and further development was aided by him.
22
+Some features have been added by:
23
+Lampmaker, Bradley Feldman, and others...
24
+
25
+
26
+Features:
27
+
28
+*   Interrupt based movement with real linear acceleration
29
+*   High steprate
30
+*   Look ahead (Keep the speed high when possible. High cornering speed)
31
+*   Interrupt based temperature protection
32
+*   preliminary support for Matthew Roberts advance algorithm 
33
+    For more info see: http://reprap.org/pipermail/reprap-dev/2011-May/003323.html
34
+*   Full endstop support
35
+*   SD Card support
36
+*   SD Card folders (works in pronterface)
37
+*   SD Card autostart support
38
+*   LCD support (ideally 20x4) 
39
+*   LCD menu system for autonomous SD card printing, controlled by an click-encoder. 
40
+*   EEPROM storage of e.g. max-velocity, max-acceleration, and similar variables
41
+*   many small but handy things originating from bkubicek's fork.
42
+*   Arc support
43
+*   Temperature oversampling
44
+*   Dynamic Temperature setpointing aka "AutoTemp"
45
+*   Support for QTMarlin, a very beta GUI for PID-tuning and velocity-acceleration testing. https://github.com/bkubicek/QTMarlin
46
+*   Endstop trigger reporting to the host software.
47
+*   Updated sdcardlib
48
+*   Heater power reporting. Useful for PID monitoring.
49
+*   PID tuning
50
+*   CoreXY kinematics (www.corexy.com/theory.html)
51
+*   Configurable serial port to support connection of wireless adaptors.
52
+*   Automatic operation of extruder/cold-end cooling fans based on nozzle temperature
53
+
54
+The default baudrate is 250000. This baudrate has less jitter and hence errors than the usual 115200 baud, but is less supported by drivers and host-environments.
55
+
56
+
57
+Differences and additions to the already good Sprinter firmware:
58
+================================================================
59
+
60
+*Look-ahead:*
61
+
62
+Marlin has look-ahead. While sprinter has to break and re-accelerate at each corner, 
63
+lookahead will only decelerate and accelerate to a velocity, 
64
+so that the change in vectorial velocity magnitude is less than the xy_jerk_velocity.
65
+This is only possible, if some future moves are already processed, hence the name. 
66
+It leads to less over-deposition at corners, especially at flat angles.
67
+
68
+*Arc support:*
69
+
70
+Slic3r can find curves that, although broken into segments, were ment to describe an arc.
71
+Marlin is able to print those arcs. The advantage is the firmware can choose the resolution,
72
+and can perform the arc with nearly constant velocity, resulting in a nice finish. 
73
+Also, less serial communication is needed.
74
+
75
+*Temperature Oversampling:*
76
+
77
+To reduce noise and make the PID-differential term more useful, 16 ADC conversion results are averaged.
78
+
79
+*AutoTemp:*
80
+
81
+If your gcode contains a wide spread of extruder velocities, or you realtime change the building speed, the temperature should be changed accordingly.
82
+Usually, higher speed requires higher temperature.
83
+This can now be performed by the AutoTemp function
84
+By calling M109 S<mintemp> T<maxtemp> F<factor> you enter the autotemp mode.
85
+
86
+You can leave it by calling M109 without any F.
87
+If active, the maximal extruder stepper rate of all buffered moves will be calculated, and named "maxerate" [steps/sec].
88
+The wanted temperature then will be set to t=tempmin+factor*maxerate, while being limited between tempmin and tempmax.
89
+If the target temperature is set manually or by gcode to a value less then tempmin, it will be kept without change.
90
+Ideally, your gcode can be completely free of temperature controls, apart from a M109 S T F in the start.gcode, and a M109 S0 in the end.gcode.
91
+
92
+*EEPROM:*
93
+
94
+If you know your PID values, the acceleration and max-velocities of your unique machine, you can set them, and finally store them in the EEPROM.
95
+After each reboot, it will magically load them from EEPROM, independent what your Configuration.h says.
96
+
97
+*LCD Menu:*
98
+
99
+If your hardware supports it, you can build yourself a LCD-CardReader+Click+encoder combination. It will enable you to realtime tune temperatures,
100
+accelerations, velocities, flow rates, select and print files from the SD card, preheat, disable the steppers, and do other fancy stuff.
101
+One working hardware is documented here: http://www.thingiverse.com/thing:12663 
102
+Also, with just a 20x4 or 16x2 display, useful data is shown.
103
+
104
+*SD card folders:*
105
+
106
+If you have an SD card reader attached to your controller, also folders work now. Listing the files in pronterface will show "/path/subpath/file.g".
107
+You can write to file in a subfolder by specifying a similar text using small letters in the path.
108
+Also, backup copies of various operating systems are hidden, as well as files not ending with ".g".
109
+
110
+*SD card folders:*
111
+
112
+If you place a file auto[0-9].g into the root of the sd card, it will be automatically executed if you boot the printer. The same file will be executed by selecting "Autostart" from the menu.
113
+First *0 will be performed, than *1 and so on. That way, you can heat up or even print automatically without user interaction.
114
+
115
+*Endstop trigger reporting:*
116
+
117
+If an endstop is hit while moving towards the endstop, the location at which the firmware thinks that the endstop was triggered is outputed on the serial port.
118
+This is useful, because the user gets a warning message.
119
+However, also tools like QTMarlin can use this for finding acceptable combinations of velocity+acceleration.
120
+
121
+*Coding paradigm:*
122
+
123
+Not relevant from a user side, but Marlin was split into thematic junks, and has tried to partially enforced private variables.
124
+This is intended to make it clearer, what interacts which what, and leads to a higher level of modularization.
125
+We think that this is a useful prestep for porting this firmware to e.g. an ARM platform in the future.
126
+A lot of RAM (with enabled LCD ~2200 bytes) was saved by storing char []="some message" in Program memory.
127
+In the serial communication, a #define based level of abstraction was enforced, so that it is clear that
128
+some transfer is information (usually beginning with "echo:"), an error "error:", or just normal protocol,
129
+necessary for backwards compatibility.
130
+
131
+*Interrupt based temperature measurements:*
132
+
133
+An interrupt is used to manage ADC conversions, and enforce checking for critical temperatures.
134
+This leads to less blocking in the heater management routine.
135
+
136
+
137
+Non-standard M-Codes, different to an old version of sprinter:
138
+==============================================================
139
+Movement:
140
+
141
+*   G2  - CW ARC
142
+*   G3  - CCW ARC
143
+
144
+General:
145
+
146
+*   M17  - Enable/Power all stepper motors. Compatibility to ReplicatorG.
147
+*   M18  - Disable all stepper motors; same as M84.Compatibility to ReplicatorG.
148
+*   M30  - Print time since last M109 or SD card start to serial
149
+*   M42  - Change pin status via gcode
150
+*   M80  - Turn on Power Supply
151
+*   M81  - Turn off Power Supply
152
+*   M114 - Output current position to serial port 
153
+*   M119 - Output Endstop status to serial port
154
+
155
+Movement variables:
156
+
157
+*   M202 - Set max acceleration in units/s^2 for travel moves (M202 X1000 Y1000) Unused in Marlin!!
158
+*   M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec
159
+*   M204 - Set default acceleration: S normal moves T filament only moves (M204 S3000 T7000) im mm/sec^2  also sets minimum segment time in ms (B20000) to prevent buffer underruns and M20 minimum feedrate
160
+*   M206 - set home offsets.  This sets the X,Y,Z coordinates of the endstops (and is added to the {X,Y,Z}_HOME_POS configuration options (and is also added to the coordinates, if any, provided to G82, as with earlier firmware)
161
+*   M220 - set build speed mulitplying S:factor in percent ; aka "realtime tuneing in the gcode". So you can slow down if you have islands in one height-range, and speed up otherwise.
162
+*   M221 - set the extrude multiplying S:factor in percent
163
+*   M400 - Finish all buffered moves.
164
+
165
+Temperature variables:
166
+*   M301 - Set PID parameters P I and D
167
+*   M302 - Allow cold extrudes
168
+*   M303 - PID relay autotune S<temperature> sets the target temperature. (default target temperature = 150C)
169
+
170
+Advance:
171
+
172
+*   M200 - Set filament diameter for advance
173
+*   M205 - advanced settings:  minimum travel speed S=while printing T=travel only,  B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk
174
+
175
+EEPROM:
176
+
177
+*   M500 - stores paramters in EEPROM. This parameters are stored:  axis_steps_per_unit,  max_feedrate, max_acceleration  ,acceleration,retract_acceleration,
178
+  minimumfeedrate,mintravelfeedrate,minsegmenttime,  jerk velocities, PID
179
+*   M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).  
180
+*   M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
181
+*   M503 - print the current settings (from memory not from eeprom)
182
+
183
+MISC:
184
+
185
+*   M240 - Trigger a camera to take a photograph
186
+*   M999 - Restart after being stopped by error
187
+
188
+Configuring and compilation:
189
+============================
190
+
191
+Install the arduino software IDE/toolset v23 (Some configurations also work with 1.x.x)
192
+   http://www.arduino.cc/en/Main/Software
193
+
194
+For gen6/gen7 and sanguinololu the Sanguino directory in the Marlin dir needs to be copied to the arduino environment.
195
+  copy ArduinoAddons\Arduino_x.x.x\sanguino <arduino home>\hardware\Sanguino
196
+
197
+Install Ultimaker's RepG 25 build
198
+    http://software.ultimaker.com
199
+For SD handling and as better substitute (apart from stl manipulation) download
200
+the very nice Kliment's printrun/pronterface  https://github.com/kliment/Printrun
201
+
202
+Copy the Ultimaker Marlin firmware
203
+   https://github.com/ErikZalm/Marlin/tree/Marlin_v1
204
+   (Use the download button)
205
+
206
+Start the arduino IDE.
207
+Select Tools -> Board -> Arduino Mega 2560    or your microcontroller
208
+Select the correct serial port in Tools ->Serial Port
209
+Open Marlin.pde
210
+
211
+Click the Verify/Compile button
212
+
213
+Click the Upload button
214
+If all goes well the firmware is uploading
215
+
216
+Start Ultimaker's Custom RepG 25
217
+Make sure Show Experimental Profiles is enabled in Preferences
218
+Select Sprinter as the Driver
219
+
220
+Press the Connect button.
221
+
222
+KNOWN ISSUES: RepG will display:  Unknown: marlin x.y.z
223
+
224
+That's ok.  Enjoy Silky Smooth Printing.
225
+
226
+
227
+

Carregando…
Cancelar
Salvar