fatalErrorPin setting is not used #926

reducing configuration fragility
This commit is contained in:
rusefi 2019-09-09 21:44:48 -04:00
parent 2818c803b5
commit 86e421e0ee
8 changed files with 23 additions and 30 deletions

View File

@ -340,10 +340,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 FALSE

View File

@ -88,10 +88,6 @@
#undef LED_ERROR_BRAIN_PIN
#define LED_ERROR_BRAIN_PIN GPIOA_13
#undef LED_ERROR_PORT
#define LED_ERROR_PORT GPIOA
#undef LED_ERROR_PIN
#define LED_ERROR_PIN 13
#undef CONSOLE_MODE_SWITCH_PORT
#undef CONFIG_RESET_SWITCH_PORT

View File

@ -80,10 +80,6 @@
/* Red */
#undef LED_ERROR_BRAIN_PIN
#define LED_ERROR_BRAIN_PIN GPIOG_7
#undef LED_ERROR_PORT
#define LED_ERROR_PORT GPIOG
#undef LED_ERROR_PIN
#define LED_ERROR_PIN 7
/* no console switch */
#undef CONSOLE_MODE_SWITCH_PORT

View File

@ -380,10 +380,9 @@
// todo: this should be detected automatically based on pin selection
#define TS_SERIAL_AF 7
// LED_ERROR_BRAIN_PIN should match LED_ERROR_PORT/LED_ERROR_PIN
#ifndef LED_ERROR_BRAIN_PIN
#define LED_ERROR_BRAIN_PIN GPIOD_14
#define LED_ERROR_PORT GPIOD
#define LED_ERROR_PIN 14
#endif
// USART1 -> check defined STM32_SERIAL_USE_USART1
// For GPS we have USART1. We can start with PB7 USART1_RX and PB6 USART1_TX

View File

@ -107,14 +107,6 @@
#undef EFI_CONSOLE_RX_PIN
#define EFI_CONSOLE_RX_PIN 9
// LED_ERROR_BRAIN_PIN should match LED_ERROR_PORT/LED_ERROR_PIN
#undef LED_ERROR_BRAIN_PIN
#define LED_ERROR_BRAIN_PIN GPIOB_14
#undef LED_ERROR_PORT
#define LED_ERROR_PORT GPIOB
#undef LED_ERROR_PIN
#define LED_ERROR_PIN 14
// todo: temporary ignore errors, this is a test config
#define EFI_PRINT_ERRORS_AS_WARNINGS TRUE

View File

@ -44,6 +44,20 @@ char *getFirmwareError(void) {
return (char*) errorMessageBuffer;
}
#if EFI_PROD_CODE
extern ioportid_t errorLedPort;
extern ioportmask_t errorLedPin;
/**
* low-level function is used here to reduce stack usage
*/
#define ON_FATAL_ERROR() \
palWritePad(errorLedPort, errorLedPin, 1); \
turnAllPinsOff(); \
enginePins.communicationLedPin.setValue(1);
#endif /* EFI_PROD_CODE */
#if EFI_SIMULATOR || EFI_PROD_CODE
void chDbgPanic3(const char *msg, const char * file, int line) {

View File

@ -478,8 +478,15 @@ void OutputPin::initPin(const char *msg, brain_pin_e brainPin, const pin_output_
#if EFI_GPIO_HARDWARE
// questionable trick: we avoid using 'getHwPort' and 'getHwPin' in case of errors in order to increase the changes of turning the LED
// by reducing stack requirment
ioportid_t errorLedPort;
ioportmask_t errorLedPin;
void initPrimaryPins(void) {
enginePins.errorLedPin.initPin("led: ERROR status", LED_ERROR_BRAIN_PIN);
errorLedPort = getHwPort("primary", LED_ERROR_BRAIN_PIN);
errorLedPin = getHwPin("primary", LED_ERROR_BRAIN_PIN);
}
/**

View File

@ -97,14 +97,6 @@ typedef unsigned int time_t;
#define CCM_OPTIONAL
#endif /* EFI_USE_CCM */
/**
* low-level function is used here to reduce stack usage
*/
#define ON_FATAL_ERROR() \
palWritePad(LED_ERROR_PORT, LED_ERROR_PIN, 1); \
turnAllPinsOff(); \
enginePins.communicationLedPin.setValue(1);
#define getCurrentRemainingStack() getRemainingStack(chThdGetSelfX())
#ifdef __cplusplus