Move formatValue to formatter class
This commit is contained in:
parent
fbe6c1a9a5
commit
cba21574cb
|
@ -521,7 +521,7 @@ void displayHeader(CommonData &commonData, bool symbolmode, GwApi::BoatValue *da
|
||||||
epd->print("USB ");
|
epd->print("USB ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
double gpshdop = formatValue(hdop, commonData).value;
|
double gpshdop = commonData.fmt->formatValue(hdop, commonData).value;
|
||||||
if(commonData.config->getString(commonData.config->useGPS) != "off" && gpshdop <= commonData.config->getInt(commonData.config->hdopAccuracy) && hdop->valid == true){
|
if(commonData.config->getString(commonData.config->useGPS) != "off" && gpshdop <= commonData.config->getInt(commonData.config->hdopAccuracy) && hdop->valid == true){
|
||||||
if (symbolmode) {
|
if (symbolmode) {
|
||||||
epd->drawXBitmap(symbol_x, 1, iconmap["GPS"], icon_width, icon_height, commonData.fgcolor);
|
epd->drawXBitmap(symbol_x, 1, iconmap["GPS"], icon_width, icon_height, commonData.fgcolor);
|
||||||
|
@ -606,9 +606,9 @@ void displayHeader(CommonData &commonData, bool symbolmode, GwApi::BoatValue *da
|
||||||
else if (timesource == "GPS") {
|
else if (timesource == "GPS") {
|
||||||
// Show date and time if date present
|
// Show date and time if date present
|
||||||
if(date->valid == true){
|
if(date->valid == true){
|
||||||
String acttime = formatValue(time, commonData).svalue;
|
String acttime = commonData.fmt->formatValue(time, commonData).svalue;
|
||||||
acttime = acttime.substring(0, 5);
|
acttime = acttime.substring(0, 5);
|
||||||
String actdate = formatValue(date, commonData).svalue;
|
String actdate = commonData.fmt->formatValue(date, commonData).svalue;
|
||||||
epd->print(acttime);
|
epd->print(acttime);
|
||||||
epd->print(" ");
|
epd->print(" ");
|
||||||
epd->print(actdate);
|
epd->print(actdate);
|
||||||
|
|
|
@ -22,76 +22,7 @@ Formatter::Formatter(GwConfigHandler *config) {
|
||||||
dateFormat = config->getString(config->dateFormat);
|
dateFormat = config->getString(config->dateFormat);
|
||||||
usesimudata = config->getBool(config->useSimuData);
|
usesimudata = config->getBool(config->useSimuData);
|
||||||
precision = config->getString(config->valueprecision);
|
precision = config->getString(config->valueprecision);
|
||||||
}
|
|
||||||
|
|
||||||
String formatDate(String fmttype, uint16_t year, uint8_t month, uint8_t day) {
|
|
||||||
char buffer[12];
|
|
||||||
if (fmttype == "GB") {
|
|
||||||
snprintf(buffer, 12, "%02d/%02d/%04d", day , month, year);
|
|
||||||
}
|
|
||||||
else if (fmttype == "US") {
|
|
||||||
snprintf(buffer, 12, "%02d/%02d/%04d", month, day, year);
|
|
||||||
}
|
|
||||||
else if (fmttype == "ISO") {
|
|
||||||
snprintf(buffer, 12, "%04d-%02d-%02d", year, month, day);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
snprintf(buffer, 12, "%02d.%02d.%04d", day, month, year);
|
|
||||||
}
|
|
||||||
return String(buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
String formatTime(char fmttype, uint8_t hour, uint8_t minute, uint8_t second) {
|
|
||||||
// fmttype: s: with seconds, m: only minutes
|
|
||||||
char buffer[10];
|
|
||||||
if (fmttype == 'm') {
|
|
||||||
snprintf(buffer, 10, "%02d:%02d", hour , minute);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
snprintf(buffer, 10, "%02d:%02d:%02d", hour, minute, second);
|
|
||||||
}
|
|
||||||
return String(buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
String formatLatitude(double lat) {
|
|
||||||
float degree = abs(int(lat));
|
|
||||||
float minute = abs((lat - int(lat)) * 60);
|
|
||||||
return String(degree, 0) + "\x90 " + String(minute, 4) + "' " + ((lat > 0) ? "N" : "S");
|
|
||||||
}
|
|
||||||
|
|
||||||
String formatLongitude(double lon) {
|
|
||||||
float degree = abs(int(lon));
|
|
||||||
float minute = abs((lon - int(lon)) * 60);
|
|
||||||
return String(degree, 0) + "\x90 " + String(minute, 4) + "' " + ((lon > 0) ? "E" : "W");
|
|
||||||
}
|
|
||||||
|
|
||||||
FormattedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
|
||||||
GwLog *logger = commondata.logger;
|
|
||||||
FormattedData result;
|
|
||||||
static int dayoffset = 0;
|
|
||||||
double rawvalue = 0;
|
|
||||||
|
|
||||||
// Load configuration values
|
|
||||||
String stimeZone = commondata.config->getString(commondata.config->timeZone); // [UTC -14.00...+12.00]
|
|
||||||
double timeZone = stimeZone.toDouble();
|
|
||||||
String lengthFormat = commondata.config->getString(commondata.config->lengthFormat); // [m|ft]
|
|
||||||
String distanceFormat = commondata.config->getString(commondata.config->distanceFormat); // [m|km|nm]
|
|
||||||
String speedFormat = commondata.config->getString(commondata.config->speedFormat); // [m/s|km/h|kn]
|
|
||||||
String windspeedFormat = commondata.config->getString(commondata.config->windspeedFormat); // [m/s|km/h|kn|bft]
|
|
||||||
String tempFormat = commondata.config->getString(commondata.config->tempFormat); // [K|°C|°F]
|
|
||||||
String dateFormat = commondata.config->getString(commondata.config->dateFormat); // [DE|GB|US]
|
|
||||||
bool usesimudata = commondata.config->getBool(commondata.config->useSimuData); // [on|off]
|
|
||||||
String precision = commondata.config->getString(commondata.config->valueprecision); // [1|2]
|
|
||||||
|
|
||||||
// If boat value not valid
|
|
||||||
if (! value->valid && !usesimudata){
|
|
||||||
result.svalue = "---";
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* fmt_dec_1;
|
|
||||||
const char* fmt_dec_10;
|
|
||||||
const char* fmt_dec_100;
|
|
||||||
if (precision == "1") {
|
if (precision == "1") {
|
||||||
fmt_dec_1 = "%3.1f";
|
fmt_dec_1 = "%3.1f";
|
||||||
fmt_dec_10 = "%3.0f";
|
fmt_dec_10 = "%3.0f";
|
||||||
|
@ -102,6 +33,20 @@ FormattedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
fmt_dec_100 = "%3.0f";
|
fmt_dec_100 = "%3.0f";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
FormattedData Formatter::formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
|
GwLog *logger = commondata.logger;
|
||||||
|
FormattedData result;
|
||||||
|
static int dayoffset = 0;
|
||||||
|
double rawvalue = 0;
|
||||||
|
|
||||||
|
// If boat value not valid
|
||||||
|
if (! value->valid && !usesimudata){
|
||||||
|
result.svalue = "---";
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
// LOG_DEBUG(GwLog::DEBUG,"formatValue init: getFormat: %s date->value: %f time->value: %f", value->getFormat(), commondata.date->value, commondata.time->value);
|
// LOG_DEBUG(GwLog::DEBUG,"formatValue init: getFormat: %s date->value: %f time->value: %f", value->getFormat(), commondata.date->value, commondata.time->value);
|
||||||
static const int bsize = 30;
|
static const int bsize = 30;
|
||||||
char buffer[bsize+1];
|
char buffer[bsize+1];
|
||||||
|
@ -857,4 +802,45 @@ FormattedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String formatDate(String fmttype, uint16_t year, uint8_t month, uint8_t day) {
|
||||||
|
char buffer[12];
|
||||||
|
if (fmttype == "GB") {
|
||||||
|
snprintf(buffer, 12, "%02d/%02d/%04d", day , month, year);
|
||||||
|
}
|
||||||
|
else if (fmttype == "US") {
|
||||||
|
snprintf(buffer, 12, "%02d/%02d/%04d", month, day, year);
|
||||||
|
}
|
||||||
|
else if (fmttype == "ISO") {
|
||||||
|
snprintf(buffer, 12, "%04d-%02d-%02d", year, month, day);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
snprintf(buffer, 12, "%02d.%02d.%04d", day, month, year);
|
||||||
|
}
|
||||||
|
return String(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
String formatTime(char fmttype, uint8_t hour, uint8_t minute, uint8_t second) {
|
||||||
|
// fmttype: s: with seconds, m: only minutes
|
||||||
|
char buffer[10];
|
||||||
|
if (fmttype == 'm') {
|
||||||
|
snprintf(buffer, 10, "%02d:%02d", hour , minute);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
snprintf(buffer, 10, "%02d:%02d:%02d", hour, minute, second);
|
||||||
|
}
|
||||||
|
return String(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
String formatLatitude(double lat) {
|
||||||
|
float degree = abs(int(lat));
|
||||||
|
float minute = abs((lat - int(lat)) * 60);
|
||||||
|
return String(degree, 0) + "\x90 " + String(minute, 4) + "' " + ((lat > 0) ? "N" : "S");
|
||||||
|
}
|
||||||
|
|
||||||
|
String formatLongitude(double lon) {
|
||||||
|
float degree = abs(int(lon));
|
||||||
|
float minute = abs((lon - int(lon)) * 60);
|
||||||
|
return String(degree, 0) + "\x90 " + String(minute, 4) + "' " + ((lon > 0) ? "E" : "W");
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -96,8 +96,6 @@ typedef struct {
|
||||||
} FormattedData;
|
} FormattedData;
|
||||||
|
|
||||||
// Formatter for boat values
|
// Formatter for boat values
|
||||||
FormattedData formatValue(GwApi::BoatValue *value, CommonData &commondata);
|
|
||||||
|
|
||||||
class Formatter {
|
class Formatter {
|
||||||
private:
|
private:
|
||||||
String stimeZone = "0";
|
String stimeZone = "0";
|
||||||
|
@ -109,9 +107,15 @@ private:
|
||||||
String tempFormat = "C"; // [K|°C|°F]
|
String tempFormat = "C"; // [K|°C|°F]
|
||||||
String dateFormat = "ISO"; // [DE|GB|US|ISO]
|
String dateFormat = "ISO"; // [DE|GB|US|ISO]
|
||||||
bool usesimudata = false; // [on|off]
|
bool usesimudata = false; // [on|off]
|
||||||
|
|
||||||
String precision = "2"; // [1|2]
|
String precision = "2"; // [1|2]
|
||||||
|
const char* fmt_dec_1;
|
||||||
|
const char* fmt_dec_10;
|
||||||
|
const char* fmt_dec_100;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Formatter(GwConfigHandler *config);
|
Formatter(GwConfigHandler *config);
|
||||||
|
FormattedData formatValue(GwApi::BoatValue *value, CommonData &commondata);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Standard format functions without overhead
|
// Standard format functions without overhead
|
||||||
|
|
|
@ -77,22 +77,22 @@ private:
|
||||||
|
|
||||||
// Boatvalues: DBS, HDT, AWS, AWD, LAT, LON, HDOP
|
// Boatvalues: DBS, HDT, AWS, AWD, LAT, LON, HDOP
|
||||||
GwApi::BoatValue *bv_dbs = pageData.values[0]; // DBS
|
GwApi::BoatValue *bv_dbs = pageData.values[0]; // DBS
|
||||||
String sval_dbs = formatValue(bv_dbs, *commonData).svalue;
|
String sval_dbs = commonData->fmt->formatValue(bv_dbs, *commonData).svalue;
|
||||||
String sunit_dbs = formatValue(bv_dbs, *commonData).unit;
|
String sunit_dbs = commonData->fmt->formatValue(bv_dbs, *commonData).unit;
|
||||||
GwApi::BoatValue *bv_hdt = pageData.values[1]; // HDT
|
GwApi::BoatValue *bv_hdt = pageData.values[1]; // HDT
|
||||||
String sval_hdt = formatValue(bv_hdt, *commonData).svalue;
|
String sval_hdt = commonData->fmt->formatValue(bv_hdt, *commonData).svalue;
|
||||||
GwApi::BoatValue *bv_aws = pageData.values[2]; // AWS
|
GwApi::BoatValue *bv_aws = pageData.values[2]; // AWS
|
||||||
String sval_aws = formatValue(bv_aws, *commonData).svalue;
|
String sval_aws = commonData->fmt->formatValue(bv_aws, *commonData).svalue;
|
||||||
String sunit_aws = formatValue(bv_aws, *commonData).unit;
|
String sunit_aws = commonData->fmt->formatValue(bv_aws, *commonData).unit;
|
||||||
GwApi::BoatValue *bv_awd = pageData.values[3]; // AWD
|
GwApi::BoatValue *bv_awd = pageData.values[3]; // AWD
|
||||||
String sval_awd = formatValue(bv_awd, *commonData).svalue;
|
String sval_awd = commonData->fmt->formatValue(bv_awd, *commonData).svalue;
|
||||||
GwApi::BoatValue *bv_lat = pageData.values[4]; // LAT
|
GwApi::BoatValue *bv_lat = pageData.values[4]; // LAT
|
||||||
String sval_lat = formatValue(bv_lat, *commonData).svalue;
|
String sval_lat = commonData->fmt->formatValue(bv_lat, *commonData).svalue;
|
||||||
GwApi::BoatValue *bv_lon = pageData.values[5]; // LON
|
GwApi::BoatValue *bv_lon = pageData.values[5]; // LON
|
||||||
String sval_lon = formatValue(bv_lon, *commonData).svalue;
|
String sval_lon = commonData->fmt->formatValue(bv_lon, *commonData).svalue;
|
||||||
GwApi::BoatValue *bv_hdop = pageData.values[6]; // HDOP
|
GwApi::BoatValue *bv_hdop = pageData.values[6]; // HDOP
|
||||||
String sval_hdop = formatValue(bv_hdop, *commonData).svalue;
|
String sval_hdop = commonData->fmt->formatValue(bv_hdop, *commonData).svalue;
|
||||||
String sunit_hdop = formatValue(bv_hdop, *commonData).unit;
|
String sunit_hdop = commonData->fmt->formatValue(bv_hdop, *commonData).unit;
|
||||||
|
|
||||||
logger->logDebug(GwLog::DEBUG, "Drawing at PageAnchor; DBS=%f, HDT=%f, AWS=%f", bv_dbs->value, bv_hdt->value, bv_aws->value);
|
logger->logDebug(GwLog::DEBUG, "Drawing at PageAnchor; DBS=%f, HDT=%f, AWS=%f", bv_dbs->value, bv_hdt->value, bv_aws->value);
|
||||||
|
|
||||||
|
|
|
@ -135,8 +135,8 @@ public:
|
||||||
value1 = simtime++; // Simulation data for time value 11:36 in seconds
|
value1 = simtime++; // Simulation data for time value 11:36 in seconds
|
||||||
} // Other simulation data see OBP60Formatter.cpp
|
} // Other simulation data see OBP60Formatter.cpp
|
||||||
bool valid1 = bvalue1->valid; // Valid information
|
bool valid1 = bvalue1->valid; // Valid information
|
||||||
String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue1 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue1, *commonData).unit; // Unit of value
|
||||||
if(valid1 == true){
|
if(valid1 == true){
|
||||||
svalue1old = svalue1; // Save old value
|
svalue1old = svalue1; // Save old value
|
||||||
unit1old = unit1; // Save old unit
|
unit1old = unit1; // Save old unit
|
||||||
|
@ -148,8 +148,8 @@ public:
|
||||||
name2 = name2.substring(0, 6); // String length limit for value name
|
name2 = name2.substring(0, 6); // String length limit for value name
|
||||||
value2 = bvalue2->value; // Value as double in SI unit
|
value2 = bvalue2->value; // Value as double in SI unit
|
||||||
bool valid2 = bvalue2->valid; // Valid information
|
bool valid2 = bvalue2->valid; // Valid information
|
||||||
String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue2 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue2, *commonData).unit; // Unit of value
|
||||||
if(valid2 == true){
|
if(valid2 == true){
|
||||||
svalue2old = svalue2; // Save old value
|
svalue2old = svalue2; // Save old value
|
||||||
unit2old = unit2; // Save old unit
|
unit2old = unit2; // Save old unit
|
||||||
|
@ -161,8 +161,8 @@ public:
|
||||||
name3 = name3.substring(0, 6); // String length limit for value name
|
name3 = name3.substring(0, 6); // String length limit for value name
|
||||||
value3 = bvalue3->value; // Value as double in SI unit
|
value3 = bvalue3->value; // Value as double in SI unit
|
||||||
bool valid3 = bvalue3->valid; // Valid information
|
bool valid3 = bvalue3->valid; // Valid information
|
||||||
String svalue3 = formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue3 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue3, *commonData).unit; // Unit of value
|
||||||
if(valid3 == true){
|
if(valid3 == true){
|
||||||
svalue3old = svalue3; // Save old value
|
svalue3old = svalue3; // Save old value
|
||||||
unit3old = unit3; // Save old unit
|
unit3old = unit3; // Save old unit
|
||||||
|
|
|
@ -88,10 +88,10 @@ public:
|
||||||
|
|
||||||
for (int i = 0; i < HowManyValues; i++){
|
for (int i = 0; i < HowManyValues; i++){
|
||||||
bvalue = pageData.values[i];
|
bvalue = pageData.values[i];
|
||||||
TheFormattedData = formatValue(bvalue, *commonData);
|
TheFormattedData = commonData->fmt->formatValue(bvalue, *commonData);
|
||||||
DataName[i] = xdrDelete(bvalue->getName());
|
DataName[i] = xdrDelete(bvalue->getName());
|
||||||
DataName[i] = DataName[i].substring(0, 6); // String length limit for value name
|
DataName[i] = DataName[i].substring(0, 6); // String length limit for value name
|
||||||
DataUnits[i] = formatValue(bvalue, *commonData).unit;
|
DataUnits[i] = commonData->fmt->formatValue(bvalue, *commonData).unit;
|
||||||
DataText[i] = TheFormattedData.svalue; // Formatted value as string including unit conversion and switching decimal places
|
DataText[i] = TheFormattedData.svalue; // Formatted value as string including unit conversion and switching decimal places
|
||||||
DataValue[i] = TheFormattedData.value; // Value as double in SI unit
|
DataValue[i] = TheFormattedData.value; // Value as double in SI unit
|
||||||
DataValid[i] = bvalue->valid;
|
DataValid[i] = bvalue->valid;
|
||||||
|
|
|
@ -45,8 +45,8 @@ public:
|
||||||
name1 = name1.substring(0, 6); // String length limit for value name
|
name1 = name1.substring(0, 6); // String length limit for value name
|
||||||
double value1 = bvalue1->value; // Value as double in SI unit
|
double value1 = bvalue1->value; // Value as double in SI unit
|
||||||
bool valid1 = bvalue1->valid; // Valid information
|
bool valid1 = bvalue1->valid; // Valid information
|
||||||
String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue1 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue1, *commonData).unit; // Unit of value
|
||||||
|
|
||||||
// Get boat values #2
|
// Get boat values #2
|
||||||
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list (only one value by PageOneValue)
|
||||||
|
@ -54,8 +54,8 @@ public:
|
||||||
name2 = name2.substring(0, 6); // String length limit for value name
|
name2 = name2.substring(0, 6); // String length limit for value name
|
||||||
double value2 = bvalue2->value; // Value as double in SI unit
|
double value2 = bvalue2->value; // Value as double in SI unit
|
||||||
bool valid2 = bvalue2->valid; // Valid information
|
bool valid2 = bvalue2->valid; // Valid information
|
||||||
String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue2 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue2, *commonData).unit; // Unit of value
|
||||||
|
|
||||||
// Get boat values #3
|
// Get boat values #3
|
||||||
GwApi::BoatValue *bvalue3 = pageData.values[2]; // Second element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue3 = pageData.values[2]; // Second element in list (only one value by PageOneValue)
|
||||||
|
@ -63,8 +63,8 @@ public:
|
||||||
name3 = name3.substring(0, 6); // String length limit for value name
|
name3 = name3.substring(0, 6); // String length limit for value name
|
||||||
double value3 = bvalue3->value; // Value as double in SI unit
|
double value3 = bvalue3->value; // Value as double in SI unit
|
||||||
bool valid3 = bvalue3->valid; // Valid information
|
bool valid3 = bvalue3->valid; // Valid information
|
||||||
String svalue3 = formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue3 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue3, *commonData).unit; // Unit of value
|
||||||
|
|
||||||
// Get boat values #4
|
// Get boat values #4
|
||||||
GwApi::BoatValue *bvalue4 = pageData.values[3]; // Second element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue4 = pageData.values[3]; // Second element in list (only one value by PageOneValue)
|
||||||
|
@ -72,8 +72,8 @@ public:
|
||||||
name4 = name4.substring(0, 6); // String length limit for value name
|
name4 = name4.substring(0, 6); // String length limit for value name
|
||||||
double value4 = bvalue4->value; // Value as double in SI unit
|
double value4 = bvalue4->value; // Value as double in SI unit
|
||||||
bool valid4 = bvalue4->valid; // Valid information
|
bool valid4 = bvalue4->valid; // Valid information
|
||||||
String svalue4 = formatValue(bvalue4, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue4 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue4, *commonData).unit; // Unit of value
|
||||||
|
|
||||||
// Optical warning by limit violation (unused)
|
// Optical warning by limit violation (unused)
|
||||||
if(String(flashLED) == "Limit Violation"){
|
if(String(flashLED) == "Limit Violation"){
|
||||||
|
|
|
@ -57,8 +57,8 @@ public:
|
||||||
calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated
|
||||||
double value1 = bvalue1->value; // Value as double in SI unit
|
double value1 = bvalue1->value; // Value as double in SI unit
|
||||||
bool valid1 = bvalue1->valid; // Valid information
|
bool valid1 = bvalue1->valid; // Valid information
|
||||||
String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue1 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue1, *commonData).unit; // Unit of value
|
||||||
|
|
||||||
// Get boat values #2
|
// Get boat values #2
|
||||||
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list
|
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list
|
||||||
|
@ -67,8 +67,8 @@ public:
|
||||||
calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated
|
||||||
double value2 = bvalue2->value; // Value as double in SI unit
|
double value2 = bvalue2->value; // Value as double in SI unit
|
||||||
bool valid2 = bvalue2->valid; // Valid information
|
bool valid2 = bvalue2->valid; // Valid information
|
||||||
String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue2 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue2, *commonData).unit; // Unit of value
|
||||||
|
|
||||||
// Get boat values #3
|
// Get boat values #3
|
||||||
GwApi::BoatValue *bvalue3 = pageData.values[2]; // Third element in list
|
GwApi::BoatValue *bvalue3 = pageData.values[2]; // Third element in list
|
||||||
|
@ -77,8 +77,8 @@ public:
|
||||||
calibrationData.calibrateInstance(bvalue3, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue3, logger); // Check if boat data value is to be calibrated
|
||||||
double value3 = bvalue3->value; // Value as double in SI unit
|
double value3 = bvalue3->value; // Value as double in SI unit
|
||||||
bool valid3 = bvalue3->valid; // Valid information
|
bool valid3 = bvalue3->valid; // Valid information
|
||||||
String svalue3 = formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue3 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue3, *commonData).unit; // Unit of value
|
||||||
|
|
||||||
// Get boat values #4
|
// Get boat values #4
|
||||||
GwApi::BoatValue *bvalue4 = pageData.values[3]; // Fourth element in list
|
GwApi::BoatValue *bvalue4 = pageData.values[3]; // Fourth element in list
|
||||||
|
@ -87,8 +87,8 @@ public:
|
||||||
calibrationData.calibrateInstance(bvalue4, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue4, logger); // Check if boat data value is to be calibrated
|
||||||
double value4 = bvalue4->value; // Value as double in SI unit
|
double value4 = bvalue4->value; // Value as double in SI unit
|
||||||
bool valid4 = bvalue4->valid; // Valid information
|
bool valid4 = bvalue4->valid; // Valid information
|
||||||
String svalue4 = formatValue(bvalue4, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue4 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue4, *commonData).unit; // Unit of value
|
||||||
|
|
||||||
// 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?
|
||||||
|
|
|
@ -57,8 +57,8 @@ public:
|
||||||
calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated
|
||||||
double value1 = bvalue1->value; // Value as double in SI unit
|
double value1 = bvalue1->value; // Value as double in SI unit
|
||||||
bool valid1 = bvalue1->valid; // Valid information
|
bool valid1 = bvalue1->valid; // Valid information
|
||||||
String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue1 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue1, *commonData).unit; // Unit of value
|
||||||
|
|
||||||
// Get boat values #2
|
// Get boat values #2
|
||||||
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list (only one value by PageOneValue)
|
||||||
|
@ -67,8 +67,8 @@ public:
|
||||||
calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated
|
||||||
double value2 = bvalue2->value; // Value as double in SI unit
|
double value2 = bvalue2->value; // Value as double in SI unit
|
||||||
bool valid2 = bvalue2->valid; // Valid information
|
bool valid2 = bvalue2->valid; // Valid information
|
||||||
String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue2 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue2, *commonData).unit; // Unit of value
|
||||||
|
|
||||||
// Get boat values #3
|
// Get boat values #3
|
||||||
GwApi::BoatValue *bvalue3 = pageData.values[2]; // Second element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue3 = pageData.values[2]; // Second element in list (only one value by PageOneValue)
|
||||||
|
@ -77,8 +77,8 @@ public:
|
||||||
calibrationData.calibrateInstance(bvalue3, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue3, logger); // Check if boat data value is to be calibrated
|
||||||
double value3 = bvalue3->value; // Value as double in SI unit
|
double value3 = bvalue3->value; // Value as double in SI unit
|
||||||
bool valid3 = bvalue3->valid; // Valid information
|
bool valid3 = bvalue3->valid; // Valid information
|
||||||
String svalue3 = formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue3 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue3, *commonData).unit; // Unit of value
|
||||||
|
|
||||||
// Get boat values #4
|
// Get boat values #4
|
||||||
GwApi::BoatValue *bvalue4 = pageData.values[3]; // Second element in list (only one value by PageOneValue)
|
GwApi::BoatValue *bvalue4 = pageData.values[3]; // Second element in list (only one value by PageOneValue)
|
||||||
|
@ -87,8 +87,8 @@ public:
|
||||||
calibrationData.calibrateInstance(bvalue4, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue4, logger); // Check if boat data value is to be calibrated
|
||||||
double value4 = bvalue4->value; // Value as double in SI unit
|
double value4 = bvalue4->value; // Value as double in SI unit
|
||||||
bool valid4 = bvalue4->valid; // Valid information
|
bool valid4 = bvalue4->valid; // Valid information
|
||||||
String svalue4 = formatValue(bvalue4, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue4 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue4, *commonData).unit; // Unit of value
|
||||||
|
|
||||||
// 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?
|
||||||
|
|
|
@ -52,8 +52,8 @@ public:
|
||||||
calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated
|
||||||
double value1 = bvalue1->value; // Value as double in SI unit
|
double value1 = bvalue1->value; // Value as double in SI unit
|
||||||
bool valid1 = bvalue1->valid; // Valid information
|
bool valid1 = bvalue1->valid; // Valid information
|
||||||
String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue1 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue1, *commonData).unit; // Unit of value
|
||||||
|
|
||||||
// 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?
|
||||||
|
|
|
@ -52,8 +52,8 @@ public:
|
||||||
calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated
|
||||||
value1 = bvalue1->value; // Raw value without unit convertion
|
value1 = bvalue1->value; // Raw value without unit convertion
|
||||||
bool valid1 = bvalue1->valid; // Valid information
|
bool valid1 = bvalue1->valid; // Valid information
|
||||||
String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue1 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue1, *commonData).unit; // Unit of value
|
||||||
|
|
||||||
if (valid1 == true) {
|
if (valid1 == true) {
|
||||||
value1old = value1; // Save old value
|
value1old = value1; // Save old value
|
||||||
|
|
|
@ -68,8 +68,8 @@ public:
|
||||||
calibrationData.calibrateInstance(bvalue, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue, logger); // Check if boat data value is to be calibrated
|
||||||
DataValue[i] = bvalue->value; // Value as double in SI unit
|
DataValue[i] = bvalue->value; // Value as double in SI unit
|
||||||
DataValid[i] = bvalue->valid;
|
DataValid[i] = bvalue->valid;
|
||||||
DataText[i] = formatValue(bvalue, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
DataText[i] = commonData->fmt->formatValue(bvalue, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
||||||
DataUnits[i] = formatValue(bvalue, *commonData).unit;
|
DataUnits[i] = commonData->fmt->formatValue(bvalue, *commonData).unit;
|
||||||
DataFormat[i] = bvalue->getFormat(); // Unit of value
|
DataFormat[i] = bvalue->getFormat(); // Unit of value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,17 +50,17 @@ public:
|
||||||
epd->setFont(&Ubuntu_Bold8pt8b);
|
epd->setFont(&Ubuntu_Bold8pt8b);
|
||||||
|
|
||||||
GwApi::BoatValue *bv_lat = pageData.values[0];
|
GwApi::BoatValue *bv_lat = pageData.values[0];
|
||||||
String sv_lat = formatValue(bv_lat, *commonData).svalue;
|
String sv_lat = commonData->fmt->formatValue(bv_lat, *commonData).svalue;
|
||||||
//epd->setCursor(300, 40);
|
//epd->setCursor(300, 40);
|
||||||
//epd->print(sv_lat);
|
//epd->print(sv_lat);
|
||||||
|
|
||||||
GwApi::BoatValue *bv_lon = pageData.values[1];
|
GwApi::BoatValue *bv_lon = pageData.values[1];
|
||||||
String sv_lon = formatValue(bv_lon, *commonData).svalue;
|
String sv_lon = commonData->fmt->formatValue(bv_lon, *commonData).svalue;
|
||||||
//epd->setCursor(300, 60);
|
//epd->setCursor(300, 60);
|
||||||
//epd->print(sv_lon);
|
//epd->print(sv_lon);
|
||||||
|
|
||||||
GwApi::BoatValue *bv_hdop = pageData.values[2];
|
GwApi::BoatValue *bv_hdop = pageData.values[2];
|
||||||
String sv_hdop = formatValue(bv_hdop, *commonData).svalue;
|
String sv_hdop = commonData->fmt->formatValue(bv_hdop, *commonData).svalue;
|
||||||
//epd->setCursor(300, 80);
|
//epd->setCursor(300, 80);
|
||||||
//epd->print(sv_hdop);
|
//epd->print(sv_hdop);
|
||||||
|
|
||||||
|
|
|
@ -55,8 +55,8 @@ public:
|
||||||
calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated
|
||||||
double value1 = bvalue1->value; // Value as double in SI unit
|
double value1 = bvalue1->value; // Value as double in SI unit
|
||||||
bool valid1 = bvalue1->valid; // Valid information
|
bool valid1 = bvalue1->valid; // Valid information
|
||||||
String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue1 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue1, *commonData).unit; // Unit of value
|
||||||
|
|
||||||
// Get boat values #2
|
// Get boat values #2
|
||||||
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list
|
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list
|
||||||
|
@ -65,8 +65,8 @@ public:
|
||||||
calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated
|
||||||
double value2 = bvalue2->value; // Value as double in SI unit
|
double value2 = bvalue2->value; // Value as double in SI unit
|
||||||
bool valid2 = bvalue2->valid; // Valid information
|
bool valid2 = bvalue2->valid; // Valid information
|
||||||
String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue2 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue2, *commonData).unit; // Unit of value
|
||||||
|
|
||||||
// Get boat values #3
|
// Get boat values #3
|
||||||
GwApi::BoatValue *bvalue3 = pageData.values[2]; // Third element in list
|
GwApi::BoatValue *bvalue3 = pageData.values[2]; // Third element in list
|
||||||
|
@ -75,8 +75,8 @@ public:
|
||||||
calibrationData.calibrateInstance(bvalue3, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue3, logger); // Check if boat data value is to be calibrated
|
||||||
double value3 = bvalue3->value; // Value as double in SI unit
|
double value3 = bvalue3->value; // Value as double in SI unit
|
||||||
bool valid3 = bvalue3->valid; // Valid information
|
bool valid3 = bvalue3->valid; // Valid information
|
||||||
String svalue3 = formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue3 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue3, *commonData).unit; // Unit of value
|
||||||
|
|
||||||
// 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?
|
||||||
|
|
|
@ -54,8 +54,8 @@ public:
|
||||||
calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated
|
||||||
double value1 = bvalue1->value; // Value as double in SI unit
|
double value1 = bvalue1->value; // Value as double in SI unit
|
||||||
bool valid1 = bvalue1->valid; // Valid information
|
bool valid1 = bvalue1->valid; // Valid information
|
||||||
String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue1 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue1, *commonData).unit; // Unit of value
|
||||||
|
|
||||||
// Get boat values #2
|
// Get boat values #2
|
||||||
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list
|
GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list
|
||||||
|
@ -64,8 +64,8 @@ public:
|
||||||
calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated
|
||||||
double value2 = bvalue2->value; // Value as double in SI unit
|
double value2 = bvalue2->value; // Value as double in SI unit
|
||||||
bool valid2 = bvalue2->valid; // Valid information
|
bool valid2 = bvalue2->valid; // Valid information
|
||||||
String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue2 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue2, *commonData).unit; // Unit of value
|
||||||
|
|
||||||
// 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?
|
||||||
|
|
|
@ -334,8 +334,8 @@ public:
|
||||||
calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated
|
||||||
double value1 = bvalue1->value; // Value as double in SI unit
|
double value1 = bvalue1->value; // Value as double in SI unit
|
||||||
// bool valid1 = bvalue1->valid; // Valid information
|
// bool valid1 = bvalue1->valid; // Valid information
|
||||||
String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue1 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue1, *commonData).unit; // Unit of value
|
||||||
|
|
||||||
// Get boat values for angle (AWD/TWD)
|
// Get boat values for angle (AWD/TWD)
|
||||||
if (source == 'A') {
|
if (source == 'A') {
|
||||||
|
@ -351,8 +351,8 @@ public:
|
||||||
if (simulation) {
|
if (simulation) {
|
||||||
value2 = 0.62731; // some random value
|
value2 = 0.62731; // some random value
|
||||||
}
|
}
|
||||||
String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue2 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue2, *commonData).unit; // Unit of value
|
||||||
|
|
||||||
// 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?
|
||||||
|
|
|
@ -261,8 +261,8 @@ public:
|
||||||
calibrationData.calibrateInstance(bvalue, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue, logger); // Check if boat data value is to be calibrated
|
||||||
BDataValue[i] = bvalue->value; // Value as double in SI unit
|
BDataValue[i] = bvalue->value; // Value as double in SI unit
|
||||||
BDataValid[i] = bvalue->valid;
|
BDataValid[i] = bvalue->valid;
|
||||||
BDataText[i] = formatValue(bvalue, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
BDataText[i] = commonData->fmt->formatValue(bvalue, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
||||||
BDataUnit[i] = formatValue(bvalue, *commonData).unit;
|
BDataUnit[i] = commonData->fmt->formatValue(bvalue, *commonData).unit;
|
||||||
BDataFormat[i] = bvalue->getFormat(); // Unit of value
|
BDataFormat[i] = bvalue->getFormat(); // Unit of value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,7 +459,7 @@ public:
|
||||||
wsValue = wsHstry->getLast();
|
wsValue = wsHstry->getLast();
|
||||||
wsBVal->value = wsValue; // temp variable to retreive data unit from OBP60Formater
|
wsBVal->value = wsValue; // temp variable to retreive data unit from OBP60Formater
|
||||||
wsBVal->valid = (static_cast<int16_t>(wsValue) != wsHstry->getMinVal());
|
wsBVal->valid = (static_cast<int16_t>(wsValue) != wsHstry->getMinVal());
|
||||||
wsUnit = formatValue(wsBVal, *commonData).unit; // Unit of value
|
wsUnit = commonData->fmt->formatValue(wsBVal, *commonData).unit; // Unit of value
|
||||||
epd->fillRect(xPosTws - 4, yPosTws - 38, 142, 44, commonData->bgcolor); // Clear area for TWS value
|
epd->fillRect(xPosTws - 4, yPosTws - 38, 142, 44, commonData->bgcolor); // Clear area for TWS value
|
||||||
epd->setFont(&DSEG7Classic_BoldItalic16pt7b);
|
epd->setFont(&DSEG7Classic_BoldItalic16pt7b);
|
||||||
epd->setCursor(xPosTws, yPosTws);
|
epd->setCursor(xPosTws, yPosTws);
|
||||||
|
|
|
@ -62,9 +62,9 @@ public:
|
||||||
calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated
|
||||||
double value1 = bvalue1->value; // Value as double in SI unit
|
double value1 = bvalue1->value; // Value as double in SI unit
|
||||||
bool valid1 = bvalue1->valid; // Valid information
|
bool valid1 = bvalue1->valid; // Valid information
|
||||||
value1 = formatValue(bvalue1, *commonData).value;// Format only nesaccery for simulation data for pointer
|
value1 = commonData->fmt->formatValue(bvalue1, *commonData).value;// Format only nesaccery for simulation data for pointer
|
||||||
String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue1 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue1, *commonData).unit; // Unit of value
|
||||||
if(valid1 == true){
|
if(valid1 == true){
|
||||||
svalue1old = svalue1; // Save old value
|
svalue1old = svalue1; // Save old value
|
||||||
unit1old = unit1; // Save old unit
|
unit1old = unit1; // Save old unit
|
||||||
|
@ -77,8 +77,8 @@ public:
|
||||||
calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue2, logger); // Check if boat data value is to be calibrated
|
||||||
double value2 = bvalue2->value; // Value as double in SI unit
|
double value2 = bvalue2->value; // Value as double in SI unit
|
||||||
bool valid2 = bvalue2->valid; // Valid information
|
bool valid2 = bvalue2->valid; // Valid information
|
||||||
String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue2 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue2, *commonData).unit; // Unit of value
|
||||||
if(valid2 == true){
|
if(valid2 == true){
|
||||||
svalue2old = svalue2; // Save old value
|
svalue2old = svalue2; // Save old value
|
||||||
unit2old = unit2; // Save old unit
|
unit2old = unit2; // Save old unit
|
||||||
|
@ -91,8 +91,8 @@ public:
|
||||||
calibrationData.calibrateInstance(bvalue3, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue3, logger); // Check if boat data value is to be calibrated
|
||||||
double value3 = bvalue3->value; // Value as double in SI unit
|
double value3 = bvalue3->value; // Value as double in SI unit
|
||||||
bool valid3 = bvalue3->valid; // Valid information
|
bool valid3 = bvalue3->valid; // Valid information
|
||||||
String svalue3 = formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue3 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue3, *commonData).unit; // Unit of value
|
||||||
if(valid3 == true){
|
if(valid3 == true){
|
||||||
svalue3old = svalue3; // Save old value
|
svalue3old = svalue3; // Save old value
|
||||||
unit3old = unit3; // Save old unit
|
unit3old = unit3; // Save old unit
|
||||||
|
@ -105,8 +105,8 @@ public:
|
||||||
calibrationData.calibrateInstance(bvalue4, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue4, logger); // Check if boat data value is to be calibrated
|
||||||
double value4 = bvalue4->value; // Value as double in SI unit
|
double value4 = bvalue4->value; // Value as double in SI unit
|
||||||
bool valid4 = bvalue4->valid; // Valid information
|
bool valid4 = bvalue4->valid; // Valid information
|
||||||
String svalue4 = formatValue(bvalue4, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue4 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue4, *commonData).unit; // Unit of value
|
||||||
if(valid4 == true){
|
if(valid4 == true){
|
||||||
svalue4old = svalue4; // Save old value
|
svalue4old = svalue4; // Save old value
|
||||||
unit4old = unit4; // Save old unit
|
unit4old = unit4; // Save old unit
|
||||||
|
@ -119,8 +119,8 @@ public:
|
||||||
calibrationData.calibrateInstance(bvalue5, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue5, logger); // Check if boat data value is to be calibrated
|
||||||
double value5 = bvalue5->value; // Value as double in SI unit
|
double value5 = bvalue5->value; // Value as double in SI unit
|
||||||
bool valid5 = bvalue5->valid; // Valid information
|
bool valid5 = bvalue5->valid; // Valid information
|
||||||
String svalue5 = formatValue(bvalue5, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue5 = commonData->fmt->formatValue(bvalue5, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
||||||
String unit5 = formatValue(bvalue5, *commonData).unit; // Unit of value
|
String unit5 = commonData->fmt->formatValue(bvalue5, *commonData).unit; // Unit of value
|
||||||
if(valid5 == true){
|
if(valid5 == true){
|
||||||
svalue5old = svalue5; // Save old value
|
svalue5old = svalue5; // Save old value
|
||||||
unit5old = unit5; // Save old unit
|
unit5old = unit5; // Save old unit
|
||||||
|
@ -133,8 +133,8 @@ public:
|
||||||
calibrationData.calibrateInstance(bvalue6, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue6, logger); // Check if boat data value is to be calibrated
|
||||||
double value6 = bvalue6->value; // Value as double in SI unit
|
double value6 = bvalue6->value; // Value as double in SI unit
|
||||||
bool valid6 = bvalue6->valid; // Valid information
|
bool valid6 = bvalue6->valid; // Valid information
|
||||||
String svalue6 = formatValue(bvalue6, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue6 = commonData->fmt->formatValue(bvalue6, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
||||||
String unit6 = formatValue(bvalue6, *commonData).unit; // Unit of value
|
String unit6 = commonData->fmt->formatValue(bvalue6, *commonData).unit; // Unit of value
|
||||||
if(valid6 == true){
|
if(valid6 == true){
|
||||||
svalue6old = svalue6; // Save old value
|
svalue6old = svalue6; // Save old value
|
||||||
unit6old = unit6; // Save old unit
|
unit6old = unit6; // Save old unit
|
||||||
|
|
|
@ -76,8 +76,8 @@ public:
|
||||||
calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue1, logger); // Check if boat data value is to be calibrated
|
||||||
double value1 = bvalue1->value; // Value as double in SI unit
|
double value1 = bvalue1->value; // Value as double in SI unit
|
||||||
bool valid1 = bvalue1->valid; // Valid information
|
bool valid1 = bvalue1->valid; // Valid information
|
||||||
String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue1 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue1, *commonData).unit; // Unit of value
|
||||||
if (valid1 == true) {
|
if (valid1 == true) {
|
||||||
svalue1old = svalue1; // Save old value
|
svalue1old = svalue1; // Save old value
|
||||||
unit1old = unit1; // Save old unit
|
unit1old = unit1; // Save old unit
|
||||||
|
@ -97,8 +97,8 @@ public:
|
||||||
if (simulation) {
|
if (simulation) {
|
||||||
value2 = 0.62731; // some random value
|
value2 = 0.62731; // some random value
|
||||||
}
|
}
|
||||||
String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue2 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue2, *commonData).unit; // Unit of value
|
||||||
if (valid2 == true) {
|
if (valid2 == true) {
|
||||||
svalue2old = svalue2; // Save old value
|
svalue2old = svalue2; // Save old value
|
||||||
unit2old = unit2; // Save old unit
|
unit2old = unit2; // Save old unit
|
||||||
|
@ -111,8 +111,8 @@ public:
|
||||||
calibrationData.calibrateInstance(bvalue3, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue3, logger); // Check if boat data value is to be calibrated
|
||||||
double value3 = bvalue3->value; // Value as double in SI unit
|
double value3 = bvalue3->value; // Value as double in SI unit
|
||||||
bool valid3 = bvalue3->valid; // Valid information
|
bool valid3 = bvalue3->valid; // Valid information
|
||||||
String svalue3 = formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue3 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue3, *commonData).unit; // Unit of value
|
||||||
if(valid3 == true){
|
if(valid3 == true){
|
||||||
svalue3old = svalue3; // Save old value
|
svalue3old = svalue3; // Save old value
|
||||||
unit3old = unit3; // Save old unit
|
unit3old = unit3; // Save old unit
|
||||||
|
@ -125,8 +125,8 @@ public:
|
||||||
calibrationData.calibrateInstance(bvalue4, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue4, logger); // Check if boat data value is to be calibrated
|
||||||
double value4 = bvalue4->value; // Value as double in SI unit
|
double value4 = bvalue4->value; // Value as double in SI unit
|
||||||
bool valid4 = bvalue4->valid; // Valid information
|
bool valid4 = bvalue4->valid; // Valid information
|
||||||
String svalue4 = formatValue(bvalue4, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue4 = commonData->fmt->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 = commonData->fmt->formatValue(bvalue4, *commonData).unit; // Unit of value
|
||||||
if(valid4 == true){
|
if(valid4 == true){
|
||||||
svalue4old = svalue4; // Save old value
|
svalue4old = svalue4; // Save old value
|
||||||
unit4old = unit4; // Save old unit
|
unit4old = unit4; // Save old unit
|
||||||
|
@ -139,8 +139,8 @@ public:
|
||||||
calibrationData.calibrateInstance(bvalue5, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue5, logger); // Check if boat data value is to be calibrated
|
||||||
double value5 = bvalue5->value; // Value as double in SI unit
|
double value5 = bvalue5->value; // Value as double in SI unit
|
||||||
bool valid5 = bvalue5->valid; // Valid information
|
bool valid5 = bvalue5->valid; // Valid information
|
||||||
String svalue5 = formatValue(bvalue5, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue5 = commonData->fmt->formatValue(bvalue5, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
||||||
String unit5 = formatValue(bvalue5, *commonData).unit; // Unit of value
|
String unit5 = commonData->fmt->formatValue(bvalue5, *commonData).unit; // Unit of value
|
||||||
if(valid5 == true){
|
if(valid5 == true){
|
||||||
svalue5old = svalue5; // Save old value
|
svalue5old = svalue5; // Save old value
|
||||||
unit5old = unit5; // Save old unit
|
unit5old = unit5; // Save old unit
|
||||||
|
@ -153,8 +153,8 @@ public:
|
||||||
calibrationData.calibrateInstance(bvalue6, logger); // Check if boat data value is to be calibrated
|
calibrationData.calibrateInstance(bvalue6, logger); // Check if boat data value is to be calibrated
|
||||||
double value6 = bvalue6->value; // Value as double in SI unit
|
double value6 = bvalue6->value; // Value as double in SI unit
|
||||||
bool valid6 = bvalue6->valid; // Valid information
|
bool valid6 = bvalue6->valid; // Valid information
|
||||||
String svalue6 = formatValue(bvalue6, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
String svalue6 = commonData->fmt->formatValue(bvalue6, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places
|
||||||
String unit6 = formatValue(bvalue6, *commonData).unit; // Unit of value
|
String unit6 = commonData->fmt->formatValue(bvalue6, *commonData).unit; // Unit of value
|
||||||
if(valid6 == true){
|
if(valid6 == true){
|
||||||
svalue6old = svalue6; // Save old value
|
svalue6old = svalue6; // Save old value
|
||||||
unit6old = unit6; // Save old unit
|
unit6old = unit6; // Save old unit
|
||||||
|
|
|
@ -110,25 +110,25 @@ public:
|
||||||
uint16_t w, h;
|
uint16_t w, h;
|
||||||
|
|
||||||
GwApi::BoatValue *bv_xte = pageData.values[0]; // XTE
|
GwApi::BoatValue *bv_xte = pageData.values[0]; // XTE
|
||||||
String sval_xte = formatValue(bv_xte, *commonData).svalue;
|
String sval_xte = commonData->fmt->formatValue(bv_xte, *commonData).svalue;
|
||||||
epd->getTextBounds(sval_xte, 0, 0, &x, &y, &w, &h);
|
epd->getTextBounds(sval_xte, 0, 0, &x, &y, &w, &h);
|
||||||
epd->setCursor(160-w, 170);
|
epd->setCursor(160-w, 170);
|
||||||
epd->print(sval_xte);
|
epd->print(sval_xte);
|
||||||
|
|
||||||
GwApi::BoatValue *bv_cog = pageData.values[1]; // COG
|
GwApi::BoatValue *bv_cog = pageData.values[1]; // COG
|
||||||
String sval_cog = formatValue(bv_cog, *commonData).svalue;
|
String sval_cog = commonData->fmt->formatValue(bv_cog, *commonData).svalue;
|
||||||
epd->getTextBounds(sval_cog, 0, 0, &x, &y, &w, &h);
|
epd->getTextBounds(sval_cog, 0, 0, &x, &y, &w, &h);
|
||||||
epd->setCursor(360-w, 170);
|
epd->setCursor(360-w, 170);
|
||||||
epd->print(sval_cog);
|
epd->print(sval_cog);
|
||||||
|
|
||||||
GwApi::BoatValue *bv_dtw = pageData.values[2]; // DTW
|
GwApi::BoatValue *bv_dtw = pageData.values[2]; // DTW
|
||||||
String sval_dtw = formatValue(bv_dtw, *commonData).svalue;
|
String sval_dtw = commonData->fmt->formatValue(bv_dtw, *commonData).svalue;
|
||||||
epd->getTextBounds(sval_dtw, 0, 0, &x, &y, &w, &h);
|
epd->getTextBounds(sval_dtw, 0, 0, &x, &y, &w, &h);
|
||||||
epd->setCursor(160-w, 257);
|
epd->setCursor(160-w, 257);
|
||||||
epd->print(sval_dtw);
|
epd->print(sval_dtw);
|
||||||
|
|
||||||
GwApi::BoatValue *bv_btw = pageData.values[3]; // BTW
|
GwApi::BoatValue *bv_btw = pageData.values[3]; // BTW
|
||||||
String sval_btw = formatValue(bv_btw, *commonData).svalue;
|
String sval_btw = commonData->fmt->formatValue(bv_btw, *commonData).svalue;
|
||||||
epd->getTextBounds(sval_btw, 0, 0, &x, &y, &w, &h);
|
epd->getTextBounds(sval_btw, 0, 0, &x, &y, &w, &h);
|
||||||
epd->setCursor(360-w, 257);
|
epd->setCursor(360-w, 257);
|
||||||
epd->print(sval_btw);
|
epd->print(sval_btw);
|
||||||
|
|
Loading…
Reference in New Issue