Browse Source

Merge github.com:ErikZalm/Marlin into Marlin_v1

Guillaume Seguin 11 years ago
parent
commit
18199ff960
32 changed files with 2596 additions and 1563 deletions
  1. 1
    1
      ArduinoAddons/Arduino_0.xx/Gen6/bootloaders/atmega644p/ATmegaBOOT.c
  2. 1
    1
      ArduinoAddons/Arduino_0.xx/Sanguino/bootloaders/atmega644p/ATmegaBOOT.c
  3. 1
    1
      ArduinoAddons/Arduino_0.xx/libraries/LiquidCrystal/LiquidCrystal.cpp
  4. 1
    1
      ArduinoAddons/Arduino_0.xx/libraries/U8glib/utility/chessengine.c
  5. 1
    1
      ArduinoAddons/Arduino_1.x.x/libraries/LiquidCrystal/LiquidCrystal.cpp
  6. 1
    1
      ArduinoAddons/Arduino_1.x.x/libraries/U8glib/utility/chessengine.c
  7. 1
    1
      ArduinoAddons/Arduino_1.x.x/sanguino/bootloaders/atmega/ATmegaBOOT_168.c
  8. 1
    1
      ArduinoAddons/Arduino_1.x.x/sanguino/bootloaders/atmega644p/ATmegaBOOT.c
  9. 1
    1
      ArduinoAddons/Arduino_1.x.x/sanguino/bootloaders/atmega644p/ATmegaBOOT.c.tst
  10. 138
    35
      Marlin/Configuration.h
  11. 12
    1
      Marlin/ConfigurationStore.cpp
  12. 28
    6
      Marlin/Configuration_adv.h
  13. 1
    1
      Marlin/LiquidCrystalRus.cpp
  14. 8
    2
      Marlin/Makefile
  15. 12
    1
      Marlin/Marlin.h
  16. 286
    35
      Marlin/Marlin_main.cpp
  17. 2
    0
      Marlin/Servo.cpp
  18. 13
    7
      Marlin/cardreader.cpp
  19. 4
    1
      Marlin/cardreader.h
  20. 17
    6
      Marlin/dogm_lcd_implementation.h
  21. 134
    113
      Marlin/language.h
  22. 374
    128
      Marlin/pins.h
  23. 53
    27
      Marlin/planner.cpp
  24. 3
    1
      Marlin/planner.h
  25. 93
    110
      Marlin/stepper.cpp
  26. 89
    52
      Marlin/temperature.cpp
  27. 3
    0
      Marlin/temperature.h
  28. 128
    52
      Marlin/ultralcd.cpp
  29. 49
    1
      Marlin/ultralcd.h
  30. 757
    748
      Marlin/ultralcd_implementation_hitachi_HD44780.h
  31. 131
    0
      Marlin/ultralcd_st7920_u8glib_rrd.h
  32. 252
    227
      README.md

+ 1
- 1
ArduinoAddons/Arduino_0.xx/Gen6/bootloaders/atmega644p/ATmegaBOOT.c View File

@@ -168,7 +168,7 @@ int main(void)
168 168
     WDTCSR = 0;
169 169
 
170 170
     // Check if the WDT was used to reset, in which case we dont bootload and skip straight to the code. woot.
171
-    if (! (ch &  _BV(EXTRF))) // if its a not an external reset...
171
+    if (! (ch &  _BV(EXTRF))) // if it's a not an external reset...
172 172
       app_start();  // skip bootloader
173 173
 #endif
174 174
 

+ 1
- 1
ArduinoAddons/Arduino_0.xx/Sanguino/bootloaders/atmega644p/ATmegaBOOT.c View File

@@ -168,7 +168,7 @@ int main(void)
168 168
     WDTCSR = 0;
169 169
 
170 170
     // Check if the WDT was used to reset, in which case we dont bootload and skip straight to the code. woot.
171
-    if (! (ch &  _BV(EXTRF))) // if its a not an external reset...
171
+    if (! (ch &  _BV(EXTRF))) // if it's a not an external reset...
172 172
       app_start();  // skip bootloader
173 173
 #endif
174 174
 

+ 1
- 1
ArduinoAddons/Arduino_0.xx/libraries/LiquidCrystal/LiquidCrystal.cpp View File

@@ -21,7 +21,7 @@
21 21
 //    S = 0; No shift 
22 22
 //
23 23
 // Note, however, that resetting the Arduino doesn't reset the LCD, so we
24
-// can't assume that its in that state when a sketch starts (and the
24
+// can't assume that it's in that state when a sketch starts (and the
25 25
 // LiquidCrystal constructor is called).
26 26
 
27 27
 LiquidCrystal::LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,

+ 1
- 1
ArduinoAddons/Arduino_0.xx/libraries/U8glib/utility/chessengine.c View File

@@ -72,7 +72,7 @@
72 72
 	- Castling: Need to check for fields under attack
73 73
 	    --> done
74 74
 	
75
-	- Check for WIN / LOOSE situation, perhaps call ce_Eval() once on the top-level board setup
75
+	- Check for WIN / LOSE situation, perhaps call ce_Eval() once on the top-level board setup
76 76
 	    just after the real move
77 77
 	- cleanup cu_Move
78 78
 	    --> almost done

+ 1
- 1
ArduinoAddons/Arduino_1.x.x/libraries/LiquidCrystal/LiquidCrystal.cpp View File

@@ -21,7 +21,7 @@
21 21
 //    S = 0; No shift 
22 22
 //
23 23
 // Note, however, that resetting the Arduino doesn't reset the LCD, so we
24
-// can't assume that its in that state when a sketch starts (and the
24
+// can't assume that it's in that state when a sketch starts (and the
25 25
 // LiquidCrystal constructor is called).
26 26
 
27 27
 LiquidCrystal::LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,

+ 1
- 1
ArduinoAddons/Arduino_1.x.x/libraries/U8glib/utility/chessengine.c View File

@@ -72,7 +72,7 @@
72 72
 	- Castling: Need to check for fields under attack
73 73
 	    --> done
74 74
 	
75
-	- Check for WIN / LOOSE situation, perhaps call ce_Eval() once on the top-level board setup
75
+	- Check for WIN / LOSE situation, perhaps call ce_Eval() once on the top-level board setup
76 76
 	    just after the real move
77 77
 	- cleanup cu_Move
78 78
 	    --> almost done

+ 1
- 1
ArduinoAddons/Arduino_1.x.x/sanguino/bootloaders/atmega/ATmegaBOOT_168.c View File

@@ -301,7 +301,7 @@ int main(void)
301 301
 	WDTCSR = 0;
302 302
 
303 303
 	// Check if the WDT was used to reset, in which case we dont bootload and skip straight to the code. woot.
304
-	if (! (ch &  _BV(EXTRF))) // if its a not an external reset...
304
+	if (! (ch &  _BV(EXTRF))) // if it's a not an external reset...
305 305
 		app_start();  // skip bootloader
306 306
 #else
307 307
 	asm volatile("nop\n\t");

+ 1
- 1
ArduinoAddons/Arduino_1.x.x/sanguino/bootloaders/atmega644p/ATmegaBOOT.c View File

@@ -172,7 +172,7 @@ int main(void)
172 172
     WDTCSR = 0;
173 173
 
174 174
     // Check if the WDT was used to reset, in which case we dont bootload and skip straight to the code. woot.
175
-    if (! (ch &  _BV(EXTRF))) // if its a not an external reset...
175
+    if (! (ch &  _BV(EXTRF))) // if it's a not an external reset...
176 176
       app_start();  // skip bootloader
177 177
 #endif
178 178
 

+ 1
- 1
ArduinoAddons/Arduino_1.x.x/sanguino/bootloaders/atmega644p/ATmegaBOOT.c.tst View File

@@ -172,7 +172,7 @@ int main(void)
172 172
     WDTCSR = 0;
173 173
 
174 174
     // Check if the WDT was used to reset, in which case we dont bootload and skip straight to the code. woot.
175
-    if (! (ch &  _BV(EXTRF))) // if its a not an external reset...
175
+    if (! (ch &  _BV(EXTRF))) // if it's a not an external reset...
176 176
       app_start();  // skip bootloader
177 177
 #endif
178 178
 

+ 138
- 35
Marlin/Configuration.h View File

@@ -1,15 +1,15 @@
1 1
 #ifndef CONFIGURATION_H
2 2
 #define CONFIGURATION_H
3 3
 
4
-// This configurtion file contains the basic settings.
4
+// This configuration file contains the basic settings.
5 5
 // Advanced settings can be found in Configuration_adv.h
6 6
 // BASIC SETTINGS: select your board type, temperature sensor type, axis scaling, and endstop configuration
7 7
 
8
-//User specified version info of this build to display in [Pronterface, etc] terminal window during startup.
9
-//Implementation of an idea by Prof Braino to inform user that any changes made
10
-//to this build by the user have been successfully uploaded into firmware.
8
+// User-specified version info of this build to display in [Pronterface, etc] terminal window during
9
+// startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
10
+// build by the user have been successfully uploaded into firmware.
11 11
 #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time
12
-#define STRING_CONFIG_H_AUTHOR "(none, default config)" //Who made the changes.
12
+#define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes.
13 13
 
14 14
 // SERIAL_PORT selects which serial port should be used for communication with the host.
15 15
 // This allows the connection of wireless adapters (for instance) to non-default port pins.
@@ -26,7 +26,7 @@
26 26
 // 12 = Gen7 v1.3
27 27
 // 13 = Gen7 v1.4
28 28
 // 3  = MEGA/RAMPS up to 1.2 = 3
29
-// 33 = RAMPS 1.3 / 1.4 (Power outputs: Extruder, Bed, Fan)
29
+// 33 = RAMPS 1.3 / 1.4 (Power outputs: Extruder, Fan, Bed)
30 30
 // 34 = RAMPS 1.3 / 1.4 (Power outputs: Extruder0, Extruder1, Bed)
31 31
 // 4  = Duemilanove w/ ATMega328P pin assignment
32 32
 // 5  = Gen6
@@ -35,8 +35,11 @@
35 35
 // 62 = Sanguinololu 1.2 and above
36 36
 // 63 = Melzi
37 37
 // 64 = STB V1.1
38
+// 65 = Azteeg X1
39
+// 66 = Melzi with ATmega1284 (MaKr3d version)
38 40
 // 7  = Ultimaker
39 41
 // 71 = Ultimaker (Older electronics. Pre 1.5.4. This is rare)
42
+// 77 = 3Drag Controller
40 43
 // 8  = Teensylu
41 44
 // 80 = Rumba
42 45
 // 81 = Printrboard (AT90USB1286)
@@ -48,11 +51,15 @@
48 51
 // 90 = Alpha OMCA board
49 52
 // 91 = Final OMCA board
50 53
 // 301 = Rambo
54
+// 21 = Elefu Ra Board (v3)
51 55
 
52 56
 #ifndef MOTHERBOARD
53 57
 #define MOTHERBOARD 7
54 58
 #endif
55 59
 
60
+// Define this to set a custom name for your generic Mendel,
61
+// #define CUSTOM_MENDEL_NAME "This Mendel"
62
+
56 63
 // This defines the number of extruders
57 64
 #define EXTRUDERS 1
58 65
 
@@ -62,6 +69,43 @@
62 69
 
63 70
 #define POWER_SUPPLY 1
64 71
 
72
+
73
+//===========================================================================
74
+//============================== Delta Settings =============================
75
+//===========================================================================
76
+// Enable DELTA kinematics
77
+//#define DELTA
78
+
79
+// Make delta curves from many straight lines (linear interpolation).
80
+// This is a trade-off between visible corners (not enough segments)
81
+// and processor overload (too many expensive sqrt calls).
82
+#define DELTA_SEGMENTS_PER_SECOND 200
83
+
84
+// Center-to-center distance of the holes in the diagonal push rods.
85
+#define DELTA_DIAGONAL_ROD 250.0 // mm
86
+
87
+// Horizontal offset from middle of printer to smooth rod center.
88
+#define DELTA_SMOOTH_ROD_OFFSET 175.0 // mm
89
+
90
+// Horizontal offset of the universal joints on the end effector.
91
+#define DELTA_EFFECTOR_OFFSET 33.0 // mm
92
+
93
+// Horizontal offset of the universal joints on the carriages.
94
+#define DELTA_CARRIAGE_OFFSET 18.0 // mm
95
+
96
+// Effective horizontal distance bridged by diagonal push rods.
97
+#define DELTA_RADIUS (DELTA_SMOOTH_ROD_OFFSET-DELTA_EFFECTOR_OFFSET-DELTA_CARRIAGE_OFFSET)
98
+
99
+// Effective X/Y positions of the three vertical towers.
100
+#define SIN_60 0.8660254037844386
101
+#define COS_60 0.5
102
+#define DELTA_TOWER1_X -SIN_60*DELTA_RADIUS // front left tower
103
+#define DELTA_TOWER1_Y -COS_60*DELTA_RADIUS
104
+#define DELTA_TOWER2_X SIN_60*DELTA_RADIUS // front right tower
105
+#define DELTA_TOWER2_Y -COS_60*DELTA_RADIUS
106
+#define DELTA_TOWER3_X 0.0 // back middle tower
107
+#define DELTA_TOWER3_Y DELTA_RADIUS
108
+
65 109
 //===========================================================================
66 110
 //=============================Thermal Settings  ============================
67 111
 //===========================================================================
@@ -82,6 +126,7 @@
82 126
 // 8 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup)
83 127
 // 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup)
84 128
 // 10 is 100k RS thermistor 198-961 (4.7k pullup)
129
+// 60 is 100k Maker's Tool Works Kapton Bed Thermister
85 130
 //
86 131
 //    1k ohm pullup tables - This is not normal, you would have to have changed out your 4.7k for 1k
87 132
 //                          (but gives greater accuracy and more stable PID)
@@ -90,14 +135,18 @@
90 135
 // 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan) (1k pullup)
91 136
 
92 137
 #define TEMP_SENSOR_0 -1
93
-#define TEMP_SENSOR_1 0
138
+#define TEMP_SENSOR_1 -1
94 139
 #define TEMP_SENSOR_2 0
95 140
 #define TEMP_SENSOR_BED 0
96 141
 
142
+// This makes temp sensor 1 a redundant sensor for sensor 0. If the temperatures difference between these sensors is to high the print will be aborted.
143
+//#define TEMP_SENSOR_1_AS_REDUNDANT 
144
+#define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10
145
+
97 146
 // Actual temperature must be close to target for this long before M109 returns success
98 147
 #define TEMP_RESIDENCY_TIME 10  // (seconds)
99 148
 #define TEMP_HYSTERESIS 3       // (degC) range of +/- temperatures considered "close" to the target one
100
-#define TEMP_WINDOW     1       // (degC) Window around target to start the recidency timer x degC early.
149
+#define TEMP_WINDOW     1       // (degC) Window around target to start the residency timer x degC early.
101 150
 
102 151
 // The minimal temperature defines the temperature below which the heater will not be enabled It is used
103 152
 // to check that the wiring to the thermistor is not broken.
@@ -123,15 +172,15 @@
123 172
 // PID settings:
124 173
 // Comment the following line to disable PID and enable bang-bang.
125 174
 #define PIDTEMP
126
-#define BANG_MAX 256 // limits current to nozzle while in bang-bang mode; 256=full current
127
-#define PID_MAX 256 // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 256=full current
175
+#define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
176
+#define PID_MAX 255 // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
128 177
 #ifdef PIDTEMP
129 178
   //#define PID_DEBUG // Sends debug data to the serial port.
130 179
   //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
131 180
   #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
132 181
                                   // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
133 182
   #define PID_INTEGRAL_DRIVE_MAX 255  //limit for the integral term
134
-  #define K1 0.95 //smoothing factor withing the PID
183
+  #define K1 0.95 //smoothing factor within the PID
135 184
   #define PID_dT ((16.0 * 8.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine
136 185
 
137 186
 // If you are using a preconfigured hotend then you can use one of the value sets by uncommenting it
@@ -152,28 +201,28 @@
152 201
 #endif // PIDTEMP
153 202
 
154 203
 // Bed Temperature Control
155
-// Select PID or bang-bang with PIDTEMPBED.  If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis
204
+// Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis
156 205
 //
157
-// uncomment this to enable PID on the bed.   It uses the same frequency PWM as the extruder.
206
+// Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder.
158 207
 // If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz,
159 208
 // which is fine for driving a square wave into a resistive load and does not significantly impact you FET heating.
160 209
 // This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W heater.
161
-// If your configuration is significantly different than this and you don't understand the issues involved, you proabaly
210
+// If your configuration is significantly different than this and you don't understand the issues involved, you probably
162 211
 // shouldn't use bed PID until someone else verifies your hardware works.
163 212
 // If this is enabled, find your own PID constants below.
164 213
 //#define PIDTEMPBED
165 214
 //
166 215
 //#define BED_LIMIT_SWITCHING
167 216
 
168
-// This sets the max power delived to the bed, and replaces the HEATER_BED_DUTY_CYCLE_DIVIDER option.
217
+// This sets the max power delivered to the bed, and replaces the HEATER_BED_DUTY_CYCLE_DIVIDER option.
169 218
 // all forms of bed control obey this (PID, bang-bang, bang-bang with hysteresis)
170
-// setting this to anything other than 256 enables a form of PWM to the bed just like HEATER_BED_DUTY_CYCLE_DIVIDER did,
219
+// setting this to anything other than 255 enables a form of PWM to the bed just like HEATER_BED_DUTY_CYCLE_DIVIDER did,
171 220
 // so you shouldn't use it unless you are OK with PWM on your bed.  (see the comment on enabling PIDTEMPBED)
172
-#define MAX_BED_POWER 256 // limits duty cycle to bed; 256=full current
221
+#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current
173 222
 
174 223
 #ifdef PIDTEMPBED
175 224
 //120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
176
-//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, argressive factor of .15 (vs .1, 1, 10)
225
+//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)
177 226
     #define  DEFAULT_bedKp 10.00
178 227
     #define  DEFAULT_bedKi .023
179 228
     #define  DEFAULT_bedKd 305.4
@@ -205,17 +254,17 @@
205 254
 // Uncomment the following line to enable CoreXY kinematics
206 255
 // #define COREXY
207 256
 
208
-// corse Endstop Settings
257
+// coarse Endstop Settings
209 258
 #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
210 259
 
211 260
 #ifndef ENDSTOPPULLUPS
212
-  // fine Enstop settings: Individual Pullups. will be ignord if ENDSTOPPULLUPS is defined
213
-  #define ENDSTOPPULLUP_XMAX
214
-  #define ENDSTOPPULLUP_YMAX
215
-  #define ENDSTOPPULLUP_ZMAX
216
-  #define ENDSTOPPULLUP_XMIN
217
-  #define ENDSTOPPULLUP_YMIN
218
-  //#define ENDSTOPPULLUP_ZMIN
261
+  // fine Enstop settings: Individual Pullups. will be ignored if ENDSTOPPULLUPS is defined
262
+  // #define ENDSTOPPULLUP_XMAX
263
+  // #define ENDSTOPPULLUP_YMAX
264
+  // #define ENDSTOPPULLUP_ZMAX
265
+  // #define ENDSTOPPULLUP_XMIN
266
+  // #define ENDSTOPPULLUP_YMIN
267
+  // #define ENDSTOPPULLUP_ZMIN
219 268
 #endif
220 269
 
221 270
 #ifdef ENDSTOPPULLUPS
@@ -232,6 +281,12 @@ const bool X_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
232 281
 const bool Y_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops.
233 282
 const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops.
234 283
 //#define DISABLE_MAX_ENDSTOPS
284
+//#define DISABLE_MIN_ENDSTOPS
285
+
286
+// Disable max endstops for compatibility with endstop checking routine
287
+#if defined(COREXY) && !defined(DISABLE_MAX_ENDSTOPS)
288
+  #define DISABLE_MAX_ENDSTOPS
289
+#endif
235 290
 
236 291
 // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
237 292
 #define X_ENABLE_ON 0
@@ -258,8 +313,8 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
258 313
 #define Y_HOME_DIR -1
259 314
 #define Z_HOME_DIR -1
260 315
 
261
-#define min_software_endstops true //If true, axis won't move to coordinates less than HOME_POS.
262
-#define max_software_endstops true  //If true, axis won't move to coordinates greater than the defined lengths below.
316
+#define min_software_endstops true // If true, axis won't move to coordinates less than HOME_POS.
317
+#define max_software_endstops true  // If true, axis won't move to coordinates greater than the defined lengths below.
263 318
 // Travel limits after homing
264 319
 #define X_MAX_POS 205
265 320
 #define X_MIN_POS 0
@@ -277,9 +332,11 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
277 332
 //#define BED_CENTER_AT_0_0  // If defined, the center of the bed is at (X=0, Y=0)
278 333
 
279 334
 //Manual homing switch locations:
335
+// For deltabots this means top and center of the cartesian print volume.
280 336
 #define MANUAL_X_HOME_POS 0
281 337
 #define MANUAL_Y_HOME_POS 0
282 338
 #define MANUAL_Z_HOME_POS 0
339
+//#define MANUAL_Z_HOME_POS 402 // For delta: Distance between nozzle and print surface after homing.
283 340
 
284 341
 //// MOVEMENT SETTINGS
285 342
 #define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
@@ -287,12 +344,12 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
287 344
 
288 345
 // default settings
289 346
 
290
-#define DEFAULT_AXIS_STEPS_PER_UNIT   {78.7402,78.7402,200.0*8/3,760*1.1}  // default steps per unit for ultimaker
347
+#define DEFAULT_AXIS_STEPS_PER_UNIT   {78.7402,78.7402,200.0*8/3,760*1.1}  // default steps per unit for Ultimaker
291 348
 #define DEFAULT_MAX_FEEDRATE          {500, 500, 5, 25}    // (mm/sec)
292 349
 #define DEFAULT_MAX_ACCELERATION      {9000,9000,100,10000}    // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for skeinforge 40+, for older versions raise them a lot.
293 350
 
294 351
 #define DEFAULT_ACCELERATION          3000    // X, Y, Z and E max acceleration in mm/s^2 for printing moves
295
-#define DEFAULT_RETRACT_ACCELERATION  3000   // X, Y, Z and E max acceleration in mm/s^2 for r retracts
352
+#define DEFAULT_RETRACT_ACCELERATION  3000   // X, Y, Z and E max acceleration in mm/s^2 for retracts
296 353
 
297 354
 // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
298 355
 // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
@@ -300,7 +357,7 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
300 357
 // #define EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
301 358
 // #define EXTRUDER_OFFSET_Y {0.0, 5.00}  // (in mm) for each extruder, offset of the hotend on the Y axis
302 359
 
303
-// The speed change that does not require acceleration (i.e. the software might assume it can be done instanteneously)
360
+// The speed change that does not require acceleration (i.e. the software might assume it can be done instantaneously)
304 361
 #define DEFAULT_XYJERK                20.0    // (mm/sec)
305 362
 #define DEFAULT_ZJERK                 0.4     // (mm/sec)
306 363
 #define DEFAULT_EJERK                 5.0    // (mm/sec)
@@ -338,6 +395,10 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
338 395
 //#define ULTIMAKERCONTROLLER //as available from the ultimaker online store.
339 396
 //#define ULTIPANEL  //the ultipanel as on thingiverse
340 397
 
398
+// The MaKr3d Makr-Panel with graphic controller and SD support
399
+// http://reprap.org/wiki/MaKr3d_MaKrPanel
400
+//#define MAKRPANEL
401
+
341 402
 // The RepRapDiscount Smart Controller (white PCB)
342 403
 // http://reprap.org/wiki/RepRapDiscount_Smart_Controller
343 404
 //#define REPRAP_DISCOUNT_SMART_CONTROLLER
@@ -357,7 +418,20 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
357 418
 //#define REPRAPWORLD_KEYPAD
358 419
 //#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 // how much should be moved when a key is pressed, eg 10.0 means 10mm per click
359 420
 
421
+// The Elefu RA Board Control Panel
422
+// http://www.elefu.com/index.php?route=product/product&product_id=53
423
+// REMEMBER TO INSTALL LiquidCrystal_I2C.h in your ARUDINO library folder: https://github.com/kiyoshigawa/LiquidCrystal_I2C
424
+//#define RA_CONTROL_PANEL
425
+
360 426
 //automatic expansion
427
+#if defined (MAKRPANEL)
428
+ #define DOGLCD
429
+ #define SDSUPPORT
430
+ #define ULTIPANEL
431
+ #define NEWPANEL
432
+ #define DEFAULT_LCD_CONTRAST 17
433
+#endif
434
+
361 435
 #if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
362 436
  #define DOGLCD
363 437
  #define U8GLIB_ST7920
@@ -373,6 +447,12 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
373 447
   #define NEWPANEL
374 448
   #define ULTIPANEL
375 449
 #endif
450
+#if defined(RA_CONTROL_PANEL)
451
+ #define ULTIPANEL
452
+ #define NEWPANEL
453
+ #define LCD_I2C_TYPE_PCA8574
454
+ #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
455
+#endif
376 456
 
377 457
 //I2C PANELS
378 458
 
@@ -438,9 +518,27 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
438 518
   #endif
439 519
 #endif
440 520
 
521
+// default LCD contrast for dogm-like LCD displays
522
+#ifdef DOGLCD
523
+# ifndef DEFAULT_LCD_CONTRAST
524
+#  define DEFAULT_LCD_CONTRAST 32
525
+# endif
526
+#endif
527
+
441 528
 // Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino
442 529
 //#define FAST_PWM_FAN
443 530
 
531
+// Use software PWM to drive the fan, as for the heaters. This uses a very low frequency
532
+// which is not ass annoying as with the hardware PWM. On the other hand, if this frequency
533
+// is too low, you should also increment SOFT_PWM_SCALE.
534
+//#define FAN_SOFT_PWM
535
+
536
+// Incrementing this by 1 will double the software PWM frequency,
537
+// affecting heaters, and the fan if FAN_SOFT_PWM is enabled.
538
+// However, control resolution will be halved for each increment;
539
+// at zero value, there are 128 effective control positions.
540
+#define SOFT_PWM_SCALE 0
541
+
444 542
 // M240  Triggers a camera by emulating a Canon RC-1 Remote
445 543
 // Data from: http://www.doc-diy.net/photo/rc-1_hacked/
446 544
 // #define PHOTOGRAPH_PIN     23
@@ -452,11 +550,8 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
452 550
 //#define BARICUDA
453 551
 
454 552
 /*********************************************************************\
455
-*
456 553
 * R/C SERVO support
457
-*
458 554
 * Sponsored by TrinityLabs, Reworked by codexmas
459
-*
460 555
 **********************************************************************/
461 556
 
462 557
 // Number of servos
@@ -466,7 +561,15 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
466 561
 // leaving it undefined or defining as 0 will disable the servo subsystem
467 562
 // If unsure, leave commented / disabled
468 563
 //
469
-// #define NUM_SERVOS 3
564
+//#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
565
+
566
+// Servo Endstops
567
+// 
568
+// This allows for servo actuated endstops, primary usage is for the Z Axis to eliminate calibration or bed height changes.
569
+// Use M206 command to correct for switch height offset to actual nozzle height. Store that setting with M500.
570
+// 
571
+//#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
572
+//#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 70,0} // X,Y,Z Axis Extend and Retract angles
470 573
 
471 574
 #include "Configuration_adv.h"
472 575
 #include "thermistortables.h"

+ 12
- 1
Marlin/ConfigurationStore.cpp View File

@@ -37,7 +37,7 @@ void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size)
37 37
 // the default values are used whenever there is a change to the data, to prevent
38 38
 // wrong data being written to the variables.
39 39
 // ALSO:  always make sure the variables in the Store and retrieve sections are in the same order.
40
-#define EEPROM_VERSION "V07"
40
+#define EEPROM_VERSION "V08"
41 41
 
42 42
 #ifdef EEPROM_SETTINGS
43 43
 void Config_StoreSettings() 
@@ -78,6 +78,10 @@ void Config_StoreSettings()
78 78
     EEPROM_WRITE_VAR(i,dummy);
79 79
     EEPROM_WRITE_VAR(i,dummy);
80 80
   #endif
81
+  #ifndef DOGLCD
82
+    int lcd_contrast = 32;
83
+  #endif
84
+  EEPROM_WRITE_VAR(i,lcd_contrast);
81 85
   char ver2[4]=EEPROM_VERSION;
82 86
   i=EEPROM_OFFSET;
83 87
   EEPROM_WRITE_VAR(i,ver2); // validate data
@@ -198,6 +202,10 @@ void Config_RetrieveSettings()
198 202
         EEPROM_READ_VAR(i,Kp);
199 203
         EEPROM_READ_VAR(i,Ki);
200 204
         EEPROM_READ_VAR(i,Kd);
205
+        #ifndef DOGLCD
206
+        int lcd_contrast;
207
+        #endif
208
+        EEPROM_READ_VAR(i,lcd_contrast);
201 209
 
202 210
 		// Call updatePID (similar to when we have processed M301)
203 211
 		updatePID();
@@ -244,6 +252,9 @@ void Config_ResetDefault()
244 252
     absPreheatHPBTemp = ABS_PREHEAT_HPB_TEMP;
245 253
     absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED;
246 254
 #endif
255
+#ifdef DOGLCD
256
+    lcd_contrast = DEFAULT_LCD_CONTRAST;
257
+#endif
247 258
 #ifdef PIDTEMP
248 259
     Kp = DEFAULT_Kp;
249 260
     Ki = scalePID_i(DEFAULT_Ki);

+ 28
- 6
Marlin/Configuration_adv.h View File

@@ -18,12 +18,6 @@
18 18
 //#define WATCH_TEMP_PERIOD 40000 //40 seconds
19 19
 //#define WATCH_TEMP_INCREASE 10  //Heat up at least 10 degree in 20 seconds
20 20
 
21
-// Wait for Cooldown
22
-// This defines if the M109 call should not block if it is cooling down.
23
-// example: From a current temp of 220, you set M109 S200. 
24
-// if CooldownNoWait is defined M109 will not wait for the cooldown to finish
25
-#define CooldownNoWait true
26
-
27 21
 #ifdef PIDTEMP
28 22
   // this adds an experimental additional term to the heatingpower, proportional to the extrusion speed.
29 23
   // if Kc is choosen well, the additional required power due to increased melting should be compensated.
@@ -152,6 +146,31 @@
152 146
   #define EXTRUDERS 1
153 147
 #endif
154 148
 
149
+// Enable this for dual x-carriage printers. 
150
+// A dual x-carriage design has the advantage that the inactive extruder can be parked which
151
+// prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
152
+// allowing faster printing speeds.
153
+//#define DUAL_X_CARRIAGE
154
+#ifdef DUAL_X_CARRIAGE
155
+// Configuration for second X-carriage
156
+// Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop;
157
+// the second x-carriage always homes to the maximum endstop.
158
+#define X2_MIN_POS 88     // set minimum to ensure second x-carriage doesn't hit the parked first X-carriage
159
+#define X2_MAX_POS 350.45 // set maximum to the distance between toolheads when both heads are homed 
160
+#define X2_HOME_DIR 1     // the second X-carriage always homes to the maximum endstop position
161
+#define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position 
162
+    // However: In this mode the EXTRUDER_OFFSET_X value for the second extruder provides a software 
163
+    // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops
164
+    // without modifying the firmware (through the "M218 T1 X???" command).
165
+    // Remember: you should set the second extruder x-offset to 0 in your slicer.
166
+
167
+// Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h)
168
+#define X2_ENABLE_PIN 29
169
+#define X2_STEP_PIN 25
170
+#define X2_DIR_PIN 23
171
+
172
+#endif // DUAL_X_CARRIAGE
173
+    
155 174
 //homing hits the endstop, then retracts by this distance, before it tries to slowly bump again:
156 175
 #define X_HOME_RETRACT_MM 5 
157 176
 #define Y_HOME_RETRACT_MM 5 
@@ -318,6 +337,9 @@ const unsigned int dropsegments=5; //everything with less than this number of st
318 337
 //===========================================================================
319 338
 //=============================  Define Defines  ============================
320 339
 //===========================================================================
340
+#if EXTRUDERS > 1 && defined TEMP_SENSOR_1_AS_REDUNDANT
341
+  #error "You cannot use TEMP_SENSOR_1_AS_REDUNDANT if EXTRUDERS > 1"
342
+#endif
321 343
 
322 344
 #if TEMP_SENSOR_0 > 0
323 345
   #define THERMISTORHEATER_0 TEMP_SENSOR_0

+ 1
- 1
Marlin/LiquidCrystalRus.cpp View File

@@ -36,7 +36,7 @@ const PROGMEM uint8_t utf_recode[] =
36 36
 //    S = 0; No shift 
37 37
 //
38 38
 // Note, however, that resetting the Arduino doesn't reset the LCD, so we
39
-// can't assume that its in that state when a sketch starts (and the
39
+// can't assume that it's in that state when a sketch starts (and the
40 40
 // LiquidCrystal constructor is called).
41 41
 // 
42 42
 // modified 27 Jul 2011

+ 8
- 2
Marlin/Makefile View File

@@ -114,6 +114,12 @@ MCU              ?= atmega644p
114 114
 else ifeq  ($(HARDWARE_MOTHERBOARD),63)
115 115
 HARDWARE_VARIANT ?= Sanguino
116 116
 MCU              ?= atmega644p
117
+else ifeq  ($(HARDWARE_MOTHERBOARD),65)
118
+HARDWARE_VARIANT ?= Sanguino
119
+MCU              ?= atmega1284p
120
+else ifeq  ($(HARDWARE_MOTHERBOARD),66)
121
+HARDWARE_VARIANT ?= Sanguino
122
+MCU              ?= atmega1284p
117 123
 
118 124
 #Ultimaker
119 125
 else ifeq  ($(HARDWARE_MOTHERBOARD),7)
@@ -213,7 +219,7 @@ CXXSRC = WMath.cpp WString.cpp Print.cpp Marlin_main.cpp	\
213 219
 	SdFile.cpp SdVolume.cpp motion_control.cpp planner.cpp		\
214 220
 	stepper.cpp temperature.cpp cardreader.cpp ConfigurationStore.cpp \
215 221
 	watchdog.cpp
216
-CXXSRC += LiquidCrystal.cpp ultralcd.cpp SPI.cpp Servo.cpp
222
+CXXSRC += LiquidCrystal.cpp ultralcd.cpp SPI.cpp Servo.cpp Tone.cpp
217 223
 
218 224
 #Check for Arduino 1.0.0 or higher and use the correct sourcefiles for that version
219 225
 ifeq ($(shell [ $(ARDUINO_VERSION) -ge 100 ] && echo true), true)
@@ -287,7 +293,7 @@ LDFLAGS = -lm
287 293
 # Programming support using avrdude. Settings and variables.
288 294
 AVRDUDE_PORT = $(UPLOAD_PORT)
289 295
 AVRDUDE_WRITE_FLASH = -U flash:w:$(BUILD_DIR)/$(TARGET).hex:i
290
-AVRDUDE_FLAGS = -D -C $(ARDUINO_INSTALL_DIR)/hardware/tools/avrdude.conf \
296
+AVRDUDE_FLAGS = -D -C $(ARDUINO_INSTALL_DIR)/hardware/tools/avr/etc/avrdude.conf \
291 297
 	-p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) \
292 298
 	-b $(UPLOAD_RATE)
293 299
 

+ 12
- 1
Marlin/Marlin.h View File

@@ -96,7 +96,11 @@ void process_commands();
96 96
 
97 97
 void manage_inactivity();
98 98
 
99
-#if defined(X_ENABLE_PIN) && X_ENABLE_PIN > -1
99
+#if defined(DUAL_X_CARRIAGE) && defined(X_ENABLE_PIN) && X_ENABLE_PIN > -1 \
100
+    && defined(X2_ENABLE_PIN) && X2_ENABLE_PIN > -1
101
+  #define  enable_x() do { WRITE(X_ENABLE_PIN, X_ENABLE_ON); WRITE(X2_ENABLE_PIN, X_ENABLE_ON); } while (0)
102
+  #define disable_x() do { WRITE(X_ENABLE_PIN,!X_ENABLE_ON); WRITE(X2_ENABLE_PIN,!X_ENABLE_ON); } while (0)
103
+#elif defined(X_ENABLE_PIN) && X_ENABLE_PIN > -1
100 104
   #define  enable_x() WRITE(X_ENABLE_PIN, X_ENABLE_ON)
101 105
   #define disable_x() WRITE(X_ENABLE_PIN,!X_ENABLE_ON)
102 106
 #else
@@ -157,6 +161,9 @@ void FlushSerialRequestResend();
157 161
 void ClearToSend();
158 162
 
159 163
 void get_coordinates();
164
+#ifdef DELTA
165
+void calculate_delta(float cartesian[3]);
166
+#endif
160 167
 void prepare_move();
161 168
 void kill();
162 169
 void Stop();
@@ -191,6 +198,10 @@ extern int ValvePressure;
191 198
 extern int EtoPPressure;
192 199
 #endif
193 200
 
201
+#ifdef FAN_SOFT_PWM
202
+extern unsigned char fanSpeedSoftPwm;
203
+#endif
204
+
194 205
 #ifdef FWRETRACT
195 206
 extern bool autoretract_enabled;
196 207
 extern bool retracted;

+ 286
- 35
Marlin/Marlin_main.cpp View File

@@ -67,17 +67,9 @@
67 67
 // G91 - Use Relative Coordinates
68 68
 // G92 - Set current position to cordinates given
69 69
 
70
-//RepRap M Codes
70
+// M Codes
71 71
 // M0   - Unconditional stop - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled)
72 72
 // M1   - Same as M0
73
-// M104 - Set extruder target temp
74
-// M105 - Read current temp
75
-// M106 - Fan on
76
-// M107 - Fan off
77
-// M109 - Wait for extruder current temp to reach target temp.
78
-// M114 - Display current position
79
-
80
-//Custom M Codes
81 73
 // M17  - Enable/Power all stepper motors
82 74
 // M18  - Disable all stepper motors; same as M84
83 75
 // M20  - List SD card
@@ -92,6 +84,7 @@
92 84
 // M29  - Stop SD write
93 85
 // M30  - Delete file from SD (M30 filename.g)
94 86
 // M31  - Output time since last M109 or SD card start to serial
87
+// M32  - Select file and start SD print (Can be used when printing from SD card)
95 88
 // M42  - Change pin status via gcode Use M42 Px Sy to set pin x to value y, when omitting Px the onboard led will be used.
96 89
 // M80  - Turn on Power Supply
97 90
 // M81  - Turn off Power Supply
@@ -101,6 +94,12 @@
101 94
 //        or use S<seconds> to specify an inactivity timeout, after which the steppers will be disabled.  S0 to disable the timeout.
102 95
 // M85  - Set inactivity shutdown timer with parameter S<seconds>. To disable set zero (default)
103 96
 // M92  - Set axis_steps_per_unit - same syntax as G92
97
+// M104 - Set extruder target temp
98
+// M105 - Read current temp
99
+// M106 - Fan on
100
+// M107 - Fan off
101
+// M109 - Sxxx Wait for extruder current temp to reach target temp. Waits only when heating
102
+//        Rxxx Wait for extruder current temp to reach target temp. Waits when heating and cooling
104 103
 // M114 - Output current position to serial port
105 104
 // M115 - Capabilities string
106 105
 // M117 - display message
@@ -110,7 +109,8 @@
110 109
 // M128 - EtoP Open (BariCUDA EtoP = electricity to air pressure transducer by jmil)
111 110
 // M129 - EtoP Closed (BariCUDA EtoP = electricity to air pressure transducer by jmil)
112 111
 // M140 - Set bed target temp
113
-// M190 - Wait for bed current temp to reach target temp.
112
+// M190 - Sxxx Wait for bed current temp to reach target temp. Waits only when heating
113
+//        Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling
114 114
 // M200 - Set filament diameter
115 115
 // M201 - Set max acceleration in units/s^2 for print moves (M201 X1000 Y1000)
116 116
 // M202 - Set max acceleration in units/s^2 for travel moves (M202 X1000 Y1000) Unused in Marlin!!
@@ -125,10 +125,11 @@
125 125
 // M220 S<factor in percent>- set speed factor override percentage
126 126
 // M221 S<factor in percent>- set extrude factor override percentage
127 127
 // M240 - Trigger a camera to take a photograph
128
+// M250 - Set LCD contrast C<contrast value> (value 0..63)
128 129
 // M280 - set servo position absolute. P: servo index, S: angle or microseconds
129 130
 // M300 - Play beepsound S<frequency Hz> P<duration ms>
130 131
 // M301 - Set PID parameters P I and D
131
-// M302 - Allow cold extrudes
132
+// M302 - Allow cold extrudes, or set the minimum extrude S<temperature>.
132 133
 // M303 - PID relay autotune S<temperature> sets the target temperature. (default target temperature = 150C)
133 134
 // M304 - Set bed PID parameters P I and D
134 135
 // M400 - Finish all moves
@@ -177,6 +178,10 @@ float extruder_offset[2][EXTRUDERS] = {
177 178
 #endif
178 179
 uint8_t active_extruder = 0;
179 180
 int fanSpeed=0;
181
+#ifdef SERVO_ENDSTOPS
182
+  int servo_endstops[] = SERVO_ENDSTOPS;
183
+  int servo_endstop_angles[] = SERVO_ENDSTOP_ANGLES;
184
+#endif
180 185
 #ifdef BARICUDA
181 186
 int ValvePressure=0;
182 187
 int EtoPPressure=0;
@@ -194,6 +199,9 @@ int EtoPPressure=0;
194 199
 //===========================================================================
195 200
 const char axis_codes[NUM_AXIS] = {'X', 'Y', 'Z', 'E'};
196 201
 static float destination[NUM_AXIS] = {  0.0, 0.0, 0.0, 0.0};
202
+#ifdef DELTA
203
+static float delta[3] = {0.0, 0.0, 0.0};
204
+#endif
197 205
 static float offset[3] = {0.0, 0.0, 0.0};
198 206
 static bool home_all_axis = true;
199 207
 static float feedrate = 1500.0, next_feedrate, saved_feedrate;
@@ -234,6 +242,9 @@ bool Stopped=false;
234 242
   Servo servos[NUM_SERVOS];
235 243
 #endif
236 244
 
245
+bool CooldownNoWait = true;
246
+bool target_direction;
247
+
237 248
 //===========================================================================
238 249
 //=============================ROUTINES=============================
239 250
 //===========================================================================
@@ -351,6 +362,16 @@ void servo_init()
351 362
   #if (NUM_SERVOS >= 5)
352 363
     #error "TODO: enter initalisation code for more servos"
353 364
   #endif
365
+
366
+  // Set position of Servo Endstops that are defined
367
+  #ifdef SERVO_ENDSTOPS
368
+  for(int8_t i = 0; i < 3; i++)
369
+  {
370
+    if(servo_endstops[i] > -1) {
371
+      servos[servo_endstops[i]].write(servo_endstop_angles[i * 2 + 1]);
372
+    }
373
+  }
374
+  #endif
354 375
 }
355 376
 
356 377
 void setup()
@@ -404,6 +425,7 @@ void setup()
404 425
   servo_init();
405 426
 
406 427
   lcd_init();
428
+  _delay_ms(1000);	// wait 1sec to display the splash screen
407 429
   
408 430
   #if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1
409 431
     SET_OUTPUT(CONTROLLERFAN_PIN); //Set pin used for driver cooling fan
@@ -655,7 +677,44 @@ XYZ_CONSTS_FROM_CONFIG(float, max_length,      MAX_LENGTH);
655 677
 XYZ_CONSTS_FROM_CONFIG(float, home_retract_mm, HOME_RETRACT_MM);
656 678
 XYZ_CONSTS_FROM_CONFIG(signed char, home_dir,  HOME_DIR);
657 679
 
680
+#ifdef DUAL_X_CARRIAGE
681
+  #if EXTRUDERS == 1 || defined(COREXY) \
682
+      || !defined(X2_ENABLE_PIN) || !defined(X2_STEP_PIN) || !defined(X2_DIR_PIN) \
683
+      || !defined(X2_HOME_POS) || !defined(X2_MIN_POS) || !defined(X2_MAX_POS) \
684
+      || !defined(X_MAX_PIN) || X_MAX_PIN < 0
685
+    #error "Missing or invalid definitions for DUAL_X_CARRIAGE mode."
686
+  #endif
687
+  #if X_HOME_DIR != -1 || X2_HOME_DIR != 1
688
+    #error "Please use canonical x-carriage assignment" // the x-carriages are defined by their homing directions
689
+  #endif  
690
+    
691
+static float x_home_pos(int extruder) {
692
+  if (extruder == 0)
693
+    return base_home_pos(X_AXIS) + add_homeing[X_AXIS];
694
+  else
695
+    // In dual carriage mode the extruder offset provides an override of the
696
+    // second X-carriage offset when homed - otherwise X2_HOME_POS is used.
697
+    // This allow soft recalibration of the second extruder offset position without firmware reflash 
698
+    // (through the M218 command).
699
+    return (extruder_offset[X_AXIS][1] > 0) ? extruder_offset[X_AXIS][1] : X2_HOME_POS;
700
+}
701
+
702
+static int x_home_dir(int extruder) {
703
+  return (extruder == 0) ? X_HOME_DIR : X2_HOME_DIR;
704
+}
705
+
706
+static float inactive_x_carriage_pos = X2_MAX_POS;
707
+#endif     
708
+
658 709
 static void axis_is_at_home(int axis) {
710
+#ifdef DUAL_X_CARRIAGE
711
+  if (axis == X_AXIS && active_extruder != 0) {
712
+    current_position[X_AXIS] = x_home_pos(active_extruder);
713
+    min_pos[X_AXIS] =          X2_MIN_POS;
714
+    max_pos[X_AXIS] =          max(extruder_offset[X_AXIS][1], X2_MAX_POS);
715
+    return;
716
+  }
717
+#endif  
659 718
   current_position[axis] = base_home_pos(axis) + add_homeing[axis];
660 719
   min_pos[axis] =          base_min_pos(axis) + add_homeing[axis];
661 720
   max_pos[axis] =          base_max_pos(axis) + add_homeing[axis];
@@ -669,20 +728,33 @@ static void homeaxis(int axis) {
669 728
       axis==Y_AXIS ? HOMEAXIS_DO(Y) :
670 729
       axis==Z_AXIS ? HOMEAXIS_DO(Z) :
671 730
       0) {
731
+    int axis_home_dir = home_dir(axis);
732
+#ifdef DUAL_X_CARRIAGE
733
+    if (axis == X_AXIS)
734
+      axis_home_dir = x_home_dir(active_extruder);
735
+#endif
736
+
737
+    // Engage Servo endstop if enabled
738
+    #ifdef SERVO_ENDSTOPS
739
+      if (SERVO_ENDSTOPS[axis] > -1) {
740
+        servos[servo_endstops[axis]].write(servo_endstop_angles[axis * 2]);
741
+      }
742
+    #endif
743
+      
672 744
     current_position[axis] = 0;
673 745
     plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
674
-    destination[axis] = 1.5 * max_length(axis) * home_dir(axis);
746
+    destination[axis] = 1.5 * max_length(axis) * axis_home_dir;
675 747
     feedrate = homing_feedrate[axis];
676 748
     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
677 749
     st_synchronize();
678 750
 
679 751
     current_position[axis] = 0;
680 752
     plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
681
-    destination[axis] = -home_retract_mm(axis) * home_dir(axis);
753
+    destination[axis] = -home_retract_mm(axis) * axis_home_dir;
682 754
     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
683 755
     st_synchronize();
684 756
 
685
-    destination[axis] = 2*home_retract_mm(axis) * home_dir(axis);
757
+    destination[axis] = 2*home_retract_mm(axis) * axis_home_dir;
686 758
     feedrate = homing_feedrate[axis]/2 ;
687 759
     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
688 760
     st_synchronize();
@@ -691,6 +763,13 @@ static void homeaxis(int axis) {
691 763
     destination[axis] = current_position[axis];
692 764
     feedrate = 0.0;
693 765
     endstops_hit_on_purpose();
766
+
767
+    // Retract Servo endstop if enabled
768
+    #ifdef SERVO_ENDSTOPS
769
+      if (SERVO_ENDSTOPS[axis] > -1) {
770
+        servos[servo_endstops[axis]].write(servo_endstop_angles[axis * 2 + 1]);
771
+      }
772
+    #endif
694 773
   }
695 774
 }
696 775
 #define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS)
@@ -781,7 +860,40 @@ void process_commands()
781 860
       for(int8_t i=0; i < NUM_AXIS; i++) {
782 861
         destination[i] = current_position[i];
783 862
       }
784
-      feedrate = 0.0;
863
+          feedrate = 0.0;
864
+
865
+#ifdef DELTA
866
+          // A delta can only safely home all axis at the same time
867
+          // all axis have to home at the same time
868
+
869
+          // Move all carriages up together until the first endstop is hit.
870
+          current_position[X_AXIS] = 0;
871
+          current_position[Y_AXIS] = 0;
872
+          current_position[Z_AXIS] = 0;
873
+          plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); 
874
+
875
+          destination[X_AXIS] = 3 * Z_MAX_LENGTH;
876
+          destination[Y_AXIS] = 3 * Z_MAX_LENGTH;
877
+          destination[Z_AXIS] = 3 * Z_MAX_LENGTH;
878
+          feedrate = 1.732 * homing_feedrate[X_AXIS];
879
+          plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
880
+          st_synchronize();
881
+          endstops_hit_on_purpose();
882
+
883
+          current_position[X_AXIS] = destination[X_AXIS];
884
+          current_position[Y_AXIS] = destination[Y_AXIS];
885
+          current_position[Z_AXIS] = destination[Z_AXIS];
886
+          
887
+          // take care of back off and rehome now we are all at the top
888
+          HOMEAXIS(X);
889
+          HOMEAXIS(Y);
890
+          HOMEAXIS(Z);
891
+
892
+          calculate_delta(current_position);
893
+          plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
894
+
895
+#else // NOT DELTA
896
+
785 897
       home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2])));
786 898
 
787 899
       #if Z_HOME_DIR > 0                      // If homing away from BED do Z first
@@ -795,8 +907,14 @@ void process_commands()
795 907
       {
796 908
         current_position[X_AXIS] = 0;current_position[Y_AXIS] = 0;
797 909
 
910
+       #ifndef DUAL_X_CARRIAGE
911
+        int x_axis_home_dir = home_dir(X_AXIS);
912
+       #else
913
+        int x_axis_home_dir = x_home_dir(active_extruder);
914
+       #endif
915
+        
798 916
         plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
799
-        destination[X_AXIS] = 1.5 * X_MAX_LENGTH * X_HOME_DIR;destination[Y_AXIS] = 1.5 * Y_MAX_LENGTH * Y_HOME_DIR;
917
+        destination[X_AXIS] = 1.5 * max_length(X_AXIS) * x_axis_home_dir;destination[Y_AXIS] = 1.5 * max_length(Y_AXIS) * home_dir(Y_AXIS);
800 918
         feedrate = homing_feedrate[X_AXIS];
801 919
         if(homing_feedrate[Y_AXIS]<feedrate)
802 920
           feedrate =homing_feedrate[Y_AXIS];
@@ -812,11 +930,22 @@ void process_commands()
812 930
         feedrate = 0.0;
813 931
         st_synchronize();
814 932
         endstops_hit_on_purpose();
933
+
934
+        current_position[X_AXIS] = destination[X_AXIS];
935
+        current_position[Y_AXIS] = destination[Y_AXIS];
936
+        current_position[Z_AXIS] = destination[Z_AXIS];
815 937
       }
816 938
       #endif
817 939
 
818 940
       if((home_all_axis) || (code_seen(axis_codes[X_AXIS])))
819 941
       {
942
+      #ifdef DUAL_X_CARRIAGE
943
+        int tmp_extruder = active_extruder;
944
+        active_extruder = !active_extruder;
945
+        HOMEAXIS(X);
946
+        inactive_x_carriage_pos = current_position[X_AXIS];
947
+        active_extruder = tmp_extruder;
948
+      #endif         
820 949
         HOMEAXIS(X);
821 950
       }
822 951
 
@@ -849,7 +978,8 @@ void process_commands()
849 978
         }
850 979
       }
851 980
       plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
852
-
981
+#endif // else DELTA
982
+          
853 983
       #ifdef ENDSTOPS_ONLY_FOR_HOMING
854 984
         enable_endstops(false);
855 985
       #endif
@@ -988,6 +1118,19 @@ void process_commands()
988 1118
         card.removeFile(strchr_pointer + 4);
989 1119
       }
990 1120
       break;
1121
+    case 32: //M32 - Select file and start SD print
1122
+      if(card.sdprinting) {
1123
+        st_synchronize();
1124
+        card.closefile();
1125
+        card.sdprinting = false;
1126
+      }
1127
+      starpos = (strchr(strchr_pointer + 4,'*'));
1128
+      if(starpos!=NULL)
1129
+        *(starpos-1)='\0';
1130
+      card.openFile(strchr_pointer + 4,true);
1131
+      card.startFileprint();
1132
+      starttime=millis();
1133
+      break;
991 1134
     case 928: //M928 - Start SD write
992 1135
       starpos = (strchr(strchr_pointer + 5,'*'));
993 1136
       if(starpos != NULL){
@@ -1055,7 +1198,7 @@ void process_commands()
1055 1198
     case 105 : // M105
1056 1199
       if(setTargetedHotend(105)){
1057 1200
         break;
1058
-      }
1201
+        }
1059 1202
       #if defined(TEMP_0_PIN) && TEMP_0_PIN > -1
1060 1203
         SERIAL_PROTOCOLPGM("ok T:");
1061 1204
         SERIAL_PROTOCOL_F(degHotend(tmp_extruder),1);
@@ -1098,7 +1241,13 @@ void process_commands()
1098 1241
       #ifdef AUTOTEMP
1099 1242
         autotemp_enabled=false;
1100 1243
       #endif
1101
-      if (code_seen('S')) setTargetHotend(code_value(), tmp_extruder);
1244
+      if (code_seen('S')) { 
1245
+        setTargetHotend(code_value(), tmp_extruder);
1246
+        CooldownNoWait = true;
1247
+      } else if (code_seen('R')) {
1248
+        setTargetHotend(code_value(), tmp_extruder);
1249
+        CooldownNoWait = false;
1250
+      }
1102 1251
       #ifdef AUTOTEMP
1103 1252
         if (code_seen('S')) autotemp_min=code_value();
1104 1253
         if (code_seen('B')) autotemp_max=code_value();
@@ -1113,7 +1262,7 @@ void process_commands()
1113 1262
       codenum = millis();
1114 1263
 
1115 1264
       /* See if we are heating up or cooling down */
1116
-      bool target_direction = isHeatingHotend(tmp_extruder); // true if heating, false if cooling
1265
+      target_direction = isHeatingHotend(tmp_extruder); // true if heating, false if cooling
1117 1266
 
1118 1267
       #ifdef TEMP_RESIDENCY_TIME
1119 1268
         long residencyStart;
@@ -1169,9 +1318,18 @@ void process_commands()
1169 1318
     case 190: // M190 - Wait for bed heater to reach target.
1170 1319
     #if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1
1171 1320
         LCD_MESSAGEPGM(MSG_BED_HEATING);
1172
-        if (code_seen('S')) setTargetBed(code_value());
1321
+        if (code_seen('S')) { 
1322
+          setTargetBed(code_value());
1323
+          CooldownNoWait = true;
1324
+        } else if (code_seen('R')) {
1325
+          setTargetBed(code_value());
1326
+          CooldownNoWait = false;
1327
+        }
1173 1328
         codenum = millis();
1174
-        while(isHeatingBed())
1329
+        
1330
+        target_direction = isHeatingBed(); // true if heating, false if cooling
1331
+        
1332
+        while ( target_direction ? (isHeatingBed()) : (isCoolingBed()&&(CooldownNoWait==false)) )
1175 1333
         {
1176 1334
           if(( millis() - codenum) > 1000 ) //Print Temp Reading every 1 second while heating up.
1177 1335
           {
@@ -1550,17 +1708,22 @@ void process_commands()
1550 1708
     #if LARGE_FLASH == true && ( BEEPER > 0 || defined(ULTRALCD) )
1551 1709
     case 300: // M300
1552 1710
     {
1553
-      int beepS = 400;
1554
-      int beepP = 1000;
1555
-      if(code_seen('S')) beepS = code_value();
1556
-      if(code_seen('P')) beepP = code_value();
1557
-      #if BEEPER > 0
1558
-        tone(BEEPER, beepS);
1711
+      int beepS = code_seen('S') ? code_value() : 110;
1712
+      int beepP = code_seen('P') ? code_value() : 1000;
1713
+      if (beepS > 0)
1714
+      {
1715
+        #if BEEPER > 0
1716
+          tone(BEEPER, beepS);
1717
+          delay(beepP);
1718
+          noTone(BEEPER);
1719
+        #elif defined(ULTRALCD)
1720
+          lcd_buzz(beepS, beepP);
1721
+        #endif
1722
+      }
1723
+      else
1724
+      {
1559 1725
         delay(beepP);
1560
-        noTone(BEEPER);
1561
-      #elif defined(ULTRALCD)
1562
-        lcd_buzz(beepS, beepP);
1563
-      #endif
1726
+      }
1564 1727
     }
1565 1728
     break;
1566 1729
     #endif // M300
@@ -1633,12 +1796,27 @@ void process_commands()
1633 1796
       #endif
1634 1797
      }
1635 1798
     break;
1636
-
1637
-    case 302: // allow cold extrudes
1799
+#ifdef DOGLCD
1800
+    case 250: // M250  Set LCD contrast value: C<value> (value 0..63)
1801
+     {
1802
+	  if (code_seen('C')) {
1803
+	   lcd_setcontrast( ((int)code_value())&63 );
1804
+          }
1805
+          SERIAL_PROTOCOLPGM("lcd contrast value: ");
1806
+          SERIAL_PROTOCOL(lcd_contrast);
1807
+          SERIAL_PROTOCOLLN("");
1808
+     }
1809
+    break;
1810
+#endif
1811
+    #ifdef PREVENT_DANGEROUS_EXTRUDE
1812
+    case 302: // allow cold extrudes, or set the minimum extrude temperature
1638 1813
     {
1639
-      allow_cold_extrudes(true);
1814
+	  float temp = .0;
1815
+	  if (code_seen('S')) temp=code_value();
1816
+      set_extrude_min_temp(temp);
1640 1817
     }
1641 1818
     break;
1819
+	#endif
1642 1820
     case 303: // M303 PID autotune
1643 1821
     {
1644 1822
       float temp = 150.0;
@@ -1887,6 +2065,20 @@ void process_commands()
1887 2065
       if(tmp_extruder != active_extruder) {
1888 2066
         // Save current position to return to after applying extruder offset
1889 2067
         memcpy(destination, current_position, sizeof(destination));
2068
+      #ifdef DUAL_X_CARRIAGE
2069
+        // only apply Y extruder offset in dual x carriage mode (x offset is already used in determining home pos)
2070
+        current_position[Y_AXIS] = current_position[Y_AXIS] -
2071
+                     extruder_offset[Y_AXIS][active_extruder] +
2072
+                     extruder_offset[Y_AXIS][tmp_extruder];
2073
+
2074
+        float tmp_x_pos = current_position[X_AXIS];
2075
+
2076
+        // Set the new active extruder and position
2077
+        active_extruder = tmp_extruder;
2078
+        axis_is_at_home(X_AXIS); //this function updates X min/max values.
2079
+        current_position[X_AXIS] = inactive_x_carriage_pos;
2080
+        inactive_x_carriage_pos = tmp_x_pos;      
2081
+      #else    
1890 2082
         // Offset extruder (only by XY)
1891 2083
         int i;
1892 2084
         for(i = 0; i < 2; i++) {
@@ -1896,6 +2088,7 @@ void process_commands()
1896 2088
         }
1897 2089
         // Set the new active extruder and position
1898 2090
         active_extruder = tmp_extruder;
2091
+      #endif //else DUAL_X_CARRIAGE
1899 2092
         plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1900 2093
         // Move to the old position if 'F' was in the parameters
1901 2094
         if(make_move && Stopped == false) {
@@ -2032,11 +2225,64 @@ void clamp_to_software_endstops(float target[3])
2032 2225
   }
2033 2226
 }
2034 2227
 
2228
+#ifdef DELTA
2229
+void calculate_delta(float cartesian[3])
2230
+{
2231
+  delta[X_AXIS] = sqrt(sq(DELTA_DIAGONAL_ROD)
2232
+                       - sq(DELTA_TOWER1_X-cartesian[X_AXIS])
2233
+                       - sq(DELTA_TOWER1_Y-cartesian[Y_AXIS])
2234
+                       ) + cartesian[Z_AXIS];
2235
+  delta[Y_AXIS] = sqrt(sq(DELTA_DIAGONAL_ROD)
2236
+                       - sq(DELTA_TOWER2_X-cartesian[X_AXIS])
2237
+                       - sq(DELTA_TOWER2_Y-cartesian[Y_AXIS])
2238
+                       ) + cartesian[Z_AXIS];
2239
+  delta[Z_AXIS] = sqrt(sq(DELTA_DIAGONAL_ROD)
2240
+                       - sq(DELTA_TOWER3_X-cartesian[X_AXIS])
2241
+                       - sq(DELTA_TOWER3_Y-cartesian[Y_AXIS])
2242
+                       ) + cartesian[Z_AXIS];
2243
+  /*
2244
+  SERIAL_ECHOPGM("cartesian x="); SERIAL_ECHO(cartesian[X_AXIS]);
2245
+  SERIAL_ECHOPGM(" y="); SERIAL_ECHO(cartesian[Y_AXIS]);
2246
+  SERIAL_ECHOPGM(" z="); SERIAL_ECHOLN(cartesian[Z_AXIS]);
2247
+
2248
+  SERIAL_ECHOPGM("delta x="); SERIAL_ECHO(delta[X_AXIS]);
2249
+  SERIAL_ECHOPGM(" y="); SERIAL_ECHO(delta[Y_AXIS]);
2250
+  SERIAL_ECHOPGM(" z="); SERIAL_ECHOLN(delta[Z_AXIS]);
2251
+  */
2252
+}
2253
+#endif
2254
+
2035 2255
 void prepare_move()
2036 2256
 {
2037 2257
   clamp_to_software_endstops(destination);
2038 2258
 
2039 2259
   previous_millis_cmd = millis();
2260
+#ifdef DELTA
2261
+  float difference[NUM_AXIS];
2262
+  for (int8_t i=0; i < NUM_AXIS; i++) {
2263
+    difference[i] = destination[i] - current_position[i];
2264
+  }
2265
+  float cartesian_mm = sqrt(sq(difference[X_AXIS]) +
2266
+                            sq(difference[Y_AXIS]) +
2267
+                            sq(difference[Z_AXIS]));
2268
+  if (cartesian_mm < 0.000001) { cartesian_mm = abs(difference[E_AXIS]); }
2269
+  if (cartesian_mm < 0.000001) { return; }
2270
+  float seconds = 6000 * cartesian_mm / feedrate / feedmultiply;
2271
+  int steps = max(1, int(DELTA_SEGMENTS_PER_SECOND * seconds));
2272
+  // SERIAL_ECHOPGM("mm="); SERIAL_ECHO(cartesian_mm);
2273
+  // SERIAL_ECHOPGM(" seconds="); SERIAL_ECHO(seconds);
2274
+  // SERIAL_ECHOPGM(" steps="); SERIAL_ECHOLN(steps);
2275
+  for (int s = 1; s <= steps; s++) {
2276
+    float fraction = float(s) / float(steps);
2277
+    for(int8_t i=0; i < NUM_AXIS; i++) {
2278
+      destination[i] = current_position[i] + difference[i] * fraction;
2279
+    }
2280
+    calculate_delta(destination);
2281
+    plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS],
2282
+                     destination[E_AXIS], feedrate*feedmultiply/60/100.0,
2283
+                     active_extruder);
2284
+  }
2285
+#else
2040 2286
   // Do not use feedmultiply for E or Z only moves
2041 2287
   if( (current_position[X_AXIS] == destination [X_AXIS]) && (current_position[Y_AXIS] == destination [Y_AXIS])) {
2042 2288
       plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
@@ -2044,6 +2290,7 @@ void prepare_move()
2044 2290
   else {
2045 2291
     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60/100.0, active_extruder);
2046 2292
   }
2293
+#endif
2047 2294
   for(int8_t i=0; i < NUM_AXIS; i++) {
2048 2295
     current_position[i] = destination[i];
2049 2296
   }
@@ -2086,6 +2333,9 @@ void controllerFan()
2086 2333
        || !READ(E2_ENABLE_PIN)
2087 2334
     #endif
2088 2335
     #if EXTRUDER > 1
2336
+      #if defined(X2_ENABLE_PIN) && X2_ENABLE_PIN > -1
2337
+       || !READ(X2_ENABLE_PIN)
2338
+      #endif
2089 2339
        || !READ(E1_ENABLE_PIN)
2090 2340
     #endif
2091 2341
        || !READ(E0_ENABLE_PIN)) //If any of the drivers are enabled...
@@ -2287,3 +2537,4 @@ bool setTargetedHotend(int code){
2287 2537
   }
2288 2538
   return false;
2289 2539
 }
2540
+

+ 2
- 0
Marlin/Servo.cpp View File

@@ -41,6 +41,8 @@
41 41
  detach()    - Stops an attached servos from pulsing its i/o pin.
42 42
 
43 43
 */
44
+#include "Configuration.h" 
45
+
44 46
 #ifdef NUM_SERVOS
45 47
 #include <avr/interrupt.h>
46 48
 #include <Arduino.h>

+ 13
- 7
Marlin/cardreader.cpp View File

@@ -18,6 +18,8 @@ CardReader::CardReader()
18 18
    saving = false;
19 19
    logging = false;
20 20
    autostart_atmillis=0;
21
+   workDirDepth = 0;
22
+   memset(workDirParents, 0, sizeof(workDirParents));
21 23
 
22 24
    autostart_stilltocheck=true; //the sd start is delayed, because otherwise the serial cannot answer fast enought to make contact with the hostsoftware.
23 25
    lastnr=0;
@@ -204,7 +206,6 @@ void CardReader::startFileprint()
204 206
   if(cardOK)
205 207
   {
206 208
     sdprinting = true;
207
-    
208 209
   }
209 210
 }
210 211
 
@@ -521,19 +522,24 @@ void CardReader::chdir(const char * relpath)
521 522
   }
522 523
   else
523 524
   {
524
-    workDirParentParent=workDirParent;
525
-    workDirParent=*parent;
526
-    
525
+    if (workDirDepth < MAX_DIR_DEPTH) {
526
+      for (int d = ++workDirDepth; d--;)
527
+        workDirParents[d+1] = workDirParents[d];
528
+      workDirParents[0]=*parent;
529
+    }
527 530
     workDir=newfile;
528 531
   }
529 532
 }
530 533
 
531 534
 void CardReader::updir()
532 535
 {
533
-  if(!workDir.isRoot())
536
+  if(workDirDepth > 0)
534 537
   {
535
-    workDir=workDirParent;
536
-    workDirParent=workDirParentParent;
538
+    --workDirDepth;
539
+    workDir = workDirParents[0];
540
+    int d;
541
+    for (int d = 0; d < workDirDepth; d++)
542
+      workDirParents[d] = workDirParents[d+1];
537 543
   }
538 544
 }
539 545
 

+ 4
- 1
Marlin/cardreader.h View File

@@ -3,6 +3,8 @@
3 3
 
4 4
 #ifdef SDSUPPORT
5 5
 
6
+#define MAX_DIR_DEPTH 10
7
+
6 8
 #include "SdFile.h"
7 9
 enum LsAction {LS_SerialPrint,LS_Count,LS_GetFilename};
8 10
 class CardReader
@@ -53,7 +55,8 @@ public:
53 55
   bool filenameIsDir;
54 56
   int lastnr; //last number of the autostart;
55 57
 private:
56
-  SdFile root,*curDir,workDir,workDirParent,workDirParentParent;
58
+  SdFile root,*curDir,workDir,workDirParents[MAX_DIR_DEPTH];
59
+  uint16_t workDirDepth;
57 60
   Sd2Card card;
58 61
   SdVolume volume;
59 62
   SdFile file;

+ 17
- 6
Marlin/dogm_lcd_implementation.h View File

@@ -33,11 +33,11 @@
33 33
 #define LCD_CLICKED (buttons&EN_C)
34 34
 #endif
35 35
 
36
-// CHANGE_DE begin ***
37
-#include <U8glib.h>	// DE_U8glib
36
+#include <U8glib.h>
38 37
 #include "DOGMbitmaps.h"
39 38
 #include "dogm_font_data_marlin.h"
40 39
 #include "ultralcd.h"
40
+#include "ultralcd_st7920_u8glib_rrd.h"
41 41
 
42 42
 
43 43
 /* Russian language not supported yet, needs custom font
@@ -74,17 +74,28 @@
74 74
 
75 75
 #define FONT_STATUSMENU	u8g_font_6x9
76 76
 
77
+int lcd_contrast;
77 78
 
78 79
 // LCD selection
79 80
 #ifdef U8GLIB_ST7920
80
-// SPI Com: SCK = en = (D4), MOSI = rw = (RS), CS = di = (ENABLE)
81
-U8GLIB_ST7920_128X64_1X u8g(LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS);
81
+//U8GLIB_ST7920_128X64_RRD u8g(0,0,0);
82
+U8GLIB_ST7920_128X64_RRD u8g(0);
83
+#elif defined(MAKRPANEL)
84
+// The MaKrPanel display, ST7565 controller as well
85
+U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0);
82 86
 #else
87
+// for regular DOGM128 display with HW-SPI
83 88
 U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0);	// HW-SPI Com: CS, A0
84 89
 #endif
85 90
 
86 91
 static void lcd_implementation_init()
87 92
 {
93
+#ifdef LCD_PIN_BL
94
+	pinMode(LCD_PIN_BL, OUTPUT);	// Enable LCD backlight
95
+	digitalWrite(LCD_PIN_BL, HIGH);
96
+#endif
97
+
98
+        u8g.setContrast(lcd_contrast);	
88 99
 	//  Uncomment this if you have the first generation (V1.10) of STBs board
89 100
 	//  pinMode(17, OUTPUT);	// Enable LCD backlight
90 101
 	//  digitalWrite(17, HIGH);
@@ -118,14 +129,14 @@ static void lcd_implementation_init()
118 129
 			u8g.setFont(u8g_font_6x10_marlin);
119 130
 			u8g.drawStr(62,10,"MARLIN"); 
120 131
 			u8g.setFont(u8g_font_5x8);
121
-			u8g.drawStr(62,19,"V1.0.0 RC2");
132
+			u8g.drawStr(62,19,"V1.0.0 RC2-mm");
122 133
 			u8g.setFont(u8g_font_6x10_marlin);
123 134
 			u8g.drawStr(62,28,"by ErikZalm");
124 135
 			u8g.drawStr(62,41,"DOGM128 LCD");
125 136
 			u8g.setFont(u8g_font_5x8);
126 137
 			u8g.drawStr(62,48,"enhancements");
127 138
 			u8g.setFont(u8g_font_5x8);
128
-			u8g.drawStr(62,55,"by STB");
139
+			u8g.drawStr(62,55,"by STB, MM");
129 140
 			u8g.drawStr(62,61,"uses u");
130 141
 			u8g.drawStr90(92,57,"8");
131 142
 			u8g.drawStr(100,61,"glib");

+ 134
- 113
Marlin/language.h View File

@@ -3,13 +3,13 @@
3 3
 
4 4
 // NOTE: IF YOU CHANGE THIS FILE / MERGE THIS FILE WITH CHANGES
5 5
 //
6
-//   ==&gt; ALWAYS TRY TO COMPILE MARLIN WITH/WITHOUT "ULTIPANEL" / "ULTRALCD" / "SDSUPPORT" #define IN "Configuration.h" 
7
-//   ==&gt; ALSO TRY ALL AVAILABLE "LANGUAGE_CHOICE" OPTIONS
6
+//   ==> ALWAYS TRY TO COMPILE MARLIN WITH/WITHOUT "ULTIPANEL" / "ULTRALCD" / "SDSUPPORT" #define IN "Configuration.h" 
7
+//   ==> ALSO TRY ALL AVAILABLE "LANGUAGE_CHOICE" OPTIONS
8 8
 
9 9
 // Languages
10 10
 // 1  English
11 11
 // 2  Polish
12
-// 3  French	(awaiting translation!)
12
+// 3  French
13 13
 // 4  German
14 14
 // 5  Spanish
15 15
 // 6  Russian
@@ -29,8 +29,15 @@
29 29
 #elif MOTHERBOARD == 80
30 30
 	#define MACHINE_NAME "Rumba"
31 31
 	#define FIRMWARE_URL "https://github.com/ErikZalm/Marlin/"
32
+#elif MOTHERBOARD == 77
33
+	#define MACHINE_NAME "3Drag"
34
+	#define FIRMWARE_URL "http://3dprint.elettronicain.it/"
32 35
 #else
33
-	#define MACHINE_NAME "Mendel"
36
+	#ifdef CUSTOM_MENDEL_NAME
37
+		#define MACHINE_NAME CUSTOM_MENDEL_NAME
38
+	#else
39
+		#define MACHINE_NAME "Mendel"
40
+	#endif
34 41
 	#define FIRMWARE_URL "http://www.mendel-parts.com"
35 42
 #endif
36 43
 
@@ -75,9 +82,9 @@
75 82
 	#define MSG_PID_D "PID-D"
76 83
 	#define MSG_PID_C "PID-C"
77 84
 	#define MSG_ACC  "Accel"
78
-	#define MSG_VXY_JERK "Vxy-jerk"
79
-	#define MSG_VZ_JERK "Vz-jerk"
80
-	#define MSG_VE_JERK "Ve-jerk"
85
+	#define MSG_VXY_JERK "Vxy-jerk"
86
+	#define MSG_VZ_JERK "Vz-jerk"
87
+	#define MSG_VE_JERK "Ve-jerk"
81 88
 	#define MSG_VMAX "Vmax "
82 89
 	#define MSG_X "x"
83 90
 	#define MSG_Y "y"
@@ -94,6 +101,7 @@
94 101
 	#define MSG_RECTRACT "Rectract"
95 102
 	#define MSG_TEMPERATURE "Temperature"
96 103
 	#define MSG_MOTION "Motion"
104
+	#define MSG_CONTRAST "LCD contrast"
97 105
 	#define MSG_STORE_EPROM "Store memory"
98 106
 	#define MSG_LOAD_EPROM "Load memory"
99 107
 	#define MSG_RESTORE_FAILSAFE "Restore Failsafe"
@@ -188,7 +196,7 @@
188 196
 	#define MSG_SD_ERR_WRITE_TO_FILE "error writing to file"
189 197
 	#define MSG_SD_CANT_ENTER_SUBDIR "Cannot enter subdir: "
190 198
 
191
-	#define MSG_STEPPER_TO_HIGH "Steprate to high: "
199
+	#define MSG_STEPPER_TOO_HIGH "Steprate too high: "
192 200
 	#define MSG_ENDSTOPS_HIT "endstops hit: "
193 201
 	#define MSG_ERR_COLD_EXTRUDE_STOP " cold extrusion prevented"
194 202
 	#define MSG_ERR_LONG_EXTRUDE_STOP " too long extrusion prevented"
@@ -235,8 +243,8 @@
235 243
 	#define MSG_PID_C "PID-C"
236 244
 	#define MSG_ACC  "Acc"
237 245
 	#define MSG_VXY_JERK "Zryw Vxy"
238
-	#define MSG_VZ_JERK "Zryw Vz"
239
-	#define MSG_VE_JERK "Zryw Ve"
246
+	#define MSG_VZ_JERK "Zryw Vz"
247
+	#define MSG_VE_JERK "Zryw Ve"
240 248
 	#define MSG_VMAX "Vmax"
241 249
 	#define MSG_X "x"
242 250
 	#define MSG_Y "y"
@@ -253,6 +261,7 @@
253 261
 	#define MSG_RECTRACT "Wycofanie"
254 262
 	#define MSG_TEMPERATURE "Temperatura"
255 263
 	#define MSG_MOTION "Ruch"
264
+	#define MSG_CONTRAST "LCD contrast"
256 265
 	#define MSG_STORE_EPROM "Zapisz w pamieci"
257 266
 	#define MSG_LOAD_EPROM "Wczytaj z pamieci"
258 267
 	#define MSG_RESTORE_FAILSAFE " Ustawienia fabryczne"
@@ -348,7 +357,7 @@
348 357
 	#define MSG_SD_ERR_WRITE_TO_FILE "blad podczas zapisu do pliku"
349 358
 	#define MSG_SD_CANT_ENTER_SUBDIR "Nie mozna odczytac podkatalogu: "
350 359
 
351
-	#define MSG_STEPPER_TO_HIGH "Za duza czestotliwosc krokow: "
360
+	#define MSG_STEPPER_TOO_HIGH "Za duza czestotliwosc krokow: "
352 361
 	#define MSG_ENDSTOPS_HIT "Wylacznik krancowy zostal wyzwolony na pozycji: "
353 362
 	#define MSG_ERR_COLD_EXTRUDE_STOP " uniemozliwiono zimna ekstruzje"
354 363
 	#define MSG_ERR_LONG_EXTRUDE_STOP " uniemozliwiono zbyt dluga ekstruzje"
@@ -396,8 +405,8 @@
396 405
 #define MSG_PID_C " PID-C: "
397 406
 #define MSG_ACC " Acc:"
398 407
 #define MSG_VXY_JERK "Vxy-jerk"
399
-#define MSG_VZ_JERK "Vz-jerk"
400
-#define MSG_VE_JERK "Ve-jerk"
408
+#define MSG_VZ_JERK "Vz-jerk"
409
+#define MSG_VE_JERK "Ve-jerk"
401 410
 #define MSG_VMAX " Vmax "
402 411
 #define MSG_X "x:"
403 412
 #define MSG_Y "y:"
@@ -416,6 +425,7 @@
416 425
 #define MSG_TEMPERATURE_WIDE " Temperature \x7E"
417 426
 #define MSG_TEMPERATURE_RTN " Temperature \003"
418 427
 #define MSG_MOTION_WIDE " Mouvement \x7E"
428
+	#define MSG_CONTRAST "LCD contrast"
419 429
 #define MSG_STORE_EPROM " Sauvegarder memoire"
420 430
 #define MSG_LOAD_EPROM " Lire memoire"
421 431
 #define MSG_RESTORE_FAILSAFE " Restaurer memoire"
@@ -512,7 +522,7 @@
512 522
 #define MSG_SD_ERR_WRITE_TO_FILE "Erreur d'ecriture dans le fichier"
513 523
 #define MSG_SD_CANT_ENTER_SUBDIR "Impossible d'entrer dans le sous-repertoire: "
514 524
 
515
-#define MSG_STEPPER_TO_HIGH "Steprate trop eleve: "
525
+#define MSG_STEPPER_TOO_HIGH "Steprate trop eleve: "
516 526
 #define MSG_ENDSTOPS_HIT "Fin de course atteint: "
517 527
 #define MSG_ERR_COLD_EXTRUDE_STOP " Extrusion a froid evitee"
518 528
 #define MSG_ERR_LONG_EXTRUDE_STOP " Extrusion longue evitee"
@@ -528,7 +538,7 @@
528 538
 
529 539
 	#define MSG_SD_INSERTED      "SDKarte erkannt"
530 540
 	#define MSG_SD_REMOVED       "SDKarte entfernt"
531
-	#define MSG_MAIN             "Hauptmneü"
541
+	#define MSG_MAIN             "Hauptmenü"
532 542
 	#define MSG_AUTOSTART        "Autostart"
533 543
 	#define MSG_DISABLE_STEPPERS "Stepper abschalten"
534 544
 	#define MSG_AUTO_HOME        "Auto Nullpunkt"
@@ -547,7 +557,7 @@
547 557
 	#define MSG_NOZZLE2          "Düse3"
548 558
 	#define MSG_BED              "Bett"
549 559
 	#define MSG_FAN_SPEED        "Lüftergeschw."
550
-	#define MSG_FLOW             "Fluß"
560
+	#define MSG_FLOW             "Fluss"
551 561
 	#define MSG_CONTROL          "Einstellungen"
552 562
 	#define MSG_MIN              "\002 Min"
553 563
 	#define MSG_MAX              "\002 Max"
@@ -561,8 +571,8 @@
561 571
 	#define MSG_PID_C            "PID-C"
562 572
 	#define MSG_ACC              "Acc"
563 573
 	#define MSG_VXY_JERK         "Vxy-jerk"
564
-	#define MSG_VZ_JERK          "Vz-jerk"
565
-	#define MSG_VE_JERK          "Ve-jerk"
574
+	#define MSG_VZ_JERK          "Vz-jerk"
575
+	#define MSG_VE_JERK          "Ve-jerk"
566 576
 	#define MSG_VMAX             "Vmax "
567 577
 	#define MSG_X                "x"
568 578
 	#define MSG_Y                "y"
@@ -580,6 +590,7 @@
580 590
 	#define MSG_WATCH            "Beobachten"
581 591
 	#define MSG_TEMPERATURE      "Temperatur"
582 592
 	#define MSG_MOTION           "Bewegung"
593
+	#define MSG_CONTRAST "LCD contrast"
583 594
 	#define MSG_STORE_EPROM      "EPROM speichern"
584 595
 	#define MSG_LOAD_EPROM       "EPROM laden"
585 596
 	#define MSG_RESTORE_FAILSAFE "Standardkonfig."
@@ -674,7 +685,7 @@
674 685
 	#define MSG_SD_ERR_WRITE_TO_FILE "error writing to file"
675 686
 	#define MSG_SD_CANT_ENTER_SUBDIR "Cannot enter subdir:"
676 687
 
677
-	#define MSG_STEPPER_TO_HIGH "Steprate to high : "
688
+	#define MSG_STEPPER_TOO_HIGH "Steprate too high : "
678 689
 	#define MSG_ENDSTOPS_HIT "endstops hit: "
679 690
 	#define MSG_ERR_COLD_EXTRUDE_STOP " cold extrusion prevented"
680 691
 	#define MSG_ERR_LONG_EXTRUDE_STOP " too long extrusion prevented"
@@ -685,91 +696,98 @@
685 696
 #if LANGUAGE_CHOICE == 5
686 697
 
687 698
 // LCD Menu Messages
688
-#define WELCOME_MSG MACHINE_NAME " Lista."
699
+#define WELCOME_MSG MACHINE_NAME "Lista."
689 700
 #define MSG_SD_INSERTED "Tarjeta SD Colocada"
690 701
 #define MSG_SD_REMOVED "Tarjeta SD Retirada"
691
-#define MSG_MAIN " Menu Principal \003"
702
+#define MSG_MAIN "Menu Principal"
692 703
 #define MSG_AUTOSTART " Autostart"
693
-#define MSG_DISABLE_STEPPERS " Apagar Motores"
694
-#define MSG_AUTO_HOME " Llevar Ejes al Cero"
695
-#define MSG_SET_ORIGIN " Establecer Cero"
696
-#define MSG_COOLDOWN " Enfriar"
697
-#define MSG_EXTRUDE " Extruir"
698
-#define MSG_RETRACT " Retraer"
699
-#define MSG_PREHEAT_PLA " Precalentar PLA"
700
-#define MSG_PREHEAT_PLA_SETTINGS " Ajustar temp. PLA"
701
-#define MSG_PREHEAT_ABS " Precalentar ABS"
702
-#define MSG_PREHEAT_ABS_SETTINGS " Ajustar temp. ABS"
703
-#define MSG_MOVE_AXIS " Mover Ejes      \x7E"
704
-#define MSG_SPEED " Velocidad:"
705
-#define MSG_NOZZLE " \002Nozzle:"
706
-#define MSG_NOZZLE1 " \002Nozzle2:"
707
-#define MSG_NOZZLE2 " \002Nozzle3:"
708
-#define MSG_BED " \002Base:"
709
-#define MSG_FAN_SPEED " Ventilador:"
710
-#define MSG_FLOW " Flujo:"
711
-#define MSG_CONTROL " Control \003"
712
-#define MSG_MIN " \002 Min:"
713
-#define MSG_MAX " \002 Max:"
714
-#define MSG_FACTOR " \002 Fact:"
715
-#define MSG_AUTOTEMP " Autotemp:"
716
-#define MSG_ON "On "
704
+#define MSG_DISABLE_STEPPERS "Apagar Motores"
705
+#define MSG_AUTO_HOME "Llevar al Origen" // "Llevar Ejes al Cero"
706
+#define MSG_SET_ORIGIN "Establecer Cero"
707
+#define MSG_PREHEAT_PLA "Precalentar PLA"
708
+#define MSG_PREHEAT_PLA_SETTINGS "Ajustar temp. PLA"
709
+#define MSG_PREHEAT_ABS "Precalentar ABS"
710
+#define MSG_PREHEAT_ABS_SETTINGS "Ajustar temp. ABS"
711
+#define MSG_COOLDOWN "Enfriar"
712
+#define MSG_EXTRUDE "Extruir"
713
+#define MSG_RETRACT "Retraer"
714
+#define MSG_MOVE_AXIS "Mover Ejes"
715
+#define MSG_SPEED "Velocidad"
716
+#define MSG_NOZZLE "Nozzle"
717
+#define MSG_NOZZLE1 "Nozzle2"
718
+#define MSG_NOZZLE2 "Nozzle3"
719
+#define MSG_BED "Base"
720
+#define MSG_FAN_SPEED "Ventilador"
721
+#define MSG_FLOW "Flujo"
722
+#define MSG_CONTROL "Control"
723
+#define MSG_MIN "\002 Min"
724
+#define MSG_MAX "\002 Max"
725
+#define MSG_FACTOR "\002 Fact"
726
+#define MSG_AUTOTEMP "Autotemp"
727
+#define MSG_ON "On"
717 728
 #define MSG_OFF "Off"
718
-#define MSG_PID_P " PID-P: "
719
-#define MSG_PID_I " PID-I: "
720
-#define MSG_PID_D " PID-D: "
721
-#define MSG_PID_C " PID-C: "
722
-#define MSG_ACC  " Acc:"
723
-#define MSG_VXY_JERK " Vxy-jerk: "
724
-#define MSG_VZ_JERK "Vz-jerk"
725
-#define MSG_VE_JERK "Ve-jerk"
726
-#define MSG_VMAX " Vmax "
727
-#define MSG_X "x:"
728
-#define MSG_Y "y:"
729
-#define MSG_Z "z:"
730
-#define MSG_E "e:"
731
-#define MSG_VMIN " Vmin:"
732
-#define MSG_VTRAV_MIN " VTrav min:"
733
-#define MSG_AMAX " Amax "
734
-#define MSG_A_RETRACT " A-retrac.:"
735
-#define MSG_XSTEPS " Xpasos/mm:"
736
-#define MSG_YSTEPS " Ypasos/mm:"
737
-#define MSG_ZSTEPS " Zpasos/mm:"
738
-#define MSG_ESTEPS " Epasos/mm:"
739
-#define MSG_MAIN_WIDE " Menu Principal  \003"
740
-#define MSG_RECTRACT_WIDE " Retraer         \x7E"
741
-#define MSG_TEMPERATURE_WIDE " Temperatura     \x7E"
742
-#define MSG_TEMPERATURE_RTN  " Temperatura     \003"
743
-#define MSG_MOTION_WIDE " Movimiento      \x7E"
744
-#define MSG_STORE_EPROM " Guardar Memoria"
745
-#define MSG_LOAD_EPROM " Cargar Memoria"
746
-#define MSG_RESTORE_FAILSAFE " Rest. de emergencia"
747
-#define MSG_REFRESH "\004Volver a cargar"
748
-#define MSG_WATCH " Monitorizar \003"
749
-#define MSG_PREPARE " Preparar \x7E"
750
-#define MSG_PREPARE_ALT " Preparar \003"
751
-#define MSG_CONTROL_ARROW " Control  \x7E"
752
-#define MSG_RETRACT_ARROW " Retraer  \x7E"
753
-#define MSG_TUNE " Ajustar \x7E"
754
-#define MSG_PAUSE_PRINT " Pausar Impresion \x7E"
755
-#define MSG_RESUME_PRINT " Reanudar Impresion \x7E"
756
-#define MSG_STOP_PRINT " Detener Impresion \x7E"
757
-#define MSG_CARD_MENU " Menu de SD    \x7E"
758
-#define MSG_NO_CARD " No hay Tarjeta SD"
729
+#define MSG_PID_P "PID-P"
730
+#define MSG_PID_I "PID-I"
731
+#define MSG_PID_D "PID-D"
732
+#define MSG_PID_C "PID-C"
733
+#define MSG_ACC  "Acel"
734
+#define MSG_VXY_JERK "Vxy-jerk"
735
+#define MSG_VZ_JERK "Vz-jerk"
736
+#define MSG_VE_JERK "Ve-jerk"
737
+#define MSG_VMAX "Vmax"
738
+#define MSG_X "x"
739
+#define MSG_Y "y"
740
+#define MSG_Z "z"
741
+#define MSG_E "e"
742
+#define MSG_VMIN "Vmin"
743
+#define MSG_VTRAV_MIN "VTrav min"
744
+#define MSG_AMAX "Amax"
745
+#define MSG_A_RETRACT "A-retrac."
746
+#define MSG_XSTEPS "X pasos/mm"
747
+#define MSG_YSTEPS "Y pasos/mm"
748
+#define MSG_ZSTEPS "Z pasos/mm"
749
+#define MSG_ESTEPS "E pasos/mm"
750
+#define MSG_RECTRACT "Retraer"
751
+#define MSG_TEMPERATURE "Temperatura"
752
+#define MSG_MOTION "Movimiento"
753
+#define MSG_STORE_EPROM "Guardar Memoria"
754
+#define MSG_LOAD_EPROM "Cargar Memoria"
755
+#define MSG_RESTORE_FAILSAFE "Rest. de emergencia"
756
+#define MSG_REFRESH "Volver a cargar"
757
+#define MSG_WATCH "Monitorizar"
758
+#define MSG_PREPARE "Preparar"
759
+#define MSG_TUNE "Ajustar"
760
+#define MSG_PAUSE_PRINT "Pausar Impresion"
761
+#define MSG_RESUME_PRINT "Reanudar Impresion"
762
+#define MSG_STOP_PRINT "Detener Impresion"
763
+#define MSG_CARD_MENU "Menu de SD"
764
+#define MSG_NO_CARD "No hay Tarjeta SD"
759 765
 #define MSG_DWELL "Reposo..."
760 766
 #define MSG_USERWAIT "Esperando Ordenes..."
767
+#define MSG_RESUMING "Resumiendo Impresion"
761 768
 #define MSG_NO_MOVE "Sin movimiento"
762
-#define MSG_PART_RELEASE "Desacople Parcial"
763 769
 #define MSG_KILLED "PARADA DE EMERGENCIA. "
764
-#define MSG_STOPPED "PARADA. "
765
-#define MSG_STEPPER_RELEASED "Desacoplada."
766
-#define MSG_CONTROL_RETRACT  " Retraer mm:"
767
-#define MSG_CONTROL_RETRACTF " Retraer  F:"
768
-#define MSG_CONTROL_RETRACT_ZLIFT " Levantar mm:"
769
-#define MSG_CONTROL_RETRACT_RECOVER " DesRet +mm:"
770
-#define MSG_CONTROL_RETRACT_RECOVERF " DesRet F:"
771
-#define MSG_AUTORETRACT " AutoRetr.:"
770
+#define MSG_STOPPED "PARADA."
771
+#define MSG_CONTROL_RETRACT  "Retraer mm"
772
+#define MSG_CONTROL_RETRACTF "Retraer  F"
773
+#define MSG_CONTROL_RETRACT_ZLIFT "Levantar mm"
774
+#define MSG_CONTROL_RETRACT_RECOVER "DesRet +mm"
775
+#define MSG_CONTROL_RETRACT_RECOVERF "DesRet F"
776
+#define MSG_AUTORETRACT "AutoRetr."
772 777
 #define MSG_FILAMENTCHANGE "Change filament"
778
+#define MSG_INIT_SDCARD "Iniciando. Tarjeta-SD"
779
+#define MSG_CNG_SDCARD "Cambiar Tarjeta-SD"
780
+#define MSG_RECTRACT_WIDE "Retraer"
781
+#define MSG_TEMPERATURE_WIDE "Temperatura"
782
+#define MSG_TEMPERATURE_RTN  "Temperatura"
783
+#define MSG_MAIN_WIDE "Menu Principal"
784
+#define MSG_MOTION_WIDE "Movimiento"
785
+#define MSG_PREPARE_ALT "Preparar"
786
+#define MSG_CONTROL_ARROW "Control"
787
+#define MSG_RETRACT_ARROW "Retraer"
788
+#define MSG_PART_RELEASE "Desacople Parcial"
789
+#define MSG_STEPPER_RELEASED "Desacoplada."
790
+
773 791
 // Serial Console Messages
774 792
 
775 793
 #define MSG_Enqueing "En cola \""
@@ -814,11 +832,11 @@
814 832
 #define MSG_Y_MIN "y_min: "
815 833
 #define MSG_Y_MAX "y_max: "
816 834
 #define MSG_Z_MIN "z_min: "
835
+#define MSG_Z_MAX "z_max: "
817 836
 #define MSG_M119_REPORT "Comprobando fines de carrera."
818 837
 #define MSG_ENDSTOP_HIT "PULSADO"
819 838
 #define MSG_ENDSTOP_OPEN "abierto"
820 839
 #define MSG_HOTEND_OFFSET "Hotend offsets:"
821
-        
822 840
 #define MSG_SD_CANT_OPEN_SUBDIR "No se pudo abrir la subcarpeta."
823 841
 #define MSG_SD_INIT_FAIL "Fallo al iniciar la SD"
824 842
 #define MSG_SD_VOL_INIT_FAIL "Fallo al montar el volumen"
@@ -835,7 +853,7 @@
835 853
 #define MSG_SD_ERR_WRITE_TO_FILE "Error al escribir en el archivo"
836 854
 #define MSG_SD_CANT_ENTER_SUBDIR "No se puede abrir la carpeta:"
837 855
 
838
-#define MSG_STEPPER_TO_HIGH "Steprate demasiado alto : "
856
+#define MSG_STEPPER_TOO_HIGH "Steprate demasiado alto : "
839 857
 #define MSG_ENDSTOPS_HIT "Se ha tocado el fin de carril: "
840 858
 #define MSG_ERR_COLD_EXTRUDE_STOP " extrusion fria evitada"
841 859
 #define MSG_ERR_LONG_EXTRUDE_STOP " extrusion demasiado larga evitada"
@@ -881,8 +899,8 @@
881 899
 #define MSG_PID_C							" PID-C: "
882 900
 #define MSG_ACC								" Acc:"
883 901
 #define MSG_VXY_JERK						" Vxy-jerk: "
884
-#define MSG_VZ_JERK                         "Vz-jerk"
885
-#define MSG_VE_JERK                         "Ve-jerk"
902
+#define MSG_VZ_JERK                         "Vz-jerk"
903
+#define MSG_VE_JERK                         "Ve-jerk"
886 904
 #define MSG_VMAX							" Vmax "
887 905
 #define MSG_X								"x:"
888 906
 #define MSG_Y								"y:"
@@ -899,6 +917,7 @@
899 917
 #define MSG_RECTRACT    					" Откат подачи      \x7E"
900 918
 #define MSG_TEMPERATURE  				" Температура       \x7E"
901 919
 #define MSG_MOTION						" Скорости          \x7E"
920
+	#define MSG_CONTRAST "LCD contrast"
902 921
 #define MSG_STORE_EPROM						" Сохранить настройки"
903 922
 #define MSG_LOAD_EPROM						" Загрузить настройки"
904 923
 #define MSG_RESTORE_FAILSAFE				" Сброс настроек     "
@@ -989,7 +1008,7 @@
989 1008
 #define MSG_SD_NOT_PRINTING					"нет SD печати"
990 1009
 #define MSG_SD_ERR_WRITE_TO_FILE			"ошибка записи в файл"
991 1010
 #define MSG_SD_CANT_ENTER_SUBDIR			"Не зайти в папку:"
992
-#define MSG_STEPPER_TO_HIGH					"Частота шагов очень высока : "
1011
+#define MSG_STEPPER_TOO_HIGH				"Частота шагов очень высока : "
993 1012
 #define MSG_ENDSTOPS_HIT					"концевик сработал: "
994 1013
 #define MSG_ERR_COLD_EXTRUDE_STOP			" защита холодной экструзии"
995 1014
 #define MSG_ERR_LONG_EXTRUDE_STOP			" защита превышения длинны экструзии"
@@ -1000,7 +1019,7 @@
1000 1019
 #if LANGUAGE_CHOICE == 7
1001 1020
 
1002 1021
 	// LCD Menu Messages
1003
-	#define WELCOME_MSG MACHINE_NAME " Pronto."
1022
+	#define WELCOME_MSG MACHINE_NAME " Pronta"
1004 1023
 	#define MSG_SD_INSERTED          "SD Card inserita"
1005 1024
 	#define MSG_SD_REMOVED           "SD Card rimossa"
1006 1025
 	#define MSG_MAIN                 "Menu principale"
@@ -1012,7 +1031,7 @@
1012 1031
 	#define MSG_PREHEAT_PLA_SETTINGS "Preris. PLA Conf"
1013 1032
 	#define MSG_PREHEAT_ABS          "Preriscalda ABS"
1014 1033
 	#define MSG_PREHEAT_ABS_SETTINGS "Preris. ABS Conf"
1015
-	#define MSG_COOLDOWN             "Rafredda"
1034
+	#define MSG_COOLDOWN             "Raffredda"
1016 1035
 	#define MSG_EXTRUDE              "Estrudi"
1017 1036
 	#define MSG_RETRACT              "Ritrai"
1018 1037
 	#define MSG_MOVE_AXIS            "Muovi Asse"
@@ -1036,8 +1055,8 @@
1036 1055
 	#define MSG_PID_C                "PID-C"
1037 1056
 	#define MSG_ACC                  "Accel"
1038 1057
 	#define MSG_VXY_JERK             "Vxy-jerk"
1039
-	#define MSG_VZ_JERK              "Vz-jerk"
1040
-	#define MSG_VE_JERK              "Ve-jerk"
1058
+	#define MSG_VZ_JERK              "Vz-jerk"
1059
+	#define MSG_VE_JERK              "Ve-jerk"
1041 1060
 	#define MSG_VMAX                 "Vmax"
1042 1061
 	#define MSG_X                    "x"
1043 1062
 	#define MSG_Y                    "y"
@@ -1054,6 +1073,7 @@
1054 1073
 	#define MSG_RECTRACT             "Ritrai"
1055 1074
 	#define MSG_TEMPERATURE          "Temperatura"
1056 1075
 	#define MSG_MOTION               "Movimento"
1076
+	#define MSG_CONTRAST "LCD contrast"
1057 1077
 	#define MSG_STORE_EPROM          "Salva in EEPROM"
1058 1078
 	#define MSG_LOAD_EPROM           "Carica da EEPROM"
1059 1079
 	#define MSG_RESTORE_FAILSAFE     "Impostaz. default"
@@ -1149,7 +1169,7 @@
1149 1169
 	#define MSG_SD_ERR_WRITE_TO_FILE "Errore nella scrittura su file"
1150 1170
 	#define MSG_SD_CANT_ENTER_SUBDIR "Impossibile entrare nella sottocartella: "
1151 1171
 
1152
-	#define MSG_STEPPER_TO_HIGH      "Steprate troppo alto: "
1172
+	#define MSG_STEPPER_TOO_HIGH     "Steprate troppo alto: "
1153 1173
 	#define MSG_ENDSTOPS_HIT         "Raggiunto il fondo carrello: "
1154 1174
 	#define MSG_ERR_COLD_EXTRUDE_STOP " prevenuta estrusione fredda"
1155 1175
 	#define MSG_ERR_LONG_EXTRUDE_STOP " prevenuta estrusione troppo lunga"
@@ -1198,8 +1218,8 @@
1198 1218
 	#define MSG_PID_C " PID-C: "
1199 1219
 	#define MSG_ACC  " Acc:"
1200 1220
 	#define MSG_VXY_JERK " Vxy-jerk: "
1201
-	#define MSG_VZ_JERK "Vz-jerk"
1202
-	#define MSG_VE_JERK "Ve-jerk"
1221
+	#define MSG_VZ_JERK "Vz-jerk"
1222
+	#define MSG_VE_JERK "Ve-jerk"
1203 1223
 	#define MSG_VMAX " Vmax "
1204 1224
 	#define MSG_X "x:"
1205 1225
 	#define MSG_Y "y:"
@@ -1246,8 +1266,8 @@
1246 1266
 	#define MSG_CONTROL_RETRACT_RECOVER " DesRet +mm:"
1247 1267
 	#define MSG_CONTROL_RETRACT_RECOVERF " DesRet  F:"
1248 1268
 	#define MSG_AUTORETRACT " AutoRetr.:"
1249
-        #define MSG_SERIAL_ERROR_MENU_STRUCTURE "Algo esta errado na estrutura do Menu."
1250
-        #define MSG_FILAMENTCHANGE "Change filament"
1269
+	#define MSG_SERIAL_ERROR_MENU_STRUCTURE "Algo esta errado na estrutura do Menu."
1270
+	#define MSG_FILAMENTCHANGE "Change filament"
1251 1271
 
1252 1272
 // Serial Console Messages
1253 1273
 
@@ -1315,7 +1335,7 @@
1315 1335
 	#define MSG_SD_ERR_WRITE_TO_FILE "Erro ao escrever no arquivo"
1316 1336
 	#define MSG_SD_CANT_ENTER_SUBDIR "Nao pode abrir o sub diretorio:"
1317 1337
 
1318
-	#define MSG_STEPPER_TO_HIGH "Steprate muito alto : "
1338
+	#define MSG_STEPPER_TOO_HIGH "Steprate muito alto : "
1319 1339
 	#define MSG_ENDSTOPS_HIT "O ponto final foi tocado: "
1320 1340
 	#define MSG_ERR_COLD_EXTRUDE_STOP " Extrusao a frio evitada"
1321 1341
 	#define MSG_ERR_LONG_EXTRUDE_STOP " Extrusao muito larga evitada"
@@ -1366,8 +1386,8 @@
1366 1386
 	#define MSG_PID_C "PID-C"
1367 1387
 	#define MSG_ACC  "Kiihtyv"
1368 1388
 	#define MSG_VXY_JERK "Vxy-jerk"
1369
-	#define MSG_VZ_JERK "Vz-jerk"
1370
-	#define MSG_VE_JERK "Ve-jerk"
1389
+	#define MSG_VZ_JERK "Vz-jerk"
1390
+	#define MSG_VE_JERK "Ve-jerk"
1371 1391
 	#define MSG_VMAX "Vmax "
1372 1392
 	#define MSG_X "x"
1373 1393
 	#define MSG_Y "y"
@@ -1384,6 +1404,7 @@
1384 1404
 	#define MSG_RECTRACT "Veda takaisin"
1385 1405
 	#define MSG_TEMPERATURE "Lampotila"
1386 1406
 	#define MSG_MOTION "Liike"
1407
+	#define MSG_CONTRAST "LCD contrast"
1387 1408
 	#define MSG_STORE_EPROM "Tallenna muistiin"
1388 1409
 	#define MSG_LOAD_EPROM "Lataa muistista"
1389 1410
 	#define MSG_RESTORE_FAILSAFE "Palauta oletus"
@@ -1476,7 +1497,7 @@
1476 1497
 	#define MSG_SD_ERR_WRITE_TO_FILE "virhe kirjoitettaessa tiedostoon"
1477 1498
 	#define MSG_SD_CANT_ENTER_SUBDIR "Alihakemistoon ei voitu siirtya: "
1478 1499
 
1479
-	#define MSG_STEPPER_TO_HIGH "Askellustaajuus liian suuri: "
1500
+	#define MSG_STEPPER_TOO_HIGH "Askellustaajuus liian suuri: "
1480 1501
 	#define MSG_ENDSTOPS_HIT "paatyrajat aktivoitu: "
1481 1502
 	#define MSG_ERR_COLD_EXTRUDE_STOP " kylmana pursotus estetty"
1482 1503
 	#define MSG_ERR_LONG_EXTRUDE_STOP " liian pitka pursotus estetty"

+ 374
- 128
Marlin/pins.h View File

@@ -53,6 +53,7 @@
53 53
 
54 54
 #endif /* 99 */
55 55
 
56
+
56 57
 /****************************************************************************************
57 58
 * Gen7 v1.1, v1.2, v1.3 pin assignment
58 59
 *
@@ -227,8 +228,8 @@
227 228
 #endif
228 229
 
229 230
 //x axis pins
230
-    #define X_STEP_PIN      21                  //different from stanard GEN7
231
-    #define X_DIR_PIN       20            //different from stanard GEN7
231
+    #define X_STEP_PIN      21                  // different from standard GEN7
232
+    #define X_DIR_PIN       20                  // different from standard GEN7
232 233
     #define X_ENABLE_PIN    24
233 234
     #define X_STOP_PIN      0
234 235
 
@@ -297,7 +298,7 @@
297 298
 * Arduino Mega pin assignment
298 299
 *
299 300
 ****************************************************************************************/
300
-#if MOTHERBOARD == 3 || MOTHERBOARD == 33 || MOTHERBOARD == 34
301
+#if MOTHERBOARD == 3 || MOTHERBOARD == 33 || MOTHERBOARD == 34 || MOTHERBOARD == 77
301 302
 #define KNOWN_BOARD 1
302 303
 
303 304
 //////////////////FIX THIS//////////////
@@ -307,149 +308,229 @@
307 308
  #endif
308 309
 #endif
309 310
 
311
+
310 312
 // uncomment one of the following lines for RAMPS v1.3 or v1.0, comment both for v1.2 or 1.1
311 313
 // #define RAMPS_V_1_3
312 314
 // #define RAMPS_V_1_0
313 315
 
314
-#if MOTHERBOARD == 33 || MOTHERBOARD == 34
315 316
 
316
-#define LARGE_FLASH        true
317
-
318
-#define X_STEP_PIN         54
319
-#define X_DIR_PIN          55
320
-#define X_ENABLE_PIN       38
321
-#define X_MIN_PIN           3
322
-#define X_MAX_PIN           2
317
+#if MOTHERBOARD == 33 || MOTHERBOARD == 34 || MOTHERBOARD == 77
323 318
 
324
-#define Y_STEP_PIN         60
325
-#define Y_DIR_PIN          61
326
-#define Y_ENABLE_PIN       56
327
-#define Y_MIN_PIN          14
328
-#define Y_MAX_PIN          15
329
-
330
-#define Z_STEP_PIN         46
331
-#define Z_DIR_PIN          48
332
-#define Z_ENABLE_PIN       62
333
-#define Z_MIN_PIN          18
334
-#define Z_MAX_PIN          19
335
-
336
-#define Z2_STEP_PIN        36
337
-#define Z2_DIR_PIN         34
338
-#define Z2_ENABLE_PIN      30
319
+  #define LARGE_FLASH true
320
+  
321
+  #if MOTHERBOARD == 77
322
+    #define X_STEP_PIN         54
323
+    #define X_DIR_PIN          55
324
+    #define X_ENABLE_PIN       38
325
+    #define X_MIN_PIN           3
326
+    #define X_MAX_PIN           -1   //2 //Max endstops default to disabled "-1", set to commented value to enable.
327
+
328
+    #define Y_STEP_PIN         60
329
+    #define Y_DIR_PIN          61
330
+    #define Y_ENABLE_PIN       56
331
+    #define Y_MIN_PIN          14
332
+    #define Y_MAX_PIN          -1   //15
333
+
334
+    #define Z_STEP_PIN         46
335
+    #define Z_DIR_PIN          48
336
+    #define Z_ENABLE_PIN       63
337
+    #define Z_MIN_PIN          18
338
+    #define Z_MAX_PIN          -1
339
+
340
+    #define Z2_STEP_PIN        36
341
+    #define Z2_DIR_PIN         34
342
+    #define Z2_ENABLE_PIN      30
343
+
344
+    #define E0_STEP_PIN        26
345
+    #define E0_DIR_PIN         28
346
+    #define E0_ENABLE_PIN      24
347
+
348
+    #define E1_STEP_PIN        36
349
+    #define E1_DIR_PIN         34
350
+    #define E1_ENABLE_PIN      30
351
+
352
+    #define SDPOWER            -1
353
+    #define SDSS               25//53
354
+    #define LED_PIN            13
355
+
356
+    #define BEEPER             33    
339 357
 
340
-#define E0_STEP_PIN        26
341
-#define E0_DIR_PIN         28
342
-#define E0_ENABLE_PIN      24
358
+  #else
343 359
 
344
-#define E1_STEP_PIN        36
345
-#define E1_DIR_PIN         34
346
-#define E1_ENABLE_PIN      30
360
+    #define X_STEP_PIN         54
361
+    #define X_DIR_PIN          55
362
+    #define X_ENABLE_PIN       38
363
+    #define X_MIN_PIN           3
364
+    #define X_MAX_PIN           2
365
+
366
+    #define Y_STEP_PIN         60
367
+    #define Y_DIR_PIN          61
368
+    #define Y_ENABLE_PIN       56
369
+    #define Y_MIN_PIN          14
370
+    #define Y_MAX_PIN          15
371
+
372
+    #define Z_STEP_PIN         46
373
+    #define Z_DIR_PIN          48
374
+    #define Z_ENABLE_PIN       62
375
+    #define Z_MIN_PIN          18
376
+    #define Z_MAX_PIN          19
377
+
378
+    #define Z2_STEP_PIN        36
379
+    #define Z2_DIR_PIN         34
380
+    #define Z2_ENABLE_PIN      30
381
+
382
+    #define E0_STEP_PIN        26
383
+    #define E0_DIR_PIN         28
384
+    #define E0_ENABLE_PIN      24
385
+
386
+    #define E1_STEP_PIN        36
387
+    #define E1_DIR_PIN         34
388
+    #define E1_ENABLE_PIN      30
389
+
390
+    #define SDPOWER            -1
391
+    #define SDSS               53
392
+    #define LED_PIN            13
393
+  #endif
347 394
 
348
-#define SDPOWER            -1
349
-#define SDSS               53
350
-#define LED_PIN            13
395
+  #if MOTHERBOARD == 33
396
+    #define FAN_PIN            9 // (Sprinter config)
397
+  #else
398
+    #define FAN_PIN            4 // IO pin. Buffer needed
399
+  #endif
351 400
 
352
-#if MOTHERBOARD == 33
353
-#define FAN_PIN            9 // (Sprinter config)
354
-#else
355
-#define FAN_PIN            4 // IO pin. Buffer needed
356
-#endif
357
-#define PS_ON_PIN          12
401
+  #if MOTHERBOARD == 77
402
+    #define FAN_PIN            8 
403
+  #endif
358 404
 
359
-#if defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
360
-#define KILL_PIN           41
361
-#else
362
-#define KILL_PIN           -1
363
-#endif
405
+  #define PS_ON_PIN          12
364 406
 
365
-#define HEATER_0_PIN       10   // EXTRUDER 1
366
-#if MOTHERBOARD == 33
367
-#define HEATER_1_PIN       -1
368
-#else
369
-#define HEATER_1_PIN       9    // EXTRUDER 2 (FAN On Sprinter)
370
-#endif
371
-#define HEATER_2_PIN       -1
372
-#define TEMP_0_PIN         13   // ANALOG NUMBERING
373
-#define TEMP_1_PIN         15   // ANALOG NUMBERING
374
-#define TEMP_2_PIN         -1   // ANALOG NUMBERING
375
-#define HEATER_BED_PIN     8    // BED
376
-#define TEMP_BED_PIN       14   // ANALOG NUMBERING
407
+  #if defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
408
+    #define KILL_PIN           41
409
+  #else
410
+    #define KILL_PIN           -1
411
+  #endif
377 412
 
378
-#ifdef NUM_SERVOS
379
-  #define SERVO0_PIN         11
380
-  #if NUM_SERVOS > 1
381
-  #define SERVO1_PIN         6
413
+  #define HEATER_0_PIN       10   // EXTRUDER 1
414
+  #if MOTHERBOARD == 33 
415
+    #define HEATER_1_PIN       -1
416
+  #else
417
+    #define HEATER_1_PIN       9    // EXTRUDER 2 (FAN On Sprinter)
382 418
   #endif
383
-  #if NUM_SERVOS > 2
384
-  #define SERVO2_PIN         5
419
+  #define HEATER_2_PIN       -1 
420
+
421
+  #if MOTHERBOARD == 77
422
+    #define HEATER_0_PIN       10   
423
+    #define HEATER_1_PIN       12 
424
+    #define HEATER_2_PIN       6   
385 425
   #endif
386
-  #if NUM_SERVOS > 2
387
-  #define SERVO3_PIN         4
426
+
427
+  #define TEMP_0_PIN         13   // ANALOG NUMBERING
428
+  #define TEMP_1_PIN         15   // ANALOG NUMBERING
429
+  #define TEMP_2_PIN         -1   // ANALOG NUMBERING
430
+  #if MOTHERBOARD == 77
431
+    #define HEATER_BED_PIN     9    // BED
432
+  #else
433
+    #define HEATER_BED_PIN     8    // BED
388 434
   #endif
389
-#endif
435
+  #define TEMP_BED_PIN       14   // ANALOG NUMBERING
390 436
 
391
-#ifdef ULTRA_LCD
392 437
 
393
-  #ifdef NEWPANEL
394
-    #define LCD_PINS_RS 16 
395
-    #define LCD_PINS_ENABLE 17
396
-    #define LCD_PINS_D4 23
397
-    #define LCD_PINS_D5 25
398
-    #define LCD_PINS_D6 27
399
-    #define LCD_PINS_D7 29
400 438
 
401
-    #ifdef REPRAP_DISCOUNT_SMART_CONTROLLER
402
-      #define BEEPER 37
439
+  #ifdef NUM_SERVOS
440
+    #define SERVO0_PIN         11
403 441
 
404
-      #define BTN_EN1 31
405
-      #define BTN_EN2 33
406
-      #define BTN_ENC 35
442
+    #if NUM_SERVOS > 1
443
+      #define SERVO1_PIN         6
444
+    #endif
407 445
 
408
-      #define SDCARDDETECT 49
409
-    #else
410
-      //arduino pin which triggers an piezzo beeper
411
-      #define BEEPER 33  // Beeper on AUX-4
412
-
413
-      //buttons are directly attached using AUX-2
414
-      #ifdef REPRAPWORLD_KEYPAD
415
-        #define BTN_EN1 64 // encoder
416
-        #define BTN_EN2 59 // encoder
417
-        #define BTN_ENC 63 // enter button
418
-        #define SHIFT_OUT 40 // shift register
419
-        #define SHIFT_CLK 44 // shift register
420
-        #define SHIFT_LD 42 // shift register
421
-      #else
422
-        #define BTN_EN1 37
423
-        #define BTN_EN2 35
424
-        #define BTN_ENC 31  //the click
425
-      #endif
446
+    #if NUM_SERVOS > 2
447
+      #define SERVO2_PIN         5
448
+    #endif
426 449
 
427
-      #ifdef G3D_PANEL
428
-        #define SDCARDDETECT 49
429
-      #else
430
-        #define SDCARDDETECT -1  // Ramps does not use this port
431
-      #endif
450
+    #if NUM_SERVOS > 3
451
+      #define SERVO3_PIN         4
432 452
     #endif
453
+  #endif
433 454
 
434
-  #else //old style panel with shift register
435
-    //arduino pin witch triggers an piezzo beeper
436
-    #define BEEPER 33   // No Beeper added 
455
+  #ifdef ULTRA_LCD
437 456
 
438
-    //buttons are attached to a shift register
439
-  // Not wired this yet
440
-    //#define SHIFT_CLK 38
441
-    //#define SHIFT_LD 42
442
-    //#define SHIFT_OUT 40
443
-    //#define SHIFT_EN 17
457
+    #ifdef NEWPANEL
458
+      #define LCD_PINS_RS 16 
459
+      #define LCD_PINS_ENABLE 17
460
+      #define LCD_PINS_D4 23
461
+      #define LCD_PINS_D5 25 
462
+      #define LCD_PINS_D6 27
463
+      #define LCD_PINS_D7 29
444 464
 
445
-    #define LCD_PINS_RS 16
446
-    #define LCD_PINS_ENABLE 17
447
-    #define LCD_PINS_D4 23
448
-    #define LCD_PINS_D5 25
449
-    #define LCD_PINS_D6 27
450
-    #define LCD_PINS_D7 29
451
-  #endif 
452
-#endif //ULTRA_LCD
465
+      #ifdef REPRAP_DISCOUNT_SMART_CONTROLLER
466
+        #define BEEPER 37
467
+
468
+        #define BTN_EN1 31
469
+        #define BTN_EN2 33
470
+        #define BTN_ENC 35
471
+
472
+        #define SDCARDDETECT 49
473
+      #else
474
+        //arduino pin which triggers an piezzo beeper
475
+        #define BEEPER 33  // Beeper on AUX-4
476
+
477
+        //buttons are directly attached using AUX-2
478
+        #ifdef REPRAPWORLD_KEYPAD
479
+          #define BTN_EN1 64 // encoder
480
+          #define BTN_EN2 59 // encoder
481
+          #define BTN_ENC 63 // enter button
482
+          #define SHIFT_OUT 40 // shift register
483
+          #define SHIFT_CLK 44 // shift register
484
+          #define SHIFT_LD 42 // shift register
485
+        #else
486
+          #define BTN_EN1 37
487
+          #define BTN_EN2 35
488
+          #define BTN_ENC 31  //the click
489
+        #endif
490
+
491
+        #ifdef G3D_PANEL
492
+          #define SDCARDDETECT 49
493
+        #else
494
+          #define SDCARDDETECT -1  // Ramps does not use this port
495
+        #endif
496
+    
497
+      #endif
498
+    
499
+      #if MOTHERBOARD == 77 
500
+        #define BEEPER -1 
501
+
502
+        #define LCD_PINS_RS 27 
503
+        #define LCD_PINS_ENABLE 29 
504
+        #define LCD_PINS_D4 37 
505
+        #define LCD_PINS_D5 35 
506
+        #define LCD_PINS_D6 33 
507
+        #define LCD_PINS_D7 31 
508
+
509
+       //buttons 
510
+       #define BTN_EN1 16 
511
+       #define BTN_EN2 17 
512
+       #define BTN_ENC 23 //the click 
513
+
514
+    #endif 
515
+    #else //old style panel with shift register
516
+      //arduino pin witch triggers an piezzo beeper
517
+      #define BEEPER 33		//No Beeper added
518
+
519
+      //buttons are attached to a shift register
520
+	// Not wired this yet
521
+      //#define SHIFT_CLK 38
522
+      //#define SHIFT_LD 42
523
+      //#define SHIFT_OUT 40
524
+      //#define SHIFT_EN 17
525
+    
526
+      #define LCD_PINS_RS 16 
527
+      #define LCD_PINS_ENABLE 17
528
+      #define LCD_PINS_D4 23
529
+      #define LCD_PINS_D5 25 
530
+      #define LCD_PINS_D6 27
531
+      #define LCD_PINS_D7 29
532
+    #endif 
533
+  #endif //ULTRA_LCD
453 534
 
454 535
 #else // RAMPS_V_1_1 or RAMPS_V_1_2 as default (MOTHERBOARD == 3)
455 536
 
@@ -493,15 +574,16 @@
493 574
 #define HEATER_1_PIN        -1
494 575
 #define HEATER_2_PIN        -1
495 576
 #define TEMP_0_PIN          2    // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
496
-#define TEMP_1_PIN          -1
497
-#define TEMP_2_PIN          -1
577
+#define TEMP_1_PIN          -1   
578
+#define TEMP_2_PIN          -1   
498 579
 #define TEMP_BED_PIN        1    // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
499
-#endif// MOTHERBOARD == 33 || MOTHERBOARD == 34
500 580
 
501
-// SPI for Max6675 Thermocouple
581
+#endif // MOTHERBOARD == 33 || MOTHERBOARD == 34 || MOTHERBOARD == 77
582
+
583
+// SPI for Max6675 Thermocouple 
502 584
 
503 585
 #ifndef SDSUPPORT
504
-// these pins are defined in the SD library if building with SD support
586
+// these pins are defined in the SD library if building with SD support  
505 587
   #define MAX_SCK_PIN          52
506 588
   #define MAX_MISO_PIN         50
507 589
   #define MAX_MOSI_PIN         51
@@ -510,7 +592,9 @@
510 592
   #define MAX6675_SS       49
511 593
 #endif
512 594
 
513
-#endif//MOTHERBOARD == 3 || MOTHERBOARD == 33 || MOTHERBOARD == 34
595
+#endif //MOTHERBOARD == 3 || MOTHERBOARD == 33 || MOTHERBOARD == 34 || MOTHERBOARD == 77
596
+
597
+
514 598
 
515 599
 /****************************************************************************************
516 600
 * Duemilanove w/ ATMega328P pin assignment
@@ -561,6 +645,131 @@
561 645
 #endif
562 646
 
563 647
 /****************************************************************************************
648
+* Elefu RA Board Pin Assignments
649
+*
650
+****************************************************************************************/
651
+#if MOTHERBOARD == 21
652
+#define	KNOWN_BOARD 1
653
+
654
+#ifndef __AVR_ATmega2560__
655
+ #error Oops!  Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu.
656
+#endif
657
+
658
+
659
+#define X_STEP_PIN		     49
660
+#define X_DIR_PIN			     13
661
+#define X_ENABLE_PIN		   48
662
+#define X_MIN_PIN			     35
663
+#define X_MAX_PIN			     -1 //34
664
+
665
+#define Y_STEP_PIN         11
666
+#define Y_DIR_PIN          9
667
+#define Y_ENABLE_PIN       12
668
+#define Y_MIN_PIN          33
669
+#define Y_MAX_PIN          -1 //32
670
+
671
+#define Z_STEP_PIN         7
672
+#define Z_DIR_PIN          6
673
+#define Z_ENABLE_PIN       8
674
+#define Z_MIN_PIN          31
675
+#define Z_MAX_PIN          -1 //30
676
+
677
+#define E2_STEP_PIN        43
678
+#define E2_DIR_PIN         47
679
+#define E2_ENABLE_PIN      42
680
+
681
+#define E1_STEP_PIN        18
682
+#define E1_DIR_PIN         19
683
+#define E1_ENABLE_PIN      38
684
+
685
+#define E0_STEP_PIN        40
686
+#define E0_DIR_PIN         41
687
+#define E0_ENABLE_PIN      37
688
+
689
+#define SDPOWER            -1
690
+#define LED_PIN            -1 //Use +12V Aux port for LED Ring
691
+
692
+#define FAN_PIN            16 //5V PWM
693
+
694
+#define PS_ON_PIN          10 //Set to -1 if using a manual switch on the PWRSW Connector
695
+#define SLEEP_WAKE_PIN		 26 //This feature still needs work
696
+
697
+#define HEATER_0_PIN       45	//12V PWM1
698
+#define HEATER_1_PIN       46	//12V PWM2
699
+#define HEATER_2_PIN       17	//12V PWM3
700
+#define HEATER_BED_PIN     44	//DOUBLE 12V PWM
701
+#define TEMP_0_PIN         3	//ANALOG NUMBERING
702
+#define TEMP_1_PIN         2 	//ANALOG NUMBERING
703
+#define TEMP_2_PIN         1 	//ANALOG NUMBERING
704
+#define TEMP_BED_PIN       0	//ANALOG NUMBERING
705
+
706
+#define BEEPER 		         36
707
+
708
+#define KILL_PIN           -1
709
+
710
+// M240  Triggers a camera by emulating a Canon RC-1 Remote
711
+// Data from: http://www.doc-diy.net/photo/rc-1_hacked/
712
+#define PHOTOGRAPH_PIN     29
713
+
714
+#ifdef RA_CONTROL_PANEL
715
+
716
+  #define SDSS             53
717
+  #define SDCARDDETECT     28
718
+
719
+  #define BTN_EN1          14
720
+  #define BTN_EN2          39
721
+  #define BTN_ENC          15  //the click
722
+    
723
+  #define BLEN_C           2
724
+  #define BLEN_B           1
725
+  #define BLEN_A           0
726
+    
727
+  //encoder rotation values
728
+  #define encrot0          0
729
+  #define encrot1          2
730
+  #define encrot2          3
731
+  #define encrot3          1
732
+  
733
+#endif //RA_CONTROL_PANEL
734
+
735
+#ifdef RA_DISCO
736
+  //variables for which pins the TLC5947 is using
737
+  #define TLC_CLOCK_PIN    25
738
+  #define TLC_BLANK_PIN    23
739
+  #define TLC_XLAT_PIN     22
740
+  #define TLC_DATA_PIN     24
741
+
742
+  //We also need to define pin to port number mapping for the 2560 to match the pins listed above. If you change the TLC pins, update this as well per the 2560 datasheet!
743
+  //This currently only works with the RA Board.
744
+  #define TLC_CLOCK_BIT 3 //bit 3 on port A
745
+  #define TLC_CLOCK_PORT &PORTA //bit 3 on port A
746
+  
747
+  #define TLC_BLANK_BIT 1 //bit 1 on port A
748
+  #define TLC_BLANK_PORT &PORTA //bit 1 on port A
749
+
750
+  #define TLC_DATA_BIT 2 //bit 2 on port A
751
+  #define TLC_DATA_PORT &PORTA //bit 2 on port A
752
+
753
+  #define TLC_XLAT_BIT 0 //bit 0 on port A
754
+  #define TLC_XLAT_PORT &PORTA //bit 0 on port A
755
+
756
+  //change this to match your situation. Lots of TLCs takes up the arduino SRAM very quickly, so be careful 
757
+  //Leave it at at least 1 if you have enabled RA_LIGHTING
758
+  //The number of TLC5947 boards chained together for use with the animation, additional ones will repeat the animation on them, but are not individually addressable and mimic those before them. You can leave the default at 2 even if you only have 1 TLC5947 module.
759
+  #define NUM_TLCS 2 
760
+
761
+  //These TRANS_ARRAY values let you change the order the LEDs on the lighting modules will animate for chase functions. 
762
+  //Modify them according to your specific situation.
763
+  //NOTE: the array should be 8 long for every TLC you have. These defaults assume (2) TLCs.
764
+  #define TRANS_ARRAY {0, 1, 2, 3, 4, 5, 6, 7, 15, 14, 13, 12, 11, 10, 9, 8} //forwards
765
+  //#define TRANS_ARRAY {7, 6, 5, 4, 3, 2, 1, 0, 8, 9, 10, 11, 12, 13, 14, 15} //backwards
766
+#endif //RA_LIGHTING
767
+
768
+
769
+#endif /* Ra Board */
770
+
771
+
772
+/****************************************************************************************
564 773
 * Gen6 pin assignment
565 774
 *
566 775
 ****************************************************************************************/
@@ -634,10 +843,13 @@
634 843
 #if MOTHERBOARD == 64
635 844
 #define STB
636 845
 #endif
637
-#if MOTHERBOARD == 63
846
+#if MOTHERBOARD == 63 || MOTHERBOARD == 66
638 847
 #define MELZI
639 848
 #endif
640
-#if MOTHERBOARD == 62 || MOTHERBOARD == 63 || MOTHERBOARD == 64
849
+#if MOTHERBOARD == 65
850
+#define AZTEEG_X1
851
+#endif
852
+#if MOTHERBOARD == 62 || MOTHERBOARD == 63 || MOTHERBOARD == 64 || MOTHERBOARD == 65 || MOTHERBOARD == 66
641 853
 #undef MOTHERBOARD
642 854
 #define MOTHERBOARD 6
643 855
 #define SANGUINOLOLU_V_1_2
@@ -679,6 +891,12 @@
679 891
 
680 892
 #ifdef STB
681 893
 #define FAN_PIN            4
894
+	//  Uncomment this if you have the first generation (V1.10) of STBs board
895
+#define LCD_PIN_BL         17 // LCD backlight LED
896
+#endif
897
+
898
+#ifdef AZTEEG_X1
899
+#define FAN_PIN            4
682 900
 #endif
683 901
 
684 902
 #define PS_ON_PIN          -1
@@ -759,6 +977,27 @@
759 977
    #endif //Newpanel
760 978
  #endif //Ultipanel
761 979
 
980
+ #ifdef MAKRPANEL
981
+     #define BEEPER 29
982
+     // Pins for DOGM SPI LCD Support
983
+     #define DOGLCD_A0  30
984
+     #define DOGLCD_CS  17
985
+     #define LCD_PIN_BL	28	// backlight LED on PA3
986
+     // GLCD features
987
+     #define LCD_CONTRAST 1
988
+     // Uncomment screen orientation
989
+     #define LCD_SCREEN_ROT_0
990
+       // #define LCD_SCREEN_ROT_90
991
+       // #define LCD_SCREEN_ROT_180
992
+       // #define LCD_SCREEN_ROT_270
993
+     //The encoder and click button
994
+     #define BTN_EN1 11
995
+     #define BTN_EN2 10
996
+     #define BTN_ENC 16  //the click switch
997
+     //not connected to a pin
998
+     #define SDCARDDETECT -1    
999
+ #endif //Makrpanel
1000
+
762 1001
 #endif
763 1002
 
764 1003
 
@@ -1831,8 +2070,15 @@
1831 2070
 #define Z_MAX_PIN          -1
1832 2071
 #endif
1833 2072
 
2073
+#ifdef DISABLE_MIN_ENDSTOPS
2074
+#define X_MIN_PIN          -1
2075
+#define Y_MIN_PIN          -1
2076
+#define Z_MIN_PIN          -1
2077
+#endif
2078
+
1834 2079
 #define SENSITIVE_PINS {0, 1, X_STEP_PIN, X_DIR_PIN, X_ENABLE_PIN, X_MIN_PIN, X_MAX_PIN, Y_STEP_PIN, Y_DIR_PIN, Y_ENABLE_PIN, Y_MIN_PIN, Y_MAX_PIN, Z_STEP_PIN, Z_DIR_PIN, Z_ENABLE_PIN, Z_MIN_PIN, Z_MAX_PIN, PS_ON_PIN, \
1835 2080
                         HEATER_BED_PIN, FAN_PIN,                  \
1836 2081
                         _E0_PINS _E1_PINS _E2_PINS             \
1837 2082
                         analogInputToDigitalPin(TEMP_0_PIN), analogInputToDigitalPin(TEMP_1_PIN), analogInputToDigitalPin(TEMP_2_PIN), analogInputToDigitalPin(TEMP_BED_PIN) }
1838 2083
 #endif
2084
+

+ 53
- 27
Marlin/planner.cpp View File

@@ -98,7 +98,7 @@ volatile unsigned char block_buffer_tail;           // Index of the block to pro
98 98
 //=============================private variables ============================
99 99
 //===========================================================================
100 100
 #ifdef PREVENT_DANGEROUS_EXTRUDE
101
-bool allow_cold_extrude=false;
101
+float extrude_min_temp=EXTRUDE_MINTEMP;
102 102
 #endif
103 103
 #ifdef XY_FREQUENCY_LIMIT
104 104
 #define MAX_FREQ_TIME (1000000.0/XY_FREQUENCY_LIMIT)
@@ -473,22 +473,24 @@ void check_axes_activity()
473 473
     disable_e2(); 
474 474
   }
475 475
 #if defined(FAN_PIN) && FAN_PIN > -1
476
-  #ifndef FAN_SOFT_PWM
477
-    #ifdef FAN_KICKSTART_TIME
478
-      static unsigned long fan_kick_end;
479
-      if (tail_fan_speed) {
480
-        if (fan_kick_end == 0) {
481
-          // Just starting up fan - run at full power.
482
-          fan_kick_end = millis() + FAN_KICKSTART_TIME;
483
-          tail_fan_speed = 255;
484
-        } else if (fan_kick_end > millis())
485
-          // Fan still spinning up.
486
-          tail_fan_speed = 255;
487
-      } else {
488
-        fan_kick_end = 0;
489
-      }
490
-    #endif//FAN_KICKSTART_TIME
491
-    analogWrite(FAN_PIN,tail_fan_speed);
476
+  #ifdef FAN_KICKSTART_TIME
477
+    static unsigned long fan_kick_end;
478
+    if (tail_fan_speed) {
479
+      if (fan_kick_end == 0) {
480
+        // Just starting up fan - run at full power.
481
+        fan_kick_end = millis() + FAN_KICKSTART_TIME;
482
+        tail_fan_speed = 255;
483
+      } else if (fan_kick_end > millis())
484
+        // Fan still spinning up.
485
+        tail_fan_speed = 255;
486
+    } else {
487
+      fan_kick_end = 0;
488
+    }
489
+  #endif//FAN_KICKSTART_TIME
490
+  #ifdef FAN_SOFT_PWM
491
+  fanSpeedSoftPwm = tail_fan_speed;
492
+  #else
493
+  analogWrite(FAN_PIN,tail_fan_speed);
492 494
   #endif//!FAN_SOFT_PWM
493 495
 #endif//FAN_PIN > -1
494 496
 #ifdef AUTOTEMP
@@ -537,7 +539,7 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
537 539
   #ifdef PREVENT_DANGEROUS_EXTRUDE
538 540
   if(target[E_AXIS]!=position[E_AXIS])
539 541
   {
540
-    if(degHotend(active_extruder)<EXTRUDE_MINTEMP && !allow_cold_extrude)
542
+    if(degHotend(active_extruder)<extrude_min_temp)
541 543
     {
542 544
       position[E_AXIS]=target[E_AXIS]; //behave as if the move really took place, but ignore E part
543 545
       SERIAL_ECHO_START;
@@ -562,8 +564,16 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
562 564
   block->busy = false;
563 565
 
564 566
   // Number of steps for each axis
565
-  block->steps_x = labs(target[X_AXIS]-position[X_AXIS]);
566
-  block->steps_y = labs(target[Y_AXIS]-position[Y_AXIS]);
567
+#ifndef COREXY
568
+// default non-h-bot planning
569
+block->steps_x = labs(target[X_AXIS]-position[X_AXIS]);
570
+block->steps_y = labs(target[Y_AXIS]-position[Y_AXIS]);
571
+#else
572
+// corexy planning
573
+// these equations follow the form of the dA and dB equations on http://www.corexy.com/theory.html
574
+block->steps_x = labs((target[X_AXIS]-position[X_AXIS]) + (target[Y_AXIS]-position[Y_AXIS]));
575
+block->steps_y = labs((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-position[Y_AXIS]));
576
+#endif
567 577
   block->steps_z = labs(target[Z_AXIS]-position[Z_AXIS]);
568 578
   block->steps_e = labs(target[E_AXIS]-position[E_AXIS]);
569 579
   block->steps_e *= extrudemultiply;
@@ -584,6 +594,7 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
584 594
 
585 595
   // Compute direction bits for this block 
586 596
   block->direction_bits = 0;
597
+#ifndef COREXY
587 598
   if (target[X_AXIS] < position[X_AXIS])
588 599
   {
589 600
     block->direction_bits |= (1<<X_AXIS); 
@@ -592,6 +603,16 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
592 603
   {
593 604
     block->direction_bits |= (1<<Y_AXIS); 
594 605
   }
606
+#else
607
+  if ((target[X_AXIS]-position[X_AXIS]) + (target[Y_AXIS]-position[Y_AXIS]) < 0)
608
+  {
609
+    block->direction_bits |= (1<<X_AXIS); 
610
+  }
611
+  if ((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-position[Y_AXIS]) < 0)
612
+  {
613
+    block->direction_bits |= (1<<Y_AXIS); 
614
+  }
615
+#endif
595 616
   if (target[Z_AXIS] < position[Z_AXIS])
596 617
   {
597 618
     block->direction_bits |= (1<<Z_AXIS); 
@@ -636,8 +657,13 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
636 657
   } 
637 658
 
638 659
   float delta_mm[4];
639
-  delta_mm[X_AXIS] = (target[X_AXIS]-position[X_AXIS])/axis_steps_per_unit[X_AXIS];
640
-  delta_mm[Y_AXIS] = (target[Y_AXIS]-position[Y_AXIS])/axis_steps_per_unit[Y_AXIS];
660
+  #ifndef COREXY
661
+    delta_mm[X_AXIS] = (target[X_AXIS]-position[X_AXIS])/axis_steps_per_unit[X_AXIS];
662
+    delta_mm[Y_AXIS] = (target[Y_AXIS]-position[Y_AXIS])/axis_steps_per_unit[Y_AXIS];
663
+  #else
664
+    delta_mm[X_AXIS] = ((target[X_AXIS]-position[X_AXIS]) + (target[Y_AXIS]-position[Y_AXIS]))/axis_steps_per_unit[X_AXIS];
665
+    delta_mm[Y_AXIS] = ((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-position[Y_AXIS]))/axis_steps_per_unit[Y_AXIS];
666
+  #endif
641 667
   delta_mm[Z_AXIS] = (target[Z_AXIS]-position[Z_AXIS])/axis_steps_per_unit[Z_AXIS];
642 668
   delta_mm[E_AXIS] = ((target[E_AXIS]-position[E_AXIS])/axis_steps_per_unit[E_AXIS])*extrudemultiply/100.0;
643 669
   if ( block->steps_x <=dropsegments && block->steps_y <=dropsegments && block->steps_z <=dropsegments )
@@ -757,7 +783,7 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
757 783
       block->acceleration_st = axis_steps_per_sqr_second[Z_AXIS];
758 784
   }
759 785
   block->acceleration = block->acceleration_st / steps_per_mm;
760
-  block->acceleration_rate = (long)((float)block->acceleration_st * 8.388608);
786
+  block->acceleration_rate = (long)((float)block->acceleration_st * (16777216.0 / (F_CPU / 8.0)));
761 787
 
762 788
 #if 0  // Use old jerk for now
763 789
   // Compute path unit vector
@@ -918,12 +944,12 @@ uint8_t movesplanned()
918 944
   return (block_buffer_head-block_buffer_tail + BLOCK_BUFFER_SIZE) & (BLOCK_BUFFER_SIZE - 1);
919 945
 }
920 946
 
921
-void allow_cold_extrudes(bool allow)
922
-{
923 947
 #ifdef PREVENT_DANGEROUS_EXTRUDE
924
-  allow_cold_extrude=allow;
925
-#endif
948
+void set_extrude_min_temp(float temp)
949
+{
950
+  extrude_min_temp=temp;
926 951
 }
952
+#endif
927 953
 
928 954
 // Calculate the steps/s^2 acceleration rates, based on the mm/s^s
929 955
 void reset_acceleration_rates()

+ 3
- 1
Marlin/planner.h View File

@@ -139,7 +139,9 @@ FORCE_INLINE bool blocks_queued()
139 139
     return true;
140 140
 }
141 141
 
142
-void allow_cold_extrudes(bool allow);
142
+#ifdef PREVENT_DANGEROUS_EXTRUDE
143
+void set_extrude_min_temp(float temp);
144
+#endif
143 145
 
144 146
 void reset_acceleration_rates();
145 147
 #endif

+ 93
- 110
Marlin/stepper.cpp View File

@@ -272,7 +272,7 @@ FORCE_INLINE unsigned short calc_timer(unsigned short step_rate) {
272 272
     timer = (unsigned short)pgm_read_word_near(table_address);
273 273
     timer -= (((unsigned short)pgm_read_word_near(table_address+2) * (unsigned char)(step_rate & 0x0007))>>3);
274 274
   }
275
-  if(timer < 100) { timer = 100; MYSERIAL.print(MSG_STEPPER_TO_HIGH); MYSERIAL.println(step_rate); }//(20kHz this should never happen)
275
+  if(timer < 100) { timer = 100; MYSERIAL.print(MSG_STEPPER_TOO_HIGH); MYSERIAL.println(step_rate); }//(20kHz this should never happen)
276 276
   return timer;
277 277
 }
278 278
 
@@ -345,50 +345,86 @@ ISR(TIMER1_COMPA_vect)
345 345
     // Set directions TO DO This should be done once during init of trapezoid. Endstops -> interrupt
346 346
     out_bits = current_block->direction_bits;
347 347
 
348
-    // Set direction en check limit switches
349
-    if ((out_bits & (1<<X_AXIS)) != 0) {   // stepping along -X axis
350
-      #if !defined COREXY  //NOT COREXY
348
+
349
+    // Set the direction bits (X_AXIS=A_AXIS and Y_AXIS=B_AXIS for COREXY)
350
+    if((out_bits & (1<<X_AXIS))!=0){
351
+      #ifdef DUAL_X_CARRIAGE
352
+      if (active_extruder != 0)
353
+        WRITE(X2_DIR_PIN,INVERT_X_DIR);
354
+      else
355
+      #endif        
351 356
         WRITE(X_DIR_PIN, INVERT_X_DIR);
352
-      #endif
353 357
       count_direction[X_AXIS]=-1;
358
+    }
359
+    else{
360
+      #ifdef DUAL_X_CARRIAGE
361
+      if (active_extruder != 0)
362
+        WRITE(X2_DIR_PIN,!INVERT_X_DIR);
363
+      else
364
+      #endif        
365
+        WRITE(X_DIR_PIN, !INVERT_X_DIR);
366
+      count_direction[X_AXIS]=1;
367
+    }
368
+    if((out_bits & (1<<Y_AXIS))!=0){
369
+      WRITE(Y_DIR_PIN, INVERT_Y_DIR);
370
+      count_direction[Y_AXIS]=-1;
371
+    }
372
+    else{
373
+      WRITE(Y_DIR_PIN, !INVERT_Y_DIR);
374
+      count_direction[Y_AXIS]=1;
375
+    }
376
+    
377
+    // Set direction en check limit switches
378
+    #ifndef COREXY
379
+    if ((out_bits & (1<<X_AXIS)) != 0) {   // stepping along -X axis
380
+    #else
381
+    if ((((out_bits & (1<<X_AXIS)) != 0)&&(out_bits & (1<<Y_AXIS)) != 0)) {   //-X occurs for -A and -B
382
+    #endif
354 383
       CHECK_ENDSTOPS
355 384
       {
356
-        #if defined(X_MIN_PIN) && X_MIN_PIN > -1
357
-          bool x_min_endstop=(READ(X_MIN_PIN) != X_ENDSTOPS_INVERTING);
358
-          if(x_min_endstop && old_x_min_endstop && (current_block->steps_x > 0)) {
359
-            endstops_trigsteps[X_AXIS] = count_position[X_AXIS];
360
-            endstop_x_hit=true;
361
-            step_events_completed = current_block->step_event_count;
362
-          }
363
-          old_x_min_endstop = x_min_endstop;
364
-        #endif
385
+        #ifdef DUAL_X_CARRIAGE
386
+        // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
387
+        if ((active_extruder == 0 && X_HOME_DIR == -1) || (active_extruder != 0 && X2_HOME_DIR == -1))
388
+        #endif          
389
+        {
390
+          #if defined(X_MIN_PIN) && X_MIN_PIN > -1
391
+            bool x_min_endstop=(READ(X_MIN_PIN) != X_ENDSTOPS_INVERTING);
392
+            if(x_min_endstop && old_x_min_endstop && (current_block->steps_x > 0)) {
393
+              endstops_trigsteps[X_AXIS] = count_position[X_AXIS];
394
+              endstop_x_hit=true;
395
+              step_events_completed = current_block->step_event_count;
396
+            }
397
+            old_x_min_endstop = x_min_endstop;
398
+          #endif
399
+        }
365 400
       }
366 401
     }
367 402
     else { // +direction
368
-      #if !defined COREXY  //NOT COREXY
369
-        WRITE(X_DIR_PIN,!INVERT_X_DIR);
370
-      #endif
371
-      
372
-      count_direction[X_AXIS]=1;
373 403
       CHECK_ENDSTOPS 
374 404
       {
375
-        #if defined(X_MAX_PIN) && X_MAX_PIN > -1
376
-          bool x_max_endstop=(READ(X_MAX_PIN) != X_ENDSTOPS_INVERTING);
377
-          if(x_max_endstop && old_x_max_endstop && (current_block->steps_x > 0)){
378
-            endstops_trigsteps[X_AXIS] = count_position[X_AXIS];
379
-            endstop_x_hit=true;
380
-            step_events_completed = current_block->step_event_count;
381
-          }
382
-          old_x_max_endstop = x_max_endstop;
383
-        #endif
405
+        #ifdef DUAL_X_CARRIAGE
406
+        // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
407
+        if ((active_extruder == 0 && X_HOME_DIR == 1) || (active_extruder != 0 && X2_HOME_DIR == 1))
408
+        #endif          
409
+        {
410
+          #if defined(X_MAX_PIN) && X_MAX_PIN > -1
411
+            bool x_max_endstop=(READ(X_MAX_PIN) != X_ENDSTOPS_INVERTING);
412
+            if(x_max_endstop && old_x_max_endstop && (current_block->steps_x > 0)){
413
+              endstops_trigsteps[X_AXIS] = count_position[X_AXIS];
414
+              endstop_x_hit=true;
415
+              step_events_completed = current_block->step_event_count;
416
+            }
417
+            old_x_max_endstop = x_max_endstop;
418
+          #endif
419
+        }  
384 420
       }
385 421
     }
386 422
 
423
+    #ifndef COREXY
387 424
     if ((out_bits & (1<<Y_AXIS)) != 0) {   // -direction
388
-      #if !defined COREXY  //NOT COREXY
389
-        WRITE(Y_DIR_PIN,INVERT_Y_DIR);
390
-      #endif
391
-      count_direction[Y_AXIS]=-1;
425
+    #else
426
+    if ((((out_bits & (1<<X_AXIS)) != 0)&&(out_bits & (1<<Y_AXIS)) == 0)) {   // -Y occurs for -A and +B
427
+    #endif
392 428
       CHECK_ENDSTOPS
393 429
       {
394 430
         #if defined(Y_MIN_PIN) && Y_MIN_PIN > -1
@@ -403,10 +439,6 @@ ISR(TIMER1_COMPA_vect)
403 439
       }
404 440
     }
405 441
     else { // +direction
406
-      #if !defined COREXY  //NOT COREXY
407
-        WRITE(Y_DIR_PIN,!INVERT_Y_DIR);
408
-      #endif
409
-      count_direction[Y_AXIS]=1;
410 442
       CHECK_ENDSTOPS
411 443
       {
412 444
         #if defined(Y_MAX_PIN) && Y_MAX_PIN > -1
@@ -420,28 +452,7 @@ ISR(TIMER1_COMPA_vect)
420 452
         #endif
421 453
       }
422 454
     }
423
-    
424
-    
425
-    #ifdef COREXY  //coreXY kinematics defined
426
-      if((current_block->steps_x >= current_block->steps_y)&&((out_bits & (1<<X_AXIS)) == 0)){  //+X is major axis
427
-        WRITE(X_DIR_PIN, !INVERT_X_DIR);
428
-        WRITE(Y_DIR_PIN, !INVERT_Y_DIR);
429
-      }
430
-      if((current_block->steps_x >= current_block->steps_y)&&((out_bits & (1<<X_AXIS)) != 0)){  //-X is major axis
431
-        WRITE(X_DIR_PIN, INVERT_X_DIR);
432
-        WRITE(Y_DIR_PIN, INVERT_Y_DIR);
433
-      }      
434
-      if((current_block->steps_y > current_block->steps_x)&&((out_bits & (1<<Y_AXIS)) == 0)){  //+Y is major axis
435
-        WRITE(X_DIR_PIN, !INVERT_X_DIR);
436
-        WRITE(Y_DIR_PIN, INVERT_Y_DIR);
437
-      }        
438
-      if((current_block->steps_y > current_block->steps_x)&&((out_bits & (1<<Y_AXIS)) != 0)){  //-Y is major axis
439
-        WRITE(X_DIR_PIN, INVERT_X_DIR);
440
-        WRITE(Y_DIR_PIN, !INVERT_Y_DIR);
441
-      }  
442
-    #endif //coreXY
443
-    
444
-    
455
+
445 456
     if ((out_bits & (1<<Z_AXIS)) != 0) {   // -direction
446 457
       WRITE(Z_DIR_PIN,INVERT_Z_DIR);
447 458
       
@@ -516,13 +527,22 @@ ISR(TIMER1_COMPA_vect)
516 527
       }    
517 528
       #endif //ADVANCE
518 529
 
519
-      #if !defined COREXY      
520 530
         counter_x += current_block->steps_x;
521 531
         if (counter_x > 0) {
522
-          WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
532
+          #ifdef DUAL_X_CARRIAGE
533
+          if (active_extruder != 0)
534
+            WRITE(X2_STEP_PIN,!INVERT_X_STEP_PIN);
535
+          else
536
+          #endif        
537
+            WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
523 538
           counter_x -= current_block->step_event_count;
524 539
           count_position[X_AXIS]+=count_direction[X_AXIS];   
525
-          WRITE(X_STEP_PIN, INVERT_X_STEP_PIN);
540
+          #ifdef DUAL_X_CARRIAGE
541
+          if (active_extruder != 0)
542
+            WRITE(X2_STEP_PIN,INVERT_X_STEP_PIN);
543
+          else
544
+          #endif        
545
+            WRITE(X_STEP_PIN, INVERT_X_STEP_PIN);
526 546
         }
527 547
   
528 548
         counter_y += current_block->steps_y;
@@ -532,56 +552,7 @@ ISR(TIMER1_COMPA_vect)
532 552
           count_position[Y_AXIS]+=count_direction[Y_AXIS]; 
533 553
           WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN);
534 554
         }
535
-      #endif
536 555
   
537
-      #ifdef COREXY
538
-        counter_x += current_block->steps_x;        
539
-        counter_y += current_block->steps_y;
540
-        
541
-        if ((counter_x > 0)&&!(counter_y>0)){  //X step only
542
-          WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
543
-          WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN);
544
-          counter_x -= current_block->step_event_count; 
545
-          count_position[X_AXIS]+=count_direction[X_AXIS];         
546
-          WRITE(X_STEP_PIN, INVERT_X_STEP_PIN);
547
-          WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN);
548
-        }
549
-        
550
-        if (!(counter_x > 0)&&(counter_y>0)){  //Y step only
551
-          WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
552
-          WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN);
553
-          counter_y -= current_block->step_event_count; 
554
-          count_position[Y_AXIS]+=count_direction[Y_AXIS];
555
-          WRITE(X_STEP_PIN, INVERT_X_STEP_PIN);
556
-          WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN);
557
-        }        
558
-        
559
-        if ((counter_x > 0)&&(counter_y>0)){  //step in both axes
560
-          if (((out_bits & (1<<X_AXIS)) == 0)^((out_bits & (1<<Y_AXIS)) == 0)){  //X and Y in different directions
561
-            WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN);
562
-            counter_x -= current_block->step_event_count;             
563
-            WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN);
564
-            step_wait();
565
-            count_position[X_AXIS]+=count_direction[X_AXIS];
566
-            count_position[Y_AXIS]+=count_direction[Y_AXIS];
567
-            WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN);
568
-            counter_y -= current_block->step_event_count;
569
-            WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN);
570
-          }
571
-          else{  //X and Y in same direction
572
-            WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
573
-            counter_x -= current_block->step_event_count;             
574
-            WRITE(X_STEP_PIN, INVERT_X_STEP_PIN) ;
575
-            step_wait();
576
-            count_position[X_AXIS]+=count_direction[X_AXIS];
577
-            count_position[Y_AXIS]+=count_direction[Y_AXIS];
578
-            WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN); 
579
-            counter_y -= current_block->step_event_count;    
580
-            WRITE(X_STEP_PIN, INVERT_X_STEP_PIN);        
581
-          }
582
-        }
583
-      #endif //corexy
584
-      
585 556
       counter_z += current_block->steps_z;
586 557
       if (counter_z > 0) {
587 558
         WRITE(Z_STEP_PIN, !INVERT_Z_STEP_PIN);
@@ -746,6 +717,9 @@ void st_init()
746 717
   #if defined(X_DIR_PIN) && X_DIR_PIN > -1
747 718
     SET_OUTPUT(X_DIR_PIN);
748 719
   #endif
720
+  #if defined(X2_DIR_PIN) && X2_DIR_PIN > -1
721
+    SET_OUTPUT(X2_DIR_PIN);
722
+  #endif
749 723
   #if defined(Y_DIR_PIN) && Y_DIR_PIN > -1 
750 724
     SET_OUTPUT(Y_DIR_PIN);
751 725
   #endif
@@ -772,6 +746,10 @@ void st_init()
772 746
     SET_OUTPUT(X_ENABLE_PIN);
773 747
     if(!X_ENABLE_ON) WRITE(X_ENABLE_PIN,HIGH);
774 748
   #endif
749
+  #if defined(X2_ENABLE_PIN) && X2_ENABLE_PIN > -1
750
+    SET_OUTPUT(X2_ENABLE_PIN);
751
+    if(!X_ENABLE_ON) WRITE(X2_ENABLE_PIN,HIGH);
752
+  #endif
775 753
   #if defined(Y_ENABLE_PIN) && Y_ENABLE_PIN > -1
776 754
     SET_OUTPUT(Y_ENABLE_PIN);
777 755
     if(!Y_ENABLE_ON) WRITE(Y_ENABLE_PIN,HIGH);
@@ -849,6 +827,11 @@ void st_init()
849 827
     WRITE(X_STEP_PIN,INVERT_X_STEP_PIN);
850 828
     disable_x();
851 829
   #endif  
830
+  #if defined(X2_STEP_PIN) && (X2_STEP_PIN > -1) 
831
+    SET_OUTPUT(X2_STEP_PIN);
832
+    WRITE(X2_STEP_PIN,INVERT_X_STEP_PIN);
833
+    disable_x();
834
+  #endif  
852 835
   #if defined(Y_STEP_PIN) && (Y_STEP_PIN > -1) 
853 836
     SET_OUTPUT(Y_STEP_PIN);
854 837
     WRITE(Y_STEP_PIN,INVERT_Y_STEP_PIN);

+ 89
- 52
Marlin/temperature.cpp View File

@@ -40,10 +40,13 @@
40 40
 int target_temperature[EXTRUDERS] = { 0 };
41 41
 int target_temperature_bed = 0;
42 42
 int current_temperature_raw[EXTRUDERS] = { 0 };
43
-float current_temperature[EXTRUDERS] = { 0 };
43
+float current_temperature[EXTRUDERS] = { 0.0 };
44 44
 int current_temperature_bed_raw = 0;
45
-float current_temperature_bed = 0;
46
-
45
+float current_temperature_bed = 0.0;
46
+#ifdef TEMP_SENSOR_1_AS_REDUNDANT
47
+  int redundant_temperature_raw = 0;
48
+  float redundant_temperature = 0.0;
49
+#endif
47 50
 #ifdef PIDTEMP
48 51
   float Kp=DEFAULT_Kp;
49 52
   float Ki=(DEFAULT_Ki*PID_dT);
@@ -59,6 +62,9 @@ float current_temperature_bed = 0;
59 62
   float bedKd=(DEFAULT_bedKd/PID_dT);
60 63
 #endif //PIDTEMPBED
61 64
   
65
+#ifdef FAN_SOFT_PWM
66
+  unsigned char fanSpeedSoftPwm;
67
+#endif
62 68
   
63 69
 //===========================================================================
64 70
 //=============================private variables============================
@@ -104,15 +110,15 @@ static volatile bool temp_meas_ready = false;
104 110
     (defined(EXTRUDER_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN > -1)
105 111
   static unsigned long extruder_autofan_last_check;
106 112
 #endif  
107
-  
113
+
108 114
 #if EXTRUDERS > 3
109
-# error Unsupported number of extruders
115
+  # error Unsupported number of extruders
110 116
 #elif EXTRUDERS > 2
111
-# define ARRAY_BY_EXTRUDERS(v1, v2, v3) { v1, v2, v3 }
117
+  # define ARRAY_BY_EXTRUDERS(v1, v2, v3) { v1, v2, v3 }
112 118
 #elif EXTRUDERS > 1
113
-# define ARRAY_BY_EXTRUDERS(v1, v2, v3) { v1, v2 }
119
+  # define ARRAY_BY_EXTRUDERS(v1, v2, v3) { v1, v2 }
114 120
 #else
115
-# define ARRAY_BY_EXTRUDERS(v1, v2, v3) { v1 }
121
+  # define ARRAY_BY_EXTRUDERS(v1, v2, v3) { v1 }
116 122
 #endif
117 123
 
118 124
 // Init min and max temp with extreme values to prevent false errors during startup
@@ -124,8 +130,14 @@ static int maxttemp[EXTRUDERS] = ARRAY_BY_EXTRUDERS( 16383, 16383, 16383 );
124 130
 #ifdef BED_MAXTEMP
125 131
 static int bed_maxttemp_raw = HEATER_BED_RAW_HI_TEMP;
126 132
 #endif
127
-static void *heater_ttbl_map[EXTRUDERS] = ARRAY_BY_EXTRUDERS( (void *)HEATER_0_TEMPTABLE, (void *)HEATER_1_TEMPTABLE, (void *)HEATER_2_TEMPTABLE );
128
-static uint8_t heater_ttbllen_map[EXTRUDERS] = ARRAY_BY_EXTRUDERS( HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN, HEATER_2_TEMPTABLE_LEN );
133
+
134
+#ifdef TEMP_SENSOR_1_AS_REDUNDANT
135
+  static void *heater_ttbl_map[2] = {(void *)HEATER_0_TEMPTABLE, (void *)HEATER_1_TEMPTABLE };
136
+  static uint8_t heater_ttbllen_map[2] = { HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN };
137
+#else
138
+  static void *heater_ttbl_map[EXTRUDERS] = ARRAY_BY_EXTRUDERS( (void *)HEATER_0_TEMPTABLE, (void *)HEATER_1_TEMPTABLE, (void *)HEATER_2_TEMPTABLE );
139
+  static uint8_t heater_ttbllen_map[EXTRUDERS] = ARRAY_BY_EXTRUDERS( HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN, HEATER_2_TEMPTABLE_LEN );
140
+#endif
129 141
 
130 142
 static float analog2temp(int raw, uint8_t e);
131 143
 static float analog2tempBed(int raw);
@@ -136,6 +148,10 @@ int watch_start_temp[EXTRUDERS] = ARRAY_BY_EXTRUDERS(0,0,0);
136 148
 unsigned long watchmillis[EXTRUDERS] = ARRAY_BY_EXTRUDERS(0,0,0);
137 149
 #endif //WATCH_TEMP_PERIOD
138 150
 
151
+#ifndef SOFT_PWM_SCALE
152
+#define SOFT_PWM_SCALE 0
153
+#endif
154
+
139 155
 //===========================================================================
140 156
 //=============================   functions      ============================
141 157
 //===========================================================================
@@ -157,28 +173,28 @@ void PID_autotune(float temp, int extruder, int ncycles)
157 173
   float Kp, Ki, Kd;
158 174
   float max = 0, min = 10000;
159 175
 
160
-	if ((extruder > EXTRUDERS)
176
+  if ((extruder > EXTRUDERS)
161 177
   #if (TEMP_BED_PIN <= -1)
162
-		||(extruder < 0)
163
-	#endif
164
-	){
165
-  	SERIAL_ECHOLN("PID Autotune failed. Bad extruder number.");
166
-  	return;
167
-	}
178
+       ||(extruder < 0)
179
+  #endif
180
+       ){
181
+          SERIAL_ECHOLN("PID Autotune failed. Bad extruder number.");
182
+          return;
183
+        }
168 184
 	
169 185
   SERIAL_ECHOLN("PID Autotune start");
170 186
   
171 187
   disable_heater(); // switch off all heaters.
172 188
 
173
-	if (extruder<0)
174
-	{
175
-	 	soft_pwm_bed = (MAX_BED_POWER)/2;
176
-		bias = d = (MAX_BED_POWER)/2;
177
-  }
178
-	else
179
-	{
180
-	  soft_pwm[extruder] = (PID_MAX)/2;
181
-		bias = d = (PID_MAX)/2;
189
+  if (extruder<0)
190
+  {
191
+     soft_pwm_bed = (MAX_BED_POWER)/2;
192
+     bias = d = (MAX_BED_POWER)/2;
193
+   }
194
+   else
195
+   {
196
+     soft_pwm[extruder] = (PID_MAX)/2;
197
+     bias = d = (PID_MAX)/2;
182 198
   }
183 199
 
184 200
 
@@ -196,10 +212,10 @@ void PID_autotune(float temp, int extruder, int ncycles)
196 212
       if(heating == true && input > temp) {
197 213
         if(millis() - t2 > 5000) { 
198 214
           heating=false;
199
-					if (extruder<0)
200
-						soft_pwm_bed = (bias - d) >> 1;
201
-					else
202
-						soft_pwm[extruder] = (bias - d) >> 1;
215
+          if (extruder<0)
216
+            soft_pwm_bed = (bias - d) >> 1;
217
+          else
218
+            soft_pwm[extruder] = (bias - d) >> 1;
203 219
           t1=millis();
204 220
           t_high=t1 - t2;
205 221
           max=temp;
@@ -250,28 +266,28 @@ void PID_autotune(float temp, int extruder, int ncycles)
250 266
               */
251 267
             }
252 268
           }
253
-					if (extruder<0)
254
-						soft_pwm_bed = (bias + d) >> 1;
255
-					else
256
-						soft_pwm[extruder] = (bias + d) >> 1;
269
+          if (extruder<0)
270
+            soft_pwm_bed = (bias + d) >> 1;
271
+          else
272
+            soft_pwm[extruder] = (bias + d) >> 1;
257 273
           cycles++;
258 274
           min=temp;
259 275
         }
260 276
       } 
261 277
     }
262 278
     if(input > (temp + 20)) {
263
-      SERIAL_PROTOCOLLNPGM("PID Autotune failed! Temperature to high");
279
+      SERIAL_PROTOCOLLNPGM("PID Autotune failed! Temperature too high");
264 280
       return;
265 281
     }
266 282
     if(millis() - temp_millis > 2000) {
267
-			int p;
268
-			if (extruder<0){
269
-	      p=soft_pwm_bed;       
270
-	      SERIAL_PROTOCOLPGM("ok B:");
271
-			}else{
272
-	      p=soft_pwm[extruder];       
273
-	      SERIAL_PROTOCOLPGM("ok T:");
274
-			}
283
+      int p;
284
+      if (extruder<0){
285
+        p=soft_pwm_bed;       
286
+        SERIAL_PROTOCOLPGM("ok B:");
287
+      }else{
288
+        p=soft_pwm[extruder];       
289
+        SERIAL_PROTOCOLPGM("ok T:");
290
+      }
275 291
 			
276 292
       SERIAL_PROTOCOL(input);   
277 293
       SERIAL_PROTOCOLPGM(" @:");
@@ -284,7 +300,7 @@ void PID_autotune(float temp, int extruder, int ncycles)
284 300
       return;
285 301
     }
286 302
     if(cycles > ncycles) {
287
-      SERIAL_PROTOCOLLNPGM("PID Autotune finished ! Place the Kp, Ki and Kd constants in the configuration.h");
303
+      SERIAL_PROTOCOLLNPGM("PID Autotune finished! Put the Kp, Ki and Kd constants into Configuration.h");
288 304
       return;
289 305
     }
290 306
     lcd_update();
@@ -471,7 +487,19 @@ void manage_heater()
471 487
         }
472 488
     }
473 489
     #endif
474
-
490
+    #ifdef TEMP_SENSOR_1_AS_REDUNDANT
491
+      if(fabs(current_temperature[0] - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF) {
492
+        disable_heater();
493
+        if(IsStopped() == false) {
494
+          SERIAL_ERROR_START;
495
+          SERIAL_ERRORLNPGM("Extruder switched off. Temperature difference between temp sensors is too high !");
496
+          LCD_ALERTMESSAGEPGM("Err: REDUNDANT TEMP ERROR");
497
+        }
498
+        #ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
499
+          Stop();
500
+        #endif
501
+      }
502
+    #endif
475 503
   } // End extruder for loop
476 504
 
477 505
   #if (defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1) || \
@@ -565,7 +593,11 @@ void manage_heater()
565 593
 // Derived from RepRap FiveD extruder::getTemperature()
566 594
 // For hot end temperature measurement.
567 595
 static float analog2temp(int raw, uint8_t e) {
596
+#ifdef TEMP_SENSOR_1_AS_REDUNDANT
597
+  if(e > EXTRUDERS)
598
+#else
568 599
   if(e >= EXTRUDERS)
600
+#endif
569 601
   {
570 602
       SERIAL_ERROR_START;
571 603
       SERIAL_ERROR((int)e);
@@ -644,7 +676,9 @@ static void updateTemperaturesFromRawValues()
644 676
         current_temperature[e] = analog2temp(current_temperature_raw[e], e);
645 677
     }
646 678
     current_temperature_bed = analog2tempBed(current_temperature_bed_raw);
647
-
679
+    #ifdef TEMP_SENSOR_1_AS_REDUNDANT
680
+      redundant_temperature = analog2temp(redundant_temperature_raw, 1);
681
+    #endif
648 682
     //Reset the watchdog after we know we have a temperature measurement.
649 683
     watchdog_reset();
650 684
 
@@ -693,8 +727,8 @@ void tp_init()
693 727
     setPwmFrequency(FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
694 728
     #endif
695 729
     #ifdef FAN_SOFT_PWM
696
-	soft_pwm_fan=(unsigned char)fanSpeed;
697
-	#endif
730
+    soft_pwm_fan = fanSpeedSoftPwm / 2;
731
+    #endif
698 732
   #endif  
699 733
 
700 734
   #ifdef HEATER_0_USES_MAX6675
@@ -994,14 +1028,14 @@ int read_max6675()
994 1028
 // Timer 0 is shared with millies
995 1029
 ISR(TIMER0_COMPB_vect)
996 1030
 {
997
-  //these variables are only accesible from the ISR, but static, so they don't loose their value
1031
+  //these variables are only accesible from the ISR, but static, so they don't lose their value
998 1032
   static unsigned char temp_count = 0;
999 1033
   static unsigned long raw_temp_0_value = 0;
1000 1034
   static unsigned long raw_temp_1_value = 0;
1001 1035
   static unsigned long raw_temp_2_value = 0;
1002 1036
   static unsigned long raw_temp_bed_value = 0;
1003 1037
   static unsigned char temp_state = 0;
1004
-  static unsigned char pwm_count = 1;
1038
+  static unsigned char pwm_count = (1 << SOFT_PWM_SCALE);
1005 1039
   static unsigned char soft_pwm_0;
1006 1040
   #if EXTRUDERS > 1
1007 1041
   static unsigned char soft_pwm_1;
@@ -1029,7 +1063,7 @@ ISR(TIMER0_COMPB_vect)
1029 1063
     if(soft_pwm_b > 0) WRITE(HEATER_BED_PIN,1);
1030 1064
     #endif
1031 1065
     #ifdef FAN_SOFT_PWM
1032
-    soft_pwm_fan =(unsigned char) fanSpeed;
1066
+    soft_pwm_fan = fanSpeedSoftPwm / 2;
1033 1067
     if(soft_pwm_fan > 0) WRITE(FAN_PIN,1);
1034 1068
     #endif
1035 1069
   }
@@ -1047,7 +1081,7 @@ ISR(TIMER0_COMPB_vect)
1047 1081
   if(soft_pwm_fan <= pwm_count) WRITE(FAN_PIN,0);
1048 1082
   #endif
1049 1083
   
1050
-  pwm_count++;
1084
+  pwm_count += (1 << SOFT_PWM_SCALE);
1051 1085
   pwm_count &= 0x7f;
1052 1086
   
1053 1087
   switch(temp_state) {
@@ -1145,6 +1179,9 @@ ISR(TIMER0_COMPB_vect)
1145 1179
 #if EXTRUDERS > 1
1146 1180
       current_temperature_raw[1] = raw_temp_1_value;
1147 1181
 #endif
1182
+#ifdef TEMP_SENSOR_1_AS_REDUNDANT
1183
+      redundant_temperature_raw = raw_temp_1_value;
1184
+#endif
1148 1185
 #if EXTRUDERS > 2
1149 1186
       current_temperature_raw[2] = raw_temp_2_value;
1150 1187
 #endif

+ 3
- 0
Marlin/temperature.h View File

@@ -37,6 +37,9 @@ extern int target_temperature[EXTRUDERS];
37 37
 extern float current_temperature[EXTRUDERS];
38 38
 extern int target_temperature_bed;
39 39
 extern float current_temperature_bed;
40
+#ifdef TEMP_SENSOR_1_AS_REDUNDANT
41
+  extern float redundant_temperature;
42
+#endif
40 43
 
41 44
 #ifdef PIDTEMP
42 45
   extern float Kp,Ki,Kd,Kc;

+ 128
- 52
Marlin/ultralcd.cpp View File

@@ -8,6 +8,8 @@
8 8
 #include "stepper.h"
9 9
 #include "ConfigurationStore.h"
10 10
 
11
+int8_t encoderDiff; /* encoderDiff is updated from interrupt context and added to encoderPosition every LCD update */
12
+
11 13
 /* Configuration settings */
12 14
 int plaPreheatHotendTemp;
13 15
 int plaPreheatHPBTemp;
@@ -47,6 +49,9 @@ static void lcd_control_temperature_menu();
47 49
 static void lcd_control_temperature_preheat_pla_settings_menu();
48 50
 static void lcd_control_temperature_preheat_abs_settings_menu();
49 51
 static void lcd_control_motion_menu();
52
+#ifdef DOGLCD
53
+static void lcd_set_contrast();
54
+#endif
50 55
 static void lcd_control_retract_menu();
51 56
 static void lcd_sdcard_menu();
52 57
 
@@ -122,13 +127,11 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l
122 127
 #ifndef REPRAPWORLD_KEYPAD
123 128
 volatile uint8_t buttons;//Contains the bits of the currently pressed buttons.
124 129
 #else
125
-volatile uint16_t buttons;//Contains the bits of the currently pressed buttons (extended).
130
+volatile uint8_t buttons_reprapworld_keypad; // to store the reprapworld_keypad shiftregister values
126 131
 #endif
127
-
128 132
 uint8_t currentMenuViewOffset;              /* scroll offset in the current menu */
129 133
 uint32_t blocking_enc;
130 134
 uint8_t lastEncoderBits;
131
-int8_t encoderDiff; /* encoderDiff is updated from interrupt context and added to encoderPosition every LCD update */
132 135
 uint32_t encoderPosition;
133 136
 #if (SDCARDDETECT > 0)
134 137
 bool lcd_oldcardstatus;
@@ -173,8 +176,8 @@ static void lcd_status_screen()
173 176
     }
174 177
 
175 178
     // Dead zone at 100% feedrate
176
-    if (feedmultiply < 100 && (feedmultiply + int(encoderPosition)) > 100 ||
177
-            feedmultiply > 100 && (feedmultiply + int(encoderPosition)) < 100)
179
+    if ((feedmultiply < 100 && (feedmultiply + int(encoderPosition)) > 100) ||
180
+            (feedmultiply > 100 && (feedmultiply + int(encoderPosition)) < 100))
178 181
     {
179 182
         encoderPosition = 0;
180 183
         feedmultiply = 100;
@@ -357,9 +360,9 @@ static void lcd_move_x()
357 360
     if (encoderPosition != 0)
358 361
     {
359 362
         current_position[X_AXIS] += float((int)encoderPosition) * move_menu_scale;
360
-        if (current_position[X_AXIS] < X_MIN_POS)
363
+        if (min_software_endstops && current_position[X_AXIS] < X_MIN_POS)
361 364
             current_position[X_AXIS] = X_MIN_POS;
362
-        if (current_position[X_AXIS] > X_MAX_POS)
365
+        if (max_software_endstops && current_position[X_AXIS] > X_MAX_POS)
363 366
             current_position[X_AXIS] = X_MAX_POS;
364 367
         encoderPosition = 0;
365 368
         plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 600, active_extruder);
@@ -381,9 +384,9 @@ static void lcd_move_y()
381 384
     if (encoderPosition != 0)
382 385
     {
383 386
         current_position[Y_AXIS] += float((int)encoderPosition) * move_menu_scale;
384
-        if (current_position[Y_AXIS] < Y_MIN_POS)
387
+        if (min_software_endstops && current_position[Y_AXIS] < Y_MIN_POS)
385 388
             current_position[Y_AXIS] = Y_MIN_POS;
386
-        if (current_position[Y_AXIS] > Y_MAX_POS)
389
+        if (max_software_endstops && current_position[Y_AXIS] > Y_MAX_POS)
387 390
             current_position[Y_AXIS] = Y_MAX_POS;
388 391
         encoderPosition = 0;
389 392
         plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 600, active_extruder);
@@ -405,12 +408,12 @@ static void lcd_move_z()
405 408
     if (encoderPosition != 0)
406 409
     {
407 410
         current_position[Z_AXIS] += float((int)encoderPosition) * move_menu_scale;
408
-        if (current_position[Z_AXIS] < Z_MIN_POS)
411
+        if (min_software_endstops && current_position[Z_AXIS] < Z_MIN_POS)
409 412
             current_position[Z_AXIS] = Z_MIN_POS;
410
-        if (current_position[Z_AXIS] > Z_MAX_POS)
413
+        if (max_software_endstops && current_position[Z_AXIS] > Z_MAX_POS)
411 414
             current_position[Z_AXIS] = Z_MAX_POS;
412 415
         encoderPosition = 0;
413
-        plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 60, active_extruder);
416
+        plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS]/60, active_extruder);
414 417
         lcdDrawUpdate = 1;
415 418
     }
416 419
     if (lcdDrawUpdate)
@@ -492,6 +495,10 @@ static void lcd_control_menu()
492 495
     MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
493 496
     MENU_ITEM(submenu, MSG_TEMPERATURE, lcd_control_temperature_menu);
494 497
     MENU_ITEM(submenu, MSG_MOTION, lcd_control_motion_menu);
498
+#ifdef DOGLCD
499
+//    MENU_ITEM_EDIT(int3, MSG_CONTRAST, &lcd_contrast, 0, 63);
500
+    MENU_ITEM(submenu, MSG_CONTRAST, lcd_set_contrast);
501
+#endif
495 502
 #ifdef FWRETRACT
496 503
     MENU_ITEM(submenu, MSG_RETRACT, lcd_control_retract_menu);
497 504
 #endif
@@ -505,9 +512,11 @@ static void lcd_control_menu()
505 512
 
506 513
 static void lcd_control_temperature_menu()
507 514
 {
515
+#ifdef PIDTEMP
508 516
     // set up temp variables - undo the default scaling
509 517
     raw_Ki = unscalePID_i(Ki);
510 518
     raw_Kd = unscalePID_d(Kd);
519
+#endif
511 520
 
512 521
     START_MENU();
513 522
     MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
@@ -601,6 +610,31 @@ static void lcd_control_motion_menu()
601 610
     END_MENU();
602 611
 }
603 612
 
613
+#ifdef DOGLCD
614
+static void lcd_set_contrast()
615
+{
616
+    if (encoderPosition != 0)
617
+    {
618
+        lcd_contrast -= encoderPosition;
619
+        if (lcd_contrast < 0) lcd_contrast = 0;
620
+        else if (lcd_contrast > 63) lcd_contrast = 63;
621
+        encoderPosition = 0;
622
+        lcdDrawUpdate = 1;
623
+        u8g.setContrast(lcd_contrast);
624
+    }
625
+    if (lcdDrawUpdate)
626
+    {
627
+        lcd_implementation_drawedit(PSTR("Contrast"), itostr2(lcd_contrast));
628
+    }
629
+    if (LCD_CLICKED)
630
+    {
631
+        lcd_quick_feedback();
632
+        currentMenu = lcd_control_menu;
633
+        encoderPosition = 0;
634
+    }
635
+}
636
+#endif
637
+
604 638
 #ifdef FWRETRACT
605 639
 static void lcd_control_retract_menu()
606 640
 {
@@ -734,21 +768,39 @@ menu_edit_type(float, float52, ftostr52, 100)
734 768
 menu_edit_type(unsigned long, long5, ftostr5, 0.01)
735 769
 
736 770
 #ifdef REPRAPWORLD_KEYPAD
737
-    static void reprapworld_keypad_move_y_down() {
738
-        encoderPosition = 1;
739
-        move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
740
-        lcd_move_y();
741
-    }
742
-    static void reprapworld_keypad_move_y_up() {
743
-        encoderPosition = -1;
744
-        move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
745
-        lcd_move_y();
746
-    }
747
-    static void reprapworld_keypad_move_home() {
748
-        //enquecommand_P((PSTR("G28"))); // move all axis home
749
-        // TODO gregor: move all axis home, i have currently only one axis on my prusa i3
750
-        enquecommand_P((PSTR("G28 Y")));
751
-    }
771
+	static void reprapworld_keypad_move_z_up() {
772
+    encoderPosition = 1;
773
+    move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
774
+		lcd_move_z();
775
+  }
776
+	static void reprapworld_keypad_move_z_down() {
777
+    encoderPosition = -1;
778
+    move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
779
+		lcd_move_z();
780
+  }
781
+	static void reprapworld_keypad_move_x_left() {
782
+    encoderPosition = -1;
783
+    move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
784
+		lcd_move_x();
785
+  }
786
+	static void reprapworld_keypad_move_x_right() {
787
+    encoderPosition = 1;
788
+    move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
789
+		lcd_move_x();
790
+	}
791
+	static void reprapworld_keypad_move_y_down() {
792
+    encoderPosition = 1;
793
+    move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
794
+		lcd_move_y();
795
+	}
796
+	static void reprapworld_keypad_move_y_up() {
797
+		encoderPosition = -1;
798
+		move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
799
+    lcd_move_y();
800
+	}
801
+	static void reprapworld_keypad_move_home() {
802
+		enquecommand_P((PSTR("G28"))); // move all axis home
803
+	}
752 804
 #endif
753 805
 
754 806
 /** End of menus **/
@@ -875,17 +927,29 @@ void lcd_update()
875 927
     if (lcd_next_update_millis < millis())
876 928
     {
877 929
 #ifdef ULTIPANEL
878
-        #ifdef REPRAPWORLD_KEYPAD
879
-        if (REPRAPWORLD_KEYPAD_MOVE_Y_DOWN) {
880
-            reprapworld_keypad_move_y_down();
881
-        }
882
-        if (REPRAPWORLD_KEYPAD_MOVE_Y_UP) {
883
-            reprapworld_keypad_move_y_up();
884
-        }
885
-        if (REPRAPWORLD_KEYPAD_MOVE_HOME) {
886
-            reprapworld_keypad_move_home();
887
-        }
888
-        #endif
930
+		#ifdef REPRAPWORLD_KEYPAD
931
+        	if (REPRAPWORLD_KEYPAD_MOVE_Z_UP) {
932
+        		reprapworld_keypad_move_z_up();
933
+        	}
934
+        	if (REPRAPWORLD_KEYPAD_MOVE_Z_DOWN) {
935
+        		reprapworld_keypad_move_z_down();
936
+        	}
937
+        	if (REPRAPWORLD_KEYPAD_MOVE_X_LEFT) {
938
+        		reprapworld_keypad_move_x_left();
939
+        	}
940
+        	if (REPRAPWORLD_KEYPAD_MOVE_X_RIGHT) {
941
+        		reprapworld_keypad_move_x_right();
942
+        	}
943
+        	if (REPRAPWORLD_KEYPAD_MOVE_Y_DOWN) {
944
+        		reprapworld_keypad_move_y_down();
945
+        	}
946
+        	if (REPRAPWORLD_KEYPAD_MOVE_Y_UP) {
947
+        		reprapworld_keypad_move_y_up();
948
+        	}
949
+        	if (REPRAPWORLD_KEYPAD_MOVE_HOME) {
950
+        		reprapworld_keypad_move_home();
951
+        	}
952
+		#endif
889 953
         if (encoderDiff)
890 954
         {
891 955
             lcdDrawUpdate = 1;
@@ -960,6 +1024,14 @@ void lcd_reset_alert_level()
960 1024
     lcd_status_message_level = 0;
961 1025
 }
962 1026
 
1027
+#ifdef DOGLCD
1028
+void lcd_setcontrast(uint8_t value)
1029
+{
1030
+    lcd_contrast = value & 63;
1031
+    u8g.setContrast(lcd_contrast);	
1032
+}
1033
+#endif
1034
+
963 1035
 #ifdef ULTIPANEL
964 1036
 /* Warning: This function is called from interrupt context */
965 1037
 void lcd_buttons_update()
@@ -971,22 +1043,22 @@ void lcd_buttons_update()
971 1043
   #if BTN_ENC > 0
972 1044
     if((blocking_enc<millis()) && (READ(BTN_ENC)==0))
973 1045
         newbutton |= EN_C;
974
-  #endif      
975
-  #ifdef REPRAPWORLD_KEYPAD
976
-    // for the reprapworld_keypad
977
-    uint8_t newbutton_reprapworld_keypad=0;
978
-    WRITE(SHIFT_LD,LOW);
979
-    WRITE(SHIFT_LD,HIGH);
980
-    for(int8_t i=0;i<8;i++) {
981
-        newbutton_reprapworld_keypad = newbutton_reprapworld_keypad>>1;
982
-        if(READ(SHIFT_OUT))
983
-            newbutton_reprapworld_keypad|=(1<<7);
984
-        WRITE(SHIFT_CLK,HIGH);
985
-        WRITE(SHIFT_CLK,LOW);
986
-    }
987
-    newbutton |= ((~newbutton_reprapworld_keypad) << REPRAPWORLD_BTN_OFFSET); //invert it, because a pressed switch produces a logical 0
988 1046
   #endif
989 1047
     buttons = newbutton;
1048
+    #ifdef REPRAPWORLD_KEYPAD
1049
+      // for the reprapworld_keypad
1050
+      uint8_t newbutton_reprapworld_keypad=0;
1051
+      WRITE(SHIFT_LD,LOW);
1052
+      WRITE(SHIFT_LD,HIGH);
1053
+      for(int8_t i=0;i<8;i++) {
1054
+          newbutton_reprapworld_keypad = newbutton_reprapworld_keypad>>1;
1055
+          if(READ(SHIFT_OUT))
1056
+              newbutton_reprapworld_keypad|=(1<<7);
1057
+          WRITE(SHIFT_CLK,HIGH);
1058
+          WRITE(SHIFT_CLK,LOW);
1059
+      }
1060
+      buttons_reprapworld_keypad=~newbutton_reprapworld_keypad; //invert it, because a pressed switch produces a logical 0
1061
+	#endif
990 1062
 #else   //read it from the shift register
991 1063
     uint8_t newbutton=0;
992 1064
     WRITE(SHIFT_LD,LOW);
@@ -1252,16 +1324,20 @@ char *ftostr52(const float &x)
1252 1324
 // grab the pid i value out of the temp variable; scale it; then update the PID driver
1253 1325
 void copy_and_scalePID_i()
1254 1326
 {
1327
+#ifdef PIDTEMP
1255 1328
   Ki = scalePID_i(raw_Ki);
1256 1329
   updatePID();
1330
+#endif
1257 1331
 }
1258 1332
 
1259 1333
 // Callback for after editing PID d value
1260 1334
 // grab the pid d value out of the temp variable; scale it; then update the PID driver
1261 1335
 void copy_and_scalePID_d()
1262 1336
 {
1337
+#ifdef PIDTEMP
1263 1338
   Kd = scalePID_d(raw_Kd);
1264 1339
   updatePID();
1340
+#endif
1265 1341
 }
1266 1342
 
1267 1343
 #endif //ULTRA_LCD

+ 49
- 1
Marlin/ultralcd.h View File

@@ -11,7 +11,12 @@
11 11
   void lcd_setstatuspgm(const char* message);
12 12
   void lcd_setalertstatuspgm(const char* message);
13 13
   void lcd_reset_alert_level();
14
-  
14
+
15
+#ifdef DOGLCD
16
+  extern int lcd_contrast;
17
+  void lcd_setcontrast(uint8_t value);
18
+#endif
19
+
15 20
   static unsigned char blink = 0;	// Variable for visualisation of fan rotation in GLCD
16 21
 
17 22
   #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
@@ -22,6 +27,10 @@
22 27
 
23 28
   #ifdef ULTIPANEL
24 29
   void lcd_buttons_update();
30
+  extern volatile uint8_t buttons;  //the last checked buttons in a bit array.
31
+  #ifdef REPRAPWORLD_KEYPAD
32
+    extern volatile uint8_t buttons_reprapworld_keypad; // to store the keypad shiftregister values
33
+  #endif
25 34
   #else
26 35
   FORCE_INLINE void lcd_buttons_update() {}
27 36
   #endif
@@ -37,6 +46,45 @@
37 46
   void lcd_buzz(long duration,uint16_t freq);
38 47
   bool lcd_clicked();
39 48
 
49
+  #ifdef NEWPANEL
50
+    #define EN_C (1<<BLEN_C)
51
+    #define EN_B (1<<BLEN_B)
52
+    #define EN_A (1<<BLEN_A)
53
+
54
+    #define LCD_CLICKED (buttons&EN_C)
55
+    #ifdef REPRAPWORLD_KEYPAD
56
+  	  #define EN_REPRAPWORLD_KEYPAD_F3 (1<<BLEN_REPRAPWORLD_KEYPAD_F3)
57
+  	  #define EN_REPRAPWORLD_KEYPAD_F2 (1<<BLEN_REPRAPWORLD_KEYPAD_F2)
58
+  	  #define EN_REPRAPWORLD_KEYPAD_F1 (1<<BLEN_REPRAPWORLD_KEYPAD_F1)
59
+  	  #define EN_REPRAPWORLD_KEYPAD_UP (1<<BLEN_REPRAPWORLD_KEYPAD_UP)
60
+  	  #define EN_REPRAPWORLD_KEYPAD_RIGHT (1<<BLEN_REPRAPWORLD_KEYPAD_RIGHT)
61
+  	  #define EN_REPRAPWORLD_KEYPAD_MIDDLE (1<<BLEN_REPRAPWORLD_KEYPAD_MIDDLE)
62
+  	  #define EN_REPRAPWORLD_KEYPAD_DOWN (1<<BLEN_REPRAPWORLD_KEYPAD_DOWN)
63
+  	  #define EN_REPRAPWORLD_KEYPAD_LEFT (1<<BLEN_REPRAPWORLD_KEYPAD_LEFT)
64
+
65
+  	  #define LCD_CLICKED ((buttons&EN_C) || (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F1))
66
+  	  #define REPRAPWORLD_KEYPAD_MOVE_Z_UP (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F2)
67
+  	  #define REPRAPWORLD_KEYPAD_MOVE_Z_DOWN (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F3)
68
+  	  #define REPRAPWORLD_KEYPAD_MOVE_X_LEFT (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_LEFT)
69
+  	  #define REPRAPWORLD_KEYPAD_MOVE_X_RIGHT (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_RIGHT)
70
+  	  #define REPRAPWORLD_KEYPAD_MOVE_Y_DOWN (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_DOWN)
71
+  	  #define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_UP)
72
+  	  #define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_MIDDLE)
73
+    #endif //REPRAPWORLD_KEYPAD
74
+  #else
75
+    //atomatic, do not change
76
+    #define B_LE (1<<BL_LE)
77
+    #define B_UP (1<<BL_UP)
78
+    #define B_MI (1<<BL_MI)
79
+    #define B_DW (1<<BL_DW)
80
+    #define B_RI (1<<BL_RI)
81
+    #define B_ST (1<<BL_ST)
82
+    #define EN_B (1<<BLEN_B)
83
+    #define EN_A (1<<BLEN_A)
84
+    
85
+    #define LCD_CLICKED ((buttons&B_MI)||(buttons&B_ST))
86
+  #endif//NEWPANEL
87
+
40 88
 #else //no lcd
41 89
   FORCE_INLINE void lcd_update() {}
42 90
   FORCE_INLINE void lcd_init() {}

+ 757
- 748
Marlin/ultralcd_implementation_hitachi_HD44780.h
File diff suppressed because it is too large
View File


+ 131
- 0
Marlin/ultralcd_st7920_u8glib_rrd.h View File

@@ -0,0 +1,131 @@
1
+#ifndef ULCDST7920_H
2
+#define ULCDST7920_H
3
+
4
+#include "Marlin.h"
5
+
6
+#ifdef U8GLIB_ST7920
7
+
8
+//set optimization so ARDUINO optimizes this file
9
+#pragma GCC optimize (3)
10
+
11
+#define ST7920_CLK_PIN  LCD_PINS_D4
12
+#define ST7920_DAT_PIN  LCD_PINS_ENABLE
13
+#define ST7920_CS_PIN   LCD_PINS_RS
14
+
15
+//#define PAGE_HEIGHT 8   //128 byte frambuffer
16
+//#define PAGE_HEIGHT 16  //256 byte frambuffer
17
+#define PAGE_HEIGHT 32  //512 byte framebuffer
18
+
19
+#define WIDTH 128
20
+#define HEIGHT 64
21
+
22
+#include <U8glib.h>
23
+
24
+static void ST7920_SWSPI_SND_8BIT(uint8_t val)
25
+{
26
+  uint8_t i;
27
+  for( i=0; i<8; i++ )
28
+  {
29
+    WRITE(ST7920_CLK_PIN,0);
30
+    WRITE(ST7920_DAT_PIN,val&0x80); 
31
+    val<<=1;
32
+    WRITE(ST7920_CLK_PIN,1);
33
+  }
34
+}
35
+
36
+#define ST7920_CS()              {WRITE(ST7920_CS_PIN,1);u8g_10MicroDelay();}
37
+#define ST7920_NCS()             {WRITE(ST7920_CS_PIN,0);}
38
+#define ST7920_SET_CMD()         {ST7920_SWSPI_SND_8BIT(0xf8);u8g_10MicroDelay();}
39
+#define ST7920_SET_DAT()         {ST7920_SWSPI_SND_8BIT(0xfa);u8g_10MicroDelay();}
40
+#define ST7920_WRITE_BYTE(a)     {ST7920_SWSPI_SND_8BIT((a)&0xf0);ST7920_SWSPI_SND_8BIT((a)<<4);u8g_10MicroDelay();}
41
+#define ST7920_WRITE_BYTES(p,l)  {uint8_t i;for(i=0;i<l;i++){ST7920_SWSPI_SND_8BIT(*p&0xf0);ST7920_SWSPI_SND_8BIT(*p<<4);p++;}u8g_10MicroDelay();}
42
+
43
+uint8_t u8g_dev_rrd_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
44
+{
45
+  uint8_t i,y;
46
+  switch(msg)
47
+  {
48
+    case U8G_DEV_MSG_INIT:
49
+      {
50
+        SET_OUTPUT(ST7920_CS_PIN);
51
+        WRITE(ST7920_CS_PIN,0);
52
+        SET_OUTPUT(ST7920_DAT_PIN);
53
+        WRITE(ST7920_DAT_PIN,0);
54
+        SET_OUTPUT(ST7920_CLK_PIN);
55
+        WRITE(ST7920_CLK_PIN,1);
56
+
57
+        ST7920_CS();
58
+        u8g_Delay(90);                 //initial delay for boot up
59
+        ST7920_SET_CMD();
60
+        ST7920_WRITE_BYTE(0x08);       //display off, cursor+blink off
61
+        ST7920_WRITE_BYTE(0x01);       //clear CGRAM ram
62
+        u8g_Delay(10);                 //delay for cgram clear
63
+        ST7920_WRITE_BYTE(0x3E);       //extended mode + gdram active
64
+        for(y=0;y<HEIGHT/2;y++)        //clear GDRAM
65
+        {
66
+          ST7920_WRITE_BYTE(0x80|y);   //set y
67
+          ST7920_WRITE_BYTE(0x80);     //set x = 0
68
+          ST7920_SET_DAT();
69
+          for(i=0;i<2*WIDTH/8;i++)     //2x width clears both segments
70
+            ST7920_WRITE_BYTE(0);
71
+          ST7920_SET_CMD();
72
+        }
73
+        ST7920_WRITE_BYTE(0x0C); //display on, cursor+blink off
74
+        ST7920_NCS();
75
+      }
76
+      break;
77
+
78
+    case U8G_DEV_MSG_STOP:
79
+      break;
80
+    case U8G_DEV_MSG_PAGE_NEXT:
81
+      {
82
+        uint8_t *ptr;
83
+        u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
84
+        y = pb->p.page_y0;
85
+        ptr = (uint8_t*)pb->buf;
86
+
87
+        ST7920_CS();
88
+        for( i = 0; i < PAGE_HEIGHT; i ++ )
89
+        {
90
+          ST7920_SET_CMD();
91
+          if ( y < 32 )
92
+          {
93
+            ST7920_WRITE_BYTE(0x80 | y);       //y
94
+            ST7920_WRITE_BYTE(0x80);           //x=0
95
+          }
96
+          else
97
+          {
98
+            ST7920_WRITE_BYTE(0x80 | (y-32));  //y
99
+            ST7920_WRITE_BYTE(0x80 | 8);       //x=64
100
+          }
101
+
102
+          ST7920_SET_DAT();
103
+          ST7920_WRITE_BYTES(ptr,WIDTH/8); //ptr is incremented inside of macro
104
+          y++;
105
+        }
106
+        ST7920_NCS();
107
+      }
108
+      break;
109
+  }
110
+#if PAGE_HEIGHT == 8
111
+  return u8g_dev_pb8h1_base_fn(u8g, dev, msg, arg);
112
+#elif PAGE_HEIGHT == 16
113
+  return u8g_dev_pb16h1_base_fn(u8g, dev, msg, arg);
114
+#else
115
+  return u8g_dev_pb32h1_base_fn(u8g, dev, msg, arg);
116
+#endif
117
+}
118
+
119
+uint8_t   u8g_dev_st7920_128x64_rrd_buf[WIDTH*(PAGE_HEIGHT/8)] U8G_NOCOMMON;
120
+u8g_pb_t  u8g_dev_st7920_128x64_rrd_pb = {{PAGE_HEIGHT,HEIGHT,0,0,0},WIDTH,u8g_dev_st7920_128x64_rrd_buf};
121
+u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = {u8g_dev_rrd_st7920_128x64_fn,&u8g_dev_st7920_128x64_rrd_pb,&u8g_com_null_fn};
122
+
123
+class U8GLIB_ST7920_128X64_RRD : public U8GLIB
124
+{
125
+  public:
126
+    U8GLIB_ST7920_128X64_RRD(uint8_t dummy) : U8GLIB(&u8g_dev_st7920_128x64_rrd_sw_spi) {}
127
+};
128
+
129
+
130
+#endif //U8GLIB_ST7920
131
+#endif //ULCDST7920_H

+ 252
- 227
README.md View File

@@ -1,227 +1,252 @@
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
-
1
+==========================
2
+Marlin 3D Printer Firmware
3
+==========================
4
+
5
+[![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=ErikZalm&url=https://github.com/ErikZalm/Marlin&title=Marlin&language=&tags=github&category=software)
6
+
7
+Quick Information
8
+===================
9
+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.
10
+
11
+Derived from Sprinter and Grbl by Erik van der Zalm.
12
+Sprinters lead developers are Kliment and caru.
13
+Grbls lead developer is Simen Svale Skogsrud. Sonney Jeon (Chamnit) improved some parts of grbl
14
+A fork by bkubicek for the Ultimaker was merged, and further development was aided by him.
15
+Some features have been added by:
16
+Lampmaker, Bradley Feldman, and others...
17
+
18
+
19
+Features:
20
+
21
+*   Interrupt based movement with real linear acceleration
22
+*   High steprate
23
+*   Look ahead (Keep the speed high when possible. High cornering speed)
24
+*   Interrupt based temperature protection
25
+*   preliminary support for Matthew Roberts advance algorithm
26
+    For more info see: http://reprap.org/pipermail/reprap-dev/2011-May/003323.html
27
+*   Full endstop support
28
+*   SD Card support
29
+*   SD Card folders (works in pronterface)
30
+*   SD Card autostart support
31
+*   LCD support (ideally 20x4)
32
+*   LCD menu system for autonomous SD card printing, controlled by an click-encoder.
33
+*   EEPROM storage of e.g. max-velocity, max-acceleration, and similar variables
34
+*   many small but handy things originating from bkubicek's fork.
35
+*   Arc support
36
+*   Temperature oversampling
37
+*   Dynamic Temperature setpointing aka "AutoTemp"
38
+*   Support for QTMarlin, a very beta GUI for PID-tuning and velocity-acceleration testing. https://github.com/bkubicek/QTMarlin
39
+*   Endstop trigger reporting to the host software.
40
+*   Updated sdcardlib
41
+*   Heater power reporting. Useful for PID monitoring.
42
+*   PID tuning
43
+*   CoreXY kinematics (www.corexy.com/theory.html)
44
+*   Delta kinematics
45
+*   Dual X-carriage support for multiple extruder systems
46
+*   Configurable serial port to support connection of wireless adaptors.
47
+*   Automatic operation of extruder/cold-end cooling fans based on nozzle temperature
48
+*   RC Servo Support, specify angle or duration for continuous rotation servos.
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
+Implemented G Codes:
133
+====================
134
+
135
+*  G0  -> G1
136
+*  G1  - Coordinated Movement X Y Z E
137
+*  G2  - CW ARC
138
+*  G3  - CCW ARC
139
+*  G4  - Dwell S<seconds> or P<milliseconds>
140
+*  G10 - retract filament according to settings of M207
141
+*  G11 - retract recover filament according to settings of M208
142
+*  G28 - Home all Axis
143
+*  G90 - Use Absolute Coordinates
144
+*  G91 - Use Relative Coordinates
145
+*  G92 - Set current position to cordinates given
146
+
147
+M Codes
148
+*  M0   - Unconditional stop - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled)
149
+*  M1   - Same as M0
150
+*  M17  - Enable/Power all stepper motors
151
+*  M18  - Disable all stepper motors; same as M84
152
+*  M20  - List SD card
153
+*  M21  - Init SD card
154
+*  M22  - Release SD card
155
+*  M23  - Select SD file (M23 filename.g)
156
+*  M24  - Start/resume SD print
157
+*  M25  - Pause SD print
158
+*  M26  - Set SD position in bytes (M26 S12345)
159
+*  M27  - Report SD print status
160
+*  M28  - Start SD write (M28 filename.g)
161
+*  M29  - Stop SD write
162
+*  M30  - Delete file from SD (M30 filename.g)
163
+*  M31  - Output time since last M109 or SD card start to serial
164
+*  M32  - Select file and start SD print (Can be used when printing from SD card)
165
+*  M42  - Change pin status via gcode Use M42 Px Sy to set pin x to value y, when omitting Px the onboard led will be used.
166
+*  M80  - Turn on Power Supply
167
+*  M81  - Turn off Power Supply
168
+*  M82  - Set E codes absolute (default)
169
+*  M83  - Set E codes relative while in Absolute Coordinates (G90) mode
170
+*  M84  - Disable steppers until next move, or use S<seconds> to specify an inactivity timeout, after which the steppers will be disabled.  S0 to disable the timeout.
171
+*  M85  - Set inactivity shutdown timer with parameter S<seconds>. To disable set zero (default)
172
+*  M92  - Set axis_steps_per_unit - same syntax as G92
173
+*  M104 - Set extruder target temp
174
+*  M105 - Read current temp
175
+*  M106 - Fan on
176
+*  M107 - Fan off
177
+*  M109 - Sxxx Wait for extruder current temp to reach target temp. Waits only when heating
178
+*         Rxxx Wait for extruder current temp to reach target temp. Waits when heating and cooling
179
+*  M114 - Output current position to serial port
180
+*  M115 - Capabilities string
181
+*  M117 - display message
182
+*  M119 - Output Endstop status to serial port
183
+*  M126 - Solenoid Air Valve Open (BariCUDA support by jmil)
184
+*  M127 - Solenoid Air Valve Closed (BariCUDA vent to atmospheric pressure by jmil)
185
+*  M128 - EtoP Open (BariCUDA EtoP = electricity to air pressure transducer by jmil)
186
+*  M129 - EtoP Closed (BariCUDA EtoP = electricity to air pressure transducer by jmil)
187
+*  M140 - Set bed target temp
188
+*  M190 - Sxxx Wait for bed current temp to reach target temp. Waits only when heating
189
+*         Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling
190
+*  M200 - Set filament diameter
191
+*  M201 - Set max acceleration in units/s^2 for print moves (M201 X1000 Y1000)
192
+*  M202 - Set max acceleration in units/s^2 for travel moves (M202 X1000 Y1000) Unused in Marlin!!
193
+*  M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec
194
+*  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
195
+*  M205 -  advanced settings:  minimum travel speed S=while printing T=travel only,  B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk, E=maximum E jerk
196
+*  M206 - set additional homeing offset
197
+*  M207 - set retract length S[positive mm] F[feedrate mm/sec] Z[additional zlift/hop]
198
+*  M208 - set recover=unretract length S[positive mm surplus to the M207 S*] F[feedrate mm/sec]
199
+*  M209 - S<1=true/0=false> enable automatic retract detect if the slicer did not support G10/11: every normal extrude-only move will be classified as retract depending on the direction.
200
+*  M218 - set hotend offset (in mm): T<extruder_number> X<offset_on_X> Y<offset_on_Y>
201
+*  M220 S<factor in percent>- set speed factor override percentage
202
+*  M221 S<factor in percent>- set extrude factor override percentage
203
+*  M240 - Trigger a camera to take a photograph
204
+*  M280 - Position an RC Servo P<index> S<angle/microseconds>, ommit S to report back current angle
205
+*  M300 - Play beepsound S<frequency Hz> P<duration ms>
206
+*  M301 - Set PID parameters P I and D
207
+*  M302 - Allow cold extrudes
208
+*  M303 - PID relay autotune S<temperature> sets the target temperature. (default target temperature = 150C)
209
+*  M304 - Set bed PID parameters P I and D
210
+*  M400 - Finish all moves
211
+*  M500 - stores paramters in EEPROM
212
+*  M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
213
+*  M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
214
+*  M503 - print the current settings (from memory not from eeprom)
215
+*  M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
216
+*  M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
217
+*  M907 - Set digital trimpot motor current using axis codes.
218
+*  M908 - Control digital trimpot directly.
219
+*  M350 - Set microstepping mode.
220
+*  M351 - Toggle MS1 MS2 pins directly.
221
+*  M928 - Start SD logging (M928 filename.g) - ended by M29
222
+*  M999 - Restart after being stopped by error
223
+
224
+
225
+Configuring and compilation:
226
+============================
227
+
228
+Install the arduino software IDE/toolset v23 (Some configurations also work with 1.x.x)
229
+   http://www.arduino.cc/en/Main/Software
230
+
231
+For gen6/gen7 and sanguinololu the Sanguino directory in the Marlin dir needs to be copied to the arduino environment.
232
+  copy ArduinoAddons\Arduino_x.x.x\sanguino <arduino home>\hardware\Sanguino
233
+
234
+Copy the Marlin firmware
235
+   https://github.com/ErikZalm/Marlin/tree/Marlin_v1
236
+   (Use the download button)
237
+
238
+Start the arduino IDE.
239
+Select Tools -> Board -> Arduino Mega 2560    or your microcontroller
240
+Select the correct serial port in Tools ->Serial Port
241
+Open Marlin.pde
242
+
243
+Click the Verify/Compile button
244
+
245
+Click the Upload button
246
+If all goes well the firmware is uploading
247
+
248
+That's ok.  Enjoy Silky Smooth Printing.
249
+
250
+
251
+
252
+

Loading…
Cancel
Save