1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-29 23:07:42 +00:00

Fix endstop reporting inverting logic

This commit is contained in:
Scott Lahteine 2018-09-22 03:22:55 -04:00
parent e85117a6cd
commit ea29b71a3a

View File

@ -317,7 +317,7 @@ static void print_es_state(const bool is_hit, const char * const label=NULL) {
void _O2 Endstops::M119() { void _O2 Endstops::M119() {
SERIAL_PROTOCOLLNPGM(MSG_M119_REPORT); SERIAL_PROTOCOLLNPGM(MSG_M119_REPORT);
#define ES_REPORT(S) print_es_state(READ(S##_PIN) == S##_ENDSTOP_INVERTING, PSTR(MSG_##S)) #define ES_REPORT(S) print_es_state(READ(S##_PIN) != S##_ENDSTOP_INVERTING, PSTR(MSG_##S))
#if HAS_X_MIN #if HAS_X_MIN
ES_REPORT(X_MIN); ES_REPORT(X_MIN);
#endif #endif
@ -355,12 +355,12 @@ void _O2 Endstops::M119() {
ES_REPORT(Z2_MAX); ES_REPORT(Z2_MAX);
#endif #endif
#if ENABLED(Z_MIN_PROBE_ENDSTOP) #if ENABLED(Z_MIN_PROBE_ENDSTOP)
print_es_state(READ(Z_MIN_PROBE_PIN) == Z_MIN_PROBE_ENDSTOP_INVERTING, PSTR(MSG_Z_PROBE)); print_es_state(READ(Z_MIN_PROBE_PIN) != Z_MIN_PROBE_ENDSTOP_INVERTING, PSTR(MSG_Z_PROBE));
#endif #endif
#if ENABLED(FILAMENT_RUNOUT_SENSOR) #if ENABLED(FILAMENT_RUNOUT_SENSOR)
#define FRS_COUNT (1 + PIN_EXISTS(FIL_RUNOUT2) + PIN_EXISTS(FIL_RUNOUT3) + PIN_EXISTS(FIL_RUNOUT4) + PIN_EXISTS(FIL_RUNOUT5)) #define FRS_COUNT (1 + PIN_EXISTS(FIL_RUNOUT2) + PIN_EXISTS(FIL_RUNOUT3) + PIN_EXISTS(FIL_RUNOUT4) + PIN_EXISTS(FIL_RUNOUT5))
#if FRS_COUNT == 1 #if FRS_COUNT == 1
print_es_state(READ(FIL_RUNOUT_PIN) == FIL_RUNOUT_INVERTING, MSG_FILAMENT_RUNOUT_SENSOR); print_es_state(READ(FIL_RUNOUT_PIN) != FIL_RUNOUT_INVERTING, MSG_FILAMENT_RUNOUT_SENSOR);
#else #else
for (uint8_t i = 1; i <= for (uint8_t i = 1; i <=
#if FRS_COUNT == 5 #if FRS_COUNT == 5
@ -393,7 +393,7 @@ void _O2 Endstops::M119() {
} }
SERIAL_PROTOCOLPGM(MSG_FILAMENT_RUNOUT_SENSOR); SERIAL_PROTOCOLPGM(MSG_FILAMENT_RUNOUT_SENSOR);
if (i > 1) { SERIAL_CHAR(' '); SERIAL_CHAR('0' + i); } if (i > 1) { SERIAL_CHAR(' '); SERIAL_CHAR('0' + i); }
print_es_state(digitalRead(pin) == FIL_RUNOUT_INVERTING); print_es_state(digitalRead(pin) != FIL_RUNOUT_INVERTING);
} }
#endif #endif
#endif #endif