From 0783b1fe25e6e92a61af69cde2fb2cde8c1e9647 Mon Sep 17 00:00:00 2001 From: Ollie Walsh Date: Mon, 7 Aug 2023 10:58:05 +0100 Subject: [PATCH] Allow TILT/LIFT emergency to be disabled completely --- Firmware/LowLevel/src/main.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Firmware/LowLevel/src/main.cpp b/Firmware/LowLevel/src/main.cpp index 806d814f..05abdff5 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;