|
@@ -290,6 +290,7 @@ void setup()
|
290
|
290
|
axis_steps_per_sqr_second[i] = max_acceleration_units_per_sq_second[i] * axis_steps_per_unit[i];
|
291
|
291
|
}
|
292
|
292
|
|
|
293
|
+
|
293
|
294
|
tp_init(); // Initialize temperature loop
|
294
|
295
|
plan_init(); // Initialize planner;
|
295
|
296
|
st_init(); // Initialize stepper;
|
|
@@ -1337,6 +1338,40 @@ void prepare_arc_move(char isclockwise) {
|
1337
|
1338
|
previous_millis_cmd = millis();
|
1338
|
1339
|
}
|
1339
|
1340
|
|
|
1341
|
+#ifdef CONTROLLERFAN_PIN
|
|
1342
|
+unsigned long lastMotor = 0; //Save the time for when a motor was turned on last
|
|
1343
|
+unsigned long lastMotorCheck = 0;
|
|
1344
|
+
|
|
1345
|
+void controllerFan()
|
|
1346
|
+{
|
|
1347
|
+ if ((millis() - lastMotorCheck) >= 2500) //Not a time critical function, so we only check every 2500ms
|
|
1348
|
+ {
|
|
1349
|
+ lastMotorCheck = millis();
|
|
1350
|
+
|
|
1351
|
+ if(!READ(X_ENABLE_PIN) || !READ(Y_ENABLE_PIN) || !READ(Z_ENABLE_PIN)
|
|
1352
|
+ #if EXTRUDERS > 2
|
|
1353
|
+ || !READ(E2_ENABLE_PIN)
|
|
1354
|
+ #endif
|
|
1355
|
+ #if EXTRUDER > 1
|
|
1356
|
+ || !READ(E2_ENABLE_PIN)
|
|
1357
|
+ #endif
|
|
1358
|
+ || !READ(E0_ENABLE_PIN)) //If any of the drivers are enabled...
|
|
1359
|
+ {
|
|
1360
|
+ lastMotor = millis(); //... set time to NOW so the fan will turn on
|
|
1361
|
+ }
|
|
1362
|
+
|
|
1363
|
+ if ((millis() - lastMotor) >= (CONTROLLERFAN_SEC*1000UL) || lastMotor == 0) //If the last time any driver was enabled, is longer since than CONTROLLERSEC...
|
|
1364
|
+ {
|
|
1365
|
+ WRITE(CONTROLLERFAN_PIN, LOW); //... turn the fan off
|
|
1366
|
+ }
|
|
1367
|
+ else
|
|
1368
|
+ {
|
|
1369
|
+ WRITE(CONTROLLERFAN_PIN, HIGH); //... turn the fan on
|
|
1370
|
+ }
|
|
1371
|
+ }
|
|
1372
|
+}
|
|
1373
|
+#endif
|
|
1374
|
+
|
1340
|
1375
|
void manage_inactivity(byte debug)
|
1341
|
1376
|
{
|
1342
|
1377
|
if( (millis() - previous_millis_cmd) > max_inactive_time )
|
|
@@ -1355,6 +1390,9 @@ void manage_inactivity(byte debug)
|
1355
|
1390
|
}
|
1356
|
1391
|
}
|
1357
|
1392
|
}
|
|
1393
|
+ #ifdef CONTROLLERFAN_PIN
|
|
1394
|
+ controllerFan(); //Check if fan should be turned on to cool stepper drivers down
|
|
1395
|
+ #endif
|
1358
|
1396
|
#ifdef EXTRUDER_RUNOUT_PREVENT
|
1359
|
1397
|
if( (millis() - previous_millis_cmd) > EXTRUDER_RUNOUT_SECONDS*1000 )
|
1360
|
1398
|
if(degHotend(active_extruder)>EXTRUDER_RUNOUT_MINTEMP)
|