From 740a7f0616b1b9f880a1eaac6370f31a4f4b9e1b Mon Sep 17 00:00:00 2001 From: rusEfi Date: Mon, 13 Oct 2014 11:03:10 -0500 Subject: [PATCH] auto-sync --- firmware/console/status_loop.cpp | 20 ++++++++++---------- firmware/console/status_loop.h | 12 ++++++++---- firmware/controllers/core/le_functions.h | 1 + firmware/controllers/engine_controller.cpp | 5 ----- firmware/rusefi.cpp | 2 +- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index 2e8a128826..93ab1f8e1e 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -116,7 +116,7 @@ static const char* boolean2string(int value) { return value ? "YES" : "NO"; } -void printSensors(void) { +void printSensors(Engine *engine) { #if EFI_FILE_LOGGING resetLogging(&fileLogger); #endif /* EFI_FILE_LOGGING */ @@ -126,7 +126,7 @@ void printSensors(void) { float sec = ((float) nowMs) / 1000; reportSensorF("time", sec, 3); - reportSensorI("rpm", getRpm()); + reportSensorI("rpm", getRpmE(engine)); reportSensorF("maf", getMaf(), 2); if (engineConfiguration->hasMapSensor) { @@ -158,24 +158,24 @@ void printSensors(void) { #endif /* EFI_FILE_LOGGING */ } -void printState(int currentCkpEventCounter) { +void printState(Engine *engine, int currentCkpEventCounter) { #if EFI_SHAFT_POSITION_INPUT - printSensors(); + printSensors(engine); - int rpm = getRpm(); + int rpm = getRpmE(engine); debugInt(&logger, "ckp_c", currentCkpEventCounter); // debugInt(&logger, "idl", getIdleSwitch()); // debugFloat(&logger, "table_spark", getAdvance(rpm, getMaf()), 2); - float engineLoad = getEngineLoad(); - float baseFuel = getBaseFuel(&engine, rpm); + float engineLoad = getEngineLoadT(engine); + float baseFuel = getBaseFuel(engine, rpm); debugFloat(&logger, "fuel_base", baseFuel, 2); // debugFloat(&logger, "fuel_iat", getIatCorrection(getIntakeAirTemperature()), 2); // debugFloat(&logger, "fuel_clt", getCltCorrection(getCoolantTemperature()), 2); debugFloat(&logger, "fuel_lag", getInjectorLag(engineConfiguration, getVBatt()), 2); - debugFloat(&logger, "fuel", getRunningFuel(baseFuel, &engine, rpm), 2); + debugFloat(&logger, "fuel", getRunningFuel(baseFuel, engine, rpm), 2); debugFloat(&logger, "timing", getAdvance(rpm, engineLoad), 2); @@ -250,7 +250,7 @@ extern char errorMessageBuffer[200]; /** * @brief Sends all pending data to dev console */ -void updateDevConsoleState(void) { +void updateDevConsoleState(Engine *engine) { if (!isConsoleReady()) { return; } @@ -288,7 +288,7 @@ void updateDevConsoleState(void) { prevCkpEventCounter = currentCkpEventCounter; - printState(currentCkpEventCounter); + printState(engine, currentCkpEventCounter); #if EFI_WAVE_ANALYZER printWave(&logger); diff --git a/firmware/console/status_loop.h b/firmware/console/status_loop.h index dd884aefd0..292f276021 100644 --- a/firmware/console/status_loop.h +++ b/firmware/console/status_loop.h @@ -8,17 +8,21 @@ #ifndef CONSOLE_LOOP_H_ #define CONSOLE_LOOP_H_ +#ifdef __cplusplus +#include "engine.h" +void updateDevConsoleState(Engine *engine); +void printSensors(Engine *engine); +void printState(Engine *engine, int currentCkpEventCounter); + +#endif /* __cplusplus */ + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -void printState(int currentCkpEventCounter); - void initStatusLoop(void); -void updateDevConsoleState(void); bool getFullLog(void); -void printSensors(void); void setFullLog(int value); void startStatusThreads(void); void sayOsHello(void); diff --git a/firmware/controllers/core/le_functions.h b/firmware/controllers/core/le_functions.h index da72f31329..db0f716583 100644 --- a/firmware/controllers/core/le_functions.h +++ b/firmware/controllers/core/le_functions.h @@ -11,6 +11,7 @@ #include "engine.h" #include "logic_expression.h" +// todo: the delay should probably be configurable? #define FUEL_PUMP_LOGIC "time_since_boot 4 < rpm 0 > OR" float getLEValue(Engine *engine, le_action_e action); diff --git a/firmware/controllers/engine_controller.cpp b/firmware/controllers/engine_controller.cpp index a8f23b14cf..7645c2836b 100644 --- a/firmware/controllers/engine_controller.cpp +++ b/firmware/controllers/engine_controller.cpp @@ -61,8 +61,6 @@ LEElementPool lePool; LEElement * fuelPumpLogic; LEElement * radiatorFanLogic; -extern board_configuration_s *boardConfiguration; - persistent_config_container_s persistentState CCM_OPTIONAL ; @@ -77,11 +75,8 @@ board_configuration_s *boardConfiguration = &persistentState.persistentConfigura /** * CH_FREQUENCY is the number of system ticks in a second */ -// todo: this should probably be configurable? -#define FUEL_PUMP_DELAY (4 * CH_FREQUENCY) static VirtualTimer everyMsTimer; -//static VirtualTimer fuelPumpTimer; static Logging logger; diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index 0b4d341380..9ae858ce74 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -187,7 +187,7 @@ void runRusEfi(void) { #if EFI_CLI_SUPPORT && !EFI_UART_ECHO_TEST_MODE // sensor state + all pending messages for our own dev console - updateDevConsoleState(); + updateDevConsoleState(&engine); #endif /* EFI_CLI_SUPPORT */ chThdSleepMilliseconds(boardConfiguration->consoleLoopPeriod);