Added page method leavePage() for e.g. cleanup and storage code

This commit is contained in:
Thomas Hooge 2025-08-14 15:11:13 +02:00
parent 992348ce92
commit 2749f25d15
4 changed files with 14 additions and 4 deletions

View File

@ -62,6 +62,7 @@ sdmmc_card_t *sdcard;
bool hasSDCard = false;
// Global vars
bool heartbeat = false; // Heartbeat indicator with two different states
bool blinkingLED = false; // Enable / disable blinking flash LED
bool statusLED = false; // Actual status of flash LED on/off
bool statusBacklightLED = false;// Actual status of flash LED on/off
@ -459,7 +460,6 @@ void displayTrendLow(int16_t x, int16_t y, uint16_t size, uint16_t color){
// Show header informations
void displayHeader(CommonData &commonData, bool symbolmode, GwApi::BoatValue *date, GwApi::BoatValue *time, GwApi::BoatValue *hdop){
static bool heartbeat = false;
static unsigned long usbRxOld = 0;
static unsigned long usbTxOld = 0;
static unsigned long serRxOld = 0;

View File

@ -38,6 +38,8 @@ extern bool hasSDCard;
extern sdmmc_card_t *sdcard;
#endif
extern bool heartbeat;
// Fonts declarations for display (#includes see OBP60Extensions.cpp)
extern const GFXfont DSEG7Classic_BoldItalic16pt7b;
extern const GFXfont DSEG7Classic_BoldItalic20pt7b;

View File

@ -291,8 +291,15 @@ public:
return PAGE_UPDATE;
};
void leavePage(PageData &pageData) {
logger->logDebug(GwLog::LOG, "Leaving PageFourvalues");
}
};
static Page *createPage(CommonData &common){
return new PageFourValues(common);
}/**

View File

@ -973,12 +973,13 @@ void OBP60Task(GwApi *api){
epd->print("Here be dragons!");
epd->nextPage(); // Partial update (fast)
}
else{
else {
if (lastPage != pageNumber){
if (hasFRAM) fram.write(FRAM_PAGE_NO, pageNumber); // remember page for device restart
pages[lastPage].page->leavePage(pages[lastPage].parameters); // call page cleanup code
if (hasFRAM) fram.write(FRAM_PAGE_NO, pageNumber); // remember new page for device restart
currentPage->setupKeys();
currentPage->displayNew(pages[pageNumber].parameters);
lastPage=pageNumber;
lastPage = pageNumber;
}
//call the page code
LOG_DEBUG(GwLog::DEBUG,"calling page %d",pageNumber);