diff --git a/RMFT2.cpp b/RMFT2.cpp index d03efbf..681ec7c 100644 --- a/RMFT2.cpp +++ b/RMFT2.cpp @@ -28,7 +28,7 @@ F8. Park/unpark */ /* EXRAILPlus planned TRANSPARENT additions - T1. RAM based fast lookup for sequences ON* event catchers and signals. + [DONE]T1. RAM based fast lookup for sequences ON* event catchers and signals. T2. Extend to >64k */ @@ -74,7 +74,7 @@ LookList * RMFT2::sequenceLookup=NULL; LookList * RMFT2::signalLookup=NULL; LookList * RMFT2::onThrowLookup=NULL; LookList * RMFT2::onCloseLookup=NULL; - + #define GET_OPCODE GETFLASH(RMFT2::RouteCode+progCounter) #define GET_OPERAND(n) GETFLASHW(RMFT2::RouteCode+progCounter+1+(n*3)) #define SKIPOP progCounter+=3 @@ -85,16 +85,18 @@ LookList * RMFT2::onCloseLookup=NULL; m_loaded=0; if (size) { m_lookupArray=new int16_t[size]; - m_resultArray=new int32_t[size]; + m_resultArray=new int16_t[size]; } } - void LookList::add(int16_t lookup, int32_t result) { + + void LookList::add(int16_t lookup, int16_t result) { if (m_loaded==m_size) return; // and forget m_lookupArray[m_loaded]=lookup; m_resultArray[m_loaded]=result; m_loaded++; } - int32_t LookList::find(int16_t value) { + + int16_t LookList::find(int16_t value) { for (int16_t i=0;iadd(0,0); // add default start sequence SKIPOP; // include ENDROUTES opcode DIAG(F("EXRAIL %db, fl=%d seq=%d, sig=%d, onT=%d, onC=%d"), @@ -491,9 +492,7 @@ void RMFT2::loop() { // Round Robin call to a RMFT task each time if (loopTask==NULL) return; - loopTask=loopTask->next; - if (pausingTask==NULL || pausingTask==loopTask) loopTask->loop2(); } diff --git a/RMFT2.h b/RMFT2.h index 0abacce..4194fb9 100644 --- a/RMFT2.h +++ b/RMFT2.h @@ -60,14 +60,14 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE, class LookList { public: - LookList(int16_t size); - void add(int16_t lookup, int32_t result); - int32_t find(int16_t value); - private: + LookList(int16_t size); + void add(int16_t lookup, int16_t result); + int16_t find(int16_t value); + private: int16_t m_size; int16_t m_loaded; int16_t * m_lookupArray; - int32_t * m_resultArray; + int16_t * m_resultArray; }; class RMFT2 {