Compare commits

...

8 Commits

Author SHA1 Message Date
Thomas Hooge 1174622b4a System page for OBP40 and deep sleep improvements 2025-01-24 12:44:10 +01:00
Norbert Walter a9525676b2
Merge pull request #149 from thooge/master
Fix for OBP40 in page system and deepSleep
2025-01-24 10:07:24 +01:00
Thomas Hooge 46af8916e7 Fix for OBP40 in page system and deepSleep 2025-01-24 08:06:26 +01:00
norbert-walter b4ebec872d Merge remote-tracking branch 'origin/master' 2025-01-23 22:55:47 +01:00
norbert-walter 78b5861da4 Typo 2025-01-23 22:55:35 +01:00
Norbert Walter d6a7323600
Merge pull request #148 from thooge/system
Deep sleep for OBP60 and small fix for BMP180
2025-01-23 22:51:52 +01:00
Norbert Walter db4547ac3f
Merge pull request #146 from thooge/refresh
Improved page refresh possibilities and page white
2025-01-23 22:47:30 +01:00
Thomas Hooge 44cb8d35ce Improved page refresh possibilities and page white 2025-01-22 12:07:00 +01:00
8 changed files with 169 additions and 80 deletions

View File

@ -146,6 +146,32 @@ void deepSleep(CommonData &common){
getdisplay().powerOff(); // Display power off getdisplay().powerOff(); // Display power off
setPortPin(OBP_POWER_50, false); // Power off ePaper display setPortPin(OBP_POWER_50, false); // Power off ePaper display
// Stop system // Stop system
esp_deep_sleep_start(); // Deep Sleep with weakup via touch pin
}
#endif
#ifdef BOARD_OBP40S3
// Deep sleep funktion
void deepSleep(CommonData &common){
RTC_lastpage = common.data.actpage - 1;
// Switch off all power lines
setPortPin(OBP_BACKLIGHT_LED, false); // Backlight Off
setFlashLED(false); // Flash LED Off
// Shutdown EInk display
getdisplay().setFullWindow(); // Set full Refresh
//getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
getdisplay().fillScreen(common.bgcolor); // Clear screen
getdisplay().setTextColor(common.fgcolor);
getdisplay().setFont(&Ubuntu_Bold20pt7b);
getdisplay().setCursor(85, 150);
getdisplay().print("Sleep Mode");
getdisplay().setFont(&Ubuntu_Bold8pt7b);
getdisplay().setCursor(65, 175);
getdisplay().print("For wakeup press wheel and wait 5s");
getdisplay().nextPage(); // Partial update
getdisplay().powerOff(); // Display power off
setPortPin(OBP_POWER_EPD, false); // Power off ePaper display
setPortPin(OBP_POWER_SD, false); // Power off SD card
// Stop system
esp_deep_sleep_start(); // Deep Sleep with weakup via GPIO pin esp_deep_sleep_start(); // Deep Sleep with weakup via GPIO pin
} }
#endif #endif

View File

@ -64,9 +64,7 @@ Point rotatePoint(const Point& origin, const Point& p, double angle);
std::vector<Point> rotatePoints(const Point& origin, const std::vector<Point>& pts, double angle); std::vector<Point> rotatePoints(const Point& origin, const std::vector<Point>& pts, double angle);
void fillPoly4(const std::vector<Point>& p4, uint16_t color); void fillPoly4(const std::vector<Point>& p4, uint16_t color);
#ifdef BOARD_OBP60S3
void deepSleep(CommonData &common); void deepSleep(CommonData &common);
#endif
uint8_t getLastPage(); uint8_t getLastPage();

View File

@ -60,7 +60,7 @@ void initKeys(CommonData &commonData) {
#ifdef HARDWARE_V21 #ifdef HARDWARE_V21
// Keypad functions for original OBP60 hardware // Keypad functions for original OBP60 hardware
int readKeypad(GwLog* logger, uint thSensitivity) { int readKeypad(GwLog* logger, uint thSensitivity, bool use_syspage) {
// Touch sensor values // Touch sensor values
// 35000 - Not touched // 35000 - Not touched
@ -261,7 +261,7 @@ void initKeys(CommonData &commonData) {
} }
// Keypad functions for OBP60 clone (thSensitivity is inactiv) // Keypad functions for OBP60 clone (thSensitivity is inactiv)
int readKeypad(GwLog* logger, uint thSensitivity) { int readKeypad(GwLog* logger, uint thSensitivity, bool use_syspage) {
pinMode(UP, INPUT); pinMode(UP, INPUT);
pinMode(DOWN, INPUT); pinMode(DOWN, INPUT);
pinMode(CONF, INPUT); pinMode(CONF, INPUT);
@ -279,7 +279,11 @@ void initKeys(CommonData &commonData) {
} }
// If key pressed longer than 200ms // If key pressed longer than 200ms
if(millis() > starttime + 200 && keycode == keycodeold) { if(millis() > starttime + 200 && keycode == keycodeold) {
if (use_syspage and keycode == 3) {
keystatus = 12;
} else {
keystatus = keycode; keystatus = keycode;
}
// Copy keycode // Copy keycode
keycodeold = keycode; keycodeold = keycode;
while(readSensorpads() > 0){} // Wait for pad release while(readSensorpads() > 0){} // Wait for pad release

View File

@ -4,6 +4,7 @@
#include "OBP60Extensions.h" #include "OBP60Extensions.h"
#include "images/logo64.xbm" #include "images/logo64.xbm"
#include <esp32/clk.h> #include <esp32/clk.h>
#include "qrcode.h"
#define STRINGIZE_IMPL(x) #x #define STRINGIZE_IMPL(x) #x
#define STRINGIZE(x) STRINGIZE_IMPL(x) #define STRINGIZE(x) STRINGIZE_IMPL(x)
@ -66,7 +67,8 @@ public:
if (hasFRAM) fram.write(FRAM_SYSTEM_MODE, mode); if (hasFRAM) fram.write(FRAM_SYSTEM_MODE, mode);
return 0; return 0;
} }
// grab cursor keys to disable page navigation #ifdef BOARD_OBP60S3
// grab cursor key to disable page navigation
if (key == 3) { if (key == 3) {
return 0; return 0;
} }
@ -83,9 +85,46 @@ public:
commonData->keylock = !commonData->keylock; commonData->keylock = !commonData->keylock;
return 0; return 0;
} }
#endif
#ifdef BOARD_OBP40S3
// grab cursor keys to disable page navigation
if (key == 9 or key == 10) {
return 0;
}
// standby / deep sleep
if (key == 12) {
deepSleep(*commonData);
}
#endif
return key; return key;
} }
void displayBarcode(String serialno, uint16_t x, uint16_t y, uint16_t s) {
// Barcode with serial number
// x, y is top left corner
// s is pixel size of a single box
QRCode qrcode;
uint8_t qrcodeData[qrcode_getBufferSize(4)];
#ifdef BOARD_OBP40S3
String prefix = "OBP40:SN:";
#endif
#ifdef BOARD_OBP60S3
String prefix = "OBP60:SN:";
#endif
qrcode_initText(&qrcode, qrcodeData, 4, 0, (prefix + serialno).c_str());
int16_t x0 = x;
for (uint8_t j = 0; j < qrcode.size; j++) {
for (uint8_t i = 0; i < qrcode.size; i++) {
if (qrcode_getModule(&qrcode, i, j)) {
getdisplay().fillRect(x, y, s, s, commonData->fgcolor);
}
x += s;
}
y += s;
x = x0;
}
}
virtual void displayPage(PageData &pageData){ virtual void displayPage(PageData &pageData){
GwConfigHandler *config = commonData->config; GwConfigHandler *config = commonData->config;
GwLog *logger = commonData->logger; GwLog *logger = commonData->logger;
@ -112,30 +151,36 @@ public:
if (mode == 'N') { if (mode == 'N') {
getdisplay().setFont(&Ubuntu_Bold12pt7b); getdisplay().setFont(&Ubuntu_Bold12pt7b);
getdisplay().setCursor(20, 50); getdisplay().setCursor(8, 50);
getdisplay().print("System Information"); getdisplay().print("System Information");
getdisplay().drawXBitmap(320, 25, logo64_bits, logo64_width, logo64_height, commonData->fgcolor); getdisplay().drawXBitmap(320, 25, logo64_bits, logo64_width, logo64_height, commonData->fgcolor);
getdisplay().setFont(&Ubuntu_Bold8pt7b); getdisplay().setFont(&Ubuntu_Bold8pt7b);
char ssid[23]; char ssid[13];
snprintf(ssid, 23, "MCUDEVICE-%04X%08X", (uint16_t)(chipid >> 32), (uint32_t)chipid); snprintf(ssid, 13, "%04X%08X", (uint16_t)(chipid >> 32), (uint32_t)chipid);
getdisplay().setCursor(20, 70); displayBarcode(String(ssid), 320, 200, 2);
getdisplay().print(ssid); getdisplay().setCursor(8, 70);
getdisplay().setCursor(20, 100); getdisplay().print(String("MUDEVICE-") + String(ssid));
getdisplay().print("Press STBY for white page and standby");
getdisplay().setCursor(8, 90);
getdisplay().print("Firmware Version: ");
getdisplay().print(VERSINFO);
getdisplay().setCursor(8, 265);
#ifdef BOARD_OBP60S3
getdisplay().print("Press STBY to enter deep sleep mode");
#endif
#ifdef BOARD_OBP40S3
getdisplay().print("Press wheel to enter deep sleep mode");
#endif
getdisplay().setCursor(2, y0); getdisplay().setCursor(2, y0);
getdisplay().print("Simulation:"); getdisplay().print("Simulation:");
getdisplay().setCursor(120, y0); getdisplay().setCursor(120, y0);
getdisplay().print(simulation ? "on" : "off"); getdisplay().print(simulation ? "on" : "off");
getdisplay().setCursor(202, y0);
getdisplay().print("Wifi:");
getdisplay().setCursor(300, y0);
getdisplay().print(commonData->status.wifiApOn ? "On" : "Off");
getdisplay().setCursor(2, y0 + 16); getdisplay().setCursor(2, y0 + 16);
getdisplay().print("Environment:"); getdisplay().print("Environment:");
getdisplay().setCursor(120, y0 + 16); getdisplay().setCursor(120, y0 + 16);
@ -143,9 +188,9 @@ public:
// total RAM free // total RAM free
int Heap_free = esp_get_free_heap_size(); int Heap_free = esp_get_free_heap_size();
getdisplay().setCursor(202, y0 + 16); getdisplay().setCursor(202, y0);
getdisplay().print("Total free:"); getdisplay().print("Total free:");
getdisplay().setCursor(300, y0 + 16); getdisplay().setCursor(300, y0);
getdisplay().print(String(Heap_free)); getdisplay().print(String(Heap_free));
getdisplay().setCursor(2, y0 + 32); getdisplay().setCursor(2, y0 + 32);
@ -155,37 +200,39 @@ public:
// RAM free for task // RAM free for task
int RAM_free = uxTaskGetStackHighWaterMark(NULL); int RAM_free = uxTaskGetStackHighWaterMark(NULL);
getdisplay().setCursor(202, y0 + 32); getdisplay().setCursor(202, y0 + 16);
getdisplay().print("Task free:"); getdisplay().print("Task free:");
getdisplay().setCursor(300, y0 + 32); getdisplay().setCursor(300, y0 + 16);
getdisplay().print(String(RAM_free)); getdisplay().print(String(RAM_free));
getdisplay().setCursor(2, y0 + 48); // FRAM available / status
getdisplay().setCursor(202, y0 + 32);
getdisplay().print("FRAM:");
getdisplay().setCursor(300, y0 + 32);
getdisplay().print(hasFRAM ? "available" : "not found");
getdisplay().setCursor(202, y0 + 64);
getdisplay().print("CPU speed:"); getdisplay().print("CPU speed:");
getdisplay().setCursor(120, y0 + 48); getdisplay().setCursor(300, y0 + 64);
getdisplay().print(cpuspeed); getdisplay().print(cpuspeed);
getdisplay().print(" / "); getdisplay().print(" / ");
int cpu_freq = esp_clk_cpu_freq() / 1000000; int cpu_freq = esp_clk_cpu_freq() / 1000000;
getdisplay().print(String(cpu_freq)); getdisplay().print(String(cpu_freq));
getdisplay().setCursor(202, y0 + 64); getdisplay().setCursor(2, y0 + 64);
getdisplay().print("GPS:"); getdisplay().print("GPS:");
getdisplay().setCursor(300, y0 + 64); getdisplay().setCursor(120, y0 + 64);
getdisplay().print(gps_module); getdisplay().print(gps_module);
getdisplay().setCursor(2, y0 + 80); getdisplay().setCursor(2, y0 + 80);
getdisplay().print("FRAM:");
getdisplay().setCursor(120, y0 + 80);
getdisplay().print(hasFRAM ? "available" : "not found");
getdisplay().setCursor(202, y0 + 80);
getdisplay().print("RTC:"); getdisplay().print("RTC:");
getdisplay().setCursor(300, y0 + 80); getdisplay().setCursor(120, y0 + 80);
getdisplay().print(rtc_module); getdisplay().print(rtc_module);
getdisplay().setCursor(2, y0 + 120); getdisplay().setCursor(2, y0 + 96);
getdisplay().print("Firmware Version: "); getdisplay().print("Wifi:");
getdisplay().print(VERSINFO); getdisplay().setCursor(120, y0 + 96);
getdisplay().print(commonData->status.wifiApOn ? "On" : "Off");
} else { } else {

View File

@ -13,6 +13,7 @@ public:
PageWhite(CommonData &common){ PageWhite(CommonData &common){
commonData = &common; commonData = &common;
common.logger->logDebug(GwLog::LOG,"Instantiate PageWhite"); common.logger->logDebug(GwLog::LOG,"Instantiate PageWhite");
refreshtime = 15000;
} }
virtual int handleKey(int key) { virtual int handleKey(int key) {
@ -53,7 +54,11 @@ public:
int bgcolor = GxEPD_WHITE; int bgcolor = GxEPD_WHITE;
// Set display in partial refresh mode // Set display in partial refresh mode
if (mode == 'W') {
getdisplay().setFullWindow();
} else {
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
}
if (mode == 'L') { if (mode == 'L') {
getdisplay().drawBitmap(0, 0, gImage_Logo_OBP_400x300_sw, getdisplay().width(), getdisplay().height(), commonData->fgcolor); getdisplay().drawBitmap(0, 0, gImage_Logo_OBP_400x300_sw, getdisplay().width(), getdisplay().height(), commonData->fgcolor);
@ -62,7 +67,10 @@ public:
} }
// Update display // Update display
getdisplay().nextPage(); // Partial update (fast) getdisplay().nextPage();
if (mode == 'W') {
getdisplay().hibernate();
}
}; };
}; };

View File

@ -100,6 +100,7 @@ class Page{
protected: protected:
CommonData *commonData; CommonData *commonData;
public: public:
int refreshtime = 1000;
virtual void displayPage(PageData &pageData)=0; virtual void displayPage(PageData &pageData)=0;
virtual void displayNew(PageData &pageData){} virtual void displayNew(PageData &pageData){}
virtual void setupKeys() { virtual void setupKeys() {

View File

@ -913,6 +913,17 @@
"obp40": "true" "obp40": "true"
} }
}, },
{
"name": "systemPage",
"label": "System Page",
"type": "boolean",
"default": "false",
"description": "Use wheel button for system page or direct deep sleep mode",
"category":"OBP40 Pages",
"capabilities": {
"obp40": "true"
}
},
{ {
"name": "imageFormat", "name": "imageFormat",
"label": "Screenshot Format", "label": "Screenshot Format",

View File

@ -9,7 +9,7 @@
#include <NMEA0183.h> // NMEA0183 #include <NMEA0183.h> // NMEA0183
#include <NMEA0183Msg.h> #include <NMEA0183Msg.h>
#include <NMEA0183Messages.h> #include <NMEA0183Messages.h>
#include <GxEPD2_BW.h> // GxEPD2 lib for black 6 white E-Ink displays #include <GxEPD2_BW.h> // GxEPD2 lib for b/w E-Ink displays
#include "OBP60Extensions.h" // Functions lib for extension board #include "OBP60Extensions.h" // Functions lib for extension board
#include "OBP60Keypad.h" // Functions for keypad #include "OBP60Keypad.h" // Functions for keypad
@ -118,7 +118,7 @@ void OBP60Init(GwApi *api){
#endif #endif
#ifdef BOARD_OBP60S3 #ifdef BOARD_OBP60S3
touchSleepWakeUpEnable(TP1, 45); touchSleepWakeUpEnable(TP1, 45); // TODO sensitivity should be configurable via web interface
touchSleepWakeUpEnable(TP2, 45); touchSleepWakeUpEnable(TP2, 45);
touchSleepWakeUpEnable(TP3, 45); touchSleepWakeUpEnable(TP3, 45);
touchSleepWakeUpEnable(TP4, 45); touchSleepWakeUpEnable(TP4, 45);
@ -169,6 +169,7 @@ typedef struct {
GwLog* logger = NULL; GwLog* logger = NULL;
// GwApi* api = NULL; // GwApi* api = NULL;
uint sensitivity = 100; uint sensitivity = 100;
bool use_syspage = true;
} MyData; } MyData;
// Keyboard Task // Keyboard Task
@ -180,7 +181,7 @@ void keyboardTask(void *param){
// Loop for keyboard task // Loop for keyboard task
while (true){ while (true){
keycode = readKeypad(data->logger, data->sensitivity); keycode = readKeypad(data->logger, data->sensitivity, data->use_syspage);
//send a key event //send a key event
if(keycode != 0){ if(keycode != 0){
xQueueSend(data->queue, &keycode, 0); xQueueSend(data->queue, &keycode, 0);
@ -336,38 +337,6 @@ void underVoltageDetection(GwApi *api, CommonData &common){
} }
} }
#ifdef BOARD_OBP40S3
// Deep sleep funktion
void deepSleep(CommonData &common){
// Switch off all power lines
setPortPin(OBP_BACKLIGHT_LED, false); // Backlight Off
setFlashLED(false); // Flash LED Off
buzzer(TONE4, 20); // Buzzer tone 4kHz 20ms
// Shutdown EInk display
getdisplay().setFullWindow(); // Set full Refresh
//getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
getdisplay().fillScreen(common.bgcolor); // Clear screen
getdisplay().setTextColor(common.fgcolor);
getdisplay().setFont(&Ubuntu_Bold20pt7b);
getdisplay().setCursor(85, 150);
getdisplay().print("Sleep Mode");
getdisplay().setFont(&Ubuntu_Bold8pt7b);
getdisplay().setCursor(65, 175);
getdisplay().print("For wakeup press wheel and wait 5s");
getdisplay().nextPage(); // Partial update
getdisplay().powerOff(); // Display power off
setPortPin(OBP_POWER_EPD, false); // Power off ePaper display
setPortPin(OBP_POWER_SD, false); // Power off SD card
// Stop system
while(true){
esp_deep_sleep_start(); // Deep Sleep with weakup via GPIO pin
}
}
#endif
// OBP60 Task // OBP60 Task
//#################################################################################### //####################################################################################
void OBP60Task(GwApi *api){ void OBP60Task(GwApi *api){
@ -412,6 +381,9 @@ void OBP60Task(GwApi *api){
bool refreshmode = api->getConfig()->getConfigItem(api->getConfig()->refresh,true)->asBoolean(); bool refreshmode = api->getConfig()->getConfigItem(api->getConfig()->refresh,true)->asBoolean();
String fastrefresh = api->getConfig()->getConfigItem(api->getConfig()->fastRefresh,true)->asString(); String fastrefresh = api->getConfig()->getConfigItem(api->getConfig()->fastRefresh,true)->asString();
uint fullrefreshtime = uint(api->getConfig()->getConfigItem(api->getConfig()->fullRefreshTime,true)->asInt()); uint fullrefreshtime = uint(api->getConfig()->getConfigItem(api->getConfig()->fullRefreshTime,true)->asInt());
#ifdef BOARD_OBP40S3
bool syspage_enabled = config->getBool(config->systemPage);
#endif
#ifdef DISPLAY_GDEY042T81 #ifdef DISPLAY_GDEY042T81
getdisplay().init(115200, true, 2, false); // Use this for Waveshare boards with "clever" reset circuit, 2ms reset pulse getdisplay().init(115200, true, 2, false); // Use this for Waveshare boards with "clever" reset circuit, 2ms reset pulse
@ -453,16 +425,24 @@ void OBP60Task(GwApi *api){
// Set start page // Set start page
int pageNumber = int(api->getConfig()->getConfigItem(api->getConfig()->startPage,true)->asInt()) - 1; int pageNumber = int(api->getConfig()->getConfigItem(api->getConfig()->startPage,true)->asInt()) - 1;
#ifdef BOARD_OBP60S3
LOG_DEBUG(GwLog::LOG,"Checking wakeup..."); LOG_DEBUG(GwLog::LOG,"Checking wakeup...");
#ifdef BOARD_OBP60S3
if (esp_sleep_get_wakeup_cause() == ESP_SLEEP_WAKEUP_TOUCHPAD) { if (esp_sleep_get_wakeup_cause() == ESP_SLEEP_WAKEUP_TOUCHPAD) {
LOG_DEBUG(GwLog::LOG,"Wake up by touch pad %d",esp_sleep_get_touchpad_wakeup_status()); LOG_DEBUG(GwLog::LOG,"Wake up by touch pad %d",esp_sleep_get_touchpad_wakeup_status());
pageNumber = getLastPage(); pageNumber = getLastPage();
} else { } else {
LOG_DEBUG(GwLog::LOG,"Other wakeup reason"); LOG_DEBUG(GwLog::LOG,"Other wakeup reason");
} }
LOG_DEBUG(GwLog::LOG,"...done");
#endif #endif
#ifdef BOARD_OBP40S3
if (esp_sleep_get_wakeup_cause() == ESP_SLEEP_WAKEUP_EXT0) {
LOG_DEBUG(GwLog::LOG,"Wake up by key");
pageNumber = getLastPage();
} else {
LOG_DEBUG(GwLog::LOG,"Other wakeup reason");
}
#endif
LOG_DEBUG(GwLog::LOG,"...done");
int lastPage=pageNumber; int lastPage=pageNumber;
@ -525,6 +505,9 @@ void OBP60Task(GwApi *api){
allParameters.page0=3; allParameters.page0=3;
allParameters.queue=xQueueCreate(10,sizeof(int)); allParameters.queue=xQueueCreate(10,sizeof(int));
allParameters.sensitivity= api->getConfig()->getInt(GwConfigDefinitions::tSensitivity); allParameters.sensitivity= api->getConfig()->getInt(GwConfigDefinitions::tSensitivity);
#ifdef BOARD_OBP40S3
allParameters.use_syspage = syspage_enabled;
#endif
xTaskCreate(keyboardTask,"keyboard",2000,&allParameters,configMAX_PRIORITIES-1,NULL); xTaskCreate(keyboardTask,"keyboard",2000,&allParameters,configMAX_PRIORITIES-1,NULL);
SharedData *shared=new SharedData(api); SharedData *shared=new SharedData(api);
createSensorTask(shared); createSensorTask(shared);
@ -574,8 +557,10 @@ void OBP60Task(GwApi *api){
//#################################################################################### //####################################################################################
bool systemPage = false; bool systemPage = false;
Page *currentPage;
while (true){ while (true){
delay(100); // Delay 100ms (loop time) delay(100); // Delay 100ms (loop time)
bool keypressed = false;
// Undervoltage detection // Undervoltage detection
if(uvoltage == true){ if(uvoltage == true){
@ -617,12 +602,13 @@ void OBP60Task(GwApi *api){
int keyboardMessage=0; int keyboardMessage=0;
while (xQueueReceive(allParameters.queue,&keyboardMessage,0)){ while (xQueueReceive(allParameters.queue,&keyboardMessage,0)){
LOG_DEBUG(GwLog::LOG,"new key from keyboard %d",keyboardMessage); LOG_DEBUG(GwLog::LOG,"new key from keyboard %d",keyboardMessage);
keypressed = true;
Page *currentPage; if (keyboardMessage == 12 and !systemPage) {
if (keyboardMessage == 12) {
LOG_DEBUG(GwLog::LOG, "Calling system page"); LOG_DEBUG(GwLog::LOG, "Calling system page");
systemPage = true; // System page is out of band systemPage = true; // System page is out of band
syspage->setupKeys(); syspage->setupKeys();
keyboardMessage = 0;
} }
else { else {
currentPage = pages[pageNumber].page; currentPage = pages[pageNumber].page;
@ -630,6 +616,7 @@ void OBP60Task(GwApi *api){
// exit system mode with exit key number 1 // exit system mode with exit key number 1
systemPage = false; systemPage = false;
currentPage->setupKeys(); currentPage->setupKeys();
keyboardMessage = 0;
} }
} }
if (systemPage) { if (systemPage) {
@ -650,7 +637,7 @@ void OBP60Task(GwApi *api){
} }
#ifdef BOARD_OBP40S3 #ifdef BOARD_OBP40S3
// #3 Deep sleep mode for OBP40 // #3 Deep sleep mode for OBP40
if (keyboardMessage == 3){ if ((keyboardMessage == 3) and !syspage_enabled){
deepSleep(commonData); deepSleep(commonData);
} }
#endif #endif
@ -749,9 +736,17 @@ void OBP60Task(GwApi *api){
} }
} }
// Refresh display data all 1s // Refresh display data, default all 1s
if(millis() > starttime3 + 1000){ currentPage = pages[pageNumber].page;
int pagetime = 1000;
if ((lastPage == pageNumber) and (!keypressed)) {
// same page we use page defined time
pagetime = currentPage->refreshtime;
}
if(millis() > starttime3 + pagetime){
LOG_DEBUG(GwLog::DEBUG,"Page with refreshtime=%d", pagetime);
starttime3 = millis(); starttime3 = millis();
//refresh data from api //refresh data from api
api->getBoatDataValues(boatValues.numValues,boatValues.allBoatValues); api->getBoatDataValues(boatValues.numValues,boatValues.allBoatValues);
api->getStatus(commonData.status); api->getStatus(commonData.status);
@ -773,7 +768,6 @@ void OBP60Task(GwApi *api){
syspage->displayPage(sysparams); syspage->displayPage(sysparams);
} }
else { else {
Page *currentPage = pages[pageNumber].page;
if (currentPage == NULL){ if (currentPage == NULL){
LOG_DEBUG(GwLog::ERROR,"page number %d not found", pageNumber); LOG_DEBUG(GwLog::ERROR,"page number %d not found", pageNumber);
// Error handling for missing page // Error handling for missing page