Enable the use of the 50% hardware test modes

This commit is contained in:
Josh Stewart 2020-05-04 15:08:45 +10:00
parent b8356675de
commit a335820b46
9 changed files with 185 additions and 94 deletions

View File

@ -1643,18 +1643,18 @@ 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"
cmdtestinj250dc = "this will cycle the output at 50% Duty cycle"
cmdtestinj350dc = "this will cycle the output at 50% Duty cycle"
cmdtestinj450dc = "this will cycle the output at 50% Duty cycle"
cmdtestinj550dc = "this will cycle the output at 50% Duty cycle"
cmdtestinj650dc = "this will cycle the output at 50% Duty cycle"
cmdtestinj750dc = "this will cycle the output at 50% Duty cycle"
cmdtestinj850dc = "this will cycle the output at 50% Duty cycle"
cmdtestspk150dc = "this will cycle the output at 50% Duty cycle"
cmdtestspk250dc = "this will cycle the output at 50% Duty cycle"
cmdtestspk350dc = "this will cycle the output at 50% Duty cycle"
cmdtestspk450dc = "this will cycle the output at 50% Duty cycle"
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"
ADCFILTER_TPS = "Recommended value: 50"
ADCFILTER_CLT = "Recommended value: 180"
@ -2386,35 +2386,35 @@ menuDialog = main
dialog = outputtestinj1, "Injector CH1", yAxis
commandButton = "Off", cmdtestinj1off,{testactive}
commandButton = "50% DC", cmdtestinj150dc,{!testenabled && testactive && 0}
commandButton = "50% DC", cmdtestinj150dc,{!testenabled && testactive}
commandButton = "On", cmdtestinj1on,{!testenabled & testactive}
dialog = outputtestinj2, "Injector CH2", yAxis
commandButton = "Off", cmdtestinj2off,{testactive && nFuelChannels >= 2 }
commandButton = "50% DC", cmdtestinj250dc,{!testenabled && testactive && 0}
commandButton = "50% DC", cmdtestinj250dc,{!testenabled && testactive && nFuelChannels >= 2 }
commandButton = "On", cmdtestinj2on,{ !testenabled && testactive && nFuelChannels >= 2 }
dialog = outputtestinj3, "Injector CH3", yAxis
commandButton = "Off", cmdtestinj3off,{ testactive && nFuelChannels >= 3 }
commandButton = "50% DC", cmdtestinj350dc,{!testenabled && testactive && 0}
commandButton = "50% DC", cmdtestinj350dc,{!testenabled && testactive && nFuelChannels >= 3 }
commandButton = "On", cmdtestinj3on,{ !testenabled && testactive && nFuelChannels >= 3 }
dialog = outputtestinj4, "Injector CH4", yAxis
commandButton = "Off", cmdtestinj4off,{ testactive && nFuelChannels >= 4 }
commandButton = "50% DC", cmdtestinj450dc,{!testenabled && testactive && 0}
commandButton = "50% DC", cmdtestinj450dc,{!testenabled && testactive && nFuelChannels >= 4 }
commandButton = "On", cmdtestinj4on ,{ !testenabled && testactive && nFuelChannels >= 4 }
dialog = outputtestinj5, "Injector CH5", yAxis
commandButton = "Off", cmdtestinj5off,{ testactive && nFuelChannels >= 5 }
commandButton = "50% DC", cmdtestinj550dc,{!testenabled && testactive & 0}
commandButton = "50% DC", cmdtestinj550dc,{!testenabled && testactive && nFuelChannels >= 5 }
commandButton = "On", cmdtestinj5on,{ !testenabled && testactive && nFuelChannels >= 5 }
dialog = outputtestinj6, "Injector CH6", yAxis
commandButton = "Off", cmdtestinj6off,{ testactive && nFuelChannels >= 6 }
commandButton = "50% DC", cmdtestinj650dc,{!testenabled && testactive & 0}
commandButton = "50% DC", cmdtestinj650dc,{!testenabled && testactive && nFuelChannels >= 6 }
commandButton = "On", cmdtestinj6on ,{ !testenabled & testactive && nFuelChannels >= 6 }
dialog = outputtestinj7, "Injector CH7", yAxis
commandButton = "Off", cmdtestinj7off,{ testactive && nFuelChannels >= 7 }
commandButton = "50% DC", cmdtestinj750dc,{!testenabled && testactive & 0}
commandButton = "50% DC", cmdtestinj750dc,{!testenabled && testactive && nFuelChannels >= 7 }
commandButton = "On", cmdtestinj7on,{ !testenabled && testactive && nFuelChannels >= 7 }
dialog = outputtestinj8, "Injector CH8", yAxis
commandButton = "Off", cmdtestinj8off,{ testactive && nFuelChannels >= 8 }
commandButton = "50% DC", cmdtestinj850dc,{!testenabled && testactive & 0}
commandButton = "50% DC", cmdtestinj850dc,{!testenabled && testactive && nFuelChannels >= 8 }
commandButton = "On", cmdtestinj8on ,{ !testenabled & testactive && nFuelChannels >= 8 }
dialog = outputtest_injectors, "Injector Driver Output Test", xAxis
@ -2429,35 +2429,35 @@ menuDialog = main
dialog = outputtestspk1, "Spark CH1 ", yAxis
commandButton = "Off", cmdtestspk1off,{testactive}
commandButton = "50% DC", cmdtestspk150dc,{!testenabled && testactive && 0}
commandButton = "50% DC", cmdtestspk150dc,{!testenabled && testactive}
commandButton = "On", cmdtestspk1on,{!testenabled && testactive}
dialog = outputtestspk2, "Spark CH2", yAxis
commandButton = "Off", cmdtestspk2off,{testactive && nIgnChannels >= 2 }
commandButton = "50% DC", cmdtestspk250dc,{!testenabled && testactive && 0}
commandButton = "50% DC", cmdtestspk250dc,{!testenabled && testactive && nIgnChannels >= 2 }
commandButton = "On", cmdtestspk2on,{ !testenabled && testactive && nIgnChannels >= 2 }
dialog = outputtestspk3, "Spark CH3", yAxis
commandButton = "Off", cmdtestspk3off,{testactive && nIgnChannels >= 3 }
commandButton = "50% DC", cmdtestspk350dc,{!testenabled && testactive && 0}
commandButton = "50% DC", cmdtestspk350dc,{!testenabled && testactive && nIgnChannels >= 3 }
commandButton = "On", cmdtestspk3on,{ !testenabled && testactive && nIgnChannels >= 3 }
dialog = outputtestspk4, "Spark CH4", yAxis
commandButton = "Off", cmdtestspk4off,{testactive && nIgnChannels >= 4 }
commandButton = "50% DC", cmdtestspk450dc,{!testenabled && testactive && 0}
commandButton = "50% DC", cmdtestspk450dc,{!testenabled && testactive && nIgnChannels >= 4}
commandButton = "On", cmdtestspk4on,{ !testenabled && testactive && nIgnChannels >= 4 }
dialog = outputtestspk5, "Spark CH5", yAxis
commandButton = "Off", cmdtestspk5off,{testactive && nIgnChannels >= 5 }
commandButton = "50% DC", cmdtestspk550dc,{!testenabled && testactive && 0}
commandButton = "50% DC", cmdtestspk550dc,{!testenabled && testactive && nIgnChannels >= 5}
commandButton = "On", cmdtestspk5on,{ !testenabled && testactive && nIgnChannels >= 5 }
dialog = outputtestspk6, "Spark CH6", yAxis
commandButton = "Off", cmdtestspk6off,{testactive && nIgnChannels >= 6 }
commandButton = "50% DC", cmdtestspk650dc,{!testenabled && testactive && 0}
commandButton = "50% DC", cmdtestspk650dc,{!testenabled && testactive && nIgnChannels >= 6}
commandButton = "On", cmdtestspk6on,{ !testenabled && testactive && nIgnChannels >= 6 }
dialog = outputtestspk7, "Spark CH7", yAxis
commandButton = "Off", cmdtestspk7off,{testactive && nIgnChannels >= 7 }
commandButton = "50% DC", cmdtestspk750dc,{!testenabled && testactive && 0}
commandButton = "50% DC", cmdtestspk750dc,{!testenabled && testactive && nIgnChannels >= 7}
commandButton = "On", cmdtestspk7on,{ !testenabled && testactive && nIgnChannels >= 7 }
dialog = outputtestspk8, "Spark CH8", yAxis
commandButton = "Off", cmdtestspk8off,{testactive && nIgnChannels >= 8 }
commandButton = "50% DC", cmdtestspk850dc,{!testenabled && testactive && 0}
commandButton = "50% DC", cmdtestspk850dc,{!testenabled && testactive && nIgnChannels >= 8}
commandButton = "On", cmdtestspk8on,{ !testenabled && testactive && nIgnChannels >= 8 }
dialog = outputtest_spark, "Spark Driver Output Test", xAxis

View File

@ -4,6 +4,9 @@
* 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_INJ1_ON 513
#define TS_CMD_INJ1_OFF 514
#define TS_CMD_INJ1_50PC 515

View File

@ -9,6 +9,9 @@
#include "utils.h"
#include "scheduledIO.h"
#include "sensors.h"
#ifdef USE_MC33810
#include "acc_mc33810.h"
#endif
/**
* @brief
@ -21,7 +24,7 @@ uint16_t TS_CommandButtonsHandler(int buttonCommand)
uint16_t returnValue = 0;
switch (buttonCommand)
{
case 256: // cmd is stop
case TS_CMD_TEST_DSBL: // cmd is stop
BIT_CLEAR(currentStatus.testOutputs, 1);
endCoil1Charge();
endCoil2Charge();
@ -43,9 +46,12 @@ uint16_t TS_CommandButtonsHandler(int buttonCommand)
#if INJ_CHANNELS >= 8
closeInjector8();
#endif
HWTest_INJ_50pc = 0;
HWTest_IGN_50pc = 0;
break;
case 257: // cmd is enable
case TS_CMD_TEST_ENBL: // cmd is enable
// currentStatus.testactive = 1;
BIT_SET(currentStatus.testOutputs, 1);
break;
@ -55,17 +61,12 @@ uint16_t TS_CommandButtonsHandler(int buttonCommand)
break;
case TS_CMD_INJ1_OFF: // cmd group is for injector1 off actions
if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector1(); }
if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector1(); BIT_CLEAR(HWTest_INJ_50pc, 1); }
break;
case TS_CMD_INJ1_50PC: // cmd group is for injector1 50% dc actions
//for (byte dcloop = 0; dcloop < 11; dcloop++)
//{
// digitalWrite(pinInjector1, HIGH);
// delay(500);
// digitalWrite(pinInjector1, LOW);
// delay(500);
//}
if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_TOGGLE(HWTest_INJ_50pc, 1); }
if(!BIT_CHECK(HWTest_INJ_50pc, 1)) { 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
@ -73,11 +74,12 @@ uint16_t TS_CommandButtonsHandler(int buttonCommand)
break;
case TS_CMD_INJ2_OFF: // cmd group is for injector2 off actions
if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector2(); }
if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector2(); BIT_CLEAR(HWTest_INJ_50pc, 2); }
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, 2); }
if(!BIT_CHECK(HWTest_INJ_50pc, 2)) { 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
@ -85,11 +87,12 @@ uint16_t TS_CommandButtonsHandler(int buttonCommand)
break;
case TS_CMD_INJ3_OFF: // cmd group is for injector3 off actions
if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector3(); }
if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector3(); BIT_CLEAR(HWTest_INJ_50pc, 3); }
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, 3); }
if(!BIT_CHECK(HWTest_INJ_50pc, 3)) { 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
@ -97,11 +100,12 @@ uint16_t TS_CommandButtonsHandler(int buttonCommand)
break;
case TS_CMD_INJ4_OFF: // cmd group is for injector4 off actions
if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector4(); }
if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector4(); BIT_CLEAR(HWTest_INJ_50pc, 4); }
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, 4); }
if(!BIT_CHECK(HWTest_INJ_50pc, 4)) { 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
@ -112,12 +116,15 @@ uint16_t TS_CommandButtonsHandler(int buttonCommand)
case TS_CMD_INJ5_OFF: // cmd group is for injector5 off actions
#if INJ_CHANNELS >= 5
if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector5(); }
if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector5(); BIT_CLEAR(HWTest_INJ_50pc, 5); }
#endif
break;
case TS_CMD_INJ5_50PC: // cmd group is for injector5 50%dc actions
#if INJ_CHANNELS >= 5
if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_TOGGLE(HWTest_INJ_50pc, 5); }
if(!BIT_CHECK(HWTest_INJ_50pc, 5)) { closeInjector5(); } //Ensure this output is turned off (Otherwise the output may stay on permanently)
#endif
break;
case TS_CMD_INJ6_ON: // cmd group is for injector6 on actions
@ -128,12 +135,15 @@ uint16_t TS_CommandButtonsHandler(int buttonCommand)
case TS_CMD_INJ6_OFF: // cmd group is for injector6 off actions
#if INJ_CHANNELS >= 6
if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector6(); }
if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector6(); BIT_CLEAR(HWTest_INJ_50pc, 6); }
#endif
break;
case TS_CMD_INJ6_50PC: // cmd group is for injector6 50% dc actions
#if INJ_CHANNELS >= 6
if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_TOGGLE(HWTest_INJ_50pc, 6); }
if(!BIT_CHECK(HWTest_INJ_50pc, 6)) { closeInjector6(); } //Ensure this output is turned off (Otherwise the output may stay on permanently)
#endif
break;
case TS_CMD_INJ7_ON: // cmd group is for injector7 on actions
@ -144,12 +154,15 @@ uint16_t TS_CommandButtonsHandler(int buttonCommand)
case TS_CMD_INJ7_OFF: // cmd group is for injector7 off actions
#if INJ_CHANNELS >= 7
if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector7(); }
if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector7(); BIT_CLEAR(HWTest_INJ_50pc, 7); }
#endif
break;
case TS_CMD_INJ7_50PC: // cmd group is for injector7 50%dc actions
#if INJ_CHANNELS >= 7
if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_TOGGLE(HWTest_INJ_50pc, 7); }
if(!BIT_CHECK(HWTest_INJ_50pc, 7)) { closeInjector7(); } //Ensure this output is turned off (Otherwise the output may stay on permanently)
#endif
break;
case TS_CMD_INJ8_ON: // cmd group is for injector8 on actions
@ -160,12 +173,15 @@ uint16_t TS_CommandButtonsHandler(int buttonCommand)
case TS_CMD_INJ8_OFF: // cmd group is for injector8 off actions
#if INJ_CHANNELS >= 8
if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector8(); }
if( BIT_CHECK(currentStatus.testOutputs, 1) ){ closeInjector8(); BIT_CLEAR(HWTest_INJ_50pc, 8); }
#endif
break;
case TS_CMD_INJ8_50PC: // cmd group is for injector8 50% dc actions
#if INJ_CHANNELS >= 8
if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_TOGGLE(HWTest_INJ_50pc, 8); }
if(!BIT_CHECK(HWTest_INJ_50pc, 8)) { closeInjector8(); } //Ensure this output is turned off (Otherwise the output may stay on permanently)
#endif
break;
case TS_CMD_IGN1_ON: // cmd group is for spark1 on actions
@ -173,11 +189,12 @@ uint16_t TS_CommandButtonsHandler(int buttonCommand)
break;
case TS_CMD_IGN1_OFF: // cmd group is for spark1 off actions
if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil1Charge(); }
if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil1Charge(); BIT_CLEAR(HWTest_IGN_50pc, 1); }
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, 1); }
if(!BIT_CHECK(HWTest_IGN_50pc, 1)) { coil1Low(); } //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
@ -185,11 +202,12 @@ uint16_t TS_CommandButtonsHandler(int buttonCommand)
break;
case TS_CMD_IGN2_OFF: // cmd group is for spark2 off actions
if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil2Charge(); }
if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil2Charge(); BIT_CLEAR(HWTest_IGN_50pc, 2); }
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, 2); }
if(!BIT_CHECK(HWTest_IGN_50pc, 2)) { coil2Low(); } //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
@ -197,11 +215,12 @@ uint16_t TS_CommandButtonsHandler(int buttonCommand)
break;
case TS_CMD_IGN3_OFF: // cmd group is for spark3 off actions
if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil3Charge(); }
if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil3Charge(); BIT_CLEAR(HWTest_IGN_50pc, 3); }
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, 3); }
if(!BIT_CHECK(HWTest_IGN_50pc, 3)) { coil3Low(); } //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
@ -209,11 +228,12 @@ uint16_t TS_CommandButtonsHandler(int buttonCommand)
break;
case TS_CMD_IGN4_OFF: // cmd group is for spark4 off actions
if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil4Charge(); }
if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil4Charge(); BIT_CLEAR(HWTest_IGN_50pc, 4); }
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, 4); }
if(!BIT_CHECK(HWTest_IGN_50pc, 4)) { coil4Low(); } //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
@ -224,13 +244,14 @@ uint16_t TS_CommandButtonsHandler(int buttonCommand)
case TS_CMD_IGN5_OFF: // cmd group is for spark5 off actions
#if IGN_CHANNELS >= 5
if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil5Charge(); }
if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil5Charge(); BIT_CLEAR(HWTest_IGN_50pc, 5); }
#endif
break;
case TS_CMD_IGN5_50PC: // cmd group is for spark4 50%dc actions
#if IGN_CHANNELS >= 5
if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_TOGGLE(HWTest_IGN_50pc, 5); }
if(!BIT_CHECK(HWTest_IGN_50pc, 5)) { coil5Low(); } //Ensure this output is turned off (Otherwise the output may stay on permanently)
#endif
break;
@ -242,13 +263,14 @@ uint16_t TS_CommandButtonsHandler(int buttonCommand)
case TS_CMD_IGN6_OFF: // cmd group is for spark6 off actions
#if IGN_CHANNELS >= 6
if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil6Charge(); }
if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil6Charge(); BIT_CLEAR(HWTest_IGN_50pc, 6); }
#endif
break;
case TS_CMD_IGN6_50PC: // cmd group is for spark6 50%dc actions
#if IGN_CHANNELS >= 6
if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_TOGGLE(HWTest_IGN_50pc, 6); }
if(!BIT_CHECK(HWTest_IGN_50pc, 6)) { coil6Low(); } //Ensure this output is turned off (Otherwise the output may stay on permanently)
#endif
break;
@ -260,13 +282,14 @@ uint16_t TS_CommandButtonsHandler(int buttonCommand)
case TS_CMD_IGN7_OFF: // cmd group is for spark7 off actions
#if IGN_CHANNELS >= 7
if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil7Charge(); }
if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil7Charge(); BIT_CLEAR(HWTest_IGN_50pc, 7); }
#endif
break;
case TS_CMD_IGN7_50PC: // cmd group is for spark7 50%dc actions
#if IGN_CHANNELS >= 7
if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_TOGGLE(HWTest_IGN_50pc, 7); }
if(!BIT_CHECK(HWTest_IGN_50pc, 7)) { coil7Low(); } //Ensure this output is turned off (Otherwise the output may stay on permanently)
#endif
break;
@ -278,13 +301,14 @@ uint16_t TS_CommandButtonsHandler(int buttonCommand)
case TS_CMD_IGN8_OFF: // cmd group is for spark8 off actions
#if IGN_CHANNELS >= 8
if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil8Charge(); }
if( BIT_CHECK(currentStatus.testOutputs, 1) ) { endCoil8Charge(); BIT_CLEAR(HWTest_IGN_50pc, 8); }
#endif
break;
case TS_CMD_IGN8_50PC: // cmd group is for spark8 50%dc actions
#if IGN_CHANNELS >= 8
if( BIT_CHECK(currentStatus.testOutputs, 1) ) { BIT_TOGGLE(HWTest_IGN_50pc, 8); }
if(!BIT_CHECK(HWTest_IGN_50pc, 8)) { coil8Low(); } //Ensure this output is turned off (Otherwise the output may stay on permanently)
#endif
break;

View File

@ -87,37 +87,27 @@ void command()
break;
case 'E': // receive command button commands
cmdPending = true;
if(cmdPending == true)
if(Serial.available() >= 2)
{
//
byte cmdGroup = Serial.read();
byte cmdValue = Serial.read();
uint16_t cmdCombined = word(cmdGroup, cmdValue);
}
else
{
cmdPending = true;
if(Serial.available() >= 2)
if ( ((cmdCombined >= TS_CMD_INJ1_ON) && (cmdCombined <= TS_CMD_IGN8_50PC)) || (cmdCombined == TS_CMD_TEST_ENBL) || (cmdCombined == TS_CMD_TEST_DSBL) )
{
byte cmdGroup = Serial.read();
byte cmdValue = Serial.read();
uint16_t cmdCombined = word(cmdGroup, cmdValue);
if ( (cmdCombined >= TS_CMD_INJ1_ON) && (cmdCombined <=TS_CMD_IGN8_50PC) )
{
//Hardware test buttons
if (currentStatus.RPM == 0) { TS_CommandButtonsHandler(cmdCombined); }
cmdPending = false;
}
else if( (cmdCombined >= TS_CMD_VSS_60KMH) && (cmdCombined <= TS_CMD_VSS_RATIO6) )
{
//VSS Calibration commands
TS_CommandButtonsHandler(cmdCombined);
cmdPending = false;
}
//Hardware test buttons
if (currentStatus.RPM == 0) { TS_CommandButtonsHandler(cmdCombined); }
cmdPending = false;
}
else if( (cmdCombined >= TS_CMD_VSS_60KMH) && (cmdCombined <= TS_CMD_VSS_RATIO6) )
{
//VSS Calibration commands
TS_CommandButtonsHandler(cmdCombined);
cmdPending = false;
}
}
break;
case 'F': // send serial protocol version

View File

@ -89,6 +89,7 @@
#define BIT_SET(a,b) ((a) |= (1U<<(b)))
#define BIT_CLEAR(a,b) ((a) &= ~(1U<<(b)))
#define BIT_CHECK(var,pos) !!((var) & (1U<<(pos)))
#define BIT_TOGGLE(var,pos) ((var)^= 1UL << (pos))
#define interruptSafe(c) (noInterrupts(); {c} interrupts();) //Wraps any code between nointerrupt and interrupt calls
@ -401,7 +402,10 @@ extern int CRANK_ANGLE_MAX;
extern int CRANK_ANGLE_MAX_IGN;
extern int CRANK_ANGLE_MAX_INJ; //The number of crank degrees that the system track over. 360 for wasted / timed batch and 720 for sequential
extern volatile uint32_t runSecsX10; /**< Counter of seconds since cranking commenced (similar to runSecs) 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_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 */
//This needs to be here because using the config page directly can prevent burning the setting
extern byte resetControl;

View File

@ -127,6 +127,10 @@ int CRANK_ANGLE_MAX = 720;
int CRANK_ANGLE_MAX_IGN = 360;
int CRANK_ANGLE_MAX_INJ = 360; //The number of crank degrees that the system track over. 360 for wasted / timed batch and 720 for sequential
volatile uint32_t runSecsX10;
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_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;
//This needs to be here because using the config page directly can prevent burning the setting

View File

@ -1287,6 +1287,7 @@ void setPinMapping(byte boardID)
pinLaunch = 51; //Can be overwritten below
pinFlex = 2; // Flex sensor (Must be external interrupt enabled)
pinResetControl = 43; //Reset control output
pinBaro = A5;
#if defined(CORE_TEENSY35)
pinInjector6 = 51;
@ -1578,6 +1579,7 @@ void setPinMapping(byte boardID)
pinLaunch = 12; //Can be overwritten below
pinFlex = 3; // Flex sensor (Must be external interrupt enabled)
pinResetControl = 44; //Reset control output
pinVSS = 20;
#if defined(CORE_TEENSY35)
pinTrigger = 23;

View File

@ -184,6 +184,25 @@ void endCoil4and8Charge();
#define coil7High() (*ign7_pin_port |= (ign7_pin_mask))
#define coil8Low() (*ign8_pin_port &= ~(ign8_pin_mask))
#define coil8High() (*ign8_pin_port |= (ign8_pin_mask))
#define coil1Toggle() (*ign1_pin_port ^= ign1_pin_mask )
#define coil2Toggle() (*ign2_pin_port ^= ign2_pin_mask )
#define coil3Toggle() (*ign3_pin_port ^= ign3_pin_mask )
#define coil4Toggle() (*ign4_pin_port ^= ign4_pin_mask )
#define coil5Toggle() (*ign5_pin_port ^= ign5_pin_mask )
#define coil6Toggle() (*ign6_pin_port ^= ign6_pin_mask )
#define coil7Toggle() (*ign7_pin_port ^= ign7_pin_mask )
#define coil8Toggle() (*ign8_pin_port ^= ign8_pin_mask )
#define injector1Toggle() (*inj1_pin_port ^= inj1_pin_mask )
#define injector2Toggle() (*inj2_pin_port ^= inj2_pin_mask )
#define injector3Toggle() (*inj3_pin_port ^= inj3_pin_mask )
#define injector4Toggle() (*inj4_pin_port ^= inj4_pin_mask )
#define injector5Toggle() (*inj5_pin_port ^= inj5_pin_mask )
#define injector6Toggle() (*inj6_pin_port ^= inj6_pin_mask )
#define injector7Toggle() (*inj7_pin_port ^= inj7_pin_mask )
#define injector8Toggle() (*inj8_pin_port ^= inj8_pin_mask )
#else
#define coil1Low() coil1Low_MC33810()
#define coil1High() coil1High_MC33810()
@ -201,6 +220,24 @@ void endCoil4and8Charge();
#define coil7High() coil7High_MC33810()
#define coil8Low() coil8Low_MC33810()
#define coil8High() coil8High_MC33810()
#define coil1Toggle() coil1Toggle_MC33810()
#define coil2Toggle() coil2Toggle_MC33810()
#define coil3Toggle() coil3Toggle_MC33810()
#define coil4Toggle() coil4Toggle_MC33810()
#define coil5Toggle() coil5Toggle_MC33810()
#define coil6Toggle() coil6Toggle_MC33810()
#define coil7Toggle() coil7Toggle_MC33810()
#define coil8Toggle() coil8Toggle_MC33810()
#define injector1Toggle() injector1Toggle_MC33810()
#define injector2Toggle() injector2Toggle_MC33810()
#define injector3Toggle() injector3Toggle_MC33810()
#define injector4Toggle() injector4Toggle_MC33810()
#define injector5Toggle() injector5Toggle_MC33810()
#define injector6Toggle() injector6Toggle_MC33810()
#define injector7Toggle() injector7Toggle_MC33810()
#define injector8Toggle() injector8Toggle_MC33810()
#endif
void nullCallback();

View File

@ -226,6 +226,33 @@ void oneMSInterval() //Most ARM chips can simply call a function
}
//**************************************************************************************************************************************************
//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, 1)) { injector1Toggle(); }
if(BIT_CHECK(HWTest_INJ_50pc, 2)) { injector2Toggle(); }
if(BIT_CHECK(HWTest_INJ_50pc, 3)) { injector3Toggle(); }
if(BIT_CHECK(HWTest_INJ_50pc, 4)) { injector4Toggle(); }
if(BIT_CHECK(HWTest_INJ_50pc, 5)) { injector5Toggle(); }
if(BIT_CHECK(HWTest_INJ_50pc, 6)) { injector6Toggle(); }
if(BIT_CHECK(HWTest_INJ_50pc, 7)) { injector7Toggle(); }
if(BIT_CHECK(HWTest_INJ_50pc, 8)) { injector8Toggle(); }
//Check for ignition outputs on 50%
if(BIT_CHECK(HWTest_IGN_50pc, 1)) { coil1Toggle(); }
if(BIT_CHECK(HWTest_IGN_50pc, 2)) { coil2Toggle(); }
if(BIT_CHECK(HWTest_IGN_50pc, 3)) { coil3Toggle(); }
if(BIT_CHECK(HWTest_IGN_50pc, 4)) { coil4Toggle(); }
if(BIT_CHECK(HWTest_IGN_50pc, 5)) { coil5Toggle(); }
if(BIT_CHECK(HWTest_IGN_50pc, 6)) { coil6Toggle(); }
if(BIT_CHECK(HWTest_IGN_50pc, 7)) { coil7Toggle(); }
if(BIT_CHECK(HWTest_IGN_50pc, 8)) { coil8Toggle(); }
}
}
#if defined(CORE_AVR) //AVR chips use the ISR for this
//Reset Timer2 to trigger in another ~1ms