diff --git a/firmware/config/engines/dodge_neon.cpp b/firmware/config/engines/dodge_neon.cpp index 91c2ab2a2a..0962088aa4 100644 --- a/firmware/config/engines/dodge_neon.cpp +++ b/firmware/config/engines/dodge_neon.cpp @@ -32,6 +32,19 @@ #define xxxxx 12 +static const fsio_table_8x8_f32t vBattTarget = { + /* Generated by TS2C on Sat Jul 02 16:13:34 EDT 2016*/ + {/* 0 20.000 *//* 0 650.0*/12.000, /* 1 800.0*/12.000, /* 2 1650.0*/13.000, /* 3 2500.0*/14.000, /* 4 3350.0*/15.000, /* 5 4200.0*/15.000, /* 6 5050.0*/15.000, /* 7 7000.0*/15.000, }, + {/* 1 30.000 *//* 0 650.0*/12.000, /* 1 800.0*/12.000, /* 2 1650.0*/13.000, /* 3 2500.0*/14.000, /* 4 3350.0*/15.000, /* 5 4200.0*/15.000, /* 6 5050.0*/15.000, /* 7 7000.0*/15.000, }, + {/* 2 40.000 *//* 0 650.0*/12.000, /* 1 800.0*/12.000, /* 2 1650.0*/13.000, /* 3 2500.0*/14.000, /* 4 3350.0*/15.000, /* 5 4200.0*/15.000, /* 6 5050.0*/15.000, /* 7 7000.0*/15.000, }, + {/* 3 60.000 *//* 0 650.0*/12.000, /* 1 800.0*/12.000, /* 2 1650.0*/13.000, /* 3 2500.0*/14.000, /* 4 3350.0*/15.000, /* 5 4200.0*/15.000, /* 6 5050.0*/15.000, /* 7 7000.0*/15.000, }, + {/* 4 70.000 *//* 0 650.0*/12.000, /* 1 800.0*/12.000, /* 2 1650.0*/13.000, /* 3 2500.0*/14.000, /* 4 3350.0*/15.000, /* 5 4200.0*/15.000, /* 6 5050.0*/15.000, /* 7 7000.0*/15.000, }, + {/* 5 90.000 *//* 0 650.0*/12.000, /* 1 800.0*/12.000, /* 2 1650.0*/13.000, /* 3 2500.0*/14.000, /* 4 3350.0*/15.000, /* 5 4200.0*/15.000, /* 6 5050.0*/15.000, /* 7 7000.0*/15.000, }, + {/* 6 100.000 *//* 0 650.0*/12.000, /* 1 800.0*/12.000, /* 2 1650.0*/13.000, /* 3 2500.0*/14.000, /* 4 3350.0*/15.000, /* 5 4200.0*/15.000, /* 6 5050.0*/15.000, /* 7 7000.0*/15.000, }, + {/* 7 120.000 *//* 0 650.0*/12.000, /* 1 800.0*/12.000, /* 2 1650.0*/13.000, /* 3 2500.0*/14.000, /* 4 3350.0*/15.000, /* 5 4200.0*/15.000, /* 6 5050.0*/15.000, /* 7 7000.0*/15.000, }, +}; + + static const fuel_table_t alphaNfuel = { {/*0 engineLoad=0.00*/ /*0 800.0*/003.7, /*1 1213.0*/003.6, /*2 1626.0*/003.6, /*3 2040.0*/004.0, /*4 2453.0*/004.0, /*5 2866.0*/004.0, /*6 3280.0*/006.0, /*7 3693.0*/xxxxx, /*8 4106.0*/xxxxx, /*9 4520.0*/xxxxx, /*10 4933.0*/xxxxx, /*11 5346.0*/xxxxx, /*12 5760.0*/xxxxx, /*13 6173.0*/xxxxx, /*14 6586.0*/xxxxx, /*15 7000.0*/xxxxx}, {/*1 engineLoad=6.66*/ /*0 800.0*/004.0, /*1 1213.0*/004.0, /*2 1626.0*/004.0, /*3 2040.0*/005.0, /*4 2453.0*/004.5, /*5 2866.0*/004.5, /*6 3280.0*/005.0, /*7 3693.0*/xxxxx, /*8 4106.0*/xxxxx, /*9 4520.0*/xxxxx, /*10 4933.0*/xxxxx, /*11 5346.0*/xxxxx, /*12 5760.0*/xxxxx, /*13 6173.0*/xxxxx, /*14 6586.0*/xxxxx, /*15 7000.0*/xxxxx}, @@ -272,6 +285,8 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) { //setWholeTimingTable(12 PASS_ENGINE_PARAMETER); copyTimingTable(fromODB, config->ignitionTable); + copy2DTable(vBattTarget, config->fsioTable1); + copyFuelTable(veDodgeNeon2003Table, config->veTable); //setMap(config->veTable, 50); @@ -310,7 +325,7 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) { * http://rusefi.com/wiki/index.php?title=Manual:Hardware_Frankenso_board */ // Frankenso low out #1: PE6 main relay - // Frankenso low out #2: PE5 alternator field control + // Frankenso low out #2: PE5 // Frankenso low out #3: PD7 coolant fan relay // Frankenso low out #4: PC13 idle valve solenoid // Frankenso low out #5: PE3 fuel pump relay @@ -423,15 +438,22 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) { // boardConfiguration->clutchUpPin = GPIOA_14; // note SWCLK - conflict with SWD boardConfiguration->clutchUpPinMode = PI_PULLUP; - // alt GPIOC_12 + engineConfiguration->auxPidPins[0] = GPIOD_5; // playing with AUX PID for alternator + engineConfiguration->auxPidFrequency[0] = 300; + + engineConfiguration->isVerboseAuxPid = true; + engineConfiguration->auxPid1.offset = 10; + engineConfiguration->auxPid1.pFactor = 5; + engineConfiguration->auxPid1.iFactor = 0.1; + engineConfiguration->auxPid1.dFactor = 0.1; + - /** - * set_fsio_setting 0 0.11 - */ - boardConfiguration->fsio_setting[0] = 0.2; #if EFI_FSIO || defined(__DOXYGEN__) - boardConfiguration->fsio_setting[0] = 0.55; - setFsioExt(0, GPIOE_5, "0 fsio_setting", 400 PASS_ENGINE_PARAMETER); +// /** +// * set_fsio_setting 0 0.55 +// */ +// boardConfiguration->fsio_setting[0] = 0.55; +// setFsioExt(0, GPIOE_5, "0 fsio_setting", 400 PASS_ENGINE_PARAMETER); #endif boardConfiguration->vehicleSpeedSensorInputPin = GPIOA_8; @@ -446,7 +468,7 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) { boardConfiguration->tunerStudioSerialSpeed = 19200; setAlgorithm(LM_SPEED_DENSITY PASS_ENGINE_PARAMETER); - boardConfiguration->alternatorControlPin = GPIOD_5; +//temp boardConfiguration->alternatorControlPin = GPIOD_5; engineConfiguration->targetVBatt = 14.5; engineConfiguration->alternatorControl.offset = 10; engineConfiguration->alternatorControl.pFactor = 5; diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index 805765226e..59cf058a46 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -657,6 +657,8 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) { for (int i = 0; i < EGT_CHANNEL_COUNT; i++) { boardConfiguration->max31855_cs[i] = GPIO_UNASSIGNED; } + + engineConfiguration->alternatorPwmFrequency = 300; for (int i = 0; i < AUX_PID_COUNT; i++) { engineConfiguration->auxPidPins[i] = GPIO_UNASSIGNED; } diff --git a/firmware/controllers/algo/rusefi_generated.h b/firmware/controllers/algo/rusefi_generated.h index 196959dcbb..ddc5fe3959 100644 --- a/firmware/controllers/algo/rusefi_generated.h +++ b/firmware/controllers/algo/rusefi_generated.h @@ -1,6 +1,6 @@ #define LE_COMMAND_LENGTH 200 #define FSIO_ADC_COUNT 4 -#define TS_FILE_VERSION 20160430 +#define TS_FILE_VERSION 20160702 #define WARMUP_TARGET_AFR_SIZE 4 #define MAP_ANGLE_SIZE 8 #define MAP_WINDOW_SIZE 8 diff --git a/firmware/controllers/core/table_helper.h b/firmware/controllers/core/table_helper.h index b018b7362a..c916e5f2a0 100644 --- a/firmware/controllers/core/table_helper.h +++ b/firmware/controllers/core/table_helper.h @@ -126,6 +126,15 @@ void Map3D::setAll(vType value) { } } +template +void copy2DTable(const vType source[LOAD_BIN_SIZE][RPM_BIN_SIZE], vType destination[LOAD_BIN_SIZE][RPM_BIN_SIZE]) { + for (int k = 0; k < LOAD_BIN_SIZE; k++) { + for (int rpmIndex = 0; rpmIndex < RPM_BIN_SIZE; rpmIndex++) { + destination[k][rpmIndex] = source[k][rpmIndex]; + } + } +} + /** * AFR value is packed into uint8_t with a multiplier of 10 */ diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 451a93eb75..d18fa48142 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -21,7 +21,7 @@ struct_no_prefix engine_configuration_s ! ! this is used to confirm that firmware and TunerStudio are using the same rusefi.ini version ! so not forget to change fileVersion in rusefi.ini -#define TS_FILE_VERSION 20160430 +#define TS_FILE_VERSION 20160702 #define WARMUP_TARGET_AFR_SIZE 4 diff --git a/firmware/tunerstudio/rusefi.ini b/firmware/tunerstudio/rusefi.ini index b52f7bfd50..9745e9e91e 100644 --- a/firmware/tunerstudio/rusefi.ini +++ b/firmware/tunerstudio/rusefi.ini @@ -42,7 +42,7 @@ enable2ndByteCanID = false ; see PAGE_0_SIZE in C source code ; CONFIG_DEFINITION_START -; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Jul 02 13:56:26 EDT 2016 +; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Jul 02 16:24:07 EDT 2016 pageSize = 16376 page = 1 @@ -741,7 +741,7 @@ page = 1 [OutputChannels] ; see TS_FILE_VERSION in firmware code -fileVersion = { 20160430 } +fileVersion = { 20160702 } ochGetCommand = "O" @@ -1665,6 +1665,9 @@ cmd_test_idle_valve = "w\x00\x17\x00\x01" field = "P factor", auxPid1_pFactor, {activateAuxPid1 == 1} field = "I factor", auxPid1_iFactor, {activateAuxPid1 == 1} field = "D factor", auxPid1_dFactor, {activateAuxPid1 == 1} + field = "FSIO pin #2", auxPidPins2 + field = "FSIO pin #3", auxPidPins3 + field = "FSIO pin #4", auxPidPins4 ; Engine->Battery & Alternator dialog = batteryDialog, "Battery Settings", yAxis @@ -1676,6 +1679,7 @@ cmd_test_idle_valve = "w\x00\x17\x00\x01" field = "Target", targetVBatt, {isAlternatorControlEnabled == 1} field = "Pin", alternatorControlPin, {isAlternatorControlEnabled == 1} field = "Pin Mode", alternatorControlPinMode, {isAlternatorControlEnabled == 1} + field = "PWM frequency", alternatorPwmFrequency, {isAlternatorControlEnabled == 1 && onOffAlternatorLogic == 0} field = "Off Above TPS", alternatorOffAboveTps, {isAlternatorControlEnabled == 1} field = "Verbose", isVerboseAlternator, {isAlternatorControlEnabled == 1} field = "control period", alternatorDT, {isAlternatorControlEnabled == 1} diff --git a/java_console/models/src/com/rusefi/core/Sensor.java b/java_console/models/src/com/rusefi/core/Sensor.java index f0858bdc61..357a6bec2e 100644 --- a/java_console/models/src/com/rusefi/core/Sensor.java +++ b/java_console/models/src/com/rusefi/core/Sensor.java @@ -93,6 +93,7 @@ public enum Sensor { DWELL(SensorCategory.OPERATIONS, FieldType.FLOAT, 60, BackgroundColor.MUD, 1, 10), actualLastInjection(SensorCategory.FUEL, FieldType.FLOAT, 64, BackgroundColor.MUD, 0, 30, "ms"), VSS(SensorCategory.OPERATIONS, FieldType.FLOAT, 76, BackgroundColor.BLUE), + FIRMWARE_VERSION(SensorCategory.OPERATIONS, FieldType.INT, 84, BackgroundColor.BLUE), CURRENT_VE(SensorCategory.FUEL, FieldType.FLOAT, 112, BackgroundColor.MUD), deltaTps(SensorCategory.FUEL, FieldType.FLOAT, 116, BackgroundColor.MUD), diff --git a/java_console/ui/src/com/rusefi/Launcher.java b/java_console/ui/src/com/rusefi/Launcher.java index 4882a8e54f..9713e1b7e9 100644 --- a/java_console/ui/src/com/rusefi/Launcher.java +++ b/java_console/ui/src/com/rusefi/Launcher.java @@ -1,8 +1,11 @@ package com.rusefi; import com.rusefi.binaryprotocol.BinaryProtocol; +import com.rusefi.config.Fields; import com.rusefi.core.EngineState; import com.rusefi.core.MessagesCentral; +import com.rusefi.core.Sensor; +import com.rusefi.core.SensorCentral; import com.rusefi.io.ConnectionStatus; import com.rusefi.io.ConnectionWatchdog; import com.rusefi.io.LinkManager; @@ -46,6 +49,7 @@ public class Launcher { // todo: the logic around 'fatalError' could be implemented nicer private String fatalError; public static EngineSnifferPanel engineSnifferPanel; + private static SensorCentral.SensorListener wrongVersionListener; private final JTabbedPane tabbedPane = new JTabbedPane() { @Override @@ -254,6 +258,20 @@ public class Launcher { if (result == JOptionPane.NO_OPTION) System.exit(-1); } + wrongVersionListener = new SensorCentral.SensorListener() { + @Override + public void onSensorUpdate(double value) { + if (value != Fields.TS_FILE_VERSION) { + String message = "This copy of rusEfi console is not compatible with this version of firmware\r\n" + + "Console compatible with " + Fields.TS_FILE_VERSION + " while firmware compatible with " + + (int)value; + JOptionPane.showMessageDialog(Launcher.getFrame(), message); + assert wrongVersionListener != null; + SensorCentral.getInstance().removeListener(Sensor.FIRMWARE_VERSION, wrongVersionListener); + } + } + }; + SensorCentral.getInstance().addListener(Sensor.FIRMWARE_VERSION, wrongVersionListener); JustOneInstance.onStart(); try { boolean isPortDefined = args.length > 0;