auto-sync

This commit is contained in:
rusEfi 2014-10-21 12:03:09 -05:00
parent e41a60a669
commit cd22e231c8
5 changed files with 20 additions and 17 deletions

View File

@ -68,8 +68,6 @@
#include "max31855.h" #include "max31855.h"
#endif #endif
extern Engine engine;
// this 'true' value is needed for simulator // this 'true' value is needed for simulator
static volatile bool fullLog = true; static volatile bool fullLog = true;
int warningEnabled = TRUE; int warningEnabled = TRUE;
@ -305,14 +303,14 @@ void updateDevConsoleState(Engine *engine) {
* that would be 'show fuel for rpm 3500 maf 4.0' * that would be 'show fuel for rpm 3500 maf 4.0'
*/ */
static void showFuelInfo2(float rpm, float engineLoad) { static void showFuelInfo2(float rpm, float engineLoad, Engine *engine) {
float baseFuelMs = getBaseTableFuel(engineConfiguration, (int) rpm, engineLoad); float baseFuelMs = getBaseTableFuel(engineConfiguration, (int) rpm, engineLoad);
scheduleMsg(&logger2, "algo=%s/pump=%s", getEngine_load_mode_e(engineConfiguration->algorithm), boolToString(getOutputPinValue(FUEL_PUMP_RELAY))); scheduleMsg(&logger2, "algo=%s/pump=%s", getEngine_load_mode_e(engineConfiguration->algorithm), boolToString(getOutputPinValue(FUEL_PUMP_RELAY)));
scheduleMsg(&logger2, "cranking fuel: %f", getCrankingFuel(&engine)); scheduleMsg(&logger2, "cranking fuel: %f", getCrankingFuel(engine));
if (engine.rpmCalculator->isRunning()) { if (engine->rpmCalculator->isRunning()) {
float iatCorrection = getIatCorrection(engineConfiguration, getIntakeAirTemperature(engineConfiguration2)); float iatCorrection = getIatCorrection(engineConfiguration, getIntakeAirTemperature(engineConfiguration2));
float cltCorrection = getCltCorrection(engineConfiguration, getCoolantTemperature(engineConfiguration2)); float cltCorrection = getCltCorrection(engineConfiguration, getCoolantTemperature(engineConfiguration2));
float injectorLag = getInjectorLag(engineConfiguration, getVBatt()); float injectorLag = getInjectorLag(engineConfiguration, getVBatt());
@ -322,13 +320,13 @@ static void showFuelInfo2(float rpm, float engineLoad) {
scheduleMsg(&logger2, "iatCorrection=%f cltCorrection=%f injectorLag=%f", iatCorrection, cltCorrection, scheduleMsg(&logger2, "iatCorrection=%f cltCorrection=%f injectorLag=%f", iatCorrection, cltCorrection,
injectorLag); injectorLag);
float value = getRunningFuel(baseFuelMs, &engine, (int) rpm); float value = getRunningFuel(baseFuelMs, engine, (int) rpm);
scheduleMsg(&logger2, "injection pulse width: %f", value); scheduleMsg(&logger2, "injection pulse width: %f", value);
} }
} }
static void showFuelInfo(void) { static void showFuelInfo(Engine *engine) {
showFuelInfo2((float) getRpm(), getEngineLoad()); showFuelInfo2((float) getRpmE(engine), getEngineLoadT(engine), engine);
} }
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */
@ -412,7 +410,7 @@ static void tsStatusThread(Engine *engine) {
} }
} }
void initStatusLoop(void) { void initStatusLoop(Engine *engine) {
#if EFI_PROD_CODE || EFI_SIMULATOR #if EFI_PROD_CODE || EFI_SIMULATOR
initLoggingExt(&logger, "status loop", LOGGING_BUFFER, sizeof(LOGGING_BUFFER)); initLoggingExt(&logger, "status loop", LOGGING_BUFFER, sizeof(LOGGING_BUFFER));
#endif /* EFI_PROD_CODE || EFI_SIMULATOR */ #endif /* EFI_PROD_CODE || EFI_SIMULATOR */
@ -424,8 +422,8 @@ void initStatusLoop(void) {
#if EFI_PROD_CODE #if EFI_PROD_CODE
initLogging(&logger2, "main event handler"); initLogging(&logger2, "main event handler");
addConsoleActionFF("fuelinfo2", showFuelInfo2); addConsoleActionFFP("fuelinfo2", (VoidFloatFloatVoidPtr)showFuelInfo2, engine);
addConsoleAction("fuelinfo", showFuelInfo); addConsoleActionP("fuelinfo", (VoidPtr)showFuelInfo, engine);
addConsoleAction("status", printStatus); addConsoleAction("status", printStatus);
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */

View File

@ -14,6 +14,7 @@ void updateDevConsoleState(Engine *engine);
void printSensors(Engine *engine); void printSensors(Engine *engine);
void printState(Engine *engine, int currentCkpEventCounter); void printState(Engine *engine, int currentCkpEventCounter);
void startStatusThreads(Engine *engine); void startStatusThreads(Engine *engine);
void initStatusLoop(Engine *engine);
#endif /* __cplusplus */ #endif /* __cplusplus */
@ -22,7 +23,6 @@ extern "C"
{ {
#endif /* __cplusplus */ #endif /* __cplusplus */
void initStatusLoop(void);
bool getFullLog(void); bool getFullLog(void);
void setFullLog(int value); void setFullLog(int value);
void sayOsHello(void); void sayOsHello(void);

View File

@ -168,7 +168,7 @@ void runRusEfi(void) {
*/ */
initHardware(&logging, &engine); initHardware(&logging, &engine);
initStatusLoop(); initStatusLoop(&engine);
/** /**
* Now let's initialize actual engine control logic * Now let's initialize actual engine control logic
* todo: should we initialize some? most? controllers before hardware? * todo: should we initialize some? most? controllers before hardware?

View File

@ -313,7 +313,7 @@ void handleActionWithParameter(TokenCallback *current, char *parameter) {
return; return;
} }
if (current->parameterType == FLOAT_FLOAT_PARAMETER) { if (current->parameterType == FLOAT_FLOAT_PARAMETER || current->parameterType == FLOAT_FLOAT_PARAMETER_P) {
int spaceIndex = findEndOfToken(parameter); int spaceIndex = findEndOfToken(parameter);
if (spaceIndex == -1) if (spaceIndex == -1)
return; return;
@ -321,8 +321,13 @@ void handleActionWithParameter(TokenCallback *current, char *parameter) {
float value1 = atoff(parameter); float value1 = atoff(parameter);
parameter += spaceIndex + 1; parameter += spaceIndex + 1;
float value2 = atoff(parameter); float value2 = atoff(parameter);
VoidFloatFloat callbackS = (VoidFloatFloat) current->callback; if (current->parameterType == FLOAT_FLOAT_PARAMETER) {
(*callbackS)(value1, value2); VoidFloatFloat callbackS = (VoidFloatFloat) current->callback;
(*callbackS)(value1, value2);
} else {
VoidFloatFloatVoidPtr callbackS = (VoidFloatFloatVoidPtr) current->callback;
(*callbackS)(value1, value2, current->param);
}
return; return;
} }

View File

@ -73,7 +73,7 @@ void rusEfiFunctionalTest(void) {
initFakeBoard(); initFakeBoard();
initStatusLoop(); initStatusLoop(&engine);
initDataStructures(engineConfiguration); initDataStructures(engineConfiguration);
engine.engineConfiguration = engineConfiguration; engine.engineConfiguration = engineConfiguration;