changes opensensebox payload struct

This commit is contained in:
nerdyscout 2019-11-21 20:18:03 +00:00
parent 494a9a3586
commit 032cfa0f8e
3 changed files with 2 additions and 4 deletions

View File

@ -95,11 +95,9 @@ typedef struct {
typedef struct { typedef struct {
int32_t latitude; int32_t latitude;
int32_t longitude; int32_t longitude;
#if !(PAYLOAD_OPENSENSEBOX)
uint8_t satellites; uint8_t satellites;
uint16_t hdop; uint16_t hdop;
int16_t altitude; int16_t altitude;
#endif
} gpsStatus_t; } gpsStatus_t;
typedef struct { typedef struct {

View File

@ -76,11 +76,9 @@ void gps_storelocation(gpsStatus_t *gps_store) {
(gps.location.age() < 1500)) { (gps.location.age() < 1500)) {
gps_store->latitude = (int32_t)(gps.location.lat() * 1e6); gps_store->latitude = (int32_t)(gps.location.lat() * 1e6);
gps_store->longitude = (int32_t)(gps.location.lng() * 1e6); gps_store->longitude = (int32_t)(gps.location.lng() * 1e6);
#if !(PAYLOAD_OPENSENSEBOX)
gps_store->satellites = (uint8_t)gps.satellites.value(); gps_store->satellites = (uint8_t)gps.satellites.value();
gps_store->hdop = (uint16_t)gps.hdop.value(); gps_store->hdop = (uint16_t)gps.hdop.value();
gps_store->altitude = (int16_t)gps.altitude.meters(); gps_store->altitude = (int16_t)gps.altitude.meters();
#endif
} }
} }

View File

@ -89,12 +89,14 @@ void PayloadConvert::addGPS(gpsStatus_t value) {
buffer[cursor++] = (byte)((value.longitude & 0x00FF0000) >> 16); buffer[cursor++] = (byte)((value.longitude & 0x00FF0000) >> 16);
buffer[cursor++] = (byte)((value.longitude & 0x0000FF00) >> 8); buffer[cursor++] = (byte)((value.longitude & 0x0000FF00) >> 8);
buffer[cursor++] = (byte)((value.longitude & 0x000000FF)); buffer[cursor++] = (byte)((value.longitude & 0x000000FF));
#if (!PAYLOAD_OPENSENSEBOX)
buffer[cursor++] = value.satellites; buffer[cursor++] = value.satellites;
buffer[cursor++] = highByte(value.hdop); buffer[cursor++] = highByte(value.hdop);
buffer[cursor++] = lowByte(value.hdop); buffer[cursor++] = lowByte(value.hdop);
buffer[cursor++] = highByte(value.altitude); buffer[cursor++] = highByte(value.altitude);
buffer[cursor++] = lowByte(value.altitude); buffer[cursor++] = lowByte(value.altitude);
#endif #endif
#endif
} }
void PayloadConvert::addSensor(uint8_t buf[]) { void PayloadConvert::addSensor(uint8_t buf[]) {