Save 600+ bytes RAM (step 4 of 9) - deduplicate scheduler ISR functions (#1063)
This commit is contained in:
parent
55c98cab22
commit
b03db96ad7
|
@ -38,6 +38,7 @@ framework=arduino
|
|||
lib_deps = EEPROM, FlexCAN_T4, Time
|
||||
test_build_src = yes
|
||||
test_ignore = test_table3d_native
|
||||
extra_scripts = post:post_extra_script.py
|
||||
|
||||
[env:teensy36]
|
||||
;platform=teensy
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
Import("env")
|
||||
|
||||
# see https://github.com/platformio/platformio-core/issues/3742#issuecomment-1003454439
|
||||
def wait_for_monitor_port(source, target, env):
|
||||
# "pio test" has no delay between upload & monitoring. Unfortuneatly, the teensy
|
||||
# is rebooting at that point and the port isn't available. This rasies an exception.
|
||||
port = env.GetProjectOption("monitor_port")
|
||||
if port is None:
|
||||
from platformio.builder.tools.pioupload import AutodetectUploadPort
|
||||
AutodetectUploadPort(env)
|
||||
port = env.subst("$UPLOAD_PORT")
|
||||
if port:
|
||||
# We have a port specified, wait for it to
|
||||
# activate
|
||||
print(f"Waiting for port {port}...")
|
||||
import serial
|
||||
while True:
|
||||
try:
|
||||
serial.Serial(port)
|
||||
print("...done!")
|
||||
return
|
||||
except:
|
||||
pass
|
||||
|
||||
# No port specified, try a generic delay
|
||||
print("Delay while uploading...")
|
||||
import time
|
||||
time.sleep(2)
|
||||
print("...done!")
|
||||
|
||||
env.AddPostAction("upload", wait_for_monitor_port)
|
|
@ -90,42 +90,42 @@
|
|||
#define IGN8_COMPARE OCR3B //Replaces injector 2
|
||||
|
||||
//Note that the interrupt flag is reset BEFORE the interrupt is enabled
|
||||
#define FUEL1_TIMER_ENABLE() TIFR3 |= (1<<OCF3A); TIMSK3 |= (1 << OCIE3A) //Turn on the A compare unit (ie turn on the interrupt)
|
||||
#define FUEL2_TIMER_ENABLE() TIFR3 |= (1<<OCF3B); TIMSK3 |= (1 << OCIE3B) //Turn on the B compare unit (ie turn on the interrupt)
|
||||
#define FUEL3_TIMER_ENABLE() TIFR3 |= (1<<OCF3C); TIMSK3 |= (1 << OCIE3C) //Turn on the C compare unit (ie turn on the interrupt)
|
||||
#define FUEL4_TIMER_ENABLE() TIFR4 |= (1<<OCF4B); TIMSK4 |= (1 << OCIE4B) //Turn on the B compare unit (ie turn on the interrupt)
|
||||
#define FUEL5_TIMER_ENABLE() TIFR4 |= (1<<OCF4C); TIMSK4 |= (1 << OCIE4C) //Turn on the C compare unit (ie turn on the interrupt)
|
||||
#define FUEL6_TIMER_ENABLE() TIFR4 |= (1<<OCF4A); TIMSK4 |= (1 << OCIE4A) //Turn on the A compare unit (ie turn on the interrupt)
|
||||
#define FUEL7_TIMER_ENABLE() TIFR5 |= (1<<OCF5C); TIMSK5 |= (1 << OCIE5C) //
|
||||
#define FUEL8_TIMER_ENABLE() TIFR5 |= (1<<OCF5B); TIMSK5 |= (1 << OCIE5B) //
|
||||
static inline void FUEL1_TIMER_ENABLE(void) { TIFR3 |= (1<<OCF3A) ; TIMSK3 |= (1 << OCIE3A); } //Turn on the A compare unit (ie turn on the interrupt)
|
||||
static inline void FUEL2_TIMER_ENABLE(void) { TIFR3 |= (1<<OCF3B); TIMSK3 |= (1 << OCIE3B); } //Turn on the B compare unit (ie turn on the interrupt)
|
||||
static inline void FUEL3_TIMER_ENABLE(void) { TIFR3 |= (1<<OCF3C); TIMSK3 |= (1 << OCIE3C); } //Turn on the C compare unit (ie turn on the interrupt)
|
||||
static inline void FUEL4_TIMER_ENABLE(void) { TIFR4 |= (1<<OCF4B); TIMSK4 |= (1 << OCIE4B); } //Turn on the B compare unit (ie turn on the interrupt)
|
||||
static inline void FUEL5_TIMER_ENABLE(void) { TIFR4 |= (1<<OCF4C); TIMSK4 |= (1 << OCIE4C); } //Turn on the C compare unit (ie turn on the interrupt)
|
||||
static inline void FUEL6_TIMER_ENABLE(void) { TIFR4 |= (1<<OCF4A); TIMSK4 |= (1 << OCIE4A); } //Turn on the A compare unit (ie turn on the interrupt)
|
||||
static inline void FUEL7_TIMER_ENABLE(void) { TIFR5 |= (1<<OCF5C); TIMSK5 |= (1 << OCIE5C); } //
|
||||
static inline void FUEL8_TIMER_ENABLE(void) { TIFR5 |= (1<<OCF5B); TIMSK5 |= (1 << OCIE5B); } //
|
||||
|
||||
#define FUEL1_TIMER_DISABLE() TIMSK3 &= ~(1 << OCIE3A); //Turn off this output compare unit
|
||||
#define FUEL2_TIMER_DISABLE() TIMSK3 &= ~(1 << OCIE3B); //Turn off this output compare unit
|
||||
#define FUEL3_TIMER_DISABLE() TIMSK3 &= ~(1 << OCIE3C); //Turn off this output compare unit
|
||||
#define FUEL4_TIMER_DISABLE() TIMSK4 &= ~(1 << OCIE4B); //Turn off this output compare unit
|
||||
#define FUEL5_TIMER_DISABLE() TIMSK4 &= ~(1 << OCIE4C); //
|
||||
#define FUEL6_TIMER_DISABLE() TIMSK4 &= ~(1 << OCIE4A); //
|
||||
#define FUEL7_TIMER_DISABLE() TIMSK5 &= ~(1 << OCIE5C); //
|
||||
#define FUEL8_TIMER_DISABLE() TIMSK5 &= ~(1 << OCIE5B); //
|
||||
static inline void FUEL1_TIMER_DISABLE(void) { TIMSK3 &= ~(1 << OCIE3A); } // //Turn off this output compare unit
|
||||
static inline void FUEL2_TIMER_DISABLE(void) { TIMSK3 &= ~(1 << OCIE3B); } // //Turn off this output compare unit
|
||||
static inline void FUEL3_TIMER_DISABLE(void) { TIMSK3 &= ~(1 << OCIE3C); } // //Turn off this output compare unit
|
||||
static inline void FUEL4_TIMER_DISABLE(void) { TIMSK4 &= ~(1 << OCIE4B); } ////Turn off this output compare unit
|
||||
static inline void FUEL5_TIMER_DISABLE(void) { TIMSK4 &= ~(1 << OCIE4C); } // //
|
||||
static inline void FUEL6_TIMER_DISABLE(void) { TIMSK4 &= ~(1 << OCIE4A); } // //
|
||||
static inline void FUEL7_TIMER_DISABLE(void) { TIMSK5 &= ~(1 << OCIE5C); } // //
|
||||
static inline void FUEL8_TIMER_DISABLE(void) { TIMSK5 &= ~(1 << OCIE5B); } //
|
||||
|
||||
//These have the TIFR5 bits set to 1 to clear the interrupt flag. This prevents a false interrupt being called the first time the channel is enabled.
|
||||
#define IGN1_TIMER_ENABLE() TIFR5 |= (1<<OCF5A); TIMSK5 |= (1 << OCIE5A) //Turn on the A compare unit (ie turn on the interrupt)
|
||||
#define IGN2_TIMER_ENABLE() TIFR5 |= (1<<OCF5B); TIMSK5 |= (1 << OCIE5B) //Turn on the B compare unit (ie turn on the interrupt)
|
||||
#define IGN3_TIMER_ENABLE() TIFR5 |= (1<<OCF5C); TIMSK5 |= (1 << OCIE5C) //Turn on the C compare unit (ie turn on the interrupt)
|
||||
#define IGN4_TIMER_ENABLE() TIFR4 |= (1<<OCF4A); TIMSK4 |= (1 << OCIE4A) //Turn on the A compare unit (ie turn on the interrupt)
|
||||
#define IGN5_TIMER_ENABLE() TIFR4 |= (1<<OCF4C); TIMSK4 |= (1 << OCIE4C) //Turn on the A compare unit (ie turn on the interrupt)
|
||||
#define IGN6_TIMER_ENABLE() TIFR4 |= (1<<OCF4B); TIMSK4 |= (1 << OCIE4B) //Replaces injector 4
|
||||
#define IGN7_TIMER_ENABLE() TIMSK3 |= (1 << OCIE3C) //Replaces injector 3
|
||||
#define IGN8_TIMER_ENABLE() TIMSK3 |= (1 << OCIE3B) //Replaces injector 2
|
||||
static inline void IGN1_TIMER_ENABLE(void) { TIFR5 |= (1<<OCF5A); TIMSK5 |= (1 << OCIE5A); } //Turn on the A compare unit (ie turn on the interrupt)
|
||||
static inline void IGN2_TIMER_ENABLE(void) { TIFR5 |= (1<<OCF5B); TIMSK5 |= (1 << OCIE5B); }//Turn on the B compare unit (ie turn on the interrupt)
|
||||
static inline void IGN3_TIMER_ENABLE(void) { TIFR5 |= (1<<OCF5C); TIMSK5 |= (1 << OCIE5C); }//Turn on the C compare unit (ie turn on the interrupt)
|
||||
static inline void IGN4_TIMER_ENABLE(void) { TIFR4 |= (1<<OCF4A); TIMSK4 |= (1 << OCIE4A); }//Turn on the A compare unit (ie turn on the interrupt)
|
||||
static inline void IGN5_TIMER_ENABLE(void) { TIFR4 |= (1<<OCF4C); TIMSK4 |= (1 << OCIE4C); } //Turn on the A compare unit (ie turn on the interrupt)
|
||||
static inline void IGN6_TIMER_ENABLE(void) { TIFR4 |= (1<<OCF4B); TIMSK4 |= (1 << OCIE4B); } //Replaces injector 4
|
||||
static inline void IGN7_TIMER_ENABLE(void) { TIMSK3 |= (1 << OCIE3C); }//Replaces injector 3
|
||||
static inline void IGN8_TIMER_ENABLE(void) { TIMSK3 |= (1 << OCIE3B); } //Replaces injector 2
|
||||
|
||||
#define IGN1_TIMER_DISABLE() TIMSK5 &= ~(1 << OCIE5A) //Turn off this output compare unit
|
||||
#define IGN2_TIMER_DISABLE() TIMSK5 &= ~(1 << OCIE5B) //Turn off this output compare unit
|
||||
#define IGN3_TIMER_DISABLE() TIMSK5 &= ~(1 << OCIE5C) //Turn off this output compare unit
|
||||
#define IGN4_TIMER_DISABLE() TIMSK4 &= ~(1 << OCIE4A) //Turn off this output compare unit
|
||||
#define IGN5_TIMER_DISABLE() TIMSK4 &= ~(1 << OCIE4C) //Turn off this output compare unit
|
||||
#define IGN6_TIMER_DISABLE() TIMSK4 &= ~(1 << OCIE4B) //Replaces injector 4
|
||||
#define IGN7_TIMER_DISABLE() TIMSK3 &= ~(1 << OCIE3C) //Replaces injector 3
|
||||
#define IGN8_TIMER_DISABLE() TIMSK3 &= ~(1 << OCIE3B) //Replaces injector 2
|
||||
static inline void IGN1_TIMER_DISABLE(void) { TIMSK5 &= ~(1 << OCIE5A); } //Turn off this output compare unit
|
||||
static inline void IGN2_TIMER_DISABLE(void) { TIMSK5 &= ~(1 << OCIE5B); } //Turn off this output compare unit
|
||||
static inline void IGN3_TIMER_DISABLE(void) { TIMSK5 &= ~(1 << OCIE5C); } //Turn off this output compare unit
|
||||
static inline void IGN4_TIMER_DISABLE(void) { TIMSK4 &= ~(1 << OCIE4A); } //Turn off this output compare unit
|
||||
static inline void IGN5_TIMER_DISABLE(void) { TIMSK4 &= ~(1 << OCIE4C); } //Turn off this output compare unit
|
||||
static inline void IGN6_TIMER_DISABLE(void) { TIMSK4 &= ~(1 << OCIE4B); } //Replaces injector 4
|
||||
static inline void IGN7_TIMER_DISABLE(void) { TIMSK3 &= ~(1 << OCIE3C); } //Replaces injector 3
|
||||
static inline void IGN8_TIMER_DISABLE(void) { TIMSK3 &= ~(1 << OCIE3B); } //Replaces injector 2
|
||||
|
||||
#define MAX_TIMER_PERIOD 262140UL //The longest period of time (in uS) that the timer can permit (IN this case it is 65535 * 4, as each timer tick is 4uS)
|
||||
#define uS_TO_TIMER_COMPARE(uS1) ((uS1) >> 2) //Converts a given number of uS into the required number of timer ticks until that time has passed
|
||||
|
|
|
@ -111,45 +111,45 @@
|
|||
#define IGN7_COMPARE TCC2->CC[0].bit.CC
|
||||
#define IGN8_COMPARE TCC2->CC[1].bit.CC
|
||||
|
||||
#define FUEL1_TIMER_ENABLE() TCC0->INTENSET.bit.MC0 = 0x1
|
||||
#define FUEL2_TIMER_ENABLE() TCC0->INTENSET.bit.MC1 = 0x1
|
||||
#define FUEL3_TIMER_ENABLE() TCC0->INTENSET.bit.MC2 = 0x1
|
||||
#define FUEL4_TIMER_ENABLE() TCC0->INTENSET.bit.MC3 = 0x1
|
||||
static inline void FUEL1_TIMER_ENABLE(void) { TCC0->INTENSET.bit.MC0 = 0x1; }
|
||||
static inline void FUEL2_TIMER_ENABLE(void) { TCC0->INTENSET.bit.MC1 = 0x1; }
|
||||
static inline void FUEL3_TIMER_ENABLE(void) { TCC0->INTENSET.bit.MC2 = 0x1; }
|
||||
static inline void FUEL4_TIMER_ENABLE(void) { TCC0->INTENSET.bit.MC3 = 0x1; }
|
||||
//The below are NOT YET RIGHT!
|
||||
#define FUEL5_TIMER_ENABLE() TCC0->INTENSET.bit.MC0 = 0x1
|
||||
#define FUEL6_TIMER_ENABLE() TCC0->INTENSET.bit.MC1 = 0x1
|
||||
#define FUEL7_TIMER_ENABLE() TCC0->INTENSET.bit.MC2 = 0x1
|
||||
#define FUEL8_TIMER_ENABLE() TCC0->INTENSET.bit.MC3 = 0x1
|
||||
static inline void FUEL5_TIMER_ENABLE(void) { TCC0->INTENSET.bit.MC0 = 0x1; }
|
||||
static inline void FUEL6_TIMER_ENABLE(void) { TCC0->INTENSET.bit.MC1 = 0x1; }
|
||||
static inline void FUEL7_TIMER_ENABLE(void) { TCC0->INTENSET.bit.MC2 = 0x1; }
|
||||
static inline void FUEL8_TIMER_ENABLE(void) { TCC0->INTENSET.bit.MC3 = 0x1; }
|
||||
|
||||
#define FUEL1_TIMER_DISABLE() TCC0->INTENSET.bit.MC0 = 0x0
|
||||
#define FUEL2_TIMER_DISABLE() TCC0->INTENSET.bit.MC0 = 0x0
|
||||
#define FUEL3_TIMER_DISABLE() TCC0->INTENSET.bit.MC0 = 0x0
|
||||
#define FUEL4_TIMER_DISABLE() TCC0->INTENSET.bit.MC0 = 0x0
|
||||
static inline void FUEL1_TIMER_DISABLE(void) { TCC0->INTENSET.bit.MC0 = 0x0; }
|
||||
static inline void FUEL2_TIMER_DISABLE(void) { TCC0->INTENSET.bit.MC0 = 0x0; }
|
||||
static inline void FUEL3_TIMER_DISABLE(void) { TCC0->INTENSET.bit.MC0 = 0x0; }
|
||||
static inline void FUEL4_TIMER_DISABLE(void) { TCC0->INTENSET.bit.MC0 = 0x0; }
|
||||
//The below are NOT YET RIGHT!
|
||||
#define FUEL5_TIMER_DISABLE() TCC0->INTENSET.bit.MC0 = 0x0
|
||||
#define FUEL6_TIMER_DISABLE() TCC0->INTENSET.bit.MC0 = 0x0
|
||||
#define FUEL7_TIMER_DISABLE() TCC0->INTENSET.bit.MC0 = 0x0
|
||||
#define FUEL8_TIMER_DISABLE() TCC0->INTENSET.bit.MC0 = 0x0
|
||||
static inline void FUEL5_TIMER_DISABLE(void) { TCC0->INTENSET.bit.MC0 = 0x0; }
|
||||
static inline void FUEL6_TIMER_DISABLE(void) { TCC0->INTENSET.bit.MC0 = 0x0; }
|
||||
static inline void FUEL7_TIMER_DISABLE(void) { TCC0->INTENSET.bit.MC0 = 0x0; }
|
||||
static inline void FUEL9_TIMER_DISABLE(void) { TCC0->INTENSET.bit.MC0 = 0x0; }
|
||||
|
||||
#define IGN1_TIMER_ENABLE() TCC1->INTENSET.bit.MC0 = 0x1
|
||||
#define IGN2_TIMER_ENABLE() TCC1->INTENSET.bit.MC1 = 0x1
|
||||
#define IGN3_TIMER_ENABLE() TCC2->INTENSET.bit.MC0 = 0x1
|
||||
#define IGN4_TIMER_ENABLE() TCC2->INTENSET.bit.MC1 = 0x1
|
||||
//The below are NOT YET RIGHT!
|
||||
#define IGN5_TIMER_ENABLE() TCC1->INTENSET.bit.MC0 = 0x1
|
||||
#define IGN6_TIMER_ENABLE() TCC1->INTENSET.bit.MC1 = 0x1
|
||||
#define IGN7_TIMER_ENABLE() TCC2->INTENSET.bit.MC0 = 0x1
|
||||
#define IGN8_TIMER_ENABLE() TCC2->INTENSET.bit.MC1 = 0x1
|
||||
static inline void IGN1_TIMER_ENABLE(void) { TCC1->INTENSET.bit.MC0 = 0x1; }
|
||||
static inline void IGN2_TIMER_ENABLE(void) { TCC1->INTENSET.bit.MC1 = 0x1; }
|
||||
static inline void IGN3_TIMER_ENABLE(void) { TCC2->INTENSET.bit.MC0 = 0x1; }
|
||||
static inline void IGN4_TIMER_ENABLE(void) { TCC2->INTENSET.bit.MC1 = 0x1; }
|
||||
//The below are NOT YET RIGHT!
|
||||
static inline void IGN5_TIMER_ENABLE(void) { TCC1->INTENSET.bit.MC0 = 0x1; }
|
||||
static inline void IGN6_TIMER_ENABLE(void) { TCC1->INTENSET.bit.MC1 = 0x1; }
|
||||
static inline void IGN7_TIMER_ENABLE(void) { TCC2->INTENSET.bit.MC0 = 0x1; }
|
||||
static inline void IGN8_TIMER_ENABLE(void) { TCC2->INTENSET.bit.MC1 = 0x1; }
|
||||
|
||||
#define IGN1_TIMER_DISABLE() TCC1->INTENSET.bit.MC0 = 0x0
|
||||
#define IGN2_TIMER_DISABLE() TCC1->INTENSET.bit.MC1 = 0x0
|
||||
#define IGN3_TIMER_DISABLE() TCC2->INTENSET.bit.MC0 = 0x0
|
||||
#define IGN4_TIMER_DISABLE() TCC2->INTENSET.bit.MC1 = 0x0
|
||||
//The below are NOT YET RIGHT!
|
||||
#define IGN5_TIMER_DISABLE() TCC1->INTENSET.bit.MC0 = 0x0
|
||||
#define IGN6_TIMER_DISABLE() TCC1->INTENSET.bit.MC1 = 0x0
|
||||
#define IGN7_TIMER_DISABLE() TCC2->INTENSET.bit.MC0 = 0x0
|
||||
#define IGN8_TIMER_DISABLE() TCC2->INTENSET.bit.MC1 = 0x0
|
||||
static inline void IGN1_TIMER_DISABLE(void) { TCC1->INTENSET.bit.MC0 = 0x0; }
|
||||
static inline void IGN2_TIMER_DISABLE(void) { TCC1->INTENSET.bit.MC1 = 0x0; }
|
||||
static inline void IGN3_TIMER_DISABLE(void) { TCC2->INTENSET.bit.MC0 = 0x0; }
|
||||
static inline void IGN4_TIMER_DISABLE(void) { TCC2->INTENSET.bit.MC1 = 0x0; }
|
||||
//The below are NOT YET RIGHT!
|
||||
static inline void IGN5_TIMER_DISABLE(void) { TCC1->INTENSET.bit.MC0 = 0x0; }
|
||||
static inline void IGN6_TIMER_DISABLE(void) { TCC1->INTENSET.bit.MC1 = 0x0; }
|
||||
static inline void IGN7_TIMER_DISABLE(void) { TCC2->INTENSET.bit.MC0 = 0x0; }
|
||||
static inline void IGN8_TIMER_DISABLE(void) { TCC2->INTENSET.bit.MC1 = 0x0; }
|
||||
|
||||
#define MAX_TIMER_PERIOD 139808 // 2.13333333uS * 65535
|
||||
#define MAX_TIMER_PERIOD_SLOW 139808
|
||||
|
|
|
@ -137,46 +137,46 @@
|
|||
#define IGN8_COMPARE (TIM4)->CCR4
|
||||
#endif
|
||||
//github.com/rogerclarkmelbourne/Arduino_STM32/blob/754bc2969921f1ef262bd69e7faca80b19db7524/STM32F1/system/libmaple/include/libmaple/timer.h#L444
|
||||
#define FUEL1_TIMER_ENABLE() (TIM3)->SR = ~TIM_FLAG_CC1; (TIM3)->DIER |= TIM_DIER_CC1IE
|
||||
#define FUEL2_TIMER_ENABLE() (TIM3)->SR = ~TIM_FLAG_CC2; (TIM3)->DIER |= TIM_DIER_CC2IE
|
||||
#define FUEL3_TIMER_ENABLE() (TIM3)->SR = ~TIM_FLAG_CC3; (TIM3)->DIER |= TIM_DIER_CC3IE
|
||||
#define FUEL4_TIMER_ENABLE() (TIM3)->SR = ~TIM_FLAG_CC4; (TIM3)->DIER |= TIM_DIER_CC4IE
|
||||
static inline void FUEL1_TIMER_ENABLE(void) {(TIM3)->SR = ~TIM_FLAG_CC1; (TIM3)->DIER |= TIM_DIER_CC1IE;}
|
||||
static inline void FUEL2_TIMER_ENABLE(void) {(TIM3)->SR = ~TIM_FLAG_CC2; (TIM3)->DIER |= TIM_DIER_CC2IE;}
|
||||
static inline void FUEL3_TIMER_ENABLE(void) {(TIM3)->SR = ~TIM_FLAG_CC3; (TIM3)->DIER |= TIM_DIER_CC3IE;}
|
||||
static inline void FUEL4_TIMER_ENABLE(void) {(TIM3)->SR = ~TIM_FLAG_CC4; (TIM3)->DIER |= TIM_DIER_CC4IE;}
|
||||
|
||||
#define FUEL1_TIMER_DISABLE() (TIM3)->DIER &= ~TIM_DIER_CC1IE
|
||||
#define FUEL2_TIMER_DISABLE() (TIM3)->DIER &= ~TIM_DIER_CC2IE
|
||||
#define FUEL3_TIMER_DISABLE() (TIM3)->DIER &= ~TIM_DIER_CC3IE
|
||||
#define FUEL4_TIMER_DISABLE() (TIM3)->DIER &= ~TIM_DIER_CC4IE
|
||||
static inline void FUEL1_TIMER_DISABLE(void) {(TIM3)->DIER &= ~TIM_DIER_CC1IE;}
|
||||
static inline void FUEL2_TIMER_DISABLE(void) {(TIM3)->DIER &= ~TIM_DIER_CC2IE;}
|
||||
static inline void FUEL3_TIMER_DISABLE(void) {(TIM3)->DIER &= ~TIM_DIER_CC3IE;}
|
||||
static inline void FUEL4_TIMER_DISABLE(void) {(TIM3)->DIER &= ~TIM_DIER_CC4IE;}
|
||||
|
||||
#define IGN1_TIMER_ENABLE() (TIM2)->SR = ~TIM_FLAG_CC1; (TIM2)->DIER |= TIM_DIER_CC1IE
|
||||
#define IGN2_TIMER_ENABLE() (TIM2)->SR = ~TIM_FLAG_CC2; (TIM2)->DIER |= TIM_DIER_CC2IE
|
||||
#define IGN3_TIMER_ENABLE() (TIM2)->SR = ~TIM_FLAG_CC3; (TIM2)->DIER |= TIM_DIER_CC3IE
|
||||
#define IGN4_TIMER_ENABLE() (TIM2)->SR = ~TIM_FLAG_CC4; (TIM2)->DIER |= TIM_DIER_CC4IE
|
||||
static inline void IGN1_TIMER_ENABLE(void) {(TIM2)->SR = ~TIM_FLAG_CC1; (TIM2)->DIER |= TIM_DIER_CC1IE;}
|
||||
static inline void IGN2_TIMER_ENABLE(void) {(TIM2)->SR = ~TIM_FLAG_CC2; (TIM2)->DIER |= TIM_DIER_CC2IE;}
|
||||
static inline void IGN3_TIMER_ENABLE(void) {(TIM2)->SR = ~TIM_FLAG_CC3; (TIM2)->DIER |= TIM_DIER_CC3IE;}
|
||||
static inline void IGN4_TIMER_ENABLE(void) {(TIM2)->SR = ~TIM_FLAG_CC4; (TIM2)->DIER |= TIM_DIER_CC4IE;}
|
||||
|
||||
#define IGN1_TIMER_DISABLE() (TIM2)->DIER &= ~TIM_DIER_CC1IE
|
||||
#define IGN2_TIMER_DISABLE() (TIM2)->DIER &= ~TIM_DIER_CC2IE
|
||||
#define IGN3_TIMER_DISABLE() (TIM2)->DIER &= ~TIM_DIER_CC3IE
|
||||
#define IGN4_TIMER_DISABLE() (TIM2)->DIER &= ~TIM_DIER_CC4IE
|
||||
static inline void IGN1_TIMER_DISABLE(void) {(TIM2)->DIER &= ~TIM_DIER_CC1IE;}
|
||||
static inline void IGN2_TIMER_DISABLE(void) {(TIM2)->DIER &= ~TIM_DIER_CC2IE;}
|
||||
static inline void IGN3_TIMER_DISABLE(void) {(TIM2)->DIER &= ~TIM_DIER_CC3IE;}
|
||||
static inline void IGN4_TIMER_DISABLE(void) {(TIM2)->DIER &= ~TIM_DIER_CC4IE;}
|
||||
|
||||
#ifndef SMALL_FLASH_MODE
|
||||
#define FUEL5_TIMER_ENABLE() (TIM5)->SR = ~TIM_FLAG_CC1; (TIM5)->DIER |= TIM_DIER_CC1IE
|
||||
#define FUEL6_TIMER_ENABLE() (TIM5)->SR = ~TIM_FLAG_CC2; (TIM5)->DIER |= TIM_DIER_CC2IE
|
||||
#define FUEL7_TIMER_ENABLE() (TIM5)->SR = ~TIM_FLAG_CC3; (TIM5)->DIER |= TIM_DIER_CC3IE
|
||||
#define FUEL8_TIMER_ENABLE() (TIM5)->SR = ~TIM_FLAG_CC4; (TIM5)->DIER |= TIM_DIER_CC4IE
|
||||
static inline void FUEL5_TIMER_ENABLE(void) {(TIM5)->SR = ~TIM_FLAG_CC1; (TIM5)->DIER |= TIM_DIER_CC1IE;}
|
||||
static inline void FUEL6_TIMER_ENABLE(void) {(TIM5)->SR = ~TIM_FLAG_CC2; (TIM5)->DIER |= TIM_DIER_CC2IE;}
|
||||
static inline void FUEL7_TIMER_ENABLE(void) {(TIM5)->SR = ~TIM_FLAG_CC3; (TIM5)->DIER |= TIM_DIER_CC3IE;}
|
||||
static inline void FUEL8_TIMER_ENABLE(void) {(TIM5)->SR = ~TIM_FLAG_CC4; (TIM5)->DIER |= TIM_DIER_CC4IE;}
|
||||
|
||||
#define FUEL5_TIMER_DISABLE() (TIM5)->DIER &= ~TIM_DIER_CC1IE
|
||||
#define FUEL6_TIMER_DISABLE() (TIM5)->DIER &= ~TIM_DIER_CC2IE
|
||||
#define FUEL7_TIMER_DISABLE() (TIM5)->DIER &= ~TIM_DIER_CC3IE
|
||||
#define FUEL8_TIMER_DISABLE() (TIM5)->DIER &= ~TIM_DIER_CC4IE
|
||||
static inline void FUEL5_TIMER_DISABLE(void) {(TIM5)->DIER &= ~TIM_DIER_CC1IE;}
|
||||
static inline void FUEL6_TIMER_DISABLE(void) {(TIM5)->DIER &= ~TIM_DIER_CC2IE;}
|
||||
static inline void FUEL7_TIMER_DISABLE(void) {(TIM5)->DIER &= ~TIM_DIER_CC3IE;}
|
||||
static inline void FUEL8_TIMER_DISABLE(void) {(TIM5)->DIER &= ~TIM_DIER_CC4IE;}
|
||||
|
||||
#define IGN5_TIMER_ENABLE() (TIM4)->SR = ~TIM_FLAG_CC1; (TIM4)->DIER |= TIM_DIER_CC1IE
|
||||
#define IGN6_TIMER_ENABLE() (TIM4)->SR = ~TIM_FLAG_CC2; (TIM4)->DIER |= TIM_DIER_CC2IE
|
||||
#define IGN7_TIMER_ENABLE() (TIM4)->SR = ~TIM_FLAG_CC3; (TIM4)->DIER |= TIM_DIER_CC3IE
|
||||
#define IGN8_TIMER_ENABLE() (TIM4)->SR = ~TIM_FLAG_CC4; (TIM4)->DIER |= TIM_DIER_CC4IE
|
||||
static inline void IGN5_TIMER_ENABLE(void) {(TIM4)->SR = ~TIM_FLAG_CC1; (TIM4)->DIER |= TIM_DIER_CC1IE;}
|
||||
static inline void IGN6_TIMER_ENABLE(void) {(TIM4)->SR = ~TIM_FLAG_CC2; (TIM4)->DIER |= TIM_DIER_CC2IE;}
|
||||
static inline void IGN7_TIMER_ENABLE(void) {(TIM4)->SR = ~TIM_FLAG_CC3; (TIM4)->DIER |= TIM_DIER_CC3IE;}
|
||||
static inline void IGN8_TIMER_ENABLE(void) {(TIM4)->SR = ~TIM_FLAG_CC4; (TIM4)->DIER |= TIM_DIER_CC4IE;}
|
||||
|
||||
#define IGN5_TIMER_DISABLE() (TIM4)->DIER &= ~TIM_DIER_CC1IE
|
||||
#define IGN6_TIMER_DISABLE() (TIM4)->DIER &= ~TIM_DIER_CC2IE
|
||||
#define IGN7_TIMER_DISABLE() (TIM4)->DIER &= ~TIM_DIER_CC3IE
|
||||
#define IGN8_TIMER_DISABLE() (TIM4)->DIER &= ~TIM_DIER_CC4IE
|
||||
static inline void IGN5_TIMER_DISABLE(void) {(TIM4)->DIER &= ~TIM_DIER_CC1IE;}
|
||||
static inline void IGN6_TIMER_DISABLE(void) {(TIM4)->DIER &= ~TIM_DIER_CC2IE;}
|
||||
static inline void IGN7_TIMER_DISABLE(void) {(TIM4)->DIER &= ~TIM_DIER_CC3IE;}
|
||||
static inline void IGN8_TIMER_DISABLE(void) {(TIM4)->DIER &= ~TIM_DIER_CC4IE;}
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
|
@ -196,46 +196,46 @@ extern "C" char* sbrk(int incr);
|
|||
#define IGN8_COMPARE (TIM4)->CCR4
|
||||
|
||||
|
||||
#define FUEL1_TIMER_ENABLE() (TIM3)->CR1 |= TIM_CR1_CEN; (TIM3)->SR = ~TIM_FLAG_CC1; (TIM3)->DIER |= TIM_DIER_CC1IE
|
||||
#define FUEL2_TIMER_ENABLE() (TIM3)->CR1 |= TIM_CR1_CEN; (TIM3)->SR = ~TIM_FLAG_CC2; (TIM3)->DIER |= TIM_DIER_CC2IE
|
||||
#define FUEL3_TIMER_ENABLE() (TIM3)->CR1 |= TIM_CR1_CEN; (TIM3)->SR = ~TIM_FLAG_CC3; (TIM3)->DIER |= TIM_DIER_CC3IE
|
||||
#define FUEL4_TIMER_ENABLE() (TIM3)->CR1 |= TIM_CR1_CEN; (TIM3)->SR = ~TIM_FLAG_CC4; (TIM3)->DIER |= TIM_DIER_CC4IE
|
||||
static inline void FUEL1_TIMER_ENABLE(void) {(TIM3)->CR1 |= TIM_CR1_CEN; (TIM3)->SR = ~TIM_FLAG_CC1; (TIM3)->DIER |= TIM_DIER_CC1IE;}
|
||||
static inline void FUEL2_TIMER_ENABLE(void) {(TIM3)->CR1 |= TIM_CR1_CEN; (TIM3)->SR = ~TIM_FLAG_CC2; (TIM3)->DIER |= TIM_DIER_CC2IE;}
|
||||
static inline void FUEL3_TIMER_ENABLE(void) {(TIM3)->CR1 |= TIM_CR1_CEN; (TIM3)->SR = ~TIM_FLAG_CC3; (TIM3)->DIER |= TIM_DIER_CC3IE;}
|
||||
static inline void FUEL4_TIMER_ENABLE(void) {(TIM3)->CR1 |= TIM_CR1_CEN; (TIM3)->SR = ~TIM_FLAG_CC4; (TIM3)->DIER |= TIM_DIER_CC4IE;}
|
||||
|
||||
#define FUEL1_TIMER_DISABLE() (TIM3)->DIER &= ~TIM_DIER_CC1IE
|
||||
#define FUEL2_TIMER_DISABLE() (TIM3)->DIER &= ~TIM_DIER_CC2IE
|
||||
#define FUEL3_TIMER_DISABLE() (TIM3)->DIER &= ~TIM_DIER_CC3IE
|
||||
#define FUEL4_TIMER_DISABLE() (TIM3)->DIER &= ~TIM_DIER_CC4IE
|
||||
static inline void FUEL1_TIMER_DISABLE(void) {(TIM3)->DIER &= ~TIM_DIER_CC1IE;}
|
||||
static inline void FUEL2_TIMER_DISABLE(void) {(TIM3)->DIER &= ~TIM_DIER_CC2IE;}
|
||||
static inline void FUEL3_TIMER_DISABLE(void) {(TIM3)->DIER &= ~TIM_DIER_CC3IE;}
|
||||
static inline void FUEL4_TIMER_DISABLE(void) {(TIM3)->DIER &= ~TIM_DIER_CC4IE;}
|
||||
|
||||
#define IGN1_TIMER_ENABLE() (TIM2)->CR1 |= TIM_CR1_CEN; (TIM2)->SR = ~TIM_FLAG_CC1; (TIM2)->DIER |= TIM_DIER_CC1IE
|
||||
#define IGN2_TIMER_ENABLE() (TIM2)->CR1 |= TIM_CR1_CEN; (TIM2)->SR = ~TIM_FLAG_CC2; (TIM2)->DIER |= TIM_DIER_CC2IE
|
||||
#define IGN3_TIMER_ENABLE() (TIM2)->CR1 |= TIM_CR1_CEN; (TIM2)->SR = ~TIM_FLAG_CC3; (TIM2)->DIER |= TIM_DIER_CC3IE
|
||||
#define IGN4_TIMER_ENABLE() (TIM2)->CR1 |= TIM_CR1_CEN; (TIM2)->SR = ~TIM_FLAG_CC4; (TIM2)->DIER |= TIM_DIER_CC4IE
|
||||
static inline void IGN1_TIMER_ENABLE(void) {(TIM2)->CR1 |= TIM_CR1_CEN; (TIM2)->SR = ~TIM_FLAG_CC1; (TIM2)->DIER |= TIM_DIER_CC1IE;}
|
||||
static inline void IGN2_TIMER_ENABLE(void) {(TIM2)->CR1 |= TIM_CR1_CEN; (TIM2)->SR = ~TIM_FLAG_CC2; (TIM2)->DIER |= TIM_DIER_CC2IE;}
|
||||
static inline void IGN3_TIMER_ENABLE(void) {(TIM2)->CR1 |= TIM_CR1_CEN; (TIM2)->SR = ~TIM_FLAG_CC3; (TIM2)->DIER |= TIM_DIER_CC3IE;}
|
||||
static inline void IGN4_TIMER_ENABLE(void) {(TIM2)->CR1 |= TIM_CR1_CEN; (TIM2)->SR = ~TIM_FLAG_CC4; (TIM2)->DIER |= TIM_DIER_CC4IE;}
|
||||
|
||||
#define IGN1_TIMER_DISABLE() (TIM2)->DIER &= ~TIM_DIER_CC1IE
|
||||
#define IGN2_TIMER_DISABLE() (TIM2)->DIER &= ~TIM_DIER_CC2IE
|
||||
#define IGN3_TIMER_DISABLE() (TIM2)->DIER &= ~TIM_DIER_CC3IE
|
||||
#define IGN4_TIMER_DISABLE() (TIM2)->DIER &= ~TIM_DIER_CC4IE
|
||||
static inline void IGN1_TIMER_DISABLE(void) {(TIM2)->DIER &= ~TIM_DIER_CC1IE;}
|
||||
static inline void IGN2_TIMER_DISABLE(void) {(TIM2)->DIER &= ~TIM_DIER_CC2IE;}
|
||||
static inline void IGN3_TIMER_DISABLE(void) {(TIM2)->DIER &= ~TIM_DIER_CC3IE;}
|
||||
static inline void IGN4_TIMER_DISABLE(void) {(TIM2)->DIER &= ~TIM_DIER_CC4IE;}
|
||||
|
||||
|
||||
#define FUEL5_TIMER_ENABLE() (TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->SR = ~TIM_FLAG_CC1; (TIM5)->DIER |= TIM_DIER_CC1IE
|
||||
#define FUEL6_TIMER_ENABLE() (TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->SR = ~TIM_FLAG_CC2; (TIM5)->DIER |= TIM_DIER_CC2IE
|
||||
#define FUEL7_TIMER_ENABLE() (TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->SR = ~TIM_FLAG_CC3; (TIM5)->DIER |= TIM_DIER_CC3IE
|
||||
#define FUEL8_TIMER_ENABLE() (TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->SR = ~TIM_FLAG_CC4; (TIM5)->DIER |= TIM_DIER_CC4IE
|
||||
static inline void FUEL5_TIMER_ENABLE(void) {(TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->SR = ~TIM_FLAG_CC1; (TIM5)->DIER |= TIM_DIER_CC1IE;}
|
||||
static inline void FUEL6_TIMER_ENABLE(void) {(TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->SR = ~TIM_FLAG_CC2; (TIM5)->DIER |= TIM_DIER_CC2IE;}
|
||||
static inline void FUEL7_TIMER_ENABLE(void) {(TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->SR = ~TIM_FLAG_CC3; (TIM5)->DIER |= TIM_DIER_CC3IE;}
|
||||
static inline void FUEL8_TIMER_ENABLE(void) {(TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->CR1 |= TIM_CR1_CEN; (TIM5)->SR = ~TIM_FLAG_CC4; (TIM5)->DIER |= TIM_DIER_CC4IE;}
|
||||
|
||||
#define FUEL5_TIMER_DISABLE() (TIM5)->DIER &= ~TIM_DIER_CC1IE
|
||||
#define FUEL6_TIMER_DISABLE() (TIM5)->DIER &= ~TIM_DIER_CC2IE
|
||||
#define FUEL7_TIMER_DISABLE() (TIM5)->DIER &= ~TIM_DIER_CC3IE
|
||||
#define FUEL8_TIMER_DISABLE() (TIM5)->DIER &= ~TIM_DIER_CC4IE
|
||||
static inline void FUEL5_TIMER_DISABLE(void) {(TIM5)->DIER &= ~TIM_DIER_CC1IE;}
|
||||
static inline void FUEL6_TIMER_DISABLE(void) {(TIM5)->DIER &= ~TIM_DIER_CC2IE;}
|
||||
static inline void FUEL7_TIMER_DISABLE(void) {(TIM5)->DIER &= ~TIM_DIER_CC3IE;}
|
||||
static inline void FUEL8_TIMER_DISABLE(void) {(TIM5)->DIER &= ~TIM_DIER_CC4IE;}
|
||||
|
||||
#define IGN5_TIMER_ENABLE() (TIM4)->CR1 |= TIM_CR1_CEN; (TIM4)->SR = ~TIM_FLAG_CC1; (TIM4)->DIER |= TIM_DIER_CC1IE
|
||||
#define IGN6_TIMER_ENABLE() (TIM4)->CR1 |= TIM_CR1_CEN; (TIM4)->SR = ~TIM_FLAG_CC2; (TIM4)->DIER |= TIM_DIER_CC2IE
|
||||
#define IGN7_TIMER_ENABLE() (TIM4)->CR1 |= TIM_CR1_CEN; (TIM4)->SR = ~TIM_FLAG_CC3; (TIM4)->DIER |= TIM_DIER_CC3IE
|
||||
#define IGN8_TIMER_ENABLE() (TIM4)->CR1 |= TIM_CR1_CEN; (TIM4)->SR = ~TIM_FLAG_CC4; (TIM4)->DIER |= TIM_DIER_CC4IE
|
||||
static inline void IGN5_TIMER_ENABLE(void) {(TIM4)->CR1 |= TIM_CR1_CEN; (TIM4)->SR = ~TIM_FLAG_CC1; (TIM4)->DIER |= TIM_DIER_CC1IE;}
|
||||
static inline void IGN6_TIMER_ENABLE(void) {(TIM4)->CR1 |= TIM_CR1_CEN; (TIM4)->SR = ~TIM_FLAG_CC2; (TIM4)->DIER |= TIM_DIER_CC2IE;}
|
||||
static inline void IGN7_TIMER_ENABLE(void) {(TIM4)->CR1 |= TIM_CR1_CEN; (TIM4)->SR = ~TIM_FLAG_CC3; (TIM4)->DIER |= TIM_DIER_CC3IE;}
|
||||
static inline void IGN8_TIMER_ENABLE(void) {(TIM4)->CR1 |= TIM_CR1_CEN; (TIM4)->SR = ~TIM_FLAG_CC4; (TIM4)->DIER |= TIM_DIER_CC4IE;}
|
||||
|
||||
#define IGN5_TIMER_DISABLE() (TIM4)->DIER &= ~TIM_DIER_CC1IE
|
||||
#define IGN6_TIMER_DISABLE() (TIM4)->DIER &= ~TIM_DIER_CC2IE
|
||||
#define IGN7_TIMER_DISABLE() (TIM4)->DIER &= ~TIM_DIER_CC3IE
|
||||
#define IGN8_TIMER_DISABLE() (TIM4)->DIER &= ~TIM_DIER_CC4IE
|
||||
static inline void IGN5_TIMER_DISABLE(void) {(TIM4)->DIER &= ~TIM_DIER_CC1IE;}
|
||||
static inline void IGN6_TIMER_DISABLE(void) {(TIM4)->DIER &= ~TIM_DIER_CC2IE;}
|
||||
static inline void IGN7_TIMER_DISABLE(void) {(TIM4)->DIER &= ~TIM_DIER_CC3IE;}
|
||||
static inline void IGN8_TIMER_DISABLE(void) {(TIM4)->DIER &= ~TIM_DIER_CC4IE;}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -76,41 +76,41 @@
|
|||
#define IGN7_COMPARE FTM3_C6V
|
||||
#define IGN8_COMPARE FTM3_C7V
|
||||
|
||||
#define FUEL1_TIMER_ENABLE() FTM0_C0SC |= FTM_CSC_CHIE //Write 1 to the CHIE (Channel Interrupt Enable) bit of channel 0 Status/Control
|
||||
#define FUEL2_TIMER_ENABLE() FTM0_C1SC |= FTM_CSC_CHIE
|
||||
#define FUEL3_TIMER_ENABLE() FTM0_C2SC |= FTM_CSC_CHIE
|
||||
#define FUEL4_TIMER_ENABLE() FTM0_C3SC |= FTM_CSC_CHIE
|
||||
#define FUEL5_TIMER_ENABLE() FTM3_C0SC |= FTM_CSC_CHIE
|
||||
#define FUEL6_TIMER_ENABLE() FTM3_C1SC |= FTM_CSC_CHIE
|
||||
#define FUEL7_TIMER_ENABLE() FTM3_C2SC |= FTM_CSC_CHIE
|
||||
#define FUEL8_TIMER_ENABLE() FTM3_C3SC |= FTM_CSC_CHIE
|
||||
static inline void FUEL1_TIMER_ENABLE(void) {FTM0_C0SC |= FTM_CSC_CHIE;} //Write 1 to the CHIE (Channel Interrupt Enable) bit of channel 0 Status/Control
|
||||
static inline void FUEL2_TIMER_ENABLE(void) {FTM0_C1SC |= FTM_CSC_CHIE;}
|
||||
static inline void FUEL3_TIMER_ENABLE(void) {FTM0_C2SC |= FTM_CSC_CHIE;}
|
||||
static inline void FUEL4_TIMER_ENABLE(void) {FTM0_C3SC |= FTM_CSC_CHIE;}
|
||||
static inline void FUEL5_TIMER_ENABLE(void) {FTM3_C0SC |= FTM_CSC_CHIE;}
|
||||
static inline void FUEL6_TIMER_ENABLE(void) {FTM3_C1SC |= FTM_CSC_CHIE;}
|
||||
static inline void FUEL7_TIMER_ENABLE(void) {FTM3_C2SC |= FTM_CSC_CHIE;}
|
||||
static inline void FUEL8_TIMER_ENABLE(void) {FTM3_C3SC |= FTM_CSC_CHIE;}
|
||||
|
||||
#define FUEL1_TIMER_DISABLE() FTM0_C0SC &= ~FTM_CSC_CHIE //Write 0 to the CHIE (Channel Interrupt Enable) bit of channel 0 Status/Control
|
||||
#define FUEL2_TIMER_DISABLE() FTM0_C1SC &= ~FTM_CSC_CHIE
|
||||
#define FUEL3_TIMER_DISABLE() FTM0_C2SC &= ~FTM_CSC_CHIE
|
||||
#define FUEL4_TIMER_DISABLE() FTM0_C3SC &= ~FTM_CSC_CHIE
|
||||
#define FUEL5_TIMER_DISABLE() FTM3_C0SC &= ~FTM_CSC_CHIE //Write 0 to the CHIE (Channel Interrupt Enable) bit of channel 0 Status/Control
|
||||
#define FUEL6_TIMER_DISABLE() FTM3_C1SC &= ~FTM_CSC_CHIE
|
||||
#define FUEL7_TIMER_DISABLE() FTM3_C2SC &= ~FTM_CSC_CHIE
|
||||
#define FUEL8_TIMER_DISABLE() FTM3_C3SC &= ~FTM_CSC_CHIE
|
||||
static inline void FUEL1_TIMER_DISABLE(void) {FTM0_C0SC &= ~FTM_CSC_CHIE;} //Write 0 to the CHIE (Channel Interrupt Enable) bit of channel 0 Status/Control
|
||||
static inline void FUEL2_TIMER_DISABLE(void) {FTM0_C1SC &= ~FTM_CSC_CHIE;}
|
||||
static inline void FUEL3_TIMER_DISABLE(void) {FTM0_C2SC &= ~FTM_CSC_CHIE;}
|
||||
static inline void FUEL4_TIMER_DISABLE(void) {FTM0_C3SC &= ~FTM_CSC_CHIE;}
|
||||
static inline void FUEL5_TIMER_DISABLE(void) {FTM3_C0SC &= ~FTM_CSC_CHIE;} //Write 0 to the CHIE (Channel Interrupt Enable) bit of channel 0 Status/Control
|
||||
static inline void FUEL6_TIMER_DISABLE(void) {FTM3_C1SC &= ~FTM_CSC_CHIE;}
|
||||
static inline void FUEL7_TIMER_DISABLE(void) {FTM3_C2SC &= ~FTM_CSC_CHIE;}
|
||||
static inline void FUEL8_TIMER_DISABLE(void) {FTM3_C3SC &= ~FTM_CSC_CHIE;}
|
||||
|
||||
#define IGN1_TIMER_ENABLE() FTM0_C4SC |= FTM_CSC_CHIE
|
||||
#define IGN2_TIMER_ENABLE() FTM0_C5SC |= FTM_CSC_CHIE
|
||||
#define IGN3_TIMER_ENABLE() FTM0_C6SC |= FTM_CSC_CHIE
|
||||
#define IGN4_TIMER_ENABLE() FTM0_C7SC |= FTM_CSC_CHIE
|
||||
#define IGN5_TIMER_ENABLE() FTM3_C4SC |= FTM_CSC_CHIE
|
||||
#define IGN6_TIMER_ENABLE() FTM3_C5SC |= FTM_CSC_CHIE
|
||||
#define IGN7_TIMER_ENABLE() FTM3_C6SC |= FTM_CSC_CHIE
|
||||
#define IGN8_TIMER_ENABLE() FTM3_C7SC |= FTM_CSC_CHIE
|
||||
static inline void IGN1_TIMER_ENABLE(void) {FTM0_C4SC |= FTM_CSC_CHIE;}
|
||||
static inline void IGN2_TIMER_ENABLE(void) {FTM0_C5SC |= FTM_CSC_CHIE;}
|
||||
static inline void IGN3_TIMER_ENABLE(void) {FTM0_C6SC |= FTM_CSC_CHIE;}
|
||||
static inline void IGN4_TIMER_ENABLE(void) {FTM0_C7SC |= FTM_CSC_CHIE;}
|
||||
static inline void IGN5_TIMER_ENABLE(void) {FTM3_C4SC |= FTM_CSC_CHIE;}
|
||||
static inline void IGN6_TIMER_ENABLE(void) {FTM3_C5SC |= FTM_CSC_CHIE;}
|
||||
static inline void IGN7_TIMER_ENABLE(void) {FTM3_C6SC |= FTM_CSC_CHIE;}
|
||||
static inline void IGN8_TIMER_ENABLE(void) {FTM3_C7SC |= FTM_CSC_CHIE;}
|
||||
|
||||
#define IGN1_TIMER_DISABLE() FTM0_C4SC &= ~FTM_CSC_CHIE
|
||||
#define IGN2_TIMER_DISABLE() FTM0_C5SC &= ~FTM_CSC_CHIE
|
||||
#define IGN3_TIMER_DISABLE() FTM0_C6SC &= ~FTM_CSC_CHIE
|
||||
#define IGN4_TIMER_DISABLE() FTM0_C7SC &= ~FTM_CSC_CHIE
|
||||
#define IGN5_TIMER_DISABLE() FTM3_C4SC &= ~FTM_CSC_CHIE
|
||||
#define IGN6_TIMER_DISABLE() FTM3_C5SC &= ~FTM_CSC_CHIE
|
||||
#define IGN7_TIMER_DISABLE() FTM3_C6SC &= ~FTM_CSC_CHIE
|
||||
#define IGN8_TIMER_DISABLE() FTM3_C7SC &= ~FTM_CSC_CHIE
|
||||
static inline void IGN1_TIMER_DISABLE(void) {FTM0_C4SC &= ~FTM_CSC_CHIE;}
|
||||
static inline void IGN2_TIMER_DISABLE(void) {FTM0_C5SC &= ~FTM_CSC_CHIE;}
|
||||
static inline void IGN3_TIMER_DISABLE(void) {FTM0_C6SC &= ~FTM_CSC_CHIE;}
|
||||
static inline void IGN4_TIMER_DISABLE(void) {FTM0_C7SC &= ~FTM_CSC_CHIE;}
|
||||
static inline void IGN5_TIMER_DISABLE(void) {FTM3_C4SC &= ~FTM_CSC_CHIE;}
|
||||
static inline void IGN6_TIMER_DISABLE(void) {FTM3_C5SC &= ~FTM_CSC_CHIE;}
|
||||
static inline void IGN7_TIMER_DISABLE(void) {FTM3_C6SC &= ~FTM_CSC_CHIE;}
|
||||
static inline void IGN8_TIMER_DISABLE(void) {FTM3_C7SC &= ~FTM_CSC_CHIE;}
|
||||
|
||||
#define MAX_TIMER_PERIOD 139808 // 2.13333333uS * 65535
|
||||
#define uS_TO_TIMER_COMPARE(uS) ((uS * 15) >> 5) //Converts a given number of uS into the required number of timer ticks until that time has passed.
|
||||
|
|
|
@ -82,41 +82,41 @@
|
|||
#define IGN7_COMPARE TMR4_COMP12
|
||||
#define IGN8_COMPARE TMR4_COMP13
|
||||
|
||||
#define FUEL1_TIMER_ENABLE() TMR1_CSCTRL0 |= TMR_CSCTRL_TCF1EN //Write 1 to the TCFIEN (Channel Interrupt Enable) bit of channel 0 Status/Control
|
||||
#define FUEL2_TIMER_ENABLE() TMR1_CSCTRL1 |= TMR_CSCTRL_TCF1EN
|
||||
#define FUEL3_TIMER_ENABLE() TMR1_CSCTRL2 |= TMR_CSCTRL_TCF1EN
|
||||
#define FUEL4_TIMER_ENABLE() TMR1_CSCTRL3 |= TMR_CSCTRL_TCF1EN
|
||||
#define FUEL5_TIMER_ENABLE() TMR3_CSCTRL0 |= TMR_CSCTRL_TCF1EN
|
||||
#define FUEL6_TIMER_ENABLE() TMR3_CSCTRL1 |= TMR_CSCTRL_TCF1EN
|
||||
#define FUEL7_TIMER_ENABLE() TMR3_CSCTRL2 |= TMR_CSCTRL_TCF1EN
|
||||
#define FUEL8_TIMER_ENABLE() TMR3_CSCTRL3 |= TMR_CSCTRL_TCF1EN
|
||||
static inline void FUEL1_TIMER_ENABLE(void) {TMR1_CSCTRL0 |= TMR_CSCTRL_TCF1EN;} //Write 1 to the TCFIEN (Channel Interrupt Enable) bit of channel 0 Status/Control
|
||||
static inline void FUEL2_TIMER_ENABLE(void) {TMR1_CSCTRL1 |= TMR_CSCTRL_TCF1EN;}
|
||||
static inline void FUEL3_TIMER_ENABLE(void) {TMR1_CSCTRL2 |= TMR_CSCTRL_TCF1EN;}
|
||||
static inline void FUEL4_TIMER_ENABLE(void) {TMR1_CSCTRL3 |= TMR_CSCTRL_TCF1EN;}
|
||||
static inline void FUEL5_TIMER_ENABLE(void) {TMR3_CSCTRL0 |= TMR_CSCTRL_TCF1EN;}
|
||||
static inline void FUEL6_TIMER_ENABLE(void) {TMR3_CSCTRL1 |= TMR_CSCTRL_TCF1EN;}
|
||||
static inline void FUEL7_TIMER_ENABLE(void) {TMR3_CSCTRL2 |= TMR_CSCTRL_TCF1EN;}
|
||||
static inline void FUEL8_TIMER_ENABLE(void) {TMR3_CSCTRL3 |= TMR_CSCTRL_TCF1EN;}
|
||||
|
||||
#define FUEL1_TIMER_DISABLE() TMR1_CSCTRL0 &= ~TMR_CSCTRL_TCF1EN //Write 0 to the TCFIEN (Channel Interrupt Enable) bit of channel 0 Status/Control
|
||||
#define FUEL2_TIMER_DISABLE() TMR1_CSCTRL1 &= ~TMR_CSCTRL_TCF1EN
|
||||
#define FUEL3_TIMER_DISABLE() TMR1_CSCTRL2 &= ~TMR_CSCTRL_TCF1EN
|
||||
#define FUEL4_TIMER_DISABLE() TMR1_CSCTRL3 &= ~TMR_CSCTRL_TCF1EN
|
||||
#define FUEL5_TIMER_DISABLE() TMR3_CSCTRL0 &= ~TMR_CSCTRL_TCF1EN
|
||||
#define FUEL6_TIMER_DISABLE() TMR3_CSCTRL1 &= ~TMR_CSCTRL_TCF1EN
|
||||
#define FUEL7_TIMER_DISABLE() TMR3_CSCTRL2 &= ~TMR_CSCTRL_TCF1EN
|
||||
#define FUEL8_TIMER_DISABLE() TMR3_CSCTRL3 &= ~TMR_CSCTRL_TCF1EN
|
||||
static inline void FUEL1_TIMER_DISABLE(void) {TMR1_CSCTRL0 &= ~TMR_CSCTRL_TCF1EN;} //Write 0 to the TCFIEN (Channel Interrupt Enable) bit of channel 0 Status/Control
|
||||
static inline void FUEL2_TIMER_DISABLE(void) {TMR1_CSCTRL1 &= ~TMR_CSCTRL_TCF1EN;}
|
||||
static inline void FUEL3_TIMER_DISABLE(void) {TMR1_CSCTRL2 &= ~TMR_CSCTRL_TCF1EN;}
|
||||
static inline void FUEL4_TIMER_DISABLE(void) {TMR1_CSCTRL3 &= ~TMR_CSCTRL_TCF1EN;}
|
||||
static inline void FUEL5_TIMER_DISABLE(void) {TMR3_CSCTRL0 &= ~TMR_CSCTRL_TCF1EN;}
|
||||
static inline void FUEL6_TIMER_DISABLE(void) {TMR3_CSCTRL1 &= ~TMR_CSCTRL_TCF1EN;}
|
||||
static inline void FUEL7_TIMER_DISABLE(void) {TMR3_CSCTRL2 &= ~TMR_CSCTRL_TCF1EN;}
|
||||
static inline void FUEL8_TIMER_DISABLE(void) {TMR3_CSCTRL3 &= ~TMR_CSCTRL_TCF1EN;}
|
||||
|
||||
#define IGN1_TIMER_ENABLE() TMR2_CSCTRL0 |= TMR_CSCTRL_TCF1EN
|
||||
#define IGN2_TIMER_ENABLE() TMR2_CSCTRL1 |= TMR_CSCTRL_TCF1EN
|
||||
#define IGN3_TIMER_ENABLE() TMR2_CSCTRL2 |= TMR_CSCTRL_TCF1EN
|
||||
#define IGN4_TIMER_ENABLE() TMR2_CSCTRL3 |= TMR_CSCTRL_TCF1EN
|
||||
#define IGN5_TIMER_ENABLE() TMR4_CSCTRL0 |= TMR_CSCTRL_TCF1EN
|
||||
#define IGN6_TIMER_ENABLE() TMR4_CSCTRL1 |= TMR_CSCTRL_TCF1EN
|
||||
#define IGN7_TIMER_ENABLE() TMR4_CSCTRL2 |= TMR_CSCTRL_TCF1EN
|
||||
#define IGN8_TIMER_ENABLE() TMR4_CSCTRL3 |= TMR_CSCTRL_TCF1EN
|
||||
static inline void IGN1_TIMER_ENABLE(void) {TMR2_CSCTRL0 |= TMR_CSCTRL_TCF1EN;}
|
||||
static inline void IGN2_TIMER_ENABLE(void) {TMR2_CSCTRL1 |= TMR_CSCTRL_TCF1EN;}
|
||||
static inline void IGN3_TIMER_ENABLE(void) {TMR2_CSCTRL2 |= TMR_CSCTRL_TCF1EN;}
|
||||
static inline void IGN4_TIMER_ENABLE(void) {TMR2_CSCTRL3 |= TMR_CSCTRL_TCF1EN;}
|
||||
static inline void IGN5_TIMER_ENABLE(void) {TMR4_CSCTRL0 |= TMR_CSCTRL_TCF1EN;}
|
||||
static inline void IGN6_TIMER_ENABLE(void) {TMR4_CSCTRL1 |= TMR_CSCTRL_TCF1EN;}
|
||||
static inline void IGN7_TIMER_ENABLE(void) {TMR4_CSCTRL2 |= TMR_CSCTRL_TCF1EN;}
|
||||
static inline void IGN8_TIMER_ENABLE(void) {TMR4_CSCTRL3 |= TMR_CSCTRL_TCF1EN;}
|
||||
|
||||
#define IGN1_TIMER_DISABLE() TMR2_CSCTRL0 &= ~TMR_CSCTRL_TCF1EN
|
||||
#define IGN2_TIMER_DISABLE() TMR2_CSCTRL1 &= ~TMR_CSCTRL_TCF1EN
|
||||
#define IGN3_TIMER_DISABLE() TMR2_CSCTRL2 &= ~TMR_CSCTRL_TCF1EN
|
||||
#define IGN4_TIMER_DISABLE() TMR2_CSCTRL3 &= ~TMR_CSCTRL_TCF1EN
|
||||
#define IGN5_TIMER_DISABLE() TMR4_CSCTRL0 &= ~TMR_CSCTRL_TCF1EN
|
||||
#define IGN6_TIMER_DISABLE() TMR4_CSCTRL1 &= ~TMR_CSCTRL_TCF1EN
|
||||
#define IGN7_TIMER_DISABLE() TMR4_CSCTRL2 &= ~TMR_CSCTRL_TCF1EN
|
||||
#define IGN8_TIMER_DISABLE() TMR4_CSCTRL3 &= ~TMR_CSCTRL_TCF1EN
|
||||
static inline void IGN1_TIMER_DISABLE(void) {TMR2_CSCTRL0 &= ~TMR_CSCTRL_TCF1EN;}
|
||||
static inline void IGN2_TIMER_DISABLE(void) {TMR2_CSCTRL1 &= ~TMR_CSCTRL_TCF1EN;}
|
||||
static inline void IGN3_TIMER_DISABLE(void) {TMR2_CSCTRL2 &= ~TMR_CSCTRL_TCF1EN;}
|
||||
static inline void IGN4_TIMER_DISABLE(void) {TMR2_CSCTRL3 &= ~TMR_CSCTRL_TCF1EN;}
|
||||
static inline void IGN5_TIMER_DISABLE(void) {TMR4_CSCTRL0 &= ~TMR_CSCTRL_TCF1EN;}
|
||||
static inline void IGN6_TIMER_DISABLE(void) {TMR4_CSCTRL1 &= ~TMR_CSCTRL_TCF1EN;}
|
||||
static inline void IGN7_TIMER_DISABLE(void) {TMR4_CSCTRL2 &= ~TMR_CSCTRL_TCF1EN;}
|
||||
static inline void IGN8_TIMER_DISABLE(void) {TMR4_CSCTRL3 &= ~TMR_CSCTRL_TCF1EN;}
|
||||
|
||||
//Bus Clock is 150Mhz @ 600 Mhz CPU. Need to handle this dynamically in the future for other frequencies
|
||||
//#define TMR_PRESCALE 128
|
||||
|
|
|
@ -67,45 +67,45 @@
|
|||
#define IGN7_COMPARE <register here>
|
||||
#define IGN8_COMPARE <register here>
|
||||
|
||||
#define FUEL1_TIMER_ENABLE() <macro here>
|
||||
#define FUEL2_TIMER_ENABLE() <macro here>
|
||||
#define FUEL3_TIMER_ENABLE() <macro here>
|
||||
#define FUEL4_TIMER_ENABLE() <macro here>
|
||||
static inline void FUEL1_TIMER_ENABLE(void) {<macro here>;}
|
||||
static inline void FUEL2_TIMER_ENABLE(void) {<macro here>;}
|
||||
static inline void FUEL3_TIMER_ENABLE(void) {<macro here>;}
|
||||
static inline void FUEL4_TIMER_ENABLE(void) {<macro here>;}
|
||||
//The below are optional, but recommended if there are sufficient timers/compares
|
||||
#define FUEL5_TIMER_ENABLE() <macro here>
|
||||
#define FUEL6_TIMER_ENABLE() <macro here>
|
||||
#define FUEL7_TIMER_ENABLE() <macro here>
|
||||
#define FUEL8_TIMER_ENABLE() <macro here>
|
||||
static inline void FUEL5_TIMER_ENABLE(void) {<macro here>;}
|
||||
static inline void FUEL6_TIMER_ENABLE(void) {<macro here>;}
|
||||
static inline void FUEL7_TIMER_ENABLE(void) {<macro here>;}
|
||||
static inline void FUEL8_TIMER_ENABLE(void) {<macro here>;}
|
||||
|
||||
#define FUEL1_TIMER_DISABLE() <macro here>
|
||||
#define FUEL2_TIMER_DISABLE() <macro here>
|
||||
#define FUEL3_TIMER_DISABLE() <macro here>
|
||||
#define FUEL4_TIMER_DISABLE() <macro here>
|
||||
static inline void FUEL1_TIMER_DISABLE(void) { <macro here>;}
|
||||
static inline void FUEL2_TIMER_DISABLE(void) { <macro here>;}
|
||||
static inline void FUEL3_TIMER_DISABLE(void) { <macro here>;}
|
||||
static inline void FUEL4_TIMER_DISABLE(void) { <macro here>;}
|
||||
//The below are optional, but recommended if there are sufficient timers/compares
|
||||
#define FUEL5_TIMER_DISABLE() <macro here>
|
||||
#define FUEL6_TIMER_DISABLE() <macro here>
|
||||
#define FUEL7_TIMER_DISABLE() <macro here>
|
||||
#define FUEL8_TIMER_DISABLE() <macro here>
|
||||
static inline void FUEL5_TIMER_DISABLE(void) { <macro here>;}
|
||||
static inline void FUEL6_TIMER_DISABLE(void) { <macro here>;}
|
||||
static inline void FUEL7_TIMER_DISABLE(void) { <macro here>;}
|
||||
static inline void FUEL8_TIMER_DISABLE(void) { <macro here>;}
|
||||
|
||||
#define IGN1_TIMER_ENABLE() <macro here>
|
||||
#define IGN2_TIMER_ENABLE() <macro here>
|
||||
#define IGN3_TIMER_ENABLE() <macro here>
|
||||
#define IGN4_TIMER_ENABLE() <macro here>
|
||||
static inline void IGN1_TIMER_ENABLE(void) {<macro here>;}
|
||||
static inline void IGN2_TIMER_ENABLE(void) {<macro here>;}
|
||||
static inline void IGN3_TIMER_ENABLE(void) {<macro here>;}
|
||||
static inline void IGN4_TIMER_ENABLE(void) {<macro here>;}
|
||||
//The below are optional, but recommended if there are sufficient timers/compares
|
||||
#define IGN5_TIMER_ENABLE() <macro here>
|
||||
#define IGN6_TIMER_ENABLE() <macro here>
|
||||
#define IGN7_TIMER_ENABLE() <macro here>
|
||||
#define IGN8_TIMER_ENABLE() <macro here>
|
||||
static inline void IGN5_TIMER_ENABLE(void) {<macro here>;}
|
||||
static inline void IGN6_TIMER_ENABLE(void) {<macro here>;}
|
||||
static inline void IGN7_TIMER_ENABLE(void) {<macro here>;}
|
||||
static inline void IGN8_TIMER_ENABLE(void) {<macro here>;}
|
||||
|
||||
#define IGN1_TIMER_DISABLE() <macro here>
|
||||
#define IGN2_TIMER_DISABLE() <macro here>
|
||||
#define IGN3_TIMER_DISABLE() <macro here>
|
||||
#define IGN4_TIMER_DISABLE() <macro here>
|
||||
//The below are optional, but recommended if there are sufficient timers/compares
|
||||
#define IGN5_TIMER_DISABLE() <macro here>
|
||||
#define IGN6_TIMER_DISABLE() <macro here>
|
||||
#define IGN7_TIMER_DISABLE() <macro here>
|
||||
#define IGN8_TIMER_DISABLE() <macro here>
|
||||
static inline void IGN1_TIMER_DISABLE(void) {<macro here>;}
|
||||
static inline void IGN2_TIMER_DISABLE(void) {<macro here>;}
|
||||
static inline void IGN3_TIMER_DISABLE(void) {<macro here>;}
|
||||
static inline void IGN4_TIMER_DISABLE(void) {<macro here>;}
|
||||
//The below are optional, but recommended if there are suffici;}ent timers/compares
|
||||
static inline void IGN5_TIMER_DISABLE(void) {<macro here>;}
|
||||
static inline void IGN6_TIMER_DISABLE(void) {<macro here>;}
|
||||
static inline void IGN7_TIMER_DISABLE(void) {<macro here>;}
|
||||
static inline void IGN8_TIMER_DISABLE(void) {<macro here>;}
|
||||
|
||||
|
||||
#define MAX_TIMER_PERIOD 139808 //This is the maximum time, in uS, that the compare channels can run before overflowing. It is typically 65535 * <how long each tick represents>
|
||||
|
@ -117,7 +117,7 @@
|
|||
*/
|
||||
//macro functions for enabling and disabling timer interrupts for the boost and vvt functions
|
||||
#define ENABLE_BOOST_TIMER() <macro here>
|
||||
#define DISABLE_BOOST_TIMER() <macro here>
|
||||
#define DISABLE_BOOST_TIMER(void) { <macro here>
|
||||
|
||||
#define ENABLE_VVT_TIMER() <macro here>
|
||||
#define DISABLE_VVT_TIMER() <macro here>
|
||||
|
|
|
@ -984,17 +984,17 @@ void initialiseAll(void)
|
|||
{
|
||||
case INJ_PAIRED:
|
||||
//Paired injection
|
||||
inj1StartFunction = openInjector1;
|
||||
inj1EndFunction = closeInjector1;
|
||||
inj2StartFunction = openInjector2;
|
||||
inj2EndFunction = closeInjector2;
|
||||
inj3StartFunction = openInjector3;
|
||||
inj3EndFunction = closeInjector3;
|
||||
inj4StartFunction = openInjector4;
|
||||
inj4EndFunction = closeInjector4;
|
||||
#if (INJ_CHANNELS >= 5)
|
||||
inj5StartFunction = openInjector5;
|
||||
inj5EndFunction = closeInjector5;
|
||||
fuelSchedule1.pStartFunction = openInjector1;
|
||||
fuelSchedule1.pEndFunction = closeInjector1;
|
||||
fuelSchedule2.pStartFunction = openInjector2;
|
||||
fuelSchedule2.pEndFunction = closeInjector2;
|
||||
fuelSchedule3.pStartFunction = openInjector3;
|
||||
fuelSchedule3.pEndFunction = closeInjector3;
|
||||
fuelSchedule4.pStartFunction = openInjector4;
|
||||
fuelSchedule4.pEndFunction = closeInjector4;
|
||||
#if INJ_CHANNELS >= 5
|
||||
fuelSchedule5.pStartFunction = openInjector5;
|
||||
fuelSchedule5.pEndFunction = closeInjector5;
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
@ -1004,109 +1004,109 @@ void initialiseAll(void)
|
|||
{
|
||||
if(configPage4.inj4cylPairing == INJ_PAIR_13_24)
|
||||
{
|
||||
inj1StartFunction = openInjector1and3;
|
||||
inj1EndFunction = closeInjector1and3;
|
||||
inj2StartFunction = openInjector2and4;
|
||||
inj2EndFunction = closeInjector2and4;
|
||||
fuelSchedule1.pStartFunction = openInjector1and3;
|
||||
fuelSchedule1.pEndFunction = closeInjector1and3;
|
||||
fuelSchedule2.pStartFunction = openInjector2and4;
|
||||
fuelSchedule2.pEndFunction = closeInjector2and4;
|
||||
}
|
||||
else
|
||||
{
|
||||
inj1StartFunction = openInjector1and4;
|
||||
inj1EndFunction = closeInjector1and4;
|
||||
inj2StartFunction = openInjector2and3;
|
||||
inj2EndFunction = closeInjector2and3;
|
||||
fuelSchedule1.pStartFunction = openInjector1and4;
|
||||
fuelSchedule1.pEndFunction = closeInjector1and4;
|
||||
fuelSchedule2.pStartFunction = openInjector2and3;
|
||||
fuelSchedule2.pEndFunction = closeInjector2and3;
|
||||
}
|
||||
}
|
||||
else if( configPage2.nCylinders == 5 ) //This is similar to the paired injection but uses five injector outputs instead of four
|
||||
{
|
||||
inj1StartFunction = openInjector1;
|
||||
inj1EndFunction = closeInjector1;
|
||||
inj2StartFunction = openInjector2;
|
||||
inj2EndFunction = closeInjector2;
|
||||
inj3StartFunction = openInjector3and5;
|
||||
inj3EndFunction = closeInjector3and5;
|
||||
inj4StartFunction = openInjector4;
|
||||
inj4EndFunction = closeInjector4;
|
||||
fuelSchedule1.pStartFunction = openInjector1;
|
||||
fuelSchedule1.pEndFunction = closeInjector1;
|
||||
fuelSchedule2.pStartFunction = openInjector2;
|
||||
fuelSchedule2.pEndFunction = closeInjector2;
|
||||
fuelSchedule3.pStartFunction = openInjector3and5;
|
||||
fuelSchedule3.pEndFunction = closeInjector3and5;
|
||||
fuelSchedule4.pStartFunction = openInjector4;
|
||||
fuelSchedule4.pEndFunction = closeInjector4;
|
||||
}
|
||||
else if( configPage2.nCylinders == 6 )
|
||||
{
|
||||
inj1StartFunction = openInjector1and4;
|
||||
inj1EndFunction = closeInjector1and4;
|
||||
inj2StartFunction = openInjector2and5;
|
||||
inj2EndFunction = closeInjector2and5;
|
||||
inj3StartFunction = openInjector3and6;
|
||||
inj3EndFunction = closeInjector3and6;
|
||||
fuelSchedule1.pStartFunction = openInjector1and4;
|
||||
fuelSchedule1.pEndFunction = closeInjector1and4;
|
||||
fuelSchedule2.pStartFunction = openInjector2and5;
|
||||
fuelSchedule2.pEndFunction = closeInjector2and5;
|
||||
fuelSchedule3.pStartFunction = openInjector3and6;
|
||||
fuelSchedule3.pEndFunction = closeInjector3and6;
|
||||
}
|
||||
else if( configPage2.nCylinders == 8 )
|
||||
{
|
||||
inj1StartFunction = openInjector1and5;
|
||||
inj1EndFunction = closeInjector1and5;
|
||||
inj2StartFunction = openInjector2and6;
|
||||
inj2EndFunction = closeInjector2and6;
|
||||
inj3StartFunction = openInjector3and7;
|
||||
inj3EndFunction = closeInjector3and7;
|
||||
inj4StartFunction = openInjector4and8;
|
||||
inj4EndFunction = closeInjector4and8;
|
||||
fuelSchedule1.pStartFunction = openInjector1and5;
|
||||
fuelSchedule1.pEndFunction = closeInjector1and5;
|
||||
fuelSchedule2.pStartFunction = openInjector2and6;
|
||||
fuelSchedule2.pEndFunction = closeInjector2and6;
|
||||
fuelSchedule3.pStartFunction = openInjector3and7;
|
||||
fuelSchedule3.pEndFunction = closeInjector3and7;
|
||||
fuelSchedule4.pStartFunction = openInjector4and8;
|
||||
fuelSchedule4.pEndFunction = closeInjector4and8;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Fall back to paired injection
|
||||
inj1StartFunction = openInjector1;
|
||||
inj1EndFunction = closeInjector1;
|
||||
inj2StartFunction = openInjector2;
|
||||
inj2EndFunction = closeInjector2;
|
||||
inj3StartFunction = openInjector3;
|
||||
inj3EndFunction = closeInjector3;
|
||||
inj4StartFunction = openInjector4;
|
||||
inj4EndFunction = closeInjector4;
|
||||
#if (INJ_CHANNELS >= 5)
|
||||
inj5StartFunction = openInjector5;
|
||||
inj5EndFunction = closeInjector5;
|
||||
fuelSchedule1.pStartFunction = openInjector1;
|
||||
fuelSchedule1.pEndFunction = closeInjector1;
|
||||
fuelSchedule2.pStartFunction = openInjector2;
|
||||
fuelSchedule2.pEndFunction = closeInjector2;
|
||||
fuelSchedule3.pStartFunction = openInjector3;
|
||||
fuelSchedule3.pEndFunction = closeInjector3;
|
||||
fuelSchedule4.pStartFunction = openInjector4;
|
||||
fuelSchedule4.pEndFunction = closeInjector4;
|
||||
#if INJ_CHANNELS >= 5
|
||||
fuelSchedule5.pStartFunction = openInjector5;
|
||||
fuelSchedule5.pEndFunction = closeInjector5;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
case INJ_SEQUENTIAL:
|
||||
//Sequential injection
|
||||
inj1StartFunction = openInjector1;
|
||||
inj1EndFunction = closeInjector1;
|
||||
inj2StartFunction = openInjector2;
|
||||
inj2EndFunction = closeInjector2;
|
||||
inj3StartFunction = openInjector3;
|
||||
inj3EndFunction = closeInjector3;
|
||||
inj4StartFunction = openInjector4;
|
||||
inj4EndFunction = closeInjector4;
|
||||
#if (INJ_CHANNELS >= 5)
|
||||
inj5StartFunction = openInjector5;
|
||||
inj5EndFunction = closeInjector5;
|
||||
fuelSchedule1.pStartFunction = openInjector1;
|
||||
fuelSchedule1.pEndFunction = closeInjector1;
|
||||
fuelSchedule2.pStartFunction = openInjector2;
|
||||
fuelSchedule2.pEndFunction = closeInjector2;
|
||||
fuelSchedule3.pStartFunction = openInjector3;
|
||||
fuelSchedule3.pEndFunction = closeInjector3;
|
||||
fuelSchedule4.pStartFunction = openInjector4;
|
||||
fuelSchedule4.pEndFunction = closeInjector4;
|
||||
#if INJ_CHANNELS >= 5
|
||||
fuelSchedule5.pStartFunction = openInjector5;
|
||||
fuelSchedule5.pEndFunction = closeInjector5;
|
||||
#endif
|
||||
#if (INJ_CHANNELS >= 6)
|
||||
inj6StartFunction = openInjector6;
|
||||
inj6EndFunction = closeInjector6;
|
||||
#if INJ_CHANNELS >= 6
|
||||
fuelSchedule6.pStartFunction = openInjector6;
|
||||
fuelSchedule6.pEndFunction = closeInjector6;
|
||||
#endif
|
||||
#if (INJ_CHANNELS >= 7)
|
||||
inj7StartFunction = openInjector7;
|
||||
inj7EndFunction = closeInjector7;
|
||||
#if INJ_CHANNELS >= 7
|
||||
fuelSchedule7.pStartFunction = openInjector7;
|
||||
fuelSchedule7.pEndFunction = closeInjector7;
|
||||
#endif
|
||||
#if (INJ_CHANNELS >= 8)
|
||||
inj8StartFunction = openInjector8;
|
||||
inj8EndFunction = closeInjector8;
|
||||
#if INJ_CHANNELS >= 8
|
||||
fuelSchedule8.pStartFunction = openInjector8;
|
||||
fuelSchedule8.pEndFunction = closeInjector8;
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
//Paired injection
|
||||
inj1StartFunction = openInjector1;
|
||||
inj1EndFunction = closeInjector1;
|
||||
inj2StartFunction = openInjector2;
|
||||
inj2EndFunction = closeInjector2;
|
||||
inj3StartFunction = openInjector3;
|
||||
inj3EndFunction = closeInjector3;
|
||||
inj4StartFunction = openInjector4;
|
||||
inj4EndFunction = closeInjector4;
|
||||
#if (INJ_CHANNELS >= 5)
|
||||
inj5StartFunction = openInjector5;
|
||||
inj5EndFunction = closeInjector5;
|
||||
fuelSchedule1.pStartFunction = openInjector1;
|
||||
fuelSchedule1.pEndFunction = closeInjector1;
|
||||
fuelSchedule2.pStartFunction = openInjector2;
|
||||
fuelSchedule2.pEndFunction = closeInjector2;
|
||||
fuelSchedule3.pStartFunction = openInjector3;
|
||||
fuelSchedule3.pEndFunction = closeInjector3;
|
||||
fuelSchedule4.pStartFunction = openInjector4;
|
||||
fuelSchedule4.pEndFunction = closeInjector4;
|
||||
#if INJ_CHANNELS >= 5
|
||||
fuelSchedule5.pStartFunction = openInjector5;
|
||||
fuelSchedule5.pEndFunction = closeInjector5;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
@ -1115,43 +1115,43 @@ void initialiseAll(void)
|
|||
{
|
||||
case IGN_MODE_WASTED:
|
||||
//Wasted Spark (Normal mode)
|
||||
ign1StartFunction = beginCoil1Charge;
|
||||
ign1EndFunction = endCoil1Charge;
|
||||
ign2StartFunction = beginCoil2Charge;
|
||||
ign2EndFunction = endCoil2Charge;
|
||||
ign3StartFunction = beginCoil3Charge;
|
||||
ign3EndFunction = endCoil3Charge;
|
||||
ign4StartFunction = beginCoil4Charge;
|
||||
ign4EndFunction = endCoil4Charge;
|
||||
ign5StartFunction = beginCoil5Charge;
|
||||
ign5EndFunction = endCoil5Charge;
|
||||
ignitionSchedule1.pStartCallback = beginCoil1Charge;
|
||||
ignitionSchedule1.pEndCallback = endCoil1Charge;
|
||||
ignitionSchedule2.pStartCallback = beginCoil2Charge;
|
||||
ignitionSchedule2.pEndCallback = endCoil2Charge;
|
||||
ignitionSchedule3.pStartCallback = beginCoil3Charge;
|
||||
ignitionSchedule3.pEndCallback = endCoil3Charge;
|
||||
ignitionSchedule4.pStartCallback = beginCoil4Charge;
|
||||
ignitionSchedule4.pEndCallback = endCoil4Charge;
|
||||
ignitionSchedule5.pStartCallback = beginCoil5Charge;
|
||||
ignitionSchedule5.pEndCallback = endCoil5Charge;
|
||||
break;
|
||||
|
||||
case IGN_MODE_SINGLE:
|
||||
//Single channel mode. All ignition pulses are on channel 1
|
||||
ign1StartFunction = beginCoil1Charge;
|
||||
ign1EndFunction = endCoil1Charge;
|
||||
ign2StartFunction = beginCoil1Charge;
|
||||
ign2EndFunction = endCoil1Charge;
|
||||
ign3StartFunction = beginCoil1Charge;
|
||||
ign3EndFunction = endCoil1Charge;
|
||||
ign4StartFunction = beginCoil1Charge;
|
||||
ign4EndFunction = endCoil1Charge;
|
||||
#if (INJ_CHANNELS >= 5)
|
||||
ign5StartFunction = beginCoil1Charge;
|
||||
ign5EndFunction = endCoil1Charge;
|
||||
ignitionSchedule1.pStartCallback = beginCoil1Charge;
|
||||
ignitionSchedule1.pEndCallback = endCoil1Charge;
|
||||
ignitionSchedule2.pStartCallback = beginCoil1Charge;
|
||||
ignitionSchedule2.pEndCallback = endCoil1Charge;
|
||||
ignitionSchedule3.pStartCallback = beginCoil1Charge;
|
||||
ignitionSchedule3.pEndCallback = endCoil1Charge;
|
||||
ignitionSchedule4.pStartCallback = beginCoil1Charge;
|
||||
ignitionSchedule4.pEndCallback = endCoil1Charge;
|
||||
#if IGN_CHANNELS >= 5
|
||||
ignitionSchedule5.pStartCallback = beginCoil1Charge;
|
||||
ignitionSchedule5.pEndCallback = endCoil1Charge;
|
||||
#endif
|
||||
#if (INJ_CHANNELS >= 6)
|
||||
ign6StartFunction = beginCoil1Charge;
|
||||
ign6EndFunction = endCoil1Charge;
|
||||
#if IGN_CHANNELS >= 6
|
||||
ignitionSchedule6.pStartCallback = beginCoil1Charge;
|
||||
ignitionSchedule6.pEndCallback = endCoil1Charge;
|
||||
#endif
|
||||
#if (INJ_CHANNELS >= 7)
|
||||
ign7StartFunction = beginCoil1Charge;
|
||||
ign7EndFunction = endCoil1Charge;
|
||||
#if IGN_CHANNELS >= 7
|
||||
ignitionSchedule7.pStartCallback = beginCoil1Charge;
|
||||
ignitionSchedule7.pEndCallback = endCoil1Charge;
|
||||
#endif
|
||||
#if (INJ_CHANNELS >= 5)
|
||||
ign8StartFunction = beginCoil1Charge;
|
||||
ign8EndFunction = endCoil1Charge;
|
||||
#if IGN_CHANNELS >= 8
|
||||
ignitionSchedule8.pStartCallback = beginCoil1Charge;
|
||||
ignitionSchedule8.pEndCallback = endCoil1Charge;
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
@ -1160,118 +1160,132 @@ void initialiseAll(void)
|
|||
//Wasted COP mode for 4 cylinders. Ignition channels 1&3 and 2&4 are paired together
|
||||
if( configPage2.nCylinders <= 4 )
|
||||
{
|
||||
ign1StartFunction = beginCoil1and3Charge;
|
||||
ign1EndFunction = endCoil1and3Charge;
|
||||
ign2StartFunction = beginCoil2and4Charge;
|
||||
ign2EndFunction = endCoil2and4Charge;
|
||||
ignitionSchedule1.pStartCallback = beginCoil1and3Charge;
|
||||
ignitionSchedule1.pEndCallback = endCoil1and3Charge;
|
||||
ignitionSchedule2.pStartCallback = beginCoil2and4Charge;
|
||||
ignitionSchedule2.pEndCallback = endCoil2and4Charge;
|
||||
|
||||
ign3StartFunction = nullCallback;
|
||||
ign3EndFunction = nullCallback;
|
||||
ign4StartFunction = nullCallback;
|
||||
ign4EndFunction = nullCallback;
|
||||
ignitionSchedule3.pStartCallback = nullCallback;
|
||||
ignitionSchedule3.pEndCallback = nullCallback;
|
||||
ignitionSchedule4.pStartCallback = nullCallback;
|
||||
ignitionSchedule4.pEndCallback = nullCallback;
|
||||
}
|
||||
//Wasted COP mode for 6 cylinders. Ignition channels 1&4, 2&5 and 3&6 are paired together
|
||||
else if( configPage2.nCylinders == 6 )
|
||||
{
|
||||
ign1StartFunction = beginCoil1and4Charge;
|
||||
ign1EndFunction = endCoil1and4Charge;
|
||||
ign2StartFunction = beginCoil2and5Charge;
|
||||
ign2EndFunction = endCoil2and5Charge;
|
||||
ign3StartFunction = beginCoil3and6Charge;
|
||||
ign3EndFunction = endCoil3and6Charge;
|
||||
ignitionSchedule1.pStartCallback = beginCoil1and4Charge;
|
||||
ignitionSchedule1.pEndCallback = endCoil1and4Charge;
|
||||
ignitionSchedule2.pStartCallback = beginCoil2and5Charge;
|
||||
ignitionSchedule2.pEndCallback = endCoil2and5Charge;
|
||||
ignitionSchedule3.pStartCallback = beginCoil3and6Charge;
|
||||
ignitionSchedule3.pEndCallback = endCoil3and6Charge;
|
||||
|
||||
ign4StartFunction = nullCallback;
|
||||
ign4EndFunction = nullCallback;
|
||||
ign5StartFunction = nullCallback;
|
||||
ign5EndFunction = nullCallback;
|
||||
ign6StartFunction = nullCallback;
|
||||
ign6EndFunction = nullCallback;
|
||||
ignitionSchedule4.pStartCallback = nullCallback;
|
||||
ignitionSchedule4.pEndCallback = nullCallback;
|
||||
ignitionSchedule5.pStartCallback = nullCallback;
|
||||
ignitionSchedule5.pEndCallback = nullCallback;
|
||||
#if IGN_CHANNELS >= 6
|
||||
ignitionSchedule6.pStartCallback = nullCallback;
|
||||
ignitionSchedule6.pEndCallback = nullCallback;
|
||||
#endif
|
||||
}
|
||||
//Wasted COP mode for 8 cylinders. Ignition channels 1&5, 2&6, 3&7 and 4&8 are paired together
|
||||
else if( configPage2.nCylinders == 8 )
|
||||
{
|
||||
ign1StartFunction = beginCoil1and5Charge;
|
||||
ign1EndFunction = endCoil1and5Charge;
|
||||
ign2StartFunction = beginCoil2and6Charge;
|
||||
ign2EndFunction = endCoil2and6Charge;
|
||||
ign3StartFunction = beginCoil3and7Charge;
|
||||
ign3EndFunction = endCoil3and7Charge;
|
||||
ign4StartFunction = beginCoil4and8Charge;
|
||||
ign4EndFunction = endCoil4and8Charge;
|
||||
ignitionSchedule1.pStartCallback = beginCoil1and5Charge;
|
||||
ignitionSchedule1.pEndCallback = endCoil1and5Charge;
|
||||
ignitionSchedule2.pStartCallback = beginCoil2and6Charge;
|
||||
ignitionSchedule2.pEndCallback = endCoil2and6Charge;
|
||||
ignitionSchedule3.pStartCallback = beginCoil3and7Charge;
|
||||
ignitionSchedule3.pEndCallback = endCoil3and7Charge;
|
||||
ignitionSchedule4.pStartCallback = beginCoil4and8Charge;
|
||||
ignitionSchedule4.pEndCallback = endCoil4and8Charge;
|
||||
|
||||
ign5StartFunction = nullCallback;
|
||||
ign5EndFunction = nullCallback;
|
||||
ign6StartFunction = nullCallback;
|
||||
ign6EndFunction = nullCallback;
|
||||
ign7StartFunction = nullCallback;
|
||||
ign7EndFunction = nullCallback;
|
||||
ign8StartFunction = nullCallback;
|
||||
ign8EndFunction = nullCallback;
|
||||
ignitionSchedule5.pStartCallback = nullCallback;
|
||||
ignitionSchedule5.pEndCallback = nullCallback;
|
||||
#if IGN_CHANNELS >= 6
|
||||
ignitionSchedule6.pStartCallback = nullCallback;
|
||||
ignitionSchedule6.pEndCallback = nullCallback;
|
||||
#endif
|
||||
#if IGN_CHANNELS >= 7
|
||||
ignitionSchedule7.pStartCallback = nullCallback;
|
||||
ignitionSchedule7.pEndCallback = nullCallback;
|
||||
#endif
|
||||
#if IGN_CHANNELS >= 8
|
||||
ignitionSchedule8.pStartCallback = nullCallback;
|
||||
ignitionSchedule8.pEndCallback = nullCallback;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
//If the person has inadvertently selected this when running more than 4 cylinders or other than 6 cylinders, just use standard Wasted spark mode
|
||||
ign1StartFunction = beginCoil1Charge;
|
||||
ign1EndFunction = endCoil1Charge;
|
||||
ign2StartFunction = beginCoil2Charge;
|
||||
ign2EndFunction = endCoil2Charge;
|
||||
ign3StartFunction = beginCoil3Charge;
|
||||
ign3EndFunction = endCoil3Charge;
|
||||
ign4StartFunction = beginCoil4Charge;
|
||||
ign4EndFunction = endCoil4Charge;
|
||||
ign5StartFunction = beginCoil5Charge;
|
||||
ign5EndFunction = endCoil5Charge;
|
||||
ignitionSchedule1.pStartCallback = beginCoil1Charge;
|
||||
ignitionSchedule1.pEndCallback = endCoil1Charge;
|
||||
ignitionSchedule2.pStartCallback = beginCoil2Charge;
|
||||
ignitionSchedule2.pEndCallback = endCoil2Charge;
|
||||
ignitionSchedule3.pStartCallback = beginCoil3Charge;
|
||||
ignitionSchedule3.pEndCallback = endCoil3Charge;
|
||||
ignitionSchedule4.pStartCallback = beginCoil4Charge;
|
||||
ignitionSchedule4.pEndCallback = endCoil4Charge;
|
||||
ignitionSchedule5.pStartCallback = beginCoil5Charge;
|
||||
ignitionSchedule5.pEndCallback = endCoil5Charge;
|
||||
}
|
||||
break;
|
||||
|
||||
case IGN_MODE_SEQUENTIAL:
|
||||
ign1StartFunction = beginCoil1Charge;
|
||||
ign1EndFunction = endCoil1Charge;
|
||||
ign2StartFunction = beginCoil2Charge;
|
||||
ign2EndFunction = endCoil2Charge;
|
||||
ign3StartFunction = beginCoil3Charge;
|
||||
ign3EndFunction = endCoil3Charge;
|
||||
ign4StartFunction = beginCoil4Charge;
|
||||
ign4EndFunction = endCoil4Charge;
|
||||
ign5StartFunction = beginCoil5Charge;
|
||||
ign5EndFunction = endCoil5Charge;
|
||||
ign6StartFunction = beginCoil6Charge;
|
||||
ign6EndFunction = endCoil6Charge;
|
||||
ign7StartFunction = beginCoil7Charge;
|
||||
ign7EndFunction = endCoil7Charge;
|
||||
ign8StartFunction = beginCoil8Charge;
|
||||
ign8EndFunction = endCoil8Charge;
|
||||
ignitionSchedule1.pStartCallback = beginCoil1Charge;
|
||||
ignitionSchedule1.pEndCallback = endCoil1Charge;
|
||||
ignitionSchedule2.pStartCallback = beginCoil2Charge;
|
||||
ignitionSchedule2.pEndCallback = endCoil2Charge;
|
||||
ignitionSchedule3.pStartCallback = beginCoil3Charge;
|
||||
ignitionSchedule3.pEndCallback = endCoil3Charge;
|
||||
ignitionSchedule4.pStartCallback = beginCoil4Charge;
|
||||
ignitionSchedule4.pEndCallback = endCoil4Charge;
|
||||
ignitionSchedule5.pStartCallback = beginCoil5Charge;
|
||||
ignitionSchedule5.pEndCallback = endCoil5Charge;
|
||||
#if IGN_CHANNELS >= 6
|
||||
ignitionSchedule6.pStartCallback = beginCoil6Charge;
|
||||
ignitionSchedule6.pEndCallback = endCoil6Charge;
|
||||
#endif
|
||||
#if IGN_CHANNELS >= 7
|
||||
ignitionSchedule7.pStartCallback = beginCoil7Charge;
|
||||
ignitionSchedule7.pEndCallback = endCoil7Charge;
|
||||
#endif
|
||||
#if IGN_CHANNELS >= 8
|
||||
ignitionSchedule8.pStartCallback = beginCoil8Charge;
|
||||
ignitionSchedule8.pEndCallback = endCoil8Charge;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case IGN_MODE_ROTARY:
|
||||
if(configPage10.rotaryType == ROTARY_IGN_FC)
|
||||
{
|
||||
//Ignition channel 1 is a wasted spark signal for leading signal on both rotors
|
||||
ign1StartFunction = beginCoil1Charge;
|
||||
ign1EndFunction = endCoil1Charge;
|
||||
ign2StartFunction = beginCoil1Charge;
|
||||
ign2EndFunction = endCoil1Charge;
|
||||
ignitionSchedule1.pStartCallback = beginCoil1Charge;
|
||||
ignitionSchedule1.pEndCallback = endCoil1Charge;
|
||||
ignitionSchedule2.pStartCallback = beginCoil1Charge;
|
||||
ignitionSchedule2.pEndCallback = endCoil1Charge;
|
||||
|
||||
ign3StartFunction = beginTrailingCoilCharge;
|
||||
ign3EndFunction = endTrailingCoilCharge1;
|
||||
ign4StartFunction = beginTrailingCoilCharge;
|
||||
ign4EndFunction = endTrailingCoilCharge2;
|
||||
ignitionSchedule3.pStartCallback = beginTrailingCoilCharge;
|
||||
ignitionSchedule3.pEndCallback = endTrailingCoilCharge1;
|
||||
ignitionSchedule4.pStartCallback = beginTrailingCoilCharge;
|
||||
ignitionSchedule4.pEndCallback = endTrailingCoilCharge2;
|
||||
}
|
||||
else if(configPage10.rotaryType == ROTARY_IGN_FD)
|
||||
{
|
||||
//Ignition channel 1 is a wasted spark signal for leading signal on both rotors
|
||||
ign1StartFunction = beginCoil1Charge;
|
||||
ign1EndFunction = endCoil1Charge;
|
||||
ign2StartFunction = beginCoil1Charge;
|
||||
ign2EndFunction = endCoil1Charge;
|
||||
ignitionSchedule1.pStartCallback = beginCoil1Charge;
|
||||
ignitionSchedule1.pEndCallback = endCoil1Charge;
|
||||
ignitionSchedule2.pStartCallback = beginCoil1Charge;
|
||||
ignitionSchedule2.pEndCallback = endCoil1Charge;
|
||||
|
||||
//Trailing coils have their own channel each
|
||||
//IGN2 = front rotor trailing spark
|
||||
ign3StartFunction = beginCoil2Charge;
|
||||
ign3EndFunction = endCoil2Charge;
|
||||
ignitionSchedule3.pStartCallback = beginCoil2Charge;
|
||||
ignitionSchedule3.pEndCallback = endCoil2Charge;
|
||||
//IGN3 = rear rotor trailing spark
|
||||
ign4StartFunction = beginCoil3Charge;
|
||||
ign4EndFunction = endCoil3Charge;
|
||||
ignitionSchedule4.pStartCallback = beginCoil3Charge;
|
||||
ignitionSchedule4.pEndCallback = endCoil3Charge;
|
||||
|
||||
//IGN4 not used
|
||||
}
|
||||
|
@ -1280,33 +1294,33 @@ void initialiseAll(void)
|
|||
//RX8 outputs are simply 1 coil and 1 output per plug
|
||||
|
||||
//IGN1 is front rotor, leading spark
|
||||
ign1StartFunction = beginCoil1Charge;
|
||||
ign1EndFunction = endCoil1Charge;
|
||||
ignitionSchedule1.pStartCallback = beginCoil1Charge;
|
||||
ignitionSchedule1.pEndCallback = endCoil1Charge;
|
||||
//IGN2 is rear rotor, leading spark
|
||||
ign2StartFunction = beginCoil2Charge;
|
||||
ign2EndFunction = endCoil2Charge;
|
||||
ignitionSchedule2.pStartCallback = beginCoil2Charge;
|
||||
ignitionSchedule2.pEndCallback = endCoil2Charge;
|
||||
//IGN3 = front rotor trailing spark
|
||||
ign3StartFunction = beginCoil3Charge;
|
||||
ign3EndFunction = endCoil3Charge;
|
||||
ignitionSchedule3.pStartCallback = beginCoil3Charge;
|
||||
ignitionSchedule3.pEndCallback = endCoil3Charge;
|
||||
//IGN4 = rear rotor trailing spark
|
||||
ign4StartFunction = beginCoil4Charge;
|
||||
ign4EndFunction = endCoil4Charge;
|
||||
ignitionSchedule4.pStartCallback = beginCoil4Charge;
|
||||
ignitionSchedule4.pEndCallback = endCoil4Charge;
|
||||
}
|
||||
else { } //No action for other RX ignition modes (Future expansion / MISRA compliant).
|
||||
break;
|
||||
|
||||
default:
|
||||
//Wasted spark (Shouldn't ever happen anyway)
|
||||
ign1StartFunction = beginCoil1Charge;
|
||||
ign1EndFunction = endCoil1Charge;
|
||||
ign2StartFunction = beginCoil2Charge;
|
||||
ign2EndFunction = endCoil2Charge;
|
||||
ign3StartFunction = beginCoil3Charge;
|
||||
ign3EndFunction = endCoil3Charge;
|
||||
ign4StartFunction = beginCoil4Charge;
|
||||
ign4EndFunction = endCoil4Charge;
|
||||
ign5StartFunction = beginCoil5Charge;
|
||||
ign5EndFunction = endCoil5Charge;
|
||||
ignitionSchedule1.pStartCallback = beginCoil1Charge;
|
||||
ignitionSchedule1.pEndCallback = endCoil1Charge;
|
||||
ignitionSchedule2.pStartCallback = beginCoil2Charge;
|
||||
ignitionSchedule2.pEndCallback = endCoil2Charge;
|
||||
ignitionSchedule3.pStartCallback = beginCoil3Charge;
|
||||
ignitionSchedule3.pEndCallback = endCoil3Charge;
|
||||
ignitionSchedule4.pStartCallback = beginCoil4Charge;
|
||||
ignitionSchedule4.pEndCallback = endCoil4Charge;
|
||||
ignitionSchedule5.pStartCallback = beginCoil5Charge;
|
||||
ignitionSchedule5.pEndCallback = endCoil5Charge;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3603,6 +3617,26 @@ void initialiseTriggers(void)
|
|||
}
|
||||
}
|
||||
|
||||
static inline bool isAnyFuelScheduleRunning(void) {
|
||||
return fuelSchedule1.Status==RUNNING
|
||||
|| fuelSchedule2.Status==RUNNING
|
||||
|| fuelSchedule3.Status==RUNNING
|
||||
|| fuelSchedule4.Status==RUNNING
|
||||
#if INJ_CHANNELS >= 5
|
||||
|| fuelSchedule5.Status==RUNNING
|
||||
#endif
|
||||
#if INJ_CHANNELS >= 6
|
||||
|| fuelSchedule6.Status==RUNNING
|
||||
#endif
|
||||
#if INJ_CHANNELS >= 7
|
||||
|| fuelSchedule7.Status==RUNNING
|
||||
#endif
|
||||
#if INJ_CHANNELS >= 8
|
||||
|| fuelSchedule8.Status==RUNNING
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
/** Change injectors or/and ignition angles to 720deg.
|
||||
* Roll back req_fuel size and set number of outputs equal to cylinder count.
|
||||
* */
|
||||
|
@ -3610,35 +3644,34 @@ void changeHalfToFullSync(void)
|
|||
{
|
||||
//Need to do another check for injLayout as this function can be called from ignition
|
||||
noInterrupts();
|
||||
if( (configPage2.injLayout == INJ_SEQUENTIAL) && (CRANK_ANGLE_MAX_INJ != 720) && fuelSchedule1.Status!=RUNNING && fuelSchedule2.Status!=RUNNING && fuelSchedule3.Status!=RUNNING && fuelSchedule4.Status!=RUNNING &&
|
||||
fuelSchedule5.Status!=RUNNING && fuelSchedule6.Status!=RUNNING && fuelSchedule7.Status!=RUNNING && fuelSchedule8.Status!=RUNNING)
|
||||
if( (configPage2.injLayout == INJ_SEQUENTIAL) && (CRANK_ANGLE_MAX_INJ != 720) && (!isAnyFuelScheduleRunning()))
|
||||
{
|
||||
CRANK_ANGLE_MAX_INJ = 720;
|
||||
req_fuel_uS *= 2;
|
||||
|
||||
inj1StartFunction = openInjector1;
|
||||
inj1EndFunction = closeInjector1;
|
||||
inj2StartFunction = openInjector2;
|
||||
inj2EndFunction = closeInjector2;
|
||||
inj3StartFunction = openInjector3;
|
||||
inj3EndFunction = closeInjector3;
|
||||
inj4StartFunction = openInjector4;
|
||||
inj4EndFunction = closeInjector4;
|
||||
#if (INJ_CHANNELS >= 5)
|
||||
inj5StartFunction = openInjector5;
|
||||
inj5EndFunction = closeInjector5;
|
||||
|
||||
fuelSchedule1.pStartFunction = openInjector1;
|
||||
fuelSchedule1.pEndFunction = closeInjector1;
|
||||
fuelSchedule2.pStartFunction = openInjector2;
|
||||
fuelSchedule2.pEndFunction = closeInjector2;
|
||||
fuelSchedule3.pStartFunction = openInjector3;
|
||||
fuelSchedule3.pEndFunction = closeInjector3;
|
||||
fuelSchedule4.pStartFunction = openInjector4;
|
||||
fuelSchedule4.pEndFunction = closeInjector4;
|
||||
#if INJ_CHANNELS >= 5
|
||||
fuelSchedule5.pStartFunction = openInjector5;
|
||||
fuelSchedule5.pEndFunction = closeInjector5;
|
||||
#endif
|
||||
#if (INJ_CHANNELS >= 6)
|
||||
inj6StartFunction = openInjector6;
|
||||
inj6EndFunction = closeInjector6;
|
||||
#if INJ_CHANNELS >= 6
|
||||
fuelSchedule6.pStartFunction = openInjector6;
|
||||
fuelSchedule6.pEndFunction = closeInjector6;
|
||||
#endif
|
||||
#if (INJ_CHANNELS >= 7)
|
||||
inj7StartFunction = openInjector7;
|
||||
inj7EndFunction = closeInjector7;
|
||||
#if INJ_CHANNELS >= 6
|
||||
fuelSchedule7.pStartFunction = openInjector7;
|
||||
fuelSchedule7.pEndFunction = closeInjector7;
|
||||
#endif
|
||||
#if (INJ_CHANNELS >= 8)
|
||||
inj8StartFunction = openInjector8;
|
||||
inj8EndFunction = closeInjector8;
|
||||
#if INJ_CHANNELS >= 6
|
||||
fuelSchedule8.pStartFunction = openInjector8;
|
||||
fuelSchedule8.pEndFunction = closeInjector8;
|
||||
#endif
|
||||
|
||||
switch (configPage2.nCylinders)
|
||||
|
@ -3670,30 +3703,30 @@ void changeHalfToFullSync(void)
|
|||
switch (configPage2.nCylinders)
|
||||
{
|
||||
case 4:
|
||||
ign1StartFunction = beginCoil1Charge;
|
||||
ign1EndFunction = endCoil1Charge;
|
||||
ign2StartFunction = beginCoil2Charge;
|
||||
ign2EndFunction = endCoil2Charge;
|
||||
ignitionSchedule1.pStartCallback = beginCoil1Charge;
|
||||
ignitionSchedule1.pEndCallback = endCoil1Charge;
|
||||
ignitionSchedule2.pStartCallback = beginCoil2Charge;
|
||||
ignitionSchedule2.pEndCallback = endCoil2Charge;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
ign1StartFunction = beginCoil1Charge;
|
||||
ign1EndFunction = endCoil1Charge;
|
||||
ign2StartFunction = beginCoil2Charge;
|
||||
ign2EndFunction = endCoil2Charge;
|
||||
ign3StartFunction = beginCoil3Charge;
|
||||
ign3EndFunction = endCoil3Charge;
|
||||
ignitionSchedule1.pStartCallback = beginCoil1Charge;
|
||||
ignitionSchedule1.pEndCallback = endCoil1Charge;
|
||||
ignitionSchedule2.pStartCallback = beginCoil2Charge;
|
||||
ignitionSchedule2.pEndCallback = endCoil2Charge;
|
||||
ignitionSchedule3.pStartCallback = beginCoil3Charge;
|
||||
ignitionSchedule3.pEndCallback = endCoil3Charge;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
ign1StartFunction = beginCoil1Charge;
|
||||
ign1EndFunction = endCoil1Charge;
|
||||
ign2StartFunction = beginCoil2Charge;
|
||||
ign2EndFunction = endCoil2Charge;
|
||||
ign3StartFunction = beginCoil3Charge;
|
||||
ign3EndFunction = endCoil3Charge;
|
||||
ign4StartFunction = beginCoil4Charge;
|
||||
ign4EndFunction = endCoil4Charge;
|
||||
ignitionSchedule1.pStartCallback = beginCoil1Charge;
|
||||
ignitionSchedule1.pEndCallback = endCoil1Charge;
|
||||
ignitionSchedule2.pStartCallback = beginCoil2Charge;
|
||||
ignitionSchedule2.pEndCallback = endCoil2Charge;
|
||||
ignitionSchedule3.pStartCallback = beginCoil3Charge;
|
||||
ignitionSchedule3.pEndCallback = endCoil3Charge;
|
||||
ignitionSchedule4.pStartCallback = beginCoil4Charge;
|
||||
ignitionSchedule4.pEndCallback = endCoil4Charge;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -3718,40 +3751,40 @@ void changeFullToHalfSync(void)
|
|||
case 4:
|
||||
if(configPage4.inj4cylPairing == INJ_PAIR_13_24)
|
||||
{
|
||||
inj1StartFunction = openInjector1and3;
|
||||
inj1EndFunction = closeInjector1and3;
|
||||
inj2StartFunction = openInjector2and4;
|
||||
inj2EndFunction = closeInjector2and4;
|
||||
fuelSchedule1.pStartFunction = openInjector1and3;
|
||||
fuelSchedule1.pEndFunction = closeInjector1and3;
|
||||
fuelSchedule2.pStartFunction = openInjector2and4;
|
||||
fuelSchedule2.pEndFunction = closeInjector2and4;
|
||||
}
|
||||
else
|
||||
{
|
||||
inj1StartFunction = openInjector1and4;
|
||||
inj1EndFunction = closeInjector1and4;
|
||||
inj2StartFunction = openInjector2and3;
|
||||
inj2EndFunction = closeInjector2and3;
|
||||
fuelSchedule1.pStartFunction = openInjector1and4;
|
||||
fuelSchedule1.pEndFunction = closeInjector1and4;
|
||||
fuelSchedule2.pStartFunction = openInjector2and3;
|
||||
fuelSchedule2.pEndFunction = closeInjector2and3;
|
||||
}
|
||||
maxInjOutputs = 2;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
inj1StartFunction = openInjector1and4;
|
||||
inj1EndFunction = closeInjector1and4;
|
||||
inj2StartFunction = openInjector2and5;
|
||||
inj2EndFunction = closeInjector2and5;
|
||||
inj3StartFunction = openInjector3and6;
|
||||
inj3EndFunction = closeInjector3and6;
|
||||
fuelSchedule1.pStartFunction = openInjector1and4;
|
||||
fuelSchedule1.pEndFunction = closeInjector1and4;
|
||||
fuelSchedule2.pStartFunction = openInjector2and5;
|
||||
fuelSchedule2.pEndFunction = closeInjector2and5;
|
||||
fuelSchedule3.pStartFunction = openInjector3and6;
|
||||
fuelSchedule3.pEndFunction = closeInjector3and6;
|
||||
maxInjOutputs = 3;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
inj1StartFunction = openInjector1and5;
|
||||
inj1EndFunction = closeInjector1and5;
|
||||
inj2StartFunction = openInjector2and6;
|
||||
inj2EndFunction = closeInjector2and6;
|
||||
inj3StartFunction = openInjector3and7;
|
||||
inj3EndFunction = closeInjector3and7;
|
||||
inj4StartFunction = openInjector4and8;
|
||||
inj4EndFunction = closeInjector4and8;
|
||||
fuelSchedule1.pStartFunction = openInjector1and5;
|
||||
fuelSchedule1.pEndFunction = closeInjector1and5;
|
||||
fuelSchedule2.pStartFunction = openInjector2and6;
|
||||
fuelSchedule2.pEndFunction = closeInjector2and6;
|
||||
fuelSchedule3.pStartFunction = openInjector3and7;
|
||||
fuelSchedule3.pEndFunction = closeInjector3and7;
|
||||
fuelSchedule4.pStartFunction = openInjector4and8;
|
||||
fuelSchedule4.pEndFunction = closeInjector4and8;
|
||||
maxInjOutputs = 4;
|
||||
break;
|
||||
}
|
||||
|
@ -3764,30 +3797,30 @@ void changeFullToHalfSync(void)
|
|||
switch (configPage2.nCylinders)
|
||||
{
|
||||
case 4:
|
||||
ign1StartFunction = beginCoil1and3Charge;
|
||||
ign1EndFunction = endCoil1and3Charge;
|
||||
ign2StartFunction = beginCoil2and4Charge;
|
||||
ign2EndFunction = endCoil2and4Charge;
|
||||
ignitionSchedule1.pStartCallback = beginCoil1and3Charge;
|
||||
ignitionSchedule1.pEndCallback = endCoil1and3Charge;
|
||||
ignitionSchedule2.pStartCallback = beginCoil2and4Charge;
|
||||
ignitionSchedule2.pEndCallback = endCoil2and4Charge;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
ign1StartFunction = beginCoil1and4Charge;
|
||||
ign1EndFunction = endCoil1and4Charge;
|
||||
ign2StartFunction = beginCoil2and5Charge;
|
||||
ign2EndFunction = endCoil2and5Charge;
|
||||
ign3StartFunction = beginCoil3and6Charge;
|
||||
ign3EndFunction = endCoil3and6Charge;
|
||||
ignitionSchedule1.pStartCallback = beginCoil1and4Charge;
|
||||
ignitionSchedule1.pEndCallback = endCoil1and4Charge;
|
||||
ignitionSchedule2.pStartCallback = beginCoil2and5Charge;
|
||||
ignitionSchedule2.pEndCallback = endCoil2and5Charge;
|
||||
ignitionSchedule3.pStartCallback = beginCoil3and6Charge;
|
||||
ignitionSchedule3.pEndCallback = endCoil3and6Charge;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
ign1StartFunction = beginCoil1and5Charge;
|
||||
ign1EndFunction = endCoil1and5Charge;
|
||||
ign2StartFunction = beginCoil2and6Charge;
|
||||
ign2EndFunction = endCoil2and6Charge;
|
||||
ign3StartFunction = beginCoil3and7Charge;
|
||||
ign3EndFunction = endCoil3and7Charge;
|
||||
ign4StartFunction = beginCoil4and8Charge;
|
||||
ign4EndFunction = endCoil4and8Charge;
|
||||
ignitionSchedule1.pStartCallback = beginCoil1and5Charge;
|
||||
ignitionSchedule1.pEndCallback = endCoil1and5Charge;
|
||||
ignitionSchedule2.pStartCallback = beginCoil2and6Charge;
|
||||
ignitionSchedule2.pEndCallback = endCoil2and6Charge;
|
||||
ignitionSchedule3.pStartCallback = beginCoil3and7Charge;
|
||||
ignitionSchedule3.pEndCallback = endCoil3and7Charge;
|
||||
ignitionSchedule4.pStartCallback = beginCoil4and8Charge;
|
||||
ignitionSchedule4.pEndCallback = endCoil4and8Charge;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#include "schedule_calcs.h"
|
||||
|
||||
byte channelInjEnabled = 0;
|
||||
|
||||
int ignition1StartAngle;
|
||||
int ignition1EndAngle;
|
||||
int channel1IgnDegrees; /**< The number of crank degrees until cylinder 1 is at TDC (This is obviously 0 for virtually ALL engines, but there's some weird ones) */
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
#include <stdint.h>
|
||||
#include "scheduler.h"
|
||||
|
||||
extern byte channelInjEnabled;
|
||||
|
||||
extern int ignition1StartAngle;
|
||||
extern int ignition1EndAngle;
|
||||
extern int channel1IgnDegrees; /**< The number of crank degrees until cylinder 1 is at TDC (This is obviously 0 for virtually ALL engines, but there's some weird ones) */
|
||||
|
@ -68,6 +66,6 @@ inline void __attribute__((always_inline)) calculateIgnitionAngle(const int dwel
|
|||
// Ignition for rotary.
|
||||
inline void __attribute__((always_inline)) calculateIgnitionTrailingRotary(int dwellAngle, int rotarySplitDegrees, int leadIgnitionAngle, int *pEndAngle, int *pStartAngle);
|
||||
|
||||
inline uint32_t __attribute__((always_inline)) calculateIgnitionTimeout(const Schedule &schedule, int startAngle, int channelIgnDegrees, int crankAngle);
|
||||
inline uint32_t __attribute__((always_inline)) calculateIgnitionTimeout(const IgnitionSchedule &schedule, int startAngle, int channelIgnDegrees, int crankAngle);
|
||||
|
||||
#include "schedule_calcs.hpp"
|
||||
#include "schedule_calcs.hpp"
|
||||
|
|
|
@ -71,7 +71,7 @@ inline void calculateIgnitionTrailingRotary(int dwellAngle, int rotarySplitDegre
|
|||
if(*pStartAngle < 0) {*pStartAngle += CRANK_ANGLE_MAX_IGN;}
|
||||
}
|
||||
|
||||
inline uint32_t _calculateIgnitionTimeout(const Schedule &schedule, int16_t startAngle, int16_t crankAngle) {
|
||||
inline uint32_t _calculateIgnitionTimeout(const IgnitionSchedule &schedule, int16_t startAngle, int16_t crankAngle) {
|
||||
int16_t delta = startAngle - crankAngle;
|
||||
if (delta<0)
|
||||
{
|
||||
|
@ -94,7 +94,7 @@ static inline uint16_t _adjustToIgnChannel(int angle, int channelInjDegrees) {
|
|||
return angle;
|
||||
}
|
||||
|
||||
inline uint32_t calculateIgnitionTimeout(const Schedule &schedule, int startAngle, int channelIgnDegrees, int crankAngle)
|
||||
inline uint32_t calculateIgnitionTimeout(const IgnitionSchedule &schedule, int startAngle, int channelIgnDegrees, int crankAngle)
|
||||
{
|
||||
if (channelIgnDegrees==0) {
|
||||
return _calculateIgnitionTimeout(schedule, startAngle, crankAngle);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -50,73 +50,40 @@ See page 136 of the processors datasheet: http://www.atmel.com/Images/doc2549.pd
|
|||
#define DWELL_AVERAGE(input) (((long)input * (256 - DWELL_AVERAGE_ALPHA) + ((long)currentStatus.actualDwell * DWELL_AVERAGE_ALPHA))) >> 8
|
||||
//#define DWELL_AVERAGE(input) (currentStatus.dwell) //Can be use to disable the above for testing
|
||||
|
||||
extern void (*inj1StartFunction)(void);
|
||||
extern void (*inj1EndFunction)(void);
|
||||
extern void (*inj2StartFunction)(void);
|
||||
extern void (*inj2EndFunction)(void);
|
||||
extern void (*inj3StartFunction)(void);
|
||||
extern void (*inj3EndFunction)(void);
|
||||
extern void (*inj4StartFunction)(void);
|
||||
extern void (*inj4EndFunction)(void);
|
||||
#if (INJ_CHANNELS >= 5)
|
||||
extern void (*inj5StartFunction)(void);
|
||||
extern void (*inj5EndFunction)(void);
|
||||
#endif
|
||||
#if (INJ_CHANNELS >= 6)
|
||||
extern void (*inj6StartFunction)(void);
|
||||
extern void (*inj6EndFunction)(void);
|
||||
#endif
|
||||
#if (INJ_CHANNELS >= 7)
|
||||
extern void (*inj7StartFunction)(void);
|
||||
extern void (*inj7EndFunction)(void);
|
||||
#endif
|
||||
#if (INJ_CHANNELS >= 8)
|
||||
extern void (*inj8StartFunction)(void);
|
||||
extern void (*inj8EndFunction)(void);
|
||||
#endif
|
||||
|
||||
/** @name IgnitionCallbacks
|
||||
* These are the (global) function pointers that get called to begin and end the ignition coil charging.
|
||||
* They are required for the various spark output modes.
|
||||
* @{
|
||||
*/
|
||||
extern void (*ign1StartFunction)(void);
|
||||
extern void (*ign1EndFunction)(void);
|
||||
extern void (*ign2StartFunction)(void);
|
||||
extern void (*ign2EndFunction)(void);
|
||||
extern void (*ign3StartFunction)(void);
|
||||
extern void (*ign3EndFunction)(void);
|
||||
extern void (*ign4StartFunction)(void);
|
||||
extern void (*ign4EndFunction)(void);
|
||||
extern void (*ign5StartFunction)(void);
|
||||
extern void (*ign5EndFunction)(void);
|
||||
extern void (*ign6StartFunction)(void);
|
||||
extern void (*ign6EndFunction)(void);
|
||||
extern void (*ign7StartFunction)(void);
|
||||
extern void (*ign7EndFunction)(void);
|
||||
extern void (*ign8StartFunction)(void);
|
||||
extern void (*ign8EndFunction)(void);
|
||||
/** @} */
|
||||
|
||||
void initialiseSchedulers(void);
|
||||
void beginInjectorPriming(void);
|
||||
|
||||
void setFuelSchedule1(unsigned long timeout, unsigned long duration);
|
||||
void setFuelSchedule2(unsigned long timeout, unsigned long duration);
|
||||
void setFuelSchedule3(unsigned long timeout, unsigned long duration);
|
||||
void setFuelSchedule4(unsigned long timeout, unsigned long duration);
|
||||
//void setFuelSchedule5(void (*startCallback)(), unsigned long timeout, unsigned long duration, void(*endCallback)()); //Schedule 5 remains a special case for now due to the way it's implemented
|
||||
#if INJ_CHANNELS >= 5
|
||||
void setFuelSchedule5(unsigned long timeout, unsigned long duration);
|
||||
#endif
|
||||
#if INJ_CHANNELS >= 6
|
||||
void setFuelSchedule6(unsigned long timeout, unsigned long duration);
|
||||
#endif
|
||||
#if INJ_CHANNELS >= 7
|
||||
void setFuelSchedule7(unsigned long timeout, unsigned long duration);
|
||||
#endif
|
||||
#if INJ_CHANNELS >= 8
|
||||
void setFuelSchedule8(unsigned long timeout, unsigned long duration);
|
||||
void setIgnitionSchedule1(void (*startCallback)(), unsigned long timeout, unsigned long duration, void(*endCallback)());
|
||||
void setIgnitionSchedule2(void (*startCallback)(), unsigned long timeout, unsigned long duration, void(*endCallback)());
|
||||
void setIgnitionSchedule3(void (*startCallback)(), unsigned long timeout, unsigned long duration, void(*endCallback)());
|
||||
void setIgnitionSchedule4(void (*startCallback)(), unsigned long timeout, unsigned long duration, void(*endCallback)());
|
||||
void setIgnitionSchedule5(void (*startCallback)(), unsigned long timeout, unsigned long duration, void(*endCallback)());
|
||||
void setIgnitionSchedule6(void (*startCallback)(), unsigned long timeout, unsigned long duration, void(*endCallback)());
|
||||
void setIgnitionSchedule7(void (*startCallback)(), unsigned long timeout, unsigned long duration, void(*endCallback)());
|
||||
void setIgnitionSchedule8(void (*startCallback)(), unsigned long timeout, unsigned long duration, void(*endCallback)());
|
||||
#endif
|
||||
|
||||
void setIgnitionSchedule1(unsigned long timeout, unsigned long duration);
|
||||
void setIgnitionSchedule2(unsigned long timeout, unsigned long duration);
|
||||
void setIgnitionSchedule3(unsigned long timeout, unsigned long duration);
|
||||
void setIgnitionSchedule4(unsigned long timeout, unsigned long duration);
|
||||
void setIgnitionSchedule5(unsigned long timeout, unsigned long duration);
|
||||
#if IGN_CHANNELS >= 6
|
||||
void setIgnitionSchedule6(unsigned long timeout, unsigned long duration);
|
||||
#endif
|
||||
#if IGN_CHANNELS >= 7
|
||||
void setIgnitionSchedule7(unsigned long timeout, unsigned long duration);
|
||||
#endif
|
||||
#if IGN_CHANNELS >= 8
|
||||
void setIgnitionSchedule8(unsigned long timeout, unsigned long duration);
|
||||
#endif
|
||||
|
||||
void disablePendingFuelSchedule(byte channel);
|
||||
void disablePendingIgnSchedule(byte channel);
|
||||
|
@ -176,12 +143,27 @@ enum ScheduleStatus {OFF, PENDING, STAGED, RUNNING}; //The statuses that a sched
|
|||
|
||||
/** Ignition schedule.
|
||||
*/
|
||||
struct Schedule {
|
||||
struct IgnitionSchedule {
|
||||
|
||||
// Deduce the real types of the counter and compare registers.
|
||||
// COMPARE_TYPE is NOT the same - it's just an integer type wide enough to
|
||||
// store 16-bit counter/compare calculation results.
|
||||
using counter_t = decltype(IGN1_COUNTER);
|
||||
using compare_t = decltype(IGN1_COMPARE);
|
||||
|
||||
IgnitionSchedule( counter_t &counter, compare_t &compare,
|
||||
void (&_pTimerDisable)(), void (&_pTimerEnable)())
|
||||
: counter(counter)
|
||||
, compare(compare)
|
||||
, pTimerDisable(_pTimerDisable)
|
||||
, pTimerEnable(_pTimerEnable)
|
||||
{
|
||||
}
|
||||
|
||||
volatile unsigned long duration;///< Scheduled duration (uS ?)
|
||||
volatile ScheduleStatus Status; ///< Schedule status: OFF, PENDING, STAGED, RUNNING
|
||||
volatile byte schedulesSet; ///< A counter of how many times the schedule has been set
|
||||
void (*StartCallback)(); ///< Start Callback function for schedule
|
||||
void (*EndCallback)(); ///< End Callback function for schedule
|
||||
void (*pStartCallback)(void); ///< Start Callback function for schedule
|
||||
void (*pEndCallback)(void); ///< End Callback function for schedule
|
||||
volatile unsigned long startTime; /**< The system time (in uS) that the schedule started, used by the overdwell protection in timers.ino */
|
||||
volatile COMPARE_TYPE startCompare; ///< The counter value of the timer when this will start
|
||||
volatile COMPARE_TYPE endCompare; ///< The counter value of the timer when this will end
|
||||
|
@ -190,116 +172,81 @@ struct Schedule {
|
|||
COMPARE_TYPE nextEndCompare; ///< Planned end of next schedule (when current schedule is RUNNING)
|
||||
volatile bool hasNextSchedule = false; ///< Enable flag for planned next schedule (when current schedule is RUNNING)
|
||||
volatile bool endScheduleSetByDecoder = false;
|
||||
|
||||
counter_t &counter; // Reference to the counter register. E.g. TCNT3
|
||||
compare_t &compare; // Reference to the compare register. E.g. OCR3A
|
||||
void (&pTimerDisable)(); // Reference to the timer disable function
|
||||
void (&pTimerEnable)(); // Reference to the timer enable function
|
||||
};
|
||||
|
||||
|
||||
/** Fuel injection schedule.
|
||||
* Fuel schedules don't use the callback pointers, or the startTime/endScheduleSetByDecoder variables.
|
||||
* They are removed in this struct to save RAM.
|
||||
*/
|
||||
struct FuelSchedule {
|
||||
|
||||
// Deduce the real types of the counter and compare registers.
|
||||
// COMPARE_TYPE is NOT the same - it's just an integer type wide enough to
|
||||
// store 16-bit counter/compare calculation results.
|
||||
using counter_t = decltype(FUEL1_COUNTER);
|
||||
using compare_t = decltype(FUEL1_COMPARE);
|
||||
|
||||
FuelSchedule( counter_t &counter, compare_t &compare,
|
||||
void (&_pTimerDisable)(), void (&_pTimerEnable)())
|
||||
: counter(counter)
|
||||
, compare(compare)
|
||||
, pTimerDisable(_pTimerDisable)
|
||||
, pTimerEnable(_pTimerEnable)
|
||||
{
|
||||
}
|
||||
|
||||
volatile unsigned long duration;///< Scheduled duration (uS ?)
|
||||
volatile ScheduleStatus Status; ///< Schedule status: OFF, PENDING, STAGED, RUNNING
|
||||
volatile byte schedulesSet; ///< A counter of how many times the schedule has been set
|
||||
volatile COMPARE_TYPE startCompare; ///< The counter value of the timer when this will start
|
||||
volatile COMPARE_TYPE endCompare; ///< The counter value of the timer when this will end
|
||||
|
||||
void (*pStartFunction)(void);
|
||||
void (*pEndFunction)(void);
|
||||
COMPARE_TYPE nextStartCompare;
|
||||
COMPARE_TYPE nextEndCompare;
|
||||
volatile bool hasNextSchedule = false;
|
||||
};
|
||||
|
||||
//volatile Schedule *timer3Aqueue[4];
|
||||
//Schedule *timer3Bqueue[4];
|
||||
//Schedule *timer3Cqueue[4];
|
||||
counter_t &counter; // Reference to the counter register. E.g. TCNT3
|
||||
compare_t &compare; // Reference to the compare register. E.g. OCR3A
|
||||
void (&pTimerDisable)(); // Reference to the timer disable function
|
||||
void (&pTimerEnable)(); // Reference to the timer enable function
|
||||
};
|
||||
|
||||
extern FuelSchedule fuelSchedule1;
|
||||
extern FuelSchedule fuelSchedule2;
|
||||
extern FuelSchedule fuelSchedule3;
|
||||
extern FuelSchedule fuelSchedule4;
|
||||
#if INJ_CHANNELS >= 5
|
||||
extern FuelSchedule fuelSchedule5;
|
||||
#endif
|
||||
#if INJ_CHANNELS >= 6
|
||||
extern FuelSchedule fuelSchedule6;
|
||||
#endif
|
||||
#if INJ_CHANNELS >= 7
|
||||
extern FuelSchedule fuelSchedule7;
|
||||
#endif
|
||||
#if INJ_CHANNELS >= 8
|
||||
extern FuelSchedule fuelSchedule8;
|
||||
#endif
|
||||
|
||||
extern Schedule ignitionSchedule1;
|
||||
extern Schedule ignitionSchedule2;
|
||||
extern Schedule ignitionSchedule3;
|
||||
extern Schedule ignitionSchedule4;
|
||||
extern Schedule ignitionSchedule5;
|
||||
extern Schedule ignitionSchedule6;
|
||||
extern Schedule ignitionSchedule7;
|
||||
extern Schedule ignitionSchedule8;
|
||||
|
||||
//IgnitionSchedule nullSchedule; //This is placed at the end of the queue. It's status will always be set to OFF and hence will never perform any action within an ISR
|
||||
|
||||
static inline COMPARE_TYPE setQueue(volatile Schedule *queue[], Schedule *schedule1, Schedule *schedule2, unsigned int CNT)
|
||||
{
|
||||
//Create an array of all the upcoming targets, relative to the current count on the timer
|
||||
unsigned int tmpQueue[4];
|
||||
|
||||
//Set the initial queue state. This order matches the tmpQueue order
|
||||
if(schedule1->Status == OFF)
|
||||
{
|
||||
queue[0] = schedule2;
|
||||
queue[1] = schedule2;
|
||||
tmpQueue[0] = schedule2->startCompare - CNT;
|
||||
tmpQueue[1] = schedule2->endCompare - CNT;
|
||||
}
|
||||
else
|
||||
{
|
||||
queue[0] = schedule1;
|
||||
queue[1] = schedule1;
|
||||
tmpQueue[0] = schedule1->startCompare - CNT;
|
||||
tmpQueue[1] = schedule1->endCompare - CNT;
|
||||
}
|
||||
|
||||
if(schedule2->Status == OFF)
|
||||
{
|
||||
queue[2] = schedule1;
|
||||
queue[3] = schedule1;
|
||||
tmpQueue[2] = schedule1->startCompare - CNT;
|
||||
tmpQueue[3] = schedule1->endCompare - CNT;
|
||||
}
|
||||
else
|
||||
{
|
||||
queue[2] = schedule2;
|
||||
queue[3] = schedule2;
|
||||
tmpQueue[2] = schedule2->startCompare - CNT;
|
||||
tmpQueue[3] = schedule2->endCompare - CNT;
|
||||
}
|
||||
|
||||
|
||||
//Sort the queues. Both queues are kept in sync.
|
||||
//This implements a sorting networking based on the Bose-Nelson sorting network
|
||||
//See: pages.ripco.net/~jgamble/nw.html
|
||||
#define SWAP(x,y) if(tmpQueue[y] < tmpQueue[x]) { unsigned int tmp = tmpQueue[x]; tmpQueue[x] = tmpQueue[y]; tmpQueue[y] = tmp; volatile Schedule *tmpS = queue[x]; queue[x] = queue[y]; queue[y] = tmpS; }
|
||||
/*SWAP(0, 1); */ //Likely not needed
|
||||
/*SWAP(2, 3); */ //Likely not needed
|
||||
SWAP(0, 2);
|
||||
SWAP(1, 3);
|
||||
SWAP(1, 2);
|
||||
|
||||
//Return the next compare time in the queue
|
||||
return tmpQueue[0] + CNT; //Return the
|
||||
}
|
||||
|
||||
/*
|
||||
* Moves all the Schedules in a queue forward one position.
|
||||
* The current item (0) is discarded
|
||||
* The final queue slot is set to nullSchedule to indicate that no action should be taken
|
||||
*/
|
||||
static inline unsigned int popQueue(volatile Schedule *queue[])
|
||||
{
|
||||
queue[0] = queue[1];
|
||||
queue[1] = queue[2];
|
||||
queue[2] = queue[3];
|
||||
//queue[3] = &nullSchedule;
|
||||
|
||||
unsigned int returnCompare;
|
||||
if( queue[0]->Status == PENDING ) { returnCompare = queue[0]->startCompare; }
|
||||
else { returnCompare = queue[0]->endCompare; }
|
||||
|
||||
return returnCompare;
|
||||
}
|
||||
|
||||
extern IgnitionSchedule ignitionSchedule1;
|
||||
extern IgnitionSchedule ignitionSchedule2;
|
||||
extern IgnitionSchedule ignitionSchedule3;
|
||||
extern IgnitionSchedule ignitionSchedule4;
|
||||
extern IgnitionSchedule ignitionSchedule5;
|
||||
#if IGN_CHANNELS >= 6
|
||||
extern IgnitionSchedule ignitionSchedule6;
|
||||
#endif
|
||||
#if IGN_CHANNELS >= 7
|
||||
extern IgnitionSchedule ignitionSchedule7;
|
||||
#endif
|
||||
#if IGN_CHANNELS >= 8
|
||||
extern IgnitionSchedule ignitionSchedule8;
|
||||
#endif
|
||||
|
||||
#endif // SCHEDULER_H
|
||||
|
|
|
@ -1050,13 +1050,8 @@ void loop(void)
|
|||
uint32_t timeOut = calculateIgnitionTimeout(ignitionSchedule1, ignition1StartAngle, channel1IgnDegrees, crankAngle);
|
||||
if ( (timeOut > 0U) && (BIT_CHECK(ignitionChannelsOn, IGN1_CMD_BIT)) )
|
||||
{
|
||||
|
||||
setIgnitionSchedule1(ign1StartFunction,
|
||||
//((unsigned long)(ignition1StartAngle - crankAngle) * (unsigned long)timePerDegree),
|
||||
timeOut,
|
||||
currentStatus.dwell + fixedCrankingOverride, //((unsigned long)((unsigned long)currentStatus.dwell* currentStatus.RPM) / newRPM) + fixedCrankingOverride,
|
||||
ign1EndFunction
|
||||
);
|
||||
setIgnitionSchedule1(timeOut,
|
||||
currentStatus.dwell + fixedCrankingOverride);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1087,11 +1082,8 @@ void loop(void)
|
|||
|
||||
if ( (ignition2StartTime > 0) && (BIT_CHECK(ignitionChannelsOn, IGN2_CMD_BIT)) )
|
||||
{
|
||||
setIgnitionSchedule2(ign2StartFunction,
|
||||
ignition2StartTime,
|
||||
currentStatus.dwell + fixedCrankingOverride,
|
||||
ign2EndFunction
|
||||
);
|
||||
setIgnitionSchedule2(ignition2StartTime,
|
||||
currentStatus.dwell + fixedCrankingOverride);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1103,11 +1095,8 @@ void loop(void)
|
|||
|
||||
if ( (ignition3StartTime > 0) && (BIT_CHECK(ignitionChannelsOn, IGN3_CMD_BIT)) )
|
||||
{
|
||||
setIgnitionSchedule3(ign3StartFunction,
|
||||
ignition3StartTime,
|
||||
currentStatus.dwell + fixedCrankingOverride,
|
||||
ign3EndFunction
|
||||
);
|
||||
setIgnitionSchedule3(ignition3StartTime,
|
||||
currentStatus.dwell + fixedCrankingOverride);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1119,11 +1108,8 @@ void loop(void)
|
|||
|
||||
if ( (ignition4StartTime > 0) && (BIT_CHECK(ignitionChannelsOn, IGN4_CMD_BIT)) )
|
||||
{
|
||||
setIgnitionSchedule4(ign4StartFunction,
|
||||
ignition4StartTime,
|
||||
currentStatus.dwell + fixedCrankingOverride,
|
||||
ign4EndFunction
|
||||
);
|
||||
setIgnitionSchedule4(ignition4StartTime,
|
||||
currentStatus.dwell + fixedCrankingOverride);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1135,11 +1121,8 @@ void loop(void)
|
|||
|
||||
if ( (ignition5StartTime > 0) && (BIT_CHECK(ignitionChannelsOn, IGN5_CMD_BIT)) )
|
||||
{
|
||||
setIgnitionSchedule5(ign5StartFunction,
|
||||
ignition5StartTime,
|
||||
currentStatus.dwell + fixedCrankingOverride,
|
||||
ign5EndFunction
|
||||
);
|
||||
setIgnitionSchedule5(ignition5StartTime,
|
||||
currentStatus.dwell + fixedCrankingOverride);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1151,11 +1134,8 @@ void loop(void)
|
|||
|
||||
if ( (ignition6StartTime > 0) && (BIT_CHECK(ignitionChannelsOn, IGN6_CMD_BIT)) )
|
||||
{
|
||||
setIgnitionSchedule6(ign6StartFunction,
|
||||
ignition6StartTime,
|
||||
currentStatus.dwell + fixedCrankingOverride,
|
||||
ign6EndFunction
|
||||
);
|
||||
setIgnitionSchedule6(ignition6StartTime,
|
||||
currentStatus.dwell + fixedCrankingOverride);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1167,11 +1147,8 @@ void loop(void)
|
|||
|
||||
if ( (ignition7StartTime > 0) && (BIT_CHECK(ignitionChannelsOn, IGN7_CMD_BIT)) )
|
||||
{
|
||||
setIgnitionSchedule7(ign7StartFunction,
|
||||
ignition7StartTime,
|
||||
currentStatus.dwell + fixedCrankingOverride,
|
||||
ign7EndFunction
|
||||
);
|
||||
setIgnitionSchedule7(ignition7StartTime,
|
||||
currentStatus.dwell + fixedCrankingOverride);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1183,11 +1160,8 @@ void loop(void)
|
|||
|
||||
if ( (ignition8StartTime > 0) && (BIT_CHECK(ignitionChannelsOn, IGN8_CMD_BIT)) )
|
||||
{
|
||||
setIgnitionSchedule8(ign8StartFunction,
|
||||
ignition8StartTime,
|
||||
currentStatus.dwell + fixedCrankingOverride,
|
||||
ign8EndFunction
|
||||
);
|
||||
setIgnitionSchedule8(ignition8StartTime,
|
||||
currentStatus.dwell + fixedCrankingOverride);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -56,6 +56,12 @@ void initialiseTimers(void)
|
|||
tachoOutputFlag = TACHO_INACTIVE;
|
||||
}
|
||||
|
||||
static inline void applyOverDwellCheck(IgnitionSchedule &schedule, uint32_t targetOverdwellTime) {
|
||||
//Check first whether each spark output is currently on. Only check it's dwell time if it is
|
||||
if ((schedule.Status == RUNNING) && (schedule.startTime < targetOverdwellTime)) {
|
||||
schedule.pEndCallback(); schedule.Status = OFF;
|
||||
}
|
||||
}
|
||||
|
||||
//Timer2 Overflow Interrupt Vector, called when the timer overflows.
|
||||
//Executes every ~1ms.
|
||||
|
@ -76,21 +82,25 @@ void oneMSInterval(void) //Most ARM chips can simply call a function
|
|||
loop250ms++;
|
||||
loopSec++;
|
||||
|
||||
unsigned long targetOverdwellTime;
|
||||
|
||||
//Overdwell check
|
||||
targetOverdwellTime = micros() - dwellLimit_uS; //Set a target time in the past that all coil charging must have begun after. If the coil charge began before this time, it's been running too long
|
||||
uint32_t targetOverdwellTime = micros() - dwellLimit_uS; //Set a target time in the past that all coil charging must have begun after. If the coil charge began before this time, it's been running too long
|
||||
bool isCrankLocked = configPage4.ignCranklock && (currentStatus.RPM < currentStatus.crankRPM); //Dwell limiter is disabled during cranking on setups using the locked cranking timing. WE HAVE to do the RPM check here as relying on the engine cranking bit can be potentially too slow in updating
|
||||
//Check first whether each spark output is currently on. Only check it's dwell time if it is
|
||||
|
||||
if(ignitionSchedule1.Status == RUNNING) { if( (ignitionSchedule1.startTime < targetOverdwellTime) && (configPage4.useDwellLim) && (isCrankLocked != true) ) { ign1EndFunction(); ignitionSchedule1.Status = OFF; } }
|
||||
if(ignitionSchedule2.Status == RUNNING) { if( (ignitionSchedule2.startTime < targetOverdwellTime) && (configPage4.useDwellLim) && (isCrankLocked != true) ) { ign2EndFunction(); ignitionSchedule2.Status = OFF; } }
|
||||
if(ignitionSchedule3.Status == RUNNING) { if( (ignitionSchedule3.startTime < targetOverdwellTime) && (configPage4.useDwellLim) && (isCrankLocked != true) ) { ign3EndFunction(); ignitionSchedule3.Status = OFF; } }
|
||||
if(ignitionSchedule4.Status == RUNNING) { if( (ignitionSchedule4.startTime < targetOverdwellTime) && (configPage4.useDwellLim) && (isCrankLocked != true) ) { ign4EndFunction(); ignitionSchedule4.Status = OFF; } }
|
||||
if(ignitionSchedule5.Status == RUNNING) { if( (ignitionSchedule5.startTime < targetOverdwellTime) && (configPage4.useDwellLim) && (isCrankLocked != true) ) { ign5EndFunction(); ignitionSchedule5.Status = OFF; } }
|
||||
if(ignitionSchedule6.Status == RUNNING) { if( (ignitionSchedule6.startTime < targetOverdwellTime) && (configPage4.useDwellLim) && (isCrankLocked != true) ) { ign6EndFunction(); ignitionSchedule6.Status = OFF; } }
|
||||
if(ignitionSchedule7.Status == RUNNING) { if( (ignitionSchedule7.startTime < targetOverdwellTime) && (configPage4.useDwellLim) && (isCrankLocked != true) ) { ign7EndFunction(); ignitionSchedule7.Status = OFF; } }
|
||||
if(ignitionSchedule8.Status == RUNNING) { if( (ignitionSchedule8.startTime < targetOverdwellTime) && (configPage4.useDwellLim) && (isCrankLocked != true) ) { ign8EndFunction(); ignitionSchedule8.Status = OFF; } }
|
||||
if ((configPage4.useDwellLim == 1) && (isCrankLocked != true)) {
|
||||
applyOverDwellCheck(ignitionSchedule1, targetOverdwellTime);
|
||||
applyOverDwellCheck(ignitionSchedule2, targetOverdwellTime);
|
||||
applyOverDwellCheck(ignitionSchedule3, targetOverdwellTime);
|
||||
applyOverDwellCheck(ignitionSchedule4, targetOverdwellTime);
|
||||
applyOverDwellCheck(ignitionSchedule5, targetOverdwellTime);
|
||||
#if IGN_CHANNELS >= 6
|
||||
applyOverDwellCheck(ignitionSchedule6, targetOverdwellTime);
|
||||
#endif
|
||||
#if IGN_CHANNELS >= 7
|
||||
applyOverDwellCheck(ignitionSchedule7, targetOverdwellTime);
|
||||
#endif
|
||||
#if IGN_CHANNELS >= 8
|
||||
applyOverDwellCheck(ignitionSchedule8, targetOverdwellTime);
|
||||
#endif
|
||||
}
|
||||
|
||||
//Tacho is flagged as being ready for a pulse by the ignition outputs, or the sweep interval upon startup
|
||||
|
||||
|
@ -179,7 +189,6 @@ void oneMSInterval(void) //Most ARM chips can simply call a function
|
|||
#if defined(CORE_STM32) //debug purpose, only visual for running code
|
||||
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
//1Hz loop
|
||||
|
|
|
@ -30,6 +30,7 @@ enum TachoOutputStatus {TACHO_INACTIVE, READY, ACTIVE}; //The 3 statuses that th
|
|||
extern volatile TachoOutputStatus tachoOutputFlag;
|
||||
extern volatile bool tachoSweepEnabled;
|
||||
extern volatile uint16_t tachoSweepIncr;
|
||||
|
||||
#define TACHO_SWEEP_TIME_MS 1500
|
||||
#define TACHO_SWEEP_RAMP_MS (TACHO_SWEEP_TIME_MS * 2 / 3)
|
||||
#define MS_PER_SEC 1000
|
||||
|
|
|
@ -34,25 +34,25 @@ static void __attribute__((noinline)) assert_fuel_schedules(uint16_t crankAngle,
|
|||
strcpy_P(msg, PSTR("req_fuel_uS"));
|
||||
TEST_ASSERT_EQUAL_UINT16_MESSAGE(reqFuel, req_fuel_uS, msg);
|
||||
|
||||
assert_fuel_channel(enabled[0], angle[0], INJ1_CMD_BIT, channel1InjDegrees, inj1StartFunction, inj1EndFunction);
|
||||
assert_fuel_channel(enabled[1], angle[1], INJ2_CMD_BIT, channel2InjDegrees, inj2StartFunction, inj2EndFunction);
|
||||
assert_fuel_channel(enabled[2], angle[2], INJ3_CMD_BIT, channel3InjDegrees, inj3StartFunction, inj3EndFunction);
|
||||
assert_fuel_channel(enabled[3], angle[3], INJ4_CMD_BIT, channel4InjDegrees, inj4StartFunction, inj4EndFunction);
|
||||
assert_fuel_channel(enabled[0], angle[0], INJ1_CMD_BIT, channel1InjDegrees, fuelSchedule1.pStartFunction, fuelSchedule1.pEndFunction);
|
||||
assert_fuel_channel(enabled[1], angle[1], INJ2_CMD_BIT, channel2InjDegrees, fuelSchedule2.pStartFunction, fuelSchedule2.pEndFunction);
|
||||
assert_fuel_channel(enabled[2], angle[2], INJ3_CMD_BIT, channel3InjDegrees, fuelSchedule3.pStartFunction, fuelSchedule3.pEndFunction);
|
||||
assert_fuel_channel(enabled[3], angle[3], INJ4_CMD_BIT, channel4InjDegrees, fuelSchedule4.pStartFunction, fuelSchedule4.pEndFunction);
|
||||
|
||||
#if INJ_CHANNELS>=5
|
||||
assert_fuel_channel(enabled[4], angle[4], INJ5_CMD_BIT, channel5InjDegrees, inj5StartFunction, inj5EndFunction);
|
||||
assert_fuel_channel(enabled[4], angle[4], INJ5_CMD_BIT, channel5InjDegrees, fuelSchedule5.pStartFunction, fuelSchedule5.pEndFunction);
|
||||
#endif
|
||||
|
||||
#if INJ_CHANNELS>=6
|
||||
assert_fuel_channel(enabled[5], angle[5], INJ6_CMD_BIT, channel6InjDegrees, inj6StartFunction, inj6EndFunction);
|
||||
assert_fuel_channel(enabled[5], angle[5], INJ6_CMD_BIT, channel6InjDegrees, fuelSchedule6.pStartFunction, fuelSchedule6.pEndFunction);
|
||||
#endif
|
||||
|
||||
#if INJ_CHANNELS>=7
|
||||
assert_fuel_channel(enabled[6], angle[6], INJ7_CMD_BIT, channel7InjDegrees, inj7StartFunction, inj7EndFunction);
|
||||
assert_fuel_channel(enabled[6], angle[6], INJ7_CMD_BIT, channel7InjDegrees, fuelSchedule7.pStartFunction, fuelSchedule7.pEndFunction);
|
||||
#endif
|
||||
|
||||
#if INJ_CHANNELS>=8
|
||||
assert_fuel_channel(enabled[7], angle[7], INJ8_CMD_BIT, channel8InjDegrees, inj8StartFunction, inj8EndFunction);
|
||||
assert_fuel_channel(enabled[7], angle[7], INJ8_CMD_BIT, channel8InjDegrees, fuelSchedule8.pStartFunction, fuelSchedule8.pEndFunction);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -335,15 +335,12 @@ static void cylinder3_stroke4_semiseq_staged(void)
|
|||
configPage10.stagingEnabled = true;
|
||||
initialiseAll(); //Run the main initialise function
|
||||
#if INJ_CHANNELS>=6
|
||||
const bool enabled[] = {true, true, true, true, true, true, false, false};
|
||||
const uint16_t angle[] = {0,80,160,0,80,160,0,0};
|
||||
assert_fuel_schedules(240U, reqFuel * 50U, enabled, angle);
|
||||
#else
|
||||
const bool enabled[] = {true, true, true, true, false, false, false, false};
|
||||
const uint16_t angle[] = {0,80,160,0,0,0,0,0};
|
||||
//assert_fuel_schedules(240U, reqFuel * 50U, enabled, angle);
|
||||
assert_fuel_schedules(720U, reqFuel * 50U, enabled, angle); //Special case as 3 squirts per cycle MUST be over 720 degrees
|
||||
#endif
|
||||
const bool enabled[] = {true, true, true, true, false, false, false, false};
|
||||
assert_fuel_schedules(720U, reqFuel * 50U, enabled, angle); //Special case as 3 squirts per cycle MUST be over 720 degrees
|
||||
}
|
||||
|
||||
static void run_3_cylinder_4stroke_tests(void)
|
||||
|
@ -402,14 +399,12 @@ static void cylinder3_stroke2_semiseq_staged(void)
|
|||
configPage10.stagingEnabled = true;
|
||||
initialiseAll(); //Run the main initialise function
|
||||
#if INJ_CHANNELS>=6
|
||||
const bool enabled[] = {true, true, true, true, true, true, false, false};
|
||||
const uint16_t angle[] = {0,80,160,0,80,160,0,0};
|
||||
assert_fuel_schedules(120U, reqFuel * 100U, enabled, angle);
|
||||
#else
|
||||
const bool enabled[] = {true, true, true, true, false, false, false, false};
|
||||
const uint16_t angle[] = {0,80,160,0,0,0,0,0};
|
||||
assert_fuel_schedules(120U, reqFuel * 100U, enabled, angle);
|
||||
#endif
|
||||
const bool enabled[] = {true, true, true, true, false, false, false, false};
|
||||
assert_fuel_schedules(120U, reqFuel * 100U, enabled, angle);
|
||||
}
|
||||
|
||||
static void run_3_cylinder_2stroke_tests(void)
|
||||
|
@ -427,15 +422,20 @@ static void run_3_cylinder_2stroke_tests(void)
|
|||
RUN_TEST_P(cylinder3_stroke2_semiseq_staged);
|
||||
}
|
||||
|
||||
static void assert_4cylinder_4stroke_seq_nostage(void)
|
||||
{
|
||||
const bool enabled[] = {true, true, true, true, false, false, false, false};
|
||||
const uint16_t angle[] = {0,180,360,540,0,0,0,0};
|
||||
assert_fuel_schedules(720U, reqFuel * 100U, enabled, angle);
|
||||
}
|
||||
|
||||
static void cylinder4_stroke4_seq_nostage(void)
|
||||
{
|
||||
configPage2.injLayout = INJ_SEQUENTIAL;
|
||||
configPage10.stagingEnabled = false;
|
||||
initialiseAll(); //Run the main initialise function
|
||||
const bool enabled[] = {true, true, true, true, false, false, false, false};
|
||||
const uint16_t angle[] = {0,180,360,540,0,0,0,0};
|
||||
assert_fuel_schedules(720U, reqFuel * 100U, enabled, angle);
|
||||
}
|
||||
assert_4cylinder_4stroke_seq_nostage();
|
||||
}
|
||||
|
||||
static void cylinder4_stroke4_semiseq_nostage(void)
|
||||
{
|
||||
|
@ -447,6 +447,7 @@ static void cylinder4_stroke4_semiseq_nostage(void)
|
|||
assert_fuel_schedules(360U, reqFuel * 50U, enabled, angle);
|
||||
}
|
||||
|
||||
|
||||
static void cylinder4_stroke4_seq_staged(void)
|
||||
{
|
||||
configPage2.injLayout = INJ_SEQUENTIAL;
|
||||
|
@ -454,18 +455,16 @@ static void cylinder4_stroke4_seq_staged(void)
|
|||
initialiseAll(); //Run the main initialise function
|
||||
#if INJ_CHANNELS>=8
|
||||
const bool enabled[] = {true, true, true, true, true, true, true, true};
|
||||
const uint16_t angle[] = {0,180,360,540,0,180,36};
|
||||
const uint16_t angle[] = {0,180,360,540,0,180,360,540};
|
||||
assert_fuel_schedules(720U, reqFuel * 100U, enabled, angle);
|
||||
#elif INJ_CHANNELS >= 5
|
||||
const bool enabled[] = {true, true, true, true, true, false, false, false};
|
||||
const uint16_t angle[] = {0,180,360,540,0,0,0,0};
|
||||
assert_fuel_schedules(720U, reqFuel * 100U, enabled, angle);
|
||||
#else
|
||||
const bool enabled[] = {true, true, true, true, false, false, false, false};
|
||||
const uint16_t angle[] = {0,180,360,540,0,0,0,0};
|
||||
assert_fuel_schedules(720U, reqFuel * 100U, enabled, angle);
|
||||
assert_4cylinder_4stroke_seq_nostage();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static void cylinder4_stroke4_semiseq_staged(void)
|
||||
{
|
||||
|
@ -638,7 +637,7 @@ static void cylinder6_stroke4_seq_nostage(void)
|
|||
initialiseAll(); //Run the main initialise function
|
||||
#if INJ_CHANNELS >= 6
|
||||
const bool enabled[] = {true, true, true, true, true, true, false, false};
|
||||
const uint16_t angle[] = {0,120,240,360,480,600,0};
|
||||
const uint16_t angle[] = {0,120,240,360,480,600,0,0};
|
||||
assert_fuel_schedules(720U, reqFuel * 100U, enabled, angle);
|
||||
#else
|
||||
const bool enabled[] = {true, true, true, false, false, false, false, false};
|
||||
|
@ -680,14 +679,12 @@ static void cylinder6_stroke4_semiseq_staged(void)
|
|||
configPage10.stagingEnabled = true;
|
||||
initialiseAll(); //Run the main initialise function
|
||||
#if INJ_CHANNELS >= 8
|
||||
const bool enabled[] = {true, true, true, true, true, true, true, true};
|
||||
const uint16_t angle[] = {0,120,240,0,0,120,240,0};
|
||||
assert_fuel_schedules(720U, reqFuel * 50U, enabled, angle);
|
||||
#else
|
||||
const bool enabled[] = {true, true, true, false, false, false, false, false};
|
||||
const uint16_t angle[] = {0,120,240,0,0,0,0,0};
|
||||
assert_fuel_schedules(720U, reqFuel * 50U, enabled, angle);
|
||||
#endif
|
||||
const bool enabled[] = {true, true, true, false, false, false, false, false};
|
||||
assert_fuel_schedules(720U, reqFuel * 50U, enabled, angle);
|
||||
}
|
||||
|
||||
void run_6_cylinder_4stroke_tests(void)
|
||||
|
@ -712,7 +709,7 @@ static void cylinder8_stroke4_seq_nostage(void)
|
|||
initialiseAll(); //Run the main initialise function
|
||||
#if INJ_CHANNELS >= 8
|
||||
const bool enabled[] = {true, true, true, true, true, true, true, true};
|
||||
const uint16_t angle[] = {0,90,180,270,360,450,5};
|
||||
const uint16_t angle[] = {0,90,180,270,360,450,540,630};
|
||||
assert_fuel_schedules(720U, reqFuel * 100U, enabled, angle);
|
||||
#else
|
||||
const bool enabled[] = {true, true, true, true, false, false, false, false};
|
||||
|
@ -788,11 +785,7 @@ static void cylinder_5_NoinjTiming_paired(void) {
|
|||
|
||||
initialiseAll(); //Run the main initialise function
|
||||
|
||||
#if INJ_CHANNELS>=5
|
||||
const bool enabled[] = {true, true, true, true, true, false, false, false};
|
||||
#else
|
||||
const bool enabled[] = {true, true, true, true, false, false, false, false};
|
||||
#endif
|
||||
assert_fuel_schedules(720U, reqFuel * 50U, enabled, zeroAngles);
|
||||
}
|
||||
|
||||
|
@ -814,11 +807,7 @@ static void cylinder_8_NoinjTiming_paired(void) {
|
|||
|
||||
initialiseAll(); //Run the main initialise function
|
||||
|
||||
#if INJ_CHANNELS>=8
|
||||
const bool enabled[] = {true, true, true, true, true, true, true, true};
|
||||
#else
|
||||
const bool enabled[] = {true, true, true, true, false, false, false, false};
|
||||
#endif
|
||||
assert_fuel_schedules(720U, reqFuel * 50U, enabled, zeroAngles);
|
||||
}
|
||||
|
||||
|
@ -849,7 +838,6 @@ static void cylinder_2_oddfire(void)
|
|||
|
||||
const bool enabled[] = {true, true, false, false, false, false, false, false};
|
||||
const uint16_t angle[] = {0,13,0,0,0,0,0,0};
|
||||
Serial.println(configPage2.engineType);
|
||||
assert_fuel_schedules(720U, reqFuel * 50U, enabled, angle);
|
||||
}
|
||||
|
||||
|
@ -888,6 +876,32 @@ static void run_oddfire_tests()
|
|||
RUN_TEST_P(cylinder8_stroke4_seq_nostage);
|
||||
}
|
||||
|
||||
static void test_partial_sync(void)
|
||||
{
|
||||
configPage2.nCylinders = 4;
|
||||
configPage2.strokes = FOUR_STROKE;
|
||||
configPage2.engineType = EVEN_FIRE;
|
||||
configPage2.injTiming = true;
|
||||
configPage2.reqFuel = reqFuel;
|
||||
configPage2.injLayout = INJ_SEQUENTIAL;
|
||||
configPage10.stagingEnabled = false;
|
||||
initialiseAll(); //Run the main initialise function
|
||||
|
||||
// Confirm initial state
|
||||
assert_4cylinder_4stroke_seq_nostage();
|
||||
|
||||
changeFullToHalfSync();
|
||||
{
|
||||
const bool enabled[] = {true, true, false, false, false, false, false, false};
|
||||
const uint16_t angle[] = {0,180,360,540,0,0,0,0};
|
||||
assert_fuel_schedules(360U, reqFuel * 50U, enabled, angle);
|
||||
}
|
||||
|
||||
changeHalfToFullSync();
|
||||
assert_4cylinder_4stroke_seq_nostage();
|
||||
}
|
||||
|
||||
|
||||
void testFuelScheduleInit()
|
||||
{
|
||||
run_1_cylinder_4stroke_tests();
|
||||
|
@ -905,4 +919,6 @@ void testFuelScheduleInit()
|
|||
run_no_inj_timing_tests();
|
||||
|
||||
run_oddfire_tests();
|
||||
|
||||
RUN_TEST_P(test_partial_sync);
|
||||
}
|
|
@ -27,21 +27,21 @@ static void assert_ignition_schedules(uint16_t crankAngle, uint16_t expectedOutp
|
|||
strcpy_P(msg, PSTR("maxIgnOutputs"));
|
||||
TEST_ASSERT_EQUAL_UINT16_MESSAGE(expectedOutputs, maxIgnOutputs, msg);
|
||||
|
||||
assert_ignition_channel(angle[0], 0, channel1IgnDegrees, ign1StartFunction, ign1EndFunction);
|
||||
assert_ignition_channel(angle[1], 1, channel2IgnDegrees, ign2StartFunction, ign2EndFunction);
|
||||
assert_ignition_channel(angle[2], 2, channel3IgnDegrees, ign3StartFunction, ign3EndFunction);
|
||||
assert_ignition_channel(angle[3], 3, channel4IgnDegrees, ign4StartFunction, ign4EndFunction);
|
||||
assert_ignition_channel(angle[0], 0, channel1IgnDegrees, ignitionSchedule1.pStartCallback, ignitionSchedule1.pEndCallback);
|
||||
assert_ignition_channel(angle[1], 1, channel2IgnDegrees, ignitionSchedule2.pStartCallback, ignitionSchedule2.pEndCallback);
|
||||
assert_ignition_channel(angle[2], 2, channel3IgnDegrees, ignitionSchedule3.pStartCallback, ignitionSchedule3.pEndCallback);
|
||||
assert_ignition_channel(angle[3], 3, channel4IgnDegrees, ignitionSchedule4.pStartCallback, ignitionSchedule4.pEndCallback);
|
||||
#if IGN_CHANNELS>=5
|
||||
assert_ignition_channel(angle[4], 4, channel5IgnDegrees, ign5StartFunction, ign5EndFunction);
|
||||
assert_ignition_channel(angle[4], 4, channel5IgnDegrees, ignitionSchedule5.pStartCallback, ignitionSchedule5.pEndCallback);
|
||||
#endif
|
||||
#if IGN_CHANNELS>=6
|
||||
assert_ignition_channel(angle[5], 5, channel6IgnDegrees, ign6StartFunction, ign6EndFunction);
|
||||
assert_ignition_channel(angle[5], 5, channel6IgnDegrees, ignitionSchedule6.pStartCallback, ignitionSchedule6.pEndCallback);
|
||||
#endif
|
||||
#if IGN_CHANNELS>=7
|
||||
assert_ignition_channel(angle[6], 6, channel7IgnDegrees, ign7StartFunction, ign7EndFunction);
|
||||
assert_ignition_channel(angle[6], 6, channel7IgnDegrees, ignitionSchedule7.pStartCallback, ignitionSchedule7.pEndCallback);
|
||||
#endif
|
||||
#if IGN_CHANNELS>=8
|
||||
assert_ignition_channel(angle[7], 7, channel8IgnDegrees, ign8StartFunction, ign8EndFunction);
|
||||
assert_ignition_channel(angle[7], 7, channel8IgnDegrees, ignitionSchedule8.pStartCallback, ignitionSchedule8.pEndCallback);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -163,13 +163,18 @@ static void run_3_cylinder_4stroke_tests(void)
|
|||
RUN_TEST_P(cylinder3_stroke4_wasted_odd);
|
||||
}
|
||||
|
||||
static void assert_cylinder4_stroke4_seq_even(void)
|
||||
{
|
||||
const uint16_t angle[] = {0,180,360,540,0,0,0,0};
|
||||
assert_ignition_schedules(720U, 4U, angle);
|
||||
}
|
||||
|
||||
static void cylinder4_stroke4_seq_even(void)
|
||||
{
|
||||
configPage4.sparkMode = IGN_MODE_SEQUENTIAL;
|
||||
configPage2.engineType = EVEN_FIRE;
|
||||
initialiseAll(); //Run the main initialise function
|
||||
const uint16_t angle[] = {0,180,360,540,0,0,0,0};
|
||||
assert_ignition_schedules(720U, 4U, angle);
|
||||
assert_cylinder4_stroke4_seq_even();
|
||||
}
|
||||
|
||||
static void cylinder4_stroke4_wasted_even(void)
|
||||
|
@ -237,7 +242,7 @@ static void cylinder6_stroke4_seq_even(void)
|
|||
configPage2.engineType = EVEN_FIRE;
|
||||
initialiseAll(); //Run the main initialise function
|
||||
#if IGN_CHANNELS >= 6
|
||||
const uint16_t angle[] = {0,120,240,360,480,540,0,0};
|
||||
const uint16_t angle[] = {0,120,240,360,480,600,0,0};
|
||||
assert_ignition_schedules(720U, 6U, angle);
|
||||
#else
|
||||
const uint16_t angle[] = {0,120,240,0,0,0,0,0};
|
||||
|
@ -296,6 +301,28 @@ static void run_8_cylinder_4stroke_tests(void)
|
|||
RUN_TEST_P(cylinder8_stroke4_wasted_even);
|
||||
}
|
||||
|
||||
static void test_partial_sync(void)
|
||||
{
|
||||
configPage2.nCylinders = 4;
|
||||
configPage2.strokes = FOUR_STROKE;
|
||||
configPage4.sparkMode = IGN_MODE_SEQUENTIAL;
|
||||
configPage2.engineType = EVEN_FIRE;
|
||||
|
||||
initialiseAll(); //Run the main initialise function
|
||||
|
||||
// Initial state
|
||||
assert_cylinder4_stroke4_seq_even();
|
||||
|
||||
changeFullToHalfSync();
|
||||
{
|
||||
const uint16_t angle[] = {0,180,360,540,0,0,0,0};
|
||||
assert_ignition_schedules(360U, 2U, angle);
|
||||
}
|
||||
|
||||
changeHalfToFullSync();
|
||||
assert_cylinder4_stroke4_seq_even();
|
||||
}
|
||||
|
||||
void testIgnitionScheduleInit()
|
||||
{
|
||||
run_1_cylinder_4stroke_tests();
|
||||
|
@ -305,4 +332,6 @@ void testIgnitionScheduleInit()
|
|||
run_5_cylinder_4stroke_tests();
|
||||
run_6_cylinder_4stroke_tests();
|
||||
run_8_cylinder_4stroke_tests();
|
||||
|
||||
RUN_TEST_P(test_partial_sync);
|
||||
}
|
|
@ -33,12 +33,12 @@ struct ign_test_parameters
|
|||
int16_t expectedEndAngle; // Expected end angle
|
||||
};
|
||||
|
||||
static void nullIgnCallback(void) { }
|
||||
|
||||
void test_calc_ign_timeout(const ign_test_parameters &test_params)
|
||||
{
|
||||
char msg[150];
|
||||
Schedule schedule;
|
||||
memset(&schedule, 0, sizeof(schedule));
|
||||
IgnitionSchedule schedule(IGN4_COUNTER, IGN4_COMPARE, nullIgnCallback, nullIgnCallback);
|
||||
|
||||
int startAngle;
|
||||
int endAngle;
|
||||
|
@ -47,11 +47,11 @@ void test_calc_ign_timeout(const ign_test_parameters &test_params)
|
|||
TEST_ASSERT_EQUAL_MESSAGE(test_params.expectedStartAngle, startAngle, "startAngle");
|
||||
TEST_ASSERT_EQUAL_MESSAGE(test_params.expectedEndAngle, endAngle, "endAngle");
|
||||
|
||||
sprintf_P(msg, PSTR("PENDING advanceAngle: %" PRIi8 ", channelAngle: % " PRIu16 ", crankAngle: %" PRIu16 ", endAngle: %" PRIi16), test_params.advanceAngle, test_params.channelAngle, test_params.crankAngle, endAngle);
|
||||
sprintf_P(msg, PSTR("PENDING advanceAngle: %" PRIi8 ", channelAngle: %" PRIu16 ", crankAngle: %" PRIu16 ", endAngle: %" PRIi16), test_params.advanceAngle, test_params.channelAngle, test_params.crankAngle, endAngle);
|
||||
schedule.Status = PENDING;
|
||||
TEST_ASSERT_EQUAL_MESSAGE(test_params.pending, calculateIgnitionTimeout(schedule, startAngle, test_params.channelAngle, test_params.crankAngle), msg);
|
||||
|
||||
sprintf_P(msg, PSTR("RUNNING advanceAngle: %" PRIi8 ", channelAngle: % " PRIu16 ", crankAngle: %" PRIu16 ", endAngle: %" PRIi16), test_params.advanceAngle, test_params.channelAngle, test_params.crankAngle, endAngle);
|
||||
sprintf_P(msg, PSTR("RUNNING advanceAngle: %" PRIi8 ", channelAngle: %" PRIu16 ", crankAngle: %" PRIu16 ", endAngle: %" PRIi16), test_params.advanceAngle, test_params.channelAngle, test_params.crankAngle, endAngle);
|
||||
schedule.Status = RUNNING;
|
||||
TEST_ASSERT_EQUAL_MESSAGE(test_params.running, calculateIgnitionTimeout(schedule, startAngle, test_params.channelAngle, test_params.crankAngle), msg);
|
||||
}
|
||||
|
@ -554,7 +554,7 @@ void test_rotary_channel_calcs(void)
|
|||
{
|
||||
setEngineSpeed(4000, 360);
|
||||
|
||||
static const int16_t test_data[][5] PROGMEM = {
|
||||
static const int test_data[][5] PROGMEM = {
|
||||
// End Angle (deg), Dwell Angle, rotary split degrees, expected start angle, expected end angle
|
||||
{ -40, 5, 0, -40, 315 },
|
||||
{ -40, 95, 0, -40, 225 },
|
||||
|
@ -588,18 +588,18 @@ void test_rotary_channel_calcs(void)
|
|||
{ 40, 355, 40, 80, 85 },
|
||||
};
|
||||
|
||||
const int16_t (*pStart)[5] = &test_data[0];
|
||||
const int16_t (*pEnd)[5] = &test_data[0]+_countof(test_data);
|
||||
const int (*pStart)[5] = &test_data[0];
|
||||
const int (*pEnd)[5] = &test_data[0]+_countof(test_data);
|
||||
|
||||
int16_t endAngle, startAngle;
|
||||
int16_t local[5];
|
||||
int endAngle, startAngle;
|
||||
int local[5];
|
||||
while (pStart!=pEnd)
|
||||
{
|
||||
memcpy_P(local, pStart, sizeof(local));
|
||||
ignition2EndAngle = local[0];
|
||||
calculateIgnitionTrailingRotary(local[1], local[2], local[0], &endAngle, &startAngle);
|
||||
TEST_ASSERT_EQUAL(local[3], endAngle);
|
||||
TEST_ASSERT_EQUAL(local[4], startAngle);
|
||||
TEST_ASSERT_EQUAL_MESSAGE(local[3], endAngle, "endAngle");
|
||||
TEST_ASSERT_EQUAL_MESSAGE(local[4], startAngle, "startAngle");
|
||||
++pStart;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,23 +22,25 @@ struct inj_test_parameters
|
|||
uint32_t running; // Expected delay when channel status is RUNNING
|
||||
};
|
||||
|
||||
static void nullInjCallback(void) { }
|
||||
|
||||
static void test_calc_inj_timeout(const inj_test_parameters ¶meters)
|
||||
{
|
||||
static constexpr uint16_t injAngle = 355;
|
||||
char msg[150];
|
||||
uint16_t PWdivTimerPerDegree = div(parameters.pw, timePerDegree).quot;
|
||||
|
||||
memset(&fuelSchedule2, 0, sizeof(fuelSchedule2));
|
||||
FuelSchedule schedule(FUEL2_COUNTER, FUEL2_COMPARE, nullInjCallback, nullInjCallback);
|
||||
|
||||
fuelSchedule2.Status = PENDING;
|
||||
schedule.Status = PENDING;
|
||||
uint16_t startAngle = calculateInjectorStartAngle(PWdivTimerPerDegree, parameters.channelAngle, injAngle);
|
||||
sprintf_P(msg, PSTR("PENDING channelAngle: % " PRIu16 ", pw: % " PRIu16 ", crankAngle: % " PRIu16 ", startAngle: % " PRIu16 ""), parameters.channelAngle, parameters.pw, parameters.crankAngle, startAngle);
|
||||
TEST_ASSERT_EQUAL_MESSAGE(parameters.pending, calculateInjectorTimeout(fuelSchedule2, parameters.channelAngle, startAngle, parameters.crankAngle), msg);
|
||||
sprintf_P(msg, PSTR("PENDING channelAngle: %" PRIu16 ", pw: %" PRIu16 ", crankAngle: %" PRIu16 ", startAngle: %" PRIu16), parameters.channelAngle, parameters.pw, parameters.crankAngle, startAngle);
|
||||
TEST_ASSERT_EQUAL_MESSAGE(parameters.pending, calculateInjectorTimeout(schedule, parameters.channelAngle, startAngle, parameters.crankAngle), msg);
|
||||
|
||||
fuelSchedule2.Status = RUNNING;
|
||||
schedule.Status = RUNNING;
|
||||
startAngle = calculateInjectorStartAngle( PWdivTimerPerDegree, parameters.channelAngle, injAngle);
|
||||
sprintf_P(msg, PSTR("RUNNING channelAngle: % " PRIu16 ", pw: % " PRIu16 ", crankAngle: % " PRIu16 ", startAngle: % " PRIu16 ""), parameters.channelAngle, parameters.pw, parameters.crankAngle, startAngle);
|
||||
TEST_ASSERT_EQUAL_MESSAGE(parameters.running, calculateInjectorTimeout(fuelSchedule2, parameters.channelAngle, startAngle, parameters.crankAngle), msg);
|
||||
sprintf_P(msg, PSTR("RUNNING channelAngle: %" PRIu16 ", pw: %" PRIu16 ", crankAngle: %" PRIu16 ", startAngle: %" PRIu16), parameters.channelAngle, parameters.pw, parameters.crankAngle, startAngle);
|
||||
TEST_ASSERT_EQUAL_MESSAGE(parameters.running, calculateInjectorTimeout(schedule, parameters.channelAngle, startAngle, parameters.crankAngle), msg);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -112,7 +112,9 @@ void test_accuracy_duration_inj8(void)
|
|||
void test_accuracy_duration_ign1(void)
|
||||
{
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule1(startCallback, TIMEOUT, DURATION, endCallback);
|
||||
ignitionSchedule1.pStartCallback = startCallback;
|
||||
ignitionSchedule1.pEndCallback = endCallback;
|
||||
setIgnitionSchedule1(TIMEOUT, DURATION);
|
||||
while( (ignitionSchedule1.Status == PENDING) || (ignitionSchedule1.Status == RUNNING) ) /*Wait*/ ;
|
||||
TEST_ASSERT_UINT32_WITHIN(DELTA, DURATION, end_time - start_time);
|
||||
}
|
||||
|
@ -120,7 +122,9 @@ void test_accuracy_duration_ign1(void)
|
|||
void test_accuracy_duration_ign2(void)
|
||||
{
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule2(startCallback, TIMEOUT, DURATION, endCallback);
|
||||
ignitionSchedule2.pStartCallback = startCallback;
|
||||
ignitionSchedule2.pEndCallback = endCallback;
|
||||
setIgnitionSchedule2(TIMEOUT, DURATION);
|
||||
while( (ignitionSchedule2.Status == PENDING) || (ignitionSchedule2.Status == RUNNING) ) /*Wait*/ ;
|
||||
TEST_ASSERT_UINT32_WITHIN(DELTA, TIMEOUT, end_time - start_time);
|
||||
}
|
||||
|
@ -128,7 +132,9 @@ void test_accuracy_duration_ign2(void)
|
|||
void test_accuracy_duration_ign3(void)
|
||||
{
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule3(startCallback, TIMEOUT, DURATION, endCallback);
|
||||
ignitionSchedule3.pStartCallback = startCallback;
|
||||
ignitionSchedule3.pEndCallback = endCallback;
|
||||
setIgnitionSchedule3(TIMEOUT, DURATION);
|
||||
while( (ignitionSchedule3.Status == PENDING) || (ignitionSchedule3.Status == RUNNING) ) /*Wait*/ ;
|
||||
TEST_ASSERT_UINT32_WITHIN(DELTA, TIMEOUT, end_time - start_time);
|
||||
}
|
||||
|
@ -136,7 +142,9 @@ void test_accuracy_duration_ign3(void)
|
|||
void test_accuracy_duration_ign4(void)
|
||||
{
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule4(startCallback, TIMEOUT, DURATION, endCallback);
|
||||
ignitionSchedule4.pStartCallback = startCallback;
|
||||
ignitionSchedule4.pEndCallback = endCallback;
|
||||
setIgnitionSchedule4(TIMEOUT, DURATION);
|
||||
while( (ignitionSchedule4.Status == PENDING) || (ignitionSchedule4.Status == RUNNING) ) /*Wait*/ ;
|
||||
TEST_ASSERT_UINT32_WITHIN(DELTA, TIMEOUT, end_time - start_time);
|
||||
}
|
||||
|
@ -145,7 +153,9 @@ void test_accuracy_duration_ign5(void)
|
|||
{
|
||||
#if IGN_CHANNELS >= 5
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule5(startCallback, TIMEOUT, DURATION, endCallback);
|
||||
ignitionSchedule5.pStartCallback = startCallback;
|
||||
ignitionSchedule5.pEndCallback = endCallback;
|
||||
setIgnitionSchedule5(TIMEOUT, DURATION);
|
||||
while( (ignitionSchedule5.Status == PENDING) || (ignitionSchedule5.Status == RUNNING) ) /*Wait*/ ;
|
||||
TEST_ASSERT_UINT32_WITHIN(DELTA, TIMEOUT, end_time - start_time);
|
||||
#endif
|
||||
|
@ -155,7 +165,9 @@ void test_accuracy_duration_ign5(void)
|
|||
void test_accuracy_duration_ign6(void)
|
||||
{
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule6(startCallback, TIMEOUT, DURATION, endCallback);
|
||||
ignitionSchedule6.pStartCallback = startCallback;
|
||||
ignitionSchedule6.pEndCallback = endCallback;
|
||||
setIgnitionSchedule6(TIMEOUT, DURATION);
|
||||
while( (ignitionSchedule6.Status == PENDING) || (ignitionSchedule6.Status == RUNNING) ) /*Wait*/ ;
|
||||
TEST_ASSERT_UINT32_WITHIN(DELTA, TIMEOUT, end_time - start_time);
|
||||
}
|
||||
|
@ -165,7 +177,9 @@ void test_accuracy_duration_ign6(void)
|
|||
void test_accuracy_duration_ign7(void)
|
||||
{
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule7(startCallback, TIMEOUT, DURATION, endCallback);
|
||||
ignitionSchedule7.pStartCallback = startCallback;
|
||||
ignitionSchedule7.pEndCallback = endCallback;
|
||||
setIgnitionSchedule7(TIMEOUT, DURATION);
|
||||
while( (ignitionSchedule7.Status == PENDING) || (ignitionSchedule7.Status == RUNNING) ) /*Wait*/ ;
|
||||
TEST_ASSERT_UINT32_WITHIN(DELTA, TIMEOUT, end_time - start_time);
|
||||
}
|
||||
|
@ -175,7 +189,9 @@ void test_accuracy_duration_ign7(void)
|
|||
void test_accuracy_duration_ign8(void)
|
||||
{
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule8(startCallback, TIMEOUT, DURATION, endCallback);
|
||||
ignitionSchedule8.pStartCallback = startCallback;
|
||||
ignitionSchedule8.pEndCallback = endCallback;
|
||||
setIgnitionSchedule8(TIMEOUT, DURATION);
|
||||
while( (ignitionSchedule8.Status == PENDING) || (ignitionSchedule8.Status == RUNNING) ) /*Wait*/ ;
|
||||
TEST_ASSERT_UINT32_WITHIN(DELTA, TIMEOUT, end_time - start_time);
|
||||
}
|
||||
|
|
|
@ -106,7 +106,9 @@ void test_accuracy_timeout_ign1(void)
|
|||
{
|
||||
initialiseSchedulers();
|
||||
start_time = micros();
|
||||
setIgnitionSchedule1(startCallback, TIMEOUT, DURATION, endCallback);
|
||||
ignitionSchedule1.pStartCallback = startCallback;
|
||||
ignitionSchedule1.pEndCallback = endCallback;
|
||||
setIgnitionSchedule1(TIMEOUT, DURATION);
|
||||
while(ignitionSchedule1.Status == PENDING) /*Wait*/ ;
|
||||
TEST_ASSERT_UINT32_WITHIN(DELTA, TIMEOUT, end_time - start_time);
|
||||
}
|
||||
|
@ -115,7 +117,9 @@ void test_accuracy_timeout_ign2(void)
|
|||
{
|
||||
initialiseSchedulers();
|
||||
start_time = micros();
|
||||
setIgnitionSchedule2(startCallback, TIMEOUT, DURATION, endCallback);
|
||||
ignitionSchedule2.pStartCallback = startCallback;
|
||||
ignitionSchedule2.pEndCallback = endCallback;
|
||||
setIgnitionSchedule2(TIMEOUT, DURATION);
|
||||
while(ignitionSchedule2.Status == PENDING) /*Wait*/ ;
|
||||
TEST_ASSERT_UINT32_WITHIN(DELTA, TIMEOUT, end_time - start_time);
|
||||
}
|
||||
|
@ -124,7 +128,9 @@ void test_accuracy_timeout_ign3(void)
|
|||
{
|
||||
initialiseSchedulers();
|
||||
start_time = micros();
|
||||
setIgnitionSchedule3(startCallback, TIMEOUT, DURATION, endCallback);
|
||||
ignitionSchedule3.pStartCallback = startCallback;
|
||||
ignitionSchedule3.pEndCallback = endCallback;
|
||||
setIgnitionSchedule3(TIMEOUT, DURATION);
|
||||
while(ignitionSchedule3.Status == PENDING) /*Wait*/ ;
|
||||
TEST_ASSERT_UINT32_WITHIN(DELTA, TIMEOUT, end_time - start_time);
|
||||
}
|
||||
|
@ -133,7 +139,9 @@ void test_accuracy_timeout_ign4(void)
|
|||
{
|
||||
initialiseSchedulers();
|
||||
start_time = micros();
|
||||
setIgnitionSchedule4(startCallback, TIMEOUT, DURATION, endCallback);
|
||||
ignitionSchedule4.pStartCallback = startCallback;
|
||||
ignitionSchedule4.pEndCallback = endCallback;
|
||||
setIgnitionSchedule4(TIMEOUT, DURATION);
|
||||
while(ignitionSchedule4.Status == PENDING) /*Wait*/ ;
|
||||
TEST_ASSERT_UINT32_WITHIN(DELTA, TIMEOUT, end_time - start_time);
|
||||
}
|
||||
|
@ -142,8 +150,10 @@ void test_accuracy_timeout_ign4(void)
|
|||
void test_accuracy_timeout_ign5(void)
|
||||
{
|
||||
initialiseSchedulers();
|
||||
ignitionSchedule5.pStartCallback = startCallback;
|
||||
ignitionSchedule5.pEndCallback = endCallback;
|
||||
start_time = micros();
|
||||
setIgnitionSchedule5(startCallback, TIMEOUT, DURATION, endCallback);
|
||||
setIgnitionSchedule5(TIMEOUT, DURATION);
|
||||
while(ignitionSchedule5.Status == PENDING) /*Wait*/ ;
|
||||
TEST_ASSERT_UINT32_WITHIN(DELTA, TIMEOUT, end_time - start_time);
|
||||
}
|
||||
|
@ -154,7 +164,9 @@ void test_accuracy_timeout_ign6(void)
|
|||
{
|
||||
initialiseSchedulers();
|
||||
start_time = micros();
|
||||
setIgnitionSchedule6(startCallback, TIMEOUT, DURATION, endCallback);
|
||||
ignitionSchedule6.pStartCallback = startCallback;
|
||||
ignitionSchedule6.pEndCallback = endCallback;
|
||||
setIgnitionSchedule6(TIMEOUT, DURATION);
|
||||
while(ignitionSchedule6.Status == PENDING) /*Wait*/ ;
|
||||
TEST_ASSERT_UINT32_WITHIN(DELTA, TIMEOUT, end_time - start_time);
|
||||
}
|
||||
|
@ -165,7 +177,9 @@ void test_accuracy_timeout_ign7(void)
|
|||
{
|
||||
initialiseSchedulers();
|
||||
start_time = micros();
|
||||
setIgnitionSchedule7(startCallback, TIMEOUT, DURATION, endCallback);
|
||||
ignitionSchedule7.pStartCallback = startCallback;
|
||||
ignitionSchedule7.pEndCallback = endCallback;
|
||||
setIgnitionSchedule7(TIMEOUT, DURATION);
|
||||
while(ignitionSchedule7.Status == PENDING) /*Wait*/ ;
|
||||
TEST_ASSERT_UINT32_WITHIN(DELTA, TIMEOUT, end_time - start_time);
|
||||
}
|
||||
|
@ -176,7 +190,9 @@ void test_accuracy_timeout_ign8(void)
|
|||
{
|
||||
initialiseSchedulers();
|
||||
start_time = micros();
|
||||
setIgnitionSchedule8(startCallback, TIMEOUT, DURATION, endCallback);
|
||||
ignitionSchedule8.pStartCallback = startCallback;
|
||||
ignitionSchedule8.pEndCallback = endCallback;
|
||||
setIgnitionSchedule8(TIMEOUT, DURATION);
|
||||
while(ignitionSchedule8.Status == PENDING) /*Wait*/ ;
|
||||
TEST_ASSERT_UINT32_WITHIN(DELTA, TIMEOUT, end_time - start_time);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
#include <Arduino.h>
|
||||
#include <unity.h>
|
||||
|
||||
|
|
|
@ -77,28 +77,36 @@ void test_status_off_to_pending_inj8(void)
|
|||
void test_status_off_to_pending_ign1(void)
|
||||
{
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule1(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule1.pStartCallback = emptyCallback;
|
||||
ignitionSchedule1.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule1(TIMEOUT, DURATION);
|
||||
TEST_ASSERT_EQUAL(PENDING, ignitionSchedule1.Status);
|
||||
}
|
||||
|
||||
void test_status_off_to_pending_ign2(void)
|
||||
{
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule2(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule2.pStartCallback = emptyCallback;
|
||||
ignitionSchedule2.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule2(TIMEOUT, DURATION);
|
||||
TEST_ASSERT_EQUAL(PENDING, ignitionSchedule2.Status);
|
||||
}
|
||||
|
||||
void test_status_off_to_pending_ign3(void)
|
||||
{
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule3(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule3.pStartCallback = emptyCallback;
|
||||
ignitionSchedule3.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule3(TIMEOUT, DURATION);
|
||||
TEST_ASSERT_EQUAL(PENDING, ignitionSchedule3.Status);
|
||||
}
|
||||
|
||||
void test_status_off_to_pending_ign4(void)
|
||||
{
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule4(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule4.pStartCallback = emptyCallback;
|
||||
ignitionSchedule4.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule4(TIMEOUT, DURATION);
|
||||
TEST_ASSERT_EQUAL(PENDING, ignitionSchedule4.Status);
|
||||
}
|
||||
|
||||
|
@ -106,7 +114,9 @@ void test_status_off_to_pending_ign4(void)
|
|||
void test_status_off_to_pending_ign5(void)
|
||||
{
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule5(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule5.pStartCallback = emptyCallback;
|
||||
ignitionSchedule5.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule5(TIMEOUT, DURATION);
|
||||
TEST_ASSERT_EQUAL(PENDING, ignitionSchedule5.Status);
|
||||
}
|
||||
#endif
|
||||
|
@ -115,7 +125,9 @@ void test_status_off_to_pending_ign5(void)
|
|||
void test_status_off_to_pending_ign6(void)
|
||||
{
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule6(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule6.pStartCallback = emptyCallback;
|
||||
ignitionSchedule6.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule6(TIMEOUT, DURATION);
|
||||
TEST_ASSERT_EQUAL(PENDING, ignitionSchedule6.Status);
|
||||
}
|
||||
#endif
|
||||
|
@ -124,7 +136,9 @@ void test_status_off_to_pending_ign6(void)
|
|||
void test_status_off_to_pending_ign7(void)
|
||||
{
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule7(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule7.pStartCallback = emptyCallback;
|
||||
ignitionSchedule7.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule7(TIMEOUT, DURATION);
|
||||
TEST_ASSERT_EQUAL(PENDING, ignitionSchedule7.Status);
|
||||
}
|
||||
#endif
|
||||
|
@ -133,7 +147,9 @@ void test_status_off_to_pending_ign7(void)
|
|||
void test_status_off_to_pending_ign8(void)
|
||||
{
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule8(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule8.pStartCallback = emptyCallback;
|
||||
ignitionSchedule8.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule8(TIMEOUT, DURATION);
|
||||
TEST_ASSERT_EQUAL(PENDING, ignitionSchedule8.Status);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -85,7 +85,9 @@ void test_status_pending_to_running_inj8(void)
|
|||
void test_status_pending_to_running_ign1(void)
|
||||
{
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule1(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule1.pStartCallback = emptyCallback;
|
||||
ignitionSchedule1.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule1(TIMEOUT, DURATION);
|
||||
while(ignitionSchedule1.Status == PENDING) /*Wait*/ ;
|
||||
TEST_ASSERT_EQUAL(RUNNING, ignitionSchedule1.Status);
|
||||
}
|
||||
|
@ -93,7 +95,9 @@ void test_status_pending_to_running_ign1(void)
|
|||
void test_status_pending_to_running_ign2(void)
|
||||
{
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule2(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule2.pStartCallback = emptyCallback;
|
||||
ignitionSchedule2.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule2(TIMEOUT, DURATION);
|
||||
while(ignitionSchedule2.Status == PENDING) /*Wait*/ ;
|
||||
TEST_ASSERT_EQUAL(RUNNING, ignitionSchedule2.Status);
|
||||
}
|
||||
|
@ -101,7 +105,9 @@ void test_status_pending_to_running_ign2(void)
|
|||
void test_status_pending_to_running_ign3(void)
|
||||
{
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule3(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule3.pStartCallback = emptyCallback;
|
||||
ignitionSchedule3.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule3(TIMEOUT, DURATION);
|
||||
while(ignitionSchedule3.Status == PENDING) /*Wait*/ ;
|
||||
TEST_ASSERT_EQUAL(RUNNING, ignitionSchedule3.Status);
|
||||
}
|
||||
|
@ -109,7 +115,9 @@ void test_status_pending_to_running_ign3(void)
|
|||
void test_status_pending_to_running_ign4(void)
|
||||
{
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule4(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule4.pStartCallback = emptyCallback;
|
||||
ignitionSchedule4.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule4(TIMEOUT, DURATION);
|
||||
while(ignitionSchedule4.Status == PENDING) /*Wait*/ ;
|
||||
TEST_ASSERT_EQUAL(RUNNING, ignitionSchedule4.Status);
|
||||
}
|
||||
|
@ -118,7 +126,9 @@ void test_status_pending_to_running_ign5(void)
|
|||
{
|
||||
#if IGN_CHANNELS >= 5
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule5(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule5.pStartCallback = emptyCallback;
|
||||
ignitionSchedule5.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule5(TIMEOUT, DURATION);
|
||||
while(ignitionSchedule5.Status == PENDING) /*Wait*/ ;
|
||||
TEST_ASSERT_EQUAL(RUNNING, ignitionSchedule5.Status);
|
||||
#endif
|
||||
|
@ -128,7 +138,9 @@ void test_status_pending_to_running_ign6(void)
|
|||
{
|
||||
#if INJ_CHANNELS >= 6
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule6(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule6.pStartCallback = emptyCallback;
|
||||
ignitionSchedule6.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule6(TIMEOUT, DURATION);
|
||||
while(ignitionSchedule6.Status == PENDING) /*Wait*/ ;
|
||||
TEST_ASSERT_EQUAL(RUNNING, ignitionSchedule6.Status);
|
||||
#endif
|
||||
|
@ -138,7 +150,9 @@ void test_status_pending_to_running_ign7(void)
|
|||
{
|
||||
#if INJ_CHANNELS >= 7
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule7(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule7.pStartCallback = emptyCallback;
|
||||
ignitionSchedule7.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule7(TIMEOUT, DURATION);
|
||||
while(ignitionSchedule7.Status == PENDING) /*Wait*/ ;
|
||||
TEST_ASSERT_EQUAL(RUNNING, ignitionSchedule7.Status);
|
||||
#endif
|
||||
|
@ -148,7 +162,9 @@ void test_status_pending_to_running_ign8(void)
|
|||
{
|
||||
#if INJ_CHANNELS >= 8
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule8(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule8.pStartCallback = emptyCallback;
|
||||
ignitionSchedule8.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule8(TIMEOUT, DURATION);
|
||||
while(ignitionSchedule8.Status == PENDING) /*Wait*/ ;
|
||||
TEST_ASSERT_EQUAL(RUNNING, ignitionSchedule8.Status);
|
||||
#endif
|
||||
|
|
|
@ -85,7 +85,9 @@ void test_status_running_to_off_inj8(void)
|
|||
void test_status_running_to_off_ign1(void)
|
||||
{
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule1(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule1.pStartCallback = emptyCallback;
|
||||
ignitionSchedule1.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule1(TIMEOUT, DURATION);
|
||||
while( (ignitionSchedule1.Status == PENDING) || (ignitionSchedule1.Status == RUNNING) ) /*Wait*/ ;
|
||||
TEST_ASSERT_EQUAL(OFF, ignitionSchedule1.Status);
|
||||
}
|
||||
|
@ -93,7 +95,9 @@ void test_status_running_to_off_ign1(void)
|
|||
void test_status_running_to_off_ign2(void)
|
||||
{
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule2(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule2.pStartCallback = emptyCallback;
|
||||
ignitionSchedule2.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule2(TIMEOUT, DURATION);
|
||||
while( (ignitionSchedule2.Status == PENDING) || (ignitionSchedule2.Status == RUNNING) ) /*Wait*/ ;
|
||||
TEST_ASSERT_EQUAL(OFF, ignitionSchedule2.Status);
|
||||
}
|
||||
|
@ -101,7 +105,9 @@ void test_status_running_to_off_ign2(void)
|
|||
void test_status_running_to_off_ign3(void)
|
||||
{
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule3(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule3.pStartCallback = emptyCallback;
|
||||
ignitionSchedule3.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule3(TIMEOUT, DURATION);
|
||||
while( (ignitionSchedule3.Status == PENDING) || (ignitionSchedule3.Status == RUNNING) ) /*Wait*/ ;
|
||||
TEST_ASSERT_EQUAL(OFF, ignitionSchedule3.Status);
|
||||
}
|
||||
|
@ -109,7 +115,9 @@ void test_status_running_to_off_ign3(void)
|
|||
void test_status_running_to_off_ign4(void)
|
||||
{
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule4(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule4.pStartCallback = emptyCallback;
|
||||
ignitionSchedule4.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule4(TIMEOUT, DURATION);
|
||||
while( (ignitionSchedule4.Status == PENDING) || (ignitionSchedule4.Status == RUNNING) ) /*Wait*/ ;
|
||||
TEST_ASSERT_EQUAL(OFF, ignitionSchedule4.Status);
|
||||
}
|
||||
|
@ -118,7 +126,9 @@ void test_status_running_to_off_ign5(void)
|
|||
{
|
||||
#if IGN_CHANNELS >= 5
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule5(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule5.pStartCallback = emptyCallback;
|
||||
ignitionSchedule5.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule5(TIMEOUT, DURATION);
|
||||
while( (ignitionSchedule5.Status == PENDING) || (ignitionSchedule5.Status == RUNNING) ) /*Wait*/ ;
|
||||
TEST_ASSERT_EQUAL(OFF, ignitionSchedule5.Status);
|
||||
#endif
|
||||
|
@ -128,7 +138,9 @@ void test_status_running_to_off_ign6(void)
|
|||
{
|
||||
#if IGN_CHANNELS >= 6
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule6(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule6.pStartCallback = emptyCallback;
|
||||
ignitionSchedule6.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule6(TIMEOUT, DURATION);
|
||||
while( (ignitionSchedule6.Status == PENDING) || (ignitionSchedule6.Status == RUNNING) ) /*Wait*/ ;
|
||||
TEST_ASSERT_EQUAL(OFF, ignitionSchedule6.Status);
|
||||
#endif
|
||||
|
@ -138,7 +150,9 @@ void test_status_running_to_off_ign7(void)
|
|||
{
|
||||
#if IGN_CHANNELS >= 7
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule7(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule7.pStartCallback = emptyCallback;
|
||||
ignitionSchedule7.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule7(TIMEOUT, DURATION);
|
||||
while( (ignitionSchedule7.Status == PENDING) || (ignitionSchedule7.Status == RUNNING) ) /*Wait*/ ;
|
||||
TEST_ASSERT_EQUAL(OFF, ignitionSchedule7.Status);
|
||||
#endif
|
||||
|
@ -148,7 +162,9 @@ void test_status_running_to_off_ign8(void)
|
|||
{
|
||||
#if IGN_CHANNELS >= 8
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule8(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule8.pStartCallback = emptyCallback;
|
||||
ignitionSchedule8.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule8(TIMEOUT, DURATION);
|
||||
while( (ignitionSchedule8.Status == PENDING) || (ignitionSchedule8.Status == RUNNING) ) /*Wait*/ ;
|
||||
TEST_ASSERT_EQUAL(OFF, ignitionSchedule8.Status);
|
||||
#endif
|
||||
|
|
|
@ -101,9 +101,11 @@ void test_status_running_to_pending_inj8(void)
|
|||
void test_status_running_to_pending_ign1(void)
|
||||
{
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule1(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule1.pStartCallback = emptyCallback;
|
||||
ignitionSchedule1.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule1(TIMEOUT, DURATION);
|
||||
while(ignitionSchedule1.Status == PENDING) /*Wait*/ ;
|
||||
setIgnitionSchedule1(emptyCallback, 2*TIMEOUT, DURATION, emptyCallback);
|
||||
setIgnitionSchedule1(2*TIMEOUT, DURATION);
|
||||
while(ignitionSchedule1.Status == RUNNING) /*Wait*/ ;
|
||||
TEST_ASSERT_EQUAL(PENDING, ignitionSchedule1.Status);
|
||||
}
|
||||
|
@ -111,9 +113,11 @@ void test_status_running_to_pending_ign1(void)
|
|||
void test_status_running_to_pending_ign2(void)
|
||||
{
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule2(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule2.pStartCallback = emptyCallback;
|
||||
ignitionSchedule2.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule2(TIMEOUT, DURATION);
|
||||
while(ignitionSchedule2.Status == PENDING) /*Wait*/ ;
|
||||
setIgnitionSchedule2(emptyCallback, 2*TIMEOUT, DURATION, emptyCallback);
|
||||
setIgnitionSchedule2(2*TIMEOUT, DURATION);
|
||||
while(ignitionSchedule2.Status == RUNNING) /*Wait*/ ;
|
||||
TEST_ASSERT_EQUAL(PENDING, ignitionSchedule2.Status);
|
||||
}
|
||||
|
@ -121,9 +125,11 @@ void test_status_running_to_pending_ign2(void)
|
|||
void test_status_running_to_pending_ign3(void)
|
||||
{
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule3(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule3.pStartCallback = emptyCallback;
|
||||
ignitionSchedule3.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule3(TIMEOUT, DURATION);
|
||||
while(ignitionSchedule3.Status == PENDING) /*Wait*/ ;
|
||||
setIgnitionSchedule3(emptyCallback, 2*TIMEOUT, DURATION, emptyCallback);
|
||||
setIgnitionSchedule3(2*TIMEOUT, DURATION);
|
||||
while(ignitionSchedule3.Status == RUNNING) /*Wait*/ ;
|
||||
TEST_ASSERT_EQUAL(PENDING, ignitionSchedule3.Status);
|
||||
}
|
||||
|
@ -131,9 +137,11 @@ void test_status_running_to_pending_ign3(void)
|
|||
void test_status_running_to_pending_ign4(void)
|
||||
{
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule4(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule4.pStartCallback = emptyCallback;
|
||||
ignitionSchedule4.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule4(TIMEOUT, DURATION);
|
||||
while(ignitionSchedule4.Status == PENDING) /*Wait*/ ;
|
||||
setIgnitionSchedule4(emptyCallback, 2*TIMEOUT, DURATION, emptyCallback);
|
||||
setIgnitionSchedule4(2*TIMEOUT, DURATION);
|
||||
while(ignitionSchedule4.Status == RUNNING) /*Wait*/ ;
|
||||
TEST_ASSERT_EQUAL(PENDING, ignitionSchedule4.Status);
|
||||
}
|
||||
|
@ -142,9 +150,11 @@ void test_status_running_to_pending_ign5(void)
|
|||
{
|
||||
#if IGN_CHANNELS >= 5
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule5(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule5.pStartCallback = emptyCallback;
|
||||
ignitionSchedule5.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule5(TIMEOUT, DURATION);
|
||||
while(ignitionSchedule5.Status == PENDING) /*Wait*/ ;
|
||||
setIgnitionSchedule5(emptyCallback, 2*TIMEOUT, DURATION, emptyCallback);
|
||||
setIgnitionSchedule5(2*TIMEOUT, DURATION);
|
||||
while(ignitionSchedule5.Status == RUNNING) /*Wait*/ ;
|
||||
TEST_ASSERT_EQUAL(PENDING, ignitionSchedule5.Status);
|
||||
#endif
|
||||
|
@ -154,9 +164,11 @@ void test_status_running_to_pending_ign6(void)
|
|||
{
|
||||
#if INJ_CHANNELS >= 6
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule6(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule6.pStartCallback = emptyCallback;
|
||||
ignitionSchedule6.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule6(TIMEOUT, DURATION);
|
||||
while(ignitionSchedule6.Status == PENDING) /*Wait*/ ;
|
||||
setIgnitionSchedule6(emptyCallback, 2*TIMEOUT, DURATION, emptyCallback);
|
||||
setIgnitionSchedule6(2*TIMEOUT, DURATION);
|
||||
while(ignitionSchedule6.Status == RUNNING) /*Wait*/ ;
|
||||
TEST_ASSERT_EQUAL(PENDING, ignitionSchedule6.Status);
|
||||
#endif
|
||||
|
@ -166,9 +178,11 @@ void test_status_running_to_pending_ign7(void)
|
|||
{
|
||||
#if INJ_CHANNELS >= 7
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule7(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule7.pStartCallback = emptyCallback;
|
||||
ignitionSchedule7.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule7(TIMEOUT, DURATION);
|
||||
while(ignitionSchedule7.Status == PENDING) /*Wait*/ ;
|
||||
setIgnitionSchedule7(emptyCallback, 2*TIMEOUT, DURATION, emptyCallback);
|
||||
setIgnitionSchedule7(2*TIMEOUT, DURATION);
|
||||
while(ignitionSchedule7.Status == RUNNING) /*Wait*/ ;
|
||||
TEST_ASSERT_EQUAL(PENDING, ignitionSchedule7.Status);
|
||||
#endif
|
||||
|
@ -178,9 +192,11 @@ void test_status_running_to_pending_ign8(void)
|
|||
{
|
||||
#if INJ_CHANNELS >= 8
|
||||
initialiseSchedulers();
|
||||
setIgnitionSchedule8(emptyCallback, TIMEOUT, DURATION, emptyCallback);
|
||||
ignitionSchedule8.pStartCallback = emptyCallback;
|
||||
ignitionSchedule8.pEndCallback = emptyCallback;
|
||||
setIgnitionSchedule8(TIMEOUT, DURATION);
|
||||
while(ignitionSchedule8.Status == PENDING) /*Wait*/ ;
|
||||
setIgnitionSchedule8(emptyCallback, 2*TIMEOUT, DURATION, emptyCallback);
|
||||
setIgnitionSchedule8(2*TIMEOUT, DURATION);
|
||||
while(ignitionSchedule8.Status == RUNNING) /*Wait*/ ;
|
||||
TEST_ASSERT_EQUAL(PENDING, ignitionSchedule8.Status);
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue