diff --git a/reference/speeduino.ini b/reference/speeduino.ini index 6404adfe..2bbb308e 100644 --- a/reference/speeduino.ini +++ b/reference/speeduino.ini @@ -1407,7 +1407,8 @@ page = 13 onboard_log_tr5_Epin_pin = bits , U08, 125, [0:5], $IO_Pins_no_def unused13_125_2 = bits , U08, 125, [6:7], ";", ",", "tab", "space" - unused12_125_127 = array, U08, 126, [2], "%", 1.0, 0.0, 0.0, 255, 0 + hwTestIgnDuration = scalar, U08, 126, "ms", 1.0, 0.0, 0.0, 10, 0 + hwTestInjDuration = scalar, U08, 127, "ms", 1.0, 0.0, 0.0, 20, 0 ;-------------------------------------------------- ;Second ignition map (Page 14) @@ -1829,6 +1830,9 @@ page = 15 defaultValue = prgm_out06Alias, PrgmOut6 defaultValue = prgm_out07Alias, PrgmOut7 + defaultValue = hwTestInjDuration, 8 + defaultValue = hwTestIgnDuration, 4 + defaultValue = rpmwarn, 3000 defaultValue = rpmdang, 5000 defaultValue = rpmhigh, 8000 @@ -2322,18 +2326,36 @@ menuDialog = main cmdEnableTestMode = "Click this to enable test mode. This will not be available if the engine is running" cmdStopTestMode = "Click this to disable test mode" - cmdtestinj150dc = "This will cycle the output at 50% Duty cycle at a 1s interval" - cmdtestinj250dc = "This will cycle the output at 50% Duty cycle at a 1s interval" - cmdtestinj350dc = "This will cycle the output at 50% Duty cycle at a 1s interval" - cmdtestinj450dc = "This will cycle the output at 50% Duty cycle at a 1s interval" - cmdtestinj550dc = "This will cycle the output at 50% Duty cycle at a 1s interval" - cmdtestinj650dc = "This will cycle the output at 50% Duty cycle at a 1s interval" - cmdtestinj750dc = "This will cycle the output at 50% Duty cycle at a 1s interval" - cmdtestinj850dc = "This will cycle the output at 50% Duty cycle at a 1s interval" - cmdtestspk150dc = "This will cycle the output at 50% Duty cycle at a 1s interval" - cmdtestspk250dc = "This will cycle the output at 50% Duty cycle at a 1s interval" - cmdtestspk350dc = "This will cycle the output at 50% Duty cycle at a 1s interval" - cmdtestspk450dc = "This will cycle the output at 50% Duty cycle at a 1s interval" + cmdtestinj1Pulsed = "This will pulse the outputs for the selected duration at a frequency of 30Hz" + cmdtestinj2Pulsed = "This will pulse the outputs for the selected duration at a frequency of 30Hz" + cmdtestinj3Pulsed = "This will pulse the outputs for the selected duration at a frequency of 30Hz" + cmdtestinj4Pulsed = "This will pulse the outputs for the selected duration at a frequency of 30Hz" + cmdtestinj5Pulsed = "This will pulse the outputs for the selected duration at a frequency of 30Hz" + cmdtestinj6Pulsed = "This will pulse the outputs for the selected duration at a frequency of 30Hz" + cmdtestinj7Pulsed = "This will pulse the outputs for the selected duration at a frequency of 30Hz" + cmdtestinj8Pulsed = "This will pulse the outputs for the selected duration at a frequency of 30Hz" + cmdtestspk1Pulsed = "This will pulse the outputs for the selected duration at a frequency of 30Hz" + cmdtestspk2Pulsed = "This will pulse the outputs for the selected duration at a frequency of 30Hz" + cmdtestspk3Pulsed = "This will pulse the outputs for the selected duration at a frequency of 30Hz" + cmdtestspk4Pulsed = "This will pulse the outputs for the selected duration at a frequency of 30Hz" + + cmdtestinj1on = "The injector output will be turned on. DO NOT USE THIS WITH INJECTORS CONNECTED" + cmdtestinj2on = "The injector output will be turned on. DO NOT USE THIS WITH INJECTORS CONNECTED" + cmdtestinj3on = "The injector output will be turned on. DO NOT USE THIS WITH INJECTORS CONNECTED" + cmdtestinj4on = "The injector output will be turned on. DO NOT USE THIS WITH INJECTORS CONNECTED" + cmdtestinj5on = "The injector output will be turned on. DO NOT USE THIS WITH INJECTORS CONNECTED" + cmdtestinj6on = "The injector output will be turned on. DO NOT USE THIS WITH INJECTORS CONNECTED" + cmdtestinj7on = "The injector output will be turned on. DO NOT USE THIS WITH INJECTORS CONNECTED" + cmdtestinj8on = "The injector output will be turned on. DO NOT USE THIS WITH INJECTORS CONNECTED" + + cmdtestspk1on = "The ignition output will be turned on. DO NOT USE THIS WITH COIL CONNECTED" + cmdtestspk2on = "The ignition output will be turned on. DO NOT USE THIS WITH COIL CONNECTED" + cmdtestspk3on = "The ignition output will be turned on. DO NOT USE THIS WITH COIL CONNECTED" + cmdtestspk4on = "The ignition output will be turned on. DO NOT USE THIS WITH COIL CONNECTED" + cmdtestspk5on = "The ignition output will be turned on. DO NOT USE THIS WITH COIL CONNECTED" + cmdtestspk6on = "The ignition output will be turned on. DO NOT USE THIS WITH COIL CONNECTED" + cmdtestspk7on = "The ignition output will be turned on. DO NOT USE THIS WITH COIL CONNECTED" + cmdtestspk8on = "The ignition output will be turned on. DO NOT USE THIS WITH COIL CONNECTED" cmdFormatSD = "Click this to format the SD card" ;For some reason the command name cmdSDFormat appears to be a reserved word and will not work @@ -3386,7 +3408,7 @@ menuDialog = main panel = stagingTableDialog_south, South dialog = outputtest_warningmessage, "" - field = "WARNING! USE AT YOUR OWN RISK. INCORRECT USE WILL DAMAGE YOUR HARDWARE!" + field = "!WARNING! USE AT YOUR OWN RISK. INCORRECT USE WILL DAMAGE YOUR HARDWARE!" field = "Do not attempt to use this page whilst your engine is running!" field = "Forcing the Injector or Spark outputs could cause flooding of your engine or permanent damage to ignition coils!" @@ -3408,38 +3430,38 @@ menuDialog = main dialog = outputtestinj1, "Injector CH1", yAxis commandButton = "Off", cmdtestinj1off,{testactive} - commandButton = "50% DC", cmdtestinj150dc,{!testenabled && testactive} - commandButton = "On", cmdtestinj1on,{!testenabled && testactive} + commandButton = "On - Pulsed", cmdtestinj1Pulsed,{!testenabled && testactive} + commandButton = "On - 100% DC", cmdtestinj1on,{!testenabled && testactive} dialog = outputtestinj2, "Injector CH2", yAxis commandButton = "Off", cmdtestinj2off,{testactive && nFuelChannels >= 2 } - commandButton = "50% DC", cmdtestinj250dc,{!testenabled && testactive && nFuelChannels >= 2 } - commandButton = "On", cmdtestinj2on,{ !testenabled && testactive && nFuelChannels >= 2 } + commandButton = "On - Pulsed", cmdtestinj2Pulsed,{!testenabled && testactive && nFuelChannels >= 2 } + commandButton = "On - 100% DC", cmdtestinj2on,{ !testenabled && testactive && nFuelChannels >= 2 } dialog = outputtestinj3, "Injector CH3", yAxis commandButton = "Off", cmdtestinj3off,{ testactive && nFuelChannels >= 3 } - commandButton = "50% DC", cmdtestinj350dc,{!testenabled && testactive && nFuelChannels >= 3 } - commandButton = "On", cmdtestinj3on,{ !testenabled && testactive && nFuelChannels >= 3 } + commandButton = "On - Pulsed", cmdtestinj3Pulsed,{!testenabled && testactive && nFuelChannels >= 3 } + commandButton = "On - 100% DC", cmdtestinj3on,{ !testenabled && testactive && nFuelChannels >= 3 } dialog = outputtestinj4, "Injector CH4", yAxis commandButton = "Off", cmdtestinj4off,{ testactive && nFuelChannels >= 4 } - commandButton = "50% DC", cmdtestinj450dc,{!testenabled && testactive && nFuelChannels >= 4 } - commandButton = "On", cmdtestinj4on ,{ !testenabled && testactive && nFuelChannels >= 4 } + commandButton = "On - Pulsed", cmdtestinj4Pulsed,{!testenabled && testactive && nFuelChannels >= 4 } + commandButton = "On - 100% DC", cmdtestinj4on ,{ !testenabled && testactive && nFuelChannels >= 4 } dialog = outputtestinj5, "Injector CH5", yAxis commandButton = "Off", cmdtestinj5off,{ testactive && nFuelChannels >= 5 } - commandButton = "50% DC", cmdtestinj550dc,{!testenabled && testactive && nFuelChannels >= 5 } - commandButton = "On", cmdtestinj5on,{ !testenabled && testactive && nFuelChannels >= 5 } + commandButton = "On - Pulsed", cmdtestinj5Pulsed,{!testenabled && testactive && nFuelChannels >= 5 } + commandButton = "On - 100% DC", cmdtestinj5on,{ !testenabled && testactive && nFuelChannels >= 5 } dialog = outputtestinj6, "Injector CH6", yAxis commandButton = "Off", cmdtestinj6off,{ testactive && nFuelChannels >= 6 } - commandButton = "50% DC", cmdtestinj650dc,{!testenabled && testactive && nFuelChannels >= 6 } - commandButton = "On", cmdtestinj6on ,{ !testenabled && testactive && nFuelChannels >= 6 } + commandButton = "On - Pulsed", cmdtestinj6Pulsed,{!testenabled && testactive && nFuelChannels >= 6 } + commandButton = "On - 100% DC", cmdtestinj6on ,{ !testenabled && testactive && nFuelChannels >= 6 } dialog = outputtestinj7, "Injector CH7", yAxis commandButton = "Off", cmdtestinj7off,{ testactive && nFuelChannels >= 7 } - commandButton = "50% DC", cmdtestinj750dc,{!testenabled && testactive && nFuelChannels >= 7 } - commandButton = "On", cmdtestinj7on,{ !testenabled && testactive && nFuelChannels >= 7 } + commandButton = "On - Pulsed", cmdtestinj7Pulsed,{!testenabled && testactive && nFuelChannels >= 7 } + commandButton = "On - 100% DC", cmdtestinj7on,{ !testenabled && testactive && nFuelChannels >= 7 } dialog = outputtestinj8, "Injector CH8", yAxis commandButton = "Off", cmdtestinj8off,{ testactive && nFuelChannels >= 8 } - commandButton = "50% DC", cmdtestinj850dc,{!testenabled && testactive && nFuelChannels >= 8 } - commandButton = "On", cmdtestinj8on ,{ !testenabled && testactive && nFuelChannels >= 8 } + commandButton = "On - Pulsed", cmdtestinj8Pulsed,{!testenabled && testactive && nFuelChannels >= 8 } + commandButton = "On - 100% DC", cmdtestinj8on ,{ !testenabled && testactive && nFuelChannels >= 8 } - dialog = outputtest_injectors, "Injector Driver Output Test", xAxis + dialog = outputtest_injectors_south, "Injector Driver Output Test", xAxis panel = outputtestinj1 panel = outputtestinj2 panel = outputtestinj3 @@ -3448,41 +3470,45 @@ menuDialog = main panel = outputtestinj6 panel = outputtestinj7 panel = outputtestinj8 + + dialog = outputtest_injectors, "Injector Driver Output Test", yAxis + field = "Test pulse duration", hwTestInjDuration, {testactive} + panel = outputtest_injectors_south dialog = outputtestspk1, "Spark CH1 ", yAxis commandButton = "Off", cmdtestspk1off,{testactive} - commandButton = "50% DC", cmdtestspk150dc,{!testenabled && testactive} - commandButton = "On", cmdtestspk1on,{!testenabled && testactive} + commandButton = "On - Pulsed", cmdtestspk1Pulsed,{!testenabled && testactive} + commandButton = "On - 100% DC", cmdtestspk1on,{!testenabled && testactive} dialog = outputtestspk2, "Spark CH2", yAxis commandButton = "Off", cmdtestspk2off,{testactive && nIgnChannels >= 2 } - commandButton = "50% DC", cmdtestspk250dc,{!testenabled && testactive && nIgnChannels >= 2 } - commandButton = "On", cmdtestspk2on,{ !testenabled && testactive && nIgnChannels >= 2 } + commandButton = "On - Pulsed", cmdtestspk2Pulsed,{!testenabled && testactive && nIgnChannels >= 2 } + commandButton = "On - 100% DC", cmdtestspk2on,{ !testenabled && testactive && nIgnChannels >= 2 } dialog = outputtestspk3, "Spark CH3", yAxis commandButton = "Off", cmdtestspk3off,{testactive && nIgnChannels >= 3 } - commandButton = "50% DC", cmdtestspk350dc,{!testenabled && testactive && nIgnChannels >= 3 } - commandButton = "On", cmdtestspk3on,{ !testenabled && testactive && nIgnChannels >= 3 } + commandButton = "On - Pulsed", cmdtestspk3Pulsed,{!testenabled && testactive && nIgnChannels >= 3 } + commandButton = "On - 100% DC", cmdtestspk3on,{ !testenabled && testactive && nIgnChannels >= 3 } dialog = outputtestspk4, "Spark CH4", yAxis commandButton = "Off", cmdtestspk4off,{testactive && nIgnChannels >= 4 } - commandButton = "50% DC", cmdtestspk450dc,{!testenabled && testactive && nIgnChannels >= 4} - commandButton = "On", cmdtestspk4on,{ !testenabled && testactive && nIgnChannels >= 4 } + commandButton = "On - Pulsed", cmdtestspk4Pulsed,{!testenabled && testactive && nIgnChannels >= 4} + commandButton = "On - 100% DC", cmdtestspk4on,{ !testenabled && testactive && nIgnChannels >= 4 } dialog = outputtestspk5, "Spark CH5", yAxis commandButton = "Off", cmdtestspk5off,{testactive && nIgnChannels >= 5 } - commandButton = "50% DC", cmdtestspk550dc,{!testenabled && testactive && nIgnChannels >= 5} - commandButton = "On", cmdtestspk5on,{ !testenabled && testactive && nIgnChannels >= 5 } + commandButton = "On - Pulsed", cmdtestspk5Pulsed,{!testenabled && testactive && nIgnChannels >= 5} + commandButton = "On - 100% DC", cmdtestspk5on,{ !testenabled && testactive && nIgnChannels >= 5 } dialog = outputtestspk6, "Spark CH6", yAxis commandButton = "Off", cmdtestspk6off,{testactive && nIgnChannels >= 6 } - commandButton = "50% DC", cmdtestspk650dc,{!testenabled && testactive && nIgnChannels >= 6} - commandButton = "On", cmdtestspk6on,{ !testenabled && testactive && nIgnChannels >= 6 } + commandButton = "On - Pulsed", cmdtestspk6Pulsed,{!testenabled && testactive && nIgnChannels >= 6} + commandButton = "On - 100% DC", cmdtestspk6on,{ !testenabled && testactive && nIgnChannels >= 6 } dialog = outputtestspk7, "Spark CH7", yAxis commandButton = "Off", cmdtestspk7off,{testactive && nIgnChannels >= 7 } - commandButton = "50% DC", cmdtestspk750dc,{!testenabled && testactive && nIgnChannels >= 7} - commandButton = "On", cmdtestspk7on,{ !testenabled && testactive && nIgnChannels >= 7 } + commandButton = "On - Pulsed", cmdtestspk7Pulsed,{!testenabled && testactive && nIgnChannels >= 7} + commandButton = "On - 100% DC", cmdtestspk7on,{ !testenabled && testactive && nIgnChannels >= 7 } dialog = outputtestspk8, "Spark CH8", yAxis commandButton = "Off", cmdtestspk8off,{testactive && nIgnChannels >= 8 } - commandButton = "50% DC", cmdtestspk850dc,{!testenabled && testactive && nIgnChannels >= 8} - commandButton = "On", cmdtestspk8on,{ !testenabled && testactive && nIgnChannels >= 8 } + commandButton = "On - Pulsed", cmdtestspk8Pulsed,{!testenabled && testactive && nIgnChannels >= 8} + commandButton = "On - 100% DC", cmdtestspk8on,{ !testenabled && testactive && nIgnChannels >= 8 } - dialog = outputtest_spark, "Spark Driver Output Test", xAxis + dialog = outputtest_spark_south, "Spark Driver Output Test", xAxis panel = outputtestspk1 panel = outputtestspk2 panel = outputtestspk3 @@ -3492,6 +3518,10 @@ menuDialog = main panel = outputtestspk7 panel = outputtestspk8 + dialog = outputtest_spark, "Spark Driver Output Test", yAxis + field = "Test pulse duration", hwTestIgnDuration, {testactive} + panel = outputtest_spark_south + dialog = outputtest1,"Test Output Hardware" topicHelp = "http://wiki.speeduino.com/en/Hardware_testing_page" panel = enableoutputtestbuttons @@ -4384,53 +4414,53 @@ cmdEnableTestMode = "E\x01\x01" cmdtestinj1on = "E\x02\x01" cmdtestinj1off = "E\x02\x02" -cmdtestinj150dc = "E\x02\x03" +cmdtestinj1Pulsed = "E\x02\x03" cmdtestinj2on = "E\x02\x04" cmdtestinj2off = "E\x02\x05" -cmdtestinj250dc = "E\x02\x06" +cmdtestinj2Pulsed = "E\x02\x06" cmdtestinj3on = "E\x02\x07" cmdtestinj3off = "E\x02\x08" -cmdtestinj350dc = "E\x02\x09" +cmdtestinj3Pulsed = "E\x02\x09" cmdtestinj4on = "E\x02\x0A" cmdtestinj4off = "E\x02\x0B" -cmdtestinj450dc = "E\x02\x0C" +cmdtestinj4Pulsed = "E\x02\x0C" cmdtestinj5on = "E\x02\x0D" cmdtestinj5off = "E\x02\x0E" -cmdtestinj550dc = "E\x02\x0F" +cmdtestinj5Pulsed = "E\x02\x0F" cmdtestinj6on = "E\x02\x10" cmdtestinj6off = "E\x02\x11" -cmdtestinj650dc = "E\x02\x12" +cmdtestinj6Pulsed = "E\x02\x12" cmdtestinj7on = "E\x02\x13" cmdtestinj7off = "E\x02\x14" -cmdtestinj750dc = "E\x02\x15" +cmdtestinj7Pulsed = "E\x02\x15" cmdtestinj8on = "E\x02\x16" cmdtestinj8off = "E\x02\x17" -cmdtestinj850dc = "E\x02\x18" +cmdtestinj8Pulsed = "E\x02\x18" cmdtestspk1on = "E\x03\x01" cmdtestspk1off = "E\x03\x02" -cmdtestspk150dc = "E\x03\x03" +cmdtestspk1Pulsed = "E\x03\x03" cmdtestspk2on = "E\x03\x04" cmdtestspk2off = "E\x03\x05" -cmdtestspk250dc = "E\x03\x06" +cmdtestspk2Pulsed = "E\x03\x06" cmdtestspk3on = "E\x03\x07" cmdtestspk3off = "E\x03\x08" -cmdtestspk350dc = "E\x03\x09" +cmdtestspk3Pulsed = "E\x03\x09" cmdtestspk4on = "E\x03\x0A" cmdtestspk4off = "E\x03\x0B" -cmdtestspk450dc = "E\x03\x0C" +cmdtestspk4Pulsed = "E\x03\x0C" cmdtestspk5on = "E\x03\x0D" cmdtestspk5off = "E\x03\x0E" -cmdtestspk550dc = "E\x03\x0F" +cmdtestspk5Pulsed = "E\x03\x0F" cmdtestspk6on = "E\x03\x10" cmdtestspk6off = "E\x03\x11" -cmdtestspk650dc = "E\x03\x12" +cmdtestspk6Pulsed = "E\x03\x12" cmdtestspk7on = "E\x03\x13" cmdtestspk7off = "E\x03\x14" -cmdtestspk750dc = "E\x03\x15" +cmdtestspk7Pulsed = "E\x03\x15" cmdtestspk8on = "E\x03\x16" cmdtestspk8off = "E\x03\x17" -cmdtestspk850dc = "E\x03\x18" +cmdtestspk8Pulsed = "E\x03\x18" cmdstm32reboot = "E\x32\x00" cmdstm32bootloader ="E\x32\x01" diff --git a/speeduino/TS_CommandButtonHandler.cpp b/speeduino/TS_CommandButtonHandler.cpp index 610de797..c23965fa 100644 --- a/speeduino/TS_CommandButtonHandler.cpp +++ b/speeduino/TS_CommandButtonHandler.cpp @@ -17,7 +17,7 @@ static bool commandRequiresStoppedEngine(uint16_t buttonCommand) { - return ((buttonCommand >= TS_CMD_INJ1_ON) && (buttonCommand <= TS_CMD_IGN8_50PC)) + return ((buttonCommand >= TS_CMD_INJ1_ON) && (buttonCommand <= TS_CMD_IGN8_PULSED)) || ((buttonCommand == TS_CMD_TEST_ENBL) || (buttonCommand == TS_CMD_TEST_DSBL)); } @@ -72,8 +72,8 @@ bool TS_CommandButtonsHandler(uint16_t buttonCommand) closeInjector8(); #endif - HWTest_INJ_50pc = 0; - HWTest_IGN_50pc = 0; + HWTest_INJ_Pulsed = 0; + HWTest_IGN_Pulsed = 0; break; case TS_CMD_TEST_ENBL: // cmd is enable @@ -86,12 +86,12 @@ bool TS_CommandButtonsHandler(uint16_t buttonCommand) break; case TS_CMD_INJ1_OFF: // cmd group is for injector1 off actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector1(); BIT_CLEAR(HWTest_INJ_50pc, INJ1_CMD_BIT); } + if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector1(); BIT_CLEAR(HWTest_INJ_Pulsed, INJ1_CMD_BIT); } break; - case TS_CMD_INJ1_50PC: // cmd group is for injector1 50% dc actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_TOGGLE(HWTest_INJ_50pc, INJ1_CMD_BIT); } - if(!BIT_CHECK(HWTest_INJ_50pc, INJ1_CMD_BIT)) { closeInjector1(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) + case TS_CMD_INJ1_PULSED: // cmd group is for injector1 50% dc actions + if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_SET(HWTest_INJ_Pulsed, INJ1_CMD_BIT); } + if(!BIT_CHECK(HWTest_INJ_Pulsed, INJ1_CMD_BIT)) { closeInjector1(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) break; case TS_CMD_INJ2_ON: // cmd group is for injector2 on actions @@ -99,12 +99,12 @@ bool TS_CommandButtonsHandler(uint16_t buttonCommand) break; case TS_CMD_INJ2_OFF: // cmd group is for injector2 off actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector2(); BIT_CLEAR(HWTest_INJ_50pc, INJ2_CMD_BIT); } + if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector2(); BIT_CLEAR(HWTest_INJ_Pulsed, INJ2_CMD_BIT); } break; - case TS_CMD_INJ2_50PC: // cmd group is for injector2 50%dc actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_TOGGLE(HWTest_INJ_50pc, INJ2_CMD_BIT); } - if(!BIT_CHECK(HWTest_INJ_50pc, INJ2_CMD_BIT)) { closeInjector2(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) + case TS_CMD_INJ2_PULSED: // cmd group is for injector2 50%dc actions + if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_SET(HWTest_INJ_Pulsed, INJ2_CMD_BIT); } + if(!BIT_CHECK(HWTest_INJ_Pulsed, INJ2_CMD_BIT)) { closeInjector2(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) break; case TS_CMD_INJ3_ON: // cmd group is for injector3 on actions @@ -112,12 +112,12 @@ bool TS_CommandButtonsHandler(uint16_t buttonCommand) break; case TS_CMD_INJ3_OFF: // cmd group is for injector3 off actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector3(); BIT_CLEAR(HWTest_INJ_50pc, INJ3_CMD_BIT); } + if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector3(); BIT_CLEAR(HWTest_INJ_Pulsed, INJ3_CMD_BIT); } break; - case TS_CMD_INJ3_50PC: // cmd group is for injector3 50%dc actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_TOGGLE(HWTest_INJ_50pc, INJ3_CMD_BIT); } - if(!BIT_CHECK(HWTest_INJ_50pc, INJ3_CMD_BIT)) { closeInjector3(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) + case TS_CMD_INJ3_PULSED: // cmd group is for injector3 50%dc actions + if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_SET(HWTest_INJ_Pulsed, INJ3_CMD_BIT); } + if(!BIT_CHECK(HWTest_INJ_Pulsed, INJ3_CMD_BIT)) { closeInjector3(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) break; case TS_CMD_INJ4_ON: // cmd group is for injector4 on actions @@ -125,12 +125,12 @@ bool TS_CommandButtonsHandler(uint16_t buttonCommand) break; case TS_CMD_INJ4_OFF: // cmd group is for injector4 off actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector4(); BIT_CLEAR(HWTest_INJ_50pc, INJ4_CMD_BIT); } + if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector4(); BIT_CLEAR(HWTest_INJ_Pulsed, INJ4_CMD_BIT); } break; - case TS_CMD_INJ4_50PC: // cmd group is for injector4 50% dc actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_TOGGLE(HWTest_INJ_50pc, INJ4_CMD_BIT); } - if(!BIT_CHECK(HWTest_INJ_50pc, INJ4_CMD_BIT)) { closeInjector4(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) + case TS_CMD_INJ4_PULSED: // cmd group is for injector4 50% dc actions + if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_SET(HWTest_INJ_Pulsed, INJ4_CMD_BIT); } + if(!BIT_CHECK(HWTest_INJ_Pulsed, INJ4_CMD_BIT)) { closeInjector4(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) break; case TS_CMD_INJ5_ON: // cmd group is for injector5 on actions @@ -138,12 +138,12 @@ bool TS_CommandButtonsHandler(uint16_t buttonCommand) break; case TS_CMD_INJ5_OFF: // cmd group is for injector5 off actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector5(); BIT_CLEAR(HWTest_INJ_50pc, INJ5_CMD_BIT); } + if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector5(); BIT_CLEAR(HWTest_INJ_Pulsed, INJ5_CMD_BIT); } break; - case TS_CMD_INJ5_50PC: // cmd group is for injector5 50%dc actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_TOGGLE(HWTest_INJ_50pc, INJ5_CMD_BIT); } - if(!BIT_CHECK(HWTest_INJ_50pc, INJ5_CMD_BIT)) { closeInjector5(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) + case TS_CMD_INJ5_PULSED: // cmd group is for injector5 50%dc actions + if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_SET(HWTest_INJ_Pulsed, INJ5_CMD_BIT); } + if(!BIT_CHECK(HWTest_INJ_Pulsed, INJ5_CMD_BIT)) { closeInjector5(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) break; case TS_CMD_INJ6_ON: // cmd group is for injector6 on actions @@ -151,12 +151,12 @@ bool TS_CommandButtonsHandler(uint16_t buttonCommand) break; case TS_CMD_INJ6_OFF: // cmd group is for injector6 off actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector6(); BIT_CLEAR(HWTest_INJ_50pc, INJ6_CMD_BIT); } + if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector6(); BIT_CLEAR(HWTest_INJ_Pulsed, INJ6_CMD_BIT); } break; - case TS_CMD_INJ6_50PC: // cmd group is for injector6 50% dc actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_TOGGLE(HWTest_INJ_50pc, INJ6_CMD_BIT); } - if(!BIT_CHECK(HWTest_INJ_50pc, INJ6_CMD_BIT)) { closeInjector6(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) + case TS_CMD_INJ6_PULSED: // cmd group is for injector6 50% dc actions + if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_SET(HWTest_INJ_Pulsed, INJ6_CMD_BIT); } + if(!BIT_CHECK(HWTest_INJ_Pulsed, INJ6_CMD_BIT)) { closeInjector6(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) break; case TS_CMD_INJ7_ON: // cmd group is for injector7 on actions @@ -164,12 +164,12 @@ bool TS_CommandButtonsHandler(uint16_t buttonCommand) break; case TS_CMD_INJ7_OFF: // cmd group is for injector7 off actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector7(); BIT_CLEAR(HWTest_INJ_50pc, INJ7_CMD_BIT); } + if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector7(); BIT_CLEAR(HWTest_INJ_Pulsed, INJ7_CMD_BIT); } break; - case TS_CMD_INJ7_50PC: // cmd group is for injector7 50%dc actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_TOGGLE(HWTest_INJ_50pc, INJ7_CMD_BIT); } - if(!BIT_CHECK(HWTest_INJ_50pc, INJ7_CMD_BIT)) { closeInjector7(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) + case TS_CMD_INJ7_PULSED: // cmd group is for injector7 50%dc actions + if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_SET(HWTest_INJ_Pulsed, INJ7_CMD_BIT); } + if(!BIT_CHECK(HWTest_INJ_Pulsed, INJ7_CMD_BIT)) { closeInjector7(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) break; case TS_CMD_INJ8_ON: // cmd group is for injector8 on actions @@ -177,12 +177,12 @@ bool TS_CommandButtonsHandler(uint16_t buttonCommand) break; case TS_CMD_INJ8_OFF: // cmd group is for injector8 off actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector8(); BIT_CLEAR(HWTest_INJ_50pc, INJ8_CMD_BIT); } + if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector8(); BIT_CLEAR(HWTest_INJ_Pulsed, INJ8_CMD_BIT); } break; - case TS_CMD_INJ8_50PC: // cmd group is for injector8 50% dc actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_TOGGLE(HWTest_INJ_50pc, INJ8_CMD_BIT); } - if(!BIT_CHECK(HWTest_INJ_50pc, INJ8_CMD_BIT)) { closeInjector8(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) + case TS_CMD_INJ8_PULSED: // cmd group is for injector8 50% dc actions + if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_SET(HWTest_INJ_Pulsed, INJ8_CMD_BIT); } + if(!BIT_CHECK(HWTest_INJ_Pulsed, INJ8_CMD_BIT)) { closeInjector8(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) break; case TS_CMD_IGN1_ON: // cmd group is for spark1 on actions @@ -190,12 +190,12 @@ bool TS_CommandButtonsHandler(uint16_t buttonCommand) break; case TS_CMD_IGN1_OFF: // cmd group is for spark1 off actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil1Charge(); BIT_CLEAR(HWTest_IGN_50pc, IGN1_CMD_BIT); } + if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil1Charge(); BIT_CLEAR(HWTest_IGN_Pulsed, IGN1_CMD_BIT); } break; - case TS_CMD_IGN1_50PC: // cmd group is for spark1 50%dc actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_TOGGLE(HWTest_IGN_50pc, IGN1_CMD_BIT); } - if(!BIT_CHECK(HWTest_IGN_50pc, IGN1_CMD_BIT)) { endCoil1Charge(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) + case TS_CMD_IGN1_PULSED: // cmd group is for spark1 50%dc actions + if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_SET(HWTest_IGN_Pulsed, IGN1_CMD_BIT); } + if(!BIT_CHECK(HWTest_IGN_Pulsed, IGN1_CMD_BIT)) { endCoil1Charge(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) break; case TS_CMD_IGN2_ON: // cmd group is for spark2 on actions @@ -203,12 +203,12 @@ bool TS_CommandButtonsHandler(uint16_t buttonCommand) break; case TS_CMD_IGN2_OFF: // cmd group is for spark2 off actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil2Charge(); BIT_CLEAR(HWTest_IGN_50pc, IGN2_CMD_BIT); } + if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil2Charge(); BIT_CLEAR(HWTest_IGN_Pulsed, IGN2_CMD_BIT); } break; - case TS_CMD_IGN2_50PC: // cmd group is for spark2 50%dc actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_TOGGLE(HWTest_IGN_50pc, IGN2_CMD_BIT); } - if(!BIT_CHECK(HWTest_IGN_50pc, IGN2_CMD_BIT)) { endCoil2Charge(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) + case TS_CMD_IGN2_PULSED: // cmd group is for spark2 50%dc actions + if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_SET(HWTest_IGN_Pulsed, IGN2_CMD_BIT); } + if(!BIT_CHECK(HWTest_IGN_Pulsed, IGN2_CMD_BIT)) { endCoil2Charge(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) break; case TS_CMD_IGN3_ON: // cmd group is for spark3 on actions @@ -216,12 +216,12 @@ bool TS_CommandButtonsHandler(uint16_t buttonCommand) break; case TS_CMD_IGN3_OFF: // cmd group is for spark3 off actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil3Charge(); BIT_CLEAR(HWTest_IGN_50pc, IGN3_CMD_BIT); } + if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil3Charge(); BIT_CLEAR(HWTest_IGN_Pulsed, IGN3_CMD_BIT); } break; - case TS_CMD_IGN3_50PC: // cmd group is for spark3 50%dc actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_TOGGLE(HWTest_IGN_50pc, IGN3_CMD_BIT); } - if(!BIT_CHECK(HWTest_IGN_50pc, IGN3_CMD_BIT)) { endCoil3Charge(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) + case TS_CMD_IGN3_PULSED: // cmd group is for spark3 50%dc actions + if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_SET(HWTest_IGN_Pulsed, IGN3_CMD_BIT); } + if(!BIT_CHECK(HWTest_IGN_Pulsed, IGN3_CMD_BIT)) { endCoil3Charge(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) break; case TS_CMD_IGN4_ON: // cmd group is for spark4 on actions @@ -229,12 +229,12 @@ bool TS_CommandButtonsHandler(uint16_t buttonCommand) break; case TS_CMD_IGN4_OFF: // cmd group is for spark4 off actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil4Charge(); BIT_CLEAR(HWTest_IGN_50pc, IGN4_CMD_BIT); } + if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil4Charge(); BIT_CLEAR(HWTest_IGN_Pulsed, IGN4_CMD_BIT); } break; - case TS_CMD_IGN4_50PC: // cmd group is for spark4 50%dc actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_TOGGLE(HWTest_IGN_50pc, IGN4_CMD_BIT); } - if(!BIT_CHECK(HWTest_IGN_50pc, IGN4_CMD_BIT)) { endCoil4Charge(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) + case TS_CMD_IGN4_PULSED: // cmd group is for spark4 50%dc actions + if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_SET(HWTest_IGN_Pulsed, IGN4_CMD_BIT); } + if(!BIT_CHECK(HWTest_IGN_Pulsed, IGN4_CMD_BIT)) { endCoil4Charge(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) break; case TS_CMD_IGN5_ON: // cmd group is for spark5 on actions @@ -242,12 +242,12 @@ bool TS_CommandButtonsHandler(uint16_t buttonCommand) break; case TS_CMD_IGN5_OFF: // cmd group is for spark5 off actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil5Charge(); BIT_CLEAR(HWTest_IGN_50pc, IGN5_CMD_BIT); } + if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil5Charge(); BIT_CLEAR(HWTest_IGN_Pulsed, IGN5_CMD_BIT); } break; - case TS_CMD_IGN5_50PC: // cmd group is for spark4 50%dc actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_TOGGLE(HWTest_IGN_50pc, IGN5_CMD_BIT); } - if(!BIT_CHECK(HWTest_IGN_50pc, IGN5_CMD_BIT)) { endCoil5Charge(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) + case TS_CMD_IGN5_PULSED: // cmd group is for spark4 50%dc actions + if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_SET(HWTest_IGN_Pulsed, IGN5_CMD_BIT); } + if(!BIT_CHECK(HWTest_IGN_Pulsed, IGN5_CMD_BIT)) { endCoil5Charge(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) break; case TS_CMD_IGN6_ON: // cmd group is for spark6 on actions @@ -255,12 +255,12 @@ bool TS_CommandButtonsHandler(uint16_t buttonCommand) break; case TS_CMD_IGN6_OFF: // cmd group is for spark6 off actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil6Charge(); BIT_CLEAR(HWTest_IGN_50pc, IGN6_CMD_BIT); } + if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil6Charge(); BIT_CLEAR(HWTest_IGN_Pulsed, IGN6_CMD_BIT); } break; - case TS_CMD_IGN6_50PC: // cmd group is for spark6 50%dc actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_TOGGLE(HWTest_IGN_50pc, IGN6_CMD_BIT); } - if(!BIT_CHECK(HWTest_IGN_50pc, IGN6_CMD_BIT)) { endCoil6Charge(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) + case TS_CMD_IGN6_PULSED: // cmd group is for spark6 50%dc actions + if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_SET(HWTest_IGN_Pulsed, IGN6_CMD_BIT); } + if(!BIT_CHECK(HWTest_IGN_Pulsed, IGN6_CMD_BIT)) { endCoil6Charge(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) break; case TS_CMD_IGN7_ON: // cmd group is for spark7 on actions @@ -268,12 +268,12 @@ bool TS_CommandButtonsHandler(uint16_t buttonCommand) break; case TS_CMD_IGN7_OFF: // cmd group is for spark7 off actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil7Charge(); BIT_CLEAR(HWTest_IGN_50pc, IGN7_CMD_BIT); } + if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil7Charge(); BIT_CLEAR(HWTest_IGN_Pulsed, IGN7_CMD_BIT); } break; - case TS_CMD_IGN7_50PC: // cmd group is for spark7 50%dc actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_TOGGLE(HWTest_IGN_50pc, IGN7_CMD_BIT); } - if(!BIT_CHECK(HWTest_IGN_50pc, IGN7_CMD_BIT)) { endCoil7Charge(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) + case TS_CMD_IGN7_PULSED: // cmd group is for spark7 50%dc actions + if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_SET(HWTest_IGN_Pulsed, IGN7_CMD_BIT); } + if(!BIT_CHECK(HWTest_IGN_Pulsed, IGN7_CMD_BIT)) { endCoil7Charge(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) break; case TS_CMD_IGN8_ON: // cmd group is for spark8 on actions @@ -281,12 +281,12 @@ bool TS_CommandButtonsHandler(uint16_t buttonCommand) break; case TS_CMD_IGN8_OFF: // cmd group is for spark8 off actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil8Charge(); BIT_CLEAR(HWTest_IGN_50pc, IGN8_CMD_BIT); } + if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil8Charge(); BIT_CLEAR(HWTest_IGN_Pulsed, IGN8_CMD_BIT); } break; - case TS_CMD_IGN8_50PC: // cmd group is for spark8 50%dc actions - if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_TOGGLE(HWTest_IGN_50pc, IGN8_CMD_BIT); } - if(!BIT_CHECK(HWTest_IGN_50pc, IGN8_CMD_BIT)) { endCoil8Charge(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) + case TS_CMD_IGN8_PULSED: // cmd group is for spark8 50%dc actions + if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_SET(HWTest_IGN_Pulsed, IGN8_CMD_BIT); } + if(!BIT_CHECK(HWTest_IGN_Pulsed, IGN8_CMD_BIT)) { endCoil8Charge(); } //Ensure this output is turned off (Otherwise the output may stay on permanently) break; //VSS Calibration routines diff --git a/speeduino/TS_CommandButtonHandler.h b/speeduino/TS_CommandButtonHandler.h index 165c8217..bb8ccc3a 100644 --- a/speeduino/TS_CommandButtonHandler.h +++ b/speeduino/TS_CommandButtonHandler.h @@ -4,58 +4,58 @@ * The command handler manages all the inputs FROM TS which are issued when a command button is clicked by the user */ -#define TS_CMD_TEST_DSBL 256 -#define TS_CMD_TEST_ENBL 257 +#define TS_CMD_TEST_DSBL 256 +#define TS_CMD_TEST_ENBL 257 -#define TS_CMD_INJ1_ON 513 -#define TS_CMD_INJ1_OFF 514 -#define TS_CMD_INJ1_50PC 515 -#define TS_CMD_INJ2_ON 516 -#define TS_CMD_INJ2_OFF 517 -#define TS_CMD_INJ2_50PC 518 -#define TS_CMD_INJ3_ON 519 -#define TS_CMD_INJ3_OFF 520 -#define TS_CMD_INJ3_50PC 521 -#define TS_CMD_INJ4_ON 522 -#define TS_CMD_INJ4_OFF 523 -#define TS_CMD_INJ4_50PC 524 -#define TS_CMD_INJ5_ON 525 -#define TS_CMD_INJ5_OFF 526 -#define TS_CMD_INJ5_50PC 527 -#define TS_CMD_INJ6_ON 528 -#define TS_CMD_INJ6_OFF 529 -#define TS_CMD_INJ6_50PC 530 -#define TS_CMD_INJ7_ON 531 -#define TS_CMD_INJ7_OFF 532 -#define TS_CMD_INJ7_50PC 533 -#define TS_CMD_INJ8_ON 534 -#define TS_CMD_INJ8_OFF 535 -#define TS_CMD_INJ8_50PC 536 +#define TS_CMD_INJ1_ON 513 +#define TS_CMD_INJ1_OFF 514 +#define TS_CMD_INJ1_PULSED 515 +#define TS_CMD_INJ2_ON 516 +#define TS_CMD_INJ2_OFF 517 +#define TS_CMD_INJ2_PULSED 518 +#define TS_CMD_INJ3_ON 519 +#define TS_CMD_INJ3_OFF 520 +#define TS_CMD_INJ3_PULSED 521 +#define TS_CMD_INJ4_ON 522 +#define TS_CMD_INJ4_OFF 523 +#define TS_CMD_INJ4_PULSED 524 +#define TS_CMD_INJ5_ON 525 +#define TS_CMD_INJ5_OFF 526 +#define TS_CMD_INJ5_PULSED 527 +#define TS_CMD_INJ6_ON 528 +#define TS_CMD_INJ6_OFF 529 +#define TS_CMD_INJ6_PULSED 530 +#define TS_CMD_INJ7_ON 531 +#define TS_CMD_INJ7_OFF 532 +#define TS_CMD_INJ7_PULSED 533 +#define TS_CMD_INJ8_ON 534 +#define TS_CMD_INJ8_OFF 535 +#define TS_CMD_INJ8_PULSED 536 -#define TS_CMD_IGN1_ON 769 -#define TS_CMD_IGN1_OFF 770 -#define TS_CMD_IGN1_50PC 771 -#define TS_CMD_IGN2_ON 772 -#define TS_CMD_IGN2_OFF 773 -#define TS_CMD_IGN2_50PC 774 -#define TS_CMD_IGN3_ON 775 -#define TS_CMD_IGN3_OFF 776 -#define TS_CMD_IGN3_50PC 777 -#define TS_CMD_IGN4_ON 778 -#define TS_CMD_IGN4_OFF 779 -#define TS_CMD_IGN4_50PC 780 -#define TS_CMD_IGN5_ON 781 -#define TS_CMD_IGN5_OFF 782 -#define TS_CMD_IGN5_50PC 783 -#define TS_CMD_IGN6_ON 784 -#define TS_CMD_IGN6_OFF 785 -#define TS_CMD_IGN6_50PC 786 -#define TS_CMD_IGN7_ON 787 -#define TS_CMD_IGN7_OFF 788 -#define TS_CMD_IGN7_50PC 789 -#define TS_CMD_IGN8_ON 790 -#define TS_CMD_IGN8_OFF 791 -#define TS_CMD_IGN8_50PC 792 +#define TS_CMD_IGN1_ON 769 +#define TS_CMD_IGN1_OFF 770 +#define TS_CMD_IGN1_PULSED 771 +#define TS_CMD_IGN2_ON 772 +#define TS_CMD_IGN2_OFF 773 +#define TS_CMD_IGN2_PULSED 774 +#define TS_CMD_IGN3_ON 775 +#define TS_CMD_IGN3_OFF 776 +#define TS_CMD_IGN3_PULSED 777 +#define TS_CMD_IGN4_ON 778 +#define TS_CMD_IGN4_OFF 779 +#define TS_CMD_IGN4_PULSED 780 +#define TS_CMD_IGN5_ON 781 +#define TS_CMD_IGN5_OFF 782 +#define TS_CMD_IGN5_PULSED 783 +#define TS_CMD_IGN6_ON 784 +#define TS_CMD_IGN6_OFF 785 +#define TS_CMD_IGN6_PULSED 786 +#define TS_CMD_IGN7_ON 787 +#define TS_CMD_IGN7_OFF 788 +#define TS_CMD_IGN7_PULSED 789 +#define TS_CMD_IGN8_ON 790 +#define TS_CMD_IGN8_OFF 791 +#define TS_CMD_IGN8_PULSED 792 #define TS_CMD_STM32_REBOOT 12800 #define TS_CMD_STM32_BOOTLOADER 12801 diff --git a/speeduino/globals.cpp b/speeduino/globals.cpp index 8f3b0688..a149bcdb 100644 --- a/speeduino/globals.cpp +++ b/speeduino/globals.cpp @@ -138,9 +138,9 @@ int CRANK_ANGLE_MAX_INJ = 360; ///< The number of crank degrees that the system volatile uint32_t runSecsX10; volatile uint32_t seclx10; volatile byte HWTest_INJ = 0; /**< Each bit in this variable represents one of the injector channels and it's HW test status */ -volatile byte HWTest_INJ_50pc = 0; /**< Each bit in this variable represents one of the injector channels and it's 50% HW test status */ +volatile byte HWTest_INJ_Pulsed = 0; /**< Each bit in this variable represents one of the injector channels and it's pulsed HW test status */ volatile byte HWTest_IGN = 0; /**< Each bit in this variable represents one of the ignition channels and it's HW test status */ -volatile byte HWTest_IGN_50pc = 0; +volatile byte HWTest_IGN_Pulsed = 0; byte maxIgnOutputs = 1; /**< Number of ignition outputs being used by the current tune configuration */ byte maxInjOutputs = 1; /**< Number of injection outputs being used by the current tune configuration */ diff --git a/speeduino/globals.h b/speeduino/globals.h index c8bbfe2d..d9711486 100644 --- a/speeduino/globals.h +++ b/speeduino/globals.h @@ -550,9 +550,9 @@ extern int CRANK_ANGLE_MAX_INJ; ///< The number of crank degrees that the extern volatile uint32_t runSecsX10; /**< Counter of seconds since cranking commenced (similar to runSecs) but in increments of 0.1 seconds */ extern volatile uint32_t seclx10; /**< Counter of seconds since powered commenced (similar to secl) but in increments of 0.1 seconds */ extern volatile byte HWTest_INJ; /**< Each bit in this variable represents one of the injector channels and it's HW test status */ -extern volatile byte HWTest_INJ_50pc; /**< Each bit in this variable represents one of the injector channels and it's 50% HW test status */ +extern volatile byte HWTest_INJ_Pulsed; /**< Each bit in this variable represents one of the injector channels and it's 50% HW test status */ extern volatile byte HWTest_IGN; /**< Each bit in this variable represents one of the ignition channels and it's HW test status */ -extern volatile byte HWTest_IGN_50pc; /**< Each bit in this variable represents one of the ignition channels and it's 50% HW test status */ +extern volatile byte HWTest_IGN_Pulsed; /**< Each bit in this variable represents one of the ignition channels and it's 50% HW test status */ extern byte maxIgnOutputs; /**< Number of ignition outputs being used by the current tune configuration */ extern byte maxInjOutputs; /**< Number of injection outputs being used by the current tune configuration */ @@ -1386,8 +1386,8 @@ struct config13 { byte onboard_log_tr5_Epin_pin :6; // "pin", 0, 0, 0, 1, 255, 0 ; byte unused13_125_2 :2; - - byte unused12_126_127[2]; + byte hwTestIgnDuration; + byte hwTestInjDuration; #if defined(CORE_AVR) }; diff --git a/speeduino/timers.cpp b/speeduino/timers.cpp index 4794cb4c..65d7ab2f 100644 --- a/speeduino/timers.cpp +++ b/speeduino/timers.cpp @@ -41,6 +41,9 @@ volatile bool tachoAlt = false; volatile uint16_t tachoSweepIncr; volatile uint16_t tachoSweepAccum; +volatile uint8_t testInjectorPulseCount = 0; +volatile uint8_t testIgnitionPulseCount = 0; + #if defined (CORE_TEENSY) IntervalTimer lowResTimer; #endif @@ -155,6 +158,33 @@ void oneMSInterval(void) //Most ARM chips can simply call a function if (loop33ms == 33) { loop33ms = 0; + + //Pulse fuel and ignition test outputs are set at 30Hz + if( BIT_CHECK(currentStatus.testOutputs, 1) && (currentStatus.RPM == 0) ) + { + //Check for pulsed injector output test + if(BIT_CHECK(HWTest_INJ_Pulsed, INJ1_CMD_BIT)) { openInjector1(); } + if(BIT_CHECK(HWTest_INJ_Pulsed, INJ2_CMD_BIT)) { openInjector2(); } + if(BIT_CHECK(HWTest_INJ_Pulsed, INJ3_CMD_BIT)) { openInjector3(); } + if(BIT_CHECK(HWTest_INJ_Pulsed, INJ4_CMD_BIT)) { openInjector4(); } + if(BIT_CHECK(HWTest_INJ_Pulsed, INJ5_CMD_BIT)) { openInjector5(); } + if(BIT_CHECK(HWTest_INJ_Pulsed, INJ6_CMD_BIT)) { openInjector6(); } + if(BIT_CHECK(HWTest_INJ_Pulsed, INJ7_CMD_BIT)) { openInjector7(); } + if(BIT_CHECK(HWTest_INJ_Pulsed, INJ8_CMD_BIT)) { openInjector8(); } + testInjectorPulseCount = 0; + + //Check for pulsed ignition output test + if(BIT_CHECK(HWTest_IGN_Pulsed, IGN1_CMD_BIT)) { beginCoil1Charge(); } + if(BIT_CHECK(HWTest_IGN_Pulsed, IGN2_CMD_BIT)) { beginCoil2Charge(); } + if(BIT_CHECK(HWTest_IGN_Pulsed, IGN3_CMD_BIT)) { beginCoil3Charge(); } + if(BIT_CHECK(HWTest_IGN_Pulsed, IGN4_CMD_BIT)) { beginCoil4Charge(); } + if(BIT_CHECK(HWTest_IGN_Pulsed, IGN5_CMD_BIT)) { beginCoil5Charge(); } + if(BIT_CHECK(HWTest_IGN_Pulsed, IGN6_CMD_BIT)) { beginCoil6Charge(); } + if(BIT_CHECK(HWTest_IGN_Pulsed, IGN7_CMD_BIT)) { beginCoil7Charge(); } + if(BIT_CHECK(HWTest_IGN_Pulsed, IGN8_CMD_BIT)) { beginCoil8Charge(); } + testIgnitionPulseCount = 0; + } + BIT_SET(TIMER_mask, BIT_TIMER_30HZ); } @@ -279,34 +309,53 @@ void oneMSInterval(void) //Most ARM chips can simply call a function currentStatus.fuelTemp = div100( (int16_t)(((4224 * (long)flexPulseWidth) >> 10) - 8125) ); } - //************************************************************************************************************************************************** - //Handle any of the hardware testing outputs - if( BIT_CHECK(currentStatus.testOutputs, 1) ) - { - //Check whether any of the fuel outputs is on - - //Check for injector outputs on 50% - if(BIT_CHECK(HWTest_INJ_50pc, INJ1_CMD_BIT)) { injector1Toggle(); } - if(BIT_CHECK(HWTest_INJ_50pc, INJ2_CMD_BIT)) { injector2Toggle(); } - if(BIT_CHECK(HWTest_INJ_50pc, INJ3_CMD_BIT)) { injector3Toggle(); } - if(BIT_CHECK(HWTest_INJ_50pc, INJ4_CMD_BIT)) { injector4Toggle(); } - if(BIT_CHECK(HWTest_INJ_50pc, INJ5_CMD_BIT)) { injector5Toggle(); } - if(BIT_CHECK(HWTest_INJ_50pc, INJ6_CMD_BIT)) { injector6Toggle(); } - if(BIT_CHECK(HWTest_INJ_50pc, INJ7_CMD_BIT)) { injector7Toggle(); } - if(BIT_CHECK(HWTest_INJ_50pc, INJ8_CMD_BIT)) { injector8Toggle(); } - - //Check for ignition outputs on 50% - if(BIT_CHECK(HWTest_IGN_50pc, IGN1_CMD_BIT)) { coil1Toggle(); } - if(BIT_CHECK(HWTest_IGN_50pc, IGN2_CMD_BIT)) { coil2Toggle(); } - if(BIT_CHECK(HWTest_IGN_50pc, IGN3_CMD_BIT)) { coil3Toggle(); } - if(BIT_CHECK(HWTest_IGN_50pc, IGN4_CMD_BIT)) { coil4Toggle(); } - if(BIT_CHECK(HWTest_IGN_50pc, IGN5_CMD_BIT)) { coil5Toggle(); } - if(BIT_CHECK(HWTest_IGN_50pc, IGN6_CMD_BIT)) { coil6Toggle(); } - if(BIT_CHECK(HWTest_IGN_50pc, IGN7_CMD_BIT)) { coil7Toggle(); } - if(BIT_CHECK(HWTest_IGN_50pc, IGN8_CMD_BIT)) { coil8Toggle(); } - } - } + + //Turn off any of the pulsed testing outputs if they are active and have been running for long enough + if( BIT_CHECK(currentStatus.testOutputs, 1) ) + { + //Check for pulsed injector output test + if( (HWTest_INJ_Pulsed > 0) ) + { + if(testInjectorPulseCount >= configPage13.hwTestInjDuration) + { + if(BIT_CHECK(HWTest_INJ_Pulsed, INJ1_CMD_BIT)) { closeInjector1(); } + if(BIT_CHECK(HWTest_INJ_Pulsed, INJ2_CMD_BIT)) { closeInjector2(); } + if(BIT_CHECK(HWTest_INJ_Pulsed, INJ3_CMD_BIT)) { closeInjector3(); } + if(BIT_CHECK(HWTest_INJ_Pulsed, INJ4_CMD_BIT)) { closeInjector4(); } + if(BIT_CHECK(HWTest_INJ_Pulsed, INJ5_CMD_BIT)) { closeInjector5(); } + if(BIT_CHECK(HWTest_INJ_Pulsed, INJ6_CMD_BIT)) { closeInjector6(); } + if(BIT_CHECK(HWTest_INJ_Pulsed, INJ7_CMD_BIT)) { closeInjector7(); } + if(BIT_CHECK(HWTest_INJ_Pulsed, INJ8_CMD_BIT)) { closeInjector8(); } + + testInjectorPulseCount = 0; + } + else { testInjectorPulseCount++; } + } + + + //Check for pulsed ignition output test + if( (HWTest_IGN_Pulsed > 0) ) + { + if(testIgnitionPulseCount >= configPage13.hwTestIgnDuration) + { + if(BIT_CHECK(HWTest_IGN_Pulsed, IGN1_CMD_BIT)) { endCoil1Charge(); } + if(BIT_CHECK(HWTest_IGN_Pulsed, IGN2_CMD_BIT)) { endCoil2Charge(); } + if(BIT_CHECK(HWTest_IGN_Pulsed, IGN3_CMD_BIT)) { endCoil3Charge(); } + if(BIT_CHECK(HWTest_IGN_Pulsed, IGN4_CMD_BIT)) { endCoil4Charge(); } + if(BIT_CHECK(HWTest_IGN_Pulsed, IGN5_CMD_BIT)) { endCoil5Charge(); } + if(BIT_CHECK(HWTest_IGN_Pulsed, IGN6_CMD_BIT)) { endCoil6Charge(); } + if(BIT_CHECK(HWTest_IGN_Pulsed, IGN7_CMD_BIT)) { endCoil7Charge(); } + if(BIT_CHECK(HWTest_IGN_Pulsed, IGN8_CMD_BIT)) { endCoil8Charge(); } + + testIgnitionPulseCount = 0; + } + else { testIgnitionPulseCount++; } + } + + } + + #if defined(CORE_AVR) //AVR chips use the ISR for this //Reset Timer2 to trigger in another ~1ms TCNT2 = 131; //Preload timer2 with 100 cycles, leaving 156 till overflow. diff --git a/speeduino/updates.cpp b/speeduino/updates.cpp index 94d5f52d..16f04776 100644 --- a/speeduino/updates.cpp +++ b/speeduino/updates.cpp @@ -727,6 +727,12 @@ void doUpdates(void) if(readEEPROMVersion() == 22) { //202311-dev + + //Default values for pulsed hw test modes + configPage13.hwTestInjDuration = 8; + configPage13.hwTestIgnDuration = 4; + + //DFCO taper default values (Feature disabled by default) configPage9.dfcoTaperEnable = 0; //Disable configPage9.dfcoTaperTime = 10; //1 second configPage9.dfcoTaperFuel = 100; //Don't scale fuel