fatalErrorPin setting is not used #926
reducing configuration fragility
This commit is contained in:
parent
2818c803b5
commit
86e421e0ee
|
@ -340,10 +340,7 @@
|
||||||
|
|
||||||
#define LED_WARNING_BRAIN_PIN GPIOD_13
|
#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_BRAIN_PIN GPIOD_14
|
||||||
#define LED_ERROR_PORT GPIOD
|
|
||||||
#define LED_ERROR_PIN 14
|
|
||||||
|
|
||||||
#define EFI_WARNING_LED FALSE
|
#define EFI_WARNING_LED FALSE
|
||||||
|
|
||||||
|
|
|
@ -88,10 +88,6 @@
|
||||||
|
|
||||||
#undef LED_ERROR_BRAIN_PIN
|
#undef LED_ERROR_BRAIN_PIN
|
||||||
#define LED_ERROR_BRAIN_PIN GPIOA_13
|
#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 CONSOLE_MODE_SWITCH_PORT
|
||||||
#undef CONFIG_RESET_SWITCH_PORT
|
#undef CONFIG_RESET_SWITCH_PORT
|
||||||
|
|
|
@ -80,10 +80,6 @@
|
||||||
/* Red */
|
/* Red */
|
||||||
#undef LED_ERROR_BRAIN_PIN
|
#undef LED_ERROR_BRAIN_PIN
|
||||||
#define LED_ERROR_BRAIN_PIN GPIOG_7
|
#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 */
|
/* no console switch */
|
||||||
#undef CONSOLE_MODE_SWITCH_PORT
|
#undef CONSOLE_MODE_SWITCH_PORT
|
||||||
|
|
|
@ -380,10 +380,9 @@
|
||||||
// todo: this should be detected automatically based on pin selection
|
// todo: this should be detected automatically based on pin selection
|
||||||
#define TS_SERIAL_AF 7
|
#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_BRAIN_PIN GPIOD_14
|
||||||
#define LED_ERROR_PORT GPIOD
|
#endif
|
||||||
#define LED_ERROR_PIN 14
|
|
||||||
|
|
||||||
// USART1 -> check defined STM32_SERIAL_USE_USART1
|
// USART1 -> check defined STM32_SERIAL_USE_USART1
|
||||||
// For GPS we have USART1. We can start with PB7 USART1_RX and PB6 USART1_TX
|
// For GPS we have USART1. We can start with PB7 USART1_RX and PB6 USART1_TX
|
||||||
|
|
|
@ -107,14 +107,6 @@
|
||||||
#undef EFI_CONSOLE_RX_PIN
|
#undef EFI_CONSOLE_RX_PIN
|
||||||
#define EFI_CONSOLE_RX_PIN 9
|
#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
|
// todo: temporary ignore errors, this is a test config
|
||||||
#define EFI_PRINT_ERRORS_AS_WARNINGS TRUE
|
#define EFI_PRINT_ERRORS_AS_WARNINGS TRUE
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,20 @@ char *getFirmwareError(void) {
|
||||||
return (char*) errorMessageBuffer;
|
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
|
#if EFI_SIMULATOR || EFI_PROD_CODE
|
||||||
|
|
||||||
void chDbgPanic3(const char *msg, const char * file, int line) {
|
void chDbgPanic3(const char *msg, const char * file, int line) {
|
||||||
|
|
|
@ -478,8 +478,15 @@ void OutputPin::initPin(const char *msg, brain_pin_e brainPin, const pin_output_
|
||||||
|
|
||||||
#if EFI_GPIO_HARDWARE
|
#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) {
|
void initPrimaryPins(void) {
|
||||||
enginePins.errorLedPin.initPin("led: ERROR status", LED_ERROR_BRAIN_PIN);
|
enginePins.errorLedPin.initPin("led: ERROR status", LED_ERROR_BRAIN_PIN);
|
||||||
|
errorLedPort = getHwPort("primary", LED_ERROR_BRAIN_PIN);
|
||||||
|
errorLedPin = getHwPin("primary", LED_ERROR_BRAIN_PIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -97,14 +97,6 @@ typedef unsigned int time_t;
|
||||||
#define CCM_OPTIONAL
|
#define CCM_OPTIONAL
|
||||||
#endif /* EFI_USE_CCM */
|
#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())
|
#define getCurrentRemainingStack() getRemainingStack(chThdGetSelfX())
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
Loading…
Reference in New Issue