|
@@ -366,6 +366,10 @@ bool cancel_heatup = false;
|
366
|
366
|
int meas_delay_cm = MEASUREMENT_DELAY_CM; //distance delay setting
|
367
|
367
|
#endif
|
368
|
368
|
|
|
369
|
+#ifdef FILAMENT_RUNOUT_SENSOR
|
|
370
|
+ static bool filrunoutEnqued = false;
|
|
371
|
+#endif
|
|
372
|
+
|
369
|
373
|
const char errormagic[] PROGMEM = "Error:";
|
370
|
374
|
const char echomagic[] PROGMEM = "echo:";
|
371
|
375
|
|
|
@@ -525,6 +529,16 @@ void setup_killpin()
|
525
|
529
|
#endif
|
526
|
530
|
}
|
527
|
531
|
|
|
532
|
+void setup_filrunoutpin()
|
|
533
|
+{
|
|
534
|
+#if defined(FILRUNOUT_PIN) && FILRUNOUT_PIN > -1
|
|
535
|
+ pinMode(FILRUNOUT_PIN,INPUT);
|
|
536
|
+ #if defined(ENDSTOPPULLUP_FIL_RUNOUT)
|
|
537
|
+ WRITE(FILLRUNOUT_PIN,HIGH);
|
|
538
|
+ #endif
|
|
539
|
+#endif
|
|
540
|
+}
|
|
541
|
+
|
528
|
542
|
// Set home pin
|
529
|
543
|
void setup_homepin(void)
|
530
|
544
|
{
|
|
@@ -601,6 +615,7 @@ void servo_init()
|
601
|
615
|
void setup()
|
602
|
616
|
{
|
603
|
617
|
setup_killpin();
|
|
618
|
+ setup_filrunoutpin();
|
604
|
619
|
setup_powerhold();
|
605
|
620
|
MYSERIAL.begin(BAUDRATE);
|
606
|
621
|
SERIAL_PROTOCOLLNPGM("start");
|
|
@@ -4091,6 +4106,11 @@ inline void gcode_M503() {
|
4091
|
4106
|
plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], target[E_AXIS], fr60, active_extruder); //move z back
|
4092
|
4107
|
plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], lastpos[E_AXIS], fr60, active_extruder); //final untretract
|
4093
|
4108
|
#endif
|
|
4109
|
+
|
|
4110
|
+ #ifdef FILAMENT_RUNOUT_SENSOR
|
|
4111
|
+ filrunoutEnqued = false;
|
|
4112
|
+ #endif
|
|
4113
|
+
|
4094
|
4114
|
}
|
4095
|
4115
|
|
4096
|
4116
|
#endif // FILAMENTCHANGEENABLE
|
|
@@ -5230,6 +5250,12 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s
|
5230
|
5250
|
const int KILL_DELAY = 10000;
|
5231
|
5251
|
#endif
|
5232
|
5252
|
|
|
5253
|
+#if defined(FILRUNOUT_PIN) && FILRUNOUT_PIN > -1
|
|
5254
|
+ if(card.sdprinting) {
|
|
5255
|
+ if(!(READ(FILRUNOUT_PIN))^FIL_RUNOUT_INVERTING)
|
|
5256
|
+ filrunout(); }
|
|
5257
|
+#endif
|
|
5258
|
+
|
5233
|
5259
|
#if defined(HOME_PIN) && HOME_PIN > -1
|
5234
|
5260
|
static int homeDebounceCount = 0; // poor man's debouncing count
|
5235
|
5261
|
const int HOME_DEBOUNCE_DELAY = 10000;
|
|
@@ -5378,6 +5404,16 @@ void kill()
|
5378
|
5404
|
while(1) { /* Intentionally left empty */ } // Wait for reset
|
5379
|
5405
|
}
|
5380
|
5406
|
|
|
5407
|
+#ifdef FILAMENT_RUNOUT_SENSOR
|
|
5408
|
+ void filrunout()
|
|
5409
|
+ {
|
|
5410
|
+ if filrunoutEnqued == false {
|
|
5411
|
+ filrunoutEnqued = true;
|
|
5412
|
+ enquecommand("M600");
|
|
5413
|
+ }
|
|
5414
|
+ }
|
|
5415
|
+#endif
|
|
5416
|
+
|
5381
|
5417
|
void Stop()
|
5382
|
5418
|
{
|
5383
|
5419
|
disable_heater();
|