auto-sync

This commit is contained in:
rusEfi 2015-02-26 21:04:29 -06:00
parent abca76b54b
commit 630f04d06c
3 changed files with 18 additions and 10 deletions

View File

@ -78,7 +78,7 @@ board_configuration_s *boardConfiguration = &persistentState.persistentConfigura
* CH_FREQUENCY is the number of system ticks in a second
*/
static VirtualTimer everyMsTimer;
static VirtualTimer periodicTimer;
static LoggingWithStorage logger("Engine Controller");
@ -200,18 +200,18 @@ static void cylinderCleanupControl(Engine *engine) {
static LocalVersionHolder versionForConfigurationListeners;
static void onEvenyGeneralMilliseconds(Engine *engine);
static void periodicCallback(Engine *engine);
static void scheduleNextInvocation(void) {
// schedule next invocation
int period = boardConfiguration->generalPeriodicThreadPeriod;
if (period == 0)
period = 50; // this might happen while resetting config
chVTSetAny(&everyMsTimer, period * TICKS_IN_MS, (vtfunc_t) &onEvenyGeneralMilliseconds, engine);
chVTSetAny(&periodicTimer, period * TICKS_IN_MS, (vtfunc_t) &periodicCallback, engine);
}
static void onEvenyGeneralMilliseconds(Engine *engine) {
static void periodicCallback(Engine *engine) {
efiAssertVoid(getRemainingStack(chThdSelf()) > 64, "lowStckOnEv");
#if EFI_PROD_CODE
/**
@ -392,6 +392,15 @@ static void resetAccel(void) {
}
#endif
void initConfigActions(void) {
addConsoleActionSS("set_float", (VoidCharPtrCharPtr) setFloat);
addConsoleActionII("set_int", (VoidIntInt) setInt);
addConsoleActionII("set_short", (VoidIntInt) setShort);
addConsoleActionI("get_float", getFloat);
addConsoleActionI("get_int", getInt);
addConsoleActionI("get_short", getShort);
}
void initEngineContoller(Logging *sharedLogger, Engine *engine) {
if (hasFirmwareError()) {
return;
@ -408,6 +417,7 @@ void initEngineContoller(Logging *sharedLogger, Engine *engine) {
#endif /* EFI_ANALOG_CHART */
initAlgo(sharedLogger, engineConfiguration);
initConfigActions();
#if EFI_WAVE_ANALYZER || defined(__DOXYGEN__)
if (engineConfiguration->isWaveAnalyzerEnabled) {
@ -483,12 +493,7 @@ void initEngineContoller(Logging *sharedLogger, Engine *engine) {
addConsoleAction("analoginfo", printAnalogInfo);
addConsoleActionSS("set_float", (VoidCharPtrCharPtr) setFloat);
addConsoleActionII("set_int", (VoidIntInt) setInt);
addConsoleActionII("set_short", (VoidIntInt) setShort);
addConsoleActionI("get_float", getFloat);
addConsoleActionI("get_int", getInt);
addConsoleActionI("get_short", getShort);
initConfigActions();
#if EFI_PROD_CODE
addConsoleAction("reset_accel", resetAccel);
#endif

View File

@ -15,6 +15,7 @@
#include "engine.h"
char * getPinNameByAdcChannel(adc_channel_e hwChannel, char *buffer);
void initConfigActions(void);
void initPeriodicEvents(Engine *engine);
void initEngineContoller(Logging *sharedLogger, Engine *engine);

View File

@ -90,6 +90,8 @@ void rusEfiFunctionalTest(void) {
initSensors(&sharedLogger PASS_ENGINE_PARAMETER);
initAlgo(&sharedLogger, engineConfiguration);
initConfigActions();
initRpmCalculator(engine);
#if EFI_ANALOG_CHART