Code cleanup

This commit is contained in:
Thomas Hooge 2025-08-14 12:50:18 +02:00
parent 8695d3eeb5
commit 992348ce92
35 changed files with 379 additions and 353 deletions

View File

@ -126,6 +126,13 @@ public:
#endif #endif
void displayNew(PageData &pageData) { void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
}; };
int displayPage(PageData &pageData){ int displayPage(PageData &pageData){

View File

@ -379,6 +379,13 @@ public:
#endif #endif
void displayNew(PageData &pageData){ void displayNew(PageData &pageData){
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
}; };
int displayPage(PageData &pageData){ int displayPage(PageData &pageData){

View File

@ -89,6 +89,13 @@ public:
#endif #endif
void displayNew(PageData &pageData){ void displayNew(PageData &pageData){
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
}; };
int displayPage(PageData &pageData){ int displayPage(PageData &pageData){

View File

@ -40,6 +40,16 @@ public:
return key; return key;
} }
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData){ int displayPage(PageData &pageData){
// Old values for hold function // Old values for hold function
@ -141,12 +151,6 @@ public:
String svalue3 = String(value3); // Formatted value as string including unit conversion and switching decimal places String svalue3 = String(value3); // Formatted value as string including unit conversion and switching decimal places
String unit3 = "W"; // Unit of value String unit3 = "W"; // Unit of value
// Optical warning by limit violation (unused)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
// Logging boat values // Logging boat values
logger->logDebug(GwLog::LOG, "Drawing at PageBattery, %s: %f, %s: %f, %s: %f, Avg: %d", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, average); logger->logDebug(GwLog::LOG, "Drawing at PageBattery, %s: %f, %s: %f, %s: %f, Avg: %d", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, average);

View File

@ -140,36 +140,20 @@ public:
if(batRange > 99) batRange = 99; if(batRange > 99) batRange = 99;
// Optical warning by limit violation // Optical warning by limit violation
if(String(flashLED) == "Limit Violation"){ if (flashLED == "Limit Violation") {
// Limits for Pb battery bool violation = false;
if(String(batType) == "Pb" && (raw < 11.8 || raw > 14.8)){ if (batType == "Pb") {
violation = (raw < 11.8 || raw > 14.8);
} else if (batType == "Gel") {
violation = (raw < 11.8 || raw > 14.4);
} else if (batType == "AGM") {
violation = (raw < 11.8 || raw > 14.7);
} else if (batType == "LiFePo4") {
violation = (raw < 12.0 || raw > 14.6);
}
if (violation) {
setBlinkingLED(true); setBlinkingLED(true);
} } else {
if(String(batType) == "Pb" && (raw >= 11.8 && raw <= 14.8)){
setBlinkingLED(false);
setFlashLED(false);
}
// Limits for Gel battery
if(String(batType) == "Gel" && (raw < 11.8 || raw > 14.4)){
setBlinkingLED(true);
}
if(String(batType) == "Gel" && (raw >= 11.8 && raw <= 14.4)){
setBlinkingLED(false);
setFlashLED(false);
}
// Limits for AGM battery
if(String(batType) == "AGM" && (raw < 11.8 || raw > 14.7)){
setBlinkingLED(true);
}
if(String(batType) == "AGM" && (raw >= 11.8 && raw <= 14.7)){
setBlinkingLED(false);
setFlashLED(false);
}
// Limits for LiFePo4 battery
if(String(batType) == "LiFePo4" && (raw < 12.0 || raw > 14.6)){
setBlinkingLED(true);
}
if(String(batType) == "LiFePo4" && (raw >= 12.0 && raw <= 14.6)){
setBlinkingLED(false); setBlinkingLED(false);
setFlashLED(false); setFlashLED(false);
} }

View File

@ -97,8 +97,18 @@ public:
return key; return key;
} }
int displayPage(PageData &pageData) void displayNew(PageData &pageData) {
{ #ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData) {
static String svalue1old = ""; static String svalue1old = "";
static String unit1old = ""; static String unit1old = "";
static String svalue2old = ""; static String svalue2old = "";

View File

@ -61,6 +61,16 @@ public:
return key; return key;
} }
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData) { int displayPage(PageData &pageData) {
// Old values for hold function // Old values for hold function
@ -89,12 +99,6 @@ public:
logger->logDebug(GwLog::LOG, "Drawing at PageCompass: %d %s %f %s %s", i, DataName[i], DataValue[i], DataFormat[i], DataText[i] ); logger->logDebug(GwLog::LOG, "Drawing at PageCompass: %d %s %f %s %s", i, DataName[i], DataValue[i], DataFormat[i], DataText[i] );
} }
// Optical warning by limit violation (unused)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
if (bvalue == NULL) return PAGE_OK; // WTF why this statement? if (bvalue == NULL) return PAGE_OK; // WTF why this statement?
//*********************************************************** //***********************************************************

View File

@ -88,6 +88,13 @@ public:
#endif #endif
void displayNew(PageData &pageData){ void displayNew(PageData &pageData){
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
}; };
int displayPage(PageData &pageData){ int displayPage(PageData &pageData){

View File

@ -94,6 +94,13 @@ public:
void displayNew(PageData &pageData) { void displayNew(PageData &pageData) {
fluidtype = config->getInt("page" + String(pageData.pageNumber) + "fluid", 0); fluidtype = config->getInt("page" + String(pageData.pageNumber) + "fluid", 0);
logger->logDebug(GwLog::LOG, "New PageFluid: fluidtype=%d", fluidtype); logger->logDebug(GwLog::LOG, "New PageFluid: fluidtype=%d", fluidtype);
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
} }
int displayPage(PageData &pageData) { int displayPage(PageData &pageData) {
@ -101,16 +108,6 @@ public:
// Old values for hold function // Old values for hold function
static double value1old; static double value1old;
// Get config data
String flashLED = config->getString(config->flashLED);
String backlightMode = config->getString(config->backlight);
// Optical warning by limit violation (unused)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
GwApi::BoatValue *bvalue1 = pageData.values[0]; GwApi::BoatValue *bvalue1 = pageData.values[0];
String name1 = bvalue1->getName(); String name1 = bvalue1->getName();
double fluidlevel = bvalue1->value; double fluidlevel = bvalue1->value;

View File

@ -9,6 +9,7 @@ class PageFourValues : public Page
{ {
private: private:
String lengthformat; String lengthformat;
public: public:
PageFourValues(CommonData &common) : Page(common) PageFourValues(CommonData &common) : Page(common)
{ {
@ -27,6 +28,16 @@ public:
return key; return key;
} }
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData){ int displayPage(PageData &pageData){
// Old values for hold function // Old values for hold function
@ -79,12 +90,6 @@ public:
String svalue4 = formatValue(bvalue4, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String svalue4 = formatValue(bvalue4, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
String unit4 = formatValue(bvalue4, *commonData).unit; // Unit of value String unit4 = formatValue(bvalue4, *commonData).unit; // Unit of value
// Optical warning by limit violation (unused)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
// Logging boat values // Logging boat values
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement? if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
logger->logDebug(GwLog::LOG, "Drawing at PageFourValues, %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 PageFourValues, %s: %f, %s: %f, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4);

View File

@ -9,6 +9,7 @@ class PageFourValues2 : public Page
{ {
private: private:
String lengthformat; String lengthformat;
public: public:
PageFourValues2(CommonData &common) : Page(common) PageFourValues2(CommonData &common) : Page(common)
{ {
@ -27,6 +28,16 @@ public:
return key; return key;
} }
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData) { int displayPage(PageData &pageData) {
// Old values for hold function // Old values for hold function
@ -79,12 +90,6 @@ public:
String svalue4 = formatValue(bvalue4, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String svalue4 = formatValue(bvalue4, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
String unit4 = formatValue(bvalue4, *commonData).unit; // Unit of value String unit4 = formatValue(bvalue4, *commonData).unit; // Unit of value
// Optical warning by limit violation (unused)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
// Logging boat values // Logging boat values
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement? if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
logger->logDebug(GwLog::LOG, "Drawing at PageFourValues2, %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 PageFourValues2, %s: %f, %s: %f, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4);

View File

@ -60,18 +60,13 @@ public:
bool valid1 = true; bool valid1 = true;
// Optical warning by limit violation // Optical warning by limit violation
if(String(flashLED) == "Limit Violation"){ if (flashLED == "Limit Violation") {
// Over voltage // Over voltage?
if(value1 > 14.8 && batVoltage == "12V"){ if (batVoltage == "12V") {
setBlinkingLED(true); setBlinkingLED(value1 > 14.8);
} } else if (batVoltage == "24V") {
if(value1 <= 14.8 && batVoltage == "12V"){ setBlinkingLED(value1 > 29.6);
setBlinkingLED(false); } else {
}
if(value1 > 29.6 && batVoltage == "24V"){
setBlinkingLED(true);
}
if(value1 <= 29.6 && batVoltage == "24V"){
setBlinkingLED(false); setBlinkingLED(false);
} }
} }

View File

@ -32,6 +32,16 @@ public:
return key; return key;
} }
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData) { int displayPage(PageData &pageData) {
double value1 = 0; double value1 = 0;
@ -54,12 +64,6 @@ public:
value1old = value1; // Save old value value1old = value1; // Save old value
} }
// Optical warning by limit violation (unused)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
// Logging boat values // Logging boat values
logger->logDebug(GwLog::LOG, "Drawing at PageKeelPosition, Keel:%f", value1); logger->logDebug(GwLog::LOG, "Drawing at PageKeelPosition, Keel:%f", value1);

View File

@ -9,6 +9,7 @@ class PageOneValue : public Page
{ {
private: private:
String lengthformat; String lengthformat;
public: public:
PageOneValue(CommonData &common) : Page(common) PageOneValue(CommonData &common) : Page(common)
{ {
@ -27,6 +28,16 @@ public:
return key; return key;
} }
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData) { int displayPage(PageData &pageData) {
// Old values for hold function // Old values for hold function
@ -44,12 +55,6 @@ public:
String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
String unit1 = formatValue(bvalue1, *commonData).unit; // Unit of value String unit1 = formatValue(bvalue1, *commonData).unit; // Unit of value
// Optical warning by limit violation (unused)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
// Logging boat values // Logging boat values
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement? if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
logger->logDebug(GwLog::LOG, "Drawing at PageOneValue, %s: %f", name1.c_str(), value1); logger->logDebug(GwLog::LOG, "Drawing at PageOneValue, %s: %f", name1.c_str(), value1);

View File

@ -99,13 +99,12 @@ public:
} }
// Optical warning by limit violation // Optical warning by limit violation
if(String(flashLED) == "Limit Violation"){ if (flashLED == "Limit Violation") {
// Limits for roll // Limits for roll
if (value1*360/(2*M_PI) >= -1*rolllimit && value1*360/(2*M_PI) <= rolllimit) { if (value1*360/(2*M_PI) >= -1*rolllimit && value1*360/(2*M_PI) <= rolllimit) {
setBlinkingLED(false); setBlinkingLED(false);
setFlashLED(false); setFlashLED(false);
} } else {
else{
setBlinkingLED(true); setBlinkingLED(true);
} }
} }

View File

@ -29,6 +29,16 @@ public:
return key; return key;
} }
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData) { int displayPage(PageData &pageData) {
static String unit1old = ""; static String unit1old = "";
@ -57,12 +67,6 @@ public:
} }
} }
// Optical warning by limit violation (unused)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
// Logging boat values // Logging boat values
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement? if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
logger->logDebug(GwLog::LOG, "Drawing at PageRudderPosition, %s:%f", name1.c_str(), value1); logger->logDebug(GwLog::LOG, "Drawing at PageRudderPosition, %s:%f", name1.c_str(), value1);
@ -89,8 +93,7 @@ public:
float x = 200 + (rInstrument-30)*sin(i/180.0*pi); // x-coordinate dots float x = 200 + (rInstrument-30)*sin(i/180.0*pi); // x-coordinate dots
float y = 150 - (rInstrument-30)*cos(i/180.0*pi); // y-coordinate cots float y = 150 - (rInstrument-30)*cos(i/180.0*pi); // y-coordinate cots
const char *ii = " "; const char *ii = " ";
switch (i) switch (i) {
{
case 0: ii=" "; break; // Use a blank for a empty scale value case 0: ii=" "; break; // Use a blank for a empty scale value
case 30 : ii=" "; break; case 30 : ii=" "; break;
case 60 : ii=" "; break; case 60 : ii=" "; break;

View File

@ -30,6 +30,16 @@ public:
return key; return key;
} }
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData) { int displayPage(PageData &pageData) {
// Old values for hold function // Old values for hold function
@ -63,12 +73,6 @@ public:
DataFormat[i] = bvalue->getFormat(); // Unit of value DataFormat[i] = bvalue->getFormat(); // Unit of value
} }
// Optical warning by limit violation (unused)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
if (bvalue == NULL) return PAGE_OK; // WTF why this statement? if (bvalue == NULL) return PAGE_OK; // WTF why this statement?
// Draw page // Draw page

View File

@ -25,13 +25,17 @@ public:
return key; return key;
} }
int displayPage(PageData &pageData) { void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Optical warning by limit violation (unused) // Clear optical warning
if(String(flashLED) == "Limit Violation"){ if (flashLED == "Limit Violation") {
setBlinkingLED(false); setBlinkingLED(false);
setFlashLED(false); setFlashLED(false);
} }
#endif
};
int displayPage(PageData &pageData) {
// Logging boat values // Logging boat values
logger->logDebug(GwLog::LOG, "Drawing at PageSkyView"); logger->logDebug(GwLog::LOG, "Drawing at PageSkyView");

View File

@ -60,18 +60,13 @@ public:
bool valid1 = true; bool valid1 = true;
// Optical warning by limit violation // Optical warning by limit violation
if(String(flashLED) == "Limit Violation"){ if (flashLED == "Limit Violation") {
// Over voltage // Over voltage?
if(value1 > 14.8 && batVoltage == "12V"){ if (batVoltage == "12V") {
setBlinkingLED(true); setBlinkingLED(value1 > 14.8);
} } else if (batVoltage == "24V") {
if(value1 <= 14.8 && batVoltage == "12V"){ setBlinkingLED(value1 > 29.6);
setBlinkingLED(false); } else {
}
if(value1 > 29.6 && batVoltage == "24V"){
setBlinkingLED(true);
}
if(value1 <= 29.6 && batVoltage == "24V"){
setBlinkingLED(false); setBlinkingLED(false);
} }
} }

View File

@ -391,7 +391,12 @@ private:
epd->setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
epd->setCursor(x0, y0); epd->setCursor(x0, y0);
epd->print("Work in progress..."); epd->print("Work in progress...");
#ifdef BOARD_OBP60S3
// This mode should not be callable by devices without card hardware
// In case of accidential reaching this, display a friendly message
epd->print("This mode is not indended to be reached!\n");
epd->print("There's nothing to see here. Move on.");
#endif
#ifdef BOARD_OBP40S3 #ifdef BOARD_OBP40S3
/* TODO identify card as OBP-Card: /* TODO identify card as OBP-Card:
magic.dat magic.dat
@ -645,6 +650,13 @@ public:
} }
void displayNew(PageData &pageData) { void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
// Get references from API // Get references from API
logger->logDebug(GwLog::LOG, "New page display: PageSystem"); logger->logDebug(GwLog::LOG, "New page display: PageSystem");
NMEA2000 = pageData.api->getNMEA2000(); NMEA2000 = pageData.api->getNMEA2000();
@ -652,12 +664,6 @@ public:
int displayPage(PageData &pageData) { int displayPage(PageData &pageData) {
// Optical warning by limit violation (unused)
if(flashLED == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
// Logging page information // Logging page information
logger->logDebug(GwLog::LOG, "Drawing at PageSystem, Mode=%c", mode); logger->logDebug(GwLog::LOG, "Drawing at PageSystem, Mode=%c", mode);

View File

@ -9,6 +9,7 @@ class PageThreeValues : public Page
{ {
private: private:
String lengthformat; String lengthformat;
public: public:
PageThreeValues(CommonData &common) : Page(common) PageThreeValues(CommonData &common) : Page(common)
{ {
@ -27,6 +28,16 @@ public:
return key; return key;
} }
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData) { int displayPage(PageData &pageData) {
// Old values for hold function // Old values for hold function
@ -67,12 +78,6 @@ public:
String svalue3 = formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String svalue3 = formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
String unit3 = formatValue(bvalue3, *commonData).unit; // Unit of value String unit3 = formatValue(bvalue3, *commonData).unit; // Unit of value
// Optical warning by limit violation (unused)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
// Logging boat values // Logging boat values
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement? if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
logger->logDebug(GwLog::LOG, "Drawing at PageThreeValues, %s: %f, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3); logger->logDebug(GwLog::LOG, "Drawing at PageThreeValues, %s: %f, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3);

View File

@ -9,6 +9,7 @@ class PageTwoValues : public Page
{ {
private: private:
String lengthformat; String lengthformat;
public: public:
PageTwoValues(CommonData &common) : Page(common) PageTwoValues(CommonData &common) : Page(common)
{ {
@ -27,6 +28,16 @@ public:
return key; return key;
} }
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData) { int displayPage(PageData &pageData) {
// Old values for hold function // Old values for hold function
@ -56,12 +67,6 @@ public:
String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
String unit2 = formatValue(bvalue2, *commonData).unit; // Unit of value String unit2 = formatValue(bvalue2, *commonData).unit; // Unit of value
// Optical warning by limit violation (unused)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
// Logging boat values // Logging boat values
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement? if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
logger->logDebug(GwLog::LOG, "Drawing at PageTwoValues, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2); logger->logDebug(GwLog::LOG, "Drawing at PageTwoValues, %s: %f, %s: %f", name1.c_str(), value1, name2.c_str(), value2);

View File

@ -154,36 +154,20 @@ public:
bool valid1 = true; bool valid1 = true;
// Optical warning by limit violation // Optical warning by limit violation
if(String(flashLED) == "Limit Violation"){ if (flashLED == "Limit Violation") {
// Limits for Pb battery bool violation = false;
if(String(batType) == "Pb" && (raw < 11.8 || raw > 14.8)){ if (batType == "Pb") {
violation = (raw < 11.8 || raw > 14.8);
} else if (batType == "Gel") {
violation = (raw < 11.8 || raw > 14.4);
} else if (batType == "AGM") {
violation = (raw < 11.8 || raw > 14.7);
} else if (batType == "LiFePo4") {
violation = (raw < 12.0 || raw > 14.6);
}
if (violation) {
setBlinkingLED(true); setBlinkingLED(true);
} } else {
if(String(batType) == "Pb" && (raw >= 11.8 && raw <= 14.8)){
setBlinkingLED(false);
setFlashLED(false);
}
// Limits for Gel battery
if(String(batType) == "Gel" && (raw < 11.8 || raw > 14.4)){
setBlinkingLED(true);
}
if(String(batType) == "Gel" && (raw >= 11.8 && raw <= 14.4)){
setBlinkingLED(false);
setFlashLED(false);
}
// Limits for AGM battery
if(String(batType) == "AGM" && (raw < 11.8 || raw > 14.7)){
setBlinkingLED(true);
}
if(String(batType) == "AGM" && (raw >= 11.8 && raw <= 14.7)){
setBlinkingLED(false);
setFlashLED(false);
}
// Limits for LiFePo4 battery
if(String(batType) == "LiFePo4" && (raw < 12.0 || raw > 14.6)){
setBlinkingLED(true);
}
if(String(batType) == "LiFePo4" && (raw >= 12.0 && raw <= 14.6)){
setBlinkingLED(false); setBlinkingLED(false);
setFlashLED(false); setFlashLED(false);
} }

View File

@ -39,13 +39,17 @@ public:
return key; return key;
} }
int displayPage(PageData &pageData) { void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Optical warning by limit violation (unused) // Clear optical warning
if(String(flashLED) == "Limit Violation"){ if (flashLED == "Limit Violation") {
setBlinkingLED(false); setBlinkingLED(false);
setFlashLED(false); setFlashLED(false);
} }
#endif
};
int displayPage(PageData &pageData) {
// Logging boat values // Logging boat values
logger->logDebug(GwLog::LOG, "Drawing at PageWhite"); logger->logDebug(GwLog::LOG, "Drawing at PageWhite");

View File

@ -303,6 +303,16 @@ public:
return key; return key;
} }
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData) { int displayPage(PageData &pageData) {
static String svalue1old = ""; static String svalue1old = "";
@ -344,12 +354,6 @@ public:
String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
String unit2 = formatValue(bvalue2, *commonData).unit; // Unit of value String unit2 = formatValue(bvalue2, *commonData).unit; // Unit of value
// Optical warning by limit violation (unused)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
// Logging boat values // Logging boat values
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement? if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
logger->logDebug(GwLog::LOG, "Drawing at PageWind, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2); logger->logDebug(GwLog::LOG, "Drawing at PageWind, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2);

View File

@ -111,6 +111,16 @@ public:
return key; return key;
} }
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData& pageData) { int displayPage(PageData& pageData) {
float twsValue; // TWS value in chart area float twsValue; // TWS value in chart area

View File

@ -30,6 +30,16 @@ public:
return key; return key;
} }
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData) { int displayPage(PageData &pageData) {
static String svalue1old = ""; static String svalue1old = "";
@ -130,12 +140,6 @@ public:
unit6old = unit6; // Save old unit unit6old = unit6; // Save old unit
} }
// Optical warning by limit violation (unused)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
// Logging boat values // Logging boat values
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement? if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
logger->logDebug(GwLog::LOG, "Drawing at PageWindRose, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4, name5.c_str(), value5, name6.c_str(), value6); logger->logDebug(GwLog::LOG, "Drawing at PageWindRose, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4, name5.c_str(), value5, name6.c_str(), value6);
@ -158,12 +162,7 @@ public:
epd->setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
epd->setCursor(10, 115); epd->setCursor(10, 115);
epd->print(" "); epd->print(" ");
if(holdvalues == false){ epd->print(holdvalues ? unit1old : unit1);
epd->print(unit1); // Unit
}
else{
epd->print(unit1old); // Unit
}
// Horizintal separator left // Horizintal separator left
epd->fillRect(0, 149, 60, 3, commonData->fgcolor); epd->fillRect(0, 149, 60, 3, commonData->fgcolor);
@ -178,12 +177,7 @@ public:
epd->setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
epd->setCursor(10, 190); epd->setCursor(10, 190);
epd->print(" "); epd->print(" ");
if(holdvalues == false){ epd->print(holdvalues ? unit2old : unit2);
epd->print(unit2); // Unit
}
else{
epd->print(unit2old); // Unit
}
// Show values TWD // Show values TWD
epd->setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
@ -200,12 +194,7 @@ public:
epd->setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
epd->setCursor(335, 115); epd->setCursor(335, 115);
epd->print(" "); epd->print(" ");
if(holdvalues == false){ epd->print(holdvalues ? unit3old : unit3);
epd->print(unit3); // Unit
}
else{
epd->print(unit3old); // Unit
}
// Horizintal separator right // Horizintal separator right
epd->fillRect(340, 149, 80, 3, commonData->fgcolor); epd->fillRect(340, 149, 80, 3, commonData->fgcolor);
@ -220,12 +209,7 @@ public:
epd->setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
epd->setCursor(335, 190); epd->setCursor(335, 190);
epd->print(" "); epd->print(" ");
if(holdvalues == false){ epd->print(holdvalues ? unit4old : unit4);
epd->print(unit4); // Unit
}
else{
epd->print(unit4old); // Unit
}
//******************************************************************************************* //*******************************************************************************************
@ -244,8 +228,7 @@ public:
float x = 200 + (rInstrument-30)*sin(i/180.0*pi); // x-coordinate dots float x = 200 + (rInstrument-30)*sin(i/180.0*pi); // x-coordinate dots
float y = 150 - (rInstrument-30)*cos(i/180.0*pi); // y-coordinate cots float y = 150 - (rInstrument-30)*cos(i/180.0*pi); // y-coordinate cots
const char *ii = ""; const char *ii = "";
switch (i) switch (i) {
{
case 0: ii="0"; break; case 0: ii="0"; break;
case 30 : ii="30"; break; case 30 : ii="30"; break;
case 60 : ii="60"; break; case 60 : ii="60"; break;
@ -333,12 +316,7 @@ public:
epd->setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
epd->setCursor(190, 215); epd->setCursor(190, 215);
epd->print(" "); epd->print(" ");
if(holdvalues == false){ epd->print(holdvalues ? unit5old : unit5);
epd->print(unit5); // Unit
}
else{
epd->print(unit5old); // Unit
}
// Show values STW // Show values STW
epd->setFont(&DSEG7Classic_BoldItalic16pt7b); epd->setFont(&DSEG7Classic_BoldItalic16pt7b);
@ -347,12 +325,7 @@ public:
epd->setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
epd->setCursor(190, 90); epd->setCursor(190, 90);
epd->print(" "); epd->print(" ");
if(holdvalues == false){ epd->print(holdvalues ? unit6old : unit6);
epd->print(unit6); // Unit
}
else{
epd->print(unit6old); // Unit
}
return PAGE_UPDATE; return PAGE_UPDATE;
}; };

View File

@ -30,6 +30,16 @@ public:
return key; return key;
} }
void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Clear optical warning
if (flashLED == "Limit Violation") {
setBlinkingLED(false);
setFlashLED(false);
}
#endif
};
int displayPage(PageData &pageData) { int displayPage(PageData &pageData) {
static String svalue1old = ""; static String svalue1old = "";
@ -130,12 +140,6 @@ public:
unit6old = unit6; // Save old unit unit6old = unit6; // Save old unit
} }
// Optical warning by limit violation (unused)
if(String(flashLED) == "Limit Violation"){
setBlinkingLED(false);
setFlashLED(false);
}
// Logging boat values // Logging boat values
if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement? if (bvalue1 == NULL) return PAGE_OK; // WTF why this statement?
logger->logDebug(GwLog::LOG, "Drawing at PageWindRoseFlex, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4, name5.c_str(), value5, name6.c_str(), value6); logger->logDebug(GwLog::LOG, "Drawing at PageWindRoseFlex, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3, name4.c_str(), value4, name5.c_str(), value5, name6.c_str(), value6);
@ -158,12 +162,7 @@ public:
epd->setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
epd->setCursor(10, 115); epd->setCursor(10, 115);
epd->print(" "); epd->print(" ");
if(holdvalues == false){ epd->print(holdvalues ? unit2old : unit2);
epd->print(unit2); // Unit
}
else{
epd->print(unit2old); // Unit
}
// Horizintal separator left // Horizintal separator left
epd->fillRect(0, 149, 60, 3, commonData->fgcolor); epd->fillRect(0, 149, 60, 3, commonData->fgcolor);
@ -178,12 +177,8 @@ public:
epd->setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
epd->setCursor(10, 190); epd->setCursor(10, 190);
epd->print(" "); epd->print(" ");
if(holdvalues == false){ epd->print(holdvalues ? unit3old : unit3);
epd->print(unit3); // Unit
}
else{
epd->print(unit3old); // Unit
}
// Show value 4 at top right // Show value 4 at top right
epd->setFont(&DSEG7Classic_BoldItalic20pt7b); epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
@ -201,12 +196,8 @@ public:
epd->setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
epd->setCursor(335, 115); epd->setCursor(335, 115);
epd->print(" "); epd->print(" ");
if(holdvalues == false){ epd->print(holdvalues ? unit4old : unit4);
epd->print(unit4); // Unit
}
else{
epd->print(unit4old); // Unit
}
// Horizintal separator right // Horizintal separator right
epd->fillRect(340, 149, 80, 3, commonData->fgcolor); epd->fillRect(340, 149, 80, 3, commonData->fgcolor);
@ -221,13 +212,7 @@ public:
epd->setFont(&Ubuntu_Bold8pt8b); epd->setFont(&Ubuntu_Bold8pt8b);
epd->setCursor(335, 190); epd->setCursor(335, 190);
epd->print(" "); epd->print(" ");
if(holdvalues == false){ epd->print(holdvalues ? unit5old : unit5);
epd->print(unit5); // Unit
}
else{
epd->print(unit5old); // Unit
}
//******************************************************************************************* //*******************************************************************************************
@ -340,12 +325,7 @@ public:
epd->setCursor(190, 90); epd->setCursor(190, 90);
} }
epd->print(" "); epd->print(" ");
if(holdvalues == false){ epd->print(holdvalues ? unit6old : unit6);
epd->print(unit6); // Unit
}
else{
epd->print(unit6old); // Unit
}
return PAGE_UPDATE; return PAGE_UPDATE;
}; };

View File

@ -69,13 +69,17 @@ public:
return key; return key;
} }
int displayPage(PageData &pageData) { void displayNew(PageData &pageData) {
#ifdef BOARD_OBP60S3
// Optical warning by limit violation (unused) // Clear optical warning
if(String(flashLED) == "Limit Violation"){ if (flashLED == "Limit Violation") {
setBlinkingLED(false); setBlinkingLED(false);
setFlashLED(false); setFlashLED(false);
} }
#endif
};
int displayPage(PageData &pageData) {
// Logging boat values // Logging boat values
logger->logDebug(GwLog::LOG, "Drawing at PageXTETrack"); logger->logDebug(GwLog::LOG, "Drawing at PageXTETrack");

View File

@ -147,6 +147,7 @@ public:
int refreshtime = 1000; int refreshtime = 1000;
virtual int displayPage(PageData &pageData)=0; virtual int displayPage(PageData &pageData)=0;
virtual void displayNew(PageData &pageData){} virtual void displayNew(PageData &pageData){}
virtual void leavePage(PageData &pageData){}
virtual void setupKeys() { virtual void setupKeys() {
#ifdef HARDWARE_V21 #ifdef HARDWARE_V21
commonData->keydata[0].label = ""; commonData->keydata[0].label = "";

View File

@ -4,6 +4,12 @@ Development information
This file contains some hints concerning building the firmware as well as This file contains some hints concerning building the firmware as well as
developing and debugging it. developing and debugging it.
Coding style
------------
WIP
Please format your new code the same as already existing code.
Preprocessor directives go to column zero.
Git commands Git commands
------------ ------------

View File

@ -2,8 +2,6 @@
- page refresh after page change and not connected to key codes - page refresh after page change and not connected to key codes
- fix sd card code
- config: getFloat, getDouble - config: getFloat, getDouble
- dseg7 font to new version - dseg7 font to new version