From e938372a4b071f97b082a30709d668b8082a3c50 Mon Sep 17 00:00:00 2001 From: dron0gus Date: Fri, 12 Apr 2019 00:33:33 +0300 Subject: [PATCH] Cleanup 3 (#745) * status leds: pick warning LED pin from configuration * wave analyzer: do not init if no pin assigned --- firmware/config/boards/prometheus/efifeatures.h | 6 ------ firmware/config/stm32f4ems/efifeatures.h | 4 ---- firmware/config/stm32f7ems/efifeatures.h | 3 --- firmware/console/status_loop.cpp | 5 +---- firmware/development/wave_analyzer.cpp | 3 +++ 5 files changed, 4 insertions(+), 17 deletions(-) diff --git a/firmware/config/boards/prometheus/efifeatures.h b/firmware/config/boards/prometheus/efifeatures.h index 755bc91ced..c6ab72efec 100644 --- a/firmware/config/boards/prometheus/efifeatures.h +++ b/firmware/config/boards/prometheus/efifeatures.h @@ -70,9 +70,6 @@ #undef TS_SERIAL_AF #define TS_SERIAL_AF 8 -#undef LED_WARNING_BRAIN_PIN -#define LED_WARNING_BRAIN_PIN GPIOA_13 - #undef LED_ERROR_BRAIN_PIN #define LED_ERROR_BRAIN_PIN GPIOA_13 #undef LED_ERROR_PORT @@ -80,9 +77,6 @@ #undef LED_ERROR_PIN #define LED_ERROR_PIN 13 -#undef EFI_WARNING_LED -#define EFI_WARNING_LED FALSE - #undef CONSOLE_MODE_SWITCH_PORT #define CONSOLE_MODE_SWITCH_PORT GPIOE // ??? diff --git a/firmware/config/stm32f4ems/efifeatures.h b/firmware/config/stm32f4ems/efifeatures.h index a0ad22ae37..d1676a9be0 100644 --- a/firmware/config/stm32f4ems/efifeatures.h +++ b/firmware/config/stm32f4ems/efifeatures.h @@ -348,15 +348,11 @@ // todo: this should be detected automatically based on pin selection #define TS_SERIAL_AF 7 -#define LED_WARNING_BRAIN_PIN GPIOD_13 - // LED_ERROR_BRAIN_PIN should match LED_ERROR_PORT/LED_ERROR_PIN #define LED_ERROR_BRAIN_PIN GPIOD_14 #define LED_ERROR_PORT GPIOD #define LED_ERROR_PIN 14 -#define EFI_WARNING_LED TRUE - // USART1 -> check defined STM32_SERIAL_USE_USART1 // For GPS we have USART1. We can start with PB7 USART1_RX and PB6 USART1_TX #define GPS_SERIAL_DEVICE &SD1 diff --git a/firmware/config/stm32f7ems/efifeatures.h b/firmware/config/stm32f7ems/efifeatures.h index 29390e43b1..49669c67b9 100644 --- a/firmware/config/stm32f7ems/efifeatures.h +++ b/firmware/config/stm32f7ems/efifeatures.h @@ -95,9 +95,6 @@ #undef EFI_CONSOLE_RX_PIN #define EFI_CONSOLE_RX_PIN 9 -#undef LED_WARNING_BRAIN_PIN -#define LED_WARNING_BRAIN_PIN GPIOD_13 - // LED_ERROR_BRAIN_PIN should match LED_ERROR_PORT/LED_ERROR_PIN #undef LED_ERROR_BRAIN_PIN #define LED_ERROR_BRAIN_PIN GPIOB_14 diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index 166b5a7f8d..f0574125d6 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -550,11 +550,8 @@ static void initStatusLeds(void) { // we initialize this here so that we can blink it on start-up enginePins.checkEnginePin.initPin("MalfunctionIndicator", CONFIGB(malfunctionIndicatorPin), &CONFIGB(malfunctionIndicatorPinMode)); - -#if EFI_WARNING_LED || defined(__DOXYGEN__) - enginePins.warningLedPin.initPin("led: warning status", LED_WARNING_BRAIN_PIN); + enginePins.warningLedPin.initPin("led: warning status", engineConfiguration->warninigLedPin); enginePins.runningLedPin.initPin("led: running status", engineConfiguration->runningLedPin); -#endif /* EFI_WARNING_LED */ } /** diff --git a/firmware/development/wave_analyzer.cpp b/firmware/development/wave_analyzer.cpp index 9e5dbf100c..88c482f528 100644 --- a/firmware/development/wave_analyzer.cpp +++ b/firmware/development/wave_analyzer.cpp @@ -120,6 +120,9 @@ static void setWaveModeSilent(int index, int mode) { static void initWave(const char *name, int index) { brain_pin_e brainPin = CONFIGB(logicAnalyzerPins)[index]; + if (brainPin == GPIO_UNASSIGNED) + return; + bool mode = CONFIGB(logicAnalyzerMode)[index]; waveReaderCount++;