From 7f395d0b2ddede0c56cad46e9f32b362afc6a94f Mon Sep 17 00:00:00 2001 From: Yannick Richter Date: Fri, 26 Apr 2024 14:54:45 +0200 Subject: [PATCH] estop checked after startup --- .../FFBoard/UserExtensions/Src/FFBHIDMain.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Firmware/FFBoard/UserExtensions/Src/FFBHIDMain.cpp b/Firmware/FFBoard/UserExtensions/Src/FFBHIDMain.cpp index ab0297da..ecd4e111 100644 --- a/Firmware/FFBoard/UserExtensions/Src/FFBHIDMain.cpp +++ b/Firmware/FFBoard/UserExtensions/Src/FFBHIDMain.cpp @@ -75,15 +75,6 @@ FFBHIDMain::FFBHIDMain(uint8_t axisCount) : restoreFlash(); // Load parameters registerCommands(); - -#ifdef E_STOP_Pin - bool estopState = HAL_GPIO_ReadPin(E_STOP_GPIO_Port, E_STOP_Pin) == GPIO_PIN_RESET; - if(estopState){ // Estop pressed at startup - emergencyStop(!estopState); - lastEstop = HAL_GetTick(); - } -#endif - } /** @@ -138,6 +129,14 @@ void FFBHIDMain::saveFlash(){ void FFBHIDMain::Run(){ +#ifdef E_STOP_Pin + bool estopState = HAL_GPIO_ReadPin(E_STOP_GPIO_Port, E_STOP_Pin) == GPIO_PIN_RESET; + if(estopState){ // Estop pressed at startup + emergencyStop(!estopState); +// control.emergency = true; // Immediately enter emergency state but without notifying other classes yet + lastEstop = HAL_GetTick(); + } +#endif while(true){ Delay(1); updateControl();