diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index 92d53dd039..8757329c73 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -201,9 +201,9 @@ void printSensors(Logging *log, bool fileFormat) { void writeLogLine(void) { +#if EFI_FILE_LOGGING || defined(__DOXYGEN__) if (!main_loop_started) return; -#if EFI_FILE_LOGGING || defined(__DOXYGEN__) resetLogging(&fileLogger); printSensors(&fileLogger, true); diff --git a/firmware/controllers/core/table_helper.h b/firmware/controllers/core/table_helper.h index 662857d857..e63f052c33 100644 --- a/firmware/controllers/core/table_helper.h +++ b/firmware/controllers/core/table_helper.h @@ -17,6 +17,7 @@ template class Map3D { public: + Map3D(); void init(float table[RPM_BIN_SIZE][LOAD_BIN_SIZE], float loadBins[LOAD_BIN_SIZE], float rpmBins[RPM_BIN_SIZE]); float getValue(float x, float rpm); void setAll(float value); @@ -81,6 +82,12 @@ float Map3D::getValue(float x, float rpm) { return interpolate3d(x, loadBins, LOAD_BIN_SIZE, rpm, rpmBins, RPM_BIN_SIZE, pointers); } +template +Map3D::Map3D() { + initialized = 0; + memset(&pointers, 0, sizeof(pointers)); +} + template void Map3D::setAll(float value) { efiAssertVoid(initialized == MAGIC_TRUE_VALUE, "map not initialized"); diff --git a/firmware/controllers/engine_controller.cpp b/firmware/controllers/engine_controller.cpp index 56b2400c4a..fb44b4eecd 100644 --- a/firmware/controllers/engine_controller.cpp +++ b/firmware/controllers/engine_controller.cpp @@ -66,7 +66,7 @@ extern bool hasFirmwareErrorFlag; persistent_config_container_s persistentState CCM_OPTIONAL; -persistent_config_s *config; +persistent_config_s *config = &persistentState.persistentConfiguration; /** * todo: it really looks like these fields should become 'static', i.e. private diff --git a/firmware/controllers/math/speed_density.cpp b/firmware/controllers/math/speed_density.cpp index 3eedc2abe8..abe658b9d2 100644 --- a/firmware/controllers/math/speed_density.cpp +++ b/firmware/controllers/math/speed_density.cpp @@ -107,6 +107,7 @@ void setDetaultVETable(engine_configuration_s *engineConfiguration) { } void initSpeedDensity(persistent_config_s *config) { + efiAssertVoid(config!=NULL, "config is NULL"); engine_configuration_s *e = &config->engineConfiguration; veMap.init(e->veTable, e->veLoadBins, e->veRpmBins); ve2Map.init(e->ve2Table, e->ve2LoadBins, e->ve2RpmBins); diff --git a/win32_functional_tests/simulator/rusEfiFunctionalTest.cpp b/win32_functional_tests/simulator/rusEfiFunctionalTest.cpp index b0bd995848..5f5db77a81 100644 --- a/win32_functional_tests/simulator/rusEfiFunctionalTest.cpp +++ b/win32_functional_tests/simulator/rusEfiFunctionalTest.cpp @@ -29,11 +29,6 @@ #include "trigger_emulator.h" #include "engine_controller.h" -// todo: reuse the instance from engine_controller? - -//static Engine _engine; -//Engine *engine = &_engine; - EXTERN_ENGINE; extern engine_configuration2_s * engineConfiguration2; @@ -79,7 +74,6 @@ void rusEfiFunctionalTest(void) { initStatusLoop(engine); initDataStructures(PASS_ENGINE_PARAMETER_F); - engine->engineConfiguration = engineConfiguration; engine->engineConfiguration2 = engineConfiguration2; // todo: reduce code duplication with initEngineContoller