Bug fix: Pointers to Idle pins/port must always be initialized. (#375)
* pointers to Idle pins must always be initialized. This is good practice. But this also gave problems with internal flash as EEPROM on STM32 otherwise. * cleanup
This commit is contained in:
parent
113247f005
commit
cbb9c339c7
|
@ -23,6 +23,12 @@ void initialiseIdle()
|
|||
//By default, turn off the PWM interrupt (It gets turned on below if needed)
|
||||
IDLE_TIMER_DISABLE();
|
||||
|
||||
//pins must always be initialized.
|
||||
idle_pin_port = portOutputRegister(digitalPinToPort(pinIdle1));
|
||||
idle_pin_mask = digitalPinToBitMask(pinIdle1);
|
||||
idle2_pin_port = portOutputRegister(digitalPinToPort(pinIdle2));
|
||||
idle2_pin_mask = digitalPinToBitMask(pinIdle2);
|
||||
|
||||
//Initialising comprises of setting the 2D tables with the relevant values from the config pages
|
||||
switch(configPage6.iacAlgorithm)
|
||||
{
|
||||
|
@ -54,10 +60,6 @@ void initialiseIdle()
|
|||
iacCrankDutyTable.values = configPage6.iacCrankDuty;
|
||||
iacCrankDutyTable.axisX = configPage6.iacCrankBins;
|
||||
|
||||
idle_pin_port = portOutputRegister(digitalPinToPort(pinIdle1));
|
||||
idle_pin_mask = digitalPinToBitMask(pinIdle1);
|
||||
idle2_pin_port = portOutputRegister(digitalPinToPort(pinIdle2));
|
||||
idle2_pin_mask = digitalPinToBitMask(pinIdle2);
|
||||
#if defined(CORE_AVR)
|
||||
idle_pwm_max_count = 1000000L / (16 * configPage6.idleFreq * 2); //Converts the frequency in Hz to the number of ticks (at 16uS) it takes to complete 1 cycle. Note that the frequency is divided by 2 coming from TS to allow for up to 512hz
|
||||
#elif defined(CORE_TEENSY)
|
||||
|
@ -80,10 +82,6 @@ void initialiseIdle()
|
|||
iacCrankDutyTable.values = configPage6.iacCrankDuty;
|
||||
iacCrankDutyTable.axisX = configPage6.iacCrankBins;
|
||||
|
||||
idle_pin_port = portOutputRegister(digitalPinToPort(pinIdle1));
|
||||
idle_pin_mask = digitalPinToBitMask(pinIdle1);
|
||||
idle2_pin_port = portOutputRegister(digitalPinToPort(pinIdle2));
|
||||
idle2_pin_mask = digitalPinToBitMask(pinIdle2);
|
||||
#if defined(CORE_AVR)
|
||||
idle_pwm_max_count = 1000000L / (16 * configPage6.idleFreq * 2); //Converts the frequency in Hz to the number of ticks (at 16uS) it takes to complete 1 cycle. Note that the frequency is divided by 2 coming from TS to allow for up to 512hz
|
||||
#elif defined(CORE_TEENSY)
|
||||
|
|
Loading…
Reference in New Issue