EFI_CONFIGURATION_STORAGE reducing code duplication

This commit is contained in:
rusefi 2024-05-05 15:52:39 -04:00
parent 217546b02d
commit 944a9375d3
7 changed files with 21 additions and 23 deletions

View File

@ -66,7 +66,7 @@
#include "periodic_task.h"
#endif /* EFI_PROD_CODE */
#if (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE)
#if EFI_CONFIGURATION_STORAGE
#include "flash_main.h"
#endif
@ -306,10 +306,10 @@ extern int totalLoggedBytes;
} else if (consoleByteArrived) {
offTimeMs = 100;
onTimeMs = 33;
#if (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE)
#if EFI_CONFIGURATION_STORAGE
} else if (getNeedToWriteConfiguration()) {
offTimeMs = onTimeMs = 500;
#endif /* (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE) */
#endif /* EFI_CONFIGURATION_STORAGE */
} else {
onTimeMs =
#if EFI_USB_SERIAL
@ -609,9 +609,9 @@ static void updateFlags() {
engine->outputChannels.isTriggerError = isTriggerErrorNow();
#endif // EFI_PROD_CODE
#if (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE)
#if EFI_CONFIGURATION_STORAGE
engine->outputChannels.needBurn = getNeedToWriteConfiguration();
#endif /* (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE) */
#endif /* EFI_CONFIGURATION_STORAGE */
}
static void updateWarningCodes() {

View File

@ -662,7 +662,7 @@ void loadConfiguration() {
#endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */
/* If board have any storage */
#if (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE)
#if EFI_CONFIGURATION_STORAGE
if (IGNORE_FLASH_CONFIGURATION) {
engineConfiguration->engineType = DEFAULT_ENGINE_TYPE;
resetConfigurationExt(engineConfiguration->engineType);
@ -676,7 +676,7 @@ void loadConfiguration() {
// This board doesn't load configuration, initialize the default
engineConfiguration->engineType = DEFAULT_ENGINE_TYPE;
resetConfigurationExt(engineConfiguration->engineType);
#endif /* (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE) */
#endif /* EFI_CONFIGURATION_STORAGE */
// Force any board configuration options that humans shouldn't be able to change
setBoardConfigOverrides();

View File

@ -463,9 +463,9 @@ static void handleCommandX14(uint16_t index) {
return;
case TS_WRITE_FLASH:
// cmd_write_config
#if (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE)
#if EFI_CONFIGURATION_STORAGE
writeToFlashNow();
#endif /* (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE) */
#endif /* EFI_CONFIGURATION_STORAGE */
return;
case TS_TRIGGER_STIMULATOR_ENABLE:
#if EFI_EMULATE_POSITION_SENSORS == TRUE
@ -517,12 +517,10 @@ static void handleCommandX14(uint16_t index) {
benchSemaphore.signal();
return;
case TS_BURN_WITHOUT_FLASH:
#if EFI_PROD_CODE
#if (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE)
#if EFI_PROD_CODE && EFI_CONFIGURATION_STORAGE
extern bool burnWithoutFlash;
burnWithoutFlash = true;
#endif /* (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE) */
#endif // EFI_PROD_CODE
#endif /* EFI_PROD_CODE && EFI_CONFIGURATION_STORAGE */
return;
default:
criticalError("Unexpected bench x14 %d", index);

View File

@ -217,9 +217,9 @@ static void doPeriodicSlowCallback() {
#endif /* EFI_CONFIGURATION_STORAGE */
}
#else /* if EFI_SHAFT_POSITION_INPUT */
#if (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE)
#if EFI_CONFIGURATION_STORAGE
writeToFlashIfPending();
#endif /* (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE) */
#endif /* EFI_CONFIGURATION_STORAGE */
#endif /* EFI_SHAFT_POSITION_INPUT */
#if EFI_TCU

View File

@ -10,7 +10,7 @@
#include "pch.h"
/* If any setting storage is exist */
#if (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE)
#if EFI_CONFIGURATION_STORAGE
#include "mpu_util.h"
#include "flash_main.h"
@ -367,4 +367,4 @@ void initFlash() {
#endif
}
#endif /* (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE) */
#endif /* EFI_CONFIGURATION_STORAGE */

View File

@ -31,9 +31,9 @@
#include "electronic_throttle.h"
#endif // EFI_ELECTRONIC_THROTTLE_BODY
#if (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE)
#if EFI_CONFIGURATION_STORAGE
#include "flash_main.h"
#endif /* (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE) */
#endif // EFI_CONFIGURATION_STORAGE
#if EFI_ENGINE_SNIFFER
#include "engine_sniffer.h"
@ -951,11 +951,11 @@ void setEngineType(int value, bool isWriteToFlash) {
resetConfigurationExt((engine_type_e)value);
engine->resetEngineSnifferIfInTestMode();
#if (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE)
#if EFI_CONFIGURATION_STORAGE
if (isWriteToFlash) {
writeToFlashNow();
}
#endif /* (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE) */
#endif /* EFI_CONFIGURATION_STORAGE */
}
incrementGlobalConfigurationVersion("engineType");
#if EFI_ENGINE_CONTROL && ! EFI_UNIT_TEST

View File

@ -61,7 +61,7 @@
#include "map_averaging.h"
#endif
#if (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE)
#if EFI_CONFIGURATION_STORAGE
#include "flash_main.h"
#endif
@ -496,7 +496,7 @@ void initHardwareNoConfig() {
initRtc();
#endif // EFI_PROD_CODE && EFI_RTC
#if (EFI_STORAGE_INT_FLASH == TRUE) || (EFI_STORAGE_MFS == TRUE)
#if EFI_CONFIGURATION_STORAGE
initFlash();
#endif