From 1ddfd9817df2202b5ef217439cb8c8fc677d368e Mon Sep 17 00:00:00 2001 From: Andrey Mironov Date: Wed, 25 Jul 2018 11:37:27 +0300 Subject: [PATCH] Moved cortex header to translation unit, added stopMotors --- src/main/drivers/system_stm32f7xx.c | 2 ++ src/main/fc/fc_hardfaults.c | 6 ++++++ src/main/platform.h | 1 - 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/drivers/system_stm32f7xx.c b/src/main/drivers/system_stm32f7xx.c index b978f9c68..41c6eb2bc 100644 --- a/src/main/drivers/system_stm32f7xx.c +++ b/src/main/drivers/system_stm32f7xx.c @@ -30,6 +30,8 @@ #include "drivers/nvic.h" #include "drivers/system.h" +#include "stm32f7xx_ll_cortex.h" + #define AIRCR_VECTKEY_MASK ((uint32_t)0x05FA0000) void SystemClock_Config(void); diff --git a/src/main/fc/fc_hardfaults.c b/src/main/fc/fc_hardfaults.c index d0163d7e5..e575c4a2e 100644 --- a/src/main/fc/fc_hardfaults.c +++ b/src/main/fc/fc_hardfaults.c @@ -36,6 +36,12 @@ void MemManage_Handler(void) { LED2_ON; + // fall out of the sky + uint8_t requiredStateForMotors = SYSTEM_STATE_CONFIG_LOADED | SYSTEM_STATE_MOTORS_READY; + if ((systemState & requiredStateForMotors) == requiredStateForMotors) { + stopMotors(); + } + #ifdef USE_TRANSPONDER // prevent IR LEDs from burning out. uint8_t requiredStateForTransponder = SYSTEM_STATE_CONFIG_LOADED | SYSTEM_STATE_TRANSPONDER_ENABLED; diff --git a/src/main/platform.h b/src/main/platform.h index b7e89232e..000d0b9bc 100644 --- a/src/main/platform.h +++ b/src/main/platform.h @@ -31,7 +31,6 @@ #include "stm32f7xx_hal.h" #include "system_stm32f7xx.h" -#include "stm32f7xx_ll_cortex.h" #include "stm32f7xx_ll_spi.h" #include "stm32f7xx_ll_gpio.h" #include "stm32f7xx_ll_dma.h"