add test modes to injector and spark outputs
This commit is contained in:
parent
4ae4afe809
commit
74cf93b979
|
@ -1,5 +1,6 @@
|
|||
;-------------------------------------------------------------------------------
|
||||
#unset CAN_COMMANDS
|
||||
#unset enablehardware_test
|
||||
|
||||
[MegaTune]
|
||||
MTversion = 2.25 ; MegaTune itself; needs to match exec version.
|
||||
|
@ -25,7 +26,8 @@
|
|||
;settingGroup = boostUnits, "Boost table units"
|
||||
;settingOption = DEFAULT, "kPa"
|
||||
;settingOption = BOOSTPSI, "PSI"
|
||||
|
||||
settingGroup = enablehardware_test, "Enable Hardware Test Page"
|
||||
|
||||
[PcVariables]
|
||||
; valid types: boolean, double, int, list
|
||||
;
|
||||
|
@ -39,7 +41,6 @@
|
|||
rpmhigh = scalar, U16, "rpm", 1, 0, 0, 30000, 0
|
||||
rpmwarn = scalar, U16, "rpm", 1, 0, 0, 30000, 0
|
||||
rpmdang = scalar, U16, "rpm", 1, 0, 0, 30000, 0
|
||||
|
||||
[Constants]
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
@ -824,6 +825,12 @@ menuDialog = main
|
|||
subMenu = veTable1Map, "Fuel Table"
|
||||
subMenu = sparkMap, "Spark Table", 3
|
||||
subMenu = afrTable1Map, "AFR Target Table"
|
||||
|
||||
#if enablehardware_test
|
||||
menuDialog = main
|
||||
menu = "Hardware Testing"
|
||||
subMenu = outputtest1, "Test Output Hardware"
|
||||
#endif
|
||||
|
||||
menu = "Help"
|
||||
subMenu = helpGeneral, "Speeduino Help"
|
||||
|
@ -898,6 +905,17 @@ menuDialog = main
|
|||
flatSSoftWin= "The number of RPM below the flat shift point where the softlimit will be applied (aka Soft limit window). Recommended values are 200-1000"
|
||||
flatSRetard = "The absolute timing (BTDC) that will be used when within the soft limit window"
|
||||
|
||||
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"
|
||||
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"
|
||||
|
||||
[UserDefined]
|
||||
|
||||
; Enhanced TunerStudio dialogs can be defined here
|
||||
|
@ -1274,7 +1292,81 @@ menuDialog = main
|
|||
field = "Individual fuel trim enabled", fuelTrimEnabled, { injLayout == 3 }
|
||||
panel = inj_trimadt, North
|
||||
panel = inj_trimadb, South
|
||||
|
||||
|
||||
dialog = outputtest_warningmessage, ""
|
||||
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!"
|
||||
|
||||
|
||||
dialog = enableoutputtestbuttons, "Enable Test Controls", xAxis
|
||||
;commandButton = "Label Text", command, { Enabled Condition }, optionalFlags
|
||||
|
||||
; The rem > 0 expression is just for testing.. It works when the MS is on the Stim with rpm.
|
||||
; a status bit there would be the expected real expression
|
||||
commandButton = "Enable Test Mode", cmdEnableTestMode,{!testenabled & !testactive }
|
||||
|
||||
; if clickOnCloseIfEnabled is set, then the command assigned to this button will be run on the
|
||||
; dialog close, but only if the enable condition is true
|
||||
; valid click flags are:
|
||||
; clickOnCloseIfEnabled - the command will be sent on dialog close if active condition is true
|
||||
; clickOnCloseIfDisabled - the command will be sent on dialog close if active condition is false
|
||||
; clickOnClose - the command will be sent on dialog close always
|
||||
commandButton = "Stop Test Mode", cmdStopTestMode,{testactive}, clickOnCloseIfEnabled
|
||||
|
||||
dialog = outputtestinj1, "Injector CH1", yAxis
|
||||
commandButton = "Off", cmdtestinj1off,{testactive}
|
||||
commandButton = "50% DC", cmdtestinj150dc,{!testenabled & testactive}
|
||||
commandButton = "On", cmdtestinj1on,{!testenabled & testactive}
|
||||
dialog = outputtestinj2, "Injector CH2", yAxis
|
||||
commandButton = "Off", cmdtestinj2off,{testactive}
|
||||
commandButton = "50% DC", cmdtestinj250dc,{!testenabled &testactive}
|
||||
commandButton = "On", cmdtestinj2on,{!testenabled & testactive}
|
||||
dialog = outputtestinj3, "Injector CH3", yAxis
|
||||
commandButton = "Off", cmdtestinj3off,{testactive}
|
||||
commandButton = "50% DC", cmdtestinj350dc,{!testenabled & testactive}
|
||||
commandButton = "On", cmdtestinj3on,{!testenabled & testactive}
|
||||
dialog = outputtestinj4, "Injector CH4", yAxis
|
||||
commandButton = "Off", cmdtestinj4off,{testactive}
|
||||
commandButton = "50% DC", cmdtestinj450dc,{!testenabled & testactive}
|
||||
commandButton = "On", cmdtestinj4on ,{!testenabled & testactive}
|
||||
|
||||
dialog = outputtest_injectors, "Injector Driver Output Test", xAxis
|
||||
panel = outputtestinj1
|
||||
panel = outputtestinj2
|
||||
panel = outputtestinj3
|
||||
panel = outputtestinj4
|
||||
|
||||
dialog = outputtestspk1, "Spark CH1 ", yAxis
|
||||
commandButton = "Off", cmdtestspk1off,{testactive}
|
||||
commandButton = "50% DC", cmdtestspk150dc,{!testenabled & testactive}
|
||||
commandButton = "On", cmdtestspk1on,{!testenabled & testactive}
|
||||
dialog = outputtestspk2, "Spark CH2", yAxis
|
||||
commandButton = "Off", cmdtestspk2off,{testactive}
|
||||
commandButton = "50% DC", cmdtestspk250dc,{!testenabled & testactive}
|
||||
commandButton = "On", cmdtestspk2on,{!testenabled & testactive}
|
||||
dialog = outputtestspk3, "Spark CH3", yAxis
|
||||
commandButton = "Off", cmdtestspk3off,{testactive}
|
||||
commandButton = "50% DC", cmdtestspk350dc,{!testenabled & testactive}
|
||||
commandButton = "On", cmdtestspk3on,{!testenabled & testactive}
|
||||
dialog = outputtestspk4, "Spark CH4", yAxis
|
||||
commandButton = "Off", cmdtestspk4off,{testactive}
|
||||
commandButton = "50% DC", cmdtestspk450dc,{!testenabled & testactive}
|
||||
commandButton = "On", cmdtestspk4on,{!testenabled & testactive}
|
||||
|
||||
dialog = outputtest_spark, "Spark Driver Output Test", xAxis
|
||||
panel = outputtestspk1
|
||||
panel = outputtestspk2
|
||||
panel = outputtestspk3
|
||||
panel = outputtestspk4
|
||||
|
||||
dialog = outputtest1,"Test Output Hardware"
|
||||
;topicHelp = ""
|
||||
panel = enableoutputtestbuttons
|
||||
panel = outputtest_injectors
|
||||
panel = outputtest_spark
|
||||
;panel = outputtest_io2
|
||||
panel = outputtest_warningmessage
|
||||
;-------------------------------------------------------------------------------
|
||||
; General help text
|
||||
|
||||
|
@ -1285,6 +1377,44 @@ menuDialog = main
|
|||
text = "<br>"
|
||||
text = "<br>why not visit our forum http://speeduino.com/forum/"
|
||||
;------------------------------------------------------------------------------
|
||||
[ControllerCommands]
|
||||
; commandName = command1, command2, commandn...
|
||||
; command in standard ini format, a command name can be assigned to 1 to n commands that will be executed in order.
|
||||
; This does not include any resultant protocol envelope data, only the response data itself.
|
||||
|
||||
; WARNING!! These commands bypass TunerStudio's normal memory synchronization. If these commands
|
||||
; alter mapped settings (Constant) memory in the controller, TunerStudio will have an out of sync condition
|
||||
; and may create error messages.
|
||||
; It is expected that these commands would not typically alter any ram mapped to a Constant.
|
||||
|
||||
cmdStopTestMode = "E\x01\x00"
|
||||
cmdEnableTestMode = "E\x01\x01"
|
||||
|
||||
cmdtestinj1on = "E\x02\x01"
|
||||
cmdtestinj1off = "E\x02\x02"
|
||||
cmdtestinj150dc = "E\x02\x03"
|
||||
cmdtestinj2on = "E\x02\x04"
|
||||
cmdtestinj2off = "E\x02\x05"
|
||||
cmdtestinj250dc = "E\x02\x06"
|
||||
cmdtestinj3on = "E\x02\x07"
|
||||
cmdtestinj3off = "E\x02\x08"
|
||||
cmdtestinj350dc = "E\x02\x09"
|
||||
cmdtestinj4on = "E\x02\x0A"
|
||||
cmdtestinj4off = "E\x02\x0B"
|
||||
cmdtestinj450dc = "E\x02\x0C"
|
||||
|
||||
cmdtestspk1on = "E\x03\x01"
|
||||
cmdtestspk1off = "E\x03\x02"
|
||||
cmdtestspk150dc = "E\x03\x03"
|
||||
cmdtestspk2on = "E\x03\x04"
|
||||
cmdtestspk2off = "E\x03\x05"
|
||||
cmdtestspk250dc = "E\x03\x06"
|
||||
cmdtestspk3on = "E\x03\x07"
|
||||
cmdtestspk3off = "E\x03\x08"
|
||||
cmdtestspk350dc = "E\x03\x09"
|
||||
cmdtestspk4on = "E\x03\x0A"
|
||||
cmdtestspk4off = "E\x03\x0B"
|
||||
cmdtestspk450dc = "E\x03\x0C"
|
||||
|
||||
; -------------------------------------------------------------
|
||||
; Help down here
|
||||
|
@ -1586,7 +1716,6 @@ menuDialog = main
|
|||
deadGauge = deadValue, "---", "", 0, 1, -1, -1, 2, 2, 0, 0
|
||||
loopGauge = loopsPerSecond,"Main loop speed", "Loops/S" , 0, 70000, -1, 500,1800, 4000, 0, 0
|
||||
memoryGauge = freeRAM, "Free memory", "bytes" , 0, 8000, -1, 1000,8000, 1000, 0, 0
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
|
||||
[FrontPage]
|
||||
|
@ -1710,7 +1839,7 @@ menuDialog = main
|
|||
|
||||
ochGetCommand = "A"
|
||||
|
||||
ochBlockSize = 38
|
||||
ochBlockSize = 39
|
||||
|
||||
secl = scalar, U08, 0, "sec", 1.000, 0.000
|
||||
squirt = scalar, U08, 1, "bits", 1.000, 0.000
|
||||
|
@ -1773,7 +1902,11 @@ menuDialog = main
|
|||
errorNum = bits, U08, 36, [0:1]
|
||||
currentError = bits, U08, 36, [2:7]
|
||||
boostTarget = scalar, U08, 37, "kPa", 2.000, 0.000
|
||||
|
||||
testoutputs = scalar, U08, 38, "bits", 1.000, 0.000
|
||||
testenabled = bits, U08, 38, [0:0]
|
||||
testactive = bits, U08, 38, [1:1]
|
||||
;"", 1.0, 0.0
|
||||
|
||||
; Computed output channels. See "megatuneExamples.ini" for all the
|
||||
; pre-defined variables, search for "???" and you'll see them.
|
||||
|
||||
|
|
|
@ -12,11 +12,15 @@
|
|||
#define seqFuelPage 9
|
||||
#define canbusPage 10//Config Page 10
|
||||
|
||||
#define packetSize 38
|
||||
#define packetSize 39
|
||||
|
||||
byte currentPage = 1;//Not the same as the speeduino config page numbers
|
||||
boolean isMap = true;
|
||||
unsigned long requestCount = 0; //The number of times the A command has been issued
|
||||
byte cmdgroup = 0;
|
||||
byte cmdvalue = 0;
|
||||
int cmdcombined = 0; //the cmdgroup as high byte and cmdvalue as low byte
|
||||
byte cmdstore[8]; //array storing pre test values
|
||||
|
||||
const char pageTitles[] PROGMEM //This is being stored in the avr flash instead of SRAM which there is not very much of
|
||||
{
|
||||
|
@ -40,5 +44,6 @@ void sendPage(bool useChar);
|
|||
void receiveCalibration(byte tableID);
|
||||
void sendToothLog(bool useChar);
|
||||
void testComm();
|
||||
void commandbuttons();
|
||||
|
||||
#endif // COMMS_H
|
||||
|
|
|
@ -28,7 +28,16 @@ void command()
|
|||
case 'C': // test communications. This is used by Tunerstudio to see whether there is an ECU on a given serial port
|
||||
testComm();
|
||||
break;
|
||||
|
||||
|
||||
case 'E': // receive command button commands
|
||||
while (Serial.available() == 0) { }
|
||||
cmdgroup = Serial.read();
|
||||
while (Serial.available() == 0) { }
|
||||
cmdvalue = Serial.read();
|
||||
cmdcombined = word(cmdgroup, cmdvalue);
|
||||
commandbuttons();
|
||||
break;
|
||||
|
||||
case 'L': // List the contents of current page in human readable form
|
||||
sendPage(true);
|
||||
break;
|
||||
|
@ -262,6 +271,7 @@ void sendValues(int packetlength, byte portNum)
|
|||
response[35] = currentStatus.flexIgnCorrection; //Ignition correction (Increased degrees of advance) for flex fuel
|
||||
response[36] = getNextError();
|
||||
response[37] = currentStatus.boostTarget;
|
||||
response[38] = currentStatus.testoutputs;
|
||||
|
||||
//cli();
|
||||
if (portNum == 0) { Serial.write(response, (size_t)packetlength); }
|
||||
|
@ -1027,3 +1037,105 @@ void testComm()
|
|||
Serial.write(1);
|
||||
return;
|
||||
}
|
||||
|
||||
void commandbuttons()
|
||||
{
|
||||
switch (cmdcombined)
|
||||
{
|
||||
case 256: // cmd is stop
|
||||
BIT_CLEAR(currentStatus.testoutputs, 1);
|
||||
digitalWrite(pinInjector1, LOW);
|
||||
digitalWrite(pinInjector2, LOW);
|
||||
digitalWrite(pinInjector3, LOW);
|
||||
digitalWrite(pinInjector4, LOW);
|
||||
digitalWrite(pinCoil1, LOW);
|
||||
digitalWrite(pinCoil2, LOW);
|
||||
digitalWrite(pinCoil3, LOW);
|
||||
digitalWrite(pinCoil4, LOW);
|
||||
break;
|
||||
|
||||
case 257: // cmd is enable
|
||||
// currentStatus.testactive = 1;
|
||||
BIT_SET(currentStatus.testoutputs, 1);
|
||||
break;
|
||||
case 513: // cmd group is for injector1 on actions
|
||||
if(BIT_CHECK(currentStatus.testoutputs, 1)){digitalWrite(pinInjector1, HIGH);}
|
||||
break;
|
||||
case 514: // cmd group is for injector1 off actions
|
||||
if(BIT_CHECK(currentStatus.testoutputs, 1)){digitalWrite(pinInjector1, LOW);}
|
||||
break;
|
||||
case 515: // 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);
|
||||
//}
|
||||
break;
|
||||
case 516: // cmd group is for injector2 on actions
|
||||
if(BIT_CHECK(currentStatus.testoutputs, 1)){digitalWrite(pinInjector2, HIGH);}
|
||||
break;
|
||||
case 517: // cmd group is for injector2 off actions
|
||||
if(BIT_CHECK(currentStatus.testoutputs, 1)){digitalWrite(pinInjector2, LOW);}
|
||||
break;
|
||||
case 518: // cmd group is for injector2 50%dc actions
|
||||
|
||||
break;
|
||||
case 519: // cmd group is for injector3 on actions
|
||||
if(BIT_CHECK(currentStatus.testoutputs, 1)){digitalWrite(pinInjector3, HIGH);}
|
||||
break;
|
||||
case 520: // cmd group is for injector3 off actions
|
||||
if(BIT_CHECK(currentStatus.testoutputs, 1)){digitalWrite(pinInjector3, LOW);}
|
||||
break;
|
||||
case 521: // cmd group is for injector3 50%dc actions
|
||||
|
||||
break;
|
||||
case 522: // cmd group is for injector4 on actions
|
||||
if(BIT_CHECK(currentStatus.testoutputs, 1)){digitalWrite(pinInjector4, HIGH);}
|
||||
break;
|
||||
case 523: // cmd group is for injector4 off actions
|
||||
if(BIT_CHECK(currentStatus.testoutputs, 1)){digitalWrite(pinInjector4, LOW);}
|
||||
break;
|
||||
case 524: // cmd group is for injector4 50% dc actions
|
||||
|
||||
break;
|
||||
case 769: // cmd group is for spark1 on actions
|
||||
if(BIT_CHECK(currentStatus.testoutputs, 1)){digitalWrite(pinCoil1, HIGH);}
|
||||
break;
|
||||
case 770: // cmd group is for spark1 off actions
|
||||
if(BIT_CHECK(currentStatus.testoutputs, 1)){digitalWrite(pinCoil1, LOW);}
|
||||
break;
|
||||
case 771: // cmd group is for spark1 50%dc actions
|
||||
|
||||
break;
|
||||
case 772: // cmd group is for spark2 on actions
|
||||
if(BIT_CHECK(currentStatus.testoutputs, 1)){digitalWrite(pinCoil2, HIGH);}
|
||||
break;
|
||||
case 773: // cmd group is for spark2 off actions
|
||||
if(BIT_CHECK(currentStatus.testoutputs, 1)){digitalWrite(pinCoil2, LOW);}
|
||||
break;
|
||||
case 774: // cmd group is for spark2 50%dc actions
|
||||
|
||||
break;
|
||||
case 775: // cmd group is for spark3 on actions
|
||||
if(BIT_CHECK(currentStatus.testoutputs, 1)){digitalWrite(pinCoil3, HIGH);}
|
||||
break;
|
||||
case 776: // cmd group is for spark3 off actions
|
||||
if(BIT_CHECK(currentStatus.testoutputs, 1)){digitalWrite(pinCoil3, LOW);}
|
||||
break;
|
||||
case 777: // cmd group is for spark3 50%dc actions
|
||||
|
||||
break;
|
||||
case 778: // cmd group is for spark4 on actions
|
||||
if(BIT_CHECK(currentStatus.testoutputs, 1)){digitalWrite(pinCoil4, HIGH);}
|
||||
break;
|
||||
case 779: // cmd group is for spark4 off actions
|
||||
if(BIT_CHECK(currentStatus.testoutputs, 1)){digitalWrite(pinCoil4, LOW);}
|
||||
break;
|
||||
case 780: // cmd group is for spark4 50%dc actions
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -206,7 +206,10 @@ struct statuses {
|
|||
bool flatShiftingHard;
|
||||
volatile byte startRevolutions; //A counter for how many revolutions have been completed since sync was achieved.
|
||||
byte boostTarget;
|
||||
|
||||
byte testoutputs;
|
||||
bool testenabled;
|
||||
bool testactive;
|
||||
|
||||
//Helpful bitwise operations:
|
||||
//Useful reference: http://playground.arduino.cc/Code/BitMath
|
||||
// y = (x >> n) & 1; // n=0..15. stores nth bit of x in y. y becomes 0 or 1.
|
||||
|
|
|
@ -906,7 +906,14 @@ void loop()
|
|||
//The IAT and CLT readings can be done less frequently. This still runs about 4 times per second
|
||||
if ((mainLoopCount & 255) == 1) //Every 256 loops
|
||||
{
|
||||
|
||||
if (currentStatus.RPM == 0)
|
||||
{
|
||||
BIT_CLEAR(currentStatus.testenabled, 0); //cleared when engine is off or stalled
|
||||
}
|
||||
else
|
||||
{
|
||||
BIT_SET(currentStatus.testenabled, 0); //set if engine is running/cranking
|
||||
}
|
||||
readCLT();
|
||||
readIAT();
|
||||
readO2();
|
||||
|
@ -940,7 +947,6 @@ void loop()
|
|||
currentStatus.runSecs = 0; //We're cranking (hopefully), so reset the engine run time to prompt ASE.
|
||||
if(configPage2.ignBypassEnabled) { digitalWrite(pinIgnBypass, LOW); }
|
||||
}
|
||||
|
||||
//END SETTING STATUSES
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
|
||||
|
|
Loading…
Reference in New Issue