Only perform the 2D table lookup for priming value once on startup

This commit is contained in:
Josh Stewart 2019-04-13 15:46:15 +10:00 committed by GitHub
parent 483d44a9e6
commit 6437516bf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -814,12 +814,13 @@ void initialiseAll()
interrupts();
//Perform the priming pulses. Set these to run at an arbitrary time in the future (100us). The prime pulse value is in ms*10, so need to multiple by 100 to get to uS
readCLT(); // need to read coolant temp to make priming pulsewidth work correctly.
if((table2D_getValue(&PrimingPulseTable, currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET)) > 0)
unsigned long primingValue = table2D_getValue(&PrimingPulseTable, currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET);
if(primingValue > 0)
{
setFuelSchedule1(100, (unsigned long)5*(table2D_getValue(&PrimingPulseTable, currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET) * 100)); //to acheive long enough priming pulses, the values in tuner studio are divided by 0.5 instead of 0.1, so multiplier of 5 is required.
setFuelSchedule2(100, (unsigned long)5*(table2D_getValue(&PrimingPulseTable, currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET) * 100));
setFuelSchedule3(100, (unsigned long)5*(table2D_getValue(&PrimingPulseTable, currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET) * 100));
setFuelSchedule4(100, (unsigned long)5*(table2D_getValue(&PrimingPulseTable, currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET) * 100));
setFuelSchedule1(100, (primingValue * 100 * 5)); //to acheive long enough priming pulses, the values in tuner studio are divided by 0.5 instead of 0.1, so multiplier of 5 is required.
setFuelSchedule2(100, (primingValue * 100 * 5));
setFuelSchedule3(100, (primingValue * 100 * 5));
setFuelSchedule4(100, (primingValue * 100 * 5));
}