From e790dadfe52be8930c0086ee11c5af361b4af961 Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Sun, 23 Jun 2019 06:18:54 -0700 Subject: [PATCH] Add "Reset ECU" button (#857) * add reset button * fix signed/unsigned bug * goodbye degree symbols --- firmware/console/binary/tunerstudio.cpp | 4 +- firmware/controllers/injector_central.cpp | 2 + firmware/tunerstudio/rusefi.input | 49 ++++++++++++----------- 3 files changed, 30 insertions(+), 25 deletions(-) diff --git a/firmware/console/binary/tunerstudio.cpp b/firmware/console/binary/tunerstudio.cpp index 34fcc831fd..0f09ba1626 100644 --- a/firmware/console/binary/tunerstudio.cpp +++ b/firmware/console/binary/tunerstudio.cpp @@ -803,8 +803,8 @@ int tunerStudioHandleCrcCommand(ts_channel_s *tsChannel, char *data, int incomin } else if (command == 't' || command == 'T') { handleTestCommand(tsChannel); } else if (command == TS_IO_TEST_COMMAND) { - uint16_t subsystem = SWAP_UINT16(*(short*)&data[0]); - uint16_t index = SWAP_UINT16(*(short*)&data[2]); + uint16_t subsystem = SWAP_UINT16(*(uint16_t*)&data[0]); + uint16_t index = SWAP_UINT16(*(uint16_t*)&data[2]); if (engineConfiguration->debugMode == DBG_BENCH_TEST) { tsOutputChannels.debugIntField1++; diff --git a/firmware/controllers/injector_central.cpp b/firmware/controllers/injector_central.cpp index bbeda5e1d0..17bfa6d84a 100644 --- a/firmware/controllers/injector_central.cpp +++ b/firmware/controllers/injector_central.cpp @@ -297,6 +297,8 @@ void executeTSCommand(uint16_t subsystem, uint16_t index) { setEngineType(DEFAULT_ENGINE_TYPE); } else if (subsystem == 0x79) { scheduleStopEngine(); + } else if (subsystem == 0xbb) { + NVIC_SystemReset(); } } diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index abc3aa4f56..259ad528af 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -168,14 +168,14 @@ fileVersion = { 20171101 } ; RPMValue = scalar, U32, 0, "RPM", 1, 0.00000 #if CELSIUS - coolant = scalar, F32, 4, "°C", 1, 0.0 + coolant = scalar, F32, 4, "deg C", 1, 0.0 #else - coolant = scalar, F32, 4, "°F", {9/5}, 17.77777 + coolant = scalar, F32, 4, "deg F", {9/5}, 17.77777 #endif #if CELSIUS - intake = scalar, F32, 8, "°C", 1, 0.0 + intake = scalar, F32, 8, "deg C", 1, 0.0 #else - intake = scalar, F32, 8, "°F", {9/5}, 17.77777 + intake = scalar, F32, 8, "deg F", {9/5}, 17.77777 #endif TPSValue = scalar, F32, 12, "%", 1, 0 MAFValue = scalar, F32, 16, "V", 1, 0 @@ -225,14 +225,14 @@ fileVersion = { 20171101 } ind_hasFatalError=bits, U32, 80, [6:6], "true", "false"; ind_isWarnNow =bits, U32, 80, [7:7], "true", "false"; firmwareTsVersion = scalar,U32, 84, "version_p", 1, 0 - egt1 = scalar, S16, 88, "°C", 1, 0 - egt2 = scalar, S16, 90, "°C", 1, 0 - egt3 = scalar, S16, 92, "°C", 1, 0 - egt4 = scalar, S16, 94, "°C", 1, 0 - egt5 = scalar, S16, 96, "°C", 1, 0 - egt6 = scalar, S16, 98, "°C", 1, 0 - egt7 = scalar, S16, 100, "°C", 1, 0 - egt8 = scalar, S16, 102, "°C", 1, 0 + egt1 = scalar, S16, 88, "deg C", 1, 0 + egt2 = scalar, S16, 90, "deg C", 1, 0 + egt3 = scalar, S16, 92, "deg C", 1, 0 + egt4 = scalar, S16, 94, "deg C", 1, 0 + egt5 = scalar, S16, 96, "deg C", 1, 0 + egt6 = scalar, S16, 98, "deg C", 1, 0 + egt7 = scalar, S16, 100, "deg C", 1, 0 + egt8 = scalar, S16, 102, "deg C", 1, 0 rpmAcceleration = scalar, F32, 104, "dRpm", 1, 0 massAirFlowValue= scalar, F32, 108, "Kg/h", 1, 0 veValue = scalar, F32, 112, "ratio", 1, 0 @@ -800,14 +800,14 @@ gaugeCategory = Debug gaugeCategory = Sensors RPMGauge = RPMValue, "Engine Speed", "RPM", 0, 15000, 200, 500, 6000, 6000, 0, 0 #if CELSIUS - CLTGauge = coolant, "Coolant Temp", "°C", -40, 140, -15, 1, 95, 110, 1, 1 + CLTGauge = coolant, "Coolant Temp", "deg C", -40, 140, -15, 1, 95, 110, 1, 1 #else - CLTGauge = coolant, "Coolant Temp", "°F", -40, 285, 5, 35, 205, 230, 1, 1 + CLTGauge = coolant, "Coolant Temp", "deg F", -40, 285, 5, 35, 205, 230, 1, 1 #endif #if CELSIUS - IATGauge = intake, "Intake Air Temp", "°C", -40, 140, -15, 1, 95, 110, 1, 1 + IATGauge = intake, "Intake Air Temp", "deg C", -40, 140, -15, 1, 95, 110, 1, 1 #else - IATGauge = intake, "Intake Air Temp", "°F", -40, 285, 5, 35, 205, 230, 1, 1 + IATGauge = intake, "Intake Air Temp", "deg F", -40, 285, 5, 35, 205, 230, 1, 1 #endif TPSGauge = TPSValue, "Throttle Position", "%", 0, 100, 0, 0, 100, 100, 2, 2 afr1Gauge = AFRValue, "Air:Fuel Ratio 1", "", 10, 19.4, 12, 13, 15, 16, 2, 2 @@ -845,9 +845,9 @@ gaugeCategory = Accel Data gaugeCategory = Fuel Data ;Name Var Title Units Lo Hi LoD LoW HiW HiD vd ld #if CELSIUS - tChargeGauge = tCharge, @@GAUGE_NAME_FUEL_CHARGE_TEMP@@, "°C", -40, 140, -15, 1, 95, 110, 1, 1 + tChargeGauge = tCharge, @@GAUGE_NAME_FUEL_CHARGE_TEMP@@, "deg C", -40, 140, -15, 1, 95, 110, 1, 1 #else - tChargeGauge = tCharge, @@GAUGE_NAME_FUEL_CHARGE_TEMP@@, "°F", -40, 285, 5, 35, 205, 230, 1, 1 + tChargeGauge = tCharge, @@GAUGE_NAME_FUEL_CHARGE_TEMP@@, "deg F", -40, 285, 5, 35, 205, 230, 1, 1 #endif baroCorrectionGauge = baroCorrection,"BaroCorr", "ratio", 0.5, 1.5, 0.6, 0.7, 1.3, 1.4, 1, 1 crankingFuelGauge = crankingFuelMs, @@GAUGE_NAME_FUEL_CRANKING@@, "mSec", 0, 25.5, 1.0, 1.2, 20, 25, 3, 1 @@ -1314,7 +1314,9 @@ cmd_test_check_engine_light = "w\x00\x16\x00\x01" cmd_test_idle_valve = "w\x00\x17\x00\x01" cmd_call_from_pit = "w\x00\x20\x34\x56" cmd_stop_engine = "w\x00\x79\x00\x00" - + +cmd_reset_controller = "w\x00\xbb\x00\x00" + ; See 'executeTSCommand' in firmware source code ; MIATA_NA6_MAP = 41 cmd_set_engine_type_Miata_NA6_MAP = "w\x00\x30\x00\x29" @@ -1512,7 +1514,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" field = "Bias resistor", auxTempSensor1_bias_resistor, {auxTempSensor1_adcChannel != 16} field = "#Here is three pairs of thermistor temperature and resistance." - field = "#Typical temperatures is -40°C, 0°C and 100°C" + field = "#Typical temperatures is -40 deg C, 0 deg C and 100 deg C" field = "" field = "Lowest temperature", auxTempSensor1_tempC_1, {auxTempSensor1_adcChannel != 16} field = "Resistance @ LT", auxTempSensor1_resistance_1, {auxTempSensor1_adcChannel != 16} @@ -1529,7 +1531,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" field = "Bias resistor", auxTempSensor2_bias_resistor, {auxTempSensor2_adcChannel != 16} field = "#Here is three pairs of thermistor temperature and resistance." - field = "#Typical temperatures is -40°C, 0°C and 100°C" + field = "#Typical temperatures is -40 deg C, 0 deg C and 100 deg C" field = "" field = "Lowest temperature", auxTempSensor2_tempC_1, {auxTempSensor2_adcChannel != 16} field = "Resistance @ LT", auxTempSensor2_resistance_1, {auxTempSensor2_adcChannel != 16} @@ -1756,7 +1758,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" field = "Bias resistor", clt_bias_resistor, {clt_adcChannel != 16} field = "#Here is three pairs of thermistor temperature and resistance." - field = "#Typical temperatures is -40°C, 0°C and 100°C" + field = "#Typical temperatures is -40 deg C, 0 deg C and 100 deg C" field = "" field = "Lowest temperature", clt_tempC_1, {clt_adcChannel != 16} field = "Resistance @ LT", clt_resistance_1, {clt_adcChannel != 16} @@ -1779,7 +1781,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" field = "Bias resistor", iat_bias_resistor, {iat_adcChannel != 16} field = "#Here is three pairs of thermistor temperature and resistance." - field = "#Typical temperatures is -40°C, 0°C and 100°C" + field = "#Typical temperatures is -40 deg C, 0 deg C and 100 deg C" field = "" field = "Lowest temperature", iat_tempC_1, {iat_adcChannel != 16} field = "Resistance @ LT", iat_resistance_1, {iat_adcChannel != 16} @@ -2504,6 +2506,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" commandButton = "Check Engine", cmd_test_check_engine_light commandButton = "Idle Air Valve", cmd_test_idle_valve commandButton = "Stop Engine", cmd_stop_engine + commandButton = "Reset ECU", cmd_reset_controller ; bench test dialog = ioTest, "Bench Test & Commands", border