Merge branch 'master' of https://github.com/noisymime/speeduino
This commit is contained in:
commit
f006dacf2b
|
@ -370,7 +370,8 @@ page = 1
|
|||
vssRatio6 = scalar, U16, 116, "km/h per 1000rpm", 0.1, 0, 0, 299.9, 1
|
||||
|
||||
|
||||
unused2-95 = array, U08, 118, [10], "%", 1.0, 0.0, 0.0, 255, 0
|
||||
unused2-95 = array, U08, 118, [9], "%", 1.0, 0.0, 0.0, 255, 0
|
||||
primingDelay = scalar, U08, 127, "S", 0.1, 0.0, 0.0, 25.5, 1
|
||||
|
||||
;Page 2 is the fuel map and axis bins only
|
||||
page = 2
|
||||
|
@ -1212,6 +1213,7 @@ page = 11
|
|||
defaultValue = dfcoMinCLT, 25
|
||||
defaultValue = crankingEnrichTaper, 0.1
|
||||
defaultValue = boostCutEnabled, 1
|
||||
defaultValue = primingDelay, 0.5
|
||||
|
||||
;Default pins
|
||||
defaultValue = fanPin, 0
|
||||
|
@ -1646,6 +1648,8 @@ menuDialog = main
|
|||
|
||||
crankRPM = "The cranking RPM threshold. When RPM is lower than this value (and above 0) the system will be considered to be cranking"
|
||||
tpsflood = "Keep throttle over this value to disable the priming pulse and cranking fuel. Used to prevent flood or clear already flooded engine"
|
||||
fpPrime = "Duration to power fuel pump on to ensure fuel line pressure."
|
||||
primingDelay= "Delay to priming after fuel pump is on, used to wait fuel line get pressurized correctly."
|
||||
|
||||
fanInv = ""
|
||||
fanHyster = "The number of degrees of hysteresis to be used in controlling the fan. Recommended values are between 2 and 5"
|
||||
|
@ -2194,6 +2198,7 @@ menuDialog = main
|
|||
field = "Cranking RPM (Max)", crankRPM
|
||||
field = "Flood Clear level", tpsflood
|
||||
field = "Fuel pump prime duration", fpPrime
|
||||
field = "Injectors priming delay", primingDelay
|
||||
field = "Cranking enrichment taper time", crankingEnrichTaper
|
||||
|
||||
dialog = primePW, "Priming Pulsewidth"
|
||||
|
|
|
@ -10,16 +10,16 @@
|
|||
#define PINMASK_TYPE uint32_t
|
||||
#define COMPARE_TYPE uint16_t
|
||||
#define COUNTER_TYPE uint16_t
|
||||
#define TIMER_RESOLUTION 2
|
||||
#define micros_safe() micros() //timer5 method is not used on anything but AVR, the micros_safe() macro is simply an alias for the normal micros()
|
||||
#if defined(SRAM_AS_EEPROM)
|
||||
#define EEPROM_LIB_H "src/BackupSram/BackupSramAsEEPROM.h"
|
||||
#elif defined(SPIFLASH_AS_EEPROM)
|
||||
#define EEPROM_LIB_H "src/SPIAsEEPROM/SPIAsEEPROM.h"
|
||||
#elif defined(FRAM_AS_EEPROM) //https://github.com/VitorBoss/FRAM
|
||||
#define EEPROM_LIB_H <Fram.h>
|
||||
#else
|
||||
#define EEPROM_LIB_H <EEPROM.h>
|
||||
#define EEPROM_LIB_H "src/SPIAsEEPROM/SPIAsEEPROM.h"
|
||||
#endif
|
||||
|
||||
#ifndef USE_SERIAL3
|
||||
#define USE_SERIAL3
|
||||
#endif
|
||||
|
@ -35,7 +35,7 @@
|
|||
#if defined(ARDUINO_BLACK_F407VE)
|
||||
FramClass EEPROM(PB5, PB4, PB3, PB0); /*(mosi, miso, sclk, ssel, clockspeed) 31/01/2020*/
|
||||
#else
|
||||
FramClass EEPROM(PB15, PB12, PB13, PB12); //Blue/Black Pills
|
||||
FramClass EEPROM(PB15, PB14, PB13, PB12); //Blue/Black Pills
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -129,57 +129,57 @@
|
|||
#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() (TIM2)->CCER |= TIM_CCER_CC1E
|
||||
#define FUEL2_TIMER_ENABLE() (TIM2)->CCER |= TIM_CCER_CC2E
|
||||
#define FUEL3_TIMER_ENABLE() (TIM2)->CCER |= TIM_CCER_CC3E
|
||||
#define FUEL4_TIMER_ENABLE() (TIM2)->CCER |= TIM_CCER_CC4E
|
||||
#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
|
||||
|
||||
#define FUEL1_TIMER_DISABLE() (TIM2)->CCER &= ~TIM_CCER_CC1E
|
||||
#define FUEL2_TIMER_DISABLE() (TIM2)->CCER &= ~TIM_CCER_CC2E
|
||||
#define FUEL3_TIMER_DISABLE() (TIM2)->CCER &= ~TIM_CCER_CC3E
|
||||
#define FUEL4_TIMER_DISABLE() (TIM2)->CCER &= ~TIM_CCER_CC4E
|
||||
#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
|
||||
|
||||
#define IGN1_TIMER_ENABLE() (TIM3)->CCER |= TIM_CCER_CC1E
|
||||
#define IGN2_TIMER_ENABLE() (TIM3)->CCER |= TIM_CCER_CC2E
|
||||
#define IGN3_TIMER_ENABLE() (TIM3)->CCER |= TIM_CCER_CC3E
|
||||
#define IGN4_TIMER_ENABLE() (TIM3)->CCER |= TIM_CCER_CC4E
|
||||
#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
|
||||
|
||||
#define IGN1_TIMER_DISABLE() (TIM3)->CCER &= ~TIM_CCER_CC1E
|
||||
#define IGN2_TIMER_DISABLE() (TIM3)->CCER &= ~TIM_CCER_CC2E
|
||||
#define IGN3_TIMER_DISABLE() (TIM3)->CCER &= ~TIM_CCER_CC3E
|
||||
#define IGN4_TIMER_DISABLE() (TIM3)->CCER &= ~TIM_CCER_CC4E
|
||||
#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
|
||||
|
||||
#ifndef SMALL_FLASH_MODE
|
||||
#define FUEL5_TIMER_ENABLE() (TIM5)->CCER |= TIM_CCER_CC1E
|
||||
#define FUEL6_TIMER_ENABLE() (TIM5)->CCER |= TIM_CCER_CC2E
|
||||
#define FUEL7_TIMER_ENABLE() (TIM5)->CCER |= TIM_CCER_CC3E
|
||||
#define FUEL8_TIMER_ENABLE() (TIM5)->CCER |= TIM_CCER_CC4E
|
||||
#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
|
||||
|
||||
#define FUEL5_TIMER_DISABLE() (TIM5)->CCER &= ~TIM_CCER_CC1E
|
||||
#define FUEL6_TIMER_DISABLE() (TIM5)->CCER &= ~TIM_CCER_CC2E
|
||||
#define FUEL7_TIMER_DISABLE() (TIM5)->CCER &= ~TIM_CCER_CC3E
|
||||
#define FUEL8_TIMER_DISABLE() (TIM5)->CCER &= ~TIM_CCER_CC4E
|
||||
#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
|
||||
|
||||
#define IGN5_TIMER_ENABLE() (TIM4)->CCER |= TIM_CCER_CC1E
|
||||
#define IGN6_TIMER_ENABLE() (TIM4)->CCER |= TIM_CCER_CC2E
|
||||
#define IGN7_TIMER_ENABLE() (TIM4)->CCER |= TIM_CCER_CC3E
|
||||
#define IGN8_TIMER_ENABLE() (TIM4)->CCER |= TIM_CCER_CC4E
|
||||
#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
|
||||
|
||||
#define IGN5_TIMER_DISABLE() (TIM4)->CCER &= ~TIM_CCER_CC1E
|
||||
#define IGN6_TIMER_DISABLE() (TIM4)->CCER &= ~TIM_CCER_CC2E
|
||||
#define IGN7_TIMER_DISABLE() (TIM4)->CCER &= ~TIM_CCER_CC3E
|
||||
#define IGN8_TIMER_DISABLE() (TIM4)->CCER &= ~TIM_CCER_CC4E
|
||||
#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
|
||||
#endif
|
||||
|
||||
/*
|
||||
***********************************************************************************************************
|
||||
* Auxilliaries
|
||||
*/
|
||||
#define ENABLE_BOOST_TIMER() (TIM1)->CCER |= TIM_CCER_CC2E
|
||||
#define DISABLE_BOOST_TIMER() (TIM1)->CCER &= ~TIM_CCER_CC2E
|
||||
#define ENABLE_BOOST_TIMER() (TIM1)->SR = ~TIM_FLAG_CC2; (TIM1)->DIER |= TIM_DIER_CC2IE
|
||||
#define DISABLE_BOOST_TIMER() (TIM1)->DIER &= ~TIM_DIER_CC2IE
|
||||
|
||||
#define ENABLE_VVT_TIMER() (TIM1)->CCER |= TIM_CCER_CC3E
|
||||
#define DISABLE_VVT_TIMER() (TIM1)->CCER &= ~TIM_CCER_CC3E
|
||||
#define ENABLE_VVT_TIMER() (TIM1)->SR = ~TIM_FLAG_CC3; (TIM1)->DIER |= TIM_DIER_CC3IE
|
||||
#define DISABLE_VVT_TIMER() (TIM1)->DIER &= ~TIM_DIER_CC3IE
|
||||
|
||||
#define BOOST_TIMER_COMPARE (TIM1)->CCR2
|
||||
#define BOOST_TIMER_COUNTER (TIM1)->CNT
|
||||
|
@ -193,8 +193,8 @@
|
|||
#define IDLE_COUNTER (TIM1)->CNT
|
||||
#define IDLE_COMPARE (TIM1)->CCR4
|
||||
|
||||
#define IDLE_TIMER_ENABLE() (TIM1)->CCER |= TIM_CCER_CC4E
|
||||
#define IDLE_TIMER_DISABLE() (TIM1)->CCER &= ~TIM_CCER_CC4E
|
||||
#define IDLE_TIMER_ENABLE() (TIM1)->SR = ~TIM_FLAG_CC4; (TIM1)->DIER |= TIM_DIER_CC4IE
|
||||
#define IDLE_TIMER_DISABLE() (TIM1)->DIER &= ~TIM_DIER_CC4IE
|
||||
/*
|
||||
***********************************************************************************************************
|
||||
* Timers
|
||||
|
|
|
@ -22,7 +22,7 @@ void initBoard()
|
|||
*/
|
||||
if( (configPage6.iacAlgorithm == IAC_ALGORITHM_PWM_OL) || (configPage6.iacAlgorithm == IAC_ALGORITHM_PWM_CL) )
|
||||
{
|
||||
idle_pwm_max_count = 1000000L / (2 * configPage6.idleFreq * 2); //Converts the frequency in Hz to the number of ticks (at 2uS) it takes to complete 1 cycle. Note that the frequency is divided by 2 coming from TS to allow for up to 5KHz
|
||||
idle_pwm_max_count = 1000000L / (TIMER_RESOLUTION * configPage6.idleFreq * 2); //Converts the frequency in Hz to the number of ticks (at 2uS) it takes to complete 1 cycle. Note that the frequency is divided by 2 coming from TS to allow for up to 5KHz
|
||||
}
|
||||
|
||||
//This must happen at the end of the idle init
|
||||
|
@ -52,8 +52,8 @@ void initBoard()
|
|||
* Auxilliaries
|
||||
*/
|
||||
//2uS resolution Min 8Hz, Max 5KHz
|
||||
boost_pwm_max_count = 1000000L / (2 * configPage6.boostFreq * 2); //Converts the frequency in Hz to the number of ticks (at 2uS) it takes to complete 1 cycle. The x2 is there because the frequency is stored at half value (in a byte) to allow freqneucies up to 511Hz
|
||||
vvt_pwm_max_count = 1000000L / (2 * configPage6.vvtFreq * 2); //Converts the frequency in Hz to the number of ticks (at 2uS) it takes to complete 1 cycle
|
||||
boost_pwm_max_count = 1000000L / (TIMER_RESOLUTION * configPage6.boostFreq * 2); //Converts the frequency in Hz to the number of ticks (at 2uS) it takes to complete 1 cycle. The x2 is there because the frequency is stored at half value (in a byte) to allow freqneucies up to 511Hz
|
||||
vvt_pwm_max_count = 1000000L / (TIMER_RESOLUTION * configPage6.vvtFreq * 2); //Converts the frequency in Hz to the number of ticks (at 2uS) it takes to complete 1 cycle
|
||||
|
||||
//Need to be initialised last due to instant interrupt
|
||||
Timer1.setMode(2, TIMER_OUTPUT_COMPARE);
|
||||
|
@ -68,17 +68,17 @@ void initBoard()
|
|||
#if defined(ARDUINO_BLUEPILL_F103C8) || defined(ARDUINO_BLUEPILL_F103CB)
|
||||
//(CYCLES_PER_MICROSECOND == 72, APB2 at 72MHz, APB1 at 36MHz).
|
||||
//Timer2 to 4 is on APB1, Timer1 on APB2. www.st.com/resource/en/datasheet/stm32f103cb.pdf sheet 12
|
||||
Timer1.setPrescaleFactor(((Timer1.getBaseFrequency()/1000000) * 2)-1); //2us resolution
|
||||
Timer2.setPrescaleFactor(((Timer2.getBaseFrequency()/1000000) * 2)-1); //2us resolution
|
||||
Timer3.setPrescaleFactor(((Timer3.getBaseFrequency()/1000000) * 2)-1); //2us resolution
|
||||
Timer1.setPrescaleFactor(((Timer1.getBaseFrequency()/1000000) * TIMER_RESOLUTION)-1); //2us resolution
|
||||
Timer2.setPrescaleFactor(((Timer2.getBaseFrequency()/1000000) * TIMER_RESOLUTION)-1); //2us resolution
|
||||
Timer3.setPrescaleFactor(((Timer3.getBaseFrequency()/1000000) * TIMER_RESOLUTION)-1); //2us resolution
|
||||
#else
|
||||
//(CYCLES_PER_MICROSECOND == 168, APB2 at 84MHz, APB1 at 42MHz).
|
||||
//Timer2 to 14 is on APB1, Timers 1, 8, 9 and 10 on APB2. www.st.com/resource/en/datasheet/stm32f407vg.pdf sheet 120
|
||||
Timer1.setPrescaleFactor(((Timer1.getBaseFrequency()/1000000) * 2)-1); //2us resolution
|
||||
Timer2.setPrescaleFactor(((Timer2.getBaseFrequency()/1000000) * 2)-1); //2us resolution
|
||||
Timer3.setPrescaleFactor(((Timer3.getBaseFrequency()/1000000) * 2)-1); //2us resolution
|
||||
Timer4.setPrescaleFactor(((Timer4.getBaseFrequency()/1000000) * 2)-1); //2us resolution
|
||||
Timer5.setPrescaleFactor(((Timer5.getBaseFrequency()/1000000) * 2)-1); //2us resolution
|
||||
Timer1.setPrescaleFactor(((Timer1.getBaseFrequency()/1000000) * TIMER_RESOLUTION)-1); //2us resolution
|
||||
Timer2.setPrescaleFactor(((Timer2.getBaseFrequency()/1000000) * TIMER_RESOLUTION)-1); //2us resolution
|
||||
Timer3.setPrescaleFactor(((Timer3.getBaseFrequency()/1000000) * TIMER_RESOLUTION)-1); //2us resolution
|
||||
Timer4.setPrescaleFactor(((Timer4.getBaseFrequency()/1000000) * TIMER_RESOLUTION)-1); //2us resolution
|
||||
Timer5.setPrescaleFactor(((Timer5.getBaseFrequency()/1000000) * TIMER_RESOLUTION)-1); //2us resolution
|
||||
#endif
|
||||
Timer2.setMode(1, TIMER_OUTPUT_COMPARE);
|
||||
Timer2.setMode(2, TIMER_OUTPUT_COMPARE);
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#define COMPARE_TYPE uint16_t
|
||||
#define COUNTER_TYPE uint16_t
|
||||
#define micros_safe() micros() //timer5 method is not used on anything but AVR, the micros_safe() macro is simply an alias for the normal micros()
|
||||
#define TIMER_RESOLUTION 4
|
||||
#if defined(SRAM_AS_EEPROM)
|
||||
#define EEPROM_LIB_H "src/BackupSram/BackupSramAsEEPROM.h"
|
||||
#elif defined(FRAM_AS_EEPROM) //https://github.com/VitorBoss/FRAM
|
||||
|
@ -40,7 +41,7 @@
|
|||
#if defined(ARDUINO_BLACK_F407VE)
|
||||
FramClass EEPROM(PB5, PB4, PB3, PB0); /*(mosi, miso, sclk, ssel, clockspeed) 31/01/2020*/
|
||||
#else
|
||||
FramClass EEPROM(PB15, PB12, PB13, PB12); //Blue/Black Pills
|
||||
FramClass EEPROM(PB15, PB14, PB13, PB12); //Blue/Black Pills
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -113,46 +114,46 @@ extern "C" char* sbrk(int incr);
|
|||
#define IGN8_COMPARE (TIM4)->CCR4
|
||||
|
||||
|
||||
#define FUEL1_TIMER_ENABLE() (TIM3)->CCER |= TIM_CCER_CC1E
|
||||
#define FUEL2_TIMER_ENABLE() (TIM3)->CCER |= TIM_CCER_CC2E
|
||||
#define FUEL3_TIMER_ENABLE() (TIM3)->CCER |= TIM_CCER_CC3E
|
||||
#define FUEL4_TIMER_ENABLE() (TIM3)->CCER |= TIM_CCER_CC4E
|
||||
#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
|
||||
|
||||
#define FUEL1_TIMER_DISABLE() (TIM3)->CCER &= ~TIM_CCER_CC1E
|
||||
#define FUEL2_TIMER_DISABLE() (TIM3)->CCER &= ~TIM_CCER_CC2E
|
||||
#define FUEL3_TIMER_DISABLE() (TIM3)->CCER &= ~TIM_CCER_CC3E
|
||||
#define FUEL4_TIMER_DISABLE() (TIM3)->CCER &= ~TIM_CCER_CC4E
|
||||
#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
|
||||
|
||||
#define IGN1_TIMER_ENABLE() (TIM2)->CCER |= TIM_CCER_CC1E
|
||||
#define IGN2_TIMER_ENABLE() (TIM2)->CCER |= TIM_CCER_CC2E
|
||||
#define IGN3_TIMER_ENABLE() (TIM2)->CCER |= TIM_CCER_CC3E
|
||||
#define IGN4_TIMER_ENABLE() (TIM2)->CCER |= TIM_CCER_CC4E
|
||||
#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
|
||||
|
||||
#define IGN1_TIMER_DISABLE() (TIM2)->CCER &= ~TIM_CCER_CC1E
|
||||
#define IGN2_TIMER_DISABLE() (TIM2)->CCER &= ~TIM_CCER_CC2E
|
||||
#define IGN3_TIMER_DISABLE() (TIM2)->CCER &= ~TIM_CCER_CC3E
|
||||
#define IGN4_TIMER_DISABLE() (TIM2)->CCER &= ~TIM_CCER_CC4E
|
||||
#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
|
||||
|
||||
|
||||
#define FUEL5_TIMER_ENABLE() (TIM5)->CCER |= TIM_CCER_CC1E
|
||||
#define FUEL6_TIMER_ENABLE() (TIM5)->CCER |= TIM_CCER_CC2E
|
||||
#define FUEL7_TIMER_ENABLE() (TIM5)->CCER |= TIM_CCER_CC3E
|
||||
#define FUEL8_TIMER_ENABLE() (TIM5)->CCER |= TIM_CCER_CC4E
|
||||
#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
|
||||
|
||||
#define FUEL5_TIMER_DISABLE() (TIM5)->CCER &= ~TIM_CCER_CC1E
|
||||
#define FUEL6_TIMER_DISABLE() (TIM5)->CCER &= ~TIM_CCER_CC2E
|
||||
#define FUEL7_TIMER_DISABLE() (TIM5)->CCER &= ~TIM_CCER_CC3E
|
||||
#define FUEL8_TIMER_DISABLE() (TIM5)->CCER &= ~TIM_CCER_CC4E
|
||||
#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
|
||||
|
||||
#define IGN5_TIMER_ENABLE() (TIM4)->CCER |= TIM_CCER_CC1E
|
||||
#define IGN6_TIMER_ENABLE() (TIM4)->CCER |= TIM_CCER_CC2E
|
||||
#define IGN7_TIMER_ENABLE() (TIM4)->CCER |= TIM_CCER_CC3E
|
||||
#define IGN8_TIMER_ENABLE() (TIM4)->CCER |= TIM_CCER_CC4E
|
||||
#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
|
||||
|
||||
#define IGN5_TIMER_DISABLE() (TIM4)->CCER &= ~TIM_CCER_CC1E
|
||||
#define IGN6_TIMER_DISABLE() (TIM4)->CCER &= ~TIM_CCER_CC2E
|
||||
#define IGN7_TIMER_DISABLE() (TIM4)->CCER &= ~TIM_CCER_CC3E
|
||||
#define IGN8_TIMER_DISABLE() (TIM4)->CCER &= ~TIM_CCER_CC4E
|
||||
#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
|
||||
|
||||
|
||||
|
||||
|
@ -161,11 +162,11 @@ extern "C" char* sbrk(int incr);
|
|||
***********************************************************************************************************
|
||||
* Auxilliaries
|
||||
*/
|
||||
#define ENABLE_BOOST_TIMER() (TIM1)->CCER |= TIM_CCER_CC2E
|
||||
#define DISABLE_BOOST_TIMER() (TIM1)->CCER &= ~TIM_CCER_CC2E
|
||||
#define ENABLE_BOOST_TIMER() (TIM1)->SR = ~TIM_FLAG_CC2; (TIM1)->DIER |= TIM_DIER_CC2IE
|
||||
#define DISABLE_BOOST_TIMER() (TIM1)->DIER &= ~TIM_DIER_CC2IE
|
||||
|
||||
#define ENABLE_VVT_TIMER() (TIM1)->CCER |= TIM_CCER_CC3E
|
||||
#define DISABLE_VVT_TIMER() (TIM1)->CCER &= ~TIM_CCER_CC3E
|
||||
#define ENABLE_VVT_TIMER() (TIM1)->SR = ~TIM_FLAG_CC3; (TIM1)->DIER |= TIM_DIER_CC3IE
|
||||
#define DISABLE_VVT_TIMER() (TIM1)->DIER &= ~TIM_DIER_CC3IE
|
||||
|
||||
#define BOOST_TIMER_COMPARE (TIM1)->CCR2
|
||||
#define BOOST_TIMER_COUNTER (TIM1)->CNT
|
||||
|
@ -179,8 +180,8 @@ extern "C" char* sbrk(int incr);
|
|||
#define IDLE_COUNTER (TIM1)->CNT
|
||||
#define IDLE_COMPARE (TIM1)->CCR4
|
||||
|
||||
#define IDLE_TIMER_ENABLE() (TIM1)->CCER |= TIM_CCER_CC4E
|
||||
#define IDLE_TIMER_DISABLE() (TIM1)->CCER &= ~TIM_CCER_CC4E
|
||||
#define IDLE_TIMER_ENABLE() (TIM1)->SR = ~TIM_FLAG_CC4; (TIM1)->DIER |= TIM_DIER_CC4IE
|
||||
#define IDLE_TIMER_DISABLE() (TIM1)->DIER &= ~TIM_DIER_CC4IE
|
||||
|
||||
/*
|
||||
***********************************************************************************************************
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
*/
|
||||
if( (configPage6.iacAlgorithm == IAC_ALGORITHM_PWM_OL) || (configPage6.iacAlgorithm == IAC_ALGORITHM_PWM_CL) )
|
||||
{
|
||||
idle_pwm_max_count = 1000000L / (4 * configPage6.idleFreq * 2); //Converts the frequency in Hz to the number of ticks (at 4uS) it takes to complete 1 cycle. Note that the frequency is divided by 2 coming from TS to allow for up to 5KHz
|
||||
idle_pwm_max_count = 1000000L / (TIMER_RESOLUTION * configPage6.idleFreq * 2); //Converts the frequency in Hz to the number of ticks (at 4uS) it takes to complete 1 cycle. Note that the frequency is divided by 2 coming from TS to allow for up to 5KHz
|
||||
}
|
||||
|
||||
//This must happen at the end of the idle init
|
||||
|
@ -52,8 +52,8 @@
|
|||
* Auxilliaries
|
||||
*/
|
||||
//2uS resolution Min 8Hz, Max 5KHz
|
||||
boost_pwm_max_count = 1000000L / (4 * configPage6.boostFreq * 2); //Converts the frequency in Hz to the number of ticks (at 4uS) it takes to complete 1 cycle. The x2 is there because the frequency is stored at half value (in a byte) to allow freqneucies up to 511Hz
|
||||
vvt_pwm_max_count = 1000000L / (4 * configPage6.vvtFreq * 2); //Converts the frequency in Hz to the number of ticks (at 4uS) it takes to complete 1 cycle
|
||||
boost_pwm_max_count = 1000000L / (TIMER_RESOLUTION * configPage6.boostFreq * 2); //Converts the frequency in Hz to the number of ticks (at 4uS) it takes to complete 1 cycle. The x2 is there because the frequency is stored at half value (in a byte) to allow freqneucies up to 511Hz
|
||||
vvt_pwm_max_count = 1000000L / (TIMER_RESOLUTION * configPage6.vvtFreq * 2); //Converts the frequency in Hz to the number of ticks (at 4uS) it takes to complete 1 cycle
|
||||
|
||||
//Need to be initialised last due to instant interrupt
|
||||
Timer1.setMode(2, TIMER_OUTPUT_COMPARE);
|
||||
|
@ -69,9 +69,9 @@
|
|||
Timer2.setOverflow(0xFFFF, TICK_FORMAT);
|
||||
Timer3.setOverflow(0xFFFF, TICK_FORMAT);
|
||||
|
||||
Timer1.setPrescaleFactor(((Timer1.getTimerClkFreq()/1000000) * 4)-1); //4us resolution
|
||||
Timer2.setPrescaleFactor(((Timer2.getTimerClkFreq()/1000000) * 4)-1); //4us resolution
|
||||
Timer3.setPrescaleFactor(((Timer3.getTimerClkFreq()/1000000) * 4)-1); //4us resolution
|
||||
Timer1.setPrescaleFactor(((Timer1.getTimerClkFreq()/1000000) * TIMER_RESOLUTION)-1); //4us resolution
|
||||
Timer2.setPrescaleFactor(((Timer2.getTimerClkFreq()/1000000) * TIMER_RESOLUTION)-1); //4us resolution
|
||||
Timer3.setPrescaleFactor(((Timer3.getTimerClkFreq()/1000000) * TIMER_RESOLUTION)-1); //4us resolution
|
||||
|
||||
Timer2.setMode(1, TIMER_OUTPUT_COMPARE);
|
||||
Timer2.setMode(2, TIMER_OUTPUT_COMPARE);
|
||||
|
@ -92,7 +92,7 @@
|
|||
Timer3.attachInterrupt(4, fuelSchedule4Interrupt);
|
||||
#if (INJ_CHANNELS >= 5)
|
||||
Timer5.setOverflow(0xFFFF, TICK_FORMAT);
|
||||
Timer5.setPrescaleFactor(((Timer5.getTimerClkFreq()/1000000) * 4)-1); //4us resolution
|
||||
Timer5.setPrescaleFactor(((Timer5.getTimerClkFreq()/1000000) * TIMER_RESOLUTION)-1); //4us resolution
|
||||
Timer5.setMode(1, TIMER_OUTPUT_COMPARE);
|
||||
Timer5.attachInterrupt(1, fuelSchedule5Interrupt);
|
||||
#endif
|
||||
|
@ -116,7 +116,7 @@
|
|||
Timer2.attachInterrupt(4, ignitionSchedule4Interrupt);
|
||||
#if (IGN_CHANNELS >= 5)
|
||||
Timer4.setOverflow(0xFFFF, TICK_FORMAT);
|
||||
Timer4.setPrescaleFactor(((Timer4.getTimerClkFreq()/1000000) * 4)-1); //4us resolution
|
||||
Timer4.setPrescaleFactor(((Timer4.getTimerClkFreq()/1000000) * TIMER_RESOLUTION)-1); //4us resolution
|
||||
Timer4.setMode(1, TIMER_OUTPUT_COMPARE);
|
||||
Timer4.attachInterrupt(1, ignitionSchedule5Interrupt);
|
||||
#endif
|
||||
|
|
|
@ -316,7 +316,7 @@ If it's the correct tooth, but the schedule is not yet started, calculate and an
|
|||
{ \
|
||||
if( (ignitionSchedule8.Status == RUNNING) ) { IGN8_COMPARE = IGN8_COUNTER + uS_TO_TIMER_COMPARE( fastDegreesToUS( ignitionLimits( (ignition8EndAngle - crankAngle) ) ) ); } \
|
||||
else if(currentStatus.startRevolutions > MIN_CYCLES_FOR_ENDCOMPARE) { ignitionSchedule8.endCompare = IGN8_COUNTER + uS_TO_TIMER_COMPARE( fastDegreesToUS( ignitionLimits( (ignition8EndAngle - crankAngle) ) ) ); ignitionSchedule8.endScheduleSetByDecoder = true; } \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
|
|
|
@ -452,6 +452,7 @@ extern int CRANK_ANGLE_MAX;
|
|||
extern int CRANK_ANGLE_MAX_IGN;
|
||||
extern int CRANK_ANGLE_MAX_INJ; //The number of crank degrees that the system track over. 360 for wasted / timed batch and 720 for sequential
|
||||
extern volatile uint32_t runSecsX10; /**< Counter of seconds since cranking commenced (similar to runSecs) but in increments of 0.1 seconds */
|
||||
extern volatile uint32_t seclx10; /**< Counter of seconds since powered commenced (similar to secl) but in increments of 0.1 seconds */
|
||||
extern volatile byte HWTest_INJ; /**< Each bit in this variable represents one of the injector channels and it's HW test status */
|
||||
extern volatile byte HWTest_INJ_50pc; /**< Each bit in this variable represents one of the injector channels and it's 50% HW test status */
|
||||
extern volatile byte HWTest_IGN; /**< Each bit in this variable represents one of the ignition channels and it's HW test status */
|
||||
|
@ -720,7 +721,8 @@ struct config2 {
|
|||
uint16_t vssRatio5;
|
||||
uint16_t vssRatio6;
|
||||
|
||||
byte unused2_95[10];
|
||||
byte unused2_95[9];
|
||||
byte primingDelay;
|
||||
|
||||
#if defined(CORE_AVR)
|
||||
};
|
||||
|
|
|
@ -128,6 +128,7 @@ int CRANK_ANGLE_MAX = 720;
|
|||
int CRANK_ANGLE_MAX_IGN = 360;
|
||||
int CRANK_ANGLE_MAX_INJ = 360; //The number of crank degrees that the system track over. 360 for wasted / timed batch and 720 for sequential
|
||||
volatile uint32_t runSecsX10;
|
||||
volatile uint32_t seclx10;
|
||||
volatile byte HWTest_INJ = 0; /**< Each bit in this variable represents one of the injector channels and it's HW test status */
|
||||
volatile byte HWTest_INJ_50pc = 0; /**< Each bit in this variable represents one of the injector channels and it's 50% HW test status */
|
||||
volatile byte HWTest_IGN = 0; /**< Each bit in this variable represents one of the ignition channels and it's HW test status */
|
||||
|
|
|
@ -1127,29 +1127,8 @@ void initialiseAll()
|
|||
else { fpPrimed = true; } //If the user has set 0 for the pump priming, immediately mark the priming as being completed
|
||||
|
||||
interrupts();
|
||||
//Perform the priming pulses. Set these to run at an arbitrary time in the future (100us). The prime pulse value is in ms*10, so need to multiple by 100 to get to uS
|
||||
readCLT(false); // Need to read coolant temp to make priming pulsewidth work correctly. The false here disables use of the filter
|
||||
readTPS(false); // Need to read tps to detect flood clear state
|
||||
unsigned long primingValue = table2D_getValue(&PrimingPulseTable, currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET);
|
||||
if((primingValue > 0) && (currentStatus.TPS < configPage4.floodClear))
|
||||
{
|
||||
if(channel1InjEnabled == true) { setFuelSchedule1(100, (primingValue * 100 * 5)); } //to achieve long enough priming pulses, the values in tunerstudio are divided by 0.5 instead of 0.1, so multiplier of 5 is required.
|
||||
if(channel2InjEnabled == true) { setFuelSchedule2(100, (primingValue * 100 * 5)); }
|
||||
if(channel3InjEnabled == true) { setFuelSchedule3(100, (primingValue * 100 * 5)); }
|
||||
if(channel4InjEnabled == true) { setFuelSchedule4(100, (primingValue * 100 * 5)); }
|
||||
#if INJ_CHANNELS >= 5
|
||||
if(channel5InjEnabled == true) { setFuelSchedule5(100, (primingValue * 100 * 5)); }
|
||||
#endif
|
||||
#if INJ_CHANNELS >= 6
|
||||
if(channel6InjEnabled == true) { setFuelSchedule6(100, (primingValue * 100 * 5)); }
|
||||
#endif
|
||||
#if INJ_CHANNELS >= 7
|
||||
if(channel7InjEnabled == true) { setFuelSchedule7(100, (primingValue * 100 * 5)); }
|
||||
#endif
|
||||
#if INJ_CHANNELS >= 8
|
||||
if(channel8InjEnabled == true) { setFuelSchedule8(100, (primingValue * 100 * 5)); }
|
||||
#endif
|
||||
}
|
||||
|
||||
initialisationComplete = true;
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
|
@ -1188,6 +1167,39 @@ void setPinMapping(byte boardID)
|
|||
pinTachOut = 49; //Tacho output pin
|
||||
pinFlex = 19; // Flex sensor (Must be external interrupt enabled)
|
||||
pinResetControl = 43; //Reset control output
|
||||
#endif
|
||||
//New FRAM chips reads 0
|
||||
#if defined(CORE_STM32)
|
||||
//https://github.com/stm32duino/Arduino_Core_STM32/blob/master/variants/Generic_F411Cx/variant.h#L28
|
||||
//pins PA12, PA11 are used for USB or CAN couldn't be used for GPIO
|
||||
//pins PB12, PB13, PB14 and PB15 are used to SPI FLASH
|
||||
pinInjector1 = PB7; //Output pin injector 1 is on
|
||||
pinInjector2 = PB6; //Output pin injector 2 is on
|
||||
pinInjector3 = PB5; //Output pin injector 3 is on
|
||||
pinInjector4 = PB4; //Output pin injector 4 is on
|
||||
pinCoil1 = PB9; //Pin for coil 1
|
||||
pinCoil2 = PB8; //Pin for coil 2
|
||||
pinCoil3 = PB3; //Pin for coil 3
|
||||
pinCoil4 = PA15; //Pin for coil 4
|
||||
pinTPS = A2;//TPS input pin
|
||||
pinMAP = A3; //MAP sensor pin
|
||||
pinIAT = A0; //IAT sensor pin
|
||||
pinCLT = A1; //CLS sensor pin
|
||||
pinO2 = A8; //O2 Sensor pin
|
||||
pinBat = A4; //Battery reference voltage pin
|
||||
pinBaro = pinMAP;
|
||||
pinIdle1 = PA5; //Single wire idle control
|
||||
pinBoost = PA6; //Boost control
|
||||
//pinVVT_1 = 4; //Default VVT output
|
||||
//pinStepperDir = PC15; //Direction pin for DRV8825 driver
|
||||
//pinStepperStep = PC14; //Step pin for DRV8825 driver
|
||||
//pinStepperEnable = PC13; //Enable pin for DRV8825
|
||||
pinFuelPump = PB10; //Fuel pump output
|
||||
pinTachOut = PC13; //Tacho output pin
|
||||
//external interrupt enabled pins
|
||||
//pinFlex = PB2; // Flex sensor (Must be external interrupt enabled)
|
||||
pinTrigger = PB1; //The CAS pin
|
||||
pinTrigger2 = PB10; //The Cam Sensor pin
|
||||
#endif
|
||||
break;
|
||||
case 1:
|
||||
|
@ -1338,8 +1350,8 @@ void setPinMapping(byte boardID)
|
|||
// = PA3;
|
||||
// = PA4;
|
||||
/* = PA5; */ //ADC12
|
||||
pinFuelPump = PA6; //ADC12 LED_BUILTIN_1
|
||||
/* = PA7; */ //ADC12 LED_BUILTIN_2
|
||||
/* = PA6; */ //ADC12 LED_BUILTIN_1
|
||||
pinFuelPump = PA7; //ADC12 LED_BUILTIN_2
|
||||
pinCoil3 = PA8;
|
||||
/* = PA9 */ //TXD1
|
||||
/* = PA10 */ //RXD1
|
||||
|
@ -1366,7 +1378,7 @@ void setPinMapping(byte boardID)
|
|||
pinCoil4 = PB10; //TXD3
|
||||
pinIdle1 = PB11; //RXD3
|
||||
pinIdle2 = PB12; //
|
||||
/* pinBoost = PB12; */ //
|
||||
pinBoost = PB12; //
|
||||
/* = PB13; */ //SPI2_SCK
|
||||
/* = PB14; */ //SPI2_MISO
|
||||
/* = PB15; */ //SPI2_MOSI
|
||||
|
@ -1378,10 +1390,9 @@ void setPinMapping(byte boardID)
|
|||
pinTPS = PC1; //ADC123
|
||||
pinIAT = PC2; //ADC123
|
||||
pinCLT = PC3; //ADC123
|
||||
pinO2 = PC4; //ADC12
|
||||
/* = PC5; */ //ADC12
|
||||
/*pinVVT_1 = PC6; */ //
|
||||
pinBat = PC6; //
|
||||
pinO2 = PC4; //ADC12
|
||||
pinBat = PC5; //ADC12
|
||||
pinVVT_1 = PC6; //
|
||||
pinDisplayReset = PC7; //
|
||||
/* = PC8; */ //(DO NOT USE FOR SPEEDUINO) - SDIO_D0
|
||||
/* = PC9; */ //(DO NOT USE FOR SPEEDUINO) - SDIO_D1
|
||||
|
@ -1435,9 +1446,9 @@ void setPinMapping(byte boardID)
|
|||
/* = PE15; */ //
|
||||
|
||||
#elif defined(CORE_STM32)
|
||||
//blue pill wiki.stm32duino.com/index.php?title=Blue_Pill
|
||||
//Maple mini wiki.stm32duino.com/index.php?title=Maple_Mini
|
||||
//https://github.com/stm32duino/Arduino_Core_STM32/blob/master/variants/Generic_F411Cx/variant.h#L28
|
||||
//pins PA12, PA11 are used for USB or CAN couldn't be used for GPIO
|
||||
//pins PB12, PB13, PB14 and PB15 are used to SPI FLASH
|
||||
pinInjector1 = PB7; //Output pin injector 1 is on
|
||||
pinInjector2 = PB6; //Output pin injector 2 is on
|
||||
pinInjector3 = PB5; //Output pin injector 3 is on
|
||||
|
@ -1462,9 +1473,9 @@ void setPinMapping(byte boardID)
|
|||
pinFuelPump = PB10; //Fuel pump output
|
||||
pinTachOut = PC13; //Tacho output pin
|
||||
//external interrupt enabled pins
|
||||
pinFlex = PB1; // Flex sensor (Must be external interrupt enabled)
|
||||
pinTrigger = PB0; //The CAS pin
|
||||
pinTrigger2 = PB2; //The Cam Sensor pin
|
||||
pinFlex = PB2; // Flex sensor (Must be external interrupt enabled)
|
||||
pinTrigger = PB1; //The CAS pin
|
||||
pinTrigger2 = PB10; //The Cam Sensor pin
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
@ -2095,9 +2106,8 @@ void setPinMapping(byte boardID)
|
|||
pinIAT = PC2; //ADC123
|
||||
pinCLT = PC3; //ADC123
|
||||
pinO2 = PC4; //ADC12
|
||||
/* = PC5; */ //ADC12
|
||||
pinBat = PC5; //ADC12
|
||||
/*pinVVT_1 = PC6; */ //
|
||||
pinBat = PC6; //
|
||||
pinDisplayReset = PC7; //
|
||||
/* = PC8; */ //(DO NOT USE FOR SPEEDUINO) - SDIO_D0
|
||||
/* = PC9; */ //(DO NOT USE FOR SPEEDUINO) - SDIO_D1
|
||||
|
@ -2243,9 +2253,8 @@ void setPinMapping(byte boardID)
|
|||
pinIAT = PC2; //ADC123
|
||||
pinCLT = PC3; //ADC123
|
||||
pinO2 = PC4; //ADC12
|
||||
/* = PC5; */ //ADC12
|
||||
pinBat = PC5; //ADC12
|
||||
/*pinVVT_1 = PC6; */ //
|
||||
pinBat = PC6; //
|
||||
pinDisplayReset = PC7; //
|
||||
/* = PC8; */ //(DO NOT USE FOR SPEEDUINO) - SDIO_D0
|
||||
/* = PC9; */ //(DO NOT USE FOR SPEEDUINO) - SDIO_D1
|
||||
|
|
|
@ -70,6 +70,7 @@ extern void (*ign8EndFunction)();
|
|||
///@}
|
||||
|
||||
void initialiseSchedulers();
|
||||
void StartPriming();
|
||||
void setFuelSchedule1(unsigned long timeout, unsigned long duration);
|
||||
void setFuelSchedule2(unsigned long timeout, unsigned long duration);
|
||||
void setFuelSchedule3(unsigned long timeout, unsigned long duration);
|
||||
|
|
|
@ -758,6 +758,31 @@ void setIgnitionSchedule8(void (*startCallback)(), unsigned long timeout, unsign
|
|||
}
|
||||
}
|
||||
|
||||
extern void StartPriming()
|
||||
{
|
||||
//Perform the priming pulses. Set these to run at an arbitrary time in the future (100us). The prime pulse value is in ms*10, so need to multiple by 100 to get to uS
|
||||
unsigned long primingValue = table2D_getValue(&PrimingPulseTable, currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET);
|
||||
if( (primingValue > 0) && (currentStatus.TPS < configPage4.floodClear) )
|
||||
{
|
||||
setFuelSchedule1(100, (primingValue * 100 * 5)); //to acheive long enough priming pulses, the values in tuner studio are divided by 0.5 instead of 0.1, so multiplier of 5 is required.
|
||||
if ( configPage2.nInjectors > 1 ) { setFuelSchedule2(100, (primingValue * 100 * 5)); }
|
||||
if ( configPage2.nInjectors > 2 ) { setFuelSchedule3(100, (primingValue * 100 * 5)); }
|
||||
if ( configPage2.nInjectors > 3 ) { setFuelSchedule4(100, (primingValue * 100 * 5)); }
|
||||
#if (INJ_CHANNELS >= 5)
|
||||
if ( configPage2.nInjectors > 4 ) { setFuelSchedule5(100, (primingValue * 100 * 5)); }
|
||||
#endif
|
||||
#if (INJ_CHANNELS >= 6)
|
||||
if ( configPage2.nInjectors > 5 ) { setFuelSchedule6(100, (primingValue * 100 * 5)); }
|
||||
#endif
|
||||
#if (INJ_CHANNELS >= 7)
|
||||
if ( configPage2.nInjectors > 6 ) { setFuelSchedule7(100, (primingValue * 100 * 5)); }
|
||||
#endif
|
||||
#if (INJ_CHANNELS >= 8)
|
||||
if ( configPage2.nInjectors > 7 ) { setFuelSchedule8(100, (primingValue * 100 * 5)); }
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************************************************************************************************************************************/
|
||||
//This function (All 8 ISR functions that are below) gets called when either the start time or the duration time are reached
|
||||
//This calls the relevant callback function (startCallback or endCallback) depending on the status of the schedule.
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(FRAM_AS_EEPROM) && !defined(SRAM_AS_EEPROM)
|
||||
#if defined(USE_SPI_EEPROM) | defined(STM32F407xx) | defined(STM32F103xB)
|
||||
|
||||
#include "SPIAsEEPROM.h"
|
||||
|
@ -440,6 +441,6 @@ int8_t InternalSTM32F4_EEPROM_Class::eraseFlashSector(uint32_t address, uint32_t
|
|||
InternalSTM32F4_EEPROM_Class EEPROM(EmulatedEEPROMMconfig);
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -422,7 +422,7 @@ class InternalSTM32F4_EEPROM_Class : public FLASH_EEPROM_BaseClass
|
|||
|
||||
#if defined(USE_SPI_EEPROM)
|
||||
extern SPI_EEPROM_Class EEPROM;
|
||||
#elif defined(STM32F407xx) & !defined(SRAM_AS_EEPROM)
|
||||
#elif defined(STM32F407xx) && !defined(SRAM_AS_EEPROM)
|
||||
extern InternalSTM32F4_EEPROM_Class EEPROM;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -123,6 +123,9 @@ void oneMSInterval() //Most ARM chips can simply call a function
|
|||
lastRPM_100ms = currentStatus.RPM; //Record the current RPM for next calc
|
||||
if ( BIT_CHECK(currentStatus.engine, BIT_ENGINE_RUN) ) { runSecsX10++; }
|
||||
else { runSecsX10 = 0; }
|
||||
|
||||
if ( (fpPrimed == false) && (seclx10 == configPage2.primingDelay) ) { StartPriming(); }
|
||||
seclx10++;
|
||||
}
|
||||
|
||||
//Loop executed every 250ms loop (1ms x 250 = 250ms)
|
||||
|
|
Loading…
Reference in New Issue