diff --git a/firmware/config/stm32f4ems/efifeatures.h b/firmware/config/stm32f4ems/efifeatures.h index 71a7f0264e..b10a88a4d6 100644 --- a/firmware/config/stm32f4ems/efifeatures.h +++ b/firmware/config/stm32f4ems/efifeatures.h @@ -147,11 +147,11 @@ #define EFI_POTENTIOMETER FALSE #ifndef BOARD_TLE6240_COUNT -#define BOARD_TLE6240_COUNT 0 +#define BOARD_TLE6240_COUNT 1 #endif #ifndef BOARD_MC33972_COUNT -#define BOARD_MC33972_COUNT 0 +#define BOARD_MC33972_COUNT 1 #endif #ifndef BOARD_TLE8888_COUNT diff --git a/firmware/console/binary/tunerstudio.cpp b/firmware/console/binary/tunerstudio.cpp index bc39314893..b0f3649de4 100644 --- a/firmware/console/binary/tunerstudio.cpp +++ b/firmware/console/binary/tunerstudio.cpp @@ -584,7 +584,7 @@ void handleQueryCommand(TsChannelBase* tsChannel, ts_response_format_e mode) { */ static void handleTestCommand(TsChannelBase* tsChannel) { tsState.testCommandCounter++; - char testOutputBuffer[64]; + static char testOutputBuffer[64]; /** * this is NOT a standard TunerStudio command, this is my own * extension of the protocol to simplify troubleshooting @@ -611,7 +611,7 @@ static void handleTestCommand(TsChannelBase* tsChannel) { extern CommandHandler console_line_callback; static void handleGetVersion(TsChannelBase* tsChannel) { - char versionBuffer[32]; + static char versionBuffer[32]; chsnprintf(versionBuffer, sizeof(versionBuffer), "rusEFI v%d@%s", getRusEfiVersion(), VCS_VERSION); tsChannel->sendResponse(TS_CRC, (const uint8_t *) versionBuffer, strlen(versionBuffer) + 1); } diff --git a/firmware/controllers/actuators/idle_hardware.cpp b/firmware/controllers/actuators/idle_hardware.cpp index ce45d178a9..8467f4b4ff 100644 --- a/firmware/controllers/actuators/idle_hardware.cpp +++ b/firmware/controllers/actuators/idle_hardware.cpp @@ -17,9 +17,9 @@ #include "dc_motors.h" #if ! EFI_UNIT_TEST #include "stepper.h" -static StepDirectionStepper iacStepperHw CCM_OPTIONAL; -static DualHBridgeStepper iacHbridgeHw CCM_OPTIONAL; -StepperMotor iacMotor CCM_OPTIONAL; +static StepDirectionStepper iacStepperHw; +static DualHBridgeStepper iacHbridgeHw; +StepperMotor iacMotor; #endif /* EFI_UNIT_TEST */ static SimplePwm idleSolenoidOpen("idle open"); diff --git a/firmware/controllers/actuators/vvt.cpp b/firmware/controllers/actuators/vvt.cpp index 58462441b0..2180c3f730 100644 --- a/firmware/controllers/actuators/vvt.cpp +++ b/firmware/controllers/actuators/vvt.cpp @@ -99,7 +99,7 @@ void VvtController::setOutput(expected outputValue) { #if EFI_AUX_PID -static VvtController instances[CAM_INPUTS_COUNT] CCM_OPTIONAL; +static VvtController instances[CAM_INPUTS_COUNT]; static void turnAuxPidOn(int index) { if (!isBrainPinValid(engineConfiguration->auxPidPins[index])) { diff --git a/firmware/controllers/core/fsio_impl.cpp b/firmware/controllers/core/fsio_impl.cpp index ad653577a8..a736303184 100644 --- a/firmware/controllers/core/fsio_impl.cpp +++ b/firmware/controllers/core/fsio_impl.cpp @@ -76,10 +76,10 @@ static LENameOrdinalPair leFuelRate(LE_METHOD_FUEL_FLOW_RATE, "fuel_flow"); #define UD_ELEMENT_POOL_SIZE 64 static LEElement sysElements[SYS_ELEMENT_POOL_SIZE] CCM_OPTIONAL; -CCM_OPTIONAL LEElementPool sysPool(sysElements, SYS_ELEMENT_POOL_SIZE); +LEElementPool sysPool(sysElements, SYS_ELEMENT_POOL_SIZE); static LEElement userElements[UD_ELEMENT_POOL_SIZE] CCM_OPTIONAL; -CCM_OPTIONAL LEElementPool userPool(userElements, UD_ELEMENT_POOL_SIZE); +LEElementPool userPool(userElements, UD_ELEMENT_POOL_SIZE); class FsioPointers { public: @@ -277,7 +277,7 @@ void onConfigurationChangeFsioCallback(engine_configuration_s *previousConfigura #endif } -static LECalculator calc CCM_OPTIONAL; +static LECalculator calc; static SimplePwm fsioPwm[FSIO_COMMAND_COUNT] CCM_OPTIONAL; diff --git a/firmware/controllers/gauges/malfunction_indicator.cpp b/firmware/controllers/gauges/malfunction_indicator.cpp index be3ecd427c..d5cb7a521e 100644 --- a/firmware/controllers/gauges/malfunction_indicator.cpp +++ b/firmware/controllers/gauges/malfunction_indicator.cpp @@ -103,7 +103,7 @@ private: } }; -static MILController instance CCM_OPTIONAL; +static MILController instance; #if TEST_MIL_CODE static void testMil(void) { diff --git a/firmware/controllers/sensors/map.cpp b/firmware/controllers/sensors/map.cpp index ec2f03f889..208b6ffd1b 100644 --- a/firmware/controllers/sensors/map.cpp +++ b/firmware/controllers/sensors/map.cpp @@ -244,7 +244,7 @@ static void printMAPInfo(void) { #endif // EFI_MAP_AVERAGING adc_channel_e mapAdc = engineConfiguration->map.sensor.hwChannel; - char pinNameBuffer[16]; + static char pinNameBuffer[16]; efiPrintf("MAP %.2fv @%s", getVoltage("mapinfo", mapAdc PASS_ENGINE_PARAMETER_SUFFIX), getPinNameByAdcChannel("map", mapAdc, pinNameBuffer)); diff --git a/firmware/hw_layer/adc/adc_subscription.cpp b/firmware/hw_layer/adc/adc_subscription.cpp index a482411f85..7d5167e170 100644 --- a/firmware/hw_layer/adc/adc_subscription.cpp +++ b/firmware/hw_layer/adc/adc_subscription.cpp @@ -17,8 +17,8 @@ struct AdcSubscriptionEntry { FunctionalSensor *Sensor; float VoltsPerAdcVolt; - Biquad Filter; adc_channel_e Channel; + Biquad Filter; bool HasUpdated = false; }; diff --git a/firmware/hw_layer/microsecond_timer/microsecond_timer.cpp b/firmware/hw_layer/microsecond_timer/microsecond_timer.cpp index c2c2a9125e..4a47e2d8ef 100644 --- a/firmware/hw_layer/microsecond_timer/microsecond_timer.cpp +++ b/firmware/hw_layer/microsecond_timer/microsecond_timer.cpp @@ -41,6 +41,8 @@ static int timerRestartCounter = 0; static const char * msg; +static char buff[32]; + static int timerFreezeCounter = 0; static int setHwTimerCounter = 0; static bool hwStarted = false; @@ -108,7 +110,9 @@ class MicrosecondTimerWatchdogController : public PeriodicTimerController { void PeriodicTask() override { efitick_t nowNt = getTimeNowNt(); if (nowNt >= lastSetTimerTimeNt + 2 * CORE_CLOCK) { - firmwareError(CUSTOM_ERR_SCHEDULING_ERROR, "no event %d", lastSetTimerTimeNt); + strcpy(buff, "no_event"); + itoa10(&buff[8], lastSetTimerTimeNt); + firmwareError(CUSTOM_ERR_SCHEDULING_ERROR, buff); return; } diff --git a/firmware/hw_layer/mmc_card.cpp b/firmware/hw_layer/mmc_card.cpp index 897868b8d4..6b82dd8ed3 100644 --- a/firmware/hw_layer/mmc_card.cpp +++ b/firmware/hw_layer/mmc_card.cpp @@ -106,6 +106,7 @@ static void printError(const char *str, FRESULT f_error) { } static FIL FDLogFile NO_CACHE; +static FIL FDCurrFile NO_CACHE; // 10 because we want at least 4 character name #define MIN_FILE_INDEX 10 @@ -131,8 +132,8 @@ static void sdStatistics(void) { } static void incLogFileName(void) { - memset(&FDLogFile, 0, sizeof(FIL)); // clear the memory - FRESULT err = f_open(&FDLogFile, LOG_INDEX_FILENAME, FA_READ); // This file has the index for next log file name + memset(&FDCurrFile, 0, sizeof(FIL)); // clear the memory + FRESULT err = f_open(&FDCurrFile, LOG_INDEX_FILENAME, FA_READ); // This file has the index for next log file name char data[_MAX_FILLER]; UINT result = 0; @@ -140,10 +141,10 @@ static void incLogFileName(void) { logFileIndex = MIN_FILE_INDEX; efiPrintf("%s: not found or error: %d", LOG_INDEX_FILENAME, err); } else { - f_read(&FDLogFile, (void*)data, sizeof(data), &result); + f_read(&FDCurrFile, (void*)data, sizeof(data), &result); efiPrintf("Got content [%s] size %d", data, result); - f_close(&FDLogFile); + f_close(&FDCurrFile); if (result < 5) { data[result] = 0; logFileIndex = maxI(MIN_FILE_INDEX, atoi(data)); @@ -157,10 +158,10 @@ static void incLogFileName(void) { } } - err = f_open(&FDLogFile, LOG_INDEX_FILENAME, FA_OPEN_ALWAYS | FA_WRITE); + err = f_open(&FDCurrFile, LOG_INDEX_FILENAME, FA_OPEN_ALWAYS | FA_WRITE); itoa10(data, logFileIndex); - f_write(&FDLogFile, (void*)data, strlen(data), &result); - f_close(&FDLogFile); + f_write(&FDCurrFile, (void*)data, strlen(data), &result); + f_close(&FDCurrFile); efiPrintf("Done %d", logFileIndex); } @@ -401,6 +402,8 @@ static bool mountMmc() { bool hasUsb = usbResult == MSG_OK; + msdObjectInit(&USBMSD1); + // If we have a device AND USB is connected, mount the card to USB, otherwise // mount the null device and try to mount the filesystem ourselves if (cardBlockDevice && hasUsb) {