Add status infos
This commit is contained in:
parent
b1bdc6ac7b
commit
1bdb3ebfb9
|
@ -425,7 +425,7 @@ double formatWind(double cv)
|
||||||
{
|
{
|
||||||
double rt = formatCourse(cv);
|
double rt = formatCourse(cv);
|
||||||
if (rt > 180)
|
if (rt > 180)
|
||||||
rt = 180 - rt;
|
rt = (360 - rt) * -1;
|
||||||
return rt;
|
return rt;
|
||||||
}
|
}
|
||||||
double formatKnots(double cv)
|
double formatKnots(double cv)
|
||||||
|
|
|
@ -215,6 +215,7 @@ void OBP60Task(void *param){
|
||||||
|
|
||||||
GwApi *api=(GwApi*)param;
|
GwApi *api=(GwApi*)param;
|
||||||
GwLog *logger=api->getLogger();
|
GwLog *logger=api->getLogger();
|
||||||
|
GwApi::Status status;
|
||||||
|
|
||||||
bool hasPosition = false;
|
bool hasPosition = false;
|
||||||
|
|
||||||
|
@ -260,8 +261,9 @@ void OBP60Task(void *param){
|
||||||
GwApi::BoatValue *longitude=new GwApi::BoatValue(F("Longitude"));
|
GwApi::BoatValue *longitude=new GwApi::BoatValue(F("Longitude"));
|
||||||
GwApi::BoatValue *latitude=new GwApi::BoatValue(F("Latitude"));
|
GwApi::BoatValue *latitude=new GwApi::BoatValue(F("Latitude"));
|
||||||
GwApi::BoatValue *waterdepth=new GwApi::BoatValue(F("WaterDepth"));
|
GwApi::BoatValue *waterdepth=new GwApi::BoatValue(F("WaterDepth"));
|
||||||
|
GwApi::BoatValue *hdop=new GwApi::BoatValue(F("HDOP"));
|
||||||
GwApi::BoatValue *pdop=new GwApi::BoatValue(F("PDOP"));
|
GwApi::BoatValue *pdop=new GwApi::BoatValue(F("PDOP"));
|
||||||
GwApi::BoatValue *valueList[]={sog, date, time, longitude, latitude, waterdepth, pdop};
|
GwApi::BoatValue *valueList[]={sog, date, time, longitude, latitude, waterdepth, hdop, pdop};
|
||||||
|
|
||||||
//Init E-Ink display
|
//Init E-Ink display
|
||||||
display.init(); // Initialize and clear display
|
display.init(); // Initialize and clear display
|
||||||
|
@ -284,7 +286,6 @@ void OBP60Task(void *param){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Task Loop
|
// Task Loop
|
||||||
//###############################
|
//###############################
|
||||||
while(true){
|
while(true){
|
||||||
|
@ -339,8 +340,31 @@ void OBP60Task(void *param){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Read the status values from gateway
|
||||||
|
api->getStatus(status);
|
||||||
|
busInfo.wifiApOn = status.wifiApOn;
|
||||||
|
busInfo.wifiClientOn = status.wifiClientOn;
|
||||||
|
busInfo.wifiClientConnected = status.wifiClientConnected;
|
||||||
|
busInfo.wifiApIp = status.wifiApIp;
|
||||||
|
busInfo.systemName = status.systemName;
|
||||||
|
busInfo.wifiApPass = status.wifiApPass;
|
||||||
|
busInfo.wifiClientIp = status.wifiClientIp;
|
||||||
|
busInfo.wifiClientSSID = status.wifiClientSSID;
|
||||||
|
busInfo.usbRx = status.usbRx;
|
||||||
|
busInfo.usbTx = status.usbTx;
|
||||||
|
busInfo.serRx = status.serRx;
|
||||||
|
busInfo.serTx = status.serTx;
|
||||||
|
busInfo.tcpSerRx = status.tcpSerRx;
|
||||||
|
busInfo.tcpSerTx = status.tcpSerTx;
|
||||||
|
busInfo.tcpClients = status.tcpClients;
|
||||||
|
busInfo.tcpClRx = status.tcpClRx;
|
||||||
|
busInfo.tcpClTx = status.tcpClTx;
|
||||||
|
busInfo.tcpClientConnected = status.tcpClientConnected;
|
||||||
|
busInfo.n2kRx = status.n2kRx;
|
||||||
|
busInfo.n2kTx = status.n2kTx;
|
||||||
|
|
||||||
// Read the current bus data and copy to stucture
|
// Read the current bus data and copy to stucture
|
||||||
api->getBoatDataValues(7,valueList);
|
api->getBoatDataValues(8,valueList);
|
||||||
|
|
||||||
busInfo.WaterDepth.fvalue = waterdepth->value;
|
busInfo.WaterDepth.fvalue = waterdepth->value;
|
||||||
waterdepth->getFormat().toCharArray(busInfo.WaterDepth.unit, 8, 0);
|
waterdepth->getFormat().toCharArray(busInfo.WaterDepth.unit, 8, 0);
|
||||||
|
@ -356,6 +380,9 @@ void OBP60Task(void *param){
|
||||||
formatValue(time).toCharArray(busInfo.Time.svalue, 16, 0);
|
formatValue(time).toCharArray(busInfo.Time.svalue, 16, 0);
|
||||||
busInfo.Time.valid = time->valid;
|
busInfo.Time.valid = time->valid;
|
||||||
|
|
||||||
|
busInfo.HDOP.fvalue = hdop->value;
|
||||||
|
busInfo.HDOP.valid = hdop->valid;
|
||||||
|
|
||||||
busInfo.PDOP.fvalue = pdop->value;
|
busInfo.PDOP.fvalue = pdop->value;
|
||||||
busInfo.PDOP.valid = pdop->valid;
|
busInfo.PDOP.valid = pdop->valid;
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,27 @@ typedef struct{ // Sub structure for bus data
|
||||||
} dataContainer;
|
} dataContainer;
|
||||||
|
|
||||||
typedef struct{
|
typedef struct{
|
||||||
|
// Gateway status infos
|
||||||
|
bool wifiApOn = false;
|
||||||
|
bool wifiClientOn = false;
|
||||||
|
bool wifiClientConnected = false;
|
||||||
|
String wifiApIp = "";
|
||||||
|
String systemName = ""; // is also AP SSID
|
||||||
|
String wifiApPass = "";
|
||||||
|
String wifiClientIp = "";
|
||||||
|
String wifiClientSSID = "";
|
||||||
|
unsigned long usbRx = 0;
|
||||||
|
unsigned long usbTx = 0;
|
||||||
|
unsigned long serRx = 0;
|
||||||
|
unsigned long serTx = 0;
|
||||||
|
unsigned long tcpSerRx = 0;
|
||||||
|
unsigned long tcpSerTx = 0;
|
||||||
|
int tcpClients = 0;
|
||||||
|
unsigned long tcpClRx = 0;
|
||||||
|
unsigned long tcpClTx = 0;
|
||||||
|
bool tcpClientConnected = false;
|
||||||
|
unsigned long n2kRx = 0;
|
||||||
|
unsigned long n2kTx = 0;
|
||||||
// OBP60 Settings
|
// OBP60 Settings
|
||||||
char dateformat[3] = "GB";
|
char dateformat[3] = "GB";
|
||||||
int timezone = 0;
|
int timezone = 0;
|
||||||
|
|
|
@ -17,7 +17,21 @@ void showPage(busData values){
|
||||||
display.setFont(&Ubuntu_Bold8pt7b);
|
display.setFont(&Ubuntu_Bold8pt7b);
|
||||||
display.setTextColor(GxEPD_BLACK);
|
display.setTextColor(GxEPD_BLACK);
|
||||||
display.setCursor(0, 15);
|
display.setCursor(0, 15);
|
||||||
display.print(" WiFi AP TCP N2K 183 ");
|
if(values.wifiApOn){
|
||||||
|
display.print(" AP ");
|
||||||
|
}
|
||||||
|
if(values.tcpClRx > 0 || values.tcpClTx > 0 || values.tcpSerRx > 0 || values.tcpSerTx > 0){
|
||||||
|
display.print("TCP ");
|
||||||
|
}
|
||||||
|
if(values.n2kRx > 0 || values.n2kTx > 0){
|
||||||
|
display.print("N2K ");
|
||||||
|
}
|
||||||
|
if(values.serRx > 0 || values.serTx > 0){
|
||||||
|
display.print("183 ");
|
||||||
|
}
|
||||||
|
if(values.usbRx > 0 || values.usbTx > 0){
|
||||||
|
display.print("USB ");
|
||||||
|
}
|
||||||
if(values.gps == true && values.PDOP.valid == true && values.PDOP.fvalue <= 50){
|
if(values.gps == true && values.PDOP.valid == true && values.PDOP.fvalue <= 50){
|
||||||
display.print("GPS");
|
display.print("GPS");
|
||||||
}
|
}
|
||||||
|
@ -36,61 +50,59 @@ void showPage(busData values){
|
||||||
// Date and time
|
// Date and time
|
||||||
display.setFont(&Ubuntu_Bold8pt7b);
|
display.setFont(&Ubuntu_Bold8pt7b);
|
||||||
display.setCursor(230, 15);
|
display.setCursor(230, 15);
|
||||||
if(values.gps == true){
|
if(values.HDOP.valid == true && values.HDOP.fvalue <= 50){
|
||||||
if(values.PDOP.valid == true && values.PDOP.fvalue <= 50){
|
char newdate[16] = "";
|
||||||
|
if(String(values.dateformat) == "DE"){
|
||||||
|
display.print(values.Date.svalue);
|
||||||
|
}
|
||||||
|
if(String(values.dateformat) == "GB"){
|
||||||
|
values.Date.svalue[2] = '/';
|
||||||
|
values.Date.svalue[5] = '/';
|
||||||
|
display.print(values.Date.svalue);
|
||||||
|
}
|
||||||
|
if(String(values.dateformat) == "US"){
|
||||||
char newdate[16] = "";
|
char newdate[16] = "";
|
||||||
if(String(values.dateformat) == "DE"){
|
strcpy(newdate, values.Date.svalue);
|
||||||
display.print(values.Date.svalue);
|
newdate[0] = values.Date.svalue[3];
|
||||||
}
|
newdate[1] = values.Date.svalue[4];
|
||||||
if(String(values.dateformat) == "GB"){
|
newdate[2] = '/';
|
||||||
values.Date.svalue[2] = '/';
|
newdate[3] = values.Date.svalue[0];
|
||||||
values.Date.svalue[5] = '/';
|
newdate[4] = values.Date.svalue[1];
|
||||||
display.print(values.Date.svalue);
|
newdate[5] = '/';
|
||||||
}
|
display.print(newdate);
|
||||||
if(String(values.dateformat) == "US"){
|
}
|
||||||
char newdate[16] = "";
|
display.print(" ");
|
||||||
strcpy(newdate, values.Date.svalue);
|
if(values.timezone == 0){
|
||||||
newdate[0] = values.Date.svalue[3];
|
display.print(values.Time.svalue);
|
||||||
newdate[1] = values.Date.svalue[4];
|
|
||||||
newdate[2] = '/';
|
|
||||||
newdate[3] = values.Date.svalue[0];
|
|
||||||
newdate[4] = values.Date.svalue[1];
|
|
||||||
newdate[5] = '/';
|
|
||||||
display.print(newdate);
|
|
||||||
}
|
|
||||||
display.print(" ");
|
display.print(" ");
|
||||||
if(values.timezone == 0){
|
display.print("UTC");
|
||||||
display.print(values.Time.svalue);
|
|
||||||
display.print(" ");
|
|
||||||
display.print("UTC");
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
char newtime[16] = "";
|
|
||||||
char newhour[3] = "";
|
|
||||||
int hour = 0;
|
|
||||||
strcpy(newtime, values.Time.svalue);
|
|
||||||
newhour[0] = values.Time.svalue[0];
|
|
||||||
newhour[1] = values.Time.svalue[1];
|
|
||||||
hour = strtol(newhour, 0, 10);
|
|
||||||
if(values.timezone > 0){
|
|
||||||
hour += values.timezone;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
hour += values.timezone + 24;
|
|
||||||
}
|
|
||||||
hour %= 24;
|
|
||||||
sprintf(newhour, "%d", hour);
|
|
||||||
newtime[0] = newhour[0];
|
|
||||||
newtime[1] = newhour[1];
|
|
||||||
display.print(newtime);
|
|
||||||
display.print(" ");
|
|
||||||
display.print("LOT");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
display.print("No GPS data");
|
char newtime[16] = "";
|
||||||
|
char newhour[3] = "";
|
||||||
|
int hour = 0;
|
||||||
|
strcpy(newtime, values.Time.svalue);
|
||||||
|
newhour[0] = values.Time.svalue[0];
|
||||||
|
newhour[1] = values.Time.svalue[1];
|
||||||
|
hour = strtol(newhour, 0, 10);
|
||||||
|
if(values.timezone > 0){
|
||||||
|
hour += values.timezone;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
hour += values.timezone + 24;
|
||||||
|
}
|
||||||
|
hour %= 24;
|
||||||
|
sprintf(newhour, "%d", hour);
|
||||||
|
newtime[0] = newhour[0];
|
||||||
|
newtime[1] = newhour[1];
|
||||||
|
display.print(newtime);
|
||||||
|
display.print(" ");
|
||||||
|
display.print("LOT");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
display.print("No GPS data");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read page number
|
// Read page number
|
||||||
|
|
Loading…
Reference in New Issue