|
@@ -170,10 +170,10 @@
|
170
|
170
|
// M404 - N<dia in mm> Enter the nominal filament width (3mm, 1.75mm ) or will display nominal filament width without parameters
|
171
|
171
|
// M405 - Turn on Filament Sensor extrusion control. Optional D<delay in cm> to set delay in centimeters between sensor and extruder
|
172
|
172
|
// M406 - Turn off Filament Sensor extrusion control
|
173
|
|
-// M407 - Displays measured filament diameter
|
|
173
|
+// M407 - Display measured filament diameter
|
174
|
174
|
// M500 - Store parameters in EEPROM
|
175
|
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
|
177
|
// M503 - Print the current settings (from memory not from EEPROM). Use S0 to leave off headings.
|
178
|
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
|
179
|
// M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
|
|
@@ -272,7 +272,7 @@ int fanSpeed = 0;
|
272
|
272
|
|
273
|
273
|
#endif // FWRETRACT
|
274
|
274
|
|
275
|
|
-#ifdef ULTIPANEL
|
|
275
|
+#if defined(ULTIPANEL) && HAS_POWER_SWITCH
|
276
|
276
|
bool powersupply =
|
277
|
277
|
#ifdef PS_DEFAULT_OFF
|
278
|
278
|
false
|
|
@@ -311,13 +311,13 @@ bool cancel_heatup = false;
|
311
|
311
|
|
312
|
312
|
#ifdef FILAMENT_SENSOR
|
313
|
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
|
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
|
321
|
int meas_delay_cm = MEASUREMENT_DELAY_CM; //distance delay setting
|
322
|
322
|
#endif
|
323
|
323
|
|
|
@@ -516,8 +516,8 @@ void setup_powerhold()
|
516
|
516
|
#if defined(SUICIDE_PIN) && SUICIDE_PIN > -1
|
517
|
517
|
OUT_WRITE(SUICIDE_PIN, HIGH);
|
518
|
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
|
521
|
OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
|
522
|
522
|
#else
|
523
|
523
|
OUT_WRITE(PS_ON_PIN, PS_ON_AWAKE);
|
|
@@ -1100,7 +1100,7 @@ inline void sync_plan_position() {
|
1100
|
1100
|
static void run_z_probe() {
|
1101
|
1101
|
|
1102
|
1102
|
#ifdef DELTA
|
1103
|
|
-
|
|
1103
|
+
|
1104
|
1104
|
float start_z = current_position[Z_AXIS];
|
1105
|
1105
|
long start_steps = st_get_position(Z_AXIS);
|
1106
|
1106
|
|
|
@@ -1153,7 +1153,7 @@ inline void sync_plan_position() {
|
1153
|
1153
|
current_position[Z_AXIS] = st_get_position_mm(Z_AXIS);
|
1154
|
1154
|
// make sure the planner knows where we are as it may be a bit different than we last said to move to
|
1155
|
1155
|
sync_plan_position();
|
1156
|
|
-
|
|
1156
|
+
|
1157
|
1157
|
#endif // !DELTA
|
1158
|
1158
|
}
|
1159
|
1159
|
|
|
@@ -1163,7 +1163,7 @@ inline void sync_plan_position() {
|
1163
|
1163
|
#ifdef DELTA
|
1164
|
1164
|
|
1165
|
1165
|
feedrate = XY_TRAVEL_SPEED;
|
1166
|
|
-
|
|
1166
|
+
|
1167
|
1167
|
destination[X_AXIS] = x;
|
1168
|
1168
|
destination[Y_AXIS] = y;
|
1169
|
1169
|
destination[Z_AXIS] = z;
|
|
@@ -1237,12 +1237,12 @@ inline void sync_plan_position() {
|
1237
|
1237
|
feedrate = homing_feedrate[X_AXIS]/10;
|
1238
|
1238
|
destination[X_AXIS] = 0;
|
1239
|
1239
|
prepare_move_raw();
|
1240
|
|
-
|
|
1240
|
+
|
1241
|
1241
|
// Home Y for safety
|
1242
|
1242
|
feedrate = homing_feedrate[X_AXIS]/2;
|
1243
|
1243
|
destination[Y_AXIS] = 0;
|
1244
|
1244
|
prepare_move_raw();
|
1245
|
|
-
|
|
1245
|
+
|
1246
|
1246
|
st_synchronize();
|
1247
|
1247
|
|
1248
|
1248
|
#if defined(Z_PROBE_ENDSTOP)
|
|
@@ -1250,7 +1250,7 @@ inline void sync_plan_position() {
|
1250
|
1250
|
if (z_probe_endstop) {
|
1251
|
1251
|
#else
|
1252
|
1252
|
bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
|
1253
|
|
- if (!z_min_endstop) {
|
|
1253
|
+ if (z_min_endstop) {
|
1254
|
1254
|
#endif
|
1255
|
1255
|
if (!Stopped) {
|
1256
|
1256
|
SERIAL_ERROR_START;
|
|
@@ -1261,7 +1261,7 @@ inline void sync_plan_position() {
|
1261
|
1261
|
}
|
1262
|
1262
|
|
1263
|
1263
|
#endif // Z_PROBE_ALLEN_KEY
|
1264
|
|
-
|
|
1264
|
+
|
1265
|
1265
|
}
|
1266
|
1266
|
|
1267
|
1267
|
static void retract_z_probe() {
|
|
@@ -1279,9 +1279,9 @@ inline void sync_plan_position() {
|
1279
|
1279
|
#if SERVO_LEVELING
|
1280
|
1280
|
servos[servo_endstops[Z_AXIS]].attach(0);
|
1281
|
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
|
1285
|
#if SERVO_LEVELING
|
1286
|
1286
|
delay(PROBE_SERVO_DEACTIVATION_DELAY);
|
1287
|
1287
|
servos[servo_endstops[Z_AXIS]].detach();
|
|
@@ -1305,23 +1305,23 @@ inline void sync_plan_position() {
|
1305
|
1305
|
feedrate = homing_feedrate[Z_AXIS]/10;
|
1306
|
1306
|
destination[Z_AXIS] = current_position[Z_AXIS] - Z_PROBE_ALLEN_KEY_RETRACT_DEPTH;
|
1307
|
1307
|
prepare_move_raw();
|
1308
|
|
-
|
|
1308
|
+
|
1309
|
1309
|
// Move up for safety
|
1310
|
1310
|
feedrate = homing_feedrate[Z_AXIS]/2;
|
1311
|
1311
|
destination[Z_AXIS] = current_position[Z_AXIS] + Z_PROBE_ALLEN_KEY_RETRACT_DEPTH * 2;
|
1312
|
1312
|
prepare_move_raw();
|
1313
|
|
-
|
|
1313
|
+
|
1314
|
1314
|
// Home XY for safety
|
1315
|
1315
|
feedrate = homing_feedrate[X_AXIS]/2;
|
1316
|
1316
|
destination[X_AXIS] = 0;
|
1317
|
1317
|
destination[Y_AXIS] = 0;
|
1318
|
1318
|
prepare_move_raw();
|
1319
|
|
-
|
|
1319
|
+
|
1320
|
1320
|
st_synchronize();
|
1321
|
1321
|
|
1322
|
1322
|
#if defined(Z_PROBE_ENDSTOP)
|
1323
|
1323
|
bool z_probe_endstop = (READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING);
|
1324
|
|
- if (z_probe_endstop) {
|
|
1324
|
+ if (!z_probe_endstop) {
|
1325
|
1325
|
#else
|
1326
|
1326
|
bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
|
1327
|
1327
|
if (!z_min_endstop) {
|
|
@@ -3319,7 +3319,7 @@ inline void gcode_M140() {
|
3319
|
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
|
3325
|
* M80: Turn on Power Supply
|
|
@@ -3341,10 +3341,12 @@ inline void gcode_M140() {
|
3341
|
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
|
3351
|
inline void gcode_M81() {
|
3350
|
3352
|
disable_heater();
|
|
@@ -3359,16 +3361,19 @@ inline void gcode_M81() {
|
3359
|
3361
|
#if defined(SUICIDE_PIN) && SUICIDE_PIN > -1
|
3360
|
3362
|
st_synchronize();
|
3361
|
3363
|
suicide();
|
3362
|
|
- #elif defined(PS_ON_PIN) && PS_ON_PIN > -1
|
|
3364
|
+ #elif HAS_POWER_SWITCH
|
3363
|
3365
|
OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
|
3364
|
3366
|
#endif
|
3365
|
3367
|
#ifdef ULTIPANEL
|
3366
|
|
- powersupply = false;
|
|
3368
|
+ #if HAS_POWER_SWITCH
|
|
3369
|
+ powersupply = false;
|
|
3370
|
+ #endif
|
3367
|
3371
|
LCD_MESSAGEPGM(MACHINE_NAME " " MSG_OFF ".");
|
3368
|
3372
|
lcd_update();
|
3369
|
3373
|
#endif
|
3370
|
3374
|
}
|
3371
|
3375
|
|
|
3376
|
+
|
3372
|
3377
|
/**
|
3373
|
3378
|
* M82: Set E codes absolute (default)
|
3374
|
3379
|
*/
|
|
@@ -4903,15 +4908,15 @@ void process_commands() {
|
4903
|
4908
|
#endif //HEATER_2_PIN
|
4904
|
4909
|
#endif //BARICUDA
|
4905
|
4910
|
|
4906
|
|
- #if defined(PS_ON_PIN) && PS_ON_PIN > -1
|
|
4911
|
+ #if HAS_POWER_SWITCH
|
4907
|
4912
|
|
4908
|
4913
|
case 80: // M80 - Turn on Power Supply
|
4909
|
4914
|
gcode_M80();
|
4910
|
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
|
4920
|
gcode_M81();
|
4916
|
4921
|
break;
|
4917
|
4922
|
|
|
@@ -5882,19 +5887,17 @@ void kill()
|
5882
|
5887
|
disable_e2();
|
5883
|
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
|
5894
|
SERIAL_ERROR_START;
|
5889
|
5895
|
SERIAL_ERRORLNPGM(MSG_ERR_KILLED);
|
5890
|
5896
|
LCD_ALERTMESSAGEPGM(MSG_KILLED);
|
5891
|
5897
|
|
5892
|
5898
|
// FMC small patch to update the LCD before ending
|
5893
|
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
|
5901
|
cli(); // disable interrupts
|
5899
|
5902
|
suicide();
|
5900
|
5903
|
while(1) { /* Intentionally left empty */ } // Wait for reset
|