diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index 3b827499c8..4f8145aecf 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -181,8 +181,8 @@ static void printSensors(Logging *log, bool fileFormat) { reportSensorF(log, fileFormat, "vss", "kph", getVehicleSpeed(), 2); } #endif /* EFI_PROD_CODE */ - reportSensorF(log, fileFormat, "vref", "V", getVRef(engineConfiguration), 2); - reportSensorF(log, fileFormat, "vbatt", "V", getVBatt(engineConfiguration), 2); +// reportSensorF(log, fileFormat, "vref", "V", getVRef(engineConfiguration), 2); + reportSensorF(log, fileFormat, "vbatt", "V", getVBatt(PASS_ENGINE_PARAMETER_F), 2); reportSensorF(log, fileFormat, "TP", "%", getTPS(PASS_ENGINE_PARAMETER_F), 2); @@ -559,7 +559,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_ tsOutputChannels->massAirFlowValue = getRealMaf(); tsOutputChannels->veValue = veMap.getValue(getMap(), rpm); tsOutputChannels->airFuelRatio = getAfr(); - tsOutputChannels->vBatt = getVBatt(engineConfiguration); + tsOutputChannels->vBatt = getVBatt(PASS_ENGINE_PARAMETER_F); tsOutputChannels->tpsADC = getTPS10bitAdc(PASS_ENGINE_PARAMETER_F); #if EFI_ANALOG_SENSORS || defined(__DOXYGEN__) tsOutputChannels->baroPressure = getBaroPressure(); diff --git a/firmware/controllers/algo/engine.cpp b/firmware/controllers/algo/engine.cpp index 88fce0bf02..86e9478ce0 100644 --- a/firmware/controllers/algo/engine.cpp +++ b/firmware/controllers/algo/engine.cpp @@ -41,7 +41,7 @@ void Engine::updateSlowSensors() { engineState.iat = getIntakeAirTemperature(PASS_ENGINE_PARAMETER_F); engineState.clt = getCoolantTemperature(PASS_ENGINE_PARAMETER_F); - injectorLagMs = getInjectorLag(getVBatt(engineConfiguration) PASS_ENGINE_PARAMETER); + injectorLagMs = getInjectorLag(getVBatt(PASS_ENGINE_PARAMETER_F) PASS_ENGINE_PARAMETER); } void Engine::onTriggerEvent(uint64_t nowNt) { diff --git a/firmware/controllers/alternatorController.cpp b/firmware/controllers/alternatorController.cpp index d45d721a8f..4498d09a97 100644 --- a/firmware/controllers/alternatorController.cpp +++ b/firmware/controllers/alternatorController.cpp @@ -36,9 +36,9 @@ static msg_t AltCtrlThread(int param) { while (true) { chThdSleepMilliseconds(boardConfiguration->alternatorDT); - currentAltDuty = engineConfiguration->alternatorOffset + altPid.getValue(boardConfiguration->targetVBatt, getVBatt(engineConfiguration), 1); + currentAltDuty = engineConfiguration->alternatorOffset + altPid.getValue(boardConfiguration->targetVBatt, getVBatt(PASS_ENGINE_PARAMETER_F), 1); if (boardConfiguration->isVerboseAlternator) { - scheduleMsg(logger, "alt duty: %f/vbatt=%f/p=%f/i=%f/d=%f int=%f", currentAltDuty, getVBatt(engineConfiguration), + scheduleMsg(logger, "alt duty: %f/vbatt=%f/p=%f/i=%f/d=%f int=%f", currentAltDuty, getVBatt(PASS_ENGINE_PARAMETER_F), altPid.getP(), altPid.getI(), altPid.getD(), altPid.getIntegration()); } @@ -59,7 +59,7 @@ void showAltInfo(void) { boardConfiguration->alternatorDT); scheduleMsg(logger, "p=%f/i=%f/d=%f offset=%f", engineConfiguration->alternatorControlPFactor, 0, 0, engineConfiguration->alternatorOffset); // todo: i & d - scheduleMsg(logger, "vbatt=%f/duty=%f/target=%f", getVBatt(engineConfiguration), currentAltDuty, + scheduleMsg(logger, "vbatt=%f/duty=%f/target=%f", getVBatt(PASS_ENGINE_PARAMETER_F), currentAltDuty, boardConfiguration->targetVBatt); } diff --git a/firmware/controllers/core/fsio_impl.cpp b/firmware/controllers/core/fsio_impl.cpp index 8f54dfab8f..212c238c53 100644 --- a/firmware/controllers/core/fsio_impl.cpp +++ b/firmware/controllers/core/fsio_impl.cpp @@ -68,7 +68,7 @@ float getLEValue(Engine *engine, calc_stack_t *s, le_action_e action) { case LE_METHOD_FAN: return enginePins.fanRelay.getLogicValue(); case LE_METHOD_AC_TOGGLE: - return getAcToggle(engine); + return getAcToggle(PASS_ENGINE_PARAMETER_F); case LE_METHOD_COOLANT: return getCoolantTemperature(PASS_ENGINE_PARAMETER_F); case LE_METHOD_INTAKE_AIR: @@ -82,7 +82,7 @@ float getLEValue(Engine *engine, calc_stack_t *s, le_action_e action) { case LE_METHOD_FAN_ON_SETTING: return engineConfiguration->fanOnTemperature; case LE_METHOD_VBATT: - return getVBatt(engine->engineConfiguration); + return getVBatt(PASS_ENGINE_PARAMETER_F); default: warning(OBD_PCM_Processor_Fault, "FSIO unexpected %d", action); return NAN; diff --git a/firmware/controllers/lcd_controller.cpp b/firmware/controllers/lcd_controller.cpp index ad18ed84f6..8efaf55ba3 100644 --- a/firmware/controllers/lcd_controller.cpp +++ b/firmware/controllers/lcd_controller.cpp @@ -103,7 +103,7 @@ void initLcdController(void) { static char * prepareVBattMapLine(engine_configuration_s *engineConfiguration, char *buffer) { char *ptr = buffer; *ptr++ = 'V'; - ptr = ftoa(ptr, getVBatt(engineConfiguration), 10.0f); + ptr = ftoa(ptr, getVBatt(PASS_ENGINE_PARAMETER_F), 10.0f); ptr = appendStr(ptr, " M"); ptr = ftoa(ptr, getRawMap(), 10.0f); @@ -228,7 +228,7 @@ static void showLine(lcd_line_e line, int screenY) { lcdPrintf("Throttle %f%%", getTPS()); return; case LL_VBATT: - lcdPrintf("Battery %fv", getVBatt(engineConfiguration)); + lcdPrintf("Battery %fv", getVBatt(PASS_ENGINE_PARAMETER_F)); return; #if EFI_ANALOG_SENSORS || defined(__DOXYGEN__) case LL_BARO: diff --git a/firmware/controllers/sensors/allsensors.cpp b/firmware/controllers/sensors/allsensors.cpp index 154f491de5..4b9f76b990 100644 --- a/firmware/controllers/sensors/allsensors.cpp +++ b/firmware/controllers/sensors/allsensors.cpp @@ -10,14 +10,15 @@ #include "engine.h" #include "allsensors.h" +EXTERN_ENGINE; + void initSensors(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_S) { initThermistors(sharedLogger PASS_ENGINE_PARAMETER); initMapDecoder(PASS_ENGINE_PARAMETER_F); } // todo: move this somewhere else? maybe. -bool getAcToggle(Engine *engine) { - engine_configuration_s *engineConfiguration = engine->engineConfiguration; +bool getAcToggle(DECLARE_ENGINE_PARAMETER_F) { /** * todo: make this flexible * diff --git a/firmware/controllers/sensors/allsensors.h b/firmware/controllers/sensors/allsensors.h index fe73dc3fc3..d278891a64 100644 --- a/firmware/controllers/sensors/allsensors.h +++ b/firmware/controllers/sensors/allsensors.h @@ -27,6 +27,6 @@ void initSensors(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_S); -bool getAcToggle(Engine *engine); +bool getAcToggle(DECLARE_ENGINE_PARAMETER_F); #endif /*SENSORS_H_*/ diff --git a/firmware/controllers/sensors/voltage.cpp b/firmware/controllers/sensors/voltage.cpp index e896de9687..655839145b 100644 --- a/firmware/controllers/sensors/voltage.cpp +++ b/firmware/controllers/sensors/voltage.cpp @@ -8,14 +8,16 @@ */ #include "main.h" -#include "engine_configuration.h" +#include "engine.h" #include "adc_inputs.h" #include "voltage.h" -float getVRef(engine_configuration_s *engineConfiguration) { +EXTERN_ENGINE; + +float getVRef(DECLARE_ENGINE_PARAMETER_F) { return getVoltageDivided("vref", engineConfiguration->vRefAdcChannel); } -float getVBatt(engine_configuration_s *engineConfiguration) { +float getVBatt(DECLARE_ENGINE_PARAMETER_F) { return getVoltage("vbatt", engineConfiguration->vbattAdcChannel) * engineConfiguration->vbattDividerCoeff; } diff --git a/firmware/controllers/sensors/voltage.h b/firmware/controllers/sensors/voltage.h index b6fd233661..53a2f9bbf2 100644 --- a/firmware/controllers/sensors/voltage.h +++ b/firmware/controllers/sensors/voltage.h @@ -13,7 +13,7 @@ #include "main.h" #include "engine_configuration.h" -float getVRef(engine_configuration_s *engineConfiguration); -float getVBatt(engine_configuration_s *engineConfiguration); +float getVRef(DECLARE_ENGINE_PARAMETER_F); +float getVBatt(DECLARE_ENGINE_PARAMETER_F); #endif diff --git a/firmware/hw_layer/adc_inputs.cpp b/firmware/hw_layer/adc_inputs.cpp index e17ac2d452..08649c571c 100644 --- a/firmware/hw_layer/adc_inputs.cpp +++ b/firmware/hw_layer/adc_inputs.cpp @@ -200,7 +200,7 @@ int getInternalAdcValue(const char *msg, adc_channel_e hwChannel) { return fastAdc.samples[internalIndex]; } if (adcHwChannelEnabled[hwChannel] != ADC_SLOW) { - warning(OBD_PCM_Processor_Fault, "ADC is off %d", hwChannel); + warning(OBD_PCM_Processor_Fault, "ADC is off [%s] index=%d", msg, hwChannel); } return slowAdc.getAdcValueByHwChannel(hwChannel); @@ -492,6 +492,7 @@ static void configureInputs(void) { addChannel("hip", engineConfiguration->hipOutputChannel, ADC_FAST); addChannel("VBatt", engineConfiguration->vbattAdcChannel, ADC_SLOW); + addChannel("Vref", engineConfiguration->vRefAdcChannel, ADC_SLOW); addChannel("CLT", engineConfiguration->clt.adcChannel, ADC_SLOW); addChannel("IAT", engineConfiguration->iat.adcChannel, ADC_SLOW); addChannel("AFR", engineConfiguration->afr.hwChannel, ADC_SLOW); diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index 846366c811..e8cafbdbfb 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -291,5 +291,5 @@ int getRusEfiVersion(void) { return 123; // this is here to make the compiler happy about the unused array if (UNUSED_CCM_SIZE[0] * 0 != 0) return 3211; // this is here to make the compiler happy about the unused array - return 20150522; + return 20150523; } diff --git a/java_console/ui/src/com/rusefi/Launcher.java b/java_console/ui/src/com/rusefi/Launcher.java index 96527d9b19..84c8016c86 100644 --- a/java_console/ui/src/com/rusefi/Launcher.java +++ b/java_console/ui/src/com/rusefi/Launcher.java @@ -32,7 +32,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig; * @see com.rusefi.StartupFrame */ public class Launcher { - public static final int CONSOLE_VERSION = 20150520; + public static final int CONSOLE_VERSION = 20150523; public static final boolean SHOW_STIMULATOR = false; private static final String TAB_INDEX = "main_tab"; protected static final String PORT_KEY = "port"; diff --git a/java_console/ui/src/com/rusefi/ui/RecentCommands.java b/java_console/ui/src/com/rusefi/ui/RecentCommands.java index 462f192e3a..baae25fcb3 100644 --- a/java_console/ui/src/com/rusefi/ui/RecentCommands.java +++ b/java_console/ui/src/com/rusefi/ui/RecentCommands.java @@ -32,6 +32,7 @@ public class RecentCommands { private static final String TSINFO = "tsinfo"; private static final String FUELINFO = "fuelinfo"; private static final String TEMPINFO = "tempinfo"; + private static final String HIPINFO = "hipinfo"; private final static Map COMMAND_ICONS = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); @@ -48,6 +49,7 @@ public class RecentCommands { COMMAND_ICONS.put(TSINFO, infoIcon); COMMAND_ICONS.put(FUELINFO, infoIcon); COMMAND_ICONS.put(TEMPINFO, infoIcon); + COMMAND_ICONS.put(HIPINFO, infoIcon); } private final JPanel content = new JPanel(new GridLayout(NUMBER_OF_COMMANDS + 1, 1)); @@ -112,6 +114,7 @@ public class RecentCommands { add(ACCELINFO); add(FUELINFO); add(TEMPINFO); + add(HIPINFO); } public void add(String command) { diff --git a/unit_tests/test_fuel_map.cpp b/unit_tests/test_fuel_map.cpp index d71d6d2fce..a66b991a75 100644 --- a/unit_tests/test_fuel_map.cpp +++ b/unit_tests/test_fuel_map.cpp @@ -95,7 +95,7 @@ void testFuelMap(void) { assertEqualsM("IAT", 2, iatCorrection); float cltCorrection = getCltCorrection(getCoolantTemperature(PASS_ENGINE_PARAMETER_F) PASS_ENGINE_PARAMETER); assertEqualsM("CLT", 1, cltCorrection); - float injectorLag = getInjectorLag(getVBatt(engineConfiguration) PASS_ENGINE_PARAMETER); + float injectorLag = getInjectorLag(getVBatt(PASS_ENGINE_PARAMETER_F) PASS_ENGINE_PARAMETER); assertEquals(0, injectorLag); testMafValue = 5;