1 #include "EventsSequencer.hpp" 3 #ifndef NO_EVENTSSEQUENCER 13 this->pNextSequencer = NULL;
14 if (this->pFirstSequencer == NULL)
15 this->pFirstSequencer =
this;
17 this->GetLastSequencer()->pNextSequencer =
this;
22 #ifdef COMMANDERS_DEBUG_MODE 25 Serial.println(F(
"Warning : a PROGMEM event list is already defined !"));
29 pNew->delay = inDelay;
37 this->GetLastItem()->SetNext(pNew);
42 #ifdef COMMANDERS_DEBUG_MODE 45 Serial.println(F(
"Warning : an event list is already defined !"));
58 while (curr != NULL && curr->GetNext() != NULL)
59 curr = curr->GetNext();
69 apLocal->next = this->
pFirst + 1;
94 this->GetCurrentItem(&item);
96 this->startDate = millis();
99 bool EventsSequencer::IsCurrentItemLast()
104 this->GetCurrentItem(&item);
110 this->GetCurrentItem(&item);
118 if (this->
pCurrent->GetNext() == NULL)
131 this->GetCurrentItem(&item);
133 if (millis() - this->startDate < item.GetDelay())
136 if (this->IsCurrentItemLast())
155 while (curr != NULL && curr->GetNextSequencer() != NULL)
156 curr = curr->GetNextSequencer();
166 if (!curr->IsPaused())
168 curr = curr->GetNextSequencer();
172 #ifdef COMMANDERS_PRINT_COMMANDERS 175 Serial.print(F(
" Sequencer "));
176 Serial.println((
long)
this, HEX);
180 pItem = this->GetFirstItem(&item);
184 Serial.print(F(
" Event - Id: "));
185 Serial.print(pItem->id);
186 Serial.print(F(
" / type: "));
189 Serial.print(F(
" / delay: "));
190 Serial.print(pItem->delay);
191 Serial.println(F(
""));
197 pItem->next = pNext + 1;
209 curr->printSequencer();
210 curr = curr->GetNextSequencer();
static void printEventType(COMMANDERS_EVENT_TYPE inEventType, bool inDataFollow)
static unsigned long RaiseEvent(unsigned long inId, COMMANDERS_EVENT_TYPE inEvent = COMMANDERS_EVENT_MOVEPOSITIONID, int inData = 0)
static void printAllSequencers()
void StartItem(EventsSequencerItem *inItem = NULL)
void AddEvents(const EventsSequencerItem *apEvents)
void AddEvent(unsigned long inId, COMMANDERS_EVENT_TYPE inType, int inData, unsigned long inDelay)
EventsSequencerItem * pCurrent
EventsSequencerItem * pFirst
static void printEventData(COMMANDERS_EVENT_TYPE inEventType, int inEventData)