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; bool hasSDCard = false;
// Global vars // Global vars
bool heartbeat = false; // Heartbeat indicator with two different states
bool blinkingLED = false; // Enable / disable blinking flash LED bool blinkingLED = false; // Enable / disable blinking flash LED
bool statusLED = false; // Actual status of flash LED on/off bool statusLED = false; // Actual status of flash LED on/off
bool statusBacklightLED = 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 // Show header informations
void displayHeader(CommonData &commonData, bool symbolmode, GwApi::BoatValue *date, GwApi::BoatValue *time, GwApi::BoatValue *hdop){ 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 usbRxOld = 0;
static unsigned long usbTxOld = 0; static unsigned long usbTxOld = 0;
static unsigned long serRxOld = 0; static unsigned long serRxOld = 0;

View File

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

View File

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

View File

@ -975,7 +975,8 @@ void OBP60Task(GwApi *api){
} }
else { else {
if (lastPage != pageNumber){ 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->setupKeys();
currentPage->displayNew(pages[pageNumber].parameters); currentPage->displayNew(pages[pageNumber].parameters);
lastPage = pageNumber; lastPage = pageNumber;