[FP] Add injector delay for priming (#391)
* [FP] Add injector delay for priming * Fix build * Add the startup TPS read back in to ensure proper flood clear check Co-authored-by: Josh Stewart <josh@noisymime.org>
This commit is contained in:
parent
876c09ff27
commit
7bcf4bcb15
|
@ -370,7 +370,8 @@ page = 1
|
|||
vssRatio6 = scalar, U16, 116, "km/h per 1000rpm", 0.1, 0, 0, 299.9, 1
|
||||
|
||||
|
||||
unused2-95 = array, U08, 118, [10], "%", 1.0, 0.0, 0.0, 255, 0
|
||||
unused2-95 = array, U08, 118, [9], "%", 1.0, 0.0, 0.0, 255, 0
|
||||
primingDelay = scalar, U08, 127, "S", 0.1, 0.0, 0.0, 25.5, 1
|
||||
|
||||
;Page 2 is the fuel map and axis bins only
|
||||
page = 2
|
||||
|
@ -1212,6 +1213,7 @@ page = 11
|
|||
defaultValue = dfcoMinCLT, 25
|
||||
defaultValue = crankingEnrichTaper, 0.1
|
||||
defaultValue = boostCutEnabled, 1
|
||||
defaultValue = primingDelay, 0.5
|
||||
|
||||
;Default pins
|
||||
defaultValue = fanPin, 0
|
||||
|
@ -1646,6 +1648,8 @@ menuDialog = main
|
|||
|
||||
crankRPM = "The cranking RPM threshold. When RPM is lower than this value (and above 0) the system will be considered to be cranking"
|
||||
tpsflood = "Keep throttle over this value to disable the priming pulse and cranking fuel. Used to prevent flood or clear already flooded engine"
|
||||
fpPrime = "Duration to power fuel pump on to ensure fuel line pressure."
|
||||
primingDelay= "Delay to priming after fuel pump is on, used to wait fuel line get pressurized correctly."
|
||||
|
||||
fanInv = ""
|
||||
fanHyster = "The number of degrees of hysteresis to be used in controlling the fan. Recommended values are between 2 and 5"
|
||||
|
@ -2194,6 +2198,7 @@ menuDialog = main
|
|||
field = "Cranking RPM (Max)", crankRPM
|
||||
field = "Flood Clear level", tpsflood
|
||||
field = "Fuel pump prime duration", fpPrime
|
||||
field = "Injectors priming delay", primingDelay
|
||||
field = "Cranking enrichment taper time", crankingEnrichTaper
|
||||
|
||||
dialog = primePW, "Priming Pulsewidth"
|
||||
|
|
|
@ -452,6 +452,7 @@ 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 uint32_t seclx10; /**< Counter of seconds since powered commenced (similar to secl) 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 */
|
||||
|
@ -720,7 +721,8 @@ struct config2 {
|
|||
uint16_t vssRatio5;
|
||||
uint16_t vssRatio6;
|
||||
|
||||
byte unused2_95[10];
|
||||
byte unused2_95[9];
|
||||
byte primingDelay;
|
||||
|
||||
#if defined(CORE_AVR)
|
||||
};
|
||||
|
|
|
@ -128,6 +128,7 @@ 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 uint32_t seclx10;
|
||||
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 */
|
||||
|
|
|
@ -1127,29 +1127,8 @@ void initialiseAll()
|
|||
else { fpPrimed = true; } //If the user has set 0 for the pump priming, immediately mark the priming as being completed
|
||||
|
||||
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(false); // Need to read coolant temp to make priming pulsewidth work correctly. The false here disables use of the filter
|
||||
readTPS(false); // Need to read tps to detect flood clear state
|
||||
unsigned long primingValue = table2D_getValue(&PrimingPulseTable, currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET);
|
||||
if((primingValue > 0) && (currentStatus.TPS < configPage4.floodClear))
|
||||
{
|
||||
if(channel1InjEnabled == true) { setFuelSchedule1(100, (primingValue * 100 * 5)); } //to achieve long enough priming pulses, the values in tunerstudio are divided by 0.5 instead of 0.1, so multiplier of 5 is required.
|
||||
if(channel2InjEnabled == true) { setFuelSchedule2(100, (primingValue * 100 * 5)); }
|
||||
if(channel3InjEnabled == true) { setFuelSchedule3(100, (primingValue * 100 * 5)); }
|
||||
if(channel4InjEnabled == true) { setFuelSchedule4(100, (primingValue * 100 * 5)); }
|
||||
#if INJ_CHANNELS >= 5
|
||||
if(channel5InjEnabled == true) { setFuelSchedule5(100, (primingValue * 100 * 5)); }
|
||||
#endif
|
||||
#if INJ_CHANNELS >= 6
|
||||
if(channel6InjEnabled == true) { setFuelSchedule6(100, (primingValue * 100 * 5)); }
|
||||
#endif
|
||||
#if INJ_CHANNELS >= 7
|
||||
if(channel7InjEnabled == true) { setFuelSchedule7(100, (primingValue * 100 * 5)); }
|
||||
#endif
|
||||
#if INJ_CHANNELS >= 8
|
||||
if(channel8InjEnabled == true) { setFuelSchedule8(100, (primingValue * 100 * 5)); }
|
||||
#endif
|
||||
}
|
||||
|
||||
initialisationComplete = true;
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
|
|
|
@ -70,6 +70,7 @@ extern void (*ign8EndFunction)();
|
|||
///@}
|
||||
|
||||
void initialiseSchedulers();
|
||||
void StartPriming();
|
||||
void setFuelSchedule1(unsigned long timeout, unsigned long duration);
|
||||
void setFuelSchedule2(unsigned long timeout, unsigned long duration);
|
||||
void setFuelSchedule3(unsigned long timeout, unsigned long duration);
|
||||
|
|
|
@ -758,6 +758,31 @@ void setIgnitionSchedule8(void (*startCallback)(), unsigned long timeout, unsign
|
|||
}
|
||||
}
|
||||
|
||||
extern void StartPriming()
|
||||
{
|
||||
//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
|
||||
unsigned long primingValue = table2D_getValue(&PrimingPulseTable, currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET);
|
||||
if( (primingValue > 0) && (currentStatus.TPS < configPage4.floodClear) )
|
||||
{
|
||||
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.
|
||||
if ( configPage2.nInjectors > 1 ) { setFuelSchedule2(100, (primingValue * 100 * 5)); }
|
||||
if ( configPage2.nInjectors > 2 ) { setFuelSchedule3(100, (primingValue * 100 * 5)); }
|
||||
if ( configPage2.nInjectors > 3 ) { setFuelSchedule4(100, (primingValue * 100 * 5)); }
|
||||
#if (INJ_CHANNELS >= 5)
|
||||
if ( configPage2.nInjectors > 4 ) { setFuelSchedule5(100, (primingValue * 100 * 5)); }
|
||||
#endif
|
||||
#if (INJ_CHANNELS >= 6)
|
||||
if ( configPage2.nInjectors > 5 ) { setFuelSchedule6(100, (primingValue * 100 * 5)); }
|
||||
#endif
|
||||
#if (INJ_CHANNELS >= 7)
|
||||
if ( configPage2.nInjectors > 6 ) { setFuelSchedule7(100, (primingValue * 100 * 5)); }
|
||||
#endif
|
||||
#if (INJ_CHANNELS >= 8)
|
||||
if ( configPage2.nInjectors > 7 ) { setFuelSchedule8(100, (primingValue * 100 * 5)); }
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************************************************************************************************************************************/
|
||||
//This function (All 8 ISR functions that are below) gets called when either the start time or the duration time are reached
|
||||
//This calls the relevant callback function (startCallback or endCallback) depending on the status of the schedule.
|
||||
|
|
|
@ -123,6 +123,9 @@ void oneMSInterval() //Most ARM chips can simply call a function
|
|||
lastRPM_100ms = currentStatus.RPM; //Record the current RPM for next calc
|
||||
if ( BIT_CHECK(currentStatus.engine, BIT_ENGINE_RUN) ) { runSecsX10++; }
|
||||
else { runSecsX10 = 0; }
|
||||
|
||||
if ( (fpPrimed == false) && (seclx10 == configPage2.primingDelay) ) { StartPriming(); }
|
||||
seclx10++;
|
||||
}
|
||||
|
||||
//Loop executed every 250ms loop (1ms x 250 = 250ms)
|
||||
|
|
Loading…
Reference in New Issue