diff --git a/firmware/console/binary/tunerstudio.cpp b/firmware/console/binary/tunerstudio.cpp index 96bf14bd8a..65905afc83 100644 --- a/firmware/console/binary/tunerstudio.cpp +++ b/firmware/console/binary/tunerstudio.cpp @@ -656,12 +656,12 @@ static void handleGetText(TsChannelBase* tsChannel) { printOverallStatus(getTimeNowSeconds()); int outputSize; - char *output = swapOutputBuffers(&outputSize); + const char* output = swapOutputBuffers(&outputSize); #if EFI_SIMULATOR logMsg("get test sending [%d]\r\n", outputSize); #endif - tsChannel->writeCrcPacket(TS_RESPONSE_COMMAND_OK, reinterpret_cast(output), outputSize); + tsChannel->writeCrcPacket(TS_RESPONSE_COMMAND_OK, reinterpret_cast(output), outputSize); #if EFI_SIMULATOR logMsg("sent [%d]\r\n", outputSize); #endif diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index 83f2cee4f3..22d8401ad8 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -258,7 +258,6 @@ void updateDevConsoleState(void) { if (hasFirmwareError()) { scheduleMsg(&logger, "%s error: %s", CRITICAL_PREFIX, getFirmwareError()); warningEnabled = false; - scheduleLogging(&logger); return; } #endif /* EFI_PROD_CODE */ diff --git a/firmware/controllers/core/error_handling.cpp b/firmware/controllers/core/error_handling.cpp index 477ebe6821..92052ec180 100644 --- a/firmware/controllers/core/error_handling.cpp +++ b/firmware/controllers/core/error_handling.cpp @@ -45,8 +45,6 @@ static LoggingWithStorage logger("error handling"); EXTERN_ENGINE; -#define WARNING_PREFIX "WARNING: " - extern int warningEnabled; extern bool main_loop_started; @@ -120,11 +118,6 @@ static void printToStream(MemoryStream *stream, const char *fmt, va_list ap) { } static void printWarning(const char *fmt, va_list ap) { - logger.reset(); // todo: is 'reset' really needed here? - appendMsgPrefix(&logger); - - logger.append(WARNING_PREFIX); - printToStream(&errorState.warningStream, fmt, ap); if (CONFIG(showHumanReadableWarning)) { @@ -137,9 +130,7 @@ static void printWarning(const char *fmt, va_list ap) { #endif /* EFI_TUNER_STUDIO */ } - logger.append(warningBuffer); - logger.append(DELIMETER); - scheduleLogging(&logger); + scheduleMsg(&logger, "WARNING: %s", warningBuffer); } #else diff --git a/firmware/hw_layer/mmc_card.cpp b/firmware/hw_layer/mmc_card.cpp index 5000731870..1851ea0d9f 100644 --- a/firmware/hw_layer/mmc_card.cpp +++ b/firmware/hw_layer/mmc_card.cpp @@ -375,7 +375,6 @@ static BaseBlockDevice* initializeMmcBlockDevice() { sdStatus = SD_STATE_CONNECTING; if (mmcConnect(&MMCD1) != HAL_SUCCESS) { sdStatus = SD_STATE_NOT_CONNECTED; - warning(CUSTOM_OBD_MMC_ERROR, "Can't connect or mount MMC/SD"); UNLOCK_SD_SPI; return nullptr; } @@ -399,7 +398,6 @@ static BaseBlockDevice* initializeMmcBlockDevice() { sdStatus = SD_STATE_CONNECTING; if (sdcConnect(&EFI_SDC_DEVICE) != HAL_SUCCESS) { sdStatus = SD_STATE_NOT_CONNECTED; - warning(CUSTOM_OBD_MMC_ERROR, "Can't connect or mount MMC/SD"); return nullptr; } diff --git a/firmware/hw_layer/rtc_helper.cpp b/firmware/hw_layer/rtc_helper.cpp index b01053fc09..f225b2b0fd 100644 --- a/firmware/hw_layer/rtc_helper.cpp +++ b/firmware/hw_layer/rtc_helper.cpp @@ -144,11 +144,8 @@ void printDateTime(void) { scheduleMsg(&logger, "%D - unix time", unix_time); date_get_tm(&timp); - appendMsgPrefix(&logger); - logger.appendPrintf( "Current RTC localtime is: %04u-%02u-%02u %02u:%02u:%02u w=%d", timp.tm_year + 1900, timp.tm_mon + 1, timp.tm_mday, timp.tm_hour, + scheduleMsg(nullptr, "Current RTC localtime is: %04u-%02u-%02u %02u:%02u:%02u w=%d", timp.tm_year + 1900, timp.tm_mon + 1, timp.tm_mday, timp.tm_hour, timp.tm_min, timp.tm_sec, rtcWorks); - appendMsgPostfix(&logger); - scheduleLogging(&logger); } } diff --git a/firmware/util/loggingcentral.cpp b/firmware/util/loggingcentral.cpp index 100113bfc4..d0147fc4a7 100644 --- a/firmware/util/loggingcentral.cpp +++ b/firmware/util/loggingcentral.cpp @@ -99,7 +99,7 @@ void scheduleLogging(Logging* logging) { * this method should always be invoked from the same thread! * @return pointer to the buffer which should be print to console */ -char * swapOutputBuffers(int *actualOutputBufferSize) { +const char* swapOutputBuffers(int *actualOutputBufferSize) { #if EFI_ENABLE_ASSERTS int expectedOutputSize; #endif /* EFI_ENABLE_ASSERTS */ diff --git a/firmware/util/loggingcentral.h b/firmware/util/loggingcentral.h index 79a27c8b12..cea992e4af 100644 --- a/firmware/util/loggingcentral.h +++ b/firmware/util/loggingcentral.h @@ -8,5 +8,5 @@ class Logging; -char * swapOutputBuffers(int *actualOutputBufferSize); +const char* swapOutputBuffers(int *actualOutputBufferSize); void scheduleMsg(Logging *logging, const char *fmt, ...);