build and board info into critical error message

This commit is contained in:
rusefi 2020-05-22 16:45:13 -04:00
parent 83573aa1b1
commit 160d034635
2 changed files with 8 additions and 1 deletions

View File

@ -36,5 +36,5 @@ EFI_CONSOLE_TTL_PINS = -DEFI_CONSOLE_TX_BRAIN_PIN=GPIOG_14 -DEFI_CONSOLE_RX_BRAI
# Add them all together
DDEFS += $(MCU_DEFS) -DEFI_USE_OSC=TRUE -DFIRMWARE_ID=\"microRusEfi\" $(DEFAULT_ENGINE_TYPE) $(LED_CRITICAL_ERROR_BRAIN_PIN) $(EFI_CONSOLE_TTL_PINS)
DDEFS += $(MCU_DEFS) -DEFI_USE_OSC=TRUE -DFIRMWARE_ID=\"microRusEFI\" $(DEFAULT_ENGINE_TYPE) $(LED_CRITICAL_ERROR_BRAIN_PIN) $(EFI_CONSOLE_TTL_PINS)

View File

@ -253,6 +253,13 @@ void firmwareError(obd_code_e code, const char *fmt, ...) {
// todo: reuse warning buffer helper method
errorState.firmwareErrorMessageStream.buffer[errorState.firmwareErrorMessageStream.eos] = 0; // need to terminate explicitly
}
int size = strlen((char*)criticalErrorMessageBuffer);
static char versionBuffer[32];
chsnprintf(versionBuffer, sizeof(versionBuffer), " %d@%s", getRusEfiVersion(), FIRMWARE_ID);
if (size + strlen(versionBuffer) < sizeof(criticalErrorMessageBuffer)) {
strcpy((char*)(criticalErrorMessageBuffer) + size, versionBuffer);
}
#else
printf("firmwareError [%s]\r\n", fmt);