gps.fix broken

This commit is contained in:
nerdyscout 2019-11-24 17:13:42 +00:00
parent 59f6bc6d28
commit 6feb1c1f65
3 changed files with 22 additions and 21 deletions

View File

@ -314,7 +314,7 @@ Note: all settings are stored in NVRAM and will be reloaded when device starts.
0x03 set GPS data on/off
0 = GPS data off
1 = GPS data on, sends GPS data on port 4 (default, use port 1 for mobile pax counter), if GPS is present and has a fix [default]
1 = GPS data on, sends GPS data on port 4 (default, use port 1 for mobile pax counter), if GPS is present and has a fix
0x04 set display on/off

View File

@ -195,12 +195,10 @@ void PayloadConvert::addStatus(uint16_t voltage, uint64_t uptime, float cputemp,
void PayloadConvert::addGPS(gpsStatus_t value) {
#if(HAS_GPS)
writeLatLng(value.latitude, value.longitude);
#if !(PAYLOAD_OPENSENSEBOX)
writeUint8(value.satellites);
writeUint16(value.hdop);
writeUint16(value.altitude);
#endif
#endif
}
void PayloadConvert::addSensor(uint8_t buf[]) {

View File

@ -58,6 +58,7 @@ void sendData() {
uint8_t bitmask = cfg.payloadmask;
uint8_t mask = 1;
gpsStatus_t gps_status;
while (bitmask) {
switch (bitmask & mask) {
@ -71,14 +72,15 @@ void sendData() {
if (cfg.blescan)
payload.addCount(macs_ble, MAC_SNIFF_BLE);
#endif
#if (HAS_GPS) && (GPSPORT == 1)
// send GPS position only if we have a fix
if (gps.location.isValid()) {
gpsStatus_t gps_status;
gps_storelocation(&gps_status);
payload.addGPS(gps_status);
} else
ESP_LOGD(TAG, "No valid GPS position");
#if (HAS_GPS)
if (GPSPORT == COUNTERPORT) {
// send GPS position only if we have a fix
if (gps.location.isValid()) {
gps_storelocation(&gps_status);
payload.addGPS(gps_status);
} else
ESP_LOGD(TAG, "No valid GPS position");
}
#endif
#if (PAYLOAD_OPENSENSEBOX)
if (cfg.wifiscan)
@ -108,17 +110,18 @@ void sendData() {
break;
#endif
#if (HAS_GPS) && (GPSPORT != 1)
#if (HAS_GPS)
case GPS_DATA:
// send GPS position only if we have a fix
if (gps.location.isValid()) {
gpsStatus_t gps_status;
gps_storelocation(&gps_status);
payload.reset();
payload.addGPS(gps_status);
SendPayload(GPSPORT, prio_high);
} else
ESP_LOGD(TAG, "No valid GPS position");
if (GPSPORT != COUNTERPORT) {
// send GPS position only if we have a fix
if (gps.location.isValid()) {
gps_storelocation(&gps_status);
payload.reset();
payload.addGPS(gps_status);
SendPayload(GPSPORT, prio_high);
} else
ESP_LOGD(TAG, "No valid GPS position");
}
break;
#endif