auto-sync
This commit is contained in:
parent
e1171e8748
commit
6e747b91c8
|
@ -308,6 +308,13 @@ void handlePageReadCommand(ts_response_format_e mode, uint16_t pageId, uint16_t
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void requestBurn(void) {
|
||||||
|
#if EFI_INTERNAL_FLASH
|
||||||
|
setNeedToWriteConfiguration();
|
||||||
|
#endif
|
||||||
|
incrementGlobalConfigurationVersion();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 'Burn' command is a command to commit the changes
|
* 'Burn' command is a command to commit the changes
|
||||||
*/
|
*/
|
||||||
|
@ -327,10 +334,7 @@ void handleBurnCommand(ts_response_format_e mode, uint16_t page) {
|
||||||
// todo: how about some multi-threading?
|
// todo: how about some multi-threading?
|
||||||
memcpy(&persistentState.persistentConfiguration, &configWorkingCopy, sizeof(persistent_config_s));
|
memcpy(&persistentState.persistentConfiguration, &configWorkingCopy, sizeof(persistent_config_s));
|
||||||
|
|
||||||
#if EFI_INTERNAL_FLASH
|
requestBurn();
|
||||||
setNeedToWriteConfiguration();
|
|
||||||
#endif
|
|
||||||
incrementGlobalConfigurationVersion();
|
|
||||||
tunerStudioWriteCrcPacket(TS_RESPONSE_BURN_OK, NULL, 0);
|
tunerStudioWriteCrcPacket(TS_RESPONSE_BURN_OK, NULL, 0);
|
||||||
scheduleMsg(tsLogger, "burned in (ms): %d", currentTimeMillis() - nowMs);
|
scheduleMsg(tsLogger, "burned in (ms): %d", currentTimeMillis() - nowMs);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
void updateTunerStudioState(Engine *engine, TunerStudioOutputChannels *tsOutputChannels);
|
void updateTunerStudioState(Engine *engine, TunerStudioOutputChannels *tsOutputChannels);
|
||||||
void printTsStats(void);
|
void printTsStats(void);
|
||||||
|
void requestBurn(void);
|
||||||
|
|
||||||
void startTunerStudioConnectivity(Logging *sharedLogger);
|
void startTunerStudioConnectivity(Logging *sharedLogger);
|
||||||
void syncTunerStudioCopy(void);
|
void syncTunerStudioCopy(void);
|
||||||
|
|
|
@ -14,6 +14,10 @@
|
||||||
#include "flash.h"
|
#include "flash.h"
|
||||||
#include "rusefi.h"
|
#include "rusefi.h"
|
||||||
|
|
||||||
|
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
||||||
|
#include "tunerstudio.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if EFI_INTERNAL_FLASH
|
#if EFI_INTERNAL_FLASH
|
||||||
|
|
||||||
#include "engine_controller.h"
|
#include "engine_controller.h"
|
||||||
|
@ -56,12 +60,12 @@ void writeToFlashIfPending() {
|
||||||
// todo: technically we need a lock here, realistically we should be fine.
|
// todo: technically we need a lock here, realistically we should be fine.
|
||||||
needToWriteConfiguration = false;
|
needToWriteConfiguration = false;
|
||||||
scheduleMsg(logger, "Writing pending configuration");
|
scheduleMsg(logger, "Writing pending configuration");
|
||||||
writeToFlash();
|
writeToFlashNow();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern uint32_t maxLockTime;
|
extern uint32_t maxLockTime;
|
||||||
|
|
||||||
void writeToFlash(void) {
|
void writeToFlashNow(void) {
|
||||||
scheduleMsg(logger, " !!!!!!!!!!!!!!!!!!!! BE SURE NOT WRITE WITH IGNITION ON !!!!!!!!!!!!!!!!!!!!");
|
scheduleMsg(logger, " !!!!!!!!!!!!!!!!!!!! BE SURE NOT WRITE WITH IGNITION ON !!!!!!!!!!!!!!!!!!!!");
|
||||||
persistentState.size = PERSISTENT_SIZE;
|
persistentState.size = PERSISTENT_SIZE;
|
||||||
persistentState.version = FLASH_DATA_VERSION;
|
persistentState.version = FLASH_DATA_VERSION;
|
||||||
|
@ -119,14 +123,23 @@ void readFromFlash(void) {
|
||||||
|
|
||||||
static void rewriteConfig(Engine *engine) {
|
static void rewriteConfig(Engine *engine) {
|
||||||
doResetConfiguration();
|
doResetConfiguration();
|
||||||
writeToFlash();
|
writeToFlashNow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void initFlash(Logging *sharedLogger, Engine *engine) {
|
void initFlash(Logging *sharedLogger, Engine *engine) {
|
||||||
logger = sharedLogger;
|
logger = sharedLogger;
|
||||||
|
|
||||||
addConsoleAction("readconfig", readFromFlash);
|
addConsoleAction("readconfig", readFromFlash);
|
||||||
addConsoleAction("writeconfig", writeToFlash);
|
/**
|
||||||
|
* This would write NOW (you should not be doing this while connected to real engine)
|
||||||
|
*/
|
||||||
|
addConsoleAction("writeconfig", writeToFlashNow);
|
||||||
|
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
||||||
|
/**
|
||||||
|
* This would schedule write to flash once the engine is stopped
|
||||||
|
*/
|
||||||
|
addConsoleAction("burnconfig", requestBurn);
|
||||||
|
#endif
|
||||||
addConsoleAction("resetconfig", doResetConfiguration);
|
addConsoleAction("resetconfig", doResetConfiguration);
|
||||||
addConsoleActionP("rewriteconfig", (VoidPtr)rewriteConfig, engine);
|
addConsoleActionP("rewriteconfig", (VoidPtr)rewriteConfig, engine);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ void initFlash(Logging *sharedLogger, Engine *engine);
|
||||||
* about 1-2 seconds, we cannot afford to do that while the engine is
|
* about 1-2 seconds, we cannot afford to do that while the engine is
|
||||||
* running so we postpone the write until the engine is stopped.
|
* running so we postpone the write until the engine is stopped.
|
||||||
*/
|
*/
|
||||||
void writeToFlash(void);
|
void writeToFlashNow(void);
|
||||||
void setNeedToWriteConfiguration(void);
|
void setNeedToWriteConfiguration(void);
|
||||||
/**
|
/**
|
||||||
* @return true if an flash write is pending
|
* @return true if an flash write is pending
|
||||||
|
|
|
@ -283,7 +283,7 @@ void setEngineType(int value) {
|
||||||
engineConfiguration->engineType = (engine_type_e) value;
|
engineConfiguration->engineType = (engine_type_e) value;
|
||||||
resetConfigurationExt(&logger, (engine_type_e) value, engine);
|
resetConfigurationExt(&logger, (engine_type_e) value, engine);
|
||||||
#if EFI_INTERNAL_FLASH
|
#if EFI_INTERNAL_FLASH
|
||||||
writeToFlash();
|
writeToFlashNow();
|
||||||
// scheduleReset();
|
// scheduleReset();
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
incrementGlobalConfigurationVersion();
|
incrementGlobalConfigurationVersion();
|
||||||
|
|
|
@ -230,7 +230,7 @@ void initHardware(Logging *l, Engine *engine) {
|
||||||
if (SHOULD_INGORE_FLASH()) {
|
if (SHOULD_INGORE_FLASH()) {
|
||||||
engineConfiguration->engineType = DEFAULT_ENGINE_TYPE;
|
engineConfiguration->engineType = DEFAULT_ENGINE_TYPE;
|
||||||
resetConfigurationExt(sharedLogger, engineConfiguration->engineType, engine);
|
resetConfigurationExt(sharedLogger, engineConfiguration->engineType, engine);
|
||||||
writeToFlash();
|
writeToFlashNow();
|
||||||
} else {
|
} else {
|
||||||
readFromFlash();
|
readFromFlash();
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,5 +278,5 @@ int getRusEfiVersion(void) {
|
||||||
return 1; // this is here to make the compiler happy about the unused array
|
return 1; // this is here to make the compiler happy about the unused array
|
||||||
if (UNUSED_CCM_SIZE == 0)
|
if (UNUSED_CCM_SIZE == 0)
|
||||||
return 1; // this is here to make the compiler happy about the unused array
|
return 1; // this is here to make the compiler happy about the unused array
|
||||||
return 20150218;
|
return 20150219;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// This file was generated by Version2Header
|
// This file was generated by Version2Header
|
||||||
// Wed Feb 18 22:08:55 EST 2015
|
// Thu Feb 19 07:53:56 EST 2015
|
||||||
#ifndef VCS_VERSION
|
#ifndef VCS_VERSION
|
||||||
#define VCS_VERSION "6947"
|
#define VCS_VERSION "6949"
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue