Browse Source

Merge pull request #1 from ErikZalm/Marlin_v1

Update on 140315
Dim3nsioneer 11 years ago
parent
commit
8613a74443

+ 73
- 37
Marlin/Configuration.h View File

8
 //===========================================================================
8
 //===========================================================================
9
 //============================= DELTA Printer ===============================
9
 //============================= DELTA Printer ===============================
10
 //===========================================================================
10
 //===========================================================================
11
-// For a Delta printer rplace the configuration files wilth the files in the
11
+// For a Delta printer replace the configuration files with the files in the
12
 // example_configurations/delta directory.
12
 // example_configurations/delta directory.
13
 //
13
 //
14
 
14
 
55
 // 68 = Azteeg X3 Pro
55
 // 68 = Azteeg X3 Pro
56
 // 7  = Ultimaker
56
 // 7  = Ultimaker
57
 // 71 = Ultimaker (Older electronics. Pre 1.5.4. This is rare)
57
 // 71 = Ultimaker (Older electronics. Pre 1.5.4. This is rare)
58
+// 72 = Ultimainboard 2.x (Uses TEMP_SENSOR 20)
58
 // 77 = 3Drag Controller
59
 // 77 = 3Drag Controller
59
 // 8  = Teensylu
60
 // 8  = Teensylu
60
 // 80 = Rumba
61
 // 80 = Rumba
67
 // 702= Minitronics v1.0
68
 // 702= Minitronics v1.0
68
 // 90 = Alpha OMCA board
69
 // 90 = Alpha OMCA board
69
 // 91 = Final OMCA board
70
 // 91 = Final OMCA board
70
-// 301 = Rambo
71
+// 301= Rambo
71
 // 21 = Elefu Ra Board (v3)
72
 // 21 = Elefu Ra Board (v3)
72
 
73
 
73
 #ifndef MOTHERBOARD
74
 #ifndef MOTHERBOARD
90
 
91
 
91
 #define POWER_SUPPLY 1
92
 #define POWER_SUPPLY 1
92
 
93
 
93
-// Define this to have the electronics keep the powersupply off on startup. If you don't know what this is leave it.
94
+// Define this to have the electronics keep the power supply off on startup. If you don't know what this is leave it.
94
 // #define PS_DEFAULT_OFF
95
 // #define PS_DEFAULT_OFF
95
 
96
 
96
 //===========================================================================
97
 //===========================================================================
105
 // 0 is not used
106
 // 0 is not used
106
 // 1 is 100k thermistor - best choice for EPCOS 100k (4.7k pullup)
107
 // 1 is 100k thermistor - best choice for EPCOS 100k (4.7k pullup)
107
 // 2 is 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup)
108
 // 2 is 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup)
108
-// 3 is mendel-parts thermistor (4.7k pullup)
109
+// 3 is Mendel-parts thermistor (4.7k pullup)
109
 // 4 is 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !!
110
 // 4 is 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !!
110
 // 5 is 100K thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (4.7k pullup)
111
 // 5 is 100K thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (4.7k pullup)
111
 // 6 is 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup)
112
 // 6 is 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup)
114
 // 8 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup)
115
 // 8 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup)
115
 // 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup)
116
 // 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup)
116
 // 10 is 100k RS thermistor 198-961 (4.7k pullup)
117
 // 10 is 100k RS thermistor 198-961 (4.7k pullup)
117
-// 60 is 100k Maker's Tool Works Kapton Bed Thermister
118
+// 20 is the PT100 circuit found in the Ultimainboard V2.x
119
+// 60 is 100k Maker's Tool Works Kapton Bed Thermistor
118
 //
120
 //
119
 //    1k ohm pullup tables - This is not normal, you would have to have changed out your 4.7k for 1k
121
 //    1k ohm pullup tables - This is not normal, you would have to have changed out your 4.7k for 1k
120
 //                          (but gives greater accuracy and more stable PID)
122
 //                          (but gives greater accuracy and more stable PID)
121
 // 51 is 100k thermistor - EPCOS (1k pullup)
123
 // 51 is 100k thermistor - EPCOS (1k pullup)
122
 // 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup)
124
 // 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup)
123
 // 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup)
125
 // 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup)
126
+//
127
+// 1047 is Pt1000 with 4k7 pullup
128
+// 1010 is Pt1000 with 1k pullup (non standard)
129
+// 147 is Pt100 with 4k7 pullup
130
+// 110 is Pt100 with 1k pullup (non standard)
124
 
131
 
125
 #define TEMP_SENSOR_0 -1
132
 #define TEMP_SENSOR_0 -1
126
 #define TEMP_SENSOR_1 -1
133
 #define TEMP_SENSOR_1 -1
175
   #define K1 0.95 //smoothing factor within the PID
182
   #define K1 0.95 //smoothing factor within the PID
176
   #define PID_dT ((OVERSAMPLENR * 8.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine
183
   #define PID_dT ((OVERSAMPLENR * 8.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine
177
 
184
 
178
-// If you are using a preconfigured hotend then you can use one of the value sets by uncommenting it
185
+// If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
179
 // Ultimaker
186
 // Ultimaker
180
     #define  DEFAULT_Kp 22.2
187
     #define  DEFAULT_Kp 22.2
181
     #define  DEFAULT_Ki 1.08
188
     #define  DEFAULT_Ki 1.08
182
     #define  DEFAULT_Kd 114
189
     #define  DEFAULT_Kd 114
183
 
190
 
184
-// Makergear
191
+// MakerGear
185
 //    #define  DEFAULT_Kp 7.0
192
 //    #define  DEFAULT_Kp 7.0
186
 //    #define  DEFAULT_Ki 0.1
193
 //    #define  DEFAULT_Ki 0.1
187
 //    #define  DEFAULT_Kd 12
194
 //    #define  DEFAULT_Kd 12
250
 #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
257
 #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
251
 
258
 
252
 #ifndef ENDSTOPPULLUPS
259
 #ifndef ENDSTOPPULLUPS
253
-  // fine Enstop settings: Individual Pullups. will be ignored if ENDSTOPPULLUPS is defined
260
+  // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined
254
   // #define ENDSTOPPULLUP_XMAX
261
   // #define ENDSTOPPULLUP_XMAX
255
   // #define ENDSTOPPULLUP_YMAX
262
   // #define ENDSTOPPULLUP_YMAX
256
   // #define ENDSTOPPULLUP_ZMAX
263
   // #define ENDSTOPPULLUP_ZMAX
328
 
335
 
329
 #ifdef ENABLE_AUTO_BED_LEVELING
336
 #ifdef ENABLE_AUTO_BED_LEVELING
330
 
337
 
331
-  // these are the positions on the bed to do the probing
332
-  #define LEFT_PROBE_BED_POSITION 15
333
-  #define RIGHT_PROBE_BED_POSITION 170
334
-  #define BACK_PROBE_BED_POSITION 180
335
-  #define FRONT_PROBE_BED_POSITION 20
338
+// There are 2 different ways to pick the X and Y locations to probe:
339
+
340
+//  - "grid" mode
341
+//    Probe every point in a rectangular grid
342
+//    You must specify the rectangle, and the density of sample points
343
+//    This mode is preferred because there are more measurements.
344
+//    It used to be called ACCURATE_BED_LEVELING but "grid" is more descriptive
345
+
346
+//  - "3-point" mode
347
+//    Probe 3 arbitrary points on the bed (that aren't colinear)
348
+//    You must specify the X & Y coordinates of all 3 points
349
+
350
+  #define AUTO_BED_LEVELING_GRID
351
+  // with AUTO_BED_LEVELING_GRID, the bed is sampled in a
352
+  // AUTO_BED_LEVELING_GRID_POINTSxAUTO_BED_LEVELING_GRID_POINTS grid
353
+  // and least squares solution is calculated
354
+  // Note: this feature occupies 10'206 byte
355
+  #ifdef AUTO_BED_LEVELING_GRID
356
+
357
+    // set the rectangle in which to probe
358
+    #define LEFT_PROBE_BED_POSITION 15
359
+    #define RIGHT_PROBE_BED_POSITION 170
360
+    #define BACK_PROBE_BED_POSITION 180
361
+    #define FRONT_PROBE_BED_POSITION 20
362
+
363
+     // set the number of grid points per dimension
364
+     // I wouldn't see a reason to go above 3 (=9 probing points on the bed)
365
+    #define AUTO_BED_LEVELING_GRID_POINTS 2
366
+
367
+
368
+  #else  // not AUTO_BED_LEVELING_GRID
369
+    // with no grid, just probe 3 arbitrary points.  A simple cross-product
370
+    // is used to esimate the plane of the print bed
336
 
371
 
337
-  // these are the offsets to the prob relative to the extruder tip (Hotend - Probe)
372
+      #define ABL_PROBE_PT_1_X 15
373
+      #define ABL_PROBE_PT_1_Y 180
374
+      #define ABL_PROBE_PT_2_X 15
375
+      #define ABL_PROBE_PT_2_Y 20
376
+      #define ABL_PROBE_PT_3_X 170
377
+      #define ABL_PROBE_PT_3_Y 20
378
+
379
+  #endif // AUTO_BED_LEVELING_GRID
380
+
381
+
382
+  // these are the offsets to the probe relative to the extruder tip (Hotend - Probe)
338
   #define X_PROBE_OFFSET_FROM_EXTRUDER -25
383
   #define X_PROBE_OFFSET_FROM_EXTRUDER -25
339
   #define Y_PROBE_OFFSET_FROM_EXTRUDER -29
384
   #define Y_PROBE_OFFSET_FROM_EXTRUDER -29
340
   #define Z_PROBE_OFFSET_FROM_EXTRUDER -12.35
385
   #define Z_PROBE_OFFSET_FROM_EXTRUDER -12.35
355
 //  #define PROBE_SERVO_DEACTIVATION_DELAY 300
400
 //  #define PROBE_SERVO_DEACTIVATION_DELAY 300
356
 
401
 
357
 
402
 
358
-//If you have enabled the Bed Auto Levelling and are using the same Z Probe for Z Homing,
403
+//If you have enabled the Bed Auto Leveling and are using the same Z Probe for Z Homing,
359
 //it is highly recommended you let this Z_SAFE_HOMING enabled!!!
404
 //it is highly recommended you let this Z_SAFE_HOMING enabled!!!
360
 
405
 
361
   #define Z_SAFE_HOMING   // This feature is meant to avoid Z homing with probe outside the bed area.
406
   #define Z_SAFE_HOMING   // This feature is meant to avoid Z homing with probe outside the bed area.
372
 
417
 
373
   #endif
418
   #endif
374
 
419
 
375
-  // with accurate bed leveling, the bed is sampled in a ACCURATE_BED_LEVELING_POINTSxACCURATE_BED_LEVELING_POINTS grid and least squares solution is calculated
376
-  // Note: this feature occupies 10'206 byte
377
-  #define ACCURATE_BED_LEVELING
378
-
379
-  #ifdef ACCURATE_BED_LEVELING
380
-     // I wouldn't see a reason to go above 3 (=9 probing points on the bed)
381
-    #define ACCURATE_BED_LEVELING_POINTS 2
382
-  #endif
383
-
384
-#endif
420
+#endif // ENABLE_AUTO_BED_LEVELING
385
 
421
 
386
 
422
 
387
 // The position of the homing switches
423
 // The position of the homing switches
389
 //#define BED_CENTER_AT_0_0  // If defined, the center of the bed is at (X=0, Y=0)
425
 //#define BED_CENTER_AT_0_0  // If defined, the center of the bed is at (X=0, Y=0)
390
 
426
 
391
 //Manual homing switch locations:
427
 //Manual homing switch locations:
392
-// For deltabots this means top and center of the cartesian print volume.
428
+// For deltabots this means top and center of the Cartesian print volume.
393
 #define MANUAL_X_HOME_POS 0
429
 #define MANUAL_X_HOME_POS 0
394
 #define MANUAL_Y_HOME_POS 0
430
 #define MANUAL_Y_HOME_POS 0
395
 #define MANUAL_Z_HOME_POS 0
431
 #define MANUAL_Z_HOME_POS 0
403
 
439
 
404
 #define DEFAULT_AXIS_STEPS_PER_UNIT   {78.7402,78.7402,200.0*8/3,760*1.1}  // default steps per unit for Ultimaker
440
 #define DEFAULT_AXIS_STEPS_PER_UNIT   {78.7402,78.7402,200.0*8/3,760*1.1}  // default steps per unit for Ultimaker
405
 #define DEFAULT_MAX_FEEDRATE          {500, 500, 5, 25}    // (mm/sec)
441
 #define DEFAULT_MAX_FEEDRATE          {500, 500, 5, 25}    // (mm/sec)
406
-#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.
442
+#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.
407
 
443
 
408
 #define DEFAULT_ACCELERATION          3000    // X, Y, Z and E max acceleration in mm/s^2 for printing moves
444
 #define DEFAULT_ACCELERATION          3000    // X, Y, Z and E max acceleration in mm/s^2 for printing moves
409
 #define DEFAULT_RETRACT_ACCELERATION  3000   // X, Y, Z and E max acceleration in mm/s^2 for retracts
445
 #define DEFAULT_RETRACT_ACCELERATION  3000   // X, Y, Z and E max acceleration in mm/s^2 for retracts
424
 //===========================================================================
460
 //===========================================================================
425
 
461
 
426
 // EEPROM
462
 // EEPROM
427
-// the microcontroller can store settings in the EEPROM, e.g. max velocity...
428
-// M500 - stores paramters in EEPROM
463
+// The microcontroller can store settings in the EEPROM, e.g. max velocity...
464
+// M500 - stores parameters in EEPROM
429
 // M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
465
 // M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
430
 // M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
466
 // M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
431
-//define this to enable eeprom support
467
+//define this to enable EEPROM support
432
 //#define EEPROM_SETTINGS
468
 //#define EEPROM_SETTINGS
433
 //to disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out:
469
 //to disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out:
434
 // please keep turned on if you can.
470
 // please keep turned on if you can.
444
 #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
480
 #define ABS_PREHEAT_FAN_SPEED 255   // Insert Value between 0 and 255
445
 
481
 
446
 //LCD and SD support
482
 //LCD and SD support
447
-//#define ULTRA_LCD  //general lcd support, also 16x2
483
+//#define ULTRA_LCD  //general LCD support, also 16x2
448
 //#define DOGLCD  // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
484
 //#define DOGLCD  // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
449
 //#define SDSUPPORT // Enable SD Card Support in Hardware Console
485
 //#define SDSUPPORT // Enable SD Card Support in Hardware Console
450
 //#define SDSLOW // Use slower SD transfer mode (not normally needed - uncomment if you're getting volume init error)
486
 //#define SDSLOW // Use slower SD transfer mode (not normally needed - uncomment if you're getting volume init error)
451
 //#define ENCODER_PULSES_PER_STEP 1 // Increase if you have a high resolution encoder
487
 //#define ENCODER_PULSES_PER_STEP 1 // Increase if you have a high resolution encoder
452
 //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
488
 //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
453
-//#define ULTIMAKERCONTROLLER //as available from the ultimaker online store.
454
-//#define ULTIPANEL  //the ultipanel as on thingiverse
489
+//#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
490
+//#define ULTIPANEL  //the UltiPanel as on Thingiverse
455
 //#define LCD_FEEDBACK_FREQUENCY_HZ 1000	// this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
491
 //#define LCD_FEEDBACK_FREQUENCY_HZ 1000	// this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
456
 //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
492
 //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
457
 
493
 
576
 // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
612
 // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
577
 //#define SR_LCD
613
 //#define SR_LCD
578
 #ifdef SR_LCD
614
 #ifdef SR_LCD
579
-   #define SR_LCD_2W_NL    // Non latching 2 wire shiftregister
615
+   #define SR_LCD_2W_NL    // Non latching 2 wire shift register
580
    //#define NEWPANEL
616
    //#define NEWPANEL
581
 #endif
617
 #endif
582
 
618
 
592
     #define LCD_WIDTH 20
628
     #define LCD_WIDTH 20
593
     #define LCD_HEIGHT 4
629
     #define LCD_HEIGHT 4
594
   #endif
630
   #endif
595
-#else //no panel but just lcd
631
+#else //no panel but just LCD
596
   #ifdef ULTRA_LCD
632
   #ifdef ULTRA_LCD
597
   #ifdef DOGLCD // Change number of lines to match the 128x64 graphics display
633
   #ifdef DOGLCD // Change number of lines to match the 128x64 graphics display
598
     #define LCD_WIDTH 20
634
     #define LCD_WIDTH 20
614
 // Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino
650
 // Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino
615
 //#define FAST_PWM_FAN
651
 //#define FAST_PWM_FAN
616
 
652
 
617
-// Temperature status leds that display the hotend and bet temperature.
618
-// If alle hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on.
653
+// Temperature status LEDs that display the hotend and bet temperature.
654
+// If all hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on.
619
 // Otherwise the RED led is on. There is 1C hysteresis.
655
 // Otherwise the RED led is on. There is 1C hysteresis.
620
 //#define TEMP_STAT_LEDS
656
 //#define TEMP_STAT_LEDS
621
 
657
 

+ 24
- 3
Marlin/ConfigurationStore.cpp View File

37
 // the default values are used whenever there is a change to the data, to prevent
37
 // the default values are used whenever there is a change to the data, to prevent
38
 // wrong data being written to the variables.
38
 // wrong data being written to the variables.
39
 // ALSO:  always make sure the variables in the Store and retrieve sections are in the same order.
39
 // ALSO:  always make sure the variables in the Store and retrieve sections are in the same order.
40
+#ifdef DELTA
41
+#define EEPROM_VERSION "V11"
42
+#else
40
 #define EEPROM_VERSION "V10"
43
 #define EEPROM_VERSION "V10"
44
+#endif
41
 
45
 
42
 #ifdef EEPROM_SETTINGS
46
 #ifdef EEPROM_SETTINGS
43
 void Config_StoreSettings() 
47
 void Config_StoreSettings() 
59
   EEPROM_WRITE_VAR(i,add_homeing);
63
   EEPROM_WRITE_VAR(i,add_homeing);
60
   #ifdef DELTA
64
   #ifdef DELTA
61
   EEPROM_WRITE_VAR(i,endstop_adj);
65
   EEPROM_WRITE_VAR(i,endstop_adj);
66
+  EEPROM_WRITE_VAR(i,delta_radius);
67
+  EEPROM_WRITE_VAR(i,delta_diagonal_rod);
68
+  EEPROM_WRITE_VAR(i,delta_segments_per_second);
62
   #endif
69
   #endif
63
   #ifndef ULTIPANEL
70
   #ifndef ULTIPANEL
64
   int plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP, plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP, plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED;
71
   int plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP, plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP, plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED;
156
     SERIAL_ECHOPAIR("  M666 X",endstop_adj[0] );
163
     SERIAL_ECHOPAIR("  M666 X",endstop_adj[0] );
157
     SERIAL_ECHOPAIR(" Y" ,endstop_adj[1] );
164
     SERIAL_ECHOPAIR(" Y" ,endstop_adj[1] );
158
     SERIAL_ECHOPAIR(" Z" ,endstop_adj[2] );
165
     SERIAL_ECHOPAIR(" Z" ,endstop_adj[2] );
159
-    SERIAL_ECHOLN("");
166
+	SERIAL_ECHOLN("");
167
+	SERIAL_ECHO_START;
168
+	SERIAL_ECHOLNPGM("Delta settings: L=delta_diagonal_rod, R=delta_radius, S=delta_segments_per_second");
169
+	SERIAL_ECHO_START;
170
+	SERIAL_ECHOPAIR("  M665 L",delta_diagonal_rod );
171
+	SERIAL_ECHOPAIR(" R" ,delta_radius );
172
+	SERIAL_ECHOPAIR(" S" ,delta_segments_per_second );
173
+	SERIAL_ECHOLN("");
160
 #endif
174
 #endif
161
 #ifdef PIDTEMP
175
 #ifdef PIDTEMP
162
     SERIAL_ECHO_START;
176
     SERIAL_ECHO_START;
199
         EEPROM_READ_VAR(i,max_e_jerk);
213
         EEPROM_READ_VAR(i,max_e_jerk);
200
         EEPROM_READ_VAR(i,add_homeing);
214
         EEPROM_READ_VAR(i,add_homeing);
201
         #ifdef DELTA
215
         #ifdef DELTA
202
-        EEPROM_READ_VAR(i,endstop_adj);
216
+		EEPROM_READ_VAR(i,endstop_adj);
217
+		EEPROM_READ_VAR(i,delta_radius);
218
+		EEPROM_READ_VAR(i,delta_diagonal_rod);
219
+		EEPROM_READ_VAR(i,delta_segments_per_second);
203
         #endif
220
         #endif
204
         #ifndef ULTIPANEL
221
         #ifndef ULTIPANEL
205
         int plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed;
222
         int plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed;
264
     max_e_jerk=DEFAULT_EJERK;
281
     max_e_jerk=DEFAULT_EJERK;
265
     add_homeing[0] = add_homeing[1] = add_homeing[2] = 0;
282
     add_homeing[0] = add_homeing[1] = add_homeing[2] = 0;
266
 #ifdef DELTA
283
 #ifdef DELTA
267
-    endstop_adj[0] = endstop_adj[1] = endstop_adj[2] = 0;
284
+	endstop_adj[0] = endstop_adj[1] = endstop_adj[2] = 0;
285
+	delta_radius= DELTA_RADIUS;
286
+	delta_diagonal_rod= DELTA_DIAGONAL_ROD;
287
+	delta_segments_per_second= DELTA_SEGMENTS_PER_SECOND;
288
+	recalc_delta_settings(delta_radius, delta_diagonal_rod);
268
 #endif
289
 #endif
269
 #ifdef ULTIPANEL
290
 #ifdef ULTIPANEL
270
     plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP;
291
     plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP;

+ 30
- 16
Marlin/Configuration_adv.h View File

11
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
11
 #define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
12
 
12
 
13
 //// Heating sanity check:
13
 //// Heating sanity check:
14
-// This waits for the watchperiod in milliseconds whenever an M104 or M109 increases the target temperature
14
+// This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperature
15
 // If the temperature has not increased at the end of that period, the target temperature is set to zero.
15
 // If the temperature has not increased at the end of that period, the target temperature is set to zero.
16
 // It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature
16
 // It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature
17
 //  differ by at least 2x WATCH_TEMP_INCREASE
17
 //  differ by at least 2x WATCH_TEMP_INCREASE
19
 //#define WATCH_TEMP_INCREASE 10  //Heat up at least 10 degree in 20 seconds
19
 //#define WATCH_TEMP_INCREASE 10  //Heat up at least 10 degree in 20 seconds
20
 
20
 
21
 #ifdef PIDTEMP
21
 #ifdef PIDTEMP
22
-  // this adds an experimental additional term to the heatingpower, proportional to the extrusion speed.
23
-  // if Kc is choosen well, the additional required power due to increased melting should be compensated.
22
+  // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
23
+  // if Kc is chosen well, the additional required power due to increased melting should be compensated.
24
   #define PID_ADD_EXTRUSION_RATE
24
   #define PID_ADD_EXTRUSION_RATE
25
   #ifdef PID_ADD_EXTRUSION_RATE
25
   #ifdef PID_ADD_EXTRUSION_RATE
26
-    #define  DEFAULT_Kc (1) //heatingpower=Kc*(e_speed)
26
+    #define  DEFAULT_Kc (1) //heating power=Kc*(e_speed)
27
   #endif
27
   #endif
28
 #endif
28
 #endif
29
 
29
 
34
 // the target temperature is set to mintemp+factor*se[steps/sec] and limited by mintemp and maxtemp
34
 // the target temperature is set to mintemp+factor*se[steps/sec] and limited by mintemp and maxtemp
35
 // you exit the value by any M109 without F*
35
 // you exit the value by any M109 without F*
36
 // Also, if the temperature is set to a value <mintemp, it is not changed by autotemp.
36
 // Also, if the temperature is set to a value <mintemp, it is not changed by autotemp.
37
-// on an ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode
37
+// on an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode
38
 #define AUTOTEMP
38
 #define AUTOTEMP
39
 #ifdef AUTOTEMP
39
 #ifdef AUTOTEMP
40
   #define AUTOTEMP_OLDWEIGHT 0.98
40
   #define AUTOTEMP_OLDWEIGHT 0.98
239
 #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60}  // set the speeds for manual moves (mm/min)
239
 #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60}  // set the speeds for manual moves (mm/min)
240
 #endif
240
 #endif
241
 
241
 
242
+//Comment to disable setting feedrate multiplier via encoder
243
+#ifdef ULTIPANEL
244
+    #define ULTIPANEL_FEEDMULTIPLY
245
+#endif
246
+
242
 // minimum time in microseconds that a movement needs to take if the buffer is emptied.
247
 // minimum time in microseconds that a movement needs to take if the buffer is emptied.
243
 #define DEFAULT_MINSEGMENTTIME        20000
248
 #define DEFAULT_MINSEGMENTTIME        20000
244
 
249
 
279
 //=============================Additional Features===========================
284
 //=============================Additional Features===========================
280
 //===========================================================================
285
 //===========================================================================
281
 
286
 
287
+//#define CHDK 4        //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/
288
+#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again
289
+
282
 #define SD_FINISHED_STEPPERRELEASE true  //if sd support and the file is finished: disable steppers?
290
 #define SD_FINISHED_STEPPERRELEASE true  //if sd support and the file is finished: disable steppers?
283
 #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place.
291
 #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place.
284
 
292
 
285
-#define SDCARD_RATHERRECENTFIRST  //reverse file order of sd card menu display. Its sorted practically after the filesystem block order.
286
-// if a file is deleted, it frees a block. hence, the order is not purely cronological. To still have auto0.g accessible, there is again the option to do that.
293
+#define SDCARD_RATHERRECENTFIRST  //reverse file order of sd card menu display. Its sorted practically after the file system block order.
294
+// if a file is deleted, it frees a block. hence, the order is not purely chronological. To still have auto0.g accessible, there is again the option to do that.
287
 // using:
295
 // using:
288
 //#define MENU_ADDAUTOSTART
296
 //#define MENU_ADDAUTOSTART
289
 
297
 
290
-// The hardware watchdog should reset the Microcontroller disabling all outputs, in case the firmware gets stuck and doesn't do temperature regulation.
298
+// The hardware watchdog should reset the microcontroller disabling all outputs, in case the firmware gets stuck and doesn't do temperature regulation.
291
 //#define USE_WATCHDOG
299
 //#define USE_WATCHDOG
292
 
300
 
293
 #ifdef USE_WATCHDOG
301
 #ifdef USE_WATCHDOG
301
 //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
309
 //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
302
 
310
 
303
 // Babystepping enables the user to control the axis in tiny amounts, independently from the normal printing process
311
 // Babystepping enables the user to control the axis in tiny amounts, independently from the normal printing process
304
-// it can e.g. be used to change z-positions in the print startup phase in realtime
312
+// it can e.g. be used to change z-positions in the print startup phase in real-time
305
 // does not respect endstops!
313
 // does not respect endstops!
306
 //#define BABYSTEPPING
314
 //#define BABYSTEPPING
307
 #ifdef BABYSTEPPING
315
 #ifdef BABYSTEPPING
324
 //
332
 //
325
 // advance (steps) = STEPS_PER_CUBIC_MM_E * EXTUDER_ADVANCE_K * cubic mm per second ^ 2
333
 // advance (steps) = STEPS_PER_CUBIC_MM_E * EXTUDER_ADVANCE_K * cubic mm per second ^ 2
326
 //
334
 //
327
-// hooke's law says:		force = k * distance
328
-// bernoulli's priniciple says:	v ^ 2 / 2 + g . h + pressure / density = constant
335
+// Hooke's law says:		force = k * distance
336
+// Bernoulli's principle says:	v ^ 2 / 2 + g . h + pressure / density = constant
329
 // so: v ^ 2 is proportional to number of steps we advance the extruder
337
 // so: v ^ 2 is proportional to number of steps we advance the extruder
330
 //#define ADVANCE
338
 //#define ADVANCE
331
 
339
 
379
 //===========================================================================
387
 //===========================================================================
380
 
388
 
381
 // The number of linear motions that can be in the plan at any give time.
389
 // The number of linear motions that can be in the plan at any give time.
382
-// THE BLOCK_BUFFER_SIZE NEEDS TO BE A POWER OF 2, i.g. 8,16,32 because shifts and ors are used to do the ringbuffering.
390
+// THE BLOCK_BUFFER_SIZE NEEDS TO BE A POWER OF 2, i.g. 8,16,32 because shifts and ors are used to do the ring-buffering.
383
 #if defined SDSUPPORT
391
 #if defined SDSUPPORT
384
   #define BLOCK_BUFFER_SIZE 16   // SD,LCD,Buttons take more memory, block buffer needs to be smaller
392
   #define BLOCK_BUFFER_SIZE 16   // SD,LCD,Buttons take more memory, block buffer needs to be smaller
385
 #else
393
 #else
387
 #endif
395
 #endif
388
 
396
 
389
 
397
 
390
-//The ASCII buffer for recieving from the serial:
398
+//The ASCII buffer for receiving from the serial:
391
 #define MAX_CMD_SIZE 96
399
 #define MAX_CMD_SIZE 96
392
 #define BUFSIZE 4
400
 #define BUFSIZE 4
393
 
401
 
394
 
402
 
395
-// Firmware based and LCD controled retract
403
+// Firmware based and LCD controlled retract
396
 // M207 and M208 can be used to define parameters for the retraction.
404
 // M207 and M208 can be used to define parameters for the retraction.
397
 // The retraction can be called by the slicer using G10 and G11
405
 // The retraction can be called by the slicer using G10 and G11
398
 // until then, intended retractions can be detected by moves that only extrude and the direction.
406
 // until then, intended retractions can be detected by moves that only extrude and the direction.
399
 // the moves are than replaced by the firmware controlled ones.
407
 // the moves are than replaced by the firmware controlled ones.
400
 
408
 
401
 // #define FWRETRACT  //ONLY PARTIALLY TESTED
409
 // #define FWRETRACT  //ONLY PARTIALLY TESTED
402
-#define MIN_RETRACT 0.1 //minimum extruded mm to accept a automatic gcode retraction attempt
403
-
410
+#ifdef FWRETRACT
411
+  #define MIN_RETRACT 0.1                //minimum extruded mm to accept a automatic gcode retraction attempt
412
+  #define RETRACT_LENGTH 3               //default retract length (positive mm)
413
+  #define RETRACT_FEEDRATE 80*60         //default feedrate for retracting
414
+  #define RETRACT_ZLIFT 0                //default retract Z-lift
415
+  #define RETRACT_RECOVER_LENGTH 0       //default additional recover length (mm, added to retract length when recovering)
416
+  #define RETRACT_RECOVER_FEEDRATE 8*60  //default feedrate for recovering from retraction
417
+#endif
404
 
418
 
405
 //adds support for experimental filament exchange support M600; requires display
419
 //adds support for experimental filament exchange support M600; requires display
406
 #ifdef ULTIPANEL
420
 #ifdef ULTIPANEL

BIN
Marlin/LCD Menu Tree.pdf View File


+ 5
- 5
Marlin/LiquidCrystalRus.cpp View File

11
   #include "WProgram.h"
11
   #include "WProgram.h"
12
 #endif
12
 #endif
13
 
13
 
14
-// it is a russian alphabet translation
14
+// it is a Russian alphabet translation
15
 // except 0401 --> 0xa2 = ╗, 0451 --> 0xb5
15
 // except 0401 --> 0xa2 = ╗, 0451 --> 0xb5
16
 const PROGMEM uint8_t utf_recode[] = 
16
 const PROGMEM uint8_t utf_recode[] = 
17
        { 0x41,0xa0,0x42,0xa1,0xe0,0x45,0xa3,0xa4,0xa5,0xa6,0x4b,0xa7,0x4d,0x48,0x4f,
17
        { 0x41,0xa0,0x42,0xa1,0xe0,0x45,0xa3,0xa4,0xa5,0xa6,0x4b,0xa7,0x4d,0x48,0x4f,
115
 
115
 
116
   // SEE PAGE 45/46 FOR INITIALIZATION SPECIFICATION!
116
   // SEE PAGE 45/46 FOR INITIALIZATION SPECIFICATION!
117
   // according to datasheet, we need at least 40ms after power rises above 2.7V
117
   // according to datasheet, we need at least 40ms after power rises above 2.7V
118
-  // before sending commands. Arduino can turn on way befer 4.5V so we'll wait 50
118
+  // before sending commands. Arduino can turn on way before 4.5V so we'll wait 50
119
   delayMicroseconds(50000); 
119
   delayMicroseconds(50000); 
120
   // Now we pull both RS and R/W low to begin commands
120
   // Now we pull both RS and R/W low to begin commands
121
   digitalWrite(_rs_pin, LOW);
121
   digitalWrite(_rs_pin, LOW);
126
   
126
   
127
   //put the LCD into 4 bit or 8 bit mode
127
   //put the LCD into 4 bit or 8 bit mode
128
   if (! (_displayfunction & LCD_8BITMODE)) {
128
   if (! (_displayfunction & LCD_8BITMODE)) {
129
-    // this is according to the hitachi HD44780 datasheet
129
+    // this is according to the Hitachi HD44780 datasheet
130
     // figure 24, pg 46
130
     // figure 24, pg 46
131
 
131
 
132
     // we start in 8bit mode, try to set 4 bit mode
132
     // we start in 8bit mode, try to set 4 bit mode
144
     // finally, set to 8-bit interface
144
     // finally, set to 8-bit interface
145
     writeNbits(0x02,4); 
145
     writeNbits(0x02,4); 
146
   } else {
146
   } else {
147
-    // this is according to the hitachi HD44780 datasheet
147
+    // this is according to the Hitachi HD44780 datasheet
148
     // page 45 figure 23
148
     // page 45 figure 23
149
 
149
 
150
     // Send function set command sequence
150
     // Send function set command sequence
308
     }    
308
     }    
309
   } else send(out_char, HIGH);
309
   } else send(out_char, HIGH);
310
 #if defined(ARDUINO) && ARDUINO >= 100
310
 #if defined(ARDUINO) && ARDUINO >= 100
311
-  return 1; // assume sucess 
311
+  return 1; // assume success 
312
 #endif
312
 #endif
313
 }
313
 }
314
 
314
 

+ 3
- 2
Marlin/Makefile View File

236
 VPATH += $(HARDWARE_DIR)/libraries/Wire/utility
236
 VPATH += $(HARDWARE_DIR)/libraries/Wire/utility
237
 VPATH += $(HARDWARE_DIR)/libraries/LiquidTWI2
237
 VPATH += $(HARDWARE_DIR)/libraries/LiquidTWI2
238
 endif
238
 endif
239
-ifeq ($(WIRE, 1)
239
+ifeq ($(WIRE), 1)
240
 VPATH += $(HARDWARE_DIR)/libraries/Wire
240
 VPATH += $(HARDWARE_DIR)/libraries/Wire
241
 VPATH += $(HARDWARE_DIR)/libraries/Wire/utility
241
 VPATH += $(HARDWARE_DIR)/libraries/Wire/utility
242
 endif
242
 endif
260
 	MarlinSerial.cpp Sd2Card.cpp SdBaseFile.cpp SdFatUtil.cpp	\
260
 	MarlinSerial.cpp Sd2Card.cpp SdBaseFile.cpp SdFatUtil.cpp	\
261
 	SdFile.cpp SdVolume.cpp motion_control.cpp planner.cpp		\
261
 	SdFile.cpp SdVolume.cpp motion_control.cpp planner.cpp		\
262
 	stepper.cpp temperature.cpp cardreader.cpp ConfigurationStore.cpp \
262
 	stepper.cpp temperature.cpp cardreader.cpp ConfigurationStore.cpp \
263
-	watchdog.cpp SPI.cpp Servo.cpp Tone.cpp ultralcd.cpp digipot_mcp4451.cpp
263
+	watchdog.cpp SPI.cpp Servo.cpp Tone.cpp ultralcd.cpp digipot_mcp4451.cpp \
264
+	vector_3.cpp qr_solve.cpp
264
 ifeq ($(LIQUID_TWI2), 0)
265
 ifeq ($(LIQUID_TWI2), 0)
265
 CXXSRC += LiquidCrystal.cpp
266
 CXXSRC += LiquidCrystal.cpp
266
 else
267
 else

+ 11
- 5
Marlin/Marlin.h View File

1
 // Tonokip RepRap firmware rewrite based off of Hydra-mmm firmware.
1
 // Tonokip RepRap firmware rewrite based off of Hydra-mmm firmware.
2
-// Licence: GPL
2
+// License: GPL
3
 
3
 
4
 #ifndef MARLIN_H
4
 #ifndef MARLIN_H
5
 #define MARLIN_H
5
 #define MARLIN_H
30
 # include "Arduino.h"
30
 # include "Arduino.h"
31
 #else
31
 #else
32
 # include "WProgram.h"
32
 # include "WProgram.h"
33
-  //Arduino < 1.0.0 does not define this, so we need to do it ourselfs
33
+  //Arduino < 1.0.0 does not define this, so we need to do it ourselves
34
 # define analogInputToDigitalPin(p) ((p) + A0)
34
 # define analogInputToDigitalPin(p) ((p) + A0)
35
 #endif
35
 #endif
36
 
36
 
87
 void serial_echopair_P(const char *s_P, unsigned long v);
87
 void serial_echopair_P(const char *s_P, unsigned long v);
88
 
88
 
89
 
89
 
90
-//things to write to serial from Programmemory. saves 400 to 2k of RAM.
90
+//Things to write to serial from Program memory. Saves 400 to 2k of RAM.
91
 FORCE_INLINE void serialprintPGM(const char *str)
91
 FORCE_INLINE void serialprintPGM(const char *str)
92
 {
92
 {
93
   char ch=pgm_read_byte(str);
93
   char ch=pgm_read_byte(str);
184
 
184
 
185
 bool IsStopped();
185
 bool IsStopped();
186
 
186
 
187
-void enquecommand(const char *cmd); //put an ascii command at the end of the current buffer.
188
-void enquecommand_P(const char *cmd); //put an ascii command at the end of the current buffer, read from flash
187
+void enquecommand(const char *cmd); //put an ASCII command at the end of the current buffer.
188
+void enquecommand_P(const char *cmd); //put an ASCII command at the end of the current buffer, read from flash
189
 void prepare_arc_move(char isclockwise);
189
 void prepare_arc_move(char isclockwise);
190
 void clamp_to_software_endstops(float target[3]);
190
 void clamp_to_software_endstops(float target[3]);
191
 
191
 
192
+void refresh_cmd_timeout(void);
193
+
192
 #ifdef FAST_PWM_FAN
194
 #ifdef FAST_PWM_FAN
193
 void setPwmFrequency(uint8_t pin, int val);
195
 void setPwmFrequency(uint8_t pin, int val);
194
 #endif
196
 #endif
207
 extern float add_homeing[3];
209
 extern float add_homeing[3];
208
 #ifdef DELTA
210
 #ifdef DELTA
209
 extern float endstop_adj[3];
211
 extern float endstop_adj[3];
212
+extern float delta_radius;
213
+extern float delta_diagonal_rod;
214
+extern float delta_segments_per_second;
215
+void recalc_delta_settings(float radius, float diagonal_rod);
210
 #endif
216
 #endif
211
 extern float min_pos[3];
217
 extern float min_pos[3];
212
 extern float max_pos[3];
218
 extern float max_pos[3];

+ 2
- 2
Marlin/MarlinSerial.cpp View File

25
 
25
 
26
 #ifndef AT90USB
26
 #ifndef AT90USB
27
 // this next line disables the entire HardwareSerial.cpp, 
27
 // this next line disables the entire HardwareSerial.cpp, 
28
-// this is so I can support Attiny series and any other chip without a uart
28
+// this is so I can support Attiny series and any other chip without a UART
29
 #if defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H)
29
 #if defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H)
30
 
30
 
31
 #if UART_PRESENT(SERIAL_PORT)
31
 #if UART_PRESENT(SERIAL_PORT)
73
   bool useU2X = true;
73
   bool useU2X = true;
74
 
74
 
75
 #if F_CPU == 16000000UL && SERIAL_PORT == 0
75
 #if F_CPU == 16000000UL && SERIAL_PORT == 0
76
-  // hardcoded exception for compatibility with the bootloader shipped
76
+  // hard coded exception for compatibility with the bootloader shipped
77
   // with the Duemilanove and previous boards and the firmware on the 8U2
77
   // with the Duemilanove and previous boards and the firmware on the 8U2
78
   // on the Uno and Mega 2560.
78
   // on the Uno and Mega 2560.
79
   if (baud == 57600) {
79
   if (baud == 57600) {

+ 253
- 219
Marlin/Marlin_main.cpp View File

31
 
31
 
32
 #ifdef ENABLE_AUTO_BED_LEVELING
32
 #ifdef ENABLE_AUTO_BED_LEVELING
33
 #include "vector_3.h"
33
 #include "vector_3.h"
34
-  #ifdef ACCURATE_BED_LEVELING
34
+  #ifdef AUTO_BED_LEVELING_GRID
35
     #include "qr_solve.h"
35
     #include "qr_solve.h"
36
   #endif
36
   #endif
37
 #endif // ENABLE_AUTO_BED_LEVELING
37
 #endif // ENABLE_AUTO_BED_LEVELING
63
 
63
 
64
 #define VERSION_STRING  "1.0.0"
64
 #define VERSION_STRING  "1.0.0"
65
 
65
 
66
-// look here for descriptions of gcodes: http://linuxcnc.org/handbook/gcode/g-code.html
66
+// look here for descriptions of G-codes: http://linuxcnc.org/handbook/gcode/g-code.html
67
 // http://objects.reprap.org/wiki/Mendel_User_Manual:_RepRapGCodes
67
 // http://objects.reprap.org/wiki/Mendel_User_Manual:_RepRapGCodes
68
 
68
 
69
 //Implemented Codes
69
 //Implemented Codes
76
 // G10 - retract filament according to settings of M207
76
 // G10 - retract filament according to settings of M207
77
 // G11 - retract recover filament according to settings of M208
77
 // G11 - retract recover filament according to settings of M208
78
 // G28 - Home all Axis
78
 // G28 - Home all Axis
79
-// G29 - Detailed Z-Probe, probes the bed at 3 points.  You must de at the home position for this to work correctly.
79
+// G29 - Detailed Z-Probe, probes the bed at 3 or more points.  Will fail if you haven't homed yet.
80
 // G30 - Single Z Probe, probes bed at current XY location.
80
 // G30 - Single Z Probe, probes bed at current XY location.
81
 // G90 - Use Absolute Coordinates
81
 // G90 - Use Absolute Coordinates
82
 // G91 - Use Relative Coordinates
82
 // G91 - Use Relative Coordinates
83
-// G92 - Set current position to cordinates given
83
+// G92 - Set current position to coordinates given
84
 
84
 
85
 // M Codes
85
 // M Codes
86
 // M0   - Unconditional stop - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled)
86
 // M0   - Unconditional stop - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled)
101
 // M31  - Output time since last M109 or SD card start to serial
101
 // M31  - Output time since last M109 or SD card start to serial
102
 // M32  - Select file and start SD print (Can be used _while_ printing from SD card files):
102
 // M32  - Select file and start SD print (Can be used _while_ printing from SD card files):
103
 //        syntax "M32 /path/filename#", or "M32 S<startpos bytes> !filename#"
103
 //        syntax "M32 /path/filename#", or "M32 S<startpos bytes> !filename#"
104
-//        Call gcode file : "M32 P !filename#" and return to caller file after finishing (simiarl to #include).
104
+//        Call gcode file : "M32 P !filename#" and return to caller file after finishing (similar to #include).
105
 //        The '#' is necessary when calling from within sd files, as it stops buffer prereading
105
 //        The '#' is necessary when calling from within sd files, as it stops buffer prereading
106
 // 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.
106
 // 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.
107
 // M80  - Turn on Power Supply
107
 // M80  - Turn on Power Supply
127
 // M128 - EtoP Open (BariCUDA EtoP = electricity to air pressure transducer by jmil)
127
 // M128 - EtoP Open (BariCUDA EtoP = electricity to air pressure transducer by jmil)
128
 // M129 - EtoP Closed (BariCUDA EtoP = electricity to air pressure transducer by jmil)
128
 // M129 - EtoP Closed (BariCUDA EtoP = electricity to air pressure transducer by jmil)
129
 // M140 - Set bed target temp
129
 // M140 - Set bed target temp
130
-// M150 - Set BlinkM Colour Output R: Red<0-255> U(!): Green<0-255> B: Blue<0-255> over i2c, G for green does not work.
130
+// M150 - Set BlinkM Color Output R: Red<0-255> U(!): Green<0-255> B: Blue<0-255> over i2c, G for green does not work.
131
 // M190 - Sxxx Wait for bed current temp to reach target temp. Waits only when heating
131
 // M190 - Sxxx Wait for bed current temp to reach target temp. Waits only when heating
132
 //        Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling
132
 //        Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling
133
 // M200 D<millimeters>- set filament diameter and set E axis units to cubic millimeters (use S0 to set back to millimeters).
133
 // M200 D<millimeters>- set filament diameter and set E axis units to cubic millimeters (use S0 to set back to millimeters).
134
 // M201 - Set max acceleration in units/s^2 for print moves (M201 X1000 Y1000)
134
 // M201 - Set max acceleration in units/s^2 for print moves (M201 X1000 Y1000)
135
 // M202 - Set max acceleration in units/s^2 for travel moves (M202 X1000 Y1000) Unused in Marlin!!
135
 // M202 - Set max acceleration in units/s^2 for travel moves (M202 X1000 Y1000) Unused in Marlin!!
136
 // M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec
136
 // M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec
137
-// 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
137
+// M204 - Set default acceleration: S normal moves T filament only moves (M204 S3000 T7000) in mm/sec^2  also sets minimum segment time in ms (B20000) to prevent buffer under-runs and M20 minimum feedrate
138
 // 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
138
 // 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
139
-// M206 - set additional homeing offset
140
-// M207 - set retract length S[positive mm] F[feedrate mm/sec] Z[additional zlift/hop]
139
+// M206 - set additional homing offset
140
+// M207 - set retract length S[positive mm] F[feedrate mm/min] Z[additional zlift/hop], stays in mm regardless of M200 setting
141
 // M208 - set recover=unretract length S[positive mm surplus to the M207 S*] F[feedrate mm/sec]
141
 // M208 - set recover=unretract length S[positive mm surplus to the M207 S*] F[feedrate mm/sec]
142
 // 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.
142
 // 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.
143
 // M218 - set hotend offset (in mm): T<extruder_number> X<offset_on_X> Y<offset_on_Y>
143
 // M218 - set hotend offset (in mm): T<extruder_number> X<offset_on_X> Y<offset_on_Y>
147
 // M240 - Trigger a camera to take a photograph
147
 // M240 - Trigger a camera to take a photograph
148
 // M250 - Set LCD contrast C<contrast value> (value 0..63)
148
 // M250 - Set LCD contrast C<contrast value> (value 0..63)
149
 // M280 - set servo position absolute. P: servo index, S: angle or microseconds
149
 // M280 - set servo position absolute. P: servo index, S: angle or microseconds
150
-// M300 - Play beepsound S<frequency Hz> P<duration ms>
150
+// M300 - Play beep sound S<frequency Hz> P<duration ms>
151
 // M301 - Set PID parameters P I and D
151
 // M301 - Set PID parameters P I and D
152
 // M302 - Allow cold extrudes, or set the minimum extrude S<temperature>.
152
 // M302 - Allow cold extrudes, or set the minimum extrude S<temperature>.
153
 // M303 - PID relay autotune S<temperature> sets the target temperature. (default target temperature = 150C)
153
 // M303 - PID relay autotune S<temperature> sets the target temperature. (default target temperature = 150C)
155
 // M400 - Finish all moves
155
 // M400 - Finish all moves
156
 // M401 - Lower z-probe if present
156
 // M401 - Lower z-probe if present
157
 // M402 - Raise z-probe if present
157
 // M402 - Raise z-probe if present
158
-// M500 - stores paramters in EEPROM
158
+// M500 - stores parameters in EEPROM
159
 // M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
159
 // M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
160
 // M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
160
 // M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
161
-// M503 - print the current settings (from memory not from eeprom)
161
+// M503 - print the current settings (from memory not from EEPROM)
162
 // M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
162
 // M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
163
 // M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
163
 // M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
164
-// M666 - set delta endstop adjustemnt
164
+// M665 - set delta configurations
165
+// M666 - set delta endstop adjustment
165
 // M605 - Set dual x-carriage movement mode: S<mode> [ X<duplication x-offset> R<duplication temp offset> ]
166
 // M605 - Set dual x-carriage movement mode: S<mode> [ X<duplication x-offset> R<duplication temp offset> ]
166
 // M907 - Set digital trimpot motor current using axis codes.
167
 // M907 - Set digital trimpot motor current using axis codes.
167
 // M908 - Control digital trimpot directly.
168
 // M908 - Control digital trimpot directly.
231
 #endif
232
 #endif
232
 
233
 
233
 #ifdef FWRETRACT
234
 #ifdef FWRETRACT
234
-  bool autoretract_enabled=true;
235
+  bool autoretract_enabled=false;
235
   bool retracted=false;
236
   bool retracted=false;
236
-  float retract_length=3, retract_feedrate=17*60, retract_zlift=0.8;
237
-  float retract_recover_length=0, retract_recover_feedrate=8*60;
237
+  float retract_length = RETRACT_LENGTH;
238
+  float retract_feedrate = RETRACT_FEEDRATE;
239
+  float retract_zlift = RETRACT_ZLIFT;
240
+  float retract_recover_length = RETRACT_RECOVER_LENGTH;
241
+  float retract_recover_feedrate = RETRACT_RECOVER_FEEDRATE;
238
 #endif
242
 #endif
239
 
243
 
240
 #ifdef ULTIPANEL
244
 #ifdef ULTIPANEL
246
 #endif
250
 #endif
247
 
251
 
248
 #ifdef DELTA
252
 #ifdef DELTA
249
-float delta[3] = {0.0, 0.0, 0.0};
250
-#endif
251
-
253
+  float delta[3] = {0.0, 0.0, 0.0};
254
+  #define SIN_60 0.8660254037844386
255
+  #define COS_60 0.5
256
+  // these are the default values, can be overriden with M665
257
+  float delta_radius= DELTA_RADIUS;
258
+  float delta_tower1_x= -SIN_60*delta_radius; // front left tower
259
+  float delta_tower1_y= -COS_60*delta_radius;	   
260
+  float delta_tower2_x=  SIN_60*delta_radius; // front right tower
261
+  float delta_tower2_y= -COS_60*delta_radius;	   
262
+  float delta_tower3_x= 0.0;                  // back middle tower
263
+  float delta_tower3_y= delta_radius;
264
+  float delta_diagonal_rod= DELTA_DIAGONAL_ROD;
265
+  float delta_diagonal_rod_2= sq(delta_diagonal_rod);
266
+  float delta_segments_per_second= DELTA_SEGMENTS_PER_SECOND;
267
+#endif					
252
 
268
 
253
 //===========================================================================
269
 //===========================================================================
254
-//=============================private variables=============================
270
+//=============================Private Variables=============================
255
 //===========================================================================
271
 //===========================================================================
256
 const char axis_codes[NUM_AXIS] = {'X', 'Y', 'Z', 'E'};
272
 const char axis_codes[NUM_AXIS] = {'X', 'Y', 'Z', 'E'};
257
 static float destination[NUM_AXIS] = {  0.0, 0.0, 0.0, 0.0};
273
 static float destination[NUM_AXIS] = {  0.0, 0.0, 0.0, 0.0};
271
 static char serial_char;
287
 static char serial_char;
272
 static int serial_count = 0;
288
 static int serial_count = 0;
273
 static boolean comment_mode = false;
289
 static boolean comment_mode = false;
274
-static char *strchr_pointer; // just a pointer to find chars in the cmd string like X, Y, Z, E, etc
290
+static char *strchr_pointer; // just a pointer to find chars in the command string like X, Y, Z, E, etc
275
 
291
 
276
 const int sensitive_pins[] = SENSITIVE_PINS; // Sensitive pin list for M42
292
 const int sensitive_pins[] = SENSITIVE_PINS; // Sensitive pin list for M42
277
 
293
 
298
 bool CooldownNoWait = true;
314
 bool CooldownNoWait = true;
299
 bool target_direction;
315
 bool target_direction;
300
 
316
 
317
+//Insert variables if CHDK is defined
318
+#ifdef CHDK
319
+unsigned long chdkHigh = 0;
320
+boolean chdkActive = false;
321
+#endif
322
+
301
 //===========================================================================
323
 //===========================================================================
302
-//=============================ROUTINES=============================
324
+//=============================Routines======================================
303
 //===========================================================================
325
 //===========================================================================
304
 
326
 
305
 void get_arc_coordinates();
327
 void get_arc_coordinates();
336
 {
358
 {
337
   if(buflen < BUFSIZE)
359
   if(buflen < BUFSIZE)
338
   {
360
   {
339
-    //this is dangerous if a mixing of serial and this happsens
361
+    //this is dangerous if a mixing of serial and this happens
340
     strcpy(&(cmdbuffer[bufindw][0]),cmd);
362
     strcpy(&(cmdbuffer[bufindw][0]),cmd);
341
     SERIAL_ECHO_START;
363
     SERIAL_ECHO_START;
342
     SERIAL_ECHOPGM("enqueing \"");
364
     SERIAL_ECHOPGM("enqueing \"");
351
 {
373
 {
352
   if(buflen < BUFSIZE)
374
   if(buflen < BUFSIZE)
353
   {
375
   {
354
-    //this is dangerous if a mixing of serial and this happsens
376
+    //this is dangerous if a mixing of serial and this happens
355
     strcpy_P(&(cmdbuffer[bufindw][0]),cmd);
377
     strcpy_P(&(cmdbuffer[bufindw][0]),cmd);
356
     SERIAL_ECHO_START;
378
     SERIAL_ECHO_START;
357
     SERIAL_ECHOPGM("enqueing \"");
379
     SERIAL_ECHOPGM("enqueing \"");
658
     return;
680
     return;
659
   }
681
   }
660
 
682
 
661
-  //'#' stops reading from sd to the buffer prematurely, so procedural macro calls are possible
662
-  // if it occures, stop_buffering is triggered and the buffer is ran dry.
663
-  // this character _can_ occure in serial com, due to checksums. however, no checksums are used in sd printing
683
+  //'#' stops reading from SD to the buffer prematurely, so procedural macro calls are possible
684
+  // if it occurs, stop_buffering is triggered and the buffer is ran dry.
685
+  // this character _can_ occur in serial com, due to checksums. however, no checksums are used in SD printing
664
 
686
 
665
   static bool stop_buffering=false;
687
   static bool stop_buffering=false;
666
   if(buflen==0) stop_buffering=false;
688
   if(buflen==0) stop_buffering=false;
819
 }
841
 }
820
 
842
 
821
 #ifdef ENABLE_AUTO_BED_LEVELING
843
 #ifdef ENABLE_AUTO_BED_LEVELING
822
-#ifdef ACCURATE_BED_LEVELING
844
+#ifdef AUTO_BED_LEVELING_GRID
823
 static void set_bed_level_equation_lsq(double *plane_equation_coefficients)
845
 static void set_bed_level_equation_lsq(double *plane_equation_coefficients)
824
 {
846
 {
825
     vector_3 planeNormal = vector_3(-plane_equation_coefficients[0], -plane_equation_coefficients[1], 1);
847
     vector_3 planeNormal = vector_3(-plane_equation_coefficients[0], -plane_equation_coefficients[1], 1);
843
     plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
865
     plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
844
 }
866
 }
845
 
867
 
846
-#else
847
-static void set_bed_level_equation(float z_at_xLeft_yFront, float z_at_xRight_yFront, float z_at_xLeft_yBack) {
848
-    plan_bed_level_matrix.set_to_identity();
868
+#else // not AUTO_BED_LEVELING_GRID
849
 
869
 
850
-    vector_3 xLeftyFront = vector_3(LEFT_PROBE_BED_POSITION, FRONT_PROBE_BED_POSITION, z_at_xLeft_yFront);
851
-    vector_3 xLeftyBack = vector_3(LEFT_PROBE_BED_POSITION, BACK_PROBE_BED_POSITION, z_at_xLeft_yBack);
852
-    vector_3 xRightyFront = vector_3(RIGHT_PROBE_BED_POSITION, FRONT_PROBE_BED_POSITION, z_at_xRight_yFront);
870
+static void set_bed_level_equation_3pts(float z_at_pt_1, float z_at_pt_2, float z_at_pt_3) {
853
 
871
 
854
-    vector_3 xPositive = (xRightyFront - xLeftyFront).get_normal();
855
-    vector_3 yPositive = (xLeftyBack - xLeftyFront).get_normal();
856
-    vector_3 planeNormal = vector_3::cross(xPositive, yPositive).get_normal();
872
+    plan_bed_level_matrix.set_to_identity();
857
 
873
 
858
-    //planeNormal.debug("planeNormal");
859
-    //yPositive.debug("yPositive");
860
-    plan_bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
861
-    //bedLevel.debug("bedLevel");
874
+    vector_3 pt1 = vector_3(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, z_at_pt_1);
875
+    vector_3 pt2 = vector_3(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, z_at_pt_2);
876
+    vector_3 pt3 = vector_3(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, z_at_pt_3);
862
 
877
 
863
-    //plan_bed_level_matrix.debug("bed level before");
864
-    //vector_3 uncorrected_position = plan_get_position_mm();
865
-    //uncorrected_position.debug("position before");
878
+    vector_3 from_2_to_1 = (pt1 - pt2).get_normal();
879
+    vector_3 from_2_to_3 = (pt3 - pt2).get_normal();
880
+    vector_3 planeNormal = vector_3::cross(from_2_to_1, from_2_to_3).get_normal();
881
+    planeNormal = vector_3(planeNormal.x, planeNormal.y, abs(planeNormal.z));
866
 
882
 
867
-    // and set our bed level equation to do the right thing
868
-    //plan_bed_level_matrix.debug("bed level after");
883
+    plan_bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
869
 
884
 
870
     vector_3 corrected_position = plan_get_position();
885
     vector_3 corrected_position = plan_get_position();
871
-    //corrected_position.debug("position after");
872
     current_position[X_AXIS] = corrected_position.x;
886
     current_position[X_AXIS] = corrected_position.x;
873
     current_position[Y_AXIS] = corrected_position.y;
887
     current_position[Y_AXIS] = corrected_position.y;
874
     current_position[Z_AXIS] = corrected_position.z;
888
     current_position[Z_AXIS] = corrected_position.z;
875
 
889
 
876
-    // but the bed at 0 so we don't go below it.
890
+    // put the bed at 0 so we don't go below it.
877
     current_position[Z_AXIS] = zprobe_zoffset;
891
     current_position[Z_AXIS] = zprobe_zoffset;
878
 
892
 
879
     plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
893
     plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
894
+
880
 }
895
 }
881
-#endif // ACCURATE_BED_LEVELING
896
+
897
+#endif // AUTO_BED_LEVELING_GRID
882
 
898
 
883
 static void run_z_probe() {
899
 static void run_z_probe() {
884
     plan_bed_level_matrix.set_to_identity();
900
     plan_bed_level_matrix.set_to_identity();
978
     #endif
994
     #endif
979
 }
995
 }
980
 
996
 
997
+/// Probe bed height at position (x,y), returns the measured z value
998
+static float probe_pt(float x, float y, float z_before) {
999
+  // move to right place
1000
+  do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z_before);
1001
+  do_blocking_move_to(x - X_PROBE_OFFSET_FROM_EXTRUDER, y - Y_PROBE_OFFSET_FROM_EXTRUDER, current_position[Z_AXIS]);
1002
+
1003
+  engage_z_probe();   // Engage Z Servo endstop if available
1004
+  run_z_probe();
1005
+  float measured_z = current_position[Z_AXIS];
1006
+  retract_z_probe();
1007
+
1008
+  SERIAL_PROTOCOLPGM(MSG_BED);
1009
+  SERIAL_PROTOCOLPGM(" x: ");
1010
+  SERIAL_PROTOCOL(x);
1011
+  SERIAL_PROTOCOLPGM(" y: ");
1012
+  SERIAL_PROTOCOL(y);
1013
+  SERIAL_PROTOCOLPGM(" z: ");
1014
+  SERIAL_PROTOCOL(measured_z);
1015
+  SERIAL_PROTOCOLPGM("\n");
1016
+  return measured_z;
1017
+}
1018
+
981
 #endif // #ifdef ENABLE_AUTO_BED_LEVELING
1019
 #endif // #ifdef ENABLE_AUTO_BED_LEVELING
982
 
1020
 
983
 static void homeaxis(int axis) {
1021
 static void homeaxis(int axis) {
1058
   }
1096
   }
1059
 }
1097
 }
1060
 #define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS)
1098
 #define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS)
1099
+void refresh_cmd_timeout(void)
1100
+{
1101
+  previous_millis_cmd = millis();
1102
+}
1103
+
1104
+#ifdef FWRETRACT
1105
+  void retract(bool retracting) {
1106
+    if(retracting && !retracted) {
1107
+      destination[X_AXIS]=current_position[X_AXIS];
1108
+      destination[Y_AXIS]=current_position[Y_AXIS];
1109
+      destination[Z_AXIS]=current_position[Z_AXIS];
1110
+      destination[E_AXIS]=current_position[E_AXIS];
1111
+      current_position[E_AXIS]+=retract_length/volumetric_multiplier[active_extruder];
1112
+      plan_set_e_position(current_position[E_AXIS]);
1113
+      float oldFeedrate = feedrate;
1114
+      feedrate=retract_feedrate;
1115
+      retracted=true;
1116
+      prepare_move();
1117
+      current_position[Z_AXIS]-=retract_zlift;
1118
+      plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1119
+      prepare_move();
1120
+      feedrate = oldFeedrate;
1121
+    } else if(!retracting && retracted) {
1122
+      destination[X_AXIS]=current_position[X_AXIS];
1123
+      destination[Y_AXIS]=current_position[Y_AXIS];
1124
+      destination[Z_AXIS]=current_position[Z_AXIS];
1125
+      destination[E_AXIS]=current_position[E_AXIS];
1126
+      current_position[Z_AXIS]+=retract_zlift;
1127
+      plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1128
+      //prepare_move();
1129
+      current_position[E_AXIS]-=(retract_length+retract_recover_length)/volumetric_multiplier[active_extruder]; 
1130
+      plan_set_e_position(current_position[E_AXIS]);
1131
+      float oldFeedrate = feedrate;
1132
+      feedrate=retract_recover_feedrate;
1133
+      retracted=false;
1134
+      prepare_move();
1135
+      feedrate = oldFeedrate;
1136
+    }
1137
+  } //retract
1138
+#endif //FWRETRACT
1061
 
1139
 
1062
 void process_commands()
1140
 void process_commands()
1063
 {
1141
 {
1074
     case 1: // G1
1152
     case 1: // G1
1075
       if(Stopped == false) {
1153
       if(Stopped == false) {
1076
         get_coordinates(); // For X Y Z E F
1154
         get_coordinates(); // For X Y Z E F
1155
+          #ifdef FWRETRACT
1156
+            if(autoretract_enabled)
1157
+            if( !(code_seen('X') || code_seen('Y') || code_seen('Z')) && code_seen('E')) {
1158
+              float echange=destination[E_AXIS]-current_position[E_AXIS];
1159
+              if((echange<-MIN_RETRACT && !retracted) || (echange>MIN_RETRACT && retracted)) { //move appears to be an attempt to retract or recover
1160
+                  current_position[E_AXIS] = destination[E_AXIS]; //hide the slicer-generated retract/recover from calculations
1161
+                  plan_set_e_position(current_position[E_AXIS]); //AND from the planner
1162
+                  retract(!retracted);
1163
+                  return;
1164
+              }
1165
+            }
1166
+          #endif //FWRETRACT
1077
         prepare_move();
1167
         prepare_move();
1078
         //ClearToSend();
1168
         //ClearToSend();
1079
         return;
1169
         return;
1108
       break;
1198
       break;
1109
       #ifdef FWRETRACT
1199
       #ifdef FWRETRACT
1110
       case 10: // G10 retract
1200
       case 10: // G10 retract
1111
-      if(!retracted)
1112
-      {
1113
-        destination[X_AXIS]=current_position[X_AXIS];
1114
-        destination[Y_AXIS]=current_position[Y_AXIS];
1115
-        destination[Z_AXIS]=current_position[Z_AXIS];
1116
-        current_position[Z_AXIS]+=-retract_zlift;
1117
-        destination[E_AXIS]=current_position[E_AXIS]-retract_length;
1118
-        feedrate=retract_feedrate;
1119
-        retracted=true;
1120
-        prepare_move();
1121
-      }
1122
-
1201
+        retract(true);
1123
       break;
1202
       break;
1124
       case 11: // G11 retract_recover
1203
       case 11: // G11 retract_recover
1125
-      if(retracted)
1126
-      {
1127
-        destination[X_AXIS]=current_position[X_AXIS];
1128
-        destination[Y_AXIS]=current_position[Y_AXIS];
1129
-        destination[Z_AXIS]=current_position[Z_AXIS];
1130
-        current_position[Z_AXIS]+=retract_zlift;
1131
-        destination[E_AXIS]=current_position[E_AXIS]+retract_length+retract_recover_length;
1132
-        feedrate=retract_recover_feedrate;
1133
-        retracted=false;
1134
-        prepare_move();
1135
-      }
1204
+        retract(false);
1136
       break;
1205
       break;
1137
       #endif //FWRETRACT
1206
       #endif //FWRETRACT
1138
     case 28: //G28 Home all Axis one at a time
1207
     case 28: //G28 Home all Axis one at a time
1185
 
1254
 
1186
 #else // NOT DELTA
1255
 #else // NOT DELTA
1187
 
1256
 
1188
-      home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2])));
1257
+      home_all_axis = !((code_seen(axis_codes[X_AXIS])) || (code_seen(axis_codes[Y_AXIS])) || (code_seen(axis_codes[Z_AXIS])));
1189
 
1258
 
1190
       #if Z_HOME_DIR > 0                      // If homing away from BED do Z first
1259
       #if Z_HOME_DIR > 0                      // If homing away from BED do Z first
1191
       if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
1260
       if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
1347
       break;
1416
       break;
1348
 
1417
 
1349
 #ifdef ENABLE_AUTO_BED_LEVELING
1418
 #ifdef ENABLE_AUTO_BED_LEVELING
1350
-    case 29: // G29 Detailed Z-Probe, probes the bed at 3 points.
1419
+    case 29: // G29 Detailed Z-Probe, probes the bed at 3 or more points.
1351
         {
1420
         {
1352
             #if Z_MIN_PIN == -1
1421
             #if Z_MIN_PIN == -1
1353
             #error "You must have a Z_MIN endstop in order to enable Auto Bed Leveling feature!!! Z_MIN_PIN must point to a valid hardware pin."
1422
             #error "You must have a Z_MIN endstop in order to enable Auto Bed Leveling feature!!! Z_MIN_PIN must point to a valid hardware pin."
1354
             #endif
1423
             #endif
1355
 
1424
 
1425
+            // Prevent user from running a G29 without first homing in X and Y
1426
+            if (! (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS]) )
1427
+            {
1428
+                LCD_MESSAGEPGM(MSG_POSITION_UNKNOWN);
1429
+                SERIAL_ECHO_START;
1430
+                SERIAL_ECHOLNPGM(MSG_POSITION_UNKNOWN);
1431
+                break; // abort G29, since we don't know where we are
1432
+            }
1433
+
1356
             st_synchronize();
1434
             st_synchronize();
1357
             // make sure the bed_level_rotation_matrix is identity or the planner will get it incorectly
1435
             // make sure the bed_level_rotation_matrix is identity or the planner will get it incorectly
1358
             //vector_3 corrected_position = plan_get_position_mm();
1436
             //vector_3 corrected_position = plan_get_position_mm();
1367
             setup_for_endstop_move();
1445
             setup_for_endstop_move();
1368
 
1446
 
1369
             feedrate = homing_feedrate[Z_AXIS];
1447
             feedrate = homing_feedrate[Z_AXIS];
1370
-#ifdef ACCURATE_BED_LEVELING
1448
+#ifdef AUTO_BED_LEVELING_GRID
1449
+            // probe at the points of a lattice grid
1371
 
1450
 
1372
-            int xGridSpacing = (RIGHT_PROBE_BED_POSITION - LEFT_PROBE_BED_POSITION) / (ACCURATE_BED_LEVELING_POINTS-1);
1373
-            int yGridSpacing = (BACK_PROBE_BED_POSITION - FRONT_PROBE_BED_POSITION) / (ACCURATE_BED_LEVELING_POINTS-1);
1451
+            int xGridSpacing = (RIGHT_PROBE_BED_POSITION - LEFT_PROBE_BED_POSITION) / (AUTO_BED_LEVELING_GRID_POINTS-1);
1452
+            int yGridSpacing = (BACK_PROBE_BED_POSITION - FRONT_PROBE_BED_POSITION) / (AUTO_BED_LEVELING_GRID_POINTS-1);
1374
 
1453
 
1375
 
1454
 
1376
             // solve the plane equation ax + by + d = z
1455
             // solve the plane equation ax + by + d = z
1380
             // so Vx = -a Vy = -b Vz = 1 (we want the vector facing towards positive Z
1459
             // so Vx = -a Vy = -b Vz = 1 (we want the vector facing towards positive Z
1381
 
1460
 
1382
             // "A" matrix of the linear system of equations
1461
             // "A" matrix of the linear system of equations
1383
-            double eqnAMatrix[ACCURATE_BED_LEVELING_POINTS*ACCURATE_BED_LEVELING_POINTS*3];
1462
+            double eqnAMatrix[AUTO_BED_LEVELING_GRID_POINTS*AUTO_BED_LEVELING_GRID_POINTS*3];
1384
             // "B" vector of Z points
1463
             // "B" vector of Z points
1385
-            double eqnBVector[ACCURATE_BED_LEVELING_POINTS*ACCURATE_BED_LEVELING_POINTS];
1464
+            double eqnBVector[AUTO_BED_LEVELING_GRID_POINTS*AUTO_BED_LEVELING_GRID_POINTS];
1386
 
1465
 
1387
 
1466
 
1388
             int probePointCounter = 0;
1467
             int probePointCounter = 0;
1405
                 zig = true;
1484
                 zig = true;
1406
               }
1485
               }
1407
 
1486
 
1408
-              for (int xCount=0; xCount < ACCURATE_BED_LEVELING_POINTS; xCount++)
1487
+              for (int xCount=0; xCount < AUTO_BED_LEVELING_GRID_POINTS; xCount++)
1409
               {
1488
               {
1489
+                float z_before;
1410
                 if (probePointCounter == 0)
1490
                 if (probePointCounter == 0)
1411
                 {
1491
                 {
1412
                   // raise before probing
1492
                   // raise before probing
1413
-                  do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], Z_RAISE_BEFORE_PROBING);
1493
+                  z_before = Z_RAISE_BEFORE_PROBING;
1414
                 } else
1494
                 } else
1415
                 {
1495
                 {
1416
                   // raise extruder
1496
                   // raise extruder
1417
-                  do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS);
1497
+                  z_before = current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS;
1418
                 }
1498
                 }
1419
 
1499
 
1500
+                float measured_z = probe_pt(xProbe, yProbe, z_before);
1420
 
1501
 
1421
-                do_blocking_move_to(xProbe - X_PROBE_OFFSET_FROM_EXTRUDER, yProbe - Y_PROBE_OFFSET_FROM_EXTRUDER, current_position[Z_AXIS]);
1422
-
1423
-                engage_z_probe();   // Engage Z Servo endstop if available
1424
-                run_z_probe();
1425
-                eqnBVector[probePointCounter] = current_position[Z_AXIS];
1426
-                retract_z_probe();
1502
+                eqnBVector[probePointCounter] = measured_z;
1427
 
1503
 
1428
-                SERIAL_PROTOCOLPGM("Bed x: ");
1429
-                SERIAL_PROTOCOL(xProbe);
1430
-                SERIAL_PROTOCOLPGM(" y: ");
1431
-                SERIAL_PROTOCOL(yProbe);
1432
-                SERIAL_PROTOCOLPGM(" z: ");
1433
-                SERIAL_PROTOCOL(current_position[Z_AXIS]);
1434
-                SERIAL_PROTOCOLPGM("\n");
1435
-
1436
-                eqnAMatrix[probePointCounter + 0*ACCURATE_BED_LEVELING_POINTS*ACCURATE_BED_LEVELING_POINTS] = xProbe;
1437
-                eqnAMatrix[probePointCounter + 1*ACCURATE_BED_LEVELING_POINTS*ACCURATE_BED_LEVELING_POINTS] = yProbe;
1438
-                eqnAMatrix[probePointCounter + 2*ACCURATE_BED_LEVELING_POINTS*ACCURATE_BED_LEVELING_POINTS] = 1;
1504
+                eqnAMatrix[probePointCounter + 0*AUTO_BED_LEVELING_GRID_POINTS*AUTO_BED_LEVELING_GRID_POINTS] = xProbe;
1505
+                eqnAMatrix[probePointCounter + 1*AUTO_BED_LEVELING_GRID_POINTS*AUTO_BED_LEVELING_GRID_POINTS] = yProbe;
1506
+                eqnAMatrix[probePointCounter + 2*AUTO_BED_LEVELING_GRID_POINTS*AUTO_BED_LEVELING_GRID_POINTS] = 1;
1439
                 probePointCounter++;
1507
                 probePointCounter++;
1440
                 xProbe += xInc;
1508
                 xProbe += xInc;
1441
               }
1509
               }
1443
             clean_up_after_endstop_move();
1511
             clean_up_after_endstop_move();
1444
 
1512
 
1445
             // solve lsq problem
1513
             // solve lsq problem
1446
-            double *plane_equation_coefficients = qr_solve(ACCURATE_BED_LEVELING_POINTS*ACCURATE_BED_LEVELING_POINTS, 3, eqnAMatrix, eqnBVector);
1514
+            double *plane_equation_coefficients = qr_solve(AUTO_BED_LEVELING_GRID_POINTS*AUTO_BED_LEVELING_GRID_POINTS, 3, eqnAMatrix, eqnBVector);
1447
 
1515
 
1448
             SERIAL_PROTOCOLPGM("Eqn coefficients: a: ");
1516
             SERIAL_PROTOCOLPGM("Eqn coefficients: a: ");
1449
             SERIAL_PROTOCOL(plane_equation_coefficients[0]);
1517
             SERIAL_PROTOCOL(plane_equation_coefficients[0]);
1457
 
1525
 
1458
             free(plane_equation_coefficients);
1526
             free(plane_equation_coefficients);
1459
 
1527
 
1460
-#else // ACCURATE_BED_LEVELING not defined
1461
-
1462
-
1463
-            // prob 1
1464
-            do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], Z_RAISE_BEFORE_PROBING);
1465
-            do_blocking_move_to(LEFT_PROBE_BED_POSITION - X_PROBE_OFFSET_FROM_EXTRUDER, BACK_PROBE_BED_POSITION - Y_PROBE_OFFSET_FROM_EXTRUDER, current_position[Z_AXIS]);
1528
+#else // AUTO_BED_LEVELING_GRID not defined
1466
 
1529
 
1467
-            engage_z_probe();   // Engage Z Servo endstop if available
1468
-            run_z_probe();
1469
-            float z_at_xLeft_yBack = current_position[Z_AXIS];
1470
-            retract_z_probe();
1471
-
1472
-            SERIAL_PROTOCOLPGM("Bed x: ");
1473
-            SERIAL_PROTOCOL(LEFT_PROBE_BED_POSITION);
1474
-            SERIAL_PROTOCOLPGM(" y: ");
1475
-            SERIAL_PROTOCOL(BACK_PROBE_BED_POSITION);
1476
-            SERIAL_PROTOCOLPGM(" z: ");
1477
-            SERIAL_PROTOCOL(current_position[Z_AXIS]);
1478
-            SERIAL_PROTOCOLPGM("\n");
1530
+            // Probe at 3 arbitrary points
1531
+            // probe 1
1532
+            float z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING);
1479
 
1533
 
1480
-            // prob 2
1481
-            do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS);
1482
-            do_blocking_move_to(LEFT_PROBE_BED_POSITION - X_PROBE_OFFSET_FROM_EXTRUDER, FRONT_PROBE_BED_POSITION - Y_PROBE_OFFSET_FROM_EXTRUDER, current_position[Z_AXIS]);
1534
+            // probe 2
1535
+            float z_at_pt_2 = probe_pt(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS);
1483
 
1536
 
1484
-            engage_z_probe();   // Engage Z Servo endstop if available
1485
-            run_z_probe();
1486
-            float z_at_xLeft_yFront = current_position[Z_AXIS];
1487
-            retract_z_probe();
1488
-
1489
-            SERIAL_PROTOCOLPGM("Bed x: ");
1490
-            SERIAL_PROTOCOL(LEFT_PROBE_BED_POSITION);
1491
-            SERIAL_PROTOCOLPGM(" y: ");
1492
-            SERIAL_PROTOCOL(FRONT_PROBE_BED_POSITION);
1493
-            SERIAL_PROTOCOLPGM(" z: ");
1494
-            SERIAL_PROTOCOL(current_position[Z_AXIS]);
1495
-            SERIAL_PROTOCOLPGM("\n");
1496
-
1497
-            // prob 3
1498
-            do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS);
1499
-            // the current position will be updated by the blocking move so the head will not lower on this next call.
1500
-            do_blocking_move_to(RIGHT_PROBE_BED_POSITION - X_PROBE_OFFSET_FROM_EXTRUDER, FRONT_PROBE_BED_POSITION - Y_PROBE_OFFSET_FROM_EXTRUDER, current_position[Z_AXIS]);
1501
-
1502
-            engage_z_probe();   // Engage Z Servo endstop if available
1503
-            run_z_probe();
1504
-            float z_at_xRight_yFront = current_position[Z_AXIS];
1505
-            retract_z_probe(); // Retract Z Servo endstop if available
1506
-
1507
-            SERIAL_PROTOCOLPGM("Bed x: ");
1508
-            SERIAL_PROTOCOL(RIGHT_PROBE_BED_POSITION);
1509
-            SERIAL_PROTOCOLPGM(" y: ");
1510
-            SERIAL_PROTOCOL(FRONT_PROBE_BED_POSITION);
1511
-            SERIAL_PROTOCOLPGM(" z: ");
1512
-            SERIAL_PROTOCOL(current_position[Z_AXIS]);
1513
-            SERIAL_PROTOCOLPGM("\n");
1537
+            // probe 3
1538
+            float z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS);
1514
 
1539
 
1515
             clean_up_after_endstop_move();
1540
             clean_up_after_endstop_move();
1516
 
1541
 
1517
-            set_bed_level_equation(z_at_xLeft_yFront, z_at_xRight_yFront, z_at_xLeft_yBack);
1542
+            set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3);
1518
 
1543
 
1519
 
1544
 
1520
-#endif // ACCURATE_BED_LEVELING
1545
+#endif // AUTO_BED_LEVELING_GRID
1521
             st_synchronize();
1546
             st_synchronize();
1522
 
1547
 
1523
             // The following code correct the Z height difference from z-probe position and hotend tip position.
1548
             // The following code correct the Z height difference from z-probe position and hotend tip position.
1545
             feedrate = homing_feedrate[Z_AXIS];
1570
             feedrate = homing_feedrate[Z_AXIS];
1546
 
1571
 
1547
             run_z_probe();
1572
             run_z_probe();
1548
-            SERIAL_PROTOCOLPGM("Bed Position X: ");
1573
+            SERIAL_PROTOCOLPGM(MSG_BED);
1574
+            SERIAL_PROTOCOLPGM(" X: ");
1549
             SERIAL_PROTOCOL(current_position[X_AXIS]);
1575
             SERIAL_PROTOCOL(current_position[X_AXIS]);
1550
             SERIAL_PROTOCOLPGM(" Y: ");
1576
             SERIAL_PROTOCOLPGM(" Y: ");
1551
             SERIAL_PROTOCOL(current_position[Y_AXIS]);
1577
             SERIAL_PROTOCOL(current_position[Y_AXIS]);
2085
       }
2111
       }
2086
       else
2112
       else
2087
       {
2113
       {
2088
-        bool all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2]))|| (code_seen(axis_codes[3])));
2114
+        bool all_axis = !((code_seen(axis_codes[X_AXIS])) || (code_seen(axis_codes[Y_AXIS])) || (code_seen(axis_codes[Z_AXIS]))|| (code_seen(axis_codes[E_AXIS])));
2089
         if(all_axis)
2115
         if(all_axis)
2090
         {
2116
         {
2091
           st_synchronize();
2117
           st_synchronize();
2147
     case 114: // M114
2173
     case 114: // M114
2148
       SERIAL_PROTOCOLPGM("X:");
2174
       SERIAL_PROTOCOLPGM("X:");
2149
       SERIAL_PROTOCOL(current_position[X_AXIS]);
2175
       SERIAL_PROTOCOL(current_position[X_AXIS]);
2150
-      SERIAL_PROTOCOLPGM("Y:");
2176
+      SERIAL_PROTOCOLPGM(" Y:");
2151
       SERIAL_PROTOCOL(current_position[Y_AXIS]);
2177
       SERIAL_PROTOCOL(current_position[Y_AXIS]);
2152
-      SERIAL_PROTOCOLPGM("Z:");
2178
+      SERIAL_PROTOCOLPGM(" Z:");
2153
       SERIAL_PROTOCOL(current_position[Z_AXIS]);
2179
       SERIAL_PROTOCOL(current_position[Z_AXIS]);
2154
-      SERIAL_PROTOCOLPGM("E:");
2180
+      SERIAL_PROTOCOLPGM(" E:");
2155
       SERIAL_PROTOCOL(current_position[E_AXIS]);
2181
       SERIAL_PROTOCOL(current_position[E_AXIS]);
2156
 
2182
 
2157
       SERIAL_PROTOCOLPGM(MSG_COUNT_X);
2183
       SERIAL_PROTOCOLPGM(MSG_COUNT_X);
2158
       SERIAL_PROTOCOL(float(st_get_position(X_AXIS))/axis_steps_per_unit[X_AXIS]);
2184
       SERIAL_PROTOCOL(float(st_get_position(X_AXIS))/axis_steps_per_unit[X_AXIS]);
2159
-      SERIAL_PROTOCOLPGM("Y:");
2185
+      SERIAL_PROTOCOLPGM(" Y:");
2160
       SERIAL_PROTOCOL(float(st_get_position(Y_AXIS))/axis_steps_per_unit[Y_AXIS]);
2186
       SERIAL_PROTOCOL(float(st_get_position(Y_AXIS))/axis_steps_per_unit[Y_AXIS]);
2161
-      SERIAL_PROTOCOLPGM("Z:");
2187
+      SERIAL_PROTOCOLPGM(" Z:");
2162
       SERIAL_PROTOCOL(float(st_get_position(Z_AXIS))/axis_steps_per_unit[Z_AXIS]);
2188
       SERIAL_PROTOCOL(float(st_get_position(Z_AXIS))/axis_steps_per_unit[Z_AXIS]);
2163
 
2189
 
2164
       SERIAL_PROTOCOLLN("");
2190
       SERIAL_PROTOCOLLN("");
2286
       }
2312
       }
2287
       break;
2313
       break;
2288
     #ifdef DELTA
2314
     #ifdef DELTA
2315
+	case 665: // M665 set delta configurations L<diagonal_rod> R<delta_radius> S<segments_per_sec>
2316
+		if(code_seen('L')) {
2317
+			delta_diagonal_rod= code_value();
2318
+		}
2319
+		if(code_seen('R')) {
2320
+			delta_radius= code_value();
2321
+		}
2322
+		if(code_seen('S')) {
2323
+			delta_segments_per_second= code_value();
2324
+		}
2325
+		
2326
+		recalc_delta_settings(delta_radius, delta_diagonal_rod);
2327
+		break;
2289
     case 666: // M666 set delta endstop adjustemnt
2328
     case 666: // M666 set delta endstop adjustemnt
2290
       for(int8_t i=0; i < 3; i++)
2329
       for(int8_t i=0; i < 3; i++)
2291
       {
2330
       {
2555
     #endif //PIDTEMP
2594
     #endif //PIDTEMP
2556
     case 240: // M240  Triggers a camera by emulating a Canon RC-1 : http://www.doc-diy.net/photo/rc-1_hacked/
2595
     case 240: // M240  Triggers a camera by emulating a Canon RC-1 : http://www.doc-diy.net/photo/rc-1_hacked/
2557
      {
2596
      {
2558
-      #if defined(PHOTOGRAPH_PIN) && PHOTOGRAPH_PIN > -1
2559
-        const uint8_t NUM_PULSES=16;
2560
-        const float PULSE_LENGTH=0.01524;
2561
-        for(int i=0; i < NUM_PULSES; i++) {
2562
-          WRITE(PHOTOGRAPH_PIN, HIGH);
2563
-          _delay_ms(PULSE_LENGTH);
2564
-          WRITE(PHOTOGRAPH_PIN, LOW);
2565
-          _delay_ms(PULSE_LENGTH);
2597
+     	#ifdef CHDK
2598
+       
2599
+         SET_OUTPUT(CHDK);
2600
+         WRITE(CHDK, HIGH);
2601
+         chdkHigh = millis();
2602
+         chdkActive = true;
2603
+       
2604
+       #else
2605
+     	
2606
+      	#if defined(PHOTOGRAPH_PIN) && PHOTOGRAPH_PIN > -1
2607
+	const uint8_t NUM_PULSES=16;
2608
+	const float PULSE_LENGTH=0.01524;
2609
+	for(int i=0; i < NUM_PULSES; i++) {
2610
+        WRITE(PHOTOGRAPH_PIN, HIGH);
2611
+        _delay_ms(PULSE_LENGTH);
2612
+        WRITE(PHOTOGRAPH_PIN, LOW);
2613
+        _delay_ms(PULSE_LENGTH);
2566
         }
2614
         }
2567
         delay(7.33);
2615
         delay(7.33);
2568
         for(int i=0; i < NUM_PULSES; i++) {
2616
         for(int i=0; i < NUM_PULSES; i++) {
2569
-          WRITE(PHOTOGRAPH_PIN, HIGH);
2570
-          _delay_ms(PULSE_LENGTH);
2571
-          WRITE(PHOTOGRAPH_PIN, LOW);
2572
-          _delay_ms(PULSE_LENGTH);
2617
+        WRITE(PHOTOGRAPH_PIN, HIGH);
2618
+        _delay_ms(PULSE_LENGTH);
2619
+        WRITE(PHOTOGRAPH_PIN, LOW);
2620
+        _delay_ms(PULSE_LENGTH);
2573
         }
2621
         }
2574
-      #endif
2622
+      	#endif
2623
+      #endif //chdk end if
2575
      }
2624
      }
2576
     break;
2625
     break;
2577
 #ifdef DOGLCD
2626
 #ifdef DOGLCD
3041
     next_feedrate = code_value();
3090
     next_feedrate = code_value();
3042
     if(next_feedrate > 0.0) feedrate = next_feedrate;
3091
     if(next_feedrate > 0.0) feedrate = next_feedrate;
3043
   }
3092
   }
3044
-  #ifdef FWRETRACT
3045
-  if(autoretract_enabled)
3046
-  if( !(seen[X_AXIS] || seen[Y_AXIS] || seen[Z_AXIS]) && seen[E_AXIS])
3047
-  {
3048
-    float echange=destination[E_AXIS]-current_position[E_AXIS];
3049
-    if(echange<-MIN_RETRACT) //retract
3050
-    {
3051
-      if(!retracted)
3052
-      {
3053
-
3054
-      destination[Z_AXIS]+=retract_zlift; //not sure why chaninging current_position negatively does not work.
3055
-      //if slicer retracted by echange=-1mm and you want to retract 3mm, corrrectede=-2mm additionally
3056
-      float correctede=-echange-retract_length;
3057
-      //to generate the additional steps, not the destination is changed, but inversely the current position
3058
-      current_position[E_AXIS]+=-correctede;
3059
-      feedrate=retract_feedrate;
3060
-      retracted=true;
3061
-      }
3062
-
3063
-    }
3064
-    else
3065
-      if(echange>MIN_RETRACT) //retract_recover
3066
-    {
3067
-      if(retracted)
3068
-      {
3069
-      //current_position[Z_AXIS]+=-retract_zlift;
3070
-      //if slicer retracted_recovered by echange=+1mm and you want to retract_recover 3mm, corrrectede=2mm additionally
3071
-      float correctede=-echange+1*retract_length+retract_recover_length; //total unretract=retract_length+retract_recover_length[surplus]
3072
-      current_position[E_AXIS]+=correctede; //to generate the additional steps, not the destination is changed, but inversely the current position
3073
-      feedrate=retract_recover_feedrate;
3074
-      retracted=false;
3075
-      }
3076
-    }
3077
-
3078
-  }
3079
-  #endif //FWRETRACT
3080
 }
3093
 }
3081
 
3094
 
3082
 void get_arc_coordinates()
3095
 void get_arc_coordinates()
3120
 }
3133
 }
3121
 
3134
 
3122
 #ifdef DELTA
3135
 #ifdef DELTA
3136
+void recalc_delta_settings(float radius, float diagonal_rod)
3137
+{
3138
+	 delta_tower1_x= -SIN_60*radius; // front left tower
3139
+	 delta_tower1_y= -COS_60*radius;	   
3140
+	 delta_tower2_x=  SIN_60*radius; // front right tower
3141
+	 delta_tower2_y= -COS_60*radius;	   
3142
+	 delta_tower3_x= 0.0;                  // back middle tower
3143
+	 delta_tower3_y= radius;
3144
+	 delta_diagonal_rod_2= sq(diagonal_rod);
3145
+}
3146
+
3123
 void calculate_delta(float cartesian[3])
3147
 void calculate_delta(float cartesian[3])
3124
 {
3148
 {
3125
-  delta[X_AXIS] = sqrt(DELTA_DIAGONAL_ROD_2
3126
-                       - sq(DELTA_TOWER1_X-cartesian[X_AXIS])
3127
-                       - sq(DELTA_TOWER1_Y-cartesian[Y_AXIS])
3149
+  delta[X_AXIS] = sqrt(delta_diagonal_rod_2
3150
+                       - sq(delta_tower1_x-cartesian[X_AXIS])
3151
+                       - sq(delta_tower1_y-cartesian[Y_AXIS])
3128
                        ) + cartesian[Z_AXIS];
3152
                        ) + cartesian[Z_AXIS];
3129
-  delta[Y_AXIS] = sqrt(DELTA_DIAGONAL_ROD_2
3130
-                       - sq(DELTA_TOWER2_X-cartesian[X_AXIS])
3131
-                       - sq(DELTA_TOWER2_Y-cartesian[Y_AXIS])
3153
+  delta[Y_AXIS] = sqrt(delta_diagonal_rod_2
3154
+                       - sq(delta_tower2_x-cartesian[X_AXIS])
3155
+                       - sq(delta_tower2_y-cartesian[Y_AXIS])
3132
                        ) + cartesian[Z_AXIS];
3156
                        ) + cartesian[Z_AXIS];
3133
-  delta[Z_AXIS] = sqrt(DELTA_DIAGONAL_ROD_2
3134
-                       - sq(DELTA_TOWER3_X-cartesian[X_AXIS])
3135
-                       - sq(DELTA_TOWER3_Y-cartesian[Y_AXIS])
3157
+  delta[Z_AXIS] = sqrt(delta_diagonal_rod_2
3158
+                       - sq(delta_tower3_x-cartesian[X_AXIS])
3159
+                       - sq(delta_tower3_y-cartesian[Y_AXIS])
3136
                        ) + cartesian[Z_AXIS];
3160
                        ) + cartesian[Z_AXIS];
3137
   /*
3161
   /*
3138
   SERIAL_ECHOPGM("cartesian x="); SERIAL_ECHO(cartesian[X_AXIS]);
3162
   SERIAL_ECHOPGM("cartesian x="); SERIAL_ECHO(cartesian[X_AXIS]);
3162
   if (cartesian_mm < 0.000001) { cartesian_mm = abs(difference[E_AXIS]); }
3186
   if (cartesian_mm < 0.000001) { cartesian_mm = abs(difference[E_AXIS]); }
3163
   if (cartesian_mm < 0.000001) { return; }
3187
   if (cartesian_mm < 0.000001) { return; }
3164
   float seconds = 6000 * cartesian_mm / feedrate / feedmultiply;
3188
   float seconds = 6000 * cartesian_mm / feedrate / feedmultiply;
3165
-  int steps = max(1, int(DELTA_SEGMENTS_PER_SECOND * seconds));
3189
+  int steps = max(1, int(delta_segments_per_second * seconds));
3166
   // SERIAL_ECHOPGM("mm="); SERIAL_ECHO(cartesian_mm);
3190
   // SERIAL_ECHOPGM("mm="); SERIAL_ECHO(cartesian_mm);
3167
   // SERIAL_ECHOPGM(" seconds="); SERIAL_ECHO(seconds);
3191
   // SERIAL_ECHOPGM(" seconds="); SERIAL_ECHO(seconds);
3168
   // SERIAL_ECHOPGM(" steps="); SERIAL_ECHOLN(steps);
3192
   // SERIAL_ECHOPGM(" steps="); SERIAL_ECHOLN(steps);
3345
       }
3369
       }
3346
     }
3370
     }
3347
   }
3371
   }
3372
+  
3373
+  #ifdef CHDK //Check if pin should be set to LOW after M240 set it to HIGH
3374
+    if (chdkActive)
3375
+    {
3376
+      chdkActive = false;
3377
+      if (millis()-chdkHigh < CHDK_DELAY) return;
3378
+      WRITE(CHDK, LOW);
3379
+    }
3380
+  #endif
3381
+  
3348
   #if defined(KILL_PIN) && KILL_PIN > -1
3382
   #if defined(KILL_PIN) && KILL_PIN > -1
3349
     if( 0 == READ(KILL_PIN) )
3383
     if( 0 == READ(KILL_PIN) )
3350
       kill();
3384
       kill();

BIN
Marlin/Menu Plans.xlsx View File


+ 6
- 6
Marlin/Servo.h View File

24
 
24
 
25
   Note that analogWrite of PWM on pins associated with the timer are disabled when the first servo is attached.
25
   Note that analogWrite of PWM on pins associated with the timer are disabled when the first servo is attached.
26
   Timers are seized as needed in groups of 12 servos - 24 servos use two timers, 48 servos will use four.
26
   Timers are seized as needed in groups of 12 servos - 24 servos use two timers, 48 servos will use four.
27
-  The sequence used to sieze timers is defined in timers.h
27
+  The sequence used to seize timers is defined in timers.h
28
 
28
 
29
   The methods are:
29
   The methods are:
30
 
30
 
50
 /*
50
 /*
51
  * Defines for 16 bit timers used with  Servo library
51
  * Defines for 16 bit timers used with  Servo library
52
  *
52
  *
53
- * If _useTimerX is defined then TimerX is a 16 bit timer on the curent board
53
+ * If _useTimerX is defined then TimerX is a 16 bit timer on the current board
54
  * timer16_Sequence_t enumerates the sequence that the timers should be allocated
54
  * timer16_Sequence_t enumerates the sequence that the timers should be allocated
55
  * _Nbr_16timers indicates how many 16 bit timers are available.
55
  * _Nbr_16timers indicates how many 16 bit timers are available.
56
  *
56
  *
89
 typedef enum { _Nbr_16timers } timer16_Sequence_t ;
89
 typedef enum { _Nbr_16timers } timer16_Sequence_t ;
90
 #endif
90
 #endif
91
 
91
 
92
-#define Servo_VERSION           2      // software version of this library
92
+#define Servo_VERSION           2     // software version of this library
93
 
93
 
94
 #define MIN_PULSE_WIDTH       544     // the shortest pulse sent to a servo
94
 #define MIN_PULSE_WIDTH       544     // the shortest pulse sent to a servo
95
 #define MAX_PULSE_WIDTH      2400     // the longest pulse sent to a servo
95
 #define MAX_PULSE_WIDTH      2400     // the longest pulse sent to a servo
96
 #define DEFAULT_PULSE_WIDTH  1500     // default pulse width when servo is attached
96
 #define DEFAULT_PULSE_WIDTH  1500     // default pulse width when servo is attached
97
-#define REFRESH_INTERVAL    20000     // minumim time to refresh servos in microseconds
97
+#define REFRESH_INTERVAL    20000     // minimum time to refresh servos in microseconds
98
 
98
 
99
 #define SERVOS_PER_TIMER       12     // the maximum number of servos controlled by one timer
99
 #define SERVOS_PER_TIMER       12     // the maximum number of servos controlled by one timer
100
 #define MAX_SERVOS   (_Nbr_16timers  * SERVOS_PER_TIMER)
100
 #define MAX_SERVOS   (_Nbr_16timers  * SERVOS_PER_TIMER)
118
   uint8_t attach(int pin);           // attach the given pin to the next free channel, sets pinMode, returns channel number or 0 if failure
118
   uint8_t attach(int pin);           // attach the given pin to the next free channel, sets pinMode, returns channel number or 0 if failure
119
   uint8_t attach(int pin, int min, int max); // as above but also sets min and max values for writes.
119
   uint8_t attach(int pin, int min, int max); // as above but also sets min and max values for writes.
120
   void detach();
120
   void detach();
121
-  void write(int value);             // if value is < 200 its treated as an angle, otherwise as pulse width in microseconds
121
+  void write(int value);             // if value is < 200 it is treated as an angle, otherwise as pulse width in microseconds
122
   void writeMicroseconds(int value); // Write pulse width in microseconds
122
   void writeMicroseconds(int value); // Write pulse width in microseconds
123
   int read();                        // returns current pulse width as an angle between 0 and 180 degrees
123
   int read();                        // returns current pulse width as an angle between 0 and 180 degrees
124
   int readMicroseconds();            // returns current pulse width in microseconds for this servo (was read_us() in first release)
124
   int readMicroseconds();            // returns current pulse width in microseconds for this servo (was read_us() in first release)
125
   bool attached();                   // return true if this servo is attached, otherwise false
125
   bool attached();                   // return true if this servo is attached, otherwise false
126
 #if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
126
 #if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
127
-  int pin;                           // store the hw pin of the servo
127
+  int pin;                           // store the hardware pin of the servo
128
 #endif
128
 #endif
129
 private:
129
 private:
130
    uint8_t servoIndex;               // index into the channel data for this servo
130
    uint8_t servoIndex;               // index into the channel data for this servo

+ 3
- 3
Marlin/cardreader.cpp View File

22
    file_subcall_ctr=0;
22
    file_subcall_ctr=0;
23
    memset(workDirParents, 0, sizeof(workDirParents));
23
    memset(workDirParents, 0, sizeof(workDirParents));
24
 
24
 
25
-   autostart_stilltocheck=true; //the sd start is delayed, because otherwise the serial cannot answer fast enought to make contact with the hostsoftware.
25
+   autostart_stilltocheck=true; //the SD start is delayed, because otherwise the serial cannot answer fast enough to make contact with the host software.
26
    lastnr=0;
26
    lastnr=0;
27
   //power to SD reader
27
   //power to SD reader
28
   #if SDPOWER > -1
28
   #if SDPOWER > -1
245
 {
245
 {
246
   if(!cardOK)
246
   if(!cardOK)
247
     return;
247
     return;
248
-  if(file.isOpen())  //replaceing current file by new file, or subfile call
248
+  if(file.isOpen())  //replacing current file by new file, or subfile call
249
   {
249
   {
250
     if(!replace_current)
250
     if(!replace_current)
251
     {
251
     {
544
   
544
   
545
   if(store_location)
545
   if(store_location)
546
   {
546
   {
547
-    //future: store printer state, filename and position for continueing a stoped print
547
+    //future: store printer state, filename and position for continuing a stopped print
548
     // so one can unplug the printer and continue printing the next day.
548
     // so one can unplug the printer and continue printing the next day.
549
     
549
     
550
   }
550
   }

+ 5
- 4
Marlin/createTemperatureLookupMarlin.py View File

16
 Options:
16
 Options:
17
   -h, --help        show this help
17
   -h, --help        show this help
18
   --rp=...          pull-up resistor
18
   --rp=...          pull-up resistor
19
-  --t0=ttt:rrr      low temperature temperature:resistance point (around 25C)
20
-  --t1=ttt:rrr      middle temperature temperature:resistance point (around 150C)
21
-  --t2=ttt:rrr      high temperature temperature:resistance point (around 250C)
19
+  --t1=ttt:rrr      low temperature temperature:resistance point (around 25C)
20
+  --t2=ttt:rrr      middle temperature temperature:resistance point (around 150C)
21
+  --t3=ttt:rrr      high temperature temperature:resistance point (around 250C)
22
   --num-temps=...   the number of temperature points to calculate (default: 20)
22
   --num-temps=...   the number of temperature points to calculate (default: 20)
23
 """
23
 """
24
 
24
 
98
     
98
     
99
     try:
99
     try:
100
         opts, args = getopt.getopt(argv, "h", ["help", "rp=", "t1=", "t2=", "t3=", "num-temps="])
100
         opts, args = getopt.getopt(argv, "h", ["help", "rp=", "t1=", "t2=", "t3=", "num-temps="])
101
-    except getopt.GetoptError:
101
+    except getopt.GetoptError as err:
102
+        print  str(err)
102
         usage()
103
         usage()
103
         sys.exit(2)
104
         sys.exit(2)
104
         
105
         

+ 1
- 12
Marlin/example_configurations/delta/Configuration.h View File

51
 // 65 = Azteeg X1
51
 // 65 = Azteeg X1
52
 // 66 = Melzi with ATmega1284 (MaKr3d version)
52
 // 66 = Melzi with ATmega1284 (MaKr3d version)
53
 // 67 = Azteeg X3
53
 // 67 = Azteeg X3
54
+// 68 = Azteeg X3 Pro
54
 // 7  = Ultimaker
55
 // 7  = Ultimaker
55
 // 71 = Ultimaker (Older electronics. Pre 1.5.4. This is rare)
56
 // 71 = Ultimaker (Older electronics. Pre 1.5.4. This is rare)
56
 // 77 = 3Drag Controller
57
 // 77 = 3Drag Controller
119
 // Effective horizontal distance bridged by diagonal push rods.
120
 // Effective horizontal distance bridged by diagonal push rods.
120
 #define DELTA_RADIUS (DELTA_SMOOTH_ROD_OFFSET-DELTA_EFFECTOR_OFFSET-DELTA_CARRIAGE_OFFSET)
121
 #define DELTA_RADIUS (DELTA_SMOOTH_ROD_OFFSET-DELTA_EFFECTOR_OFFSET-DELTA_CARRIAGE_OFFSET)
121
 
122
 
122
-#define DELTA_DIAGONAL_ROD_2 sq(DELTA_DIAGONAL_ROD)
123
-
124
-// Effective X/Y positions of the three vertical towers.
125
-#define SIN_60 0.8660254037844386
126
-#define COS_60 0.5
127
-#define DELTA_TOWER1_X -SIN_60*DELTA_RADIUS // front left tower
128
-#define DELTA_TOWER1_Y -COS_60*DELTA_RADIUS
129
-#define DELTA_TOWER2_X SIN_60*DELTA_RADIUS // front right tower
130
-#define DELTA_TOWER2_Y -COS_60*DELTA_RADIUS
131
-#define DELTA_TOWER3_X 0.0 // back middle tower
132
-#define DELTA_TOWER3_Y DELTA_RADIUS
133
-
134
 //===========================================================================
123
 //===========================================================================
135
 //=============================Thermal Settings  ============================
124
 //=============================Thermal Settings  ============================
136
 //===========================================================================
125
 //===========================================================================

+ 6
- 0
Marlin/example_configurations/delta/Configuration_adv.h View File

270
 // Motor Current setting (Only functional when motor driver current ref pins are connected to a digital trimpot on supported boards)
270
 // Motor Current setting (Only functional when motor driver current ref pins are connected to a digital trimpot on supported boards)
271
 #define DIGIPOT_MOTOR_CURRENT {135,135,135,135,135} // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A)
271
 #define DIGIPOT_MOTOR_CURRENT {135,135,135,135,135} // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A)
272
 
272
 
273
+// uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
274
+//#define DIGIPOT_I2C
275
+// Number of channels available for I2C digipot, For Azteeg X3 Pro we have 8
276
+#define DIGIPOT_I2C_NUM_CHANNELS 8
277
+// actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
278
+#define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}
273
 
279
 
274
 //===========================================================================
280
 //===========================================================================
275
 //=============================Additional Features===========================
281
 //=============================Additional Features===========================

+ 1
- 1
Marlin/fastio.h View File

1
 /*
1
 /*
2
-  This code contibuted by Triffid_Hunter and modified by Kliment
2
+  This code contributed by Triffid_Hunter and modified by Kliment
3
   why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html
3
   why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html
4
 */
4
 */
5
 
5
 

+ 488
- 289
Marlin/language.h
File diff suppressed because it is too large
View File


+ 7
- 6
Marlin/pins.h View File

1381
 #define SDSS               53
1381
 #define SDSS               53
1382
 #define LED_PIN            8
1382
 #define LED_PIN            8
1383
 #define FAN_PIN            7
1383
 #define FAN_PIN            7
1384
-#define PS_ON_PIN          12
1384
+#define PS_ON_PIN          -1
1385
 #define KILL_PIN           -1
1385
 #define KILL_PIN           -1
1386
 #define SUICIDE_PIN        -1  //PIN that has to be turned on right after start, to keep power flowing.
1386
 #define SUICIDE_PIN        -1  //PIN that has to be turned on right after start, to keep power flowing.
1387
 #define SAFETY_TRIGGERED_PIN     28 //PIN to detect the safety circuit has triggered
1387
 #define SAFETY_TRIGGERED_PIN     28 //PIN to detect the safety circuit has triggered
1781
 #define Z_DIR_PIN          28
1781
 #define Z_DIR_PIN          28
1782
 #define Z_STOP_PIN         30
1782
 #define Z_STOP_PIN         30
1783
 
1783
 
1784
-#define E_STEP_PIN         17
1785
-#define E_DIR_PIN          21
1784
+#define E0_STEP_PIN         17
1785
+#define E0_DIR_PIN          21
1786
 
1786
 
1787
 #define LED_PIN            -1
1787
 #define LED_PIN            -1
1788
 
1788
 
1793
 
1793
 
1794
 #define HEATER_0_PIN       12 // (extruder)
1794
 #define HEATER_0_PIN       12 // (extruder)
1795
 
1795
 
1796
-#define HEATER_1_PIN       16 // (bed)
1796
+#define HEATER_BED_PIN     16 // (bed)
1797
 #define X_ENABLE_PIN       19
1797
 #define X_ENABLE_PIN       19
1798
 #define Y_ENABLE_PIN       24
1798
 #define Y_ENABLE_PIN       24
1799
 #define Z_ENABLE_PIN       29
1799
 #define Z_ENABLE_PIN       29
1800
-#define E_ENABLE_PIN       13
1800
+#define E0_ENABLE_PIN      13
1801
 
1801
 
1802
 #define TEMP_0_PIN          0   // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!! (pin 33 extruder)
1802
 #define TEMP_0_PIN          0   // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!! (pin 33 extruder)
1803
-#define TEMP_1_PIN          5   // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!! (pin 34 bed)
1803
+#define TEMP_1_PIN         -1   
1804
 #define TEMP_2_PIN         -1
1804
 #define TEMP_2_PIN         -1
1805
+#define TEMP_BED_PIN        5   // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!! (pin 34 bed)  
1805
 #define SDPOWER            -1
1806
 #define SDPOWER            -1
1806
 #define SDSS               4
1807
 #define SDSS               4
1807
 #define HEATER_2_PIN       -1
1808
 #define HEATER_2_PIN       -1

+ 4
- 6
Marlin/qr_solve.cpp View File

1
 #include "qr_solve.h"
1
 #include "qr_solve.h"
2
 
2
 
3
-#ifdef ACCURATE_BED_LEVELING
3
+#ifdef AUTO_BED_LEVELING_GRID
4
 
4
 
5
 #include <stdlib.h>
5
 #include <stdlib.h>
6
 #include <math.h>
6
 #include <math.h>
7
-#include <time.h>
8
-
9
 
7
 
10
 //# include "r8lib.h"
8
 //# include "r8lib.h"
11
 
9
 
1173
 
1171
 
1174
   Discussion:
1172
   Discussion:
1175
 
1173
 
1176
-    DQRLSS must be preceeded by a call to DQRANK.
1174
+    DQRLSS must be preceded by a call to DQRANK.
1177
 
1175
 
1178
     The system is to be solved is
1176
     The system is to be solved is
1179
       A * X = B
1177
       A * X = B
1225
     linear system.
1223
     linear system.
1226
 
1224
 
1227
     Output, double RSD[M], the residual, B - A*X.  RSD may
1225
     Output, double RSD[M], the residual, B - A*X.  RSD may
1228
-    overwite B.
1226
+    overwrite B.
1229
 
1227
 
1230
     Input, int JPVT[N], the pivot information from DQRANK.
1228
     Input, int JPVT[N], the pivot information from DQRANK.
1231
     Columns JPVT[0], ..., JPVT[KR-1] of the original matrix are linearly
1229
     Columns JPVT[0], ..., JPVT[KR-1] of the original matrix are linearly
1314
     can be replaced by dummy variables in the calling program.
1312
     can be replaced by dummy variables in the calling program.
1315
     To save storage, the user may in some cases use the same
1313
     To save storage, the user may in some cases use the same
1316
     array for different parameters in the calling sequence.  A
1314
     array for different parameters in the calling sequence.  A
1317
-    frequently occuring example is when one wishes to compute
1315
+    frequently occurring example is when one wishes to compute
1318
     any of B, RSD, or AB and does not need Y or QTY.  In this
1316
     any of B, RSD, or AB and does not need Y or QTY.  In this
1319
     case one may identify Y, QTY, and one of B, RSD, or AB, while
1317
     case one may identify Y, QTY, and one of B, RSD, or AB, while
1320
     providing separate arrays for anything else that is to be
1318
     providing separate arrays for anything else that is to be

+ 1
- 1
Marlin/qr_solve.h View File

1
 #include "Configuration.h"
1
 #include "Configuration.h"
2
 
2
 
3
-#ifdef ACCURATE_BED_LEVELING
3
+#ifdef AUTO_BED_LEVELING_GRID
4
 
4
 
5
 void daxpy ( int n, double da, double dx[], int incx, double dy[], int incy );
5
 void daxpy ( int n, double da, double dx[], int incx, double dy[], int incy );
6
 double ddot ( int n, double dx[], int incx, double dy[], int incy );
6
 double ddot ( int n, double dx[], int incx, double dy[], int incy );

+ 2
- 2
Marlin/stepper.h View File

71
 void st_wake_up();
71
 void st_wake_up();
72
 
72
 
73
   
73
   
74
-void checkHitEndstops(); //call from somwhere to create an serial error message with the locations the endstops where hit, in case they were triggered
75
-void endstops_hit_on_purpose(); //avoid creation of the message, i.e. after homeing and before a routine call of checkHitEndstops();
74
+void checkHitEndstops(); //call from somewhere to create an serial error message with the locations the endstops where hit, in case they were triggered
75
+void endstops_hit_on_purpose(); //avoid creation of the message, i.e. after homing and before a routine call of checkHitEndstops();
76
 
76
 
77
 void enable_endstops(bool check); // Enable/disable endstop checking
77
 void enable_endstops(bool check); // Enable/disable endstop checking
78
 
78
 

+ 4
- 3
Marlin/temperature.cpp View File

250
               Kp = 0.6*Ku;
250
               Kp = 0.6*Ku;
251
               Ki = 2*Kp/Tu;
251
               Ki = 2*Kp/Tu;
252
               Kd = Kp*Tu/8;
252
               Kd = Kp*Tu/8;
253
-              SERIAL_PROTOCOLLNPGM(" Clasic PID ");
253
+              SERIAL_PROTOCOLLNPGM(" Classic PID ");
254
               SERIAL_PROTOCOLPGM(" Kp: "); SERIAL_PROTOCOLLN(Kp);
254
               SERIAL_PROTOCOLPGM(" Kp: "); SERIAL_PROTOCOLLN(Kp);
255
               SERIAL_PROTOCOLPGM(" Ki: "); SERIAL_PROTOCOLLN(Ki);
255
               SERIAL_PROTOCOLPGM(" Ki: "); SERIAL_PROTOCOLLN(Ki);
256
               SERIAL_PROTOCOLPGM(" Kd: "); SERIAL_PROTOCOLLN(Kd);
256
               SERIAL_PROTOCOLPGM(" Kd: "); SERIAL_PROTOCOLLN(Kd);
306
       return;
306
       return;
307
     }
307
     }
308
     if(cycles > ncycles) {
308
     if(cycles > ncycles) {
309
-      SERIAL_PROTOCOLLNPGM("PID Autotune finished! Put the Kp, Ki and Kd constants into Configuration.h");
309
+      SERIAL_PROTOCOLLNPGM("PID Autotune finished! Put the last Kp, Ki and Kd constants from above into Configuration.h");
310
       return;
310
       return;
311
     }
311
     }
312
     lcd_update();
312
     lcd_update();
449
           pid_output = constrain(target_temperature[e], 0, PID_MAX);
449
           pid_output = constrain(target_temperature[e], 0, PID_MAX);
450
     #endif //PID_OPENLOOP
450
     #endif //PID_OPENLOOP
451
     #ifdef PID_DEBUG
451
     #ifdef PID_DEBUG
452
-    SERIAL_ECHO_START(" PIDDEBUG ");
452
+    SERIAL_ECHO_START;
453
+    SERIAL_ECHO(" PID_DEBUG ");
453
     SERIAL_ECHO(e);
454
     SERIAL_ECHO(e);
454
     SERIAL_ECHO(": Input ");
455
     SERIAL_ECHO(": Input ");
455
     SERIAL_ECHO(pid_input);
456
     SERIAL_ECHO(pid_input);

+ 1
- 1
Marlin/temperature.h View File

28
 #endif
28
 #endif
29
 
29
 
30
 // public functions
30
 // public functions
31
-void tp_init();  //initialise the heating
31
+void tp_init();  //initialize the heating
32
 void manage_heater(); //it is critical that this is called periodically.
32
 void manage_heater(); //it is critical that this is called periodically.
33
 
33
 
34
 // low level conversion routines
34
 // low level conversion routines

+ 64
- 0
Marlin/thermistortables.h View File

857
 };
857
 };
858
 #endif
858
 #endif
859
 
859
 
860
+// Pt1000 and Pt100 handling
861
+// 
862
+// Rt=R0*(1+a*T+b*T*T) [for T>0]
863
+// a=3.9083E-3, b=-5.775E-7
864
+
865
+#define PtA 3.9083E-3
866
+#define PtB -5.775E-7
867
+#define PtRt(T,R0) ((R0)*(1.0+(PtA)*(T)+(PtB)*(T)*(T)))
868
+#define PtAdVal(T,R0,Rup) (short)(1024/(Rup/PtRt(T,R0)+1))
869
+#define PtLine(T,R0,Rup) { PtAdVal(T,R0,Rup)*OVERSAMPLENR, T },
870
+
871
+#if (THERMISTORHEATER_0 == 110) || (THERMISTORHEATER_1 == 110) || (THERMISTORHEATER_2 == 110) || (THERMISTORBED == 110) // Pt100 with 1k0 pullup
872
+const short temptable_110[][2] PROGMEM = {
873
+// only few values are needed as the curve is very flat  
874
+  PtLine(0,100,1000)
875
+  PtLine(50,100,1000)
876
+  PtLine(100,100,1000)
877
+  PtLine(150,100,1000)
878
+  PtLine(200,100,1000)
879
+  PtLine(250,100,1000)
880
+  PtLine(300,100,1000)
881
+};
882
+#endif
883
+#if (THERMISTORHEATER_0 == 147) || (THERMISTORHEATER_1 == 147) || (THERMISTORHEATER_2 == 147) || (THERMISTORBED == 147) // Pt100 with 4k7 pullup
884
+const short temptable_147[][2] PROGMEM = {
885
+// only few values are needed as the curve is very flat  
886
+  PtLine(0,100,4700)
887
+  PtLine(50,100,4700)
888
+  PtLine(100,100,4700)
889
+  PtLine(150,100,4700)
890
+  PtLine(200,100,4700)
891
+  PtLine(250,100,4700)
892
+  PtLine(300,100,4700)
893
+};
894
+#endif
895
+#if (THERMISTORHEATER_0 == 1010) || (THERMISTORHEATER_1 == 1010) || (THERMISTORHEATER_2 == 1010) || (THERMISTORBED == 1010) // Pt1000 with 1k0 pullup
896
+const short temptable_1010[][2] PROGMEM = {
897
+  PtLine(0,1000,1000)
898
+  PtLine(25,1000,1000)
899
+  PtLine(50,1000,1000)
900
+  PtLine(75,1000,1000)
901
+  PtLine(100,1000,1000)
902
+  PtLine(125,1000,1000)
903
+  PtLine(150,1000,1000)
904
+  PtLine(175,1000,1000)
905
+  PtLine(200,1000,1000)
906
+  PtLine(225,1000,1000)
907
+  PtLine(250,1000,1000)
908
+  PtLine(275,1000,1000)
909
+  PtLine(300,1000,1000)
910
+};
911
+#endif
912
+#if (THERMISTORHEATER_0 == 1047) || (THERMISTORHEATER_1 == 1047) || (THERMISTORHEATER_2 == 1047) || (THERMISTORBED == 1047) // Pt1000 with 4k7 pullup
913
+const short temptable_1047[][2] PROGMEM = {
914
+// only few values are needed as the curve is very flat  
915
+  PtLine(0,1000,4700)
916
+  PtLine(50,1000,4700)
917
+  PtLine(100,1000,4700)
918
+  PtLine(150,1000,4700)
919
+  PtLine(200,1000,4700)
920
+  PtLine(250,1000,4700)
921
+  PtLine(300,1000,4700)
922
+};
923
+#endif
860
 
924
 
861
 #define _TT_NAME(_N) temptable_ ## _N
925
 #define _TT_NAME(_N) temptable_ ## _N
862
 #define TT_NAME(_N) _TT_NAME(_N)
926
 #define TT_NAME(_N) _TT_NAME(_N)

+ 18
- 11
Marlin/ultralcd.cpp View File

38
 #include "ultralcd_implementation_hitachi_HD44780.h"
38
 #include "ultralcd_implementation_hitachi_HD44780.h"
39
 #endif
39
 #endif
40
 
40
 
41
-/** forward declerations **/
41
+/** forward declarations **/
42
 
42
 
43
 void copy_and_scalePID_i();
43
 void copy_and_scalePID_i();
44
 void copy_and_scalePID_d();
44
 void copy_and_scalePID_d();
62
 static void lcd_control_retract_menu();
62
 static void lcd_control_retract_menu();
63
 static void lcd_sdcard_menu();
63
 static void lcd_sdcard_menu();
64
 
64
 
65
-static void lcd_quick_feedback();//Cause an LCD refresh, and give the user visual or audiable feedback that something has happend
65
+static void lcd_quick_feedback();//Cause an LCD refresh, and give the user visual or audible feedback that something has happened
66
 
66
 
67
-/* Different types of actions that can be used in menuitems. */
67
+/* Different types of actions that can be used in menu items. */
68
 static void menu_action_back(menuFunc_t data);
68
 static void menu_action_back(menuFunc_t data);
69
 static void menu_action_submenu(menuFunc_t data);
69
 static void menu_action_submenu(menuFunc_t data);
70
 static void menu_action_gcode(const char* pgcode);
70
 static void menu_action_gcode(const char* pgcode);
145
 #ifndef REPRAPWORLD_KEYPAD
145
 #ifndef REPRAPWORLD_KEYPAD
146
 volatile uint8_t buttons;//Contains the bits of the currently pressed buttons.
146
 volatile uint8_t buttons;//Contains the bits of the currently pressed buttons.
147
 #else
147
 #else
148
-volatile uint8_t buttons_reprapworld_keypad; // to store the reprapworld_keypad shiftregister values
148
+volatile uint8_t buttons_reprapworld_keypad; // to store the reprapworld_keypad shift register values
149
 #endif
149
 #endif
150
 #ifdef LCD_HAS_SLOW_BUTTONS
150
 #ifdef LCD_HAS_SLOW_BUTTONS
151
 volatile uint8_t slow_buttons;//Contains the bits of the currently pressed buttons.
151
 volatile uint8_t slow_buttons;//Contains the bits of the currently pressed buttons.
162
 menuFunc_t currentMenu = lcd_status_screen; /* function pointer to the currently active menu */
162
 menuFunc_t currentMenu = lcd_status_screen; /* function pointer to the currently active menu */
163
 uint32_t lcd_next_update_millis;
163
 uint32_t lcd_next_update_millis;
164
 uint8_t lcd_status_update_delay;
164
 uint8_t lcd_status_update_delay;
165
-uint8_t lcdDrawUpdate = 2;                  /* Set to none-zero when the LCD needs to draw, decreased after every draw. Set to 2 in LCD routines so the LCD gets atleast 1 full redraw (first redraw is partial) */
165
+uint8_t lcdDrawUpdate = 2;                  /* Set to none-zero when the LCD needs to draw, decreased after every draw. Set to 2 in LCD routines so the LCD gets at least 1 full redraw (first redraw is partial) */
166
 
166
 
167
 //prevMenu and prevEncoderPosition are used to store the previous menu location when editing settings.
167
 //prevMenu and prevEncoderPosition are used to store the previous menu location when editing settings.
168
 menuFunc_t prevMenu = NULL;
168
 menuFunc_t prevMenu = NULL;
173
 int32_t minEditValue, maxEditValue;
173
 int32_t minEditValue, maxEditValue;
174
 menuFunc_t callbackFunc;
174
 menuFunc_t callbackFunc;
175
 
175
 
176
-// placeholders for Ki and Kd edits
176
+// place-holders for Ki and Kd edits
177
 float raw_Ki, raw_Kd;
177
 float raw_Ki, raw_Kd;
178
 
178
 
179
-/* Main status screen. It's up to the implementation specific part to show what is needed. As this is very display dependend */
179
+/* Main status screen. It's up to the implementation specific part to show what is needed. As this is very display dependent */
180
 static void lcd_status_screen()
180
 static void lcd_status_screen()
181
 {
181
 {
182
     if (lcd_status_update_delay)
182
     if (lcd_status_update_delay)
196
         lcd_quick_feedback();
196
         lcd_quick_feedback();
197
     }
197
     }
198
 
198
 
199
+#ifdef ULTIPANEL_FEEDMULTIPLY
199
     // Dead zone at 100% feedrate
200
     // Dead zone at 100% feedrate
200
     if ((feedmultiply < 100 && (feedmultiply + int(encoderPosition)) > 100) ||
201
     if ((feedmultiply < 100 && (feedmultiply + int(encoderPosition)) > 100) ||
201
             (feedmultiply > 100 && (feedmultiply + int(encoderPosition)) < 100))
202
             (feedmultiply > 100 && (feedmultiply + int(encoderPosition)) < 100))
219
         feedmultiply += int(encoderPosition);
220
         feedmultiply += int(encoderPosition);
220
         encoderPosition = 0;
221
         encoderPosition = 0;
221
     }
222
     }
223
+#endif//ULTIPANEL_FEEDMULTIPLY
222
 
224
 
223
     if (feedmultiply < 10)
225
     if (feedmultiply < 10)
224
         feedmultiply = 10;
226
         feedmultiply = 10;
460
 {
462
 {
461
     if (encoderPosition != 0)
463
     if (encoderPosition != 0)
462
     {
464
     {
465
+        refresh_cmd_timeout();
463
         current_position[X_AXIS] += float((int)encoderPosition) * move_menu_scale;
466
         current_position[X_AXIS] += float((int)encoderPosition) * move_menu_scale;
464
         if (min_software_endstops && current_position[X_AXIS] < X_MIN_POS)
467
         if (min_software_endstops && current_position[X_AXIS] < X_MIN_POS)
465
             current_position[X_AXIS] = X_MIN_POS;
468
             current_position[X_AXIS] = X_MIN_POS;
489
 {
492
 {
490
     if (encoderPosition != 0)
493
     if (encoderPosition != 0)
491
     {
494
     {
495
+        refresh_cmd_timeout();
492
         current_position[Y_AXIS] += float((int)encoderPosition) * move_menu_scale;
496
         current_position[Y_AXIS] += float((int)encoderPosition) * move_menu_scale;
493
         if (min_software_endstops && current_position[Y_AXIS] < Y_MIN_POS)
497
         if (min_software_endstops && current_position[Y_AXIS] < Y_MIN_POS)
494
             current_position[Y_AXIS] = Y_MIN_POS;
498
             current_position[Y_AXIS] = Y_MIN_POS;
518
 {
522
 {
519
     if (encoderPosition != 0)
523
     if (encoderPosition != 0)
520
     {
524
     {
525
+        refresh_cmd_timeout();
521
         current_position[Z_AXIS] += float((int)encoderPosition) * move_menu_scale;
526
         current_position[Z_AXIS] += float((int)encoderPosition) * move_menu_scale;
522
         if (min_software_endstops && current_position[Z_AXIS] < Z_MIN_POS)
527
         if (min_software_endstops && current_position[Z_AXIS] < Z_MIN_POS)
523
             current_position[Z_AXIS] = Z_MIN_POS;
528
             current_position[Z_AXIS] = Z_MIN_POS;
706
 {
711
 {
707
     START_MENU();
712
     START_MENU();
708
     MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
713
     MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
714
+#ifdef ENABLE_AUTO_BED_LEVELING
709
     MENU_ITEM_EDIT(float32, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, 0.5, 50);
715
     MENU_ITEM_EDIT(float32, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, 0.5, 50);
716
+#endif
710
     MENU_ITEM_EDIT(float5, MSG_ACC, &acceleration, 500, 99000);
717
     MENU_ITEM_EDIT(float5, MSG_ACC, &acceleration, 500, 99000);
711
     MENU_ITEM_EDIT(float3, MSG_VXY_JERK, &max_xy_jerk, 1, 990);
718
     MENU_ITEM_EDIT(float3, MSG_VXY_JERK, &max_xy_jerk, 1, 990);
712
     MENU_ITEM_EDIT(float52, MSG_VZ_JERK, &max_z_jerk, 0.1, 990);
719
     MENU_ITEM_EDIT(float52, MSG_VZ_JERK, &max_z_jerk, 0.1, 990);
1003
     WRITE(SHIFT_LD,HIGH);
1010
     WRITE(SHIFT_LD,HIGH);
1004
   #endif
1011
   #endif
1005
 #else  // Not NEWPANEL
1012
 #else  // Not NEWPANEL
1006
-  #ifdef SR_LCD_2W_NL // Non latching 2 wire shiftregister
1013
+  #ifdef SR_LCD_2W_NL // Non latching 2 wire shift register
1007
      pinMode (SR_DATA_PIN, OUTPUT);
1014
      pinMode (SR_DATA_PIN, OUTPUT);
1008
      pinMode (SR_CLK_PIN, OUTPUT);
1015
      pinMode (SR_CLK_PIN, OUTPUT);
1009
   #elif defined(SHIFT_CLK) 
1016
   #elif defined(SHIFT_CLK) 
1050
     {
1057
     {
1051
         lcdDrawUpdate = 2;
1058
         lcdDrawUpdate = 2;
1052
         lcd_oldcardstatus = IS_SD_INSERTED;
1059
         lcd_oldcardstatus = IS_SD_INSERTED;
1053
-        lcd_implementation_init(); // to maybe revive the lcd if static electricty killed it.
1060
+        lcd_implementation_init(); // to maybe revive the LCD if static electricity killed it.
1054
 
1061
 
1055
         if(lcd_oldcardstatus)
1062
         if(lcd_oldcardstatus)
1056
         {
1063
         {
1465
 }
1472
 }
1466
 
1473
 
1467
 // Callback for after editing PID i value
1474
 // Callback for after editing PID i value
1468
-// grab the pid i value out of the temp variable; scale it; then update the PID driver
1475
+// grab the PID i value out of the temp variable; scale it; then update the PID driver
1469
 void copy_and_scalePID_i()
1476
 void copy_and_scalePID_i()
1470
 {
1477
 {
1471
 #ifdef PIDTEMP
1478
 #ifdef PIDTEMP
1475
 }
1482
 }
1476
 
1483
 
1477
 // Callback for after editing PID d value
1484
 // Callback for after editing PID d value
1478
-// grab the pid d value out of the temp variable; scale it; then update the PID driver
1485
+// grab the PID d value out of the temp variable; scale it; then update the PID driver
1479
 void copy_and_scalePID_d()
1486
 void copy_and_scalePID_d()
1480
 {
1487
 {
1481
 #ifdef PIDTEMP
1488
 #ifdef PIDTEMP

+ 4
- 4
Marlin/ultralcd.h View File

17
   void lcd_setcontrast(uint8_t value);
17
   void lcd_setcontrast(uint8_t value);
18
 #endif
18
 #endif
19
 
19
 
20
-  static unsigned char blink = 0;	// Variable for visualisation of fan rotation in GLCD
20
+  static unsigned char blink = 0;	// Variable for visualization of fan rotation in GLCD
21
 
21
 
22
   #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
22
   #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
23
   #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
23
   #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
29
   void lcd_buttons_update();
29
   void lcd_buttons_update();
30
   extern volatile uint8_t buttons;  //the last checked buttons in a bit array.
30
   extern volatile uint8_t buttons;  //the last checked buttons in a bit array.
31
   #ifdef REPRAPWORLD_KEYPAD
31
   #ifdef REPRAPWORLD_KEYPAD
32
-    extern volatile uint8_t buttons_reprapworld_keypad; // to store the keypad shiftregister values
32
+    extern volatile uint8_t buttons_reprapworld_keypad; // to store the keypad shift register values
33
   #endif
33
   #endif
34
   #else
34
   #else
35
   FORCE_INLINE void lcd_buttons_update() {}
35
   FORCE_INLINE void lcd_buttons_update() {}
72
   	  #define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_MIDDLE)
72
   	  #define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_MIDDLE)
73
     #endif //REPRAPWORLD_KEYPAD
73
     #endif //REPRAPWORLD_KEYPAD
74
   #else
74
   #else
75
-    //atomatic, do not change
75
+    //atomic, do not change
76
     #define B_LE (1<<BL_LE)
76
     #define B_LE (1<<BL_LE)
77
     #define B_UP (1<<BL_UP)
77
     #define B_UP (1<<BL_UP)
78
     #define B_MI (1<<BL_MI)
78
     #define B_MI (1<<BL_MI)
85
     #define LCD_CLICKED ((buttons&B_MI)||(buttons&B_ST))
85
     #define LCD_CLICKED ((buttons&B_MI)||(buttons&B_ST))
86
   #endif//NEWPANEL
86
   #endif//NEWPANEL
87
 
87
 
88
-#else //no lcd
88
+#else //no LCD
89
   FORCE_INLINE void lcd_update() {}
89
   FORCE_INLINE void lcd_update() {}
90
   FORCE_INLINE void lcd_init() {}
90
   FORCE_INLINE void lcd_init() {}
91
   FORCE_INLINE void lcd_setstatus(const char* message) {}
91
   FORCE_INLINE void lcd_setstatus(const char* message) {}

+ 13
- 3
Marlin/ultralcd_implementation_hitachi_HD44780.h View File

2
 #define ULTRA_LCD_IMPLEMENTATION_HITACHI_HD44780_H
2
 #define ULTRA_LCD_IMPLEMENTATION_HITACHI_HD44780_H
3
 
3
 
4
 /**
4
 /**
5
-* Implementation of the LCD display routines for a hitachi HD44780 display. These are common LCD character displays.
6
-* When selecting the rusian language, a slightly different LCD implementation is used to handle UTF8 characters.
5
+* Implementation of the LCD display routines for a Hitachi HD44780 display. These are common LCD character displays.
6
+* When selecting the Russian language, a slightly different LCD implementation is used to handle UTF8 characters.
7
 **/
7
 **/
8
 
8
 
9
 #ifndef REPRAPWORLD_KEYPAD
9
 #ifndef REPRAPWORLD_KEYPAD
20
 // via a shift/i2c register.
20
 // via a shift/i2c register.
21
 
21
 
22
 #ifdef ULTIPANEL
22
 #ifdef ULTIPANEL
23
-// All Ultipanels might have an encoder - so this is always be mapped onto first two bits
23
+// All UltiPanels might have an encoder - so this is always be mapped onto first two bits
24
 #define BLEN_B 1
24
 #define BLEN_B 1
25
 #define BLEN_A 0
25
 #define BLEN_A 0
26
 
26
 
718
 	#endif
718
 	#endif
719
 #elif defined(BEEPER) && BEEPER > -1
719
 #elif defined(BEEPER) && BEEPER > -1
720
     SET_OUTPUT(BEEPER);
720
     SET_OUTPUT(BEEPER);
721
+	#if !defined(LCD_FEEDBACK_FREQUENCY_HZ) || !defined(LCD_FEEDBACK_FREQUENCY_DURATION_MS)
721
     for(int8_t i=0;i<10;i++)
722
     for(int8_t i=0;i<10;i++)
722
     {
723
     {
723
       WRITE(BEEPER,HIGH);
724
       WRITE(BEEPER,HIGH);
725
       WRITE(BEEPER,LOW);
726
       WRITE(BEEPER,LOW);
726
       delayMicroseconds(100);
727
       delayMicroseconds(100);
727
     }
728
     }
729
+    #else
730
+    for(int8_t i=0;i<(LCD_FEEDBACK_FREQUENCY_DURATION_MS / (1000 / LCD_FEEDBACK_FREQUENCY_HZ));i++)
731
+    {
732
+      WRITE(BEEPER,HIGH);
733
+      delayMicroseconds(1000000 / LCD_FEEDBACK_FREQUENCY_HZ / 2);
734
+      WRITE(BEEPER,LOW);
735
+      delayMicroseconds(1000000 / LCD_FEEDBACK_FREQUENCY_HZ / 2);
736
+    }
737
+    #endif
728
 #endif
738
 #endif
729
 }
739
 }
730
 
740
 

+ 4
- 4
Marlin/ultralcd_st7920_u8glib_rrd.h View File

12
 #define ST7920_DAT_PIN  LCD_PINS_ENABLE
12
 #define ST7920_DAT_PIN  LCD_PINS_ENABLE
13
 #define ST7920_CS_PIN   LCD_PINS_RS
13
 #define ST7920_CS_PIN   LCD_PINS_RS
14
 
14
 
15
-//#define PAGE_HEIGHT 8   //128 byte frambuffer
16
-//#define PAGE_HEIGHT 16  //256 byte frambuffer
15
+//#define PAGE_HEIGHT 8   //128 byte framebuffer
16
+//#define PAGE_HEIGHT 16  //256 byte framebuffer
17
 #define PAGE_HEIGHT 32  //512 byte framebuffer
17
 #define PAGE_HEIGHT 32  //512 byte framebuffer
18
 
18
 
19
 #define WIDTH 128
19
 #define WIDTH 128
59
         ST7920_SET_CMD();
59
         ST7920_SET_CMD();
60
         ST7920_WRITE_BYTE(0x08);       //display off, cursor+blink off
60
         ST7920_WRITE_BYTE(0x08);       //display off, cursor+blink off
61
         ST7920_WRITE_BYTE(0x01);       //clear CGRAM ram
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
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
64
         for(y=0;y<HEIGHT/2;y++)        //clear GDRAM
65
         {
65
         {
66
           ST7920_WRITE_BYTE(0x80|y);   //set y
66
           ST7920_WRITE_BYTE(0x80|y);   //set y

+ 3
- 13
Marlin/vector_3.cpp View File

22
 #ifdef ENABLE_AUTO_BED_LEVELING
22
 #ifdef ENABLE_AUTO_BED_LEVELING
23
 #include "vector_3.h"
23
 #include "vector_3.h"
24
 
24
 
25
-vector_3::vector_3()
26
-{
27
-  this->x = 0;
28
-  this->y = 0;
29
-  this->z = 0;
30
-}
25
+vector_3::vector_3() : x(0), y(0), z(0) { }
31
 
26
 
32
-vector_3::vector_3(float x, float y, float z)
33
-{
34
-	this->x = x;
35
-	this->y = y;
36
-	this->z = z;
37
-}
27
+vector_3::vector_3(float x_, float y_, float z_) : x(x_), y(y_), z(z_) { }
38
 
28
 
39
 vector_3 vector_3::cross(vector_3 left, vector_3 right)
29
 vector_3 vector_3::cross(vector_3 left, vector_3 right)
40
 {
30
 {
62
 
52
 
63
 float vector_3::get_length() 
53
 float vector_3::get_length() 
64
 {
54
 {
65
-        float length = sqrt((x * x) + (y * y) + (z * z));
55
+	float length = sqrt((x * x) + (y * y) + (z * z));
66
 	return length;
56
 	return length;
67
 }
57
 }
68
  
58
  

+ 2
- 2
Marlin/watchdog.h View File

4
 #include "Marlin.h"
4
 #include "Marlin.h"
5
 
5
 
6
 #ifdef USE_WATCHDOG
6
 #ifdef USE_WATCHDOG
7
-  // intialise watch dog with a 1 sec interrupt time
7
+  // initialize watch dog with a 1 sec interrupt time
8
   void watchdog_init();
8
   void watchdog_init();
9
-  // pad the dog/reset watchdog. MUST be called at least every second after the first watchdog_init or avr will go into emergency procedures..
9
+  // pad the dog/reset watchdog. MUST be called at least every second after the first watchdog_init or AVR will go into emergency procedures..
10
   void watchdog_reset();
10
   void watchdog_reset();
11
 #else
11
 #else
12
   //If we do not have a watchdog, then we can have empty functions which are optimized away.
12
   //If we do not have a watchdog, then we can have empty functions which are optimized away.

+ 1
- 1
README.md View File

85
 If your gcode contains a wide spread of extruder velocities, or you realtime change the building speed, the temperature should be changed accordingly.
85
 If your gcode contains a wide spread of extruder velocities, or you realtime change the building speed, the temperature should be changed accordingly.
86
 Usually, higher speed requires higher temperature.
86
 Usually, higher speed requires higher temperature.
87
 This can now be performed by the AutoTemp function
87
 This can now be performed by the AutoTemp function
88
-By calling M109 S<mintemp> T<maxtemp> F<factor> you enter the autotemp mode.
88
+By calling M109 S<mintemp> B<maxtemp> F<factor> you enter the autotemp mode.
89
 
89
 
90
 You can leave it by calling M109 without any F.
90
 You can leave it by calling M109 without any F.
91
 If active, the maximal extruder stepper rate of all buffered moves will be calculated, and named "maxerate" [steps/sec].
91
 If active, the maximal extruder stepper rate of all buffered moves will be calculated, and named "maxerate" [steps/sec].

Loading…
Cancel
Save