Browse Source

Merge branch 'Marlin_v1' of https://github.com/ErikZalm/Marlin into ErikZalm

Conflicts:
	Marlin/Configuration.h
	Marlin/Marlin_main.cpp
fsantini 11 years ago
parent
commit
6ae7f7870d

+ 22
- 0
ArduinoAddons/Arduino_1.x.x/Sanguino/boards.txt View File

61
 atmega1284.build.core=arduino
61
 atmega1284.build.core=arduino
62
 atmega1284.build.variant=standard
62
 atmega1284.build.variant=standard
63
 #
63
 #
64
+
65
+##############################################################
66
+
67
+atmega1284.name=Sanguino W/ ATmega1284p 16mhz ceramic resonator
68
+
69
+atmega1284.upload.protocol=stk500
70
+atmega1284.upload.maximum_size=131072
71
+atmega1284.upload.speed=57600
72
+
73
+atmega1284.bootloader.low_fuses=0xD6
74
+atmega1284.bootloader.high_fuses=0xDC
75
+atmega1284.bootloader.extended_fuses=0xFD
76
+atmega1284.bootloader.path=atmega
77
+atmega1284.bootloader.file=ATmegaBOOT_168_atmega1284p.hex
78
+atmega1284.bootloader.unlock_bits=0x3F
79
+atmega1284.bootloader.lock_bits=0x0F
80
+
81
+atmega1284.build.mcu=atmega1284p
82
+atmega1284.build.f_cpu=16000000L
83
+atmega1284.build.core=arduino
84
+atmega1284.build.variant=standard
85
+#

+ 15
- 13
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 rplace the configuration files wilth the files in the
12
 // example_configurations/delta directory.
12
 // example_configurations/delta directory.
13
-// 
13
+//
14
 
14
 
15
 // User-specified version info of this build to display in [Pronterface, etc] terminal window during
15
 // User-specified version info of this build to display in [Pronterface, etc] terminal window during
16
 // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
16
 // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
36
 // 11 = Gen7 v1.1, v1.2 = 11
36
 // 11 = Gen7 v1.1, v1.2 = 11
37
 // 12 = Gen7 v1.3
37
 // 12 = Gen7 v1.3
38
 // 13 = Gen7 v1.4
38
 // 13 = Gen7 v1.4
39
-// 20 = Sethi 3D_1 
39
+// 2  = Cheaptronic v1.0
40
+// 20 = Sethi 3D_1
40
 // 3  = MEGA/RAMPS up to 1.2 = 3
41
 // 3  = MEGA/RAMPS up to 1.2 = 3
41
 // 33 = RAMPS 1.3 / 1.4 (Power outputs: Extruder, Fan, Bed)
42
 // 33 = RAMPS 1.3 / 1.4 (Power outputs: Extruder, Fan, Bed)
42
 // 34 = RAMPS 1.3 / 1.4 (Power outputs: Extruder0, Extruder1, Bed)
43
 // 34 = RAMPS 1.3 / 1.4 (Power outputs: Extruder0, Extruder1, Bed)
335
 
336
 
336
   #define Z_RAISE_BEFORE_HOMING 4       // (in mm) Raise Z before homing (G28) for Probe Clearance.
337
   #define Z_RAISE_BEFORE_HOMING 4       // (in mm) Raise Z before homing (G28) for Probe Clearance.
337
                                         // Be sure you have this distance over your Z_MAX_POS in case
338
                                         // Be sure you have this distance over your Z_MAX_POS in case
338
-    
339
+
339
   #define XY_TRAVEL_SPEED 8000         // X and Y axis travel speed between probes, in mm/min
340
   #define XY_TRAVEL_SPEED 8000         // X and Y axis travel speed between probes, in mm/min
340
-  
341
+
341
   #define Z_RAISE_BEFORE_PROBING 15    //How much the extruder will be raised before traveling to the first probing point.
342
   #define Z_RAISE_BEFORE_PROBING 15    //How much the extruder will be raised before traveling to the first probing point.
342
   #define Z_RAISE_BETWEEN_PROBINGS 5  //How much the extruder will be raised when traveling from between next probing points
343
   #define Z_RAISE_BETWEEN_PROBINGS 5  //How much the extruder will be raised when traveling from between next probing points
343
 
344
 
346
   //The value is the delay to turn the servo off after powered on - depends on the servo speed; 300ms is good value, but you can try lower it.
347
   //The value is the delay to turn the servo off after powered on - depends on the servo speed; 300ms is good value, but you can try lower it.
347
   // You MUST HAVE the SERVO_ENDSTOPS defined to use here a value higher than zero otherwise your code will not compile.
348
   // You MUST HAVE the SERVO_ENDSTOPS defined to use here a value higher than zero otherwise your code will not compile.
348
 
349
 
349
-//  #define PROBE_SERVO_DEACTIVATION_DELAY 300  
350
+//  #define PROBE_SERVO_DEACTIVATION_DELAY 300
350
 
351
 
351
 
352
 
352
-//If you have enabled the Bed Auto Levelling and are using the same Z Probe for Z Homing, 
353
+//If you have enabled the Bed Auto Levelling and are using the same Z Probe for Z Homing,
353
 //it is highly recommended you let this Z_SAFE_HOMING enabled!!!
354
 //it is highly recommended you let this Z_SAFE_HOMING enabled!!!
354
 
355
 
355
-  #define Z_SAFE_HOMING   // This feature is meant to avoid Z homing with probe outside the bed area. 
356
+  #define Z_SAFE_HOMING   // This feature is meant to avoid Z homing with probe outside the bed area.
356
                           // When defined, it will:
357
                           // When defined, it will:
357
                           // - Allow Z homing only after X and Y homing AND stepper drivers still enabled
358
                           // - Allow Z homing only after X and Y homing AND stepper drivers still enabled
358
                           // - If stepper drivers timeout, it will need X and Y homing again before Z homing
359
                           // - If stepper drivers timeout, it will need X and Y homing again before Z homing
359
                           // - Position the probe in a defined XY point before Z Homing when homing all axis (G28)
360
                           // - Position the probe in a defined XY point before Z Homing when homing all axis (G28)
360
                           // - Block Z homing only when the probe is outside bed area.
361
                           // - Block Z homing only when the probe is outside bed area.
361
-  
362
+
362
   #ifdef Z_SAFE_HOMING
363
   #ifdef Z_SAFE_HOMING
363
-    
364
+
364
     #define Z_SAFE_HOMING_X_POINT (X_MAX_LENGTH/2)    // X point for Z homing when homing all axis (G28)
365
     #define Z_SAFE_HOMING_X_POINT (X_MAX_LENGTH/2)    // X point for Z homing when homing all axis (G28)
365
     #define Z_SAFE_HOMING_Y_POINT (Y_MAX_LENGTH/2)    // Y point for Z homing when homing all axis (G28)
366
     #define Z_SAFE_HOMING_Y_POINT (Y_MAX_LENGTH/2)    // Y point for Z homing when homing all axis (G28)
366
-    
367
+
367
   #endif
368
   #endif
368
-  
369
+
369
   // with accurate bed leveling, the bed is sampled in a ACCURATE_BED_LEVELING_POINTSxACCURATE_BED_LEVELING_POINTS grid and least squares solution is calculated
370
   // with accurate bed leveling, the bed is sampled in a ACCURATE_BED_LEVELING_POINTSxACCURATE_BED_LEVELING_POINTS grid and least squares solution is calculated
370
   // Note: this feature occupies 10'206 byte
371
   // Note: this feature occupies 10'206 byte
371
   #define ACCURATE_BED_LEVELING
372
   #define ACCURATE_BED_LEVELING
443
 //#define SDSUPPORT // Enable SD Card Support in Hardware Console
444
 //#define SDSUPPORT // Enable SD Card Support in Hardware Console
444
 //#define SDSLOW // Use slower SD transfer mode (not normally needed - uncomment if you're getting volume init error)
445
 //#define SDSLOW // Use slower SD transfer mode (not normally needed - uncomment if you're getting volume init error)
445
 //#define ENCODER_PULSES_PER_STEP 1 // Increase if you have a high resolution encoder
446
 //#define ENCODER_PULSES_PER_STEP 1 // Increase if you have a high resolution encoder
447
+//#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
446
 //#define ULTIMAKERCONTROLLER //as available from the ultimaker online store.
448
 //#define ULTIMAKERCONTROLLER //as available from the ultimaker online store.
447
 //#define ULTIPANEL  //the ultipanel as on thingiverse
449
 //#define ULTIPANEL  //the ultipanel as on thingiverse
448
 
450
 
549
 // Shift register panels
551
 // Shift register panels
550
 // ---------------------
552
 // ---------------------
551
 // 2 wire Non-latching LCD SR from:
553
 // 2 wire Non-latching LCD SR from:
552
-// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection 
554
+// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
553
 //#define SR_LCD
555
 //#define SR_LCD
554
 #ifdef SR_LCD
556
 #ifdef SR_LCD
555
    #define SR_LCD_2W_NL    // Non latching 2 wire shiftregister
557
    #define SR_LCD_2W_NL    // Non latching 2 wire shiftregister

+ 1
- 1
Marlin/Configuration_adv.h View File

161
   #define EXTRUDERS 1
161
   #define EXTRUDERS 1
162
 #endif
162
 #endif
163
 
163
 
164
-#ifdef Z_DUAL_STEPPER_DRIVERS && Y_DUAL_STEPPER_DRIVERS
164
+#if defined (Z_DUAL_STEPPER_DRIVERS) && defined (Y_DUAL_STEPPER_DRIVERS)
165
   #error "You cannot have dual drivers for both Y and Z"
165
   #error "You cannot have dual drivers for both Y and Z"
166
 #endif
166
 #endif
167
 
167
 

+ 95
- 91
Marlin/Marlin_main.cpp View File

50
 
50
 
51
 #ifdef BLINKM
51
 #ifdef BLINKM
52
 #include "BlinkM.h"
52
 #include "BlinkM.h"
53
-#include "Wire.h" 
53
+#include "Wire.h"
54
 #endif
54
 #endif
55
 
55
 
56
 #if NUM_SERVOS > 0
56
 #if NUM_SERVOS > 0
99
 // M29  - Stop SD write
99
 // M29  - Stop SD write
100
 // M30  - Delete file from SD (M30 filename.g)
100
 // M30  - Delete file from SD (M30 filename.g)
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 (simiarl 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
229
 #endif
229
 #endif
230
 
230
 
231
 #ifdef ULTIPANEL
231
 #ifdef ULTIPANEL
232
-	bool powersupply = true;
232
+  #ifdef PS_DEFAULT_OFF
233
+    bool powersupply = false;
234
+  #else
235
+	  bool powersupply = true;
236
+  #endif
233
 #endif
237
 #endif
234
 
238
 
235
 #ifdef DELTA
239
 #ifdef DELTA
418
 
422
 
419
   #if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
423
   #if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
420
   delay(PROBE_SERVO_DEACTIVATION_DELAY);
424
   delay(PROBE_SERVO_DEACTIVATION_DELAY);
421
-  servos[servo_endstops[Z_AXIS]].detach();  
425
+  servos[servo_endstops[Z_AXIS]].detach();
422
   #endif
426
   #endif
423
 }
427
 }
424
 
428
 
639
   if(!card.sdprinting || serial_count!=0){
643
   if(!card.sdprinting || serial_count!=0){
640
     return;
644
     return;
641
   }
645
   }
642
-  
646
+
643
   //'#' stops reading from sd to the buffer prematurely, so procedural macro calls are possible
647
   //'#' stops reading from sd to the buffer prematurely, so procedural macro calls are possible
644
-  // if it occures, stop_buffering is triggered and the buffer is ran dry. 
648
+  // if it occures, stop_buffering is triggered and the buffer is ran dry.
645
   // this character _can_ occure in serial com, due to checksums. however, no checksums are used in sd printing
649
   // this character _can_ occure in serial com, due to checksums. however, no checksums are used in sd printing
646
-  
650
+
647
   static bool stop_buffering=false;
651
   static bool stop_buffering=false;
648
   if(buflen==0) stop_buffering=false;
652
   if(buflen==0) stop_buffering=false;
649
-  
650
-  while( !card.eof()  && buflen < BUFSIZE && !stop_buffering) { 
653
+
654
+  while( !card.eof()  && buflen < BUFSIZE && !stop_buffering) {
651
     int16_t n=card.get();
655
     int16_t n=card.get();
652
-    serial_char = (char)n; 
656
+    serial_char = (char)n;
653
     if(serial_char == '\n' ||
657
     if(serial_char == '\n' ||
654
        serial_char == '\r' ||
658
        serial_char == '\r' ||
655
        (serial_char == '#' && comment_mode == false) ||
659
        (serial_char == '#' && comment_mode == false) ||
674
       }
678
       }
675
       if(serial_char=='#')
679
       if(serial_char=='#')
676
         stop_buffering=true;
680
         stop_buffering=true;
677
-      
681
+
678
       if(!serial_count)
682
       if(!serial_count)
679
       {
683
       {
680
         comment_mode = false; //for new command
684
         comment_mode = false; //for new command
746
   #endif
750
   #endif
747
   #if X_HOME_DIR != -1 || X2_HOME_DIR != 1
751
   #if X_HOME_DIR != -1 || X2_HOME_DIR != 1
748
     #error "Please use canonical x-carriage assignment" // the x-carriages are defined by their homing directions
752
     #error "Please use canonical x-carriage assignment" // the x-carriages are defined by their homing directions
749
-  #endif  
753
+  #endif
750
 
754
 
751
 #define DXC_FULL_CONTROL_MODE 0
755
 #define DXC_FULL_CONTROL_MODE 0
752
 #define DXC_AUTO_PARK_MODE    1
756
 #define DXC_AUTO_PARK_MODE    1
753
 #define DXC_DUPLICATION_MODE  2
757
 #define DXC_DUPLICATION_MODE  2
754
 static int dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
758
 static int dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
755
- 
759
+
756
 static float x_home_pos(int extruder) {
760
 static float x_home_pos(int extruder) {
757
   if (extruder == 0)
761
   if (extruder == 0)
758
     return base_home_pos(X_AXIS) + add_homeing[X_AXIS];
762
     return base_home_pos(X_AXIS) + add_homeing[X_AXIS];
770
 
774
 
771
 static float inactive_extruder_x_pos = X2_MAX_POS; // used in mode 0 & 1
775
 static float inactive_extruder_x_pos = X2_MAX_POS; // used in mode 0 & 1
772
 static bool active_extruder_parked = false; // used in mode 1 & 2
776
 static bool active_extruder_parked = false; // used in mode 1 & 2
773
-static float raised_parked_position[NUM_AXIS]; // used in mode 1 
774
-static unsigned long delayed_move_time = 0; // used in mode 1 
777
+static float raised_parked_position[NUM_AXIS]; // used in mode 1
778
+static unsigned long delayed_move_time = 0; // used in mode 1
775
 static float duplicate_extruder_x_offset = DEFAULT_DUPLICATION_X_OFFSET; // used in mode 2
779
 static float duplicate_extruder_x_offset = DEFAULT_DUPLICATION_X_OFFSET; // used in mode 2
776
 static float duplicate_extruder_temp_offset = 0; // used in mode 2
780
 static float duplicate_extruder_temp_offset = 0; // used in mode 2
777
 bool extruder_duplication_enabled = false; // used in mode 2
781
 bool extruder_duplication_enabled = false; // used in mode 2
778
-#endif //DUAL_X_CARRIAGE    
782
+#endif //DUAL_X_CARRIAGE
779
 
783
 
780
 static void axis_is_at_home(int axis) {
784
 static void axis_is_at_home(int axis) {
781
 #ifdef DUAL_X_CARRIAGE
785
 #ifdef DUAL_X_CARRIAGE
788
     }
792
     }
789
     else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && active_extruder == 0) {
793
     else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && active_extruder == 0) {
790
       current_position[X_AXIS] = base_home_pos(X_AXIS) + add_homeing[X_AXIS];
794
       current_position[X_AXIS] = base_home_pos(X_AXIS) + add_homeing[X_AXIS];
791
-      min_pos[X_AXIS] =          base_min_pos(X_AXIS) + add_homeing[X_AXIS]; 
792
-      max_pos[X_AXIS] =          min(base_max_pos(X_AXIS) + add_homeing[X_AXIS], 
795
+      min_pos[X_AXIS] =          base_min_pos(X_AXIS) + add_homeing[X_AXIS];
796
+      max_pos[X_AXIS] =          min(base_max_pos(X_AXIS) + add_homeing[X_AXIS],
793
                                   max(extruder_offset[X_AXIS][1], X2_MAX_POS) - duplicate_extruder_x_offset);
797
                                   max(extruder_offset[X_AXIS][1], X2_MAX_POS) - duplicate_extruder_x_offset);
794
       return;
798
       return;
795
     }
799
     }
881
     st_synchronize();
885
     st_synchronize();
882
 
886
 
883
     // move back down slowly to find bed
887
     // move back down slowly to find bed
884
-    feedrate = homing_feedrate[Z_AXIS]/4; 
888
+    feedrate = homing_feedrate[Z_AXIS]/4;
885
     zPosition -= home_retract_mm(Z_AXIS) * 2;
889
     zPosition -= home_retract_mm(Z_AXIS) * 2;
886
     plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate/60, active_extruder);
890
     plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate/60, active_extruder);
887
     st_synchronize();
891
     st_synchronize();
978
 
982
 
979
     current_position[axis] = 0;
983
     current_position[axis] = 0;
980
     plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
984
     plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
981
-	
985
+
982
 
986
 
983
     // Engage Servo endstop if enabled
987
     // Engage Servo endstop if enabled
984
     #ifdef SERVO_ENDSTOPS
988
     #ifdef SERVO_ENDSTOPS
1036
 #if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
1040
 #if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
1037
     if (axis==Z_AXIS) retract_z_probe();
1041
     if (axis==Z_AXIS) retract_z_probe();
1038
 #endif
1042
 #endif
1039
-    
1043
+
1040
   }
1044
   }
1041
 }
1045
 }
1042
 #define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS)
1046
 #define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS)
1110
         destination[Y_AXIS]=current_position[Y_AXIS];
1114
         destination[Y_AXIS]=current_position[Y_AXIS];
1111
         destination[Z_AXIS]=current_position[Z_AXIS];
1115
         destination[Z_AXIS]=current_position[Z_AXIS];
1112
         current_position[Z_AXIS]+=retract_zlift;
1116
         current_position[Z_AXIS]+=retract_zlift;
1113
-        destination[E_AXIS]=current_position[E_AXIS]+retract_length+retract_recover_length; 
1117
+        destination[E_AXIS]=current_position[E_AXIS]+retract_length+retract_recover_length;
1114
         feedrate=retract_recover_feedrate;
1118
         feedrate=retract_recover_feedrate;
1115
         retracted=false;
1119
         retracted=false;
1116
         prepare_move();
1120
         prepare_move();
1224
         // reset state used by the different modes
1228
         // reset state used by the different modes
1225
         memcpy(raised_parked_position, current_position, sizeof(raised_parked_position));
1229
         memcpy(raised_parked_position, current_position, sizeof(raised_parked_position));
1226
         delayed_move_time = 0;
1230
         delayed_move_time = 0;
1227
-        active_extruder_parked = true; 
1228
-      #else      
1231
+        active_extruder_parked = true;
1232
+      #else
1229
         HOMEAXIS(X);
1233
         HOMEAXIS(X);
1230
-      #endif         
1234
+      #endif
1231
       }
1235
       }
1232
 
1236
 
1233
       if((home_all_axis) || (code_seen(axis_codes[Y_AXIS]))) {
1237
       if((home_all_axis) || (code_seen(axis_codes[Y_AXIS]))) {
1246
           current_position[Y_AXIS]=code_value()+add_homeing[1];
1250
           current_position[Y_AXIS]=code_value()+add_homeing[1];
1247
         }
1251
         }
1248
       }
1252
       }
1249
-      
1253
+
1250
       #if Z_HOME_DIR < 0                      // If homing towards BED do Z last
1254
       #if Z_HOME_DIR < 0                      // If homing towards BED do Z last
1251
         #ifndef Z_SAFE_HOMING
1255
         #ifndef Z_SAFE_HOMING
1252
           if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
1256
           if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
1258
             #endif
1262
             #endif
1259
             HOMEAXIS(Z);
1263
             HOMEAXIS(Z);
1260
           }
1264
           }
1261
-        #else                      // Z Safe mode activated. 
1265
+        #else                      // Z Safe mode activated.
1262
           if(home_all_axis) {
1266
           if(home_all_axis) {
1263
             destination[X_AXIS] = round(Z_SAFE_HOMING_X_POINT - X_PROBE_OFFSET_FROM_EXTRUDER);
1267
             destination[X_AXIS] = round(Z_SAFE_HOMING_X_POINT - X_PROBE_OFFSET_FROM_EXTRUDER);
1264
             destination[Y_AXIS] = round(Z_SAFE_HOMING_Y_POINT - Y_PROBE_OFFSET_FROM_EXTRUDER);
1268
             destination[Y_AXIS] = round(Z_SAFE_HOMING_Y_POINT - Y_PROBE_OFFSET_FROM_EXTRUDER);
1265
             destination[Z_AXIS] = Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS) * (-1);    // Set destination away from bed
1269
             destination[Z_AXIS] = Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS) * (-1);    // Set destination away from bed
1266
             feedrate = XY_TRAVEL_SPEED;
1270
             feedrate = XY_TRAVEL_SPEED;
1267
             current_position[Z_AXIS] = 0;
1271
             current_position[Z_AXIS] = 0;
1268
-			
1272
+
1269
             plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1273
             plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1270
             plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder);
1274
             plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder);
1271
             st_synchronize();
1275
             st_synchronize();
1283
               && (current_position[Y_AXIS]+Y_PROBE_OFFSET_FROM_EXTRUDER <= Y_MAX_POS)) {
1287
               && (current_position[Y_AXIS]+Y_PROBE_OFFSET_FROM_EXTRUDER <= Y_MAX_POS)) {
1284
 
1288
 
1285
               current_position[Z_AXIS] = 0;
1289
               current_position[Z_AXIS] = 0;
1286
-              plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);			  
1290
+              plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1287
               destination[Z_AXIS] = Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS) * (-1);    // Set destination away from bed
1291
               destination[Z_AXIS] = Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS) * (-1);    // Set destination away from bed
1288
               feedrate = max_feedrate[Z_AXIS];
1292
               feedrate = max_feedrate[Z_AXIS];
1289
               plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder);
1293
               plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder);
1303
         #endif
1307
         #endif
1304
       #endif
1308
       #endif
1305
 
1309
 
1306
-      
1307
-     
1310
+
1311
+
1308
       if(code_seen(axis_codes[Z_AXIS])) {
1312
       if(code_seen(axis_codes[Z_AXIS])) {
1309
         if(code_value_long() != 0) {
1313
         if(code_value_long() != 0) {
1310
           current_position[Z_AXIS]=code_value()+add_homeing[2];
1314
           current_position[Z_AXIS]=code_value()+add_homeing[2];
1467
             run_z_probe();
1471
             run_z_probe();
1468
             float z_at_xLeft_yFront = current_position[Z_AXIS];
1472
             float z_at_xLeft_yFront = current_position[Z_AXIS];
1469
             retract_z_probe();
1473
             retract_z_probe();
1470
-            
1474
+
1471
             SERIAL_PROTOCOLPGM("Bed x: ");
1475
             SERIAL_PROTOCOLPGM("Bed x: ");
1472
             SERIAL_PROTOCOL(LEFT_PROBE_BED_POSITION);
1476
             SERIAL_PROTOCOL(LEFT_PROBE_BED_POSITION);
1473
             SERIAL_PROTOCOLPGM(" y: ");
1477
             SERIAL_PROTOCOLPGM(" y: ");
1485
             run_z_probe();
1489
             run_z_probe();
1486
             float z_at_xRight_yFront = current_position[Z_AXIS];
1490
             float z_at_xRight_yFront = current_position[Z_AXIS];
1487
             retract_z_probe(); // Retract Z Servo endstop if available
1491
             retract_z_probe(); // Retract Z Servo endstop if available
1488
-            
1492
+
1489
             SERIAL_PROTOCOLPGM("Bed x: ");
1493
             SERIAL_PROTOCOLPGM("Bed x: ");
1490
             SERIAL_PROTOCOL(RIGHT_PROBE_BED_POSITION);
1494
             SERIAL_PROTOCOL(RIGHT_PROBE_BED_POSITION);
1491
             SERIAL_PROTOCOLPGM(" y: ");
1495
             SERIAL_PROTOCOLPGM(" y: ");
1500
          
1504
          
1501
             
1505
             
1502
 #endif // ACCURATE_BED_LEVELING
1506
 #endif // ACCURATE_BED_LEVELING
1503
-            st_synchronize();            
1507
+            st_synchronize();
1504
 
1508
 
1505
             // The following code correct the Z height difference from z-probe position and hotend tip position.
1509
             // The following code correct the Z height difference from z-probe position and hotend tip position.
1506
-            // The Z height on homing is measured by Z-Probe, but the probe is quite far from the hotend. 
1510
+            // The Z height on homing is measured by Z-Probe, but the probe is quite far from the hotend.
1507
             // When the bed is uneven, this height must be corrected.
1511
             // When the bed is uneven, this height must be corrected.
1508
             real_z = float(st_get_position(Z_AXIS))/axis_steps_per_unit[Z_AXIS];  //get the real Z (since the auto bed leveling is already correcting the plane)
1512
             real_z = float(st_get_position(Z_AXIS))/axis_steps_per_unit[Z_AXIS];  //get the real Z (since the auto bed leveling is already correcting the plane)
1509
             x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER;
1513
             x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER;
1515
             plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1519
             plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1516
         }
1520
         }
1517
         break;
1521
         break;
1518
-        
1522
+
1519
     case 30: // G30 Single Z Probe
1523
     case 30: // G30 Single Z Probe
1520
         {
1524
         {
1521
             engage_z_probe(); // Engage Z Servo endstop if available
1525
             engage_z_probe(); // Engage Z Servo endstop if available
1522
-            
1526
+
1523
             st_synchronize();
1527
             st_synchronize();
1524
             // TODO: make sure the bed_level_rotation_matrix is identity or the planner will get set incorectly
1528
             // TODO: make sure the bed_level_rotation_matrix is identity or the planner will get set incorectly
1525
             setup_for_endstop_move();
1529
             setup_for_endstop_move();
1670
         card.removeFile(strchr_pointer + 4);
1674
         card.removeFile(strchr_pointer + 4);
1671
       }
1675
       }
1672
       break;
1676
       break;
1673
-    case 32: //M32 - Select file and start SD print 
1677
+    case 32: //M32 - Select file and start SD print
1674
     {
1678
     {
1675
       if(card.sdprinting) {
1679
       if(card.sdprinting) {
1676
         st_synchronize();
1680
         st_synchronize();
1677
 
1681
 
1678
       }
1682
       }
1679
-      starpos = (strchr(strchr_pointer + 4,'*')); 
1680
-      
1683
+      starpos = (strchr(strchr_pointer + 4,'*'));
1684
+
1681
       char* namestartpos = (strchr(strchr_pointer + 4,'!'));   //find ! to indicate filename string start.
1685
       char* namestartpos = (strchr(strchr_pointer + 4,'!'));   //find ! to indicate filename string start.
1682
       if(namestartpos==NULL)
1686
       if(namestartpos==NULL)
1683
       {
1687
       {
1685
       }
1689
       }
1686
       else
1690
       else
1687
         namestartpos++; //to skip the '!'
1691
         namestartpos++; //to skip the '!'
1688
-        
1692
+
1689
       if(starpos!=NULL)
1693
       if(starpos!=NULL)
1690
         *(starpos-1)='\0';
1694
         *(starpos-1)='\0';
1691
-            
1695
+
1692
       bool call_procedure=(code_seen('P'));
1696
       bool call_procedure=(code_seen('P'));
1693
-      
1694
-      if(strchr_pointer>namestartpos) 
1697
+
1698
+      if(strchr_pointer>namestartpos)
1695
         call_procedure=false;  //false alert, 'P' found within filename
1699
         call_procedure=false;  //false alert, 'P' found within filename
1696
-      
1697
-      if( card.cardOK ) 
1700
+
1701
+      if( card.cardOK )
1698
       {
1702
       {
1699
         card.openFile(namestartpos,true,!call_procedure);
1703
         card.openFile(namestartpos,true,!call_procedure);
1700
         if(code_seen('S'))
1704
         if(code_seen('S'))
1767
 #ifdef DUAL_X_CARRIAGE
1771
 #ifdef DUAL_X_CARRIAGE
1768
       if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && tmp_extruder == 0)
1772
       if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && tmp_extruder == 0)
1769
         setTargetHotend1(code_value() == 0.0 ? 0.0 : code_value() + duplicate_extruder_temp_offset);
1773
         setTargetHotend1(code_value() == 0.0 ? 0.0 : code_value() + duplicate_extruder_temp_offset);
1770
-#endif          
1774
+#endif
1771
       setWatch();
1775
       setWatch();
1772
       break;
1776
       break;
1773
     case 140: // M140 set bed temp
1777
     case 140: // M140 set bed temp
1823
             SERIAL_PROTOCOL_F(rawHotendTemp(cur_extruder)/OVERSAMPLENR,0);
1827
             SERIAL_PROTOCOL_F(rawHotendTemp(cur_extruder)/OVERSAMPLENR,0);
1824
           }
1828
           }
1825
         #endif
1829
         #endif
1826
-		
1830
+
1827
         SERIAL_PROTOCOLLN("");
1831
         SERIAL_PROTOCOLLN("");
1828
       return;
1832
       return;
1829
       break;
1833
       break;
1841
 #ifdef DUAL_X_CARRIAGE
1845
 #ifdef DUAL_X_CARRIAGE
1842
         if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && tmp_extruder == 0)
1846
         if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && tmp_extruder == 0)
1843
           setTargetHotend1(code_value() == 0.0 ? 0.0 : code_value() + duplicate_extruder_temp_offset);
1847
           setTargetHotend1(code_value() == 0.0 ? 0.0 : code_value() + duplicate_extruder_temp_offset);
1844
-#endif          
1848
+#endif
1845
         CooldownNoWait = true;
1849
         CooldownNoWait = true;
1846
       } else if (code_seen('R')) {
1850
       } else if (code_seen('R')) {
1847
         setTargetHotend(code_value(), tmp_extruder);
1851
         setTargetHotend(code_value(), tmp_extruder);
1848
 #ifdef DUAL_X_CARRIAGE
1852
 #ifdef DUAL_X_CARRIAGE
1849
         if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && tmp_extruder == 0)
1853
         if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && tmp_extruder == 0)
1850
           setTargetHotend1(code_value() == 0.0 ? 0.0 : code_value() + duplicate_extruder_temp_offset);
1854
           setTargetHotend1(code_value() == 0.0 ? 0.0 : code_value() + duplicate_extruder_temp_offset);
1851
-#endif          
1855
+#endif
1852
         CooldownNoWait = false;
1856
         CooldownNoWait = false;
1853
       }
1857
       }
1854
       #ifdef AUTOTEMP
1858
       #ifdef AUTOTEMP
2012
             SET_OUTPUT(SUICIDE_PIN);
2016
             SET_OUTPUT(SUICIDE_PIN);
2013
             WRITE(SUICIDE_PIN, HIGH);
2017
             WRITE(SUICIDE_PIN, HIGH);
2014
         #endif
2018
         #endif
2015
-        
2019
+
2016
         #ifdef ULTIPANEL
2020
         #ifdef ULTIPANEL
2017
           powersupply = true;
2021
           powersupply = true;
2018
           LCD_MESSAGEPGM(WELCOME_MSG);
2022
           LCD_MESSAGEPGM(WELCOME_MSG);
2169
       #endif
2173
       #endif
2170
       break;
2174
       break;
2171
       //TODO: update for all axis, use for loop
2175
       //TODO: update for all axis, use for loop
2172
-    #ifdef BLINKM  
2176
+    #ifdef BLINKM
2173
     case 150: // M150
2177
     case 150: // M150
2174
       {
2178
       {
2175
         byte red;
2179
         byte red;
2176
         byte grn;
2180
         byte grn;
2177
         byte blu;
2181
         byte blu;
2178
-        
2182
+
2179
         if(code_seen('R')) red = code_value();
2183
         if(code_seen('R')) red = code_value();
2180
         if(code_seen('U')) grn = code_value();
2184
         if(code_seen('U')) grn = code_value();
2181
         if(code_seen('B')) blu = code_value();
2185
         if(code_seen('B')) blu = code_value();
2182
-        
2183
-        SendColors(red,grn,blu);        
2186
+
2187
+        SendColors(red,grn,blu);
2184
       }
2188
       }
2185
       break;
2189
       break;
2186
     #endif //BLINKM
2190
     #endif //BLINKM
2302
       {
2306
       {
2303
         extruder_offset[Z_AXIS][tmp_extruder] = code_value();
2307
         extruder_offset[Z_AXIS][tmp_extruder] = code_value();
2304
       }
2308
       }
2305
-      #endif       
2309
+      #endif
2306
       SERIAL_ECHO_START;
2310
       SERIAL_ECHO_START;
2307
       SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
2311
       SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
2308
       for(tmp_extruder = 0; tmp_extruder < EXTRUDERS; tmp_extruder++)
2312
       for(tmp_extruder = 0; tmp_extruder < EXTRUDERS; tmp_extruder++)
2335
       }
2339
       }
2336
     }
2340
     }
2337
     break;
2341
     break;
2338
-	
2342
+
2339
 	case 226: // M226 P<pin number> S<pin state>- Wait until the specified pin reaches the state required
2343
 	case 226: // M226 P<pin number> S<pin state>- Wait until the specified pin reaches the state required
2340
 	{
2344
 	{
2341
       if(code_seen('P')){
2345
       if(code_seen('P')){
2342
         int pin_number = code_value(); // pin number
2346
         int pin_number = code_value(); // pin number
2343
         int pin_state = -1; // required pin state - default is inverted
2347
         int pin_state = -1; // required pin state - default is inverted
2344
-        
2348
+
2345
         if(code_seen('S')) pin_state = code_value(); // required pin state
2349
         if(code_seen('S')) pin_state = code_value(); // required pin state
2346
-      
2350
+
2347
         if(pin_state >= -1 && pin_state <= 1){
2351
         if(pin_state >= -1 && pin_state <= 1){
2348
-        
2352
+
2349
           for(int8_t i = 0; i < (int8_t)sizeof(sensitive_pins); i++)
2353
           for(int8_t i = 0; i < (int8_t)sizeof(sensitive_pins); i++)
2350
           {
2354
           {
2351
             if (sensitive_pins[i] == pin_number)
2355
             if (sensitive_pins[i] == pin_number)
2354
               break;
2358
               break;
2355
             }
2359
             }
2356
           }
2360
           }
2357
-        
2361
+
2358
           if (pin_number > -1)
2362
           if (pin_number > -1)
2359
           {
2363
           {
2360
             st_synchronize();
2364
             st_synchronize();
2361
-            
2365
+
2362
             pinMode(pin_number, INPUT);
2366
             pinMode(pin_number, INPUT);
2363
-            
2367
+
2364
             int target;
2368
             int target;
2365
             switch(pin_state){
2369
             switch(pin_state){
2366
             case 1:
2370
             case 1:
2367
               target = HIGH;
2371
               target = HIGH;
2368
               break;
2372
               break;
2369
-            
2373
+
2370
             case 0:
2374
             case 0:
2371
               target = LOW;
2375
               target = LOW;
2372
               break;
2376
               break;
2373
-            
2377
+
2374
             case -1:
2378
             case -1:
2375
               target = !digitalRead(pin_number);
2379
               target = !digitalRead(pin_number);
2376
               break;
2380
               break;
2377
             }
2381
             }
2378
-            
2382
+
2379
             while(digitalRead(pin_number) != target){
2383
             while(digitalRead(pin_number) != target){
2380
               manage_heater();
2384
               manage_heater();
2381
               manage_inactivity();
2385
               manage_inactivity();
2385
         }
2389
         }
2386
       }
2390
       }
2387
     }
2391
     }
2388
-    break;	
2392
+    break;
2389
 
2393
 
2390
     #if NUM_SERVOS > 0
2394
     #if NUM_SERVOS > 0
2391
     case 280: // M280 - set servo position absolute. P: servo index, S: angle or microseconds
2395
     case 280: // M280 - set servo position absolute. P: servo index, S: angle or microseconds
2561
         engage_z_probe();    // Engage Z Servo endstop if available
2565
         engage_z_probe();    // Engage Z Servo endstop if available
2562
     }
2566
     }
2563
     break;
2567
     break;
2564
-    
2568
+
2565
     case 402:
2569
     case 402:
2566
     {
2570
     {
2567
         retract_z_probe();    // Retract Z Servo endstop if enabled
2571
         retract_z_probe();    // Retract Z Servo endstop if enabled
2568
     }
2572
     }
2569
     break;
2573
     break;
2570
-#endif    
2574
+#endif
2571
     case 500: // M500 Store settings in EEPROM
2575
     case 500: // M500 Store settings in EEPROM
2572
     {
2576
     {
2573
         Config_StoreSettings();
2577
         Config_StoreSettings();
2725
               //    M605 S0: Full control mode. The slicer has full control over x-carriage movement
2729
               //    M605 S0: Full control mode. The slicer has full control over x-carriage movement
2726
               //    M605 S1: Auto-park mode. The inactive head will auto park/unpark without slicer involvement
2730
               //    M605 S1: Auto-park mode. The inactive head will auto park/unpark without slicer involvement
2727
               //    M605 S2 [Xnnn] [Rmmm]: Duplication mode. The second extruder will duplicate the first with nnn
2731
               //    M605 S2 [Xnnn] [Rmmm]: Duplication mode. The second extruder will duplicate the first with nnn
2728
-              //                         millimeters x-offset and an optional differential hotend temperature of 
2732
+              //                         millimeters x-offset and an optional differential hotend temperature of
2729
               //                         mmm degrees. E.g., with "M605 S2 X100 R2" the second extruder will duplicate
2733
               //                         mmm degrees. E.g., with "M605 S2 X100 R2" the second extruder will duplicate
2730
               //                         the first with a spacing of 100mm in the x direction and 2 degrees hotter.
2734
               //                         the first with a spacing of 100mm in the x direction and 2 degrees hotter.
2731
               //
2735
               //
2732
               //    Note: the X axis should be homed after changing dual x-carriage mode.
2736
               //    Note: the X axis should be homed after changing dual x-carriage mode.
2733
     {
2737
     {
2734
         st_synchronize();
2738
         st_synchronize();
2735
-        
2739
+
2736
         if (code_seen('S'))
2740
         if (code_seen('S'))
2737
           dual_x_carriage_mode = code_value();
2741
           dual_x_carriage_mode = code_value();
2738
 
2742
 
2743
 
2747
 
2744
           if (code_seen('R'))
2748
           if (code_seen('R'))
2745
             duplicate_extruder_temp_offset = code_value();
2749
             duplicate_extruder_temp_offset = code_value();
2746
-            
2750
+
2747
           SERIAL_ECHO_START;
2751
           SERIAL_ECHO_START;
2748
           SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
2752
           SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
2749
           SERIAL_ECHO(" ");
2753
           SERIAL_ECHO(" ");
2759
         {
2763
         {
2760
           dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
2764
           dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
2761
         }
2765
         }
2762
-        
2766
+
2763
         active_extruder_parked = false;
2767
         active_extruder_parked = false;
2764
         extruder_duplication_enabled = false;
2768
         extruder_duplication_enabled = false;
2765
         delayed_move_time = 0;
2769
         delayed_move_time = 0;
2766
     }
2770
     }
2767
     break;
2771
     break;
2768
-    #endif //DUAL_X_CARRIAGE         
2772
+    #endif //DUAL_X_CARRIAGE
2769
 
2773
 
2770
     case 907: // M907 Set digital trimpot motor current using axis codes.
2774
     case 907: // M907 Set digital trimpot motor current using axis codes.
2771
     {
2775
     {
2846
         // Save current position to return to after applying extruder offset
2850
         // Save current position to return to after applying extruder offset
2847
         memcpy(destination, current_position, sizeof(destination));
2851
         memcpy(destination, current_position, sizeof(destination));
2848
       #ifdef DUAL_X_CARRIAGE
2852
       #ifdef DUAL_X_CARRIAGE
2849
-        if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE && Stopped == false && 
2853
+        if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE && Stopped == false &&
2850
             (delayed_move_time != 0 || current_position[X_AXIS] != x_home_pos(active_extruder)))
2854
             (delayed_move_time != 0 || current_position[X_AXIS] != x_home_pos(active_extruder)))
2851
         {
2855
         {
2852
           // Park old head: 1) raise 2) move to park position 3) lower
2856
           // Park old head: 1) raise 2) move to park position 3) lower
2853
-          plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT, 
2857
+          plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT,
2854
                 current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
2858
                 current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
2855
-          plan_buffer_line(x_home_pos(active_extruder), current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT, 
2859
+          plan_buffer_line(x_home_pos(active_extruder), current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT,
2856
                 current_position[E_AXIS], max_feedrate[X_AXIS], active_extruder);
2860
                 current_position[E_AXIS], max_feedrate[X_AXIS], active_extruder);
2857
-          plan_buffer_line(x_home_pos(active_extruder), current_position[Y_AXIS], current_position[Z_AXIS], 
2861
+          plan_buffer_line(x_home_pos(active_extruder), current_position[Y_AXIS], current_position[Z_AXIS],
2858
                 current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
2862
                 current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
2859
           st_synchronize();
2863
           st_synchronize();
2860
         }
2864
         }
2861
-        
2865
+
2862
         // apply Y & Z extruder offset (x offset is already used in determining home pos)
2866
         // apply Y & Z extruder offset (x offset is already used in determining home pos)
2863
         current_position[Y_AXIS] = current_position[Y_AXIS] -
2867
         current_position[Y_AXIS] = current_position[Y_AXIS] -
2864
                      extruder_offset[Y_AXIS][active_extruder] +
2868
                      extruder_offset[Y_AXIS][active_extruder] +
2866
         current_position[Z_AXIS] = current_position[Z_AXIS] -
2870
         current_position[Z_AXIS] = current_position[Z_AXIS] -
2867
                      extruder_offset[Z_AXIS][active_extruder] +
2871
                      extruder_offset[Z_AXIS][active_extruder] +
2868
                      extruder_offset[Z_AXIS][tmp_extruder];
2872
                      extruder_offset[Z_AXIS][tmp_extruder];
2869
-                     
2873
+
2870
         active_extruder = tmp_extruder;
2874
         active_extruder = tmp_extruder;
2871
 
2875
 
2872
         // This function resets the max/min values - the current position may be overwritten below.
2876
         // This function resets the max/min values - the current position may be overwritten below.
2874
 
2878
 
2875
         if (dual_x_carriage_mode == DXC_FULL_CONTROL_MODE)
2879
         if (dual_x_carriage_mode == DXC_FULL_CONTROL_MODE)
2876
         {
2880
         {
2877
-          current_position[X_AXIS] = inactive_extruder_x_pos; 
2881
+          current_position[X_AXIS] = inactive_extruder_x_pos;
2878
           inactive_extruder_x_pos = destination[X_AXIS];
2882
           inactive_extruder_x_pos = destination[X_AXIS];
2879
         }
2883
         }
2880
         else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE)
2884
         else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE)
2881
         {
2885
         {
2882
           active_extruder_parked = (active_extruder == 0); // this triggers the second extruder to move into the duplication position
2886
           active_extruder_parked = (active_extruder == 0); // this triggers the second extruder to move into the duplication position
2883
           if (active_extruder == 0 || active_extruder_parked)
2887
           if (active_extruder == 0 || active_extruder_parked)
2884
-            current_position[X_AXIS] = inactive_extruder_x_pos; 
2888
+            current_position[X_AXIS] = inactive_extruder_x_pos;
2885
           else
2889
           else
2886
-            current_position[X_AXIS] = destination[X_AXIS] + duplicate_extruder_x_offset; 
2890
+            current_position[X_AXIS] = destination[X_AXIS] + duplicate_extruder_x_offset;
2887
           inactive_extruder_x_pos = destination[X_AXIS];
2891
           inactive_extruder_x_pos = destination[X_AXIS];
2888
-          extruder_duplication_enabled = false; 
2892
+          extruder_duplication_enabled = false;
2889
         }
2893
         }
2890
         else
2894
         else
2891
         {
2895
         {
2895
           active_extruder_parked = true;
2899
           active_extruder_parked = true;
2896
           delayed_move_time = 0;
2900
           delayed_move_time = 0;
2897
         }
2901
         }
2898
-      #else    
2902
+      #else
2899
         // Offset extruder (only by XY)
2903
         // Offset extruder (only by XY)
2900
         int i;
2904
         int i;
2901
         for(i = 0; i < 2; i++) {
2905
         for(i = 0; i < 2; i++) {
3108
     {
3112
     {
3109
       // move duplicate extruder into correct duplication position.
3113
       // move duplicate extruder into correct duplication position.
3110
       plan_set_position(inactive_extruder_x_pos, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
3114
       plan_set_position(inactive_extruder_x_pos, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
3111
-      plan_buffer_line(current_position[X_AXIS] + duplicate_extruder_x_offset, current_position[Y_AXIS], current_position[Z_AXIS], 
3115
+      plan_buffer_line(current_position[X_AXIS] + duplicate_extruder_x_offset, current_position[Y_AXIS], current_position[Z_AXIS],
3112
           current_position[E_AXIS], max_feedrate[X_AXIS], 1);
3116
           current_position[E_AXIS], max_feedrate[X_AXIS], 1);
3113
       plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
3117
       plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
3114
       st_synchronize();
3118
       st_synchronize();
3115
       extruder_duplication_enabled = true;
3119
       extruder_duplication_enabled = true;
3116
       active_extruder_parked = false;
3120
       active_extruder_parked = false;
3117
-    }  
3121
+    }
3118
     else if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE) // handle unparking of head
3122
     else if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE) // handle unparking of head
3119
     {
3123
     {
3120
       if (current_position[E_AXIS] == destination[E_AXIS])
3124
       if (current_position[E_AXIS] == destination[E_AXIS])
3123
         // be used as start of first non-travel move)
3127
         // be used as start of first non-travel move)
3124
         if (delayed_move_time != 0xFFFFFFFFUL)
3128
         if (delayed_move_time != 0xFFFFFFFFUL)
3125
         {
3129
         {
3126
-          memcpy(current_position, destination, sizeof(current_position)); 
3130
+          memcpy(current_position, destination, sizeof(current_position));
3127
           if (destination[Z_AXIS] > raised_parked_position[Z_AXIS])
3131
           if (destination[Z_AXIS] > raised_parked_position[Z_AXIS])
3128
             raised_parked_position[Z_AXIS] = destination[Z_AXIS];
3132
             raised_parked_position[Z_AXIS] = destination[Z_AXIS];
3129
           delayed_move_time = millis();
3133
           delayed_move_time = millis();
3133
       delayed_move_time = 0;
3137
       delayed_move_time = 0;
3134
       // unpark extruder: 1) raise, 2) move into starting XY position, 3) lower
3138
       // unpark extruder: 1) raise, 2) move into starting XY position, 3) lower
3135
       plan_buffer_line(raised_parked_position[X_AXIS], raised_parked_position[Y_AXIS], raised_parked_position[Z_AXIS],    current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
3139
       plan_buffer_line(raised_parked_position[X_AXIS], raised_parked_position[Y_AXIS], raised_parked_position[Z_AXIS],    current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
3136
-      plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], raised_parked_position[Z_AXIS], 
3140
+      plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], raised_parked_position[Z_AXIS],
3137
           current_position[E_AXIS], min(max_feedrate[X_AXIS],max_feedrate[Y_AXIS]), active_extruder);
3141
           current_position[E_AXIS], min(max_feedrate[X_AXIS],max_feedrate[Y_AXIS]), active_extruder);
3138
-      plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], 
3142
+      plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS],
3139
           current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
3143
           current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
3140
       active_extruder_parked = false;
3144
       active_extruder_parked = false;
3141
     }
3145
     }
3301
       // travel moves have been received so enact them
3305
       // travel moves have been received so enact them
3302
       delayed_move_time = 0xFFFFFFFFUL; // force moves to be done
3306
       delayed_move_time = 0xFFFFFFFFUL; // force moves to be done
3303
       memcpy(destination,current_position,sizeof(destination));
3307
       memcpy(destination,current_position,sizeof(destination));
3304
-      prepare_move(); 
3308
+      prepare_move();
3305
     }
3309
     }
3306
   #endif
3310
   #endif
3307
   #ifdef TEMP_STAT_LEDS
3311
   #ifdef TEMP_STAT_LEDS

+ 105
- 13
Marlin/example_configurations/delta/Configuration.h View File

5
 // Advanced settings can be found in Configuration_adv.h
5
 // Advanced settings can be found in Configuration_adv.h
6
 // BASIC SETTINGS: select your board type, temperature sensor type, axis scaling, and endstop configuration
6
 // BASIC SETTINGS: select your board type, temperature sensor type, axis scaling, and endstop configuration
7
 
7
 
8
+//===========================================================================
9
+//============================= DELTA Printer ===============================
10
+//===========================================================================
11
+// For a Delta printer rplace the configuration files wilth the files in the
12
+// example_configurations/delta directory.
13
+//
14
+
8
 // User-specified version info of this build to display in [Pronterface, etc] terminal window during
15
 // User-specified version info of this build to display in [Pronterface, etc] terminal window during
9
 // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
16
 // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
10
 // build by the user have been successfully uploaded into firmware.
17
 // build by the user have been successfully uploaded into firmware.
18
 
25
 
19
 // This determines the communication speed of the printer
26
 // This determines the communication speed of the printer
20
 #define BAUDRATE 250000
27
 #define BAUDRATE 250000
21
-//#define BAUDRATE 115200
28
+
29
+// This enables the serial port associated to the Bluetooth interface
30
+//#define BTENABLED              // Enable BT interface on AT90USB devices
31
+
22
 
32
 
23
 //// The following define selects which electronics board you have. Please choose the one that matches your setup
33
 //// The following define selects which electronics board you have. Please choose the one that matches your setup
24
 // 10 = Gen7 custom (Alfons3 Version) "https://github.com/Alfons3/Generation_7_Electronics"
34
 // 10 = Gen7 custom (Alfons3 Version) "https://github.com/Alfons3/Generation_7_Electronics"
25
 // 11 = Gen7 v1.1, v1.2 = 11
35
 // 11 = Gen7 v1.1, v1.2 = 11
26
 // 12 = Gen7 v1.3
36
 // 12 = Gen7 v1.3
27
 // 13 = Gen7 v1.4
37
 // 13 = Gen7 v1.4
38
+// 2  = Cheaptronic v1.0
39
+// 20 = Sethi 3D_1
28
 // 3  = MEGA/RAMPS up to 1.2 = 3
40
 // 3  = MEGA/RAMPS up to 1.2 = 3
29
 // 33 = RAMPS 1.3 / 1.4 (Power outputs: Extruder, Fan, Bed)
41
 // 33 = RAMPS 1.3 / 1.4 (Power outputs: Extruder, Fan, Bed)
30
 // 34 = RAMPS 1.3 / 1.4 (Power outputs: Extruder0, Extruder1, Bed)
42
 // 34 = RAMPS 1.3 / 1.4 (Power outputs: Extruder0, Extruder1, Bed)
38
 // 64 = STB V1.1
50
 // 64 = STB V1.1
39
 // 65 = Azteeg X1
51
 // 65 = Azteeg X1
40
 // 66 = Melzi with ATmega1284 (MaKr3d version)
52
 // 66 = Melzi with ATmega1284 (MaKr3d version)
53
+// 67 = Azteeg X3
41
 // 7  = Ultimaker
54
 // 7  = Ultimaker
42
 // 71 = Ultimaker (Older electronics. Pre 1.5.4. This is rare)
55
 // 71 = Ultimaker (Older electronics. Pre 1.5.4. This is rare)
43
 // 77 = 3Drag Controller
56
 // 77 = 3Drag Controller
45
 // 80 = Rumba
58
 // 80 = Rumba
46
 // 81 = Printrboard (AT90USB1286)
59
 // 81 = Printrboard (AT90USB1286)
47
 // 82 = Brainwave (AT90USB646)
60
 // 82 = Brainwave (AT90USB646)
61
+// 83 = SAV Mk-I (AT90USB1286)
48
 // 9  = Gen3+
62
 // 9  = Gen3+
49
 // 70 = Megatronics
63
 // 70 = Megatronics
50
 // 701= Megatronics v2.0
64
 // 701= Megatronics v2.0
61
 // Define this to set a custom name for your generic Mendel,
75
 // Define this to set a custom name for your generic Mendel,
62
 // #define CUSTOM_MENDEL_NAME "This Mendel"
76
 // #define CUSTOM_MENDEL_NAME "This Mendel"
63
 
77
 
78
+// Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines)
79
+// You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4)
80
+// #define MACHINE_UUID "00000000-0000-0000-0000-000000000000"
81
+
64
 // This defines the number of extruders
82
 // This defines the number of extruders
65
 #define EXTRUDERS 1
83
 #define EXTRUDERS 1
66
 
84
 
70
 
88
 
71
 #define POWER_SUPPLY 1
89
 #define POWER_SUPPLY 1
72
 
90
 
91
+// Define this to have the electronics keep the powersupply off on startup. If you don't know what this is leave it.
92
+// #define PS_DEFAULT_OFF
73
 
93
 
74
 //===========================================================================
94
 //===========================================================================
75
 //============================== Delta Settings =============================
95
 //============================== Delta Settings =============================
125
 // 2 is 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup)
145
 // 2 is 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup)
126
 // 3 is mendel-parts thermistor (4.7k pullup)
146
 // 3 is mendel-parts thermistor (4.7k pullup)
127
 // 4 is 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !!
147
 // 4 is 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !!
128
-// 5 is 100K thermistor - ATC Semitec 104GT-2 (Used in ParCan) (4.7k pullup)
148
+// 5 is 100K thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (4.7k pullup)
129
 // 6 is 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup)
149
 // 6 is 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup)
130
 // 7 is 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup)
150
 // 7 is 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup)
151
+// 71 is 100k Honeywell thermistor 135-104LAF-J01 (4.7k pullup)
131
 // 8 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup)
152
 // 8 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup)
132
 // 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup)
153
 // 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup)
133
 // 10 is 100k RS thermistor 198-961 (4.7k pullup)
154
 // 10 is 100k RS thermistor 198-961 (4.7k pullup)
137
 //                          (but gives greater accuracy and more stable PID)
158
 //                          (but gives greater accuracy and more stable PID)
138
 // 51 is 100k thermistor - EPCOS (1k pullup)
159
 // 51 is 100k thermistor - EPCOS (1k pullup)
139
 // 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup)
160
 // 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup)
140
-// 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan) (1k pullup)
161
+// 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup)
141
 
162
 
142
 #define TEMP_SENSOR_0 -1
163
 #define TEMP_SENSOR_0 -1
143
 #define TEMP_SENSOR_1 -1
164
 #define TEMP_SENSOR_1 -1
282
 #endif
303
 #endif
283
 
304
 
284
 // The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
305
 // The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
285
-const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
286
-const bool Y_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
287
-const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
288
-const bool X_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
289
-const bool Y_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
290
-const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
291
-
292
-// deltas never have min endstops
306
+const bool X_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
307
+const bool Y_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
308
+const bool Z_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
309
+const bool X_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
310
+const bool Y_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
311
+const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
312
+//#define DISABLE_MAX_ENDSTOPS
313
+// Deltas never have min endstops
293
 #define DISABLE_MIN_ENDSTOPS
314
 #define DISABLE_MIN_ENDSTOPS
294
-
295
 // Disable max endstops for compatibility with endstop checking routine
315
 // Disable max endstops for compatibility with endstop checking routine
296
 #if defined(COREXY) && !defined(DISABLE_MAX_ENDSTOPS)
316
 #if defined(COREXY) && !defined(DISABLE_MAX_ENDSTOPS)
297
   #define DISABLE_MAX_ENDSTOPS
317
   #define DISABLE_MAX_ENDSTOPS
338
 #define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
358
 #define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
339
 #define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
359
 #define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
340
 #define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
360
 #define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
361
+//============================= Bed Auto Leveling ===========================
362
+
363
+//#define ENABLE_AUTO_BED_LEVELING // Delete the comment to enable (remove // at the start of the line)
364
+
365
+#ifdef ENABLE_AUTO_BED_LEVELING
366
+
367
+  // these are the positions on the bed to do the probing
368
+  #define LEFT_PROBE_BED_POSITION 15
369
+  #define RIGHT_PROBE_BED_POSITION 170
370
+  #define BACK_PROBE_BED_POSITION 180
371
+  #define FRONT_PROBE_BED_POSITION 20
372
+
373
+  // these are the offsets to the prob relative to the extruder tip (Hotend - Probe)
374
+  #define X_PROBE_OFFSET_FROM_EXTRUDER -25
375
+  #define Y_PROBE_OFFSET_FROM_EXTRUDER -29
376
+  #define Z_PROBE_OFFSET_FROM_EXTRUDER -12.35
377
+
378
+  #define Z_RAISE_BEFORE_HOMING 4       // (in mm) Raise Z before homing (G28) for Probe Clearance.
379
+                                        // Be sure you have this distance over your Z_MAX_POS in case
380
+
381
+  #define XY_TRAVEL_SPEED 8000         // X and Y axis travel speed between probes, in mm/min
382
+
383
+  #define Z_RAISE_BEFORE_PROBING 15    //How much the extruder will be raised before traveling to the first probing point.
384
+  #define Z_RAISE_BETWEEN_PROBINGS 5  //How much the extruder will be raised when traveling from between next probing points
385
+
386
+
387
+  //If defined, the Probe servo will be turned on only during movement and then turned off to avoid jerk
388
+  //The value is the delay to turn the servo off after powered on - depends on the servo speed; 300ms is good value, but you can try lower it.
389
+  // You MUST HAVE the SERVO_ENDSTOPS defined to use here a value higher than zero otherwise your code will not compile.
390
+
391
+//  #define PROBE_SERVO_DEACTIVATION_DELAY 300
392
+
393
+
394
+//If you have enabled the Bed Auto Levelling and are using the same Z Probe for Z Homing,
395
+//it is highly recommended you let this Z_SAFE_HOMING enabled!!!
396
+
397
+  #define Z_SAFE_HOMING   // This feature is meant to avoid Z homing with probe outside the bed area.
398
+                          // When defined, it will:
399
+                          // - Allow Z homing only after X and Y homing AND stepper drivers still enabled
400
+                          // - If stepper drivers timeout, it will need X and Y homing again before Z homing
401
+                          // - Position the probe in a defined XY point before Z Homing when homing all axis (G28)
402
+                          // - Block Z homing only when the probe is outside bed area.
403
+
404
+  #ifdef Z_SAFE_HOMING
405
+
406
+    #define Z_SAFE_HOMING_X_POINT (X_MAX_LENGTH/2)    // X point for Z homing when homing all axis (G28)
407
+    #define Z_SAFE_HOMING_Y_POINT (Y_MAX_LENGTH/2)    // Y point for Z homing when homing all axis (G28)
408
+
409
+  #endif
410
+
411
+#endif
412
+
341
 
413
 
342
 // The position of the homing switches
414
 // The position of the homing switches
343
 //#define MANUAL_HOME_POSITIONS  // If defined, MANUAL_*_HOME_POS below will be used
415
 //#define MANUAL_HOME_POSITIONS  // If defined, MANUAL_*_HOME_POS below will be used
406
 //#define DOGLCD  // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
478
 //#define DOGLCD  // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
407
 //#define SDSUPPORT // Enable SD Card Support in Hardware Console
479
 //#define SDSUPPORT // Enable SD Card Support in Hardware Console
408
 //#define SDSLOW // Use slower SD transfer mode (not normally needed - uncomment if you're getting volume init error)
480
 //#define SDSLOW // Use slower SD transfer mode (not normally needed - uncomment if you're getting volume init error)
409
-
481
+//#define ENCODER_PULSES_PER_STEP 1 // Increase if you have a high resolution encoder
482
+//#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
410
 //#define ULTIMAKERCONTROLLER //as available from the ultimaker online store.
483
 //#define ULTIMAKERCONTROLLER //as available from the ultimaker online store.
411
 //#define ULTIPANEL  //the ultipanel as on thingiverse
484
 //#define ULTIPANEL  //the ultipanel as on thingiverse
412
 
485
 
510
   #define ULTIPANEL
583
   #define ULTIPANEL
511
 #endif
584
 #endif
512
 
585
 
586
+// Shift register panels
587
+// ---------------------
588
+// 2 wire Non-latching LCD SR from:
589
+// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
590
+//#define SR_LCD
591
+#ifdef SR_LCD
592
+   #define SR_LCD_2W_NL    // Non latching 2 wire shiftregister
593
+   //#define NEWPANEL
594
+#endif
595
+
596
+
513
 #ifdef ULTIPANEL
597
 #ifdef ULTIPANEL
514
 //  #define NEWPANEL  //enable this if you have a click-encoder panel
598
 //  #define NEWPANEL  //enable this if you have a click-encoder panel
515
   #define SDSUPPORT
599
   #define SDSUPPORT
543
 // Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino
627
 // Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino
544
 //#define FAST_PWM_FAN
628
 //#define FAST_PWM_FAN
545
 
629
 
630
+// Temperature status leds that display the hotend and bet temperature.
631
+// If alle hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on.
632
+// Otherwise the RED led is on. There is 1C hysteresis.
633
+//#define TEMP_STAT_LEDS
634
+
546
 // Use software PWM to drive the fan, as for the heaters. This uses a very low frequency
635
 // Use software PWM to drive the fan, as for the heaters. This uses a very low frequency
547
 // which is not ass annoying as with the hardware PWM. On the other hand, if this frequency
636
 // which is not ass annoying as with the hardware PWM. On the other hand, if this frequency
548
 // is too low, you should also increment SOFT_PWM_SCALE.
637
 // is too low, you should also increment SOFT_PWM_SCALE.
564
 // Support for the BariCUDA Paste Extruder.
653
 // Support for the BariCUDA Paste Extruder.
565
 //#define BARICUDA
654
 //#define BARICUDA
566
 
655
 
656
+//define BlinkM/CyzRgb Support
657
+//#define BLINKM
658
+
567
 /*********************************************************************\
659
 /*********************************************************************\
568
 * R/C SERVO support
660
 * R/C SERVO support
569
 * Sponsored by TrinityLabs, Reworked by codexmas
661
 * Sponsored by TrinityLabs, Reworked by codexmas

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

40
   #define AUTOTEMP_OLDWEIGHT 0.98
40
   #define AUTOTEMP_OLDWEIGHT 0.98
41
 #endif
41
 #endif
42
 
42
 
43
+//Show Temperature ADC value
44
+//The M105 command return, besides traditional information, the ADC value read from temperature sensors.
45
+//#define SHOW_TEMP_ADC_VALUES
46
+
43
 //  extruder run-out prevention. 
47
 //  extruder run-out prevention. 
44
 //if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
48
 //if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
45
 //#define EXTRUDER_RUNOUT_PREVENT  
49
 //#define EXTRUDER_RUNOUT_PREVENT  
146
   #define EXTRUDERS 1
150
   #define EXTRUDERS 1
147
 #endif
151
 #endif
148
 
152
 
153
+// Same again but for Y Axis.
154
+//#define Y_DUAL_STEPPER_DRIVERS
155
+
156
+// Define if the two Y drives need to rotate in opposite directions
157
+#define INVERT_Y2_VS_Y_DIR true
158
+
159
+#ifdef Y_DUAL_STEPPER_DRIVERS
160
+  #undef EXTRUDERS
161
+  #define EXTRUDERS 1
162
+#endif
163
+
164
+#if defined (Z_DUAL_STEPPER_DRIVERS) && defined (Y_DUAL_STEPPER_DRIVERS)
165
+  #error "You cannot have dual drivers for both Y and Z"
166
+#endif
167
+
149
 // Enable this for dual x-carriage printers. 
168
 // Enable this for dual x-carriage printers. 
150
 // A dual x-carriage design has the advantage that the inactive extruder can be parked which
169
 // A dual x-carriage design has the advantage that the inactive extruder can be parked which
151
 // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
170
 // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
155
 // Configuration for second X-carriage
174
 // Configuration for second X-carriage
156
 // Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop;
175
 // Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop;
157
 // the second x-carriage always homes to the maximum endstop.
176
 // the second x-carriage always homes to the maximum endstop.
158
-#define X2_MIN_POS 88     // set minimum to ensure second x-carriage doesn't hit the parked first X-carriage
159
-#define X2_MAX_POS 350.45 // set maximum to the distance between toolheads when both heads are homed 
177
+#define X2_MIN_POS 80     // set minimum to ensure second x-carriage doesn't hit the parked first X-carriage
178
+#define X2_MAX_POS 353    // set maximum to the distance between toolheads when both heads are homed 
160
 #define X2_HOME_DIR 1     // the second X-carriage always homes to the maximum endstop position
179
 #define X2_HOME_DIR 1     // the second X-carriage always homes to the maximum endstop position
161
 #define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position 
180
 #define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position 
162
     // However: In this mode the EXTRUDER_OFFSET_X value for the second extruder provides a software 
181
     // However: In this mode the EXTRUDER_OFFSET_X value for the second extruder provides a software 
169
 #define X2_STEP_PIN 25
188
 #define X2_STEP_PIN 25
170
 #define X2_DIR_PIN 23
189
 #define X2_DIR_PIN 23
171
 
190
 
172
-#endif // DUAL_X_CARRIAGE
191
+// There are a few selectable movement modes for dual x-carriages using M605 S<mode>
192
+//    Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results
193
+//                           as long as it supports dual x-carriages. (M605 S0)
194
+//    Mode 1: Auto-park mode. The firmware will automatically park and unpark the x-carriages on tool changes so
195
+//                           that additional slicer support is not required. (M605 S1)
196
+//    Mode 2: Duplication mode. The firmware will transparently make the second x-carriage and extruder copy all  
197
+//                           actions of the first x-carriage. This allows the printer to print 2 arbitrary items at
198
+//                           once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm])
199
+
200
+// This is the default power-up mode which can be later using M605. 
201
+#define DEFAULT_DUAL_X_CARRIAGE_MODE 0 
202
+
203
+// As the x-carriages are independent we can now account for any relative Z offset
204
+#define EXTRUDER1_Z_OFFSET 0.0           // z offset relative to extruder 0
205
+
206
+// Default settings in "Auto-park Mode" 
207
+#define TOOLCHANGE_PARK_ZLIFT   0.2      // the distance to raise Z axis when parking an extruder
208
+#define TOOLCHANGE_UNPARK_ZLIFT 1        // the distance to raise Z axis when unparking an extruder
209
+
210
+// Default x offset in duplication mode (typically set to half print bed width)
211
+#define DEFAULT_DUPLICATION_X_OFFSET 100
212
+
213
+#endif //DUAL_X_CARRIAGE
173
     
214
     
174
 //homing hits the endstop, then retracts by this distance, before it tries to slowly bump again:
215
 //homing hits the endstop, then retracts by this distance, before it tries to slowly bump again:
175
 #define X_HOME_RETRACT_MM 5 
216
 #define X_HOME_RETRACT_MM 5 
176
-#define Y_HOME_RETRACT_MM 5
217
+#define Y_HOME_RETRACT_MM 5 
177
 #define Z_HOME_RETRACT_MM 5 // deltas need the same for all three axis
218
 #define Z_HOME_RETRACT_MM 5 // deltas need the same for all three axis
178
 
219
 
179
-
180
 //#define QUICK_HOME  //if this is defined, if both x and y are to be homed, a diagonal move will be performed initially.
220
 //#define QUICK_HOME  //if this is defined, if both x and y are to be homed, a diagonal move will be performed initially.
181
 
221
 
182
 #define AXIS_RELATIVE_MODES {false, false, false, false}
222
 #define AXIS_RELATIVE_MODES {false, false, false, false}
238
 #define SD_FINISHED_STEPPERRELEASE true  //if sd support and the file is finished: disable steppers?
278
 #define SD_FINISHED_STEPPERRELEASE true  //if sd support and the file is finished: disable steppers?
239
 #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place.
279
 #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place.
240
 
280
 
281
+#define SDCARD_RATHERRECENTFIRST  //reverse file order of sd card menu display. Its sorted practically after the filesystem block order. 
282
+// 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.
283
+// using:
284
+//#define MENU_ADDAUTOSTART
285
+
241
 // The hardware watchdog should reset the Microcontroller disabling all outputs, in case the firmware gets stuck and doesn't do temperature regulation.
286
 // The hardware watchdog should reset the Microcontroller disabling all outputs, in case the firmware gets stuck and doesn't do temperature regulation.
242
 //#define USE_WATCHDOG
287
 //#define USE_WATCHDOG
243
 
288
 
251
 // Enable the option to stop SD printing when hitting and endstops, needs to be enabled from the LCD menu when this option is enabled.
296
 // Enable the option to stop SD printing when hitting and endstops, needs to be enabled from the LCD menu when this option is enabled.
252
 //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
297
 //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
253
 
298
 
299
+// Babystepping enables the user to control the axis in tiny amounts, independently from the normal printing process
300
+// it can e.g. be used to change z-positions in the print startup phase in realtime
301
+// does not respect endstops!
302
+//#define BABYSTEPPING
303
+#ifdef BABYSTEPPING
304
+  #define BABYSTEP_XY  //not only z, but also XY in the menu. more clutter, more functions
305
+  #define BABYSTEP_INVERT_Z false  //true for inverse movements in Z
306
+  #define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements
307
+  
308
+  #ifdef COREXY
309
+    #error BABYSTEPPING not implemented for COREXY yet.
310
+  #endif
311
+
312
+  #ifdef DELTA
313
+    #ifdef BABYSTEP_XY
314
+      #error BABYSTEPPING only implemented for Z axis on deltabots.
315
+    #endif
316
+  #endif
317
+#endif
318
+
254
 // extruder advance constant (s2/mm3)
319
 // extruder advance constant (s2/mm3)
255
 //
320
 //
256
 // advance (steps) = STEPS_PER_CUBIC_MM_E * EXTUDER_ADVANCE_K * cubic mm per second ^ 2
321
 // advance (steps) = STEPS_PER_CUBIC_MM_E * EXTUDER_ADVANCE_K * cubic mm per second ^ 2
302
   #define PS_ON_ASLEEP LOW
367
   #define PS_ON_ASLEEP LOW
303
 #endif
368
 #endif
304
 
369
 
370
+// Control heater 0 and heater 1 in parallel.
371
+//#define HEATERS_PARALLEL
372
+
305
 //===========================================================================
373
 //===========================================================================
306
 //=============================Buffers           ============================
374
 //=============================Buffers           ============================
307
 //===========================================================================
375
 //===========================================================================
332
 
400
 
333
 //adds support for experimental filament exchange support M600; requires display
401
 //adds support for experimental filament exchange support M600; requires display
334
 #ifdef ULTIPANEL
402
 #ifdef ULTIPANEL
335
-  //#define FILAMENTCHANGEENABLE
403
+  #define FILAMENTCHANGEENABLE
336
   #ifdef FILAMENTCHANGEENABLE
404
   #ifdef FILAMENTCHANGEENABLE
337
     #define FILAMENTCHANGE_XPOS 3
405
     #define FILAMENTCHANGE_XPOS 3
338
     #define FILAMENTCHANGE_YPOS 3
406
     #define FILAMENTCHANGE_YPOS 3
341
     #define FILAMENTCHANGE_FINALRETRACT -100
409
     #define FILAMENTCHANGE_FINALRETRACT -100
342
   #endif
410
   #endif
343
 #endif
411
 #endif
412
+
413
+#ifdef FILAMENTCHANGEENABLE
414
+  #ifdef EXTRUDER_RUNOUT_PREVENT
415
+    #error EXTRUDER_RUNOUT_PREVENT currently incompatible with FILAMENTCHANGE
416
+  #endif 
417
+#endif
344
  
418
  
345
 //===========================================================================
419
 //===========================================================================
346
 //=============================  Define Defines  ============================
420
 //=============================  Define Defines  ============================
349
   #error "You cannot use TEMP_SENSOR_1_AS_REDUNDANT if EXTRUDERS > 1"
423
   #error "You cannot use TEMP_SENSOR_1_AS_REDUNDANT if EXTRUDERS > 1"
350
 #endif
424
 #endif
351
 
425
 
426
+#if EXTRUDERS > 1 && defined HEATERS_PARALLEL
427
+  #error "You cannot use HEATERS_PARALLEL if EXTRUDERS > 1"
428
+#endif
429
+
352
 #if TEMP_SENSOR_0 > 0
430
 #if TEMP_SENSOR_0 > 0
353
   #define THERMISTORHEATER_0 TEMP_SENSOR_0
431
   #define THERMISTORHEATER_0 TEMP_SENSOR_0
354
   #define HEATER_0_USES_THERMISTOR
432
   #define HEATER_0_USES_THERMISTOR

+ 101
- 0
Marlin/pins.h View File

2288
 
2288
 
2289
 #endif
2289
 #endif
2290
 
2290
 
2291
+/****************************************************************************************
2292
+* Cheaptronic v1.0
2293
+*
2294
+****************************************************************************************/
2295
+#if MOTHERBOARD == 2
2296
+ #define KNOWN_BOARD 1
2297
+
2298
+ #ifndef __AVR_ATmega2560__
2299
+ #error Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu.
2300
+ #endif
2301
+
2302
+ #define LARGE_FLASH        true
2303
+
2304
+ //X motor stepper
2305
+ #define X_STEP_PIN 14
2306
+ #define X_DIR_PIN 15
2307
+ #define X_ENABLE_PIN 24
2308
+ 
2309
+ //X endstop
2310
+ #define X_MIN_PIN 3
2311
+ #define X_MAX_PIN -1
2312
+
2313
+ //Y motor stepper
2314
+ #define Y_STEP_PIN 35
2315
+ #define Y_DIR_PIN 36
2316
+ #define Y_ENABLE_PIN 31
2317
+
2318
+ //Y endstop
2319
+ #define Y_MIN_PIN 2
2320
+ #define Y_MAX_PIN -1
2321
+ 
2322
+ //Z motor stepper
2323
+ #define Z_STEP_PIN 40
2324
+ #define Z_DIR_PIN 41
2325
+ #define Z_ENABLE_PIN 37
2326
+
2327
+ //Z endstop
2328
+ #define Z_MIN_PIN 5
2329
+ #define Z_MAX_PIN -1
2330
+ 
2331
+ //Extruder 0 stepper
2332
+ #define E0_STEP_PIN 26
2333
+ #define E0_DIR_PIN 28
2334
+ #define E0_ENABLE_PIN 25
2335
+
2336
+ //Extruder 1 stepper
2337
+ #define E1_STEP_PIN 33
2338
+ #define E1_DIR_PIN 34
2339
+ #define E1_ENABLE_PIN 30
2340
+
2341
+ #define SDPOWER -1
2342
+ #define SDSS -1
2343
+ #define LED_PIN -1
2344
+
2345
+ //FAN
2346
+ #define FAN_PIN -1
2347
+
2348
+ #define PS_ON_PIN -1
2349
+ #define KILL_PIN -1
2350
+
2351
+ #define HEATER_0_PIN 19 // EXTRUDER 1
2352
+ #define HEATER_1_PIN 23 // EXTRUDER 2
2353
+ //HeatedBad
2354
+ #define HEATER_BED_PIN 22
2355
+ //Cheaptronic v1.0 hasent EXTRUDER 3
2356
+ #define HEATER_2_PIN -1
2357
+ 
2358
+ //Temperature sensors
2359
+ #define TEMP_0_PIN 15
2360
+ #define TEMP_1_PIN 14
2361
+ #define TEMP_2_PIN -1
2362
+ #define TEMP_BED_PIN 13
2363
+
2364
+ //Cheaptronic v1.0 dont support LCD
2365
+ #define LCD_PINS_RS -1
2366
+ #define LCD_PINS_ENABLE -1
2367
+ #define LCD_PINS_D4 -1
2368
+ #define LCD_PINS_D5 -1
2369
+ #define LCD_PINS_D6 -1
2370
+ #define LCD_PINS_D7 -1
2371
+
2372
+ //Cheaptronic v1.0 dont support keypad
2373
+ #define BTN_EN1 -1
2374
+ #define BTN_EN2 -1
2375
+ #define BTN_ENC -1
2376
+
2377
+ #define BLEN_C 2
2378
+ #define BLEN_B 1
2379
+ #define BLEN_A 0
2380
+
2381
+ //Cheaptronic v1.0 does not use this port
2382
+ #define SDCARDDETECT -1
2383
+
2384
+ //encoder rotation values
2385
+ #define encrot0 0
2386
+ #define encrot1 2
2387
+ #define encrot2 3
2388
+ #define encrot3 1
2389
+
2390
+#endif
2391
+
2291
 
2392
 
2292
 
2393
 
2293
 #ifndef KNOWN_BOARD
2394
 #ifndef KNOWN_BOARD

+ 3
- 3
Marlin/planner.cpp View File

186
 
186
 
187
   long acceleration = block->acceleration_st;
187
   long acceleration = block->acceleration_st;
188
   int32_t accelerate_steps =
188
   int32_t accelerate_steps =
189
-    ceil(estimate_acceleration_distance(block->initial_rate, block->nominal_rate, acceleration));
189
+    ceil(estimate_acceleration_distance(initial_rate, block->nominal_rate, acceleration));
190
   int32_t decelerate_steps =
190
   int32_t decelerate_steps =
191
-    floor(estimate_acceleration_distance(block->nominal_rate, block->final_rate, -acceleration));
191
+    floor(estimate_acceleration_distance(block->nominal_rate, final_rate, -acceleration));
192
 
192
 
193
   // Calculate the size of Plateau of Nominal Rate.
193
   // Calculate the size of Plateau of Nominal Rate.
194
   int32_t plateau_steps = block->step_event_count-accelerate_steps-decelerate_steps;
194
   int32_t plateau_steps = block->step_event_count-accelerate_steps-decelerate_steps;
197
   // have to use intersection_distance() to calculate when to abort acceleration and start braking
197
   // have to use intersection_distance() to calculate when to abort acceleration and start braking
198
   // in order to reach the final_rate exactly at the end of this block.
198
   // in order to reach the final_rate exactly at the end of this block.
199
   if (plateau_steps < 0) {
199
   if (plateau_steps < 0) {
200
-    accelerate_steps = ceil(intersection_distance(block->initial_rate, block->final_rate, acceleration, block->step_event_count));
200
+    accelerate_steps = ceil(intersection_distance(initial_rate, final_rate, acceleration, block->step_event_count));
201
     accelerate_steps = max(accelerate_steps,0); // Check limits due to numerical round-off
201
     accelerate_steps = max(accelerate_steps,0); // Check limits due to numerical round-off
202
     accelerate_steps = min((uint32_t)accelerate_steps,block->step_event_count);//(We can cast here to unsigned, because the above line ensures that we are above zero)
202
     accelerate_steps = min((uint32_t)accelerate_steps,block->step_event_count);//(We can cast here to unsigned, because the above line ensures that we are above zero)
203
     plateau_steps = 0;
203
     plateau_steps = 0;

+ 31
- 27
Marlin/ultralcd.cpp View File

90
 #define ENCODER_FEEDRATE_DEADZONE 10
90
 #define ENCODER_FEEDRATE_DEADZONE 10
91
 
91
 
92
 #if !defined(LCD_I2C_VIKI)
92
 #if !defined(LCD_I2C_VIKI)
93
-  #define ENCODER_STEPS_PER_MENU_ITEM 5
93
+  #ifndef ENCODER_STEPS_PER_MENU_ITEM
94
+    #define ENCODER_STEPS_PER_MENU_ITEM 5
95
+  #endif
94
   #ifndef ENCODER_PULSES_PER_STEP
96
   #ifndef ENCODER_PULSES_PER_STEP
95
     #define ENCODER_PULSES_PER_STEP 1
97
     #define ENCODER_PULSES_PER_STEP 1
96
   #endif
98
   #endif
97
 #else
99
 #else
98
-  #define ENCODER_STEPS_PER_MENU_ITEM 2 // VIKI LCD rotary encoder uses a different number of steps per rotation
100
+  #ifndef ENCODER_STEPS_PER_MENU_ITEM
101
+    #define ENCODER_STEPS_PER_MENU_ITEM 2 // VIKI LCD rotary encoder uses a different number of steps per rotation
102
+  #endif
99
   #ifndef ENCODER_PULSES_PER_STEP
103
   #ifndef ENCODER_PULSES_PER_STEP
100
     #define ENCODER_PULSES_PER_STEP 1
104
     #define ENCODER_PULSES_PER_STEP 1
101
   #endif
105
   #endif
207
     else if (feedmultiply == 100 && int(encoderPosition) < -ENCODER_FEEDRATE_DEADZONE)
211
     else if (feedmultiply == 100 && int(encoderPosition) < -ENCODER_FEEDRATE_DEADZONE)
208
     {
212
     {
209
         feedmultiply += int(encoderPosition) + ENCODER_FEEDRATE_DEADZONE;
213
         feedmultiply += int(encoderPosition) + ENCODER_FEEDRATE_DEADZONE;
210
-        encoderPosition = 0;	
214
+        encoderPosition = 0;
211
     }
215
     }
212
     else if (feedmultiply != 100)
216
     else if (feedmultiply != 100)
213
     {
217
     {
407
 #endif
411
 #endif
408
     MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255);
412
     MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255);
409
     MENU_ITEM_EDIT(int3, MSG_FLOW, &extrudemultiply, 10, 999);
413
     MENU_ITEM_EDIT(int3, MSG_FLOW, &extrudemultiply, 10, 999);
410
-    
414
+
411
 #ifdef BABYSTEPPING
415
 #ifdef BABYSTEPPING
412
     #ifdef BABYSTEP_XY
416
     #ifdef BABYSTEP_XY
413
       MENU_ITEM(submenu, "Babystep X", lcd_babystep_x);
417
       MENU_ITEM(submenu, "Babystep X", lcd_babystep_x);
719
     MENU_ITEM_EDIT(float52, MSG_XSTEPS, &axis_steps_per_unit[X_AXIS], 5, 9999);
723
     MENU_ITEM_EDIT(float52, MSG_XSTEPS, &axis_steps_per_unit[X_AXIS], 5, 9999);
720
     MENU_ITEM_EDIT(float52, MSG_YSTEPS, &axis_steps_per_unit[Y_AXIS], 5, 9999);
724
     MENU_ITEM_EDIT(float52, MSG_YSTEPS, &axis_steps_per_unit[Y_AXIS], 5, 9999);
721
     MENU_ITEM_EDIT(float51, MSG_ZSTEPS, &axis_steps_per_unit[Z_AXIS], 5, 9999);
725
     MENU_ITEM_EDIT(float51, MSG_ZSTEPS, &axis_steps_per_unit[Z_AXIS], 5, 9999);
722
-    MENU_ITEM_EDIT(float51, MSG_ESTEPS, &axis_steps_per_unit[E_AXIS], 5, 9999);    
726
+    MENU_ITEM_EDIT(float51, MSG_ESTEPS, &axis_steps_per_unit[E_AXIS], 5, 9999);
723
 #ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
727
 #ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
724
     MENU_ITEM_EDIT(bool, "Endstop abort", &abort_on_endstop_hit);
728
     MENU_ITEM_EDIT(bool, "Endstop abort", &abort_on_endstop_hit);
725
 #endif
729
 #endif
781
 
785
 
782
 void lcd_sdcard_menu()
786
 void lcd_sdcard_menu()
783
 {
787
 {
784
-    if (lcdDrawUpdate == 0 && LCD_CLICKED == 0) 
788
+    if (lcdDrawUpdate == 0 && LCD_CLICKED == 0)
785
         return;	// nothing to do (so don't thrash the SD card)
789
         return;	// nothing to do (so don't thrash the SD card)
786
     uint16_t fileCnt = card.getnrfilenames();
790
     uint16_t fileCnt = card.getnrfilenames();
787
     START_MENU();
791
     START_MENU();
795
     }else{
799
     }else{
796
         MENU_ITEM(function, LCD_STR_FOLDER "..", lcd_sd_updir);
800
         MENU_ITEM(function, LCD_STR_FOLDER "..", lcd_sd_updir);
797
     }
801
     }
798
-    
802
+
799
     for(uint16_t i=0;i<fileCnt;i++)
803
     for(uint16_t i=0;i<fileCnt;i++)
800
     {
804
     {
801
         if (_menuItemNr == _lineNr)
805
         if (_menuItemNr == _lineNr)
982
 
986
 
983
 #ifdef NEWPANEL
987
 #ifdef NEWPANEL
984
     pinMode(BTN_EN1,INPUT);
988
     pinMode(BTN_EN1,INPUT);
985
-    pinMode(BTN_EN2,INPUT); 
989
+    pinMode(BTN_EN2,INPUT);
986
     pinMode(SDCARDDETECT,INPUT);
990
     pinMode(SDCARDDETECT,INPUT);
987
     WRITE(BTN_EN1,HIGH);
991
     WRITE(BTN_EN1,HIGH);
988
     WRITE(BTN_EN2,HIGH);
992
     WRITE(BTN_EN2,HIGH);
989
   #if BTN_ENC > 0
993
   #if BTN_ENC > 0
990
-    pinMode(BTN_ENC,INPUT); 
994
+    pinMode(BTN_ENC,INPUT);
991
     WRITE(BTN_ENC,HIGH);
995
     WRITE(BTN_ENC,HIGH);
992
-  #endif    
996
+  #endif
993
   #ifdef REPRAPWORLD_KEYPAD
997
   #ifdef REPRAPWORLD_KEYPAD
994
     pinMode(SHIFT_CLK,OUTPUT);
998
     pinMode(SHIFT_CLK,OUTPUT);
995
     pinMode(SHIFT_LD,OUTPUT);
999
     pinMode(SHIFT_LD,OUTPUT);
1007
      pinMode(SHIFT_EN,OUTPUT);
1011
      pinMode(SHIFT_EN,OUTPUT);
1008
      pinMode(SHIFT_OUT,INPUT);
1012
      pinMode(SHIFT_OUT,INPUT);
1009
      WRITE(SHIFT_OUT,HIGH);
1013
      WRITE(SHIFT_OUT,HIGH);
1010
-     WRITE(SHIFT_LD,HIGH); 
1014
+     WRITE(SHIFT_LD,HIGH);
1011
      WRITE(SHIFT_EN,LOW);
1015
      WRITE(SHIFT_EN,LOW);
1012
-   #endif // SR_LCD_2W_NL    
1016
+   #endif // SR_LCD_2W_NL
1013
 #endif//!NEWPANEL
1017
 #endif//!NEWPANEL
1014
 
1018
 
1015
 #if (SDCARDDETECT > 0)
1019
 #if (SDCARDDETECT > 0)
1020
     slow_buttons = 0;
1024
     slow_buttons = 0;
1021
     #endif
1025
     #endif
1022
     lcd_buttons_update();
1026
     lcd_buttons_update();
1023
-#ifdef ULTIPANEL    
1027
+#ifdef ULTIPANEL
1024
     encoderDiff = 0;
1028
     encoderDiff = 0;
1025
-#endif    
1029
+#endif
1026
 }
1030
 }
1027
 
1031
 
1028
 void lcd_update()
1032
 void lcd_update()
1029
 {
1033
 {
1030
     static unsigned long timeoutToStatus = 0;
1034
     static unsigned long timeoutToStatus = 0;
1031
-    
1035
+
1032
     #ifdef LCD_HAS_SLOW_BUTTONS
1036
     #ifdef LCD_HAS_SLOW_BUTTONS
1033
     slow_buttons = lcd_implementation_read_slow_buttons(); // buttons which take too long to read in interrupt context
1037
     slow_buttons = lcd_implementation_read_slow_buttons(); // buttons which take too long to read in interrupt context
1034
     #endif
1038
     #endif
1035
-    
1039
+
1036
     lcd_buttons_update();
1040
     lcd_buttons_update();
1037
-    
1041
+
1038
     #if (SDCARDDETECT > 0)
1042
     #if (SDCARDDETECT > 0)
1039
     if((IS_SD_INSERTED != lcd_oldcardstatus))
1043
     if((IS_SD_INSERTED != lcd_oldcardstatus))
1040
     {
1044
     {
1041
         lcdDrawUpdate = 2;
1045
         lcdDrawUpdate = 2;
1042
         lcd_oldcardstatus = IS_SD_INSERTED;
1046
         lcd_oldcardstatus = IS_SD_INSERTED;
1043
         lcd_implementation_init(); // to maybe revive the lcd if static electricty killed it.
1047
         lcd_implementation_init(); // to maybe revive the lcd if static electricty killed it.
1044
-        
1048
+
1045
         if(lcd_oldcardstatus)
1049
         if(lcd_oldcardstatus)
1046
         {
1050
         {
1047
             card.initsd();
1051
             card.initsd();
1054
         }
1058
         }
1055
     }
1059
     }
1056
     #endif//CARDINSERTED
1060
     #endif//CARDINSERTED
1057
-    
1061
+
1058
     if (lcd_next_update_millis < millis())
1062
     if (lcd_next_update_millis < millis())
1059
     {
1063
     {
1060
 #ifdef ULTIPANEL
1064
 #ifdef ULTIPANEL
1095
 #ifdef DOGLCD        // Changes due to different driver architecture of the DOGM display
1099
 #ifdef DOGLCD        // Changes due to different driver architecture of the DOGM display
1096
         blink++;     // Variable for fan animation and alive dot
1100
         blink++;     // Variable for fan animation and alive dot
1097
         u8g.firstPage();
1101
         u8g.firstPage();
1098
-        do 
1102
+        do
1099
         {
1103
         {
1100
             u8g.setFont(u8g_font_6x10_marlin);
1104
             u8g.setFont(u8g_font_6x10_marlin);
1101
             u8g.setPrintPos(125,0);
1105
             u8g.setPrintPos(125,0);
1105
             (*currentMenu)();
1109
             (*currentMenu)();
1106
             if (!lcdDrawUpdate)  break; // Terminate display update, when nothing new to draw. This must be done before the last dogm.next()
1110
             if (!lcdDrawUpdate)  break; // Terminate display update, when nothing new to draw. This must be done before the last dogm.next()
1107
         } while( u8g.nextPage() );
1111
         } while( u8g.nextPage() );
1108
-#else        
1112
+#else
1109
         (*currentMenu)();
1113
         (*currentMenu)();
1110
 #endif
1114
 #endif
1111
 
1115
 
1159
 void lcd_setcontrast(uint8_t value)
1163
 void lcd_setcontrast(uint8_t value)
1160
 {
1164
 {
1161
     lcd_contrast = value & 63;
1165
     lcd_contrast = value & 63;
1162
-    u8g.setContrast(lcd_contrast);	
1166
+    u8g.setContrast(lcd_contrast);
1163
 }
1167
 }
1164
 #endif
1168
 #endif
1165
 
1169
 
1199
     WRITE(SHIFT_LD,HIGH);
1203
     WRITE(SHIFT_LD,HIGH);
1200
     unsigned char tmp_buttons=0;
1204
     unsigned char tmp_buttons=0;
1201
     for(int8_t i=0;i<8;i++)
1205
     for(int8_t i=0;i<8;i++)
1202
-    { 
1206
+    {
1203
         newbutton = newbutton>>1;
1207
         newbutton = newbutton>>1;
1204
         if(READ(SHIFT_OUT))
1208
         if(READ(SHIFT_OUT))
1205
             newbutton|=(1<<7);
1209
             newbutton|=(1<<7);
1249
 }
1253
 }
1250
 
1254
 
1251
 void lcd_buzz(long duration, uint16_t freq)
1255
 void lcd_buzz(long duration, uint16_t freq)
1252
-{ 
1256
+{
1253
 #ifdef LCD_USE_I2C_BUZZER
1257
 #ifdef LCD_USE_I2C_BUZZER
1254
   lcd.buzz(duration,freq);
1258
   lcd.buzz(duration,freq);
1255
-#endif   
1259
+#endif
1256
 }
1260
 }
1257
 
1261
 
1258
-bool lcd_clicked() 
1259
-{ 
1262
+bool lcd_clicked()
1263
+{
1260
   return LCD_CLICKED;
1264
   return LCD_CLICKED;
1261
 }
1265
 }
1262
 #endif//ULTIPANEL
1266
 #endif//ULTIPANEL

Loading…
Cancel
Save