gps.fix broken
This commit is contained in:
		
							parent
							
								
									59f6bc6d28
								
							
						
					
					
						commit
						6feb1c1f65
					
				| @ -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 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -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[]) { | ||||||
|  | |||||||
| @ -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)  | ||||||
|       // send GPS position only if we have a fix
 |       if (GPSPORT == COUNTERPORT) { | ||||||
|       if (gps.location.isValid()) { |         // send GPS position only if we have a fix
 | ||||||
|         gpsStatus_t gps_status; |         if (gps.location.isValid()) { | ||||||
|         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: | ||||||
|       // send GPS position only if we have a fix
 |       if (GPSPORT != COUNTERPORT) { | ||||||
|       if (gps.location.isValid()) { |         // send GPS position only if we have a fix
 | ||||||
|         gpsStatus_t gps_status; |         if (gps.location.isValid()) { | ||||||
|         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 | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user