Fixes for STM crash

This commit is contained in:
VitorBoss 2018-03-18 03:26:12 -03:00
parent 4a532a7a80
commit 7e19e6c4ad
3 changed files with 16 additions and 6 deletions

View File

@ -36,12 +36,12 @@
#endif
//Specific mode for Bluepill due to its small flash size. This disables a number of strings from being compiled into the flash
#if defined(MCU_STM32F103C8)
#if defined(MCU_STM32F103C8) | defined(MCU_STM32F103CB)
#define SMALL_FLASH_MODE
#endif
extern "C" char* sbrk(int incr); //Used to freeRam
//inline unsigned char digitalPinToInterrupt(unsigned char Interrupt_pin) { return Interrupt_pin; } //This isn't included in the stm32duino libs (yet)
inline unsigned char digitalPinToInterrupt(unsigned char Interrupt_pin) { return Interrupt_pin; } //This isn't included in the stm32duino libs (yet)
#if defined(ARDUINO_ARCH_STM32) // STM32GENERIC core
#define portOutputRegister(port) (volatile byte *)( &(port->ODR) )
#define portInputRegister(port) (volatile byte *)( &(port->IDR) )

View File

@ -246,10 +246,18 @@ void initialiseSchedulers()
fuelSchedule2.counter = &FUEL2_COUNTER;
fuelSchedule3.counter = &FUEL3_COUNTER;
fuelSchedule4.counter = &FUEL4_COUNTER;
#if (INJ_CHANNELS >= 5)
fuelSchedule5.counter = &FUEL5_COUNTER;
fuelSchedule6.counter = &FUEL6_COUNTER;
fuelSchedule7.counter = &FUEL7_COUNTER;
fuelSchedule8.counter = &FUEL8_COUNTER;
#endif
#if (INJ_CHANNELS >= 6)
fuelSchedule5.counter = &FUEL6_COUNTER;
#endif
#if (INJ_CHANNELS >= 7)
fuelSchedule5.counter = &FUEL7_COUNTER;
#endif
#if (INJ_CHANNELS >= 8)
fuelSchedule5.counter = &FUEL8_COUNTER;
#endif
ignitionSchedule1.Status = OFF;
ignitionSchedule2.Status = OFF;
@ -478,6 +486,7 @@ void setFuelSchedule4(unsigned long timeout, unsigned long duration) //Uses time
}
}
#if INJ_CHANNELS >= 5
void setFuelSchedule5(void (*startCallback)(), unsigned long timeout, unsigned long duration, void(*endCallback)())
{
if(fuelSchedule5.Status != RUNNING) //Check that we're not already part way through a schedule
@ -509,6 +518,7 @@ void setFuelSchedule5(void (*startCallback)(), unsigned long timeout, unsigned l
fuelSchedule5.hasNextSchedule = true;
}
}
#endif
#if INJ_CHANNELS >= 6
//This uses timer

View File

@ -40,7 +40,7 @@ void initialiseTimers()
lowResTimer.begin(oneMSInterval, 1000);
#elif defined(CORE_STM32)
#ifndef SMALL_FLASH_MODE
#if defined(ARDUINO_BLACK_F407VE) || defined(STM32F4) || defined(_STM32F4_)
Timer8.setPeriod(1000); // Set up period
Timer8.setMode(1, TIMER_OUTPUT_COMPARE);
Timer8.attachInterrupt(1, oneMSInterval);