parent
717d66054d
commit
c5449a91a6
|
@ -234,7 +234,7 @@ void displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatVa
|
||||||
getdisplay().print("USB ");
|
getdisplay().print("USB ");
|
||||||
}
|
}
|
||||||
double gpshdop = formatValue(hdop, commonData).value;
|
double gpshdop = formatValue(hdop, commonData).value;
|
||||||
if(commonData.config->getString(commonData.config->useGPS) != "off" && gpshdop > 0.3){
|
if(commonData.config->getString(commonData.config->useGPS) != "off" && gpshdop <= commonData.config->getInt(commonData.config->hdopAccuracy) && hdop->valid == true){
|
||||||
getdisplay().print("GPS");
|
getdisplay().print("GPS");
|
||||||
}
|
}
|
||||||
// Save old telegram counter
|
// Save old telegram counter
|
||||||
|
@ -265,6 +265,7 @@ void displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatVa
|
||||||
getdisplay().setTextColor(textcolor);
|
getdisplay().setTextColor(textcolor);
|
||||||
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
getdisplay().setFont(&Ubuntu_Bold8pt7b);
|
||||||
getdisplay().setCursor(230, 15);
|
getdisplay().setCursor(230, 15);
|
||||||
|
// Show date and time if date present
|
||||||
if(date->valid == true){
|
if(date->valid == true){
|
||||||
String acttime = formatValue(time, commonData).svalue;
|
String acttime = formatValue(time, commonData).svalue;
|
||||||
acttime = acttime.substring(0, 5);
|
acttime = acttime.substring(0, 5);
|
||||||
|
|
|
@ -147,6 +147,7 @@ void sensorTask(void *param){
|
||||||
|
|
||||||
// Settings for GPS sensors
|
// Settings for GPS sensors
|
||||||
String gpsOn=api->getConfig()->getConfigItem(api->getConfig()->useGPS,true)->asString();
|
String gpsOn=api->getConfig()->getConfigItem(api->getConfig()->useGPS,true)->asString();
|
||||||
|
uint hdopAccuracy = uint(api->getConfig()->getConfigItem(api->getConfig()->hdopAccuracy,true)->asInt());
|
||||||
if(String(gpsOn) == "NEO-6M"){
|
if(String(gpsOn) == "NEO-6M"){
|
||||||
Serial2.begin(9600, SERIAL_8N1, OBP_GPS_RX, OBP_GPS_TX, false); // not inverted (false)
|
Serial2.begin(9600, SERIAL_8N1, OBP_GPS_RX, OBP_GPS_TX, false); // not inverted (false)
|
||||||
if (!Serial2) {
|
if (!Serial2) {
|
||||||
|
@ -354,7 +355,8 @@ void sensorTask(void *param){
|
||||||
|
|
||||||
GwApi::BoatValue *gpsdays=new GwApi::BoatValue(GwBoatData::_GPSD);
|
GwApi::BoatValue *gpsdays=new GwApi::BoatValue(GwBoatData::_GPSD);
|
||||||
GwApi::BoatValue *gpsseconds=new GwApi::BoatValue(GwBoatData::_GPST);
|
GwApi::BoatValue *gpsseconds=new GwApi::BoatValue(GwBoatData::_GPST);
|
||||||
GwApi::BoatValue *valueList[]={gpsdays, gpsseconds};
|
GwApi::BoatValue *hdop=new GwApi::BoatValue(GwBoatData::_HDOP);
|
||||||
|
GwApi::BoatValue *valueList[]={gpsdays, gpsseconds, hdop};
|
||||||
|
|
||||||
// Sensor task loop runs with 100ms
|
// Sensor task loop runs with 100ms
|
||||||
//####################################################################################
|
//####################################################################################
|
||||||
|
@ -366,7 +368,7 @@ void sensorTask(void *param){
|
||||||
{
|
{
|
||||||
starttime0 = millis();
|
starttime0 = millis();
|
||||||
// Send NMEA0183 GPS data on several bus systems all 100ms
|
// Send NMEA0183 GPS data on several bus systems all 100ms
|
||||||
if (GPS_ready == true)
|
if (GPS_ready == true && hdop->value <= hdopAccuracy)
|
||||||
{
|
{
|
||||||
SNMEA0183Msg NMEA0183Msg;
|
SNMEA0183Msg NMEA0183Msg;
|
||||||
while (NMEA0183.GetMessageCor(NMEA0183Msg))
|
while (NMEA0183.GetMessageCor(NMEA0183Msg))
|
||||||
|
@ -381,8 +383,8 @@ void sensorTask(void *param){
|
||||||
if(millis() > starttime11 + 5*60*1000){
|
if(millis() > starttime11 + 5*60*1000){
|
||||||
starttime11 = millis();
|
starttime11 = millis();
|
||||||
if(rtcOn == "DS1388" && RTC_ready == true && GPS_ready == true){
|
if(rtcOn == "DS1388" && RTC_ready == true && GPS_ready == true){
|
||||||
api->getBoatDataValues(2,valueList);
|
api->getBoatDataValues(3,valueList);
|
||||||
if(gpsdays->valid && gpsseconds->valid){
|
if(gpsdays->valid && gpsseconds->valid && hdop->valid){
|
||||||
long ts = tNMEA0183Msg::daysToTime_t(gpsdays->value - (30*365+7))+floor(gpsseconds->value); // Adjusted to reference year 2000 (-30 years and 7 days for switch years)
|
long ts = tNMEA0183Msg::daysToTime_t(gpsdays->value - (30*365+7))+floor(gpsseconds->value); // Adjusted to reference year 2000 (-30 years and 7 days for switch years)
|
||||||
// sample input: date = "Dec 26 2009", time = "12:34:56"
|
// sample input: date = "Dec 26 2009", time = "12:34:56"
|
||||||
// ds1388.adjust(DateTime("Dec 26 2009", "12:34:56"));
|
// ds1388.adjust(DateTime("Dec 26 2009", "12:34:56"));
|
||||||
|
@ -421,7 +423,7 @@ void sensorTask(void *param){
|
||||||
// If GPS not ready or installed then send RTC time on bus all 500ms
|
// If GPS not ready or installed then send RTC time on bus all 500ms
|
||||||
if(millis() > starttime12 + 500){
|
if(millis() > starttime12 + 500){
|
||||||
starttime12 = millis();
|
starttime12 = millis();
|
||||||
if(rtcOn == "DS1388" && RTC_ready == true && GPS_ready == false){
|
if((rtcOn == "DS1388" && RTC_ready == true && GPS_ready == false) || (rtcOn == "DS1388" && RTC_ready == true && GPS_ready == true && hdop->valid == false)){
|
||||||
// Convert RTC time to Unix system time
|
// Convert RTC time to Unix system time
|
||||||
// https://de.wikipedia.org/wiki/Unixzeit
|
// https://de.wikipedia.org/wiki/Unixzeit
|
||||||
const short daysOfYear[12] = {0,31,59,90,120,151,181,212,243,273,304,334};
|
const short daysOfYear[12] = {0,31,59,90,120,151,181,212,243,273,304,334};
|
||||||
|
|
|
@ -311,6 +311,20 @@
|
||||||
"obp60":"true"
|
"obp60":"true"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "hdopAccuracy",
|
||||||
|
"label": "HDOP Accuracy [m]",
|
||||||
|
"type": "number",
|
||||||
|
"default": "20",
|
||||||
|
"check": "checkMinMax",
|
||||||
|
"min": 1,
|
||||||
|
"max": 50,
|
||||||
|
"description": "HDOP ccuracy in m for a valid GPS signal [1...50]",
|
||||||
|
"category": "OBP60 Hardware",
|
||||||
|
"capabilities": {
|
||||||
|
"obp60":"true"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "useEnvSensor",
|
"name": "useEnvSensor",
|
||||||
"label": "Env. Sensor",
|
"label": "Env. Sensor",
|
||||||
|
|
|
@ -432,6 +432,7 @@ void OBP60Task(GwApi *api){
|
||||||
uint brightness = 2.55 * uint(api->getConfig()->getConfigItem(api->getConfig()->blBrightness,true)->asInt());
|
uint brightness = 2.55 * uint(api->getConfig()->getConfigItem(api->getConfig()->blBrightness,true)->asInt());
|
||||||
bool uvoltage = api->getConfig()->getConfigItem(api->getConfig()->underVoltage,true)->asBoolean();
|
bool uvoltage = api->getConfig()->getConfigItem(api->getConfig()->underVoltage,true)->asBoolean();
|
||||||
String cpuspeed = api->getConfig()->getConfigItem(api->getConfig()->cpuSpeed,true)->asString();
|
String cpuspeed = api->getConfig()->getConfigItem(api->getConfig()->cpuSpeed,true)->asString();
|
||||||
|
uint hdopAccuracy = uint(api->getConfig()->getConfigItem(api->getConfig()->hdopAccuracy,true)->asInt());
|
||||||
|
|
||||||
// refreshmode defined in init section
|
// refreshmode defined in init section
|
||||||
// displaycolor defined in init section
|
// displaycolor defined in init section
|
||||||
|
@ -498,11 +499,11 @@ void OBP60Task(GwApi *api){
|
||||||
commonData.data.maxpage = numPages;
|
commonData.data.maxpage = numPages;
|
||||||
|
|
||||||
// If GPS fix then LED off (HDOP)
|
// If GPS fix then LED off (HDOP)
|
||||||
if(String(gpsFix) == "GPS Fix Lost" && date->valid == true){
|
if(String(gpsFix) == "GPS Fix Lost" && hdop->value <= hdopAccuracy && hdop->valid == true){
|
||||||
setFlashLED(false);
|
setFlashLED(false);
|
||||||
}
|
}
|
||||||
// If missing GPS fix then LED on
|
// If missing GPS fix then LED on
|
||||||
if(String(gpsFix) == "GPS Fix Lost" && date->valid == false){
|
if((String(gpsFix) == "GPS Fix Lost" && hdop->value > hdopAccuracy && hdop->valid == true) || (String(gpsFix) == "GPS Fix Lost" && hdop->valid == false)){
|
||||||
setFlashLED(true);
|
setFlashLED(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue