diff --git a/firmware/controllers/core/table_helper.h b/firmware/controllers/core/table_helper.h index 5da12ef0f9..651cd823b9 100644 --- a/firmware/controllers/core/table_helper.h +++ b/firmware/controllers/core/table_helper.h @@ -70,6 +70,10 @@ template void Map3D::init(float table[RPM_BIN_SIZE][LOAD_BIN_SIZE], float loadBins[LOAD_BIN_SIZE], float rpmBins[RPM_BIN_SIZE]) { + // this method cannot use logger because it's invoked before everything + // that's because this method needs to be invoked before initial configuration processing + // and initial configuration load is done prior to logging initialization + for (int k = 0; k < LOAD_BIN_SIZE; k++) { pointers[k] = table[k]; } @@ -92,7 +96,7 @@ float Map3D::getValue(float xRpm, float y) { template Map3D::Map3D(const char *name) { this->name = name; - initialized = 0; + initialized = false; memset(&pointers, 0, sizeof(pointers)); loadBins = NULL; rpmBins = NULL; diff --git a/firmware/controllers/flash_main.cpp b/firmware/controllers/flash_main.cpp index 37f742d04a..c26f4277e9 100644 --- a/firmware/controllers/flash_main.cpp +++ b/firmware/controllers/flash_main.cpp @@ -90,9 +90,6 @@ void writeToFlashNow(void) { static bool isValidCrc(persistent_config_container_s *state) { crc_t result = flashStateCrc(state); int isValidCrc_b = result == state->value; - if (!isValidCrc_b) { - scheduleMsg(logger, "CRC got %d while %d expected", result, state->value); - } return isValidCrc_b; } diff --git a/firmware/hw_layer/hardware.cpp b/firmware/hw_layer/hardware.cpp index aaf68dc2a9..41e24f9621 100644 --- a/firmware/hw_layer/hardware.cpp +++ b/firmware/hw_layer/hardware.cpp @@ -239,8 +239,6 @@ void initHardware(Logging *l) { return; } - initDataStructures(PASS_ENGINE_PARAMETER_F); - #if EFI_INTERNAL_FLASH palSetPadMode(CONFIG_RESET_SWITCH_PORT, CONFIG_RESET_SWITCH_PIN, PAL_MODE_INPUT_PULLUP); diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index 17644219ca..72d8e83d79 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -109,6 +109,7 @@ #include "status_loop.h" #include "pin_repository.h" #include "flash_main.h" +#include "algo.h" #if EFI_HD44780_LCD #include "lcd_HD44780.h" @@ -178,6 +179,11 @@ void runRusEfi(void) { initTriggerDecoderLogger(&sharedLogger); #endif + /** + * we need to initialize table objects before default configuration can set values + */ + initDataStructures(PASS_ENGINE_PARAMETER_F); + /** * First thing is reading configuration from flash memory. * In order to have complete flexibility configuration has to go before anything else. @@ -292,5 +298,5 @@ int getRusEfiVersion(void) { return 123; // this is here to make the compiler happy about the unused array if (UNUSED_CCM_SIZE[0] * 0 != 0) return 3211; // this is here to make the compiler happy about the unused array - return 20160411; + return 20160415; }