RAM cleanup of the schedule structs
This commit is contained in:
parent
de8b563028
commit
e449f319c2
|
@ -109,27 +109,33 @@ struct Schedule {
|
|||
unsigned int nextEndCompare;
|
||||
volatile bool hasNextSchedule = false;
|
||||
volatile bool endScheduleSetByDecoder = false;
|
||||
#if defined(CORE_AVR) || defined(CORE_TEENSY40)
|
||||
volatile uint16_t * counter;
|
||||
volatile uint16_t * compare;
|
||||
#else
|
||||
volatile uint32_t * counter;
|
||||
volatile uint32_t * compare;
|
||||
#endif
|
||||
};
|
||||
|
||||
//Fuel schedules don't use the callback pointers, or the startTime/endScheduleSetByDecoder variables. They are removed in this struct to save RAM
|
||||
struct FuelSchedule {
|
||||
volatile unsigned long duration;
|
||||
volatile ScheduleStatus Status;
|
||||
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;
|
||||
|
||||
unsigned int nextStartCompare;
|
||||
unsigned int nextEndCompare;
|
||||
volatile bool hasNextSchedule = false;
|
||||
};
|
||||
|
||||
//volatile Schedule *timer3Aqueue[4];
|
||||
//Schedule *timer3Bqueue[4];
|
||||
//Schedule *timer3Cqueue[4];
|
||||
|
||||
Schedule fuelSchedule1;
|
||||
Schedule fuelSchedule2;
|
||||
Schedule fuelSchedule3;
|
||||
Schedule fuelSchedule4;
|
||||
Schedule fuelSchedule5;
|
||||
Schedule fuelSchedule6;
|
||||
Schedule fuelSchedule7;
|
||||
Schedule fuelSchedule8;
|
||||
FuelSchedule fuelSchedule1;
|
||||
FuelSchedule fuelSchedule2;
|
||||
FuelSchedule fuelSchedule3;
|
||||
FuelSchedule fuelSchedule4;
|
||||
FuelSchedule fuelSchedule5;
|
||||
FuelSchedule fuelSchedule6;
|
||||
FuelSchedule fuelSchedule7;
|
||||
FuelSchedule fuelSchedule8;
|
||||
|
||||
Schedule ignitionSchedule1;
|
||||
Schedule ignitionSchedule2;
|
||||
|
@ -140,7 +146,7 @@ Schedule ignitionSchedule6;
|
|||
Schedule ignitionSchedule7;
|
||||
Schedule ignitionSchedule8;
|
||||
|
||||
Schedule 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
|
||||
//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 unsigned int setQueue(volatile Schedule *queue[], Schedule *schedule1, Schedule *schedule2, unsigned int CNT)
|
||||
{
|
||||
|
@ -203,7 +209,7 @@ static inline unsigned int popQueue(volatile Schedule *queue[])
|
|||
queue[0] = queue[1];
|
||||
queue[1] = queue[2];
|
||||
queue[2] = queue[3];
|
||||
queue[3] = &nullSchedule;
|
||||
//queue[3] = &nullSchedule;
|
||||
|
||||
unsigned int returnCompare;
|
||||
if( queue[0]->Status == PENDING ) { returnCompare = queue[0]->startCompare; }
|
||||
|
|
|
@ -11,7 +11,7 @@ A full copy of the license may be found in the projects root directory
|
|||
|
||||
void initialiseSchedulers()
|
||||
{
|
||||
nullSchedule.Status = OFF;
|
||||
//nullSchedule.Status = OFF;
|
||||
|
||||
fuelSchedule1.Status = OFF;
|
||||
fuelSchedule2.Status = OFF;
|
||||
|
@ -31,31 +31,6 @@ void initialiseSchedulers()
|
|||
fuelSchedule7.schedulesSet = 0;
|
||||
fuelSchedule8.schedulesSet = 0;
|
||||
|
||||
fuelSchedule1.counter = &FUEL1_COUNTER;
|
||||
fuelSchedule1.compare = &FUEL1_COMPARE;
|
||||
fuelSchedule2.counter = &FUEL2_COUNTER;
|
||||
fuelSchedule2.compare = &FUEL2_COMPARE;
|
||||
fuelSchedule3.counter = &FUEL3_COUNTER;
|
||||
fuelSchedule3.compare = &FUEL3_COMPARE;
|
||||
fuelSchedule4.counter = &FUEL4_COUNTER;
|
||||
fuelSchedule4.compare = &FUEL4_COMPARE;
|
||||
#if (INJ_CHANNELS >= 5)
|
||||
fuelSchedule5.counter = &FUEL5_COUNTER;
|
||||
fuelSchedule5.compare = &FUEL5_COMPARE;
|
||||
#endif
|
||||
#if (INJ_CHANNELS >= 6)
|
||||
fuelSchedule6.counter = &FUEL6_COUNTER;
|
||||
fuelSchedule6.compare = &FUEL6_COMPARE;
|
||||
#endif
|
||||
#if (INJ_CHANNELS >= 7)
|
||||
fuelSchedule7.counter = &FUEL7_COUNTER;
|
||||
fuelSchedule7.compare = &FUEL7_COMPARE;
|
||||
#endif
|
||||
#if (INJ_CHANNELS >= 8)
|
||||
fuelSchedule8.counter = &FUEL8_COUNTER;
|
||||
fuelSchedule8.compare = &FUEL8_COMPARE;
|
||||
#endif
|
||||
|
||||
ignitionSchedule1.Status = OFF;
|
||||
ignitionSchedule2.Status = OFF;
|
||||
ignitionSchedule3.Status = OFF;
|
||||
|
@ -78,32 +53,6 @@ void initialiseSchedulers()
|
|||
ignitionSchedule6.schedulesSet = 0;
|
||||
ignitionSchedule7.schedulesSet = 0;
|
||||
ignitionSchedule8.schedulesSet = 0;
|
||||
|
||||
ignitionSchedule1.counter = &IGN1_COUNTER;
|
||||
ignitionSchedule1.compare = &IGN1_COMPARE;
|
||||
ignitionSchedule2.counter = &IGN2_COUNTER;
|
||||
ignitionSchedule2.compare = &IGN2_COMPARE;
|
||||
ignitionSchedule3.counter = &IGN3_COUNTER;
|
||||
ignitionSchedule3.compare = &IGN3_COMPARE;
|
||||
ignitionSchedule4.counter = &IGN4_COUNTER;
|
||||
ignitionSchedule4.compare = &IGN4_COMPARE;
|
||||
#if (IGN_CHANNELS >= 5)
|
||||
ignitionSchedule5.counter = &IGN5_COUNTER;
|
||||
ignitionSchedule5.compare = &IGN5_COMPARE;
|
||||
#endif
|
||||
#if (IGN_CHANNELS >= 6)
|
||||
ignitionSchedule6.counter = &IGN6_COUNTER;
|
||||
ignitionSchedule6.compare = &IGN6_COMPARE;
|
||||
#endif
|
||||
#if (IGN_CHANNELS >= 7)
|
||||
ignitionSchedule7.counter = &IGN7_COUNTER;
|
||||
ignitionSchedule7.compare = &IGN7_COMPARE;
|
||||
#endif
|
||||
#if (IGN_CHANNELS >= 8)
|
||||
ignitionSchedule8.counter = &IGN8_COUNTER;
|
||||
ignitionSchedule8.compare = &IGN8_COMPARE;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -117,6 +66,7 @@ endCallback: This function is called once the duration time has been reached
|
|||
*/
|
||||
|
||||
//Experimental new generic function
|
||||
/*
|
||||
void setFuelSchedule(struct Schedule *targetSchedule, unsigned long timeout, unsigned long duration)
|
||||
{
|
||||
if(targetSchedule->Status != RUNNING) //Check that we're not already part way through a schedule
|
||||
|
@ -151,6 +101,7 @@ void setFuelSchedule(struct Schedule *targetSchedule, unsigned long timeout, uns
|
|||
targetSchedule->hasNextSchedule = true;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
//void setFuelSchedule1(void (*startCallback)(), unsigned long timeout, unsigned long duration, void(*endCallback)())
|
||||
|
|
Loading…
Reference in New Issue