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 0x03 set GPS data on/off
0 = GPS data 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 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) { void PayloadConvert::addGPS(gpsStatus_t value) {
#if(HAS_GPS) #if(HAS_GPS)
writeLatLng(value.latitude, value.longitude); writeLatLng(value.latitude, value.longitude);
#if !(PAYLOAD_OPENSENSEBOX)
writeUint8(value.satellites); writeUint8(value.satellites);
writeUint16(value.hdop); writeUint16(value.hdop);
writeUint16(value.altitude); writeUint16(value.altitude);
#endif #endif
#endif
} }
void PayloadConvert::addSensor(uint8_t buf[]) { void PayloadConvert::addSensor(uint8_t buf[]) {

View File

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