Add home location to system page
This commit is contained in:
parent
ae7130b86c
commit
4aefc99212
|
@ -37,6 +37,18 @@ String formatTime(char fmttype, uint8_t hour, uint8_t minute, uint8_t second) {
|
||||||
return String(buffer);
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
FormatedData formatValue(GwApi::BoatValue *value, CommonData &commondata){
|
||||||
GwLog *logger = commondata.logger;
|
GwLog *logger = commondata.logger;
|
||||||
FormatedData result;
|
FormatedData result;
|
||||||
|
|
|
@ -43,6 +43,8 @@ String batt_sensor;
|
||||||
String solar_sensor;
|
String solar_sensor;
|
||||||
String gen_sensor;
|
String gen_sensor;
|
||||||
String rot_sensor;
|
String rot_sensor;
|
||||||
|
double homelat;
|
||||||
|
double homelon;
|
||||||
|
|
||||||
char mode = 'N'; // (N)ormal, (S)ettings, (D)evice list, (C)ard
|
char mode = 'N'; // (N)ormal, (S)ettings, (D)evice list, (C)ard
|
||||||
|
|
||||||
|
@ -69,6 +71,8 @@ public:
|
||||||
solar_sensor = common.config->getString(common.config->usePowSensor2);
|
solar_sensor = common.config->getString(common.config->usePowSensor2);
|
||||||
gen_sensor = common.config->getString(common.config->usePowSensor3);
|
gen_sensor = common.config->getString(common.config->usePowSensor3);
|
||||||
rot_sensor = common.config->getString(common.config->useRotSensor);
|
rot_sensor = common.config->getString(common.config->useRotSensor);
|
||||||
|
homelat = common.config->getString(common.config->homeLAT).toDouble();
|
||||||
|
homelon = common.config->getString(common.config->homeLON).toDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void setupKeys(){
|
virtual void setupKeys(){
|
||||||
|
@ -295,34 +299,44 @@ public:
|
||||||
// left column
|
// left column
|
||||||
getdisplay().setCursor(x0, y0);
|
getdisplay().setCursor(x0, y0);
|
||||||
getdisplay().print("Simulation:");
|
getdisplay().print("Simulation:");
|
||||||
getdisplay().setCursor(140, y0);
|
getdisplay().setCursor(120, y0);
|
||||||
getdisplay().print(simulation ? "on" : "off");
|
getdisplay().print(simulation ? "on" : "off");
|
||||||
|
|
||||||
getdisplay().setCursor(x0, y0 + 16);
|
getdisplay().setCursor(x0, y0 + 16);
|
||||||
getdisplay().print("Environment:");
|
getdisplay().print("Environment:");
|
||||||
getdisplay().setCursor(140, y0 + 16);
|
getdisplay().setCursor(120, y0 + 16);
|
||||||
getdisplay().print(env_module);
|
getdisplay().print(env_module);
|
||||||
|
|
||||||
getdisplay().setCursor(x0, y0 + 32);
|
getdisplay().setCursor(x0, y0 + 32);
|
||||||
getdisplay().print("Buzzer:");
|
getdisplay().print("Buzzer:");
|
||||||
getdisplay().setCursor(140, y0 + 32);
|
getdisplay().setCursor(120, y0 + 32);
|
||||||
getdisplay().print(buzzer_mode);
|
getdisplay().print(buzzer_mode);
|
||||||
|
|
||||||
getdisplay().setCursor(x0, y0 + 64);
|
getdisplay().setCursor(x0, y0 + 64);
|
||||||
getdisplay().print("GPS:");
|
getdisplay().print("GPS:");
|
||||||
getdisplay().setCursor(140, y0 + 64);
|
getdisplay().setCursor(120, y0 + 64);
|
||||||
getdisplay().print(gps_module);
|
getdisplay().print(gps_module);
|
||||||
|
|
||||||
getdisplay().setCursor(x0, y0 + 80);
|
getdisplay().setCursor(x0, y0 + 80);
|
||||||
getdisplay().print("RTC:");
|
getdisplay().print("RTC:");
|
||||||
getdisplay().setCursor(140, y0 + 80);
|
getdisplay().setCursor(120, y0 + 80);
|
||||||
getdisplay().print(rtc_module);
|
getdisplay().print(rtc_module);
|
||||||
|
|
||||||
getdisplay().setCursor(x0, y0 + 96);
|
getdisplay().setCursor(x0, y0 + 96);
|
||||||
getdisplay().print("Wifi:");
|
getdisplay().print("Wifi:");
|
||||||
getdisplay().setCursor(140, y0 + 96);
|
getdisplay().setCursor(120, y0 + 96);
|
||||||
getdisplay().print(commonData->status.wifiApOn ? "on" : "off");
|
getdisplay().print(commonData->status.wifiApOn ? "on" : "off");
|
||||||
|
|
||||||
|
// Home location
|
||||||
|
getdisplay().setCursor(x0, y0 + 128);
|
||||||
|
getdisplay().print("Home Lat.:");
|
||||||
|
getdisplay().setCursor(120, y0 + 128);
|
||||||
|
getdisplay().print(formatLatitude(homelat));
|
||||||
|
getdisplay().setCursor(x0, y0 + 144);
|
||||||
|
getdisplay().print("Home Lon.:");
|
||||||
|
getdisplay().setCursor(120, y0 + 144);
|
||||||
|
getdisplay().print(formatLongitude(homelon));
|
||||||
|
|
||||||
// right column
|
// right column
|
||||||
getdisplay().setCursor(202, y0);
|
getdisplay().setCursor(202, y0);
|
||||||
getdisplay().print("Batt. sensor:");
|
getdisplay().print("Batt. sensor:");
|
||||||
|
|
|
@ -168,6 +168,8 @@ class PageStruct{
|
||||||
// Standard format functions without overhead
|
// Standard format functions without overhead
|
||||||
String formatDate(String fmttype, uint16_t year, uint8_t month, uint8_t day);
|
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 formatTime(char fmttype, uint8_t hour, uint8_t minute, uint8_t second);
|
||||||
|
String formatLatitude(double lat);
|
||||||
|
String formatLongitude(double lon);
|
||||||
|
|
||||||
// Structure for formatted boat values
|
// Structure for formatted boat values
|
||||||
typedef struct{
|
typedef struct{
|
||||||
|
|
Loading…
Reference in New Issue