Increased GPS altitude resolution, further fixes

This commit is contained in:
cyberman54 committed 2019-07-27 13:35:12 +02:00
1 parent 8fdd83edf9
commit 1f9e93cf39
4 files changed
+15 -18

No files matched your search

+2 -3
View File
@@ -143,7 +143,7 @@ var hdop = function (bytes) {
if (bytes.length !== hdop.BYTES) {
throw new Error('hdop must have exactly 2 bytes');
}
return bytesToInt(bytes) / 100;
return +(bytesToInt(bytes) / 100).toFixed(1);
};
hdop.BYTES = 2;
@@ -151,8 +151,7 @@ var altitude = function (bytes) {
if (bytes.length !== altitude.BYTES) {
throw new Error('Altitude must have exactly 2 bytes');
}
var alt = bytesToInt(bytes) / 4 - 1000;
return +alt.toFixed(1);
return +(bytesToInt(bytes) / 4 - 1000).toFixed(1);
};
altitude.BYTES = 2;
+1 -1
View File
@@ -71,7 +71,7 @@ void gps_storelocation(gpsStatus_t &gps_store) {
gps_store.longitude = (int32_t)(gps.location.lng() * 1e6);
gps_store.satellites = (uint8_t)gps.satellites.value();
gps_store.hdop = (uint16_t)gps.hdop.value();
gps_store.altitude = (int16_t)((gps.altitude.meters() + 1000) * 4);
gps_store.altitude = (int16_t)gps.altitude.meters();
}
// store current GPS timedate in struct
+7 -9
View File
@@ -16,7 +16,7 @@ uint8_t *PayloadConvert::getBuffer(void) { return buffer; }
/* ---------------- plain format without special encoding ---------- */
#if PAYLOAD_ENCODER == 1
#if (PAYLOAD_ENCODER == 1)
void PayloadConvert::addByte(uint8_t value) { buffer[cursor++] = (value); }
@@ -92,8 +92,8 @@ void PayloadConvert::addGPS(gpsStatus_t value) {
buffer[cursor++] = value.satellites;
buffer[cursor++] = highByte(value.hdop);
buffer[cursor++] = lowByte(value.hdop);
buffer[cursor++] = highByte(value.altitude);
buffer[cursor++] = lowByte(value.altitude);
buffer[cursor++] = highByte((value.altitude + 1000) * 4);
buffer[cursor++] = lowByte((value.altitude + 1000) * 4);
#endif
}
@@ -141,7 +141,7 @@ void PayloadConvert::addTime(time_t value) {
// derived from
// https://github.com/thesolarnomad/lora-serialization/blob/master/src/LoraEncoder.cpp
#elif PAYLOAD_ENCODER == 2
#elif (PAYLOAD_ENCODER == 2)
void PayloadConvert::addByte(uint8_t value) { writeUint8(value); }
@@ -195,7 +195,7 @@ void PayloadConvert::addGPS(gpsStatus_t value) {
writeLatLng(value.latitude, value.longitude);
writeUint8(value.satellites);
writeUint16(value.hdop);
writeUint16(value.altitude);
writeUint16((value.altitude + 1000) * 4);
#endif
}
@@ -301,7 +301,7 @@ void PayloadConvert::writeBitmap(bool a, bool b, bool c, bool d, bool e, bool f,
// FPort 1 PAYLOAD_ENCODER == 4 -> Packed Sensor Payload, not using channels ->
// FPort 2
#elif (PAYLOAD_ENCODER == 3 || PAYLOAD_ENCODER == 4)
#elif ((PAYLOAD_ENCODER == 3) || (PAYLOAD_ENCODER == 4))
void PayloadConvert::addByte(uint8_t value) {
/*
@@ -412,7 +412,7 @@ void PayloadConvert::addSensor(uint8_t buf[]) {
memcpy(buffer, buf+1, length);
cursor += length; // length of buffer
*/
#endif
#endif // HAS_SENSORS
}
void PayloadConvert::addBME(bmeStatus_t value) {
@@ -481,6 +481,4 @@ void PayloadConvert::addTime(time_t value) {
#endif
}
#else
#error No valid payload converter defined!
#endif