Compare commits

...

1 Commits

Author SHA1 Message Date
Thomas Hooge 6793bcb8e1 Preparation for new page "Anchor" 2025-07-26 09:31:38 +02:00
5 changed files with 123 additions and 0 deletions

View File

@ -0,0 +1,100 @@
#if defined BOARD_OBP60S3 || defined BOARD_OBP40S3
#include "Pagedata.h"
#include "OBP60Extensions.h"
/*
Anchor overview with additional associated data
This page is in experimental stage so be warned!
DBS - Water depth
HDT - Boat heading
TWS - Wind strength
TWD - Wind direction
This is the fist page to contain a configuration page with
data entry option.
Also it will make use of the new alarm function.
*/
#define anchor_width 16
#define anchor_height 16
static unsigned char anchor_bits[] = {
0x80, 0x01, 0x40, 0x02, 0x40, 0x02, 0x80, 0x01, 0xf0, 0x0f, 0x80, 0x01,
0x80, 0x01, 0x88, 0x11, 0x8c, 0x31, 0x8e, 0x71, 0x84, 0x21, 0x86, 0x61,
0x86, 0x61, 0xfc, 0x3f, 0xf8, 0x1f, 0x80, 0x01 };
class PageAnchor : public Page
{
bool simulation = false;
bool holdvalues = false;
String flashLED;
String backlightMode;
public:
PageAnchor(CommonData &common){
commonData = &common;
common.logger->logDebug(GwLog::LOG,"Instantiate PageAnchor");
// preload configuration data
simulation = common.config->getBool(common.config->useSimuData);
holdvalues = common.config->getBool(common.config->holdvalues);
flashLED = common.config->getString(common.config->flashLED);
backlightMode = common.config->getString(common.config->backlight);
}
virtual int handleKey(int key){
// Code for keylock
if (key == 11) {
commonData->keylock = !commonData->keylock;
return 0; // Commit the key
}
return key;
}
void displayNew(PageData &pageData){
}
int displayPage(PageData &pageData){
GwConfigHandler *config = commonData->config;
GwLog *logger = commonData->logger;
// Logging boat values
LOG_DEBUG(GwLog::LOG,"Drawing at PageAnchor");
// Set display in partial refresh mode
getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update
uint16_t cx = 200; // center = anchor position
uint16_t cy = 150;
// draw anchor symbol (as bitmap)
getdisplay().drawXBitmap(cx - anchor_width / 2, cy - anchor_height / 2,
anchor_bits, anchor_width, anchor_height, commonData->fgcolor);
getdisplay().setTextColor(commonData->fgcolor);
return PAGE_UPDATE;
};
};
static Page *createPage(CommonData &common){
return new PageAnchor(common);
}/**
* with the code below we make this page known to the PageTask
* we give it a type (name) that can be selected in the config
* we define which function is to be called
* and we provide the number of user parameters we expect
* this will be number of BoatValue pointers in pageData.values
*/
PageDescription registerPageAnchor(
"Anchor", // Page name
createPage, // Action
0, // Number of bus values depends on selection in Web configuration
{"DBS", "HDT", "TWS", "TWD"}, // Names of bus values undepends on selection in Web configuration (refer GwBoatData.h)
true // Show display header on/off
);
#endif

View File

@ -1292,6 +1292,7 @@
"default": "Voltage",
"description": "Type of page for page 1",
"list": [
"Anchor",
"BME280",
"Battery",
"Battery2",
@ -1572,6 +1573,7 @@
"default": "WindRose",
"description": "Type of page for page 2",
"list": [
"Anchor",
"BME280",
"Battery",
"Battery2",
@ -1849,6 +1851,7 @@
"default": "OneValue",
"description": "Type of page for page 3",
"list": [
"Anchor",
"BME280",
"Battery",
"Battery2",
@ -2123,6 +2126,7 @@
"default": "TwoValues",
"description": "Type of page for page 4",
"list": [
"Anchor",
"BME280",
"Battery",
"Battery2",
@ -2394,6 +2398,7 @@
"default": "ThreeValues",
"description": "Type of page for page 5",
"list": [
"Anchor",
"BME280",
"Battery",
"Battery2",
@ -2662,6 +2667,7 @@
"default": "FourValues",
"description": "Type of page for page 6",
"list": [
"Anchor",
"BME280",
"Battery",
"Battery2",
@ -2927,6 +2933,7 @@
"default": "FourValues2",
"description": "Type of page for page 7",
"list": [
"Anchor",
"BME280",
"Battery",
"Battery2",
@ -3189,6 +3196,7 @@
"default": "Clock",
"description": "Type of page for page 8",
"list": [
"Anchor",
"BME280",
"Battery",
"Battery2",
@ -3448,6 +3456,7 @@
"default": "RollPitch",
"description": "Type of page for page 9",
"list": [
"Anchor",
"BME280",
"Battery",
"Battery2",
@ -3704,6 +3713,7 @@
"default": "Battery2",
"description": "Type of page for page 10",
"list": [
"Anchor",
"BME280",
"Battery",
"Battery2",

View File

@ -1315,6 +1315,7 @@
"default": "Clock",
"description": "Type of page for page 1",
"list": [
"Anchor",
"BME280",
"Battery",
"Battery2",
@ -1595,6 +1596,7 @@
"default": "Wind",
"description": "Type of page for page 2",
"list": [
"Anchor",
"BME280",
"Battery",
"Battery2",
@ -1872,6 +1874,7 @@
"default": "OneValue",
"description": "Type of page for page 3",
"list": [
"Anchor",
"BME280",
"Battery",
"Battery2",
@ -2146,6 +2149,7 @@
"default": "TwoValues",
"description": "Type of page for page 4",
"list": [
"Anchor",
"BME280",
"Battery",
"Battery2",
@ -2417,6 +2421,7 @@
"default": "ThreeValues",
"description": "Type of page for page 5",
"list": [
"Anchor",
"BME280",
"Battery",
"Battery2",
@ -2685,6 +2690,7 @@
"default": "FourValues",
"description": "Type of page for page 6",
"list": [
"Anchor",
"BME280",
"Battery",
"Battery2",
@ -2950,6 +2956,7 @@
"default": "FourValues2",
"description": "Type of page for page 7",
"list": [
"Anchor",
"BME280",
"Battery",
"Battery2",
@ -3212,6 +3219,7 @@
"default": "Fluid",
"description": "Type of page for page 8",
"list": [
"Anchor",
"BME280",
"Battery",
"Battery2",
@ -3471,6 +3479,7 @@
"default": "RollPitch",
"description": "Type of page for page 9",
"list": [
"Anchor",
"BME280",
"Battery",
"Battery2",
@ -3727,6 +3736,7 @@
"default": "Battery2",
"description": "Type of page for page 10",
"list": [
"Anchor",
"BME280",
"Battery",
"Battery2",

View File

@ -33,6 +33,7 @@ no_of_fields_per_page = {
"WhitePage": 0,
"WindRose": 0,
"WindRoseFlex": 6,
"Anchor", 0
}
# No changes needed beyond this point

View File

@ -309,6 +309,8 @@ void registerAllPages(PageList &list){
list.add(&registerPageXTETrack);
extern PageDescription registerPageFluid;
list.add(&registerPageFluid);
extern PageDescription registerPageAnchor;
list.add(&registerPageAnchor);
}
// Undervoltage detection for shutdown display