|
@@ -176,10 +176,8 @@ const int sensitive_pins[] = SENSITIVE_PINS; // Sensitive pin list for M42
|
176
|
176
|
|
177
|
177
|
//Inactivity shutdown variables
|
178
|
178
|
static unsigned long previous_millis_cmd = 0;
|
179
|
|
-static unsigned long previous_millis_runoutprevent = 0;
|
180
|
|
-//static unsigned long previous_millis_beep = 0;
|
181
|
|
-static unsigned long max_inactive_time=0;
|
182
|
|
-static unsigned long stepper_inactive_time = 0;
|
|
179
|
+static unsigned long max_inactive_time = 0;
|
|
180
|
+static unsigned long stepper_inactive_time = DEFAULT_STEPPER_DEACTIVE_TIME*1000;
|
183
|
181
|
static unsigned long last_stepperdisabled_time=30*1000; //first release check after 30 seconds
|
184
|
182
|
|
185
|
183
|
static unsigned long starttime=0;
|
|
@@ -245,10 +243,6 @@ void setup()
|
245
|
243
|
fromsd[i] = false;
|
246
|
244
|
}
|
247
|
245
|
|
248
|
|
- max_inactive_time = DEFAULT_MAX_INACTIVE_TIME*1000;
|
249
|
|
- stepper_inactive_time = DEFAULT_STEPPER_DEACTIVE_TIME*1000;
|
250
|
|
-
|
251
|
|
-
|
252
|
246
|
EEPROM_RetrieveSettings(); // loads data from EEPROM if available
|
253
|
247
|
|
254
|
248
|
for(int8_t i=0; i < NUM_AXIS; i++)
|
|
@@ -421,7 +415,6 @@ FORCE_INLINE void get_command()
|
421
|
415
|
SERIAL_ECHO_START;
|
422
|
416
|
SERIAL_ECHOLN(time);
|
423
|
417
|
LCD_MESSAGE(time);
|
424
|
|
- st_synchronize();
|
425
|
418
|
card.printingHasFinished();
|
426
|
419
|
card.checkautostart(true);
|
427
|
420
|
|
|
@@ -1207,34 +1200,11 @@ void prepare_arc_move(char isclockwise) {
|
1207
|
1200
|
|
1208
|
1201
|
void manage_inactivity(byte debug)
|
1209
|
1202
|
{
|
1210
|
|
- unsigned long curtime=millis();
|
1211
|
|
- SERIAL_ECHO_START;
|
1212
|
|
- SERIAL_ECHO("MS");
|
1213
|
|
- SERIAL_ECHO(millis());
|
1214
|
|
- SERIAL_ECHO(" PREV_CMD");
|
1215
|
|
- SERIAL_ECHO(previous_millis_cmd);
|
1216
|
|
- SERIAL_ECHO(" maxinactive");
|
1217
|
|
- SERIAL_ECHOLN(max_inactive_time );
|
1218
|
|
-
|
1219
|
|
- if( (curtime-previous_millis_cmd) > max_inactive_time )
|
|
1203
|
+ if( (millis()-previous_millis_cmd) > max_inactive_time )
|
1220
|
1204
|
if(max_inactive_time)
|
1221
|
|
- {
|
1222
|
|
- LCD_MESSAGEPGM("Bored Shutdown.");
|
1223
|
|
- SERIAL_ERROR_START;
|
1224
|
|
- SERIAL_ERRORLNPGM("Bored Shutdown.");
|
1225
|
1205
|
kill();
|
1226
|
|
- }
|
1227
|
|
-
|
1228
|
|
- if( (curtime-previous_millis_cmd) > DEFAULT_MAX_HOT_TIME*1000 )
|
1229
|
|
- if(DEFAULT_MAX_HOT_TIME && (degHotend0()>HOTTEMP) )
|
1230
|
|
- {
|
1231
|
|
- LCD_MESSAGEPGM("Hot too long.");
|
1232
|
|
- SERIAL_ECHO_START;
|
1233
|
|
- SERIAL_ECHOLNPGM("Hot too long");
|
1234
|
|
- disable_heater();
|
1235
|
|
- }
|
1236
|
1206
|
if(stepper_inactive_time)
|
1237
|
|
- if( (curtime-last_stepperdisabled_time) > stepper_inactive_time )
|
|
1207
|
+ if( (millis()-last_stepperdisabled_time) > stepper_inactive_time )
|
1238
|
1208
|
{
|
1239
|
1209
|
if(previous_millis_cmd>last_stepperdisabled_time)
|
1240
|
1210
|
last_stepperdisabled_time=previous_millis_cmd;
|
|
@@ -1246,37 +1216,23 @@ void manage_inactivity(byte debug)
|
1246
|
1216
|
}
|
1247
|
1217
|
}
|
1248
|
1218
|
#ifdef EXTRUDER_RUNOUT_PREVENT
|
1249
|
|
- if(!blocks_queued())
|
1250
|
|
- if( (curtime-previous_millis_cmd) > EXTRUDER_RUNOUT_SECONDS*1000 )
|
|
1219
|
+ if( (millis()-previous_millis_cmd) > EXTRUDER_RUNOUT_SECONDS*1000 )
|
|
1220
|
+ if(degHotend(active_extruder)>EXTRUDER_RUNOUT_MINTEMP)
|
1251
|
1221
|
{
|
1252
|
|
- if(previous_millis_cmd>previous_millis_runoutprevent)
|
1253
|
|
- {
|
1254
|
|
- previous_millis_runoutprevent=previous_millis_cmd;
|
1255
|
|
- }
|
1256
|
|
-
|
1257
|
|
- if(degHotend0()>EXTRUDER_RUNOUT_MINTEMP)
|
1258
|
|
- if((curtime-previous_millis_runoutprevent) > EXTRUDER_RUNOUT_SECONDS*1000)
|
1259
|
|
- {
|
1260
|
|
- bool oldstatus=READ(E_ENABLE_PIN);
|
1261
|
|
- enable_e();
|
1262
|
|
- float oldepos=current_position[E_AXIS];
|
1263
|
|
- float oldedes=destination[E_AXIS];
|
1264
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS],
|
1265
|
|
- current_position[E_AXIS]+EXTRUDER_RUNOUT_EXTRUDE*EXTRUDER_RUNOUT_ESTEPS/axis_steps_per_unit[E_AXIS],
|
1266
|
|
- EXTRUDER_RUNOUT_SPEED/60.*EXTRUDER_RUNOUT_ESTEPS/axis_steps_per_unit[E_AXIS], active_extruder);
|
1267
|
|
- current_position[E_AXIS]=oldepos;
|
1268
|
|
- destination[E_AXIS]=oldedes;
|
1269
|
|
- plan_set_e_position(oldepos);
|
1270
|
|
-
|
1271
|
|
- while(current_block!=NULL || blocks_queued())
|
1272
|
|
- {
|
1273
|
|
- manage_heater();
|
1274
|
|
- LCD_STATUS;
|
1275
|
|
- }
|
1276
|
|
-
|
1277
|
|
- previous_millis_runoutprevent=millis();
|
1278
|
|
- WRITE(E_ENABLE_PIN,oldstatus);
|
1279
|
|
- }
|
|
1222
|
+ bool oldstatus=READ(E_ENABLE_PIN);
|
|
1223
|
+ enable_e();
|
|
1224
|
+ float oldepos=current_position[E_AXIS];
|
|
1225
|
+ float oldedes=destination[E_AXIS];
|
|
1226
|
+ plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS],
|
|
1227
|
+ current_position[E_AXIS]+EXTRUDER_RUNOUT_EXTRUDE*EXTRUDER_RUNOUT_ESTEPS/axis_steps_per_unit[E_AXIS],
|
|
1228
|
+ EXTRUDER_RUNOUT_SPEED/60.*EXTRUDER_RUNOUT_ESTEPS/axis_steps_per_unit[E_AXIS], active_extruder);
|
|
1229
|
+ current_position[E_AXIS]=oldepos;
|
|
1230
|
+ destination[E_AXIS]=oldedes;
|
|
1231
|
+ plan_set_e_position(oldepos);
|
|
1232
|
+ previous_millis_cmd=millis();
|
|
1233
|
+ //enquecommand(DEFAULT_STEPPER_DEACTIVE_COMMAND);
|
|
1234
|
+ st_synchronize();
|
|
1235
|
+ WRITE(E_ENABLE_PIN,oldstatus);
|
1280
|
1236
|
}
|
1281
|
1237
|
#endif
|
1282
|
1238
|
check_axes_activity();
|
|
@@ -1291,7 +1247,7 @@ void kill()
|
1291
|
1247
|
disable_z();
|
1292
|
1248
|
disable_e();
|
1293
|
1249
|
|
1294
|
|
- if(PS_ON_PIN > -1) pinMode(PS_ON_PIN,INPUT); //Turn powersupply off
|
|
1250
|
+ if(PS_ON_PIN > -1) pinMode(PS_ON_PIN,INPUT);
|
1295
|
1251
|
SERIAL_ERROR_START;
|
1296
|
1252
|
SERIAL_ERRORLNPGM("Printer halted. kill() called !!");
|
1297
|
1253
|
LCD_MESSAGEPGM("KILLED. ");
|