Standardise all the fuel schedule setting channel calls

This commit is contained in:
Josh Stewart 2023-06-26 15:52:02 +10:00
parent d9b5554a8c
commit 624d255123
1 changed files with 15 additions and 17 deletions

View File

@ -897,19 +897,17 @@ void loop(void)
#if INJ_CHANNELS >= 1
if( (BIT_CHECK(fuelChannelsOn, INJ1_CMD_BIT)) && !BIT_CHECK(currentStatus.status1, BIT_STATUS1_BOOSTCUT))
if( (maxInjOutputs >= 1) && (currentStatus.PW1 >= inj_opentime_uS) && (BIT_CHECK(fuelChannelsOn, INJ1_CMD_BIT)) )
{
if(currentStatus.PW1 >= inj_opentime_uS)
uint32_t timeOut = calculateInjectorTimeout(fuelSchedule1, channel1InjDegrees, injector1StartAngle, crankAngle);
if (timeOut>0U)
{
uint32_t timeOut = calculateInjectorTimeout(fuelSchedule1, channel1InjDegrees, injector1StartAngle, crankAngle);
if (timeOut>0U)
{
setFuelSchedule1(
timeOut,
(unsigned long)currentStatus.PW1
);
}
setFuelSchedule1(
timeOut,
(unsigned long)currentStatus.PW1
);
}
}
#endif
/*-----------------------------------------------------------------------------------------
@ -923,7 +921,7 @@ void loop(void)
|------------------------------------------------------------------------------------------
*/
#if INJ_CHANNELS >= 2
if( (maxInjOutputs >= 2) && (currentStatus.PW2 >= inj_opentime_uS) )
if( (maxInjOutputs >= 2) && (currentStatus.PW2 >= inj_opentime_uS) && (BIT_CHECK(fuelChannelsOn, INJ2_CMD_BIT)) )
{
uint32_t timeOut = calculateInjectorTimeout(fuelSchedule2, channel2InjDegrees, injector2StartAngle, crankAngle);
if ( timeOut>0U )
@ -937,7 +935,7 @@ void loop(void)
#endif
#if INJ_CHANNELS >= 3
if( (maxInjOutputs >= 3) && (currentStatus.PW3 >= inj_opentime_uS) )
if( (maxInjOutputs >= 3) && (currentStatus.PW3 >= inj_opentime_uS) && (BIT_CHECK(fuelChannelsOn, INJ3_CMD_BIT)) )
{
uint32_t timeOut = calculateInjectorTimeout(fuelSchedule3, channel3InjDegrees, injector3StartAngle, crankAngle);
if ( timeOut>0U )
@ -951,7 +949,7 @@ void loop(void)
#endif
#if INJ_CHANNELS >= 4
if( (maxInjOutputs >= 4) && (currentStatus.PW4 >= inj_opentime_uS) )
if( (maxInjOutputs >= 4) && (currentStatus.PW4 >= inj_opentime_uS) && (BIT_CHECK(fuelChannelsOn, INJ4_CMD_BIT)) )
{
uint32_t timeOut = calculateInjectorTimeout(fuelSchedule4, channel4InjDegrees, injector4StartAngle, crankAngle);
if ( timeOut>0U )
@ -965,7 +963,7 @@ void loop(void)
#endif
#if INJ_CHANNELS >= 5
if( (maxInjOutputs >= 5) && (currentStatus.PW5 >= inj_opentime_uS) )
if( (maxInjOutputs >= 5) && (currentStatus.PW5 >= inj_opentime_uS) && (BIT_CHECK(fuelChannelsOn, INJ5_CMD_BIT)) )
{
uint32_t timeOut = calculateInjectorTimeout(fuelSchedule5, channel5InjDegrees, injector5StartAngle, crankAngle);
if ( timeOut>0U )
@ -979,7 +977,7 @@ void loop(void)
#endif
#if INJ_CHANNELS >= 6
if( (maxInjOutputs >= 6) && (currentStatus.PW6 >= inj_opentime_uS) )
if( (maxInjOutputs >= 6) && (currentStatus.PW6 >= inj_opentime_uS) && (BIT_CHECK(fuelChannelsOn, INJ6_CMD_BIT)) )
{
uint32_t timeOut = calculateInjectorTimeout(fuelSchedule6, channel6InjDegrees, injector6StartAngle, crankAngle);
if ( timeOut>0U )
@ -993,7 +991,7 @@ void loop(void)
#endif
#if INJ_CHANNELS >= 7
if( (maxInjOutputs >= 7) && (currentStatus.PW7 >= inj_opentime_uS) )
if( (maxInjOutputs >= 7) && (currentStatus.PW7 >= inj_opentime_uS) && (BIT_CHECK(fuelChannelsOn, INJ7_CMD_BIT)) )
{
uint32_t timeOut = calculateInjectorTimeout(fuelSchedule7, channel7InjDegrees, injector7StartAngle, crankAngle);
if ( timeOut>0U )
@ -1007,7 +1005,7 @@ void loop(void)
#endif
#if INJ_CHANNELS >= 8
if( (maxInjOutputs >= 8) && (currentStatus.PW8 >= inj_opentime_uS) )
if( (maxInjOutputs >= 8) && (currentStatus.PW8 >= inj_opentime_uS) && (BIT_CHECK(fuelChannelsOn, INJ8_CMD_BIT)) )
{
uint32_t timeOut = calculateInjectorTimeout(fuelSchedule8, channel8InjDegrees, injector8StartAngle, crankAngle);
if ( timeOut>0U )