Compare commits
No commits in common. "c932724473c2b231931a7e7e73db0dc77d986a31" and "cba21574cbe5caefee3083f1aa0613179054e8cd" have entirely different histories.
c932724473
...
cba21574cb
|
@ -474,7 +474,6 @@ void displayHeader(CommonData &commonData, bool symbolmode, GwApi::BoatValue *da
|
|||
uint16_t symbol_x = 2;
|
||||
static const uint16_t symbol_offset = 20;
|
||||
|
||||
// TODO invert and get rid of the if
|
||||
if(commonData.config->getBool(commonData.config->statusLine) == true){
|
||||
|
||||
// Show status info
|
||||
|
@ -584,7 +583,7 @@ void displayHeader(CommonData &commonData, bool symbolmode, GwApi::BoatValue *da
|
|||
heartbeat = !heartbeat;
|
||||
|
||||
// Date and time
|
||||
fmtDate fmttype = commonData.fmt->getDateFormat(commonData.config->getString(commonData.config->dateFormat));
|
||||
String fmttype = commonData.config->getString(commonData.config->dateFormat);
|
||||
String timesource = commonData.config->getString(commonData.config->timeSource);
|
||||
double tz = commonData.config->getString(commonData.config->timeZone).toDouble();
|
||||
epd->setTextColor(commonData.fgcolor);
|
||||
|
@ -595,7 +594,7 @@ void displayHeader(CommonData &commonData, bool symbolmode, GwApi::BoatValue *da
|
|||
if (commonData.data.rtcValid) {
|
||||
time_t tv = mktime(&commonData.data.rtcTime) + (int)(tz * 3600);
|
||||
struct tm *local_tm = localtime(&tv);
|
||||
epd->print(formatTime(fmtTime::MMHH, local_tm->tm_hour, local_tm->tm_min, 0));
|
||||
epd->print(formatTime('m', local_tm->tm_hour, local_tm->tm_min, 0));
|
||||
epd->print(" ");
|
||||
epd->print(formatDate(fmttype, local_tm->tm_year + 1900, local_tm->tm_mon + 1, local_tm->tm_mday));
|
||||
epd->print(" ");
|
||||
|
|
|
@ -20,7 +20,6 @@ Formatter::Formatter(GwConfigHandler *config) {
|
|||
windspeedFormat = config->getString(config->windspeedFormat);
|
||||
tempFormat = config->getString(config->tempFormat);
|
||||
dateFormat = config->getString(config->dateFormat);
|
||||
dateFmt = getDateFormat(dateFormat);
|
||||
usesimudata = config->getBool(config->useSimuData);
|
||||
precision = config->getString(config->valueprecision);
|
||||
|
||||
|
@ -36,37 +35,6 @@ Formatter::Formatter(GwConfigHandler *config) {
|
|||
|
||||
}
|
||||
|
||||
fmtType Formatter::stringToFormat(const char* formatStr) {
|
||||
auto it = formatMap.find(formatStr);
|
||||
if (it != formatMap.end()) {
|
||||
return it->second;
|
||||
}
|
||||
return fmtType::XDR_G; // generic as default
|
||||
}
|
||||
|
||||
fmtDate Formatter::getDateFormat(String sformat) {
|
||||
if (sformat == "DE") {
|
||||
return fmtDate::DE;
|
||||
}
|
||||
if (sformat == "GB") {
|
||||
return fmtDate::GB;
|
||||
}
|
||||
if (sformat == "US") {
|
||||
return fmtDate::US;
|
||||
}
|
||||
return fmtDate::ISO; // default
|
||||
}
|
||||
|
||||
fmtTime Formatter::getTimeFormat(String sformat) {
|
||||
if (sformat == "MMHH") {
|
||||
return fmtTime::MMHH;
|
||||
}
|
||||
if (sformat == "MMHHSS") {
|
||||
return fmtTime::MMHHSS;
|
||||
}
|
||||
return fmtTime::MMHH; // default
|
||||
}
|
||||
|
||||
FormattedData Formatter::formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||
GwLog *logger = commondata.logger;
|
||||
FormattedData result;
|
||||
|
@ -75,7 +43,7 @@ FormattedData Formatter::formatValue(GwApi::BoatValue *value, CommonData &common
|
|||
|
||||
// If boat value not valid
|
||||
if (! value->valid && !usesimudata){
|
||||
result.svalue = placeholder;
|
||||
result.svalue = "---";
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -118,7 +86,12 @@ FormattedData Formatter::formatValue(GwApi::BoatValue *value, CommonData &common
|
|||
else{
|
||||
snprintf(buffer, bsize, "01.01.2022");
|
||||
}
|
||||
result.unit = ((timeZone == 0) ? "UTC" : "LOT");
|
||||
if(timeZone == 0){
|
||||
result.unit = "UTC";
|
||||
}
|
||||
else{
|
||||
result.unit = "LOT";
|
||||
}
|
||||
}
|
||||
//########################################################
|
||||
else if(value->getFormat() == "formatTime"){
|
||||
|
@ -148,7 +121,12 @@ FormattedData Formatter::formatValue(GwApi::BoatValue *value, CommonData &common
|
|||
snprintf(buffer, bsize, "11:36:%02i", int(sec));
|
||||
lasttime = millis();
|
||||
}
|
||||
result.unit = ((timeZone == 0) ? "UTC" : "LOT");
|
||||
if(timeZone == 0){
|
||||
result.unit = "UTC";
|
||||
}
|
||||
else{
|
||||
result.unit = "LOT";
|
||||
}
|
||||
}
|
||||
//########################################################
|
||||
else if (value->getFormat() == "formatFixed0"){
|
||||
|
@ -308,13 +286,13 @@ FormattedData Formatter::formatValue(GwApi::BoatValue *value, CommonData &common
|
|||
if (rotation < -100){
|
||||
rotation = -99;
|
||||
}
|
||||
else if (rotation > 100){
|
||||
if (rotation > 100){
|
||||
rotation = 99;
|
||||
}
|
||||
if (rotation > -10 && rotation < 10){
|
||||
snprintf(buffer, bsize, "%3.2f", rotation);
|
||||
}
|
||||
else {
|
||||
if (rotation <= -10 || rotation >= 10){
|
||||
snprintf(buffer, bsize, "%3.0f", rotation);
|
||||
}
|
||||
}
|
||||
|
@ -352,7 +330,12 @@ FormattedData Formatter::formatValue(GwApi::BoatValue *value, CommonData &common
|
|||
String latdir = "";
|
||||
float degree = abs(int(lat));
|
||||
float minute = abs((lat - int(lat)) * 60);
|
||||
latdir = (lat > 0) ? "N" : "S";
|
||||
if (lat > 0){
|
||||
latdir = "N";
|
||||
}
|
||||
else {
|
||||
latdir = "S";
|
||||
}
|
||||
latitude = String(degree,0) + "\x90 " + String(minute,4) + "' " + latdir;
|
||||
result.unit = "";
|
||||
strcpy(buffer, latitude.c_str());
|
||||
|
@ -371,7 +354,12 @@ FormattedData Formatter::formatValue(GwApi::BoatValue *value, CommonData &common
|
|||
String londir = "";
|
||||
float degree = abs(int(lon));
|
||||
float minute = abs((lon - int(lon)) * 60);
|
||||
londir = (lon > 0) ? "E" : "W";
|
||||
if (lon > 0){
|
||||
londir = "E";
|
||||
}
|
||||
else {
|
||||
londir = "W";
|
||||
}
|
||||
longitude = String(degree,0) + "\x90 " + String(minute,4) + "' " + londir;
|
||||
result.unit = "";
|
||||
strcpy(buffer, longitude.c_str());
|
||||
|
@ -393,7 +381,7 @@ FormattedData Formatter::formatValue(GwApi::BoatValue *value, CommonData &common
|
|||
depth = rawvalue;
|
||||
}
|
||||
if(String(lengthFormat) == "ft"){
|
||||
depth = depth * 3.28084; // TODO use global defined factor
|
||||
depth = depth * 3.28084;
|
||||
result.unit = "ft";
|
||||
}
|
||||
else{
|
||||
|
@ -423,7 +411,7 @@ FormattedData Formatter::formatValue(GwApi::BoatValue *value, CommonData &common
|
|||
xte = xte * 0.001;
|
||||
result.unit = "km";
|
||||
} else if (distanceFormat == "nm") {
|
||||
xte = xte * 0.000539957; // TODO use global defined factor
|
||||
xte = xte * 0.000539957;
|
||||
result.unit = "nm";
|
||||
} else {
|
||||
result.unit = "m";
|
||||
|
@ -459,7 +447,7 @@ FormattedData Formatter::formatValue(GwApi::BoatValue *value, CommonData &common
|
|||
else{
|
||||
result.unit = "K";
|
||||
}
|
||||
if (temp < 10) {
|
||||
if(temp < 10) {
|
||||
snprintf(buffer, bsize, fmt_dec_1, temp);
|
||||
}
|
||||
else if (temp < 100) {
|
||||
|
@ -485,7 +473,7 @@ FormattedData Formatter::formatValue(GwApi::BoatValue *value, CommonData &common
|
|||
result.unit = "km";
|
||||
}
|
||||
else if (String(distanceFormat) == "nm") {
|
||||
distance = distance * 0.000539957; // TODO use global defined factor
|
||||
distance = distance * 0.000539957;
|
||||
result.unit = "nm";
|
||||
}
|
||||
else {
|
||||
|
@ -814,35 +802,31 @@ FormattedData Formatter::formatValue(GwApi::BoatValue *value, CommonData &common
|
|||
return result;
|
||||
}
|
||||
|
||||
String formatDate(fmtDate fmttype, uint16_t year, uint8_t month, uint8_t day) {
|
||||
String formatDate(String fmttype, uint16_t year, uint8_t month, uint8_t day) {
|
||||
char buffer[12];
|
||||
if (fmttype == fmtDate::GB) {
|
||||
if (fmttype == "GB") {
|
||||
snprintf(buffer, 12, "%02d/%02d/%04d", day , month, year);
|
||||
}
|
||||
else if (fmttype == fmtDate::US) {
|
||||
else if (fmttype == "US") {
|
||||
snprintf(buffer, 12, "%02d/%02d/%04d", month, day, year);
|
||||
}
|
||||
else if (fmttype == fmtDate::ISO) {
|
||||
else if (fmttype == "ISO") {
|
||||
snprintf(buffer, 12, "%04d-%02d-%02d", year, month, day);
|
||||
}
|
||||
else if (fmttype == fmtDate::DE) {
|
||||
else {
|
||||
snprintf(buffer, 12, "%02d.%02d.%04d", day, month, year);
|
||||
} else {
|
||||
snprintf(buffer, 12, "%04d-%02d-%02d", year, month, day);
|
||||
}
|
||||
return String(buffer);
|
||||
}
|
||||
|
||||
String formatTime(fmtTime fmttype, uint8_t hour, uint8_t minute, uint8_t second) {
|
||||
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 == fmtTime::MMHH) {
|
||||
if (fmttype == 'm') {
|
||||
snprintf(buffer, 10, "%02d:%02d", hour , minute);
|
||||
}
|
||||
else if (fmttype == fmtTime::MMHHSS) {
|
||||
snprintf(buffer, 10, "%02d:%02d:%02d", hour, minute, second);
|
||||
}
|
||||
else {
|
||||
snprintf(buffer, 10, "%02d%02d%02d", hour, minute, second);
|
||||
snprintf(buffer, 10, "%02d:%02d:%02d", hour, minute, second);
|
||||
}
|
||||
return String(buffer);
|
||||
}
|
||||
|
|
|
@ -2,10 +2,41 @@
|
|||
#ifndef _OBP60FORMATTER_H
|
||||
#define _OBP60FORMATTER_H
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
/*
|
||||
|
||||
Formatter names as defined in BoatItemBase
|
||||
formatCourse
|
||||
formatKnots
|
||||
formatWind
|
||||
formatLatitude
|
||||
formatLongitude
|
||||
formatXte
|
||||
formatFixed0
|
||||
formatDepth
|
||||
kelvinToC TODO not a format but conversion
|
||||
mtr2nm TODO not a format but conversion
|
||||
formatDop dilution of precision
|
||||
formatRot
|
||||
formatDate
|
||||
formatTime
|
||||
formatName
|
||||
|
||||
XDR Formatter names
|
||||
formatXdr:P:P // pressure percent
|
||||
formatXdr:P:B // pressure bar
|
||||
formatXdr:U:V // voltage volt
|
||||
formatXdr:I:A // current ampere
|
||||
formatXdr:C:K // temperature kelvin
|
||||
formatXdr:C:C // temperature celsius
|
||||
formatXdr:H:P // humidity percent
|
||||
formatXdr:V:P // volume percent
|
||||
formatXdr:V:M // volume cubic meters
|
||||
formatXdr:R:I // flow liter per second?
|
||||
formatXdr:G: // generic
|
||||
formatXdr:A:P // angle percent
|
||||
formatXdr:A:D // angle degrees
|
||||
formatXdr:T:R // tachometer rpm
|
||||
|
||||
XDR types
|
||||
A Angular displacement
|
||||
C Temperature
|
||||
|
@ -38,77 +69,8 @@ XDR units
|
|||
|
||||
*/
|
||||
|
||||
enum class fmtType {
|
||||
// Formatter names as defined in BoatItemBase
|
||||
COURSE,
|
||||
KNOTS,
|
||||
WIND,
|
||||
LATITUDE,
|
||||
LONGITUDE,
|
||||
XTE,
|
||||
FIXED0,
|
||||
DEPTH,
|
||||
DOP, // dilution of precision
|
||||
ROT,
|
||||
DATE,
|
||||
TIME,
|
||||
NAME,
|
||||
|
||||
kelvinToC, // TODO not a format but conversion
|
||||
mtr2nm, // TODO not a format but conversion
|
||||
|
||||
// XDR Formatter names
|
||||
XDR_PP, // pressure percent
|
||||
XDR_PB, // pressure bar
|
||||
XDR_UV, // voltage volt
|
||||
XDR_IA, // current ampere
|
||||
XDR_CK, // temperature kelvin
|
||||
XDR_CC, // temperature celsius
|
||||
XDR_HP, // humidity percent
|
||||
XDR_VP, // volume percent
|
||||
XDR_VM, // volume cubic meters
|
||||
XDR_RI, // flow liter per second?
|
||||
XDR_G, // generic
|
||||
XDR_AP, // angle percent
|
||||
XDR_AD, // angle degrees
|
||||
XDR_TR // tachometer rpm
|
||||
};
|
||||
|
||||
// Hint: String is not supported
|
||||
static std::unordered_map<const char*, fmtType> formatMap PROGMEM = {
|
||||
{"formatCourse", fmtType::COURSE},
|
||||
{"formatKnots", fmtType::KNOTS},
|
||||
{"formatWind", fmtType::WIND},
|
||||
{"formatLatitude", fmtType::LATITUDE},
|
||||
{"formatLongitude", fmtType::LONGITUDE},
|
||||
{"formatXte", fmtType::XTE},
|
||||
{"formatFixed0", fmtType::FIXED0},
|
||||
{"formatDepth", fmtType::DEPTH},
|
||||
{"formatDop", fmtType::DOP},
|
||||
{"formatRot", fmtType::ROT},
|
||||
{"formatDate", fmtType::DATE},
|
||||
{"formatTime", fmtType::TIME},
|
||||
{"formatName", fmtType::NAME},
|
||||
{"kelvinToC", fmtType::kelvinToC},
|
||||
{"mtr2nm", fmtType::mtr2nm},
|
||||
{"formatXdr:P:P", fmtType::XDR_PP},
|
||||
{"formatXdr:P:B", fmtType::XDR_PB},
|
||||
{"formatXdr:U:V", fmtType::XDR_UV},
|
||||
{"formatXdr:I:A", fmtType::XDR_IA},
|
||||
{"formatXdr:C:K", fmtType::XDR_CK},
|
||||
{"formatXdr:C:C", fmtType::XDR_CC},
|
||||
{"formatXdr:H:P", fmtType::XDR_HP},
|
||||
{"formatXdr:V:P", fmtType::XDR_VP},
|
||||
{"formatXdr:V:M", fmtType::XDR_VM},
|
||||
{"formatXdr:R:I", fmtType::XDR_RI},
|
||||
{"formatXdr:G:", fmtType::XDR_G},
|
||||
{"formatXdr:A:P", fmtType::XDR_AP},
|
||||
{"formatXdr:A:D", fmtType::XDR_AD},
|
||||
{"formatXdr:T:R", fmtType::XDR_TR}
|
||||
};
|
||||
|
||||
// Possible formats as scoped enums
|
||||
enum class fmtDate {DE, GB, US, ISO};
|
||||
enum class fmtDate {DE, EN, GB, ISO};
|
||||
enum class fmtTime {MMHH, MMHHSS};
|
||||
enum class fmtLength {METER, FEET, FATHOM, CABLE};
|
||||
enum class fmtDepth {METER, FEET, FATHOM};
|
||||
|
@ -144,7 +106,6 @@ private:
|
|||
String windspeedFormat = "kn"; // [m/s|km/h|kn|bft]
|
||||
String tempFormat = "C"; // [K|°C|°F]
|
||||
String dateFormat = "ISO"; // [DE|GB|US|ISO]
|
||||
fmtDate dateFmt;
|
||||
bool usesimudata = false; // [on|off]
|
||||
|
||||
String precision = "2"; // [1|2]
|
||||
|
@ -154,16 +115,12 @@ private:
|
|||
|
||||
public:
|
||||
Formatter(GwConfigHandler *config);
|
||||
fmtType stringToFormat(const char* formatStr);
|
||||
fmtDate getDateFormat(String sformat);
|
||||
fmtTime getTimeFormat(String sformat);
|
||||
FormattedData formatValue(GwApi::BoatValue *value, CommonData &commondata);
|
||||
String placeholder = "---";
|
||||
};
|
||||
|
||||
// Standard format functions without class and overhead
|
||||
String formatDate(fmtDate fmttype, uint16_t year, uint8_t month, uint8_t day);
|
||||
String formatTime(fmtTime fmttype, uint8_t hour, uint8_t minute, uint8_t second);
|
||||
// Standard format functions without overhead
|
||||
String formatDate(String fmttype, uint16_t year, uint8_t month, uint8_t day);
|
||||
String formatTime(char fmttype, uint8_t hour, uint8_t minute, uint8_t second);
|
||||
String formatLatitude(double lat);
|
||||
String formatLongitude(double lon);
|
||||
|
||||
|
|
|
@ -227,7 +227,7 @@ public:
|
|||
epd->print(value1,2); // Real value as formated string
|
||||
}
|
||||
else{
|
||||
epd->print(commonData->fmt->placeholder); // No sensor data (sensor is off)
|
||||
epd->print("---"); // 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(commonData->fmt->placeholder); // No sensor data (sensor is off)
|
||||
epd->print("---"); // 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(commonData->fmt->placeholder); // No sensor data (sensor is off)
|
||||
epd->print("---"); // 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(commonData->fmt->placeholder); // Missing bus data
|
||||
epd->print("---"); // Missing bus data
|
||||
}
|
||||
}
|
||||
epd->setFont(&Ubuntu_Bold16pt8b);
|
||||
|
@ -300,9 +300,7 @@ public:
|
|||
if(value2 > 9.9 && value2 <= 99.9)epd->print(value2, 1);
|
||||
if(value2 > 99.9) epd->print(value2, 0);
|
||||
}
|
||||
else {
|
||||
epd->print(commonData->fmt->placeholder);
|
||||
}
|
||||
else epd->print("---");
|
||||
epd->setFont(&Ubuntu_Bold16pt8b);
|
||||
epd->print("A");
|
||||
|
||||
|
@ -314,9 +312,7 @@ public:
|
|||
if(value3 > 9.9 && value3 <= 99.9)epd->print(value3, 1);
|
||||
if(value3 > 99.9) epd->print(value3, 0);
|
||||
}
|
||||
else {
|
||||
epd->print(commonData->fmt->placeholder);
|
||||
}
|
||||
else epd->print("---");
|
||||
epd->setFont(&Ubuntu_Bold16pt8b);
|
||||
epd->print("W");
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
class PageClock : public Page
|
||||
{
|
||||
private:
|
||||
fmtDate dateformat;
|
||||
String dateformat;
|
||||
int simtime;
|
||||
bool keylock = false;
|
||||
char source = 'R'; // time source (R)TC | (G)PS | (N)TP
|
||||
|
@ -35,7 +35,7 @@ public:
|
|||
logger->logDebug(GwLog::LOG, "Instantiate PageClock");
|
||||
|
||||
// Get config data
|
||||
dateformat = common.fmt->getDateFormat(config->getString(config->dateFormat));
|
||||
dateformat = config->getString(config->dateFormat);
|
||||
timezone = config->getString(config->timeZone).toDouble();
|
||||
homelat = config->getString(config->homeLAT).toDouble();
|
||||
homelon = config->getString(config->homeLON).toDouble();
|
||||
|
@ -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(commonData->fmt->placeholder);
|
||||
epd->print("---");
|
||||
}
|
||||
} else {
|
||||
epd->print(svalue2old);
|
||||
|
@ -229,13 +229,13 @@ public:
|
|||
}
|
||||
else if (commonData->data.rtcValid) {
|
||||
if (tz == 'L') {
|
||||
epd->print(formatTime(fmtTime::MMHHSS, local_tm->tm_hour, local_tm->tm_min, local_tm->tm_sec));
|
||||
epd->print(formatTime('s', local_tm->tm_hour, local_tm->tm_min, local_tm->tm_sec));
|
||||
}
|
||||
else {
|
||||
epd->print(formatTime(fmtTime::MMHHSS, commonData->data.rtcTime.tm_hour, commonData->data.rtcTime.tm_min, commonData->data.rtcTime.tm_sec));
|
||||
epd->print(formatTime('s', commonData->data.rtcTime.tm_hour, commonData->data.rtcTime.tm_min, commonData->data.rtcTime.tm_sec));
|
||||
}
|
||||
} else {
|
||||
epd->print(commonData->fmt->placeholder);
|
||||
epd->print("---");
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -246,7 +246,7 @@ public:
|
|||
epd->print("Time"); // Name
|
||||
|
||||
// Show values sunrise
|
||||
String sunrise = commonData->fmt->placeholder;
|
||||
String sunrise = "---";
|
||||
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 = commonData->fmt->placeholder;
|
||||
String sunset = "---";
|
||||
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(commonData->fmt->placeholder); // Missing bus data
|
||||
epd->print("---"); // Missing bus data
|
||||
}
|
||||
}
|
||||
epd->setFont(&Ubuntu_Bold16pt8b);
|
||||
|
@ -177,37 +177,24 @@ public:
|
|||
// Show actual current in A
|
||||
epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
epd->setCursor(260, 200);
|
||||
if ((powerSensor == "INA219" || powerSensor == "INA226") && (simulation == false)) {
|
||||
// TODO use formatter for this?
|
||||
if (value2 <= 9.9) {
|
||||
epd->print(value2, 2);
|
||||
} else if (value2 <= 99.9) {
|
||||
epd->print(value2, 1);
|
||||
} else {
|
||||
epd->print(value2, 0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
epd->print(commonData->fmt->placeholder);
|
||||
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
|
||||
if(value2 <= 9.9) epd->print(value2, 2);
|
||||
if(value2 > 9.9 && value2 <= 99.9)epd->print(value2, 1);
|
||||
if(value2 > 99.9) epd->print(value2, 0);
|
||||
}
|
||||
else epd->print("---");
|
||||
epd->setFont(&Ubuntu_Bold16pt8b);
|
||||
epd->print("A");
|
||||
|
||||
// Show actual consumption in W
|
||||
epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
epd->setCursor(260, 260);
|
||||
if ((powerSensor == "INA219" || powerSensor == "INA226") && (simulation == false)) {
|
||||
if(value3 <= 9.9) {
|
||||
epd->print(value3, 2);
|
||||
} else if (value3 <= 99.9) {
|
||||
epd->print(value3, 1);
|
||||
} else {
|
||||
epd->print(value3, 0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
epd->print(commonData->fmt->placeholder);
|
||||
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
|
||||
if(value3 <= 9.9) epd->print(value3, 2);
|
||||
if(value3 > 9.9 && value3 <= 99.9)epd->print(value3, 1);
|
||||
if(value3 > 99.9) epd->print(value3, 0);
|
||||
}
|
||||
else epd->print("---");
|
||||
epd->setFont(&Ubuntu_Bold16pt8b);
|
||||
epd->print("W");
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ public:
|
|||
|
||||
// directions
|
||||
|
||||
int16_t x1, y1;
|
||||
int16_t x1, y1;
|
||||
uint16_t w, h;
|
||||
epd->setFont(&Ubuntu_Bold12pt8b);
|
||||
|
||||
|
|
|
@ -160,16 +160,12 @@ public:
|
|||
// Check for valid real data, display also if hold values activated
|
||||
if(valid1 == true || holdvalues == true){
|
||||
// Resolution switching
|
||||
if (value1 <= 9.9) {
|
||||
epd->print(value1, 2);
|
||||
} else if (value1 <= 99.9) {
|
||||
epd->print(value1, 1);
|
||||
} else {
|
||||
epd->print(value1, 0);
|
||||
}
|
||||
if(value1 <= 9.9) epd->print(value1, 2);
|
||||
if(value1 > 9.9 && value1 <= 99.9)epd->print(value1, 1);
|
||||
if(value1 > 99.9) epd->print(value1, 0);
|
||||
}
|
||||
else {
|
||||
epd->print(commonData->fmt->placeholder); // Missing bus data
|
||||
else{
|
||||
epd->print("---"); // Missing bus data
|
||||
}
|
||||
}
|
||||
epd->setFont(&Ubuntu_Bold16pt8b);
|
||||
|
@ -178,36 +174,24 @@ public:
|
|||
// Show actual current in A
|
||||
epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
epd->setCursor(260, 200);
|
||||
if ((powerSensor == "INA219" || powerSensor == "INA226") && (simulation == false)) {
|
||||
if (value2 <= 9.9) {
|
||||
epd->print(value2, 2);
|
||||
} else if (value2 <= 99.9) {
|
||||
epd->print(value2, 1);
|
||||
} else {
|
||||
epd->print(value2, 0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
epd->print(commonData->fmt->placeholder);
|
||||
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
|
||||
if(value2 <= 9.9) epd->print(value2, 2);
|
||||
if(value2 > 9.9 && value2 <= 99.9)epd->print(value2, 1);
|
||||
if(value2 > 99.9) epd->print(value2, 0);
|
||||
}
|
||||
else epd->print("---");
|
||||
epd->setFont(&Ubuntu_Bold16pt8b);
|
||||
epd->print("A");
|
||||
|
||||
// Show actual consumption in W
|
||||
epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
epd->setCursor(260, 260);
|
||||
if ((powerSensor == "INA219" || powerSensor == "INA226") && (simulation == false)) {
|
||||
if (value3 <= 9.9) {
|
||||
epd->print(value3, 2);
|
||||
} else if (value3 <= 99.9) {
|
||||
epd->print(value3, 1);
|
||||
} else {
|
||||
epd->print(value3, 0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
epd->print(commonData->fmt->placeholder);
|
||||
if((powerSensor == "INA219" || powerSensor == "INA226") && simulation == false){
|
||||
if(value3 <= 9.9) epd->print(value3, 2);
|
||||
if(value3 > 9.9 && value3 <= 99.9)epd->print(value3, 1);
|
||||
if(value3 > 99.9) epd->print(value3, 0);
|
||||
}
|
||||
else epd->print("---");
|
||||
epd->setFont(&Ubuntu_Bold16pt8b);
|
||||
epd->print("W");
|
||||
|
||||
|
|
|
@ -249,7 +249,7 @@ public:
|
|||
}
|
||||
}
|
||||
else{
|
||||
epd->print(commonData->fmt->placeholder); // Missing bus data
|
||||
epd->print("---"); // Missing bus data
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -182,11 +182,11 @@ public:
|
|||
// Show values TWD
|
||||
epd->setFont(&DSEG7Classic_BoldItalic20pt7b);
|
||||
epd->setCursor(295, 65);
|
||||
if (valid3 == true) {
|
||||
if(valid3 == true){
|
||||
epd->print(abs(value3 * 180 / PI), 0); // Value
|
||||
}
|
||||
else {
|
||||
epd->print(commonData->fmt->placeholder);
|
||||
else{
|
||||
epd->print("---"); // Value
|
||||
}
|
||||
epd->setFont(&Ubuntu_Bold12pt8b);
|
||||
epd->setCursor(335, 95);
|
||||
|
|
|
@ -207,7 +207,7 @@ public:
|
|||
epd->print(svalue4); // Value
|
||||
}
|
||||
else{
|
||||
epd->print(commonData->fmt->placeholder);
|
||||
epd->print("---"); // Value
|
||||
}
|
||||
epd->setFont(&Ubuntu_Bold12pt8b);
|
||||
epd->setCursor(335, 95);
|
||||
|
|
|
@ -208,7 +208,7 @@ class PageDescription{
|
|||
|
||||
class PageStruct{
|
||||
public:
|
||||
Page *page = nullptr;
|
||||
Page *page=NULL;
|
||||
PageData parameters;
|
||||
PageDescription *description = nullptr;
|
||||
PageDescription *description=NULL;
|
||||
};
|
||||
|
|
|
@ -8,10 +8,9 @@ Coding style
|
|||
------------
|
||||
WIP
|
||||
Please format your new code the same as already existing code.
|
||||
Preprocessor directives go to column zero.
|
||||
|
||||
Some rules:
|
||||
- Preprocessor directives go to column zero
|
||||
- Identation is 4 spaces
|
||||
Identation is 4 spaces
|
||||
|
||||
Git commands
|
||||
------------
|
||||
|
|
|
@ -65,8 +65,8 @@ void OBP60Init(GwApi *api){
|
|||
#endif
|
||||
|
||||
// Settings for e-paper display
|
||||
String fastrefresh = config->getConfigItem(config->fastRefresh,true)->asString();
|
||||
logger->logDebug(GwLog::DEBUG, "Fast Refresh Mode is: %s", fastrefresh.c_str());
|
||||
String fastrefresh = api->getConfig()->getConfigItem(api->getConfig()->fastRefresh,true)->asString();
|
||||
logger->logDebug(GwLog::DEBUG,"Fast Refresh Mode is: %s", fastrefresh.c_str());
|
||||
#ifdef DISPLAY_GDEY042T81
|
||||
if(fastrefresh == "true"){
|
||||
static const bool useFastFullUpdate = true; // Enable fast full display update only for GDEY042T81
|
||||
|
@ -88,24 +88,24 @@ void OBP60Init(GwApi *api){
|
|||
logger->logDebug(GwLog::LOG,"CPU speed at boot: %i MHz", freq);
|
||||
|
||||
// Settings for backlight
|
||||
String backlightMode = config->getConfigItem(config->backlight,true)->asString();
|
||||
logger->logDebug(GwLog::DEBUG, "Backlight Mode is: %s", backlightMode.c_str());
|
||||
uint brightness = uint(config->getConfigItem(config->blBrightness,true)->asInt());
|
||||
String backlightColor = config->getConfigItem(config->blColor,true)->asString();
|
||||
if (backlightMode == "On") {
|
||||
setBacklightLED(brightness, colorMapping(backlightColor));
|
||||
String backlightMode = api->getConfig()->getConfigItem(api->getConfig()->backlight,true)->asString();
|
||||
logger->logDebug(GwLog::DEBUG,"Backlight Mode is: %s", backlightMode.c_str());
|
||||
uint brightness = uint(api->getConfig()->getConfigItem(api->getConfig()->blBrightness,true)->asInt());
|
||||
String backlightColor = api->getConfig()->getConfigItem(api->getConfig()->blColor,true)->asString();
|
||||
if(String(backlightMode) == "On"){
|
||||
setBacklightLED(brightness, colorMapping(backlightColor));
|
||||
}
|
||||
else if (backlightMode == "Off") {
|
||||
setBacklightLED(0, COLOR_BLACK); // Backlight LEDs off (blue without britghness)
|
||||
else if(String(backlightMode) == "Off"){
|
||||
setBacklightLED(0, COLOR_BLACK); // Backlight LEDs off (blue without britghness)
|
||||
}
|
||||
else if (backlightMode == "Control by Key") {
|
||||
setBacklightLED(0, COLOR_BLUE); // Backlight LEDs off (blue without britghness)
|
||||
else if(String(backlightMode) == "Control by Key"){
|
||||
setBacklightLED(0, COLOR_BLUE); // Backlight LEDs off (blue without britghness)
|
||||
}
|
||||
|
||||
// Settings flash LED mode
|
||||
String ledMode = config->getConfigItem(config->flashLED,true)->asString();
|
||||
String ledMode = api->getConfig()->getConfigItem(api->getConfig()->flashLED,true)->asString();
|
||||
logger->logDebug(GwLog::DEBUG,"LED Mode is: %s", ledMode.c_str());
|
||||
if (ledMode == "Off") {
|
||||
if(String(ledMode) == "Off"){
|
||||
setBlinkingLED(false);
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ void OBP60Init(GwApi *api){
|
|||
initComplete = true;
|
||||
|
||||
// Buzzer tone for initialization finish
|
||||
setBuzzerPower(uint(config->getConfigItem(config->buzzerPower,true)->asInt()));
|
||||
setBuzzerPower(uint(api->getConfig()->getConfigItem(api->getConfig()->buzzerPower,true)->asInt()));
|
||||
buzzer(TONE4, 500);
|
||||
|
||||
}
|
||||
|
@ -186,6 +186,7 @@ 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;
|
||||
|
@ -279,62 +280,64 @@ void registerAllPages(GwLog *logger, PageList &list){
|
|||
}
|
||||
|
||||
// Undervoltage detection for shutdown display
|
||||
void underVoltageError(CommonData &common) {
|
||||
#if defined VOLTAGE_SENSOR && defined LIPO_ACCU_1200
|
||||
// Switch off all power lines
|
||||
setPortPin(OBP_BACKLIGHT_LED, false); // Backlight Off
|
||||
setFlashLED(false); // Flash LED Off
|
||||
buzzer(TONE4, 20); // Buzzer tone 4kHz 20ms
|
||||
// Shutdown EInk display
|
||||
epd->setFullWindow(); // Set full Refresh
|
||||
//epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
|
||||
epd->fillScreen(common.bgcolor);// Clear screen
|
||||
epd->setTextColor(common.fgcolor);
|
||||
epd->setFont(&Ubuntu_Bold20pt8b);
|
||||
epd->setCursor(65, 150);
|
||||
epd->print("Undervoltage");
|
||||
epd->setFont(&Ubuntu_Bold8pt8b);
|
||||
epd->setCursor(65, 175);
|
||||
epd->print("Charge battery and restart system");
|
||||
epd->nextPage(); // Partial update
|
||||
epd->powerOff(); // Display power off
|
||||
setPortPin(OBP_POWER_EPD, false); // Power off ePaper display
|
||||
setPortPin(OBP_POWER_SD, false); // Power off SD card
|
||||
#else
|
||||
// Switch off all power lines
|
||||
setPortPin(OBP_BACKLIGHT_LED, false); // Backlight Off
|
||||
setFlashLED(false); // Flash LED Off
|
||||
buzzer(TONE4, 20); // Buzzer tone 4kHz 20ms
|
||||
setPortPin(OBP_POWER_50, false); // Power rail 5.0V Off
|
||||
// Shutdown EInk display
|
||||
epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
|
||||
epd->fillScreen(common.bgcolor);// Clear screen
|
||||
epd->setTextColor(common.fgcolor);
|
||||
epd->setFont(&Ubuntu_Bold20pt8b);
|
||||
epd->setCursor(65, 150);
|
||||
epd->print("Undervoltage");
|
||||
epd->setFont(&Ubuntu_Bold8pt8b);
|
||||
epd->setCursor(65, 175);
|
||||
epd->print("To wake up repower system");
|
||||
epd->nextPage(); // Partial update
|
||||
epd->powerOff(); // Display power off
|
||||
#endif
|
||||
while (true) {
|
||||
esp_deep_sleep_start(); // Deep Sleep without wakeup. Wakeup only after power cycle (restart).
|
||||
}
|
||||
}
|
||||
|
||||
inline bool underVoltageDetection(float voffset, float vslope) {
|
||||
void underVoltageDetection(GwApi *api, CommonData &common){
|
||||
// Read settings
|
||||
double voffset = (api->getConfig()->getConfigItem(api->getConfig()->vOffset,true)->asString()).toFloat();
|
||||
double vslope = (api->getConfig()->getConfigItem(api->getConfig()->vSlope,true)->asString()).toFloat();
|
||||
// Read supply voltage
|
||||
#if defined VOLTAGE_SENSOR && defined LIPO_ACCU_1200
|
||||
float actVoltage = (float(analogRead(OBP_ANALOG0)) * 3.3 / 4096 + 0.53) * 2; // Vin = 1/2 for OBP40
|
||||
float actVoltage = (float(analogRead(OBP_ANALOG0)) * 3.3 / 4096 + 0.53) * 2; // Vin = 1/2 for OBP40
|
||||
float minVoltage = 3.65; // Absolut minimum volatge for 3,7V LiPo accu
|
||||
#else
|
||||
float actVoltage = (float(analogRead(OBP_ANALOG0)) * 3.3 / 4096 + 0.17) * 20; // Vin = 1/20 for OBP60
|
||||
float actVoltage = (float(analogRead(OBP_ANALOG0)) * 3.3 / 4096 + 0.17) * 20; // Vin = 1/20 for OBP60
|
||||
float minVoltage = MIN_VOLTAGE;
|
||||
#endif
|
||||
float calVoltage = actVoltage * vslope + voffset; // Calibration
|
||||
return (calVoltage < minVoltage);
|
||||
double calVoltage = actVoltage * vslope + voffset; // Calibration
|
||||
if(calVoltage < minVoltage){
|
||||
#if defined VOLTAGE_SENSOR && defined LIPO_ACCU_1200
|
||||
// Switch off all power lines
|
||||
setPortPin(OBP_BACKLIGHT_LED, false); // Backlight Off
|
||||
setFlashLED(false); // Flash LED Off
|
||||
buzzer(TONE4, 20); // Buzzer tone 4kHz 20ms
|
||||
// Shutdown EInk display
|
||||
epd->setFullWindow(); // Set full Refresh
|
||||
//epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
|
||||
epd->fillScreen(common.bgcolor);// Clear screen
|
||||
epd->setTextColor(common.fgcolor);
|
||||
epd->setFont(&Ubuntu_Bold20pt8b);
|
||||
epd->setCursor(65, 150);
|
||||
epd->print("Undervoltage");
|
||||
epd->setFont(&Ubuntu_Bold8pt8b);
|
||||
epd->setCursor(65, 175);
|
||||
epd->print("Charge battery and restart system");
|
||||
epd->nextPage(); // Partial update
|
||||
epd->powerOff(); // Display power off
|
||||
setPortPin(OBP_POWER_EPD, false); // Power off ePaper display
|
||||
setPortPin(OBP_POWER_SD, false); // Power off SD card
|
||||
#else
|
||||
// Switch off all power lines
|
||||
setPortPin(OBP_BACKLIGHT_LED, false); // Backlight Off
|
||||
setFlashLED(false); // Flash LED Off
|
||||
buzzer(TONE4, 20); // Buzzer tone 4kHz 20ms
|
||||
setPortPin(OBP_POWER_50, false); // Power rail 5.0V Off
|
||||
// Shutdown EInk display
|
||||
epd->setPartialWindow(0, 0, epd->width(), epd->height()); // Set partial update
|
||||
epd->fillScreen(common.bgcolor);// Clear screen
|
||||
epd->setTextColor(common.fgcolor);
|
||||
epd->setFont(&Ubuntu_Bold20pt8b);
|
||||
epd->setCursor(65, 150);
|
||||
epd->print("Undervoltage");
|
||||
epd->setFont(&Ubuntu_Bold8pt8b);
|
||||
epd->setCursor(65, 175);
|
||||
epd->print("To wake up repower system");
|
||||
epd->nextPage(); // Partial update
|
||||
epd->powerOff(); // Display power off
|
||||
#endif
|
||||
// Stop system
|
||||
while(true){
|
||||
esp_deep_sleep_start(); // Deep Sleep without weakup. Weakup only after power cycle (restart).
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate true wind data and add to obp60task boat data list
|
||||
|
@ -538,8 +541,8 @@ void handleHstryBuf(GwApi* api, BoatValueList* boatValues, tBoatHstryData hstryB
|
|||
void OBP60Task(GwApi *api){
|
||||
// vTaskDelete(NULL);
|
||||
// return;
|
||||
GwLog *logger = api->getLogger();
|
||||
GwConfigHandler *config = api->getConfig();
|
||||
GwLog *logger=api->getLogger();
|
||||
GwConfigHandler *config=api->getConfig();
|
||||
#ifdef HARDWARE_V21
|
||||
startLedTask(api);
|
||||
#endif
|
||||
|
@ -563,8 +566,8 @@ void OBP60Task(GwApi *api){
|
|||
}
|
||||
|
||||
// Init E-Ink display
|
||||
String displaymode = config->getConfigItem(config->display,true)->asString();
|
||||
String displaycolor = config->getConfigItem(config->displaycolor,true)->asString();
|
||||
String displaymode = api->getConfig()->getConfigItem(api->getConfig()->display,true)->asString();
|
||||
String displaycolor = api->getConfig()->getConfigItem(api->getConfig()->displaycolor,true)->asString();
|
||||
if (displaycolor == "Normal") {
|
||||
commonData.fgcolor = GxEPD_BLACK;
|
||||
commonData.bgcolor = GxEPD_WHITE;
|
||||
|
@ -573,12 +576,12 @@ void OBP60Task(GwApi *api){
|
|||
commonData.fgcolor = GxEPD_WHITE;
|
||||
commonData.bgcolor = GxEPD_BLACK;
|
||||
}
|
||||
String systemname = config->getConfigItem(config->systemName, true)->asString();
|
||||
String wifipass = config->getConfigItem(config->apPassword, true)->asString();
|
||||
bool refreshmode = config->getConfigItem(config->refresh, true)->asBoolean();
|
||||
String systemname = api->getConfig()->getConfigItem(api->getConfig()->systemName,true)->asString();
|
||||
String wifipass = api->getConfig()->getConfigItem(api->getConfig()->apPassword,true)->asString();
|
||||
bool refreshmode = api->getConfig()->getConfigItem(api->getConfig()->refresh,true)->asBoolean();
|
||||
bool symbolmode = (config->getString(config->headerFormat) == "ICON");
|
||||
String fastrefresh = config->getConfigItem(config->fastRefresh, true)->asString();
|
||||
uint fullrefreshtime = uint(config->getConfigItem(config->fullRefreshTime, true)->asInt());
|
||||
String fastrefresh = api->getConfig()->getConfigItem(api->getConfig()->fastRefresh,true)->asString();
|
||||
uint fullrefreshtime = uint(api->getConfig()->getConfigItem(api->getConfig()->fullRefreshTime,true)->asInt());
|
||||
#ifdef BOARD_OBP40S3
|
||||
bool syspage_enabled = config->getBool(config->systemPage);
|
||||
#endif
|
||||
|
@ -735,23 +738,21 @@ void OBP60Task(GwApi *api){
|
|||
//####################################################################################
|
||||
|
||||
// Configuration values for main loop
|
||||
String gpsFix = config->getConfigItem(config->flashLED,true)->asString();
|
||||
String gpsOn = config->getConfigItem(config->useGPS,true)->asString();
|
||||
float tz = config->getConfigItem(config->timeZone,true)->asFloat();
|
||||
String gpsFix = api->getConfig()->getConfigItem(api->getConfig()->flashLED,true)->asString();
|
||||
String gpsOn=api->getConfig()->getConfigItem(api->getConfig()->useGPS,true)->asString();
|
||||
float tz = api->getConfig()->getConfigItem(api->getConfig()->timeZone,true)->asFloat();
|
||||
|
||||
commonData.backlight.mode = backlightMapping(config->getConfigItem(config->backlight, true)->asString());
|
||||
commonData.backlight.color = colorMapping(config->getConfigItem(config->blColor, true)->asString());
|
||||
commonData.backlight.brightness = 2.55 * uint(config->getConfigItem(config->blBrightness, true)->asInt());
|
||||
commonData.powermode = api->getConfig()->getConfigItem(api->getConfig()->powerMode, true)->asString();
|
||||
commonData.backlight.mode = backlightMapping(config->getConfigItem(config->backlight,true)->asString());
|
||||
commonData.backlight.color = colorMapping(config->getConfigItem(config->blColor,true)->asString());
|
||||
commonData.backlight.brightness = 2.55 * uint(config->getConfigItem(config->blBrightness,true)->asInt());
|
||||
commonData.powermode = api->getConfig()->getConfigItem(api->getConfig()->powerMode,true)->asString();
|
||||
|
||||
bool uvoltage = config->getConfigItem(config->underVoltage, true)->asBoolean();
|
||||
float voffset = (config->getConfigItem(config->vOffset,true)->asString()).toFloat();
|
||||
float vslope = (config->getConfigItem(config->vSlope,true)->asString()).toFloat();
|
||||
String cpuspeed = config->getConfigItem(config->cpuSpeed, true)->asString();
|
||||
uint hdopAccuracy = uint(config->getConfigItem(config->hdopAccuracy, true)->asInt());
|
||||
bool uvoltage = api->getConfig()->getConfigItem(api->getConfig()->underVoltage,true)->asBoolean();
|
||||
String cpuspeed = api->getConfig()->getConfigItem(api->getConfig()->cpuSpeed,true)->asString();
|
||||
uint hdopAccuracy = uint(api->getConfig()->getConfigItem(api->getConfig()->hdopAccuracy,true)->asInt());
|
||||
|
||||
double homelat = config->getString(config->homeLAT).toDouble();
|
||||
double homelon = config->getString(config->homeLON).toDouble();
|
||||
double homelat = commonData.config->getString(commonData.config->homeLAT).toDouble();
|
||||
double homelon = commonData.config->getString(commonData.config->homeLON).toDouble();
|
||||
bool homevalid = homelat >= -180.0 and homelat <= 180 and homelon >= -90.0 and homelon <= 90.0;
|
||||
if (homevalid) {
|
||||
logger->logDebug(GwLog::LOG, "Home location set to lat=%f, lon=%f", homelat, homelon);
|
||||
|
@ -795,11 +796,8 @@ void OBP60Task(GwApi *api){
|
|||
bool keypressed = false;
|
||||
|
||||
// Undervoltage detection
|
||||
if (uvoltage == true) {
|
||||
if (underVoltageDetection(voffset, vslope)) {
|
||||
LOG_DEBUG(GwLog::ERROR, "Undervoltage detected, shutting down!");
|
||||
underVoltageError(commonData);
|
||||
}
|
||||
if(uvoltage == true){
|
||||
underVoltageDetection(api, commonData);
|
||||
}
|
||||
|
||||
// Set CPU speed after boot after 1min
|
||||
|
|
|
@ -41,10 +41,5 @@
|
|||
#ifdef BOARD_OBP40S3
|
||||
DECLARE_CAPABILITY(obp40,true)
|
||||
#endif
|
||||
#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
|
||||
DECLARE_STRING_CAPABILITY(HELP_URL, "https://obp60-v2-docu.readthedocs.io/de/latest/"); // Link to help pages
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue