rpmDOT added
This commit is contained in:
parent
fe1d58cd38
commit
6fb864b0bd
|
@ -194,7 +194,7 @@ This function returns the current values of a fixed group of variables
|
|||
*/
|
||||
void sendValues(int length)
|
||||
{
|
||||
byte packetSize = 31;
|
||||
byte packetSize = 33;
|
||||
byte response[packetSize];
|
||||
|
||||
response[0] = currentStatus.secl; //secl is simply a counter that increments each second. Used to track unexpected resets (Which will reset this count to 0)
|
||||
|
@ -234,6 +234,10 @@ void sendValues(int length)
|
|||
response[29] = (byte)(currentStatus.dwell / 100);
|
||||
response[30] = currentStatus.O2_2; //O2
|
||||
|
||||
//rpmDOT must be sent as a signed integer
|
||||
response[31] = lowByte(currentStatus.rpmDOT);
|
||||
response[32] = highByte(currentStatus.rpmDOT);
|
||||
|
||||
Serial.write(response, (size_t)packetSize);
|
||||
//Serial.flush();
|
||||
return;
|
||||
|
|
|
@ -177,7 +177,7 @@ This simple check applies the extra fuel if we're currently launching
|
|||
*/
|
||||
byte correctionsLaunch()
|
||||
{
|
||||
if(currentStatus.launching) { return (100 + configPage3.lnchFuelAdd); }
|
||||
if(configPage3.launchEnabled && currentStatus.launching) { return (100 + configPage3.lnchFuelAdd); }
|
||||
else { return 100; }
|
||||
}
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ struct statuses {
|
|||
unsigned long TPSlast_time; //The time the previous TPS sample was taken
|
||||
byte tpsADC; //0-255 byte representation of the TPS
|
||||
byte tpsDOT;
|
||||
int rpmDOT;
|
||||
byte VE;
|
||||
byte O2;
|
||||
byte O2_2;
|
||||
|
|
|
@ -591,7 +591,7 @@ page = 8
|
|||
|
||||
dialog = injChars, "Injector Characteristics"
|
||||
field = "Injector Open Time", injOpen
|
||||
field = "Injector close times"
|
||||
field = "Injector close angle"
|
||||
field = "Channel 1", inj1Ang
|
||||
field = "Channel 2", inj2Ang, { nCylinders > 1 }
|
||||
field = "Channel 3", inj3Ang, { nCylinders > 4 || nCylinders == 3 }
|
||||
|
@ -1094,7 +1094,7 @@ page = 8
|
|||
|
||||
ochGetCommand = "A"
|
||||
|
||||
ochBlockSize = 31
|
||||
ochBlockSize = 33
|
||||
|
||||
secl = scalar, U08, 0, "sec", 1.000, 0.000
|
||||
squirt = scalar, U08, 1, "bits", 1.000, 0.000
|
||||
|
@ -1138,6 +1138,7 @@ page = 8
|
|||
batCorrection = scalar, U08, 28, "%", 1.000, 0.000
|
||||
dwell = scalar, U08, 29, "ms", 0.1, 0.000
|
||||
afr2 = scalar, U08, 30, "O2", 0.100, 0.000
|
||||
rpmDOT = scalar, S16, 31, "rpm/s", 1.000, 0.000
|
||||
|
||||
; Computed output channels. See "megatuneExamples.ini" for all the
|
||||
; pre-defined variables, search for "???" and you'll see them.
|
||||
|
@ -1230,6 +1231,7 @@ page = 8
|
|||
entry = TPSdot, "TPS DOT", int, "%d"
|
||||
entry = advance, "Ignition Advance", int,"%d"
|
||||
entry = batteryVoltage, "Battery V", float, "%.1f"
|
||||
entry = rpmDOT, "rpm/s", int, "%d"
|
||||
|
||||
[LoggerDefinition]
|
||||
; valid logger types: composite, tooth, trigger, csv
|
||||
|
|
|
@ -473,8 +473,10 @@ void loop()
|
|||
long timeToLastTooth = (currentLoopTime - toothLastToothTime);
|
||||
if ( (timeToLastTooth < 500000L) || (toothLastToothTime > currentLoopTime) ) //Check how long ago the last tooth was seen compared to now. If it was more than half a second ago then the engine is probably stopped. toothLastToothTime can be greater than currentLoopTime if a pulse occurs between getting the lastest time and doing the comparison
|
||||
{
|
||||
int lastRPM = currentStatus.RPM; //Need to record this for rpmDOT calculation
|
||||
currentStatus.RPM = getRPM();
|
||||
if(fuelPumpOn == false) { digitalWrite(pinFuelPump, HIGH); fuelPumpOn = true; } //Check if the fuel pump is on and turn it on if it isn't.
|
||||
currentStatus.rpmDOT = ldiv(1000000, (currentLoopTime - previousLoopTime)).quot * (currentStatus.RPM - lastRPM); //This is the RPM per second that the engine has accelerated/decelleratedin the last loop
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -486,6 +488,7 @@ void loop()
|
|||
currentStatus.runSecs = 0; //Reset the counter for number of seconds running.
|
||||
secCounter = 0; //Reset our seconds counter.
|
||||
startRevolutions = 0;
|
||||
currentStatus.rpmDOT = 0;
|
||||
ignitionOn = false;
|
||||
fuelOn = false;
|
||||
digitalWrite(pinFuelPump, LOW); //Turn off the fuel pump
|
||||
|
@ -702,7 +705,7 @@ void loop()
|
|||
//***********************************************************************************************
|
||||
//| BEGIN IGNITION CALCULATIONS
|
||||
if (currentStatus.RPM > ((unsigned int)(configPage2.SoftRevLim) * 100) ) { currentStatus.advance = configPage2.SoftLimRetard; } //Softcut RPM limit (If we're above softcut limit, delay timing by configured number of degrees)
|
||||
if (currentStatus.launching && (currentStatus.RPM > ((unsigned int)(configPage3.lnchSoftLim) * 100)) ) { currentStatus.advance = configPage3.lnchRetard; } //SoftCut rev limit for 2-step launch control
|
||||
if (configPage3.launchEnabled && currentStatus.launching && (currentStatus.RPM > ((unsigned int)(configPage3.lnchSoftLim) * 100)) ) { currentStatus.advance = configPage3.lnchRetard; } //SoftCut rev limit for 2-step launch control
|
||||
|
||||
//Set dwell
|
||||
//Dwell is stored as ms * 10. ie Dwell of 4.3ms would be 43 in configPage2. This number therefore needs to be multiplied by 100 to get dwell in uS
|
||||
|
|
Loading…
Reference in New Issue