auto-sync
This commit is contained in:
parent
d031de3a2d
commit
1912c2954c
|
@ -76,6 +76,13 @@ void addWarningCode(obd_code_e code) {
|
|||
engine->engineState.lastErrorCode = code;
|
||||
}
|
||||
|
||||
// todo: move to some util file & reuse for 'firmwareError' method
|
||||
void printToStream(MemoryStream *stream, const char *fmt, va_list ap) {
|
||||
stream->eos = 0; // reset
|
||||
chvprintf((BaseSequentialStream *) stream, fmt, ap);
|
||||
stream->buffer[stream->eos] = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* OBD_PCM_Processor_Fault is the general error code for now
|
||||
*
|
||||
|
@ -100,12 +107,11 @@ bool warning(obd_code_e code, const char *fmt, ...) {
|
|||
resetLogging(&logger); // todo: is 'reset' really needed here?
|
||||
appendMsgPrefix(&logger);
|
||||
|
||||
append(&logger, WARNING_PREFIX);
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
append(&logger, WARNING_PREFIX);
|
||||
warningStream.eos = 0; // reset
|
||||
chvprintf((BaseSequentialStream *) &warningStream, fmt, ap);
|
||||
warningStream.buffer[warningStream.eos] = 0;
|
||||
printToStream(&warningStream, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
append(&logger, warningBuffer);
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
|
||||
EXTERN_ENGINE
|
||||
;
|
||||
extern bool hasFirmwareErrorFlag;
|
||||
extern char errorMessageBuffer[200];
|
||||
|
||||
static MenuItem ROOT(NULL, NULL);
|
||||
|
||||
|
@ -341,7 +343,9 @@ void updateHD44780lcd(Engine *engine) {
|
|||
fillWithSpaces();
|
||||
}
|
||||
|
||||
memcpy(buffer, getWarning(), engineConfiguration->HD44780width);
|
||||
|
||||
const char * message = hasFirmwareErrorFlag ? (char *)&errorMessageBuffer : getWarning();
|
||||
memcpy(buffer, message, engineConfiguration->HD44780width);
|
||||
buffer[engineConfiguration->HD44780width] = 0;
|
||||
lcd_HD44780_set_position(engineConfiguration->HD44780height - 1, 0);
|
||||
lcd_HD44780_print_string(buffer);
|
||||
|
|
|
@ -126,6 +126,7 @@ bool main_loop_started = false;
|
|||
static MemoryStream firmwareErrorMessageStream;
|
||||
static char panicMessage[200];
|
||||
|
||||
// todo: define custom type and fix 'extern char errorMessageBuffer[200];' horror
|
||||
uint8_t errorMessageBuffer[200];
|
||||
bool hasFirmwareErrorFlag = false;
|
||||
|
||||
|
|
Loading…
Reference in New Issue