Some work on page clock concerning default time source
This commit is contained in:
parent
d1c620a858
commit
08cd2ad4b1
|
@ -31,6 +31,15 @@ bool homevalid = false; // homelat and homelon are valid
|
||||||
PageClock(CommonData &common){
|
PageClock(CommonData &common){
|
||||||
commonData = &common;
|
commonData = &common;
|
||||||
common.logger->logDebug(GwLog::LOG,"Instantiate PageClock");
|
common.logger->logDebug(GwLog::LOG,"Instantiate PageClock");
|
||||||
|
|
||||||
|
// WIP time source
|
||||||
|
#ifdef BOARD_OBP60S3
|
||||||
|
String use_rtc = common.config->getString(common.config->useRTC);
|
||||||
|
if (use_rtc == "off") {
|
||||||
|
source = 'G';
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
simulation = common.config->getBool(common.config->useSimuData);
|
simulation = common.config->getBool(common.config->useSimuData);
|
||||||
timezone = common.config->getString(common.config->timeZone).toDouble();
|
timezone = common.config->getString(common.config->timeZone).toDouble();
|
||||||
homelat = common.config->getString(common.config->homeLAT).toDouble();
|
homelat = common.config->getString(common.config->homeLAT).toDouble();
|
||||||
|
@ -100,9 +109,10 @@ bool homevalid = false; // homelat and homelon are valid
|
||||||
static String svalue5old = "";
|
static String svalue5old = "";
|
||||||
static String svalue6old = "";
|
static String svalue6old = "";
|
||||||
|
|
||||||
double value1 = 0;
|
double value1 = 0; // GPS time
|
||||||
double value2 = 0;
|
double value2 = 0; // GPS date FIXME date defined as uint32_t!
|
||||||
double value3 = 0;
|
double value3 = 0; // HDOP
|
||||||
|
bool gpsvalid = false;
|
||||||
|
|
||||||
// Get config data
|
// Get config data
|
||||||
String lengthformat = config->getString(config->lengthFormat);
|
String lengthformat = config->getString(config->lengthFormat);
|
||||||
|
@ -155,6 +165,9 @@ bool homevalid = false; // homelat and homelon are valid
|
||||||
unit3old = unit3; // Save old unit
|
unit3old = unit3; // Save old unit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GPS date and time are valid and can be used
|
||||||
|
gpsvalid = (valid1 && valid2 && valid3);
|
||||||
|
|
||||||
// Optical warning by limit violation (unused)
|
// Optical warning by limit violation (unused)
|
||||||
if(String(flashLED) == "Limit Violation"){
|
if(String(flashLED) == "Limit Violation"){
|
||||||
setBlinkingLED(false);
|
setBlinkingLED(false);
|
||||||
|
@ -163,7 +176,7 @@ bool homevalid = false; // homelat and homelon are valid
|
||||||
|
|
||||||
// Logging boat values
|
// Logging boat values
|
||||||
if (bvalue1 == NULL) return;
|
if (bvalue1 == NULL) return;
|
||||||
LOG_DEBUG(GwLog::LOG,"Drawing at PageClock, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2);
|
LOG_DEBUG(GwLog::LOG,"Drawing at PageClock, %s:%f, %s:%f, %s:%f", name1.c_str(), value1, name2.c_str(), value2, name3.c_str(), value3);
|
||||||
|
|
||||||
// Draw page
|
// Draw page
|
||||||
//***********************************************************
|
//***********************************************************
|
||||||
|
@ -231,7 +244,7 @@ bool homevalid = false; // homelat and homelon are valid
|
||||||
|
|
||||||
// Show values sunrise
|
// Show values sunrise
|
||||||
String sunrise = "---";
|
String sunrise = "---";
|
||||||
if ((valid1 and valid2 and valid3 == true) or (homevalid and commonData->data.rtcValid)) {
|
if (((source == 'G') and gpsvalid) or (homevalid and commonData->data.rtcValid)) {
|
||||||
sunrise = String(commonData->sundata.sunriseHour) + ":" + String(commonData->sundata.sunriseMinute + 100).substring(1);
|
sunrise = String(commonData->sundata.sunriseHour) + ":" + String(commonData->sundata.sunriseMinute + 100).substring(1);
|
||||||
svalue5old = sunrise;
|
svalue5old = sunrise;
|
||||||
} else if (simulation) {
|
} else if (simulation) {
|
||||||
|
@ -251,7 +264,7 @@ bool homevalid = false; // homelat and homelon are valid
|
||||||
|
|
||||||
// Show values sunset
|
// Show values sunset
|
||||||
String sunset = "---";
|
String sunset = "---";
|
||||||
if ((valid1 and valid2 and valid3 == true) or (homevalid and commonData->data.rtcValid)) {
|
if (((source == 'G') and gpsvalid) or (homevalid and commonData->data.rtcValid)) {
|
||||||
sunset = String(commonData->sundata.sunsetHour) + ":" + String(commonData->sundata.sunsetMinute + 100).substring(1);
|
sunset = String(commonData->sundata.sunsetHour) + ":" + String(commonData->sundata.sunsetMinute + 100).substring(1);
|
||||||
svalue6old = sunset;
|
svalue6old = sunset;
|
||||||
} else if (simulation) {
|
} else if (simulation) {
|
||||||
|
|
|
@ -337,7 +337,7 @@
|
||||||
"label": "RTC Modul",
|
"label": "RTC Modul",
|
||||||
"type": "list",
|
"type": "list",
|
||||||
"default": "off",
|
"default": "off",
|
||||||
"description": "Use internal RTC module type [off|DS1388]",
|
"description": "Use RTC module type [off|DS1388]",
|
||||||
"list": [
|
"list": [
|
||||||
"off",
|
"off",
|
||||||
"DS1388"
|
"DS1388"
|
||||||
|
|
Loading…
Reference in New Issue