Fix for misaligned spark2 memory
This commit is contained in:
parent
23bbee6b82
commit
0995eb4ad4
|
@ -1110,15 +1110,15 @@ page = 10
|
|||
fuelTempValues = array, U08, 180, [6], "%", 1.0, 0.0, 0, 255, 0
|
||||
|
||||
;Things for the 2nd spark table
|
||||
spark2Algorithm = bits, U08, 181, [0:2], $loadSourceNames
|
||||
spark2Mode = bits, U08, 181, [3:5], "Off", "Multiplied %", "Added", "Switched - Conditional", "Switched - Input based","INVALID","INVALID","INVALID"
|
||||
spark2SwitchVariable = bits, U08, 181, [6:7], "RPM", "MAP", "TPS", "ETH%"
|
||||
spark2SwitchValue = scalar, U16, 182, { bitStringValue(fuel2SwitchUnits, spark2SwitchVariable) }, 1.0, 0.0, 0.0, 9000, 0
|
||||
spark2InputPin = bits , U08, 184, [0:5], $IO_Pins_no_def
|
||||
spark2InputPolarity = bits , U08, 184, [6:6], "LOW", "HIGH"
|
||||
spark2InputPullup = bits , U08, 184, [7:7], "No", "Yes"
|
||||
spark2Algorithm = bits, U08, 186, [0:2], $loadSourceNames
|
||||
spark2Mode = bits, U08, 186, [3:5], "Off", "Multiplied %", "Added", "Switched - Conditional", "Switched - Input based","INVALID","INVALID","INVALID"
|
||||
spark2SwitchVariable = bits, U08, 186, [6:7], "RPM", "MAP", "TPS", "ETH%"
|
||||
spark2SwitchValue = scalar, U16, 187, { bitStringValue(fuel2SwitchUnits, spark2SwitchVariable) }, 1.0, 0.0, 0.0, 9000, 0
|
||||
spark2InputPin = bits , U08, 189, [0:5], $IO_Pins_no_def
|
||||
spark2InputPolarity = bits , U08, 189, [6:6], "LOW", "HIGH"
|
||||
spark2InputPullup = bits , U08, 189, [7:7], "No", "Yes"
|
||||
|
||||
unused11_187_191 = array, U08, 185, [2], "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
unused11_190_191 = array, U08, 90, [2], "RPM", 100.0, 0.0, 100, 25500, 0
|
||||
|
||||
;Page 11 is the fuel map and axis bins only
|
||||
page = 11
|
||||
|
|
|
@ -1222,17 +1222,17 @@ struct config10 {
|
|||
byte unused11_174_2 : 1;
|
||||
|
||||
byte fuelTempBins[6];
|
||||
byte fuelTempValues[6];
|
||||
byte fuelTempValues[6]; //180
|
||||
|
||||
//Byte 122
|
||||
//Byte 186
|
||||
byte spark2Algorithm : 3;
|
||||
byte spark2Mode : 3;
|
||||
byte spark2SwitchVariable : 2;
|
||||
|
||||
//Bytes 123-124
|
||||
//Bytes 187-188
|
||||
uint16_t spark2SwitchValue;
|
||||
|
||||
//Byte 125
|
||||
//Byte 189
|
||||
byte spark2InputPin : 6;
|
||||
byte spark2InputPolarity : 1;
|
||||
byte spark2InputPullup : 1;
|
||||
|
|
|
@ -84,10 +84,11 @@ void calculateSecondarySpark()
|
|||
{
|
||||
if(configPage10.spark2Mode == SPARK2_MODE_MULTIPLY)
|
||||
{
|
||||
BIT_SET(currentStatus.spark2, BIT_SPARK2_SPARK2_ACTIVE);
|
||||
currentStatus.advance2 = getAdvance2();
|
||||
//Spark 2 table is treated as a % value. Table 1 and 2 are multiplied together and divded by 100
|
||||
uint16_t combinedadvance = ((uint16_t)currentStatus.advance1 * (uint16_t)currentStatus.advance2) / 100;
|
||||
if(combinedadvance <= 255) { currentStatus.advance = combinedadvance; }
|
||||
uint16_t combinedAdvance = ((uint16_t)currentStatus.advance1 * (uint16_t)currentStatus.advance2) / 100;
|
||||
if(combinedAdvance <= 255) { currentStatus.advance = combinedAdvance; }
|
||||
else { currentStatus.advance = 255; }
|
||||
}
|
||||
else if(configPage10.spark2Mode == SPARK2_MODE_ADD)
|
||||
|
@ -95,8 +96,8 @@ void calculateSecondarySpark()
|
|||
BIT_SET(currentStatus.spark2, BIT_SPARK2_SPARK2_ACTIVE); //Set the bit indicating that the 2nd spark table is in use.
|
||||
currentStatus.advance2 = getAdvance2();
|
||||
//Spark tables are added together, but a check is made to make sure this won't overflow the 8-bit VE value
|
||||
uint16_t combinedadvance = (uint16_t)currentStatus.advance1 + (uint16_t)currentStatus.advance2;
|
||||
if(combinedadvance <= 255) { currentStatus.advance = combinedadvance; }
|
||||
uint16_t combinedAdvance = (uint16_t)currentStatus.advance1 + (uint16_t)currentStatus.advance2;
|
||||
if(combinedAdvance <= 255) { currentStatus.advance = combinedAdvance; }
|
||||
else { currentStatus.advance = 255; }
|
||||
}
|
||||
else if(configPage10.spark2Mode == SPARK2_MODE_CONDITIONAL_SWITCH )
|
||||
|
@ -110,9 +111,9 @@ void calculateSecondarySpark()
|
|||
currentStatus.advance = currentStatus.advance2;
|
||||
}
|
||||
}
|
||||
else if(configPage10.fuel2SwitchVariable == FUEL2_CONDITION_MAP)
|
||||
else if(configPage10.spark2SwitchVariable == SPARK2_CONDITION_MAP)
|
||||
{
|
||||
if(currentStatus.MAP > configPage10.fuel2SwitchValue)
|
||||
if(currentStatus.MAP > configPage10.spark2SwitchValue)
|
||||
{
|
||||
BIT_SET(currentStatus.spark2, BIT_SPARK2_SPARK2_ACTIVE); //Set the bit indicating that the 2nd spark table is in use.
|
||||
currentStatus.advance2 = getAdvance2();
|
||||
|
@ -121,7 +122,7 @@ void calculateSecondarySpark()
|
|||
}
|
||||
else if(configPage10.spark2SwitchVariable == SPARK2_CONDITION_TPS)
|
||||
{
|
||||
if(currentStatus.TPS > configPage10.fuel2SwitchValue)
|
||||
if(currentStatus.TPS > configPage10.spark2SwitchValue)
|
||||
{
|
||||
BIT_SET(currentStatus.spark2, BIT_SPARK2_SPARK2_ACTIVE); //Set the bit indicating that the 2nd spark table is in use.
|
||||
currentStatus.advance2 = getAdvance2();
|
||||
|
|
Loading…
Reference in New Issue