1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2026-03-28 18:06:37 +01:00

Move config code into page constructors and some code cleanup

This commit is contained in:
2025-08-14 09:12:56 +02:00
parent 54b4954797
commit 8695d3eeb5
32 changed files with 317 additions and 398 deletions

View File

@@ -7,10 +7,15 @@
class PageOneValue : public Page
{
public:
private:
String lengthformat;
public:
PageOneValue(CommonData &common) : Page(common)
{
logger->logDebug(GwLog::LOG, "Instantiate PageOneValue");
// Get config data
lengthformat = config->getString(config->lengthFormat);
}
int handleKey(int key) {
@@ -28,12 +33,6 @@ class PageOneValue : public Page
static String svalue1old = "";
static String unit1old = "";
// Get config data
String lengthformat = config->getString(config->lengthFormat);
// bool simulation = config->getBool(config->useSimuData);
bool holdvalues = config->getBool(config->holdvalues);
String flashLED = config->getString(config->flashLED);
String backlightMode = config->getString(config->backlight);
// Get boat values
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
@@ -53,7 +52,7 @@ class PageOneValue : public Page
// Logging boat values
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
LOG_DEBUG(GwLog::LOG,"Drawing at PageOneValue, %s: %f", name1.c_str(), value1);
logger->logDebug(GwLog::LOG, "Drawing at PageOneValue, %s: %f", name1.c_str(), value1);
// Draw page
//***********************************************************