Distinct runout states (#19965)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
Costas Basdekis
2020-11-11 06:39:23 +00:00
committed by GitHub
parent 3b68e44d9a
commit 0465e0ae3a
14 changed files with 202 additions and 45 deletions

View File

@ -459,18 +459,19 @@ void _O2 Endstops::report_states() {
#endif
#if HAS_FILAMENT_SENSOR
#if NUM_RUNOUT_SENSORS == 1
print_es_state(READ(FIL_RUNOUT_PIN) != FIL_RUNOUT_STATE, PSTR(STR_FILAMENT_RUNOUT_SENSOR));
print_es_state(READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE, PSTR(STR_FILAMENT_RUNOUT_SENSOR));
#else
#define _CASE_RUNOUT(N) case N: pin = FIL_RUNOUT##N##_PIN; break;
#define _CASE_RUNOUT(N) case N: pin = FIL_RUNOUT##N##_PIN; state = FIL_RUNOUT##N##_STATE; break;
LOOP_S_LE_N(i, 1, NUM_RUNOUT_SENSORS) {
pin_t pin;
uint8_t state;
switch (i) {
default: continue;
REPEAT_S(1, INCREMENT(NUM_RUNOUT_SENSORS), _CASE_RUNOUT)
}
SERIAL_ECHOPGM(STR_FILAMENT_RUNOUT_SENSOR);
if (i > 1) SERIAL_CHAR(' ', '0' + i);
print_es_state(extDigitalRead(pin) != FIL_RUNOUT_STATE);
print_es_state(extDigitalRead(pin) != state);
}
#undef _CASE_RUNOUT
#endif