Browse Source

Cleaning up code in prep for merge with upstream.

Chris Roadfeldt 9 years ago
parent
commit
a57862e29f

+ 0
- 1
Marlin/Configuration.h View File

330
 const bool Y_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
330
 const bool Y_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
331
 const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
331
 const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
332
 const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
332
 const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
333
-
334
 //#define DISABLE_MAX_ENDSTOPS
333
 //#define DISABLE_MAX_ENDSTOPS
335
 //#define DISABLE_MIN_ENDSTOPS
334
 //#define DISABLE_MIN_ENDSTOPS
336
 // If you want to enable the Z Probe pin, but disable its use, uncomment the line below.
335
 // If you want to enable the Z Probe pin, but disable its use, uncomment the line below.

+ 0
- 1
Marlin/Marlin.h View File

231
 extern float homing_feedrate[];
231
 extern float homing_feedrate[];
232
 extern bool axis_relative_modes[];
232
 extern bool axis_relative_modes[];
233
 extern int feedmultiply;
233
 extern int feedmultiply;
234
-extern int extrudemultiply; // Sets extrude multiply factor (in percent) for all extruders
235
 extern bool volumetric_enabled;
234
 extern bool volumetric_enabled;
236
 extern int extruder_multiply[EXTRUDERS]; // sets extrude multiply factor (in percent) for each extruder individually
235
 extern int extruder_multiply[EXTRUDERS]; // sets extrude multiply factor (in percent) for each extruder individually
237
 extern float filament_size[EXTRUDERS]; // cross-sectional area of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder.
236
 extern float filament_size[EXTRUDERS]; // cross-sectional area of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder.

+ 43
- 40
Marlin/Marlin_main.cpp View File

170
 // M404 - N<dia in mm> Enter the nominal filament width (3mm, 1.75mm ) or will display nominal filament width without parameters
170
 // M404 - N<dia in mm> Enter the nominal filament width (3mm, 1.75mm ) or will display nominal filament width without parameters
171
 // M405 - Turn on Filament Sensor extrusion control.  Optional D<delay in cm> to set delay in centimeters between sensor and extruder
171
 // M405 - Turn on Filament Sensor extrusion control.  Optional D<delay in cm> to set delay in centimeters between sensor and extruder
172
 // M406 - Turn off Filament Sensor extrusion control
172
 // M406 - Turn off Filament Sensor extrusion control
173
-// M407 - Displays measured filament diameter
173
+// M407 - Display measured filament diameter
174
 // M500 - Store parameters in EEPROM
174
 // M500 - Store parameters in EEPROM
175
 // M501 - Read parameters from EEPROM (if you need reset them after you changed them temporarily).
175
 // M501 - Read parameters from EEPROM (if you need reset them after you changed them temporarily).
176
-// M502 - Revert to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
176
+// M502 - Revert to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
177
 // M503 - Print the current settings (from memory not from EEPROM). Use S0 to leave off headings.
177
 // M503 - Print the current settings (from memory not from EEPROM). Use S0 to leave off headings.
178
 // M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
178
 // M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
179
 // M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
179
 // M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
272
 
272
 
273
 #endif // FWRETRACT
273
 #endif // FWRETRACT
274
 
274
 
275
-#ifdef ULTIPANEL
275
+#if defined(ULTIPANEL) && HAS_POWER_SWITCH
276
   bool powersupply = 
276
   bool powersupply = 
277
     #ifdef PS_DEFAULT_OFF
277
     #ifdef PS_DEFAULT_OFF
278
       false
278
       false
311
 
311
 
312
 #ifdef FILAMENT_SENSOR
312
 #ifdef FILAMENT_SENSOR
313
   //Variables for Filament Sensor input
313
   //Variables for Filament Sensor input
314
-  float filament_width_nominal=DEFAULT_NOMINAL_FILAMENT_DIA;  //Set nominal filament width, can be changed with M404
315
-  bool filament_sensor=false;  //M405 turns on filament_sensor control, M406 turns it off
316
-  float filament_width_meas=DEFAULT_MEASURED_FILAMENT_DIA; //Stores the measured filament diameter
314
+  float filament_width_nominal = DEFAULT_NOMINAL_FILAMENT_DIA;  //Set nominal filament width, can be changed with M404
315
+  bool filament_sensor = false;  //M405 turns on filament_sensor control, M406 turns it off
316
+  float filament_width_meas = DEFAULT_MEASURED_FILAMENT_DIA; //Stores the measured filament diameter
317
   signed char measurement_delay[MAX_MEASUREMENT_DELAY+1];  //ring buffer to delay measurement  store extruder factor after subtracting 100
317
   signed char measurement_delay[MAX_MEASUREMENT_DELAY+1];  //ring buffer to delay measurement  store extruder factor after subtracting 100
318
-  int delay_index1=0;  //index into ring buffer
319
-  int delay_index2=-1;  //index into ring buffer - set to -1 on startup to indicate ring buffer needs to be initialized
320
-  float delay_dist=0; //delay distance counter
318
+  int delay_index1 = 0;  //index into ring buffer
319
+  int delay_index2 = -1;  //index into ring buffer - set to -1 on startup to indicate ring buffer needs to be initialized
320
+  float delay_dist = 0; //delay distance counter
321
   int meas_delay_cm = MEASUREMENT_DELAY_CM;  //distance delay setting
321
   int meas_delay_cm = MEASUREMENT_DELAY_CM;  //distance delay setting
322
 #endif
322
 #endif
323
 
323
 
516
   #if defined(SUICIDE_PIN) && SUICIDE_PIN > -1
516
   #if defined(SUICIDE_PIN) && SUICIDE_PIN > -1
517
     OUT_WRITE(SUICIDE_PIN, HIGH);
517
     OUT_WRITE(SUICIDE_PIN, HIGH);
518
   #endif
518
   #endif
519
-  #if defined(PS_ON_PIN) && PS_ON_PIN > -1
520
-    #if defined(PS_DEFAULT_OFF)
519
+  #if HAS_POWER_SWITCH
520
+    #ifdef PS_DEFAULT_OFF
521
       OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
521
       OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
522
     #else
522
     #else
523
       OUT_WRITE(PS_ON_PIN, PS_ON_AWAKE);
523
       OUT_WRITE(PS_ON_PIN, PS_ON_AWAKE);
1100
   static void run_z_probe() {
1100
   static void run_z_probe() {
1101
 
1101
 
1102
     #ifdef DELTA
1102
     #ifdef DELTA
1103
-
1103
+    
1104
       float start_z = current_position[Z_AXIS];
1104
       float start_z = current_position[Z_AXIS];
1105
       long start_steps = st_get_position(Z_AXIS);
1105
       long start_steps = st_get_position(Z_AXIS);
1106
     
1106
     
1153
       current_position[Z_AXIS] = st_get_position_mm(Z_AXIS);
1153
       current_position[Z_AXIS] = st_get_position_mm(Z_AXIS);
1154
       // make sure the planner knows where we are as it may be a bit different than we last said to move to
1154
       // make sure the planner knows where we are as it may be a bit different than we last said to move to
1155
       sync_plan_position();
1155
       sync_plan_position();
1156
-
1156
+      
1157
     #endif // !DELTA
1157
     #endif // !DELTA
1158
   }
1158
   }
1159
 
1159
 
1163
     #ifdef DELTA
1163
     #ifdef DELTA
1164
 
1164
 
1165
       feedrate = XY_TRAVEL_SPEED;
1165
       feedrate = XY_TRAVEL_SPEED;
1166
-
1166
+      
1167
       destination[X_AXIS] = x;
1167
       destination[X_AXIS] = x;
1168
       destination[Y_AXIS] = y;
1168
       destination[Y_AXIS] = y;
1169
       destination[Z_AXIS] = z;
1169
       destination[Z_AXIS] = z;
1237
       feedrate = homing_feedrate[X_AXIS]/10;
1237
       feedrate = homing_feedrate[X_AXIS]/10;
1238
       destination[X_AXIS] = 0;
1238
       destination[X_AXIS] = 0;
1239
       prepare_move_raw();
1239
       prepare_move_raw();
1240
-
1240
+      
1241
       // Home Y for safety
1241
       // Home Y for safety
1242
       feedrate = homing_feedrate[X_AXIS]/2;
1242
       feedrate = homing_feedrate[X_AXIS]/2;
1243
       destination[Y_AXIS] = 0;
1243
       destination[Y_AXIS] = 0;
1244
       prepare_move_raw();
1244
       prepare_move_raw();
1245
-
1245
+      
1246
       st_synchronize();
1246
       st_synchronize();
1247
 
1247
 
1248
     #if defined(Z_PROBE_ENDSTOP)
1248
     #if defined(Z_PROBE_ENDSTOP)
1250
       if (z_probe_endstop) {
1250
       if (z_probe_endstop) {
1251
     #else
1251
     #else
1252
       bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
1252
       bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
1253
-      if (!z_min_endstop) {
1253
+      if (z_min_endstop) {
1254
     #endif
1254
     #endif
1255
         if (!Stopped) {
1255
         if (!Stopped) {
1256
           SERIAL_ERROR_START;
1256
           SERIAL_ERROR_START;
1261
       }
1261
       }
1262
 
1262
 
1263
     #endif // Z_PROBE_ALLEN_KEY
1263
     #endif // Z_PROBE_ALLEN_KEY
1264
-      
1264
+
1265
   }
1265
   }
1266
 
1266
 
1267
   static void retract_z_probe() {
1267
   static void retract_z_probe() {
1279
         #if SERVO_LEVELING
1279
         #if SERVO_LEVELING
1280
           servos[servo_endstops[Z_AXIS]].attach(0);
1280
           servos[servo_endstops[Z_AXIS]].attach(0);
1281
         #endif
1281
         #endif
1282
-          
1283
-          servos[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2 + 1]);
1284
-          
1282
+
1283
+        servos[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2 + 1]);
1284
+
1285
         #if SERVO_LEVELING
1285
         #if SERVO_LEVELING
1286
           delay(PROBE_SERVO_DEACTIVATION_DELAY);
1286
           delay(PROBE_SERVO_DEACTIVATION_DELAY);
1287
           servos[servo_endstops[Z_AXIS]].detach();
1287
           servos[servo_endstops[Z_AXIS]].detach();
1305
       feedrate = homing_feedrate[Z_AXIS]/10;
1305
       feedrate = homing_feedrate[Z_AXIS]/10;
1306
       destination[Z_AXIS] = current_position[Z_AXIS] - Z_PROBE_ALLEN_KEY_RETRACT_DEPTH;
1306
       destination[Z_AXIS] = current_position[Z_AXIS] - Z_PROBE_ALLEN_KEY_RETRACT_DEPTH;
1307
       prepare_move_raw();
1307
       prepare_move_raw();
1308
-
1308
+      
1309
       // Move up for safety
1309
       // Move up for safety
1310
       feedrate = homing_feedrate[Z_AXIS]/2;
1310
       feedrate = homing_feedrate[Z_AXIS]/2;
1311
       destination[Z_AXIS] = current_position[Z_AXIS] + Z_PROBE_ALLEN_KEY_RETRACT_DEPTH * 2;
1311
       destination[Z_AXIS] = current_position[Z_AXIS] + Z_PROBE_ALLEN_KEY_RETRACT_DEPTH * 2;
1312
       prepare_move_raw();
1312
       prepare_move_raw();
1313
-
1313
+      
1314
       // Home XY for safety
1314
       // Home XY for safety
1315
       feedrate = homing_feedrate[X_AXIS]/2;
1315
       feedrate = homing_feedrate[X_AXIS]/2;
1316
       destination[X_AXIS] = 0;
1316
       destination[X_AXIS] = 0;
1317
       destination[Y_AXIS] = 0;
1317
       destination[Y_AXIS] = 0;
1318
       prepare_move_raw();
1318
       prepare_move_raw();
1319
-
1319
+      
1320
       st_synchronize();
1320
       st_synchronize();
1321
 
1321
 
1322
     #if defined(Z_PROBE_ENDSTOP)
1322
     #if defined(Z_PROBE_ENDSTOP)
1323
       bool z_probe_endstop = (READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING);
1323
       bool z_probe_endstop = (READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING);
1324
-      if (z_probe_endstop) {
1324
+      if (!z_probe_endstop) {
1325
     #else
1325
     #else
1326
       bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
1326
       bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
1327
       if (!z_min_endstop) {
1327
       if (!z_min_endstop) {
3319
   if (code_seen('S')) setTargetBed(code_value());
3319
   if (code_seen('S')) setTargetBed(code_value());
3320
 }
3320
 }
3321
 
3321
 
3322
-#if defined(PS_ON_PIN) && PS_ON_PIN > -1
3322
+#if HAS_POWER_SWITCH
3323
 
3323
 
3324
   /**
3324
   /**
3325
    * M80: Turn on Power Supply
3325
    * M80: Turn on Power Supply
3341
     #endif
3341
     #endif
3342
   }
3342
   }
3343
 
3343
 
3344
-#endif // PS_ON_PIN
3344
+#endif // HAS_POWER_SWITCH
3345
 
3345
 
3346
 /**
3346
 /**
3347
- * M81: Turn off Power Supply
3347
+ * M81: Turn off Power, including Power Supply, if there is one.
3348
+ *
3349
+ *      This code should ALWAYS be available for EMERGENCY SHUTDOWN!
3348
  */
3350
  */
3349
 inline void gcode_M81() {
3351
 inline void gcode_M81() {
3350
   disable_heater();
3352
   disable_heater();
3359
   #if defined(SUICIDE_PIN) && SUICIDE_PIN > -1
3361
   #if defined(SUICIDE_PIN) && SUICIDE_PIN > -1
3360
     st_synchronize();
3362
     st_synchronize();
3361
     suicide();
3363
     suicide();
3362
-  #elif defined(PS_ON_PIN) && PS_ON_PIN > -1
3364
+  #elif HAS_POWER_SWITCH
3363
     OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
3365
     OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
3364
   #endif
3366
   #endif
3365
   #ifdef ULTIPANEL
3367
   #ifdef ULTIPANEL
3366
-    powersupply = false;
3368
+    #if HAS_POWER_SWITCH
3369
+      powersupply = false;
3370
+    #endif
3367
     LCD_MESSAGEPGM(MACHINE_NAME " " MSG_OFF ".");
3371
     LCD_MESSAGEPGM(MACHINE_NAME " " MSG_OFF ".");
3368
     lcd_update();
3372
     lcd_update();
3369
   #endif
3373
   #endif
3370
 }
3374
 }
3371
 
3375
 
3376
+
3372
 /**
3377
 /**
3373
  * M82: Set E codes absolute (default)
3378
  * M82: Set E codes absolute (default)
3374
  */
3379
  */
4903
         #endif //HEATER_2_PIN
4908
         #endif //HEATER_2_PIN
4904
       #endif //BARICUDA
4909
       #endif //BARICUDA
4905
 
4910
 
4906
-      #if defined(PS_ON_PIN) && PS_ON_PIN > -1
4911
+      #if HAS_POWER_SWITCH
4907
 
4912
 
4908
         case 80: // M80 - Turn on Power Supply
4913
         case 80: // M80 - Turn on Power Supply
4909
           gcode_M80();
4914
           gcode_M80();
4910
           break;
4915
           break;
4911
 
4916
 
4912
-      #endif // PS_ON_PIN
4917
+      #endif // HAS_POWER_SWITCH
4913
 
4918
 
4914
-      case 81: // M81 - Turn off Power Supply
4919
+      case 81: // M81 - Turn off Power, including Power Supply, if possible
4915
         gcode_M81();
4920
         gcode_M81();
4916
         break;
4921
         break;
4917
 
4922
 
5882
   disable_e2();
5887
   disable_e2();
5883
   disable_e3();
5888
   disable_e3();
5884
 
5889
 
5885
-#if defined(PS_ON_PIN) && PS_ON_PIN > -1
5886
-  pinMode(PS_ON_PIN,INPUT);
5887
-#endif
5890
+  #if HAS_POWER_SWITCH
5891
+    pinMode(PS_ON_PIN, INPUT);
5892
+  #endif
5893
+
5888
   SERIAL_ERROR_START;
5894
   SERIAL_ERROR_START;
5889
   SERIAL_ERRORLNPGM(MSG_ERR_KILLED);
5895
   SERIAL_ERRORLNPGM(MSG_ERR_KILLED);
5890
   LCD_ALERTMESSAGEPGM(MSG_KILLED);
5896
   LCD_ALERTMESSAGEPGM(MSG_KILLED);
5891
   
5897
   
5892
   // FMC small patch to update the LCD before ending
5898
   // FMC small patch to update the LCD before ending
5893
   sei();   // enable interrupts
5899
   sei();   // enable interrupts
5894
-  for ( int i=5; i--; lcd_update())
5895
-  {
5896
-     delay(200);
5897
-  }
5900
+  for (int i = 5; i--; lcd_update()) delay(200); // Wait a short time
5898
   cli();   // disable interrupts
5901
   cli();   // disable interrupts
5899
   suicide();
5902
   suicide();
5900
   while(1) { /* Intentionally left empty */ } // Wait for reset
5903
   while(1) { /* Intentionally left empty */ } // Wait for reset

+ 1
- 1
Marlin/dogm_lcd_implementation.h View File

369
       lcd_printPGM(PSTR("dia:"));
369
       lcd_printPGM(PSTR("dia:"));
370
       lcd_print(ftostr12ns(filament_width_meas));
370
       lcd_print(ftostr12ns(filament_width_meas));
371
       lcd_printPGM(PSTR(" factor:"));
371
       lcd_printPGM(PSTR(" factor:"));
372
-      lcd_print(itostr3(extrudemultiply));
372
+      lcd_print(itostr3(volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM]));
373
       lcd_print('%');
373
       lcd_print('%');
374
     }
374
     }
375
   #endif
375
   #endif

+ 2
- 2
Marlin/planner.cpp View File

545
   block->steps[Z_AXIS] = labs(dz);
545
   block->steps[Z_AXIS] = labs(dz);
546
   block->steps[E_AXIS] = labs(de);
546
   block->steps[E_AXIS] = labs(de);
547
   block->steps[E_AXIS] *= volumetric_multiplier[active_extruder];
547
   block->steps[E_AXIS] *= volumetric_multiplier[active_extruder];
548
-  block->steps[E_AXIS] *= extrudemultiply;
548
+  block->steps[E_AXIS] *= extruder_multiply[active_extruder];
549
   block->steps[E_AXIS] /= 100;
549
   block->steps[E_AXIS] /= 100;
550
   block->step_event_count = max(block->steps[X_AXIS], max(block->steps[Y_AXIS], max(block->steps[Z_AXIS], block->steps[E_AXIS])));
550
   block->step_event_count = max(block->steps[X_AXIS], max(block->steps[Y_AXIS], max(block->steps[Z_AXIS], block->steps[E_AXIS])));
551
 
551
 
679
     delta_mm[Y_AXIS] = dy / axis_steps_per_unit[Y_AXIS];
679
     delta_mm[Y_AXIS] = dy / axis_steps_per_unit[Y_AXIS];
680
   #endif
680
   #endif
681
   delta_mm[Z_AXIS] = dz / axis_steps_per_unit[Z_AXIS];
681
   delta_mm[Z_AXIS] = dz / axis_steps_per_unit[Z_AXIS];
682
-  delta_mm[E_AXIS] = (de / axis_steps_per_unit[E_AXIS]) * volumetric_multiplier[active_extruder] * extrudemultiply / 100.0;
682
+  delta_mm[E_AXIS] = (de / axis_steps_per_unit[E_AXIS]) * volumetric_multiplier[active_extruder] * extruder_multiply[active_extruder] / 100.0;
683
 
683
 
684
   if (block->steps[X_AXIS] <= dropsegments && block->steps[Y_AXIS] <= dropsegments && block->steps[Z_AXIS] <= dropsegments) {
684
   if (block->steps[X_AXIS] <= dropsegments && block->steps[Y_AXIS] <= dropsegments && block->steps[Z_AXIS] <= dropsegments) {
685
     block->millimeters = fabs(delta_mm[E_AXIS]);
685
     block->millimeters = fabs(delta_mm[E_AXIS]);

+ 70
- 46
Marlin/stepper.cpp View File

524
     }
524
     }
525
 
525
 
526
     if (TEST(out_bits, Z_AXIS)) {   // -direction
526
     if (TEST(out_bits, Z_AXIS)) {   // -direction
527
+
527
       Z_APPLY_DIR(INVERT_Z_DIR,0);
528
       Z_APPLY_DIR(INVERT_Z_DIR,0);
528
       count_direction[Z_AXIS] = -1;
529
       count_direction[Z_AXIS] = -1;
529
-      if (check_endstops) 
530
-      {
531
-        #if defined(Z_MIN_PIN) && Z_MIN_PIN > -1
532
-          #ifndef Z_DUAL_ENDSTOPS
533
-            UPDATE_ENDSTOP(z, Z, min, MIN);
534
-          #else
535
-            bool z_min_endstop=(READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
536
-            #if defined(Z2_MIN_PIN) && Z2_MIN_PIN > -1
537
-              bool z2_min_endstop=(READ(Z2_MIN_PIN) != Z2_MIN_ENDSTOP_INVERTING);
538
-            #else
539
-              bool z2_min_endstop=z_min_endstop;
540
-            #endif
541
-            if(((z_min_endstop && old_z_min_endstop) || (z2_min_endstop && old_z2_min_endstop)) && (current_block->steps[Z_AXIS] > 0))
542
-            {
530
+
531
+      if (check_endstops) {
532
+
533
+        #if defined(Z_MIN_PIN) && Z_MIN_PIN >= 0
534
+
535
+          #ifdef Z_DUAL_ENDSTOPS
536
+
537
+            bool z_min_endstop = READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING,
538
+                z2_min_endstop =
539
+                  #if defined(Z2_MIN_PIN) && Z2_MIN_PIN >= 0
540
+                    READ(Z2_MIN_PIN) != Z2_MIN_ENDSTOP_INVERTING
541
+                  #else
542
+                    z_min_endstop
543
+                  #endif
544
+                ;
545
+
546
+            bool z_min_both = z_min_endstop && old_z_min_endstop,
547
+                z2_min_both = z2_min_endstop && old_z2_min_endstop;
548
+            if ((z_min_both || z2_min_both) && current_block->steps[Z_AXIS] > 0) {
543
               endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
549
               endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
544
-              endstop_z_hit=true;
545
-              if (!(performing_homing) || ((performing_homing)&&(z_min_endstop && old_z_min_endstop)&&(z2_min_endstop && old_z2_min_endstop))) //if not performing home or if both endstops were trigged during homing...
546
-              {
550
+              endstop_z_hit = true;
551
+              if (!performing_homing || (performing_homing && z_min_both && z2_min_both)) //if not performing home or if both endstops were trigged during homing...
547
                 step_events_completed = current_block->step_event_count;
552
                 step_events_completed = current_block->step_event_count;
548
-              } 
549
             }
553
             }
550
             old_z_min_endstop = z_min_endstop;
554
             old_z_min_endstop = z_min_endstop;
551
             old_z2_min_endstop = z2_min_endstop;
555
             old_z2_min_endstop = z2_min_endstop;
552
-          #endif
553
-        #endif
556
+
557
+          #else // !Z_DUAL_ENDSTOPS
558
+
559
+            UPDATE_ENDSTOP(z, Z, min, MIN);
560
+
561
+          #endif // !Z_DUAL_ENDSTOPS
562
+
563
+        #endif // Z_MIN_PIN
554
 
564
 
555
         #ifdef Z_PROBE_ENDSTOP
565
         #ifdef Z_PROBE_ENDSTOP
556
           UPDATE_ENDSTOP(z, Z, probe, PROBE);
566
           UPDATE_ENDSTOP(z, Z, probe, PROBE);
564
           }
574
           }
565
           old_z_probe_endstop = z_probe_endstop;
575
           old_z_probe_endstop = z_probe_endstop;
566
         #endif
576
         #endif
567
-      }
577
+        
578
+      } // check_endstops
579
+
568
     }
580
     }
569
     else { // +direction
581
     else { // +direction
582
+
570
       Z_APPLY_DIR(!INVERT_Z_DIR,0);
583
       Z_APPLY_DIR(!INVERT_Z_DIR,0);
571
       count_direction[Z_AXIS] = 1;
584
       count_direction[Z_AXIS] = 1;
585
+
572
       if (check_endstops) {
586
       if (check_endstops) {
587
+
573
         #if defined(Z_MAX_PIN) && Z_MAX_PIN >= 0
588
         #if defined(Z_MAX_PIN) && Z_MAX_PIN >= 0
574
-          #ifndef Z_DUAL_ENDSTOPS
575
-            UPDATE_ENDSTOP(z, Z, max, MAX);
576
-          #else
577
-            bool z_max_endstop=(READ(Z_MAX_PIN) != Z_MAX_ENDSTOP_INVERTING);
578
-            #if defined(Z2_MAX_PIN) && Z2_MAX_PIN > -1
579
-              bool z2_max_endstop=(READ(Z2_MAX_PIN) != Z2_MAX_ENDSTOP_INVERTING);
580
-            #else
581
-              bool z2_max_endstop=z_max_endstop;
582
-            #endif
583
-            if(((z_max_endstop && old_z_max_endstop) || (z2_max_endstop && old_z2_max_endstop)) && (current_block->steps[Z_AXIS] > 0))
584
-            {
589
+
590
+          #ifdef Z_DUAL_ENDSTOPS
591
+
592
+            bool z_max_endstop = READ(Z_MAX_PIN) != Z_MAX_ENDSTOP_INVERTING,
593
+                z2_max_endstop =
594
+                  #if defined(Z2_MAX_PIN) && Z2_MAX_PIN >= 0
595
+                    READ(Z2_MAX_PIN) != Z2_MAX_ENDSTOP_INVERTING
596
+                  #else
597
+                    z_max_endstop
598
+                  #endif
599
+                ;
600
+
601
+            bool z_max_both = z_max_endstop && old_z_max_endstop,
602
+                z2_max_both = z2_max_endstop && old_z2_max_endstop;
603
+            if ((z_max_both || z2_max_both) && current_block->steps[Z_AXIS] > 0) {
585
               endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
604
               endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
586
-              endstop_z_hit=true;
605
+              endstop_z_hit = true;
587
 
606
 
588
-//              if (z_max_endstop && old_z_max_endstop) SERIAL_ECHOLN("z_max_endstop = true");
589
-//              if (z2_max_endstop && old_z2_max_endstop) SERIAL_ECHOLN("z2_max_endstop = true");
607
+             // if (z_max_both) SERIAL_ECHOLN("z_max_endstop = true");
608
+             // if (z2_max_both) SERIAL_ECHOLN("z2_max_endstop = true");
590
 
609
 
591
-            
592
-              if (!(performing_homing) || ((performing_homing)&&(z_max_endstop && old_z_max_endstop)&&(z2_max_endstop && old_z2_max_endstop))) //if not performing home or if both endstops were trigged during homing...
593
-              {
610
+              if (!performing_homing || (performing_homing && z_max_both && z2_max_both)) //if not performing home or if both endstops were trigged during homing...
594
                 step_events_completed = current_block->step_event_count;
611
                 step_events_completed = current_block->step_event_count;
595
-              } 
596
             }
612
             }
597
             old_z_max_endstop = z_max_endstop;
613
             old_z_max_endstop = z_max_endstop;
598
             old_z2_max_endstop = z2_max_endstop;
614
             old_z2_max_endstop = z2_max_endstop;
599
-          #endif
600
-        #endif
601
 
615
 
616
+          #else // !Z_DUAL_ENDSTOPS
617
+
618
+            UPDATE_ENDSTOP(z, Z, max, MAX);
619
+
620
+          #endif // !Z_DUAL_ENDSTOPS
621
+
622
+        #endif // Z_MAX_PIN
623
+        
602
         #ifdef Z_PROBE_ENDSTOP
624
         #ifdef Z_PROBE_ENDSTOP
603
           UPDATE_ENDSTOP(z, Z, probe, PROBE);
625
           UPDATE_ENDSTOP(z, Z, probe, PROBE);
604
           z_probe_endstop=(READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING);
626
           z_probe_endstop=(READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING);
610
           }
632
           }
611
           old_z_probe_endstop = z_probe_endstop;
633
           old_z_probe_endstop = z_probe_endstop;
612
         #endif
634
         #endif
613
-      }
614
-    }
635
+
636
+      } // check_endstops
637
+
638
+    } // +direction
615
 
639
 
616
     #ifndef ADVANCE
640
     #ifndef ADVANCE
617
       if (TEST(out_bits, E_AXIS)) {  // -direction
641
       if (TEST(out_bits, E_AXIS)) {  // -direction
618
         REV_E_DIR();
642
         REV_E_DIR();
619
-        count_direction[E_AXIS]=-1;
643
+        count_direction[E_AXIS] = -1;
620
       }
644
       }
621
       else { // +direction
645
       else { // +direction
622
         NORM_E_DIR();
646
         NORM_E_DIR();
623
-        count_direction[E_AXIS]=1;
647
+        count_direction[E_AXIS] = 1;
624
       }
648
       }
625
     #endif //!ADVANCE
649
     #endif //!ADVANCE
626
 
650
 
627
     // Take multiple steps per interrupt (For high speed moves)
651
     // Take multiple steps per interrupt (For high speed moves)
628
-    for (int8_t i=0; i < step_loops; i++) {
652
+    for (int8_t i = 0; i < step_loops; i++) {
629
       #ifndef AT90USB
653
       #ifndef AT90USB
630
         MSerial.checkRx(); // Check for serial chars.
654
         MSerial.checkRx(); // Check for serial chars.
631
       #endif
655
       #endif

+ 1
- 1
Marlin/ultralcd.cpp View File

491
     MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15);
491
     MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15);
492
   #endif
492
   #endif
493
   MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255);
493
   MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255);
494
-  MENU_ITEM_EDIT(int3, MSG_FLOW, &extrudemultiply, 10, 999);
494
+  MENU_ITEM_EDIT(int3, MSG_FLOW, &extruder_multiply[active_extruder], 10, 999);
495
   MENU_ITEM_EDIT(int3, MSG_FLOW MSG_F0, &extruder_multiply[0], 10, 999);
495
   MENU_ITEM_EDIT(int3, MSG_FLOW MSG_F0, &extruder_multiply[0], 10, 999);
496
   #if TEMP_SENSOR_1 != 0
496
   #if TEMP_SENSOR_1 != 0
497
     MENU_ITEM_EDIT(int3, MSG_FLOW MSG_F1, &extruder_multiply[1], 10, 999);
497
     MENU_ITEM_EDIT(int3, MSG_FLOW MSG_F1, &extruder_multiply[1], 10, 999);

+ 8
- 8
Marlin/ultralcd_implementation_hitachi_HD44780.h View File

624
 
624
 
625
 static void lcd_implementation_drawmenu_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char post_char) {
625
 static void lcd_implementation_drawmenu_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char post_char) {
626
   char c;
626
   char c;
627
-  uint8_t n = LCD_WIDTH - 1 - (LCD_WIDTH < 20 ? 1 : 2);
627
+  uint8_t n = LCD_WIDTH - 2;
628
   lcd.setCursor(0, row);
628
   lcd.setCursor(0, row);
629
   lcd.print(sel ? pre_char : ' ');
629
   lcd.print(sel ? pre_char : ' ');
630
   while ((c = pgm_read_byte(pstr)) && n > 0) {
630
   while ((c = pgm_read_byte(pstr)) && n > 0) {
633
   }
633
   }
634
   while(n--) lcd.print(' ');
634
   while(n--) lcd.print(' ');
635
   lcd.print(post_char);
635
   lcd.print(post_char);
636
-  lcd.print(' ');
637
 }
636
 }
638
 
637
 
639
 static void lcd_implementation_drawmenu_setting_edit_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char* data) {
638
 static void lcd_implementation_drawmenu_setting_edit_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char* data) {
640
   char c;
639
   char c;
641
-  uint8_t n = LCD_WIDTH - 1 - (LCD_WIDTH < 20 ? 1 : 2) - lcd_strlen(data);
640
+  uint8_t n = LCD_WIDTH - 2 - lcd_strlen(data);
642
   lcd.setCursor(0, row);
641
   lcd.setCursor(0, row);
643
   lcd.print(sel ? pre_char : ' ');
642
   lcd.print(sel ? pre_char : ' ');
644
   while ((c = pgm_read_byte(pstr)) && n > 0) {
643
   while ((c = pgm_read_byte(pstr)) && n > 0) {
651
 }
650
 }
652
 static void lcd_implementation_drawmenu_setting_edit_generic_P(bool sel, uint8_t row, const char* pstr, char pre_char, const char* data) {
651
 static void lcd_implementation_drawmenu_setting_edit_generic_P(bool sel, uint8_t row, const char* pstr, char pre_char, const char* data) {
653
   char c;
652
   char c;
654
-  uint8_t n = LCD_WIDTH - 1 - (LCD_WIDTH < 20 ? 1 : 2) - lcd_strlen_P(data);
653
+  uint8_t n = LCD_WIDTH - 2 - lcd_strlen_P(data);
655
   lcd.setCursor(0, row);
654
   lcd.setCursor(0, row);
656
   lcd.print(sel ? pre_char : ' ');
655
   lcd.print(sel ? pre_char : ' ');
657
   while ((c = pgm_read_byte(pstr)) && n > 0) {
656
   while ((c = pgm_read_byte(pstr)) && n > 0) {
688
   lcd.setCursor(1, 1);
687
   lcd.setCursor(1, 1);
689
   lcd_printPGM(pstr);
688
   lcd_printPGM(pstr);
690
   lcd.print(':');
689
   lcd.print(':');
691
-  lcd.setCursor(LCD_WIDTH - (LCD_WIDTH < 20 ? 0 : 1) - lcd_strlen(value), 1);
690
+  lcd.setCursor(LCD_WIDTH - lcd_strlen(value), 1);
692
   lcd_print(value);
691
   lcd_print(value);
693
 }
692
 }
694
 
693
 
695
-static void lcd_implementation_drawmenu_sd(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename, uint8_t concat) {
694
+static void lcd_implementation_drawmenu_sd(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename, uint8_t concat, char post_char) {
696
   char c;
695
   char c;
697
   uint8_t n = LCD_WIDTH - concat;
696
   uint8_t n = LCD_WIDTH - concat;
698
   lcd.setCursor(0, row);
697
   lcd.setCursor(0, row);
706
     filename++;
705
     filename++;
707
   }
706
   }
708
   while (n--) lcd.print(' ');
707
   while (n--) lcd.print(' ');
708
+  lcd.print(post_char);
709
 }
709
 }
710
 
710
 
711
 static void lcd_implementation_drawmenu_sdfile(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename) {
711
 static void lcd_implementation_drawmenu_sdfile(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename) {
712
-  lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 1);
712
+  lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 2, ' ');
713
 }
713
 }
714
 
714
 
715
 static void lcd_implementation_drawmenu_sddirectory(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename) {
715
 static void lcd_implementation_drawmenu_sddirectory(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename) {
716
-  lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 2);
716
+  lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 2, LCD_STR_FOLDER[0]);
717
 }
717
 }
718
 
718
 
719
 #define lcd_implementation_drawmenu_back(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0])
719
 #define lcd_implementation_drawmenu_back(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0])

Loading…
Cancel
Save