OLED timer chart now updates with JSON timer changes

This commit is contained in:
rljonesau 2019-03-06 07:17:58 +11:00
parent 459f15054d
commit c10d8c4204
3 changed files with 11 additions and 0 deletions

View file

@ -57,6 +57,9 @@ CTimerChartScreen::onSelect()
bool bool
CTimerChartScreen::show() CTimerChartScreen::show()
{ {
if(CTimerManager::hasTimerChanged()) {
CTimerManager::condenseMap(condensed);
}
_display.clearDisplay(); _display.clearDisplay();
CTransientFont AF(_display, &miniFontInfo); // temporarily use a mini font CTransientFont AF(_display, &miniFontInfo); // temporarily use a mini font

View file

@ -40,6 +40,7 @@ int CTimerManager::activeTimer = 0;
int CTimerManager::activeDow = 0; int CTimerManager::activeDow = 0;
int CTimerManager::nextTimer = 0; int CTimerManager::nextTimer = 0;
int CTimerManager::nextStart = 0; int CTimerManager::nextStart = 0;
bool CTimerManager::timerChanged = false;
// create a bitmap that describes the pattern of on/off times // create a bitmap that describes the pattern of on/off times
void void
@ -205,6 +206,7 @@ CTimerManager::condenseMap(uint8_t timerMap[7][120])
timerMap[dow][opIndex++] = condense; timerMap[dow][opIndex++] = condense;
} }
} }
timerChanged = false;
} }
int int
@ -291,6 +293,7 @@ CTimerManager::setTimer(sTimer& timerInfo)
NVstore.save(); NVstore.save();
createMap(); createMap();
manageTime(0,0,0); manageTime(0,0,0);
timerChanged = true;
return 1; return 1;
} }
return 0; return 0;
@ -309,5 +312,8 @@ CTimerManager::conflictTest(int ID)
timerInfo.enabled = 0; // cancel enabled status if it conflicts with others timerInfo.enabled = 0; // cancel enabled status if it conflicts with others
CTimerManager::setTimer(timerInfo); // stage the timer settings, without being enabled CTimerManager::setTimer(timerInfo); // stage the timer settings, without being enabled
} }
createMap();
manageTime(0,0,0);
timerChanged = true;
return conflictID; return conflictID;
} }

View file

@ -49,6 +49,7 @@ public:
static int getNextTimer(); static int getNextTimer();
static void getTimer(int idx, sTimer& timerInfo); static void getTimer(int idx, sTimer& timerInfo);
static int setTimer(sTimer& timerInfo); static int setTimer(sTimer& timerInfo);
static bool hasTimerChanged() { return timerChanged; };
private: private:
static int activeTimer; static int activeTimer;
static int activeDow; static int activeDow;
@ -56,6 +57,7 @@ private:
static int nextTimer; static int nextTimer;
static int nextStart; static int nextStart;
static uint8_t weekTimerIDs[7][_dayMinutes]; // b[7] = repeat flag, b[3..0] = timer ID static uint8_t weekTimerIDs[7][_dayMinutes]; // b[7] = repeat flag, b[3..0] = timer ID
static bool timerChanged;
}; };
#endif //__TIMERMANAGER_H__ #endif //__TIMERMANAGER_H__