|
@@ -370,6 +370,10 @@ bool cancel_heatup = false;
|
370
|
370
|
int meas_delay_cm = MEASUREMENT_DELAY_CM; //distance delay setting
|
371
|
371
|
#endif
|
372
|
372
|
|
|
373
|
+#ifdef FILAMENT_RUNOUT_SENSOR
|
|
374
|
+ static bool filrunoutEnqued = false;
|
|
375
|
+#endif
|
|
376
|
+
|
373
|
377
|
const char errormagic[] PROGMEM = "Error:";
|
374
|
378
|
const char echomagic[] PROGMEM = "echo:";
|
375
|
379
|
|
|
@@ -529,6 +533,16 @@ void setup_killpin()
|
529
|
533
|
#endif
|
530
|
534
|
}
|
531
|
535
|
|
|
536
|
+void setup_filrunoutpin()
|
|
537
|
+{
|
|
538
|
+#if defined(FILRUNOUT_PIN) && FILRUNOUT_PIN > -1
|
|
539
|
+ pinMode(FILRUNOUT_PIN,INPUT);
|
|
540
|
+ #if defined(ENDSTOPPULLUP_FIL_RUNOUT)
|
|
541
|
+ WRITE(FILLRUNOUT_PIN,HIGH);
|
|
542
|
+ #endif
|
|
543
|
+#endif
|
|
544
|
+}
|
|
545
|
+
|
532
|
546
|
// Set home pin
|
533
|
547
|
void setup_homepin(void)
|
534
|
548
|
{
|
|
@@ -605,6 +619,7 @@ void servo_init()
|
605
|
619
|
void setup()
|
606
|
620
|
{
|
607
|
621
|
setup_killpin();
|
|
622
|
+ setup_filrunoutpin();
|
608
|
623
|
setup_powerhold();
|
609
|
624
|
MYSERIAL.begin(BAUDRATE);
|
610
|
625
|
SERIAL_PROTOCOLLNPGM("start");
|
|
@@ -4136,6 +4151,11 @@ inline void gcode_M503() {
|
4136
|
4151
|
plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], target[E_AXIS], fr60, active_extruder); //move z back
|
4137
|
4152
|
plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], lastpos[E_AXIS], fr60, active_extruder); //final untretract
|
4138
|
4153
|
#endif
|
|
4154
|
+
|
|
4155
|
+ #ifdef FILAMENT_RUNOUT_SENSOR
|
|
4156
|
+ filrunoutEnqued = false;
|
|
4157
|
+ #endif
|
|
4158
|
+
|
4139
|
4159
|
}
|
4140
|
4160
|
|
4141
|
4161
|
#endif // FILAMENTCHANGEENABLE
|
|
@@ -5275,6 +5295,12 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s
|
5275
|
5295
|
const int KILL_DELAY = 10000;
|
5276
|
5296
|
#endif
|
5277
|
5297
|
|
|
5298
|
+#if defined(FILRUNOUT_PIN) && FILRUNOUT_PIN > -1
|
|
5299
|
+ if(card.sdprinting) {
|
|
5300
|
+ if(!(READ(FILRUNOUT_PIN))^FIL_RUNOUT_INVERTING)
|
|
5301
|
+ filrunout(); }
|
|
5302
|
+#endif
|
|
5303
|
+
|
5278
|
5304
|
#if defined(HOME_PIN) && HOME_PIN > -1
|
5279
|
5305
|
static int homeDebounceCount = 0; // poor man's debouncing count
|
5280
|
5306
|
const int HOME_DEBOUNCE_DELAY = 10000;
|
|
@@ -5423,6 +5449,16 @@ void kill()
|
5423
|
5449
|
while(1) { /* Intentionally left empty */ } // Wait for reset
|
5424
|
5450
|
}
|
5425
|
5451
|
|
|
5452
|
+#ifdef FILAMENT_RUNOUT_SENSOR
|
|
5453
|
+ void filrunout()
|
|
5454
|
+ {
|
|
5455
|
+ if filrunoutEnqued == false {
|
|
5456
|
+ filrunoutEnqued = true;
|
|
5457
|
+ enquecommand("M600");
|
|
5458
|
+ }
|
|
5459
|
+ }
|
|
5460
|
+#endif
|
|
5461
|
+
|
5426
|
5462
|
void Stop()
|
5427
|
5463
|
{
|
5428
|
5464
|
disable_heater();
|