diff --git a/Firmware/LowLevel/src/main.cpp b/Firmware/LowLevel/src/main.cpp index 51bad344..0956e8fa 100644 --- a/Firmware/LowLevel/src/main.cpp +++ b/Firmware/LowLevel/src/main.cpp @@ -31,9 +31,9 @@ #define STATUS_CYCLETIME 100 // cycletime for refresh analog and digital Statusvalues #define UI_SET_LED_CYCLETIME 1000 // cycletime for refresh UI status LEDs -#define TILT_EMERGENCY_MILLIS 2500 // Time for a single wheel to be lifted in order to count as emergency. This is to filter uneven ground. -#define LIFT_EMERGENCY_MILLIS 100 // Time for both wheels to be lifted in order to count as emergency. This is to filter uneven ground. -#define BUTTON_EMERGENCY_MILLIS 20 // Time for button emergency to activate. This is to debounce the button if triggered on bumpy surfaces +#define TILT_EMERGENCY_MILLIS 2500 // Time for a single wheel to be lifted in order to count as emergency (0 disable). This is to filter uneven ground. +#define LIFT_EMERGENCY_MILLIS 100 // Time for both wheels to be lifted in order to count as emergency (0 disable). This is to filter uneven ground. +#define BUTTON_EMERGENCY_MILLIS 20 // Time for button emergency to activate. This is to debounce the button. // Define to stream debugging messages via USB // #define USB_DEBUG @@ -167,7 +167,7 @@ void updateEmergency() { button_emergency_started = 0; } - if (lift_emergency_started > 0 && (millis() - lift_emergency_started) >= LIFT_EMERGENCY_MILLIS) { + if (LIFT_EMERGENCY_MILLIS > 0 && lift_emergency_started > 0 && (millis() - lift_emergency_started) >= LIFT_EMERGENCY_MILLIS) { // Emergency bit 2 (lift wheel 1)set? if (emergency1) emergency_state |= 0b01000; @@ -186,7 +186,7 @@ void updateEmergency() { tilt_emergency_started = 0; } - if (tilt_emergency_started > 0 && (millis() - tilt_emergency_started) >= TILT_EMERGENCY_MILLIS) { + if (TILT_EMERGENCY_MILLIS > 0 && tilt_emergency_started > 0 && (millis() - tilt_emergency_started) >= TILT_EMERGENCY_MILLIS) { // Emergency bit 2 (lift wheel 1)set? if (emergency1) emergency_state |= 0b01000;