Use placeholder from formatter for missing data text
This commit is contained in:
parent
cba21574cb
commit
63ae42588f
|
@ -43,7 +43,7 @@ FormattedData Formatter::formatValue(GwApi::BoatValue *value, CommonData &common
|
|||
|
||||
// If boat value not valid
|
||||
if (! value->valid && !usesimudata){
|
||||
result.svalue = "---";
|
||||
result.svalue = placeholder;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ XDR units
|
|||
*/
|
||||
|
||||
// Possible formats as scoped enums
|
||||
enum class fmtDate {DE, EN, GB, ISO};
|
||||
enum class fmtDate {DE, GB, US, ISO};
|
||||
enum class fmtTime {MMHH, MMHHSS};
|
||||
enum class fmtLength {METER, FEET, FATHOM, CABLE};
|
||||
enum class fmtDepth {METER, FEET, FATHOM};
|
||||
|
@ -116,6 +116,7 @@ private:
|
|||
public:
|
||||
Formatter(GwConfigHandler *config);
|
||||
FormattedData formatValue(GwApi::BoatValue *value, CommonData &commondata);
|
||||
String placeholder = "---";
|
||||
};
|
||||
|
||||
// Standard format functions without overhead
|
||||
|
|
|
@ -227,7 +227,7 @@ public:
|
|||
epd->print(value1,2); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
epd->print("---"); // No sensor data (sensor is off)
|
||||
epd->print(commonData->fmt->placeholder); // No sensor data (sensor is off)
|
||||
}
|
||||
|
||||
// ############### Horizontal Line ################
|
||||
|
@ -256,7 +256,7 @@ public:
|
|||
epd->print(value2,1); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
epd->print("---"); // No sensor data (sensor is off)
|
||||
epd->print(commonData->fmt->placeholder); // No sensor data (sensor is off)
|
||||
}
|
||||
|
||||
// ############### Horizontal Line ################
|
||||
|
@ -285,7 +285,7 @@ public:
|
|||
epd->print(value3,1); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
epd->print("---"); // No sensor data (sensor is off)
|
||||
epd->print(commonData->fmt->placeholder); // No sensor data (sensor is off)
|
||||
}
|
||||
|
||||
return PAGE_UPDATE;
|
||||
|
|
|
@ -286,7 +286,7 @@ public:
|
|||
if(value1 > 99.9) epd->print(value1, 0);
|
||||
}
|
||||
else{
|
||||
epd->print("---"); // Missing bus data
|
||||
epd->print(commonData->fmt->placeholder); // Missing bus data
|
||||
}
|
||||
}
|
||||
epd->setFont(&Ubuntu_Bold16pt8b);
|
||||
|
@ -300,7 +300,9 @@ public:
|
|||
if(value2 > 9.9 && value2 <= 99.9)epd->print(value2, 1);
|
||||
if(value2 > 99.9) epd->print(value2, 0);
|
||||
}
|
||||
else epd->print("---");
|
||||
else {
|
||||
epd->print(commonData->fmt->placeholder);
|
||||
}
|
||||
epd->setFont(&Ubuntu_Bold16pt8b);
|
||||
epd->print("A");
|
||||
|
||||
|
@ -312,7 +314,9 @@ public:
|
|||
if(value3 > 9.9 && value3 <= 99.9)epd->print(value3, 1);
|
||||
if(value3 > 99.9) epd->print(value3, 0);
|
||||
}
|
||||
else epd->print("---");
|
||||
else {
|
||||
epd->print(commonData->fmt->placeholder);
|
||||
}
|
||||
epd->setFont(&Ubuntu_Bold16pt8b);
|
||||
epd->print("W");
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@ public:
|
|||
epd->print(formatDate(dateformat, commonData->data.rtcTime.tm_year + 1900, commonData->data.rtcTime.tm_mon + 1, commonData->data.rtcTime.tm_mday));
|
||||
}
|
||||
} else {
|
||||
epd->print("---");
|
||||
epd->print(commonData->fmt->placeholder);
|
||||
}
|
||||
} else {
|
||||
epd->print(svalue2old);
|
||||
|
@ -235,7 +235,7 @@ public:
|
|||
epd->print(formatTime('s', commonData->data.rtcTime.tm_hour, commonData->data.rtcTime.tm_min, commonData->data.rtcTime.tm_sec));
|
||||
}
|
||||
} else {
|
||||
epd->print("---");
|
||||
epd->print(commonData->fmt->placeholder);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -246,7 +246,7 @@ public:
|
|||
epd->print("Time"); // Name
|
||||
|
||||
// Show values sunrise
|
||||
String sunrise = "---";
|
||||
String sunrise = commonData->fmt->placeholder;
|
||||
if (((source == 'G') and gpsvalid) or (homevalid and commonData->data.rtcValid)) {
|
||||
sunrise = String(commonData->sundata.sunriseHour) + ":" + String(commonData->sundata.sunriseMinute + 100).substring(1);
|
||||
svalue5old = sunrise;
|
||||
|
@ -266,7 +266,7 @@ public:
|
|||
epd->fillRect(340, 149, 80, 3, commonData->fgcolor);
|
||||
|
||||
// Show values sunset
|
||||
String sunset = "---";
|
||||
String sunset = commonData->fmt->placeholder;
|
||||
if (((source == 'G') and gpsvalid) or (homevalid and commonData->data.rtcValid)) {
|
||||
sunset = String(commonData->sundata.sunsetHour) + ":" + String(commonData->sundata.sunsetMinute + 100).substring(1);
|
||||
svalue6old = sunset;
|
||||
|
|
|
@ -168,7 +168,7 @@ public:
|
|||
if(value1 > 99.9) epd->print(value1, 0);
|
||||
}
|
||||
else{
|
||||
epd->print("---"); // Missing bus data
|
||||
epd->print(commonData->fmt->placeholder); // Missing bus data
|
||||
}
|
||||
}
|
||||
epd->setFont(&Ubuntu_Bold16pt8b);
|
||||
|
@ -182,7 +182,9 @@ public:
|
|||
if(value2 > 9.9 && value2 <= 99.9)epd->print(value2, 1);
|
||||
if(value2 > 99.9) epd->print(value2, 0);
|
||||
}
|
||||
else epd->print("---");
|
||||
else {
|
||||
epd->print(commonData->fmt->placeholder);
|
||||
}
|
||||
epd->setFont(&Ubuntu_Bold16pt8b);
|
||||
epd->print("A");
|
||||
|
||||
|
@ -194,7 +196,9 @@ public:
|
|||
if(value3 > 9.9 && value3 <= 99.9)epd->print(value3, 1);
|
||||
if(value3 > 99.9) epd->print(value3, 0);
|
||||
}
|
||||
else epd->print("---");
|
||||
else {
|
||||
epd->print(commonData->fmt->placeholder);
|
||||
}
|
||||
epd->setFont(&Ubuntu_Bold16pt8b);
|
||||
epd->print("W");
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ public:
|
|||
if(value1 > 99.9) epd->print(value1, 0);
|
||||
}
|
||||
else {
|
||||
epd->print("---"); // Missing bus data
|
||||
epd->print(commonData->fmt->placeholder); // Missing bus data
|
||||
}
|
||||
}
|
||||
epd->setFont(&Ubuntu_Bold16pt8b);
|
||||
|
@ -179,7 +179,9 @@ public:
|
|||
if(value2 > 9.9 && value2 <= 99.9)epd->print(value2, 1);
|
||||
if(value2 > 99.9) epd->print(value2, 0);
|
||||
}
|
||||
else epd->print("---");
|
||||
else {
|
||||
epd->print(commonData->fmt->placeholder);
|
||||
}
|
||||
epd->setFont(&Ubuntu_Bold16pt8b);
|
||||
epd->print("A");
|
||||
|
||||
|
@ -191,7 +193,9 @@ public:
|
|||
if(value3 > 9.9 && value3 <= 99.9)epd->print(value3, 1);
|
||||
if(value3 > 99.9) epd->print(value3, 0);
|
||||
}
|
||||
else epd->print("---");
|
||||
else {
|
||||
epd->print(commonData->fmt->placeholder);
|
||||
}
|
||||
epd->setFont(&Ubuntu_Bold16pt8b);
|
||||
epd->print("W");
|
||||
|
||||
|
|
|
@ -249,7 +249,7 @@ public:
|
|||
}
|
||||
}
|
||||
else{
|
||||
epd->print("---"); // Missing bus data
|
||||
epd->print(commonData->fmt->placeholder); // Missing bus data
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -186,7 +186,7 @@ public:
|
|||
epd->print(abs(value3 * 180 / PI), 0); // Value
|
||||
}
|
||||
else {
|
||||
epd->print("---"); // Value
|
||||
epd->print(commonData->fmt->placeholder);
|
||||
}
|
||||
epd->setFont(&Ubuntu_Bold12pt8b);
|
||||
epd->setCursor(335, 95);
|
||||
|
|
|
@ -207,7 +207,7 @@ public:
|
|||
epd->print(svalue4); // Value
|
||||
}
|
||||
else{
|
||||
epd->print("---"); // Value
|
||||
epd->print(commonData->fmt->placeholder);
|
||||
}
|
||||
epd->setFont(&Ubuntu_Bold12pt8b);
|
||||
epd->setCursor(335, 95);
|
||||
|
|
|
@ -186,7 +186,6 @@ class BoatValueList{
|
|||
//this way each page can easily be added here
|
||||
//needs some minor tricks for the safe static initialization
|
||||
typedef std::vector<PageDescription*> Pages;
|
||||
//the page list class
|
||||
class PageList{
|
||||
public:
|
||||
Pages pages;
|
||||
|
|
|
@ -41,5 +41,10 @@
|
|||
#ifdef BOARD_OBP40S3
|
||||
DECLARE_CAPABILITY(obp40,true)
|
||||
#endif
|
||||
DECLARE_STRING_CAPABILITY(HELP_URL, "https://obp60-v2-docu.readthedocs.io/de/latest/"); // Link to help pages
|
||||
#ifdef BOARD_OBP60S3
|
||||
DECLARE_STRING_CAPABILITY(HELP_URL, "https://obp60-v2-docu.readthedocs.io/en/latest/"); // Link to help pages
|
||||
#endif
|
||||
#ifdef BOARD_OBP40S3
|
||||
DECLARE_STRING_CAPABILITY(HELP_URL, "https://obp40-v1-docu.readthedocs.io/en/latest/"); // Link to help pages
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue