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:
@@ -6,13 +6,19 @@
|
||||
|
||||
class PageDST810 : public Page
|
||||
{
|
||||
private:
|
||||
String lengthformat;
|
||||
|
||||
public:
|
||||
PageDST810(CommonData &common) : Page(common)
|
||||
{
|
||||
logger->logDebug(GwLog::LOG, "Instantiate PageDST810");
|
||||
|
||||
// Get config data
|
||||
lengthformat = config->getString(config->lengthFormat);
|
||||
}
|
||||
|
||||
virtual int handleKey(int key){
|
||||
int handleKey(int key) {
|
||||
// Code for keylock
|
||||
if(key == 11){
|
||||
commonData->keylock = !commonData->keylock;
|
||||
@@ -21,7 +27,7 @@ public:
|
||||
return key;
|
||||
}
|
||||
|
||||
int displayPage(PageData &pageData){
|
||||
int displayPage(PageData &pageData) {
|
||||
|
||||
// Old values for hold function
|
||||
static String svalue1old = "";
|
||||
@@ -33,13 +39,6 @@ public:
|
||||
static String svalue4old = "";
|
||||
static String unit4old = "";
|
||||
|
||||
// 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 #1
|
||||
GwApi::BoatValue *bvalue1 = pageData.values[0]; // First element in list (only one value by PageOneValue)
|
||||
String name1 = xdrDelete(bvalue1->getName()); // Value name
|
||||
@@ -84,7 +83,7 @@ public:
|
||||
|
||||
// Logging boat values
|
||||
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
|
||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageDST810, %s: %f, %s: %f, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4);
|
||||
logger->logDebug(GwLog::LOG, "Drawing at PageDST810, %s: %f, %s: %f, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4);
|
||||
|
||||
// Draw page
|
||||
//***********************************************************
|
||||
|
||||
Reference in New Issue
Block a user