payload encoder fix HAS GPS

This commit is contained in:
Klaus K Wilting 2018-06-17 13:31:24 +02:00
parent 87910492e0
commit b1de323ed5
3 changed files with 17 additions and 5 deletions

View File

@ -15,8 +15,8 @@
;env_default = ttgov1 ;env_default = ttgov1
;env_default = ttgov2 ;env_default = ttgov2
;env_default = ttgov21 ;env_default = ttgov21
env_default = ttgobeam ;env_default = ttgobeam
;env_default = lopy env_default = lopy
;env_default = lopy4 ;env_default = lopy4
;env_default = fipy ;env_default = fipy
;env_default = lolin32lite ;env_default = lolin32lite

View File

@ -24,6 +24,7 @@ void TTNplain::addCount(uint16_t value1, uint16_t value2) {
buffer[cursor++] = value2; buffer[cursor++] = value2;
} }
#ifdef HAS_GPS
void TTNplain::addGPS(gpsStatus_t value) { void TTNplain::addGPS(gpsStatus_t value) {
buffer[cursor++] = value.latitude >> 24; buffer[cursor++] = value.latitude >> 24;
buffer[cursor++] = value.latitude >> 16; buffer[cursor++] = value.latitude >> 16;
@ -39,6 +40,7 @@ void TTNplain::addGPS(gpsStatus_t value) {
buffer[cursor++] = value.altitude >> 8; buffer[cursor++] = value.altitude >> 8;
buffer[cursor++] = value.altitude; buffer[cursor++] = value.altitude;
} }
#endif
void TTNplain::addConfig(configData_t value) { void TTNplain::addConfig(configData_t value) {
buffer[cursor++] = value.lorasf; buffer[cursor++] = value.lorasf;
@ -99,6 +101,7 @@ void TTNserialized::addCount(uint16_t value1, uint16_t value2) {
message.writeUint16(value2); message.writeUint16(value2);
} }
#ifdef HAS_GPS
void TTNserialized::addGPS(gpsStatus_t value) { void TTNserialized::addGPS(gpsStatus_t value) {
LoraEncoder message(buffer); LoraEncoder message(buffer);
message.writeLatLng(value.latitude, value.longitude); message.writeLatLng(value.latitude, value.longitude);
@ -106,6 +109,7 @@ void TTNserialized::addGPS(gpsStatus_t value) {
message.writeUint16(value.hdop); message.writeUint16(value.hdop);
message.writeUint16(value.altitude); message.writeUint16(value.altitude);
} }
#endif
void TTNserialized::addConfig(configData_t value) { void TTNserialized::addConfig(configData_t value) {
LoraEncoder message(buffer); LoraEncoder message(buffer);
@ -156,6 +160,7 @@ void CayenneLPP::addCount(uint16_t value1, uint16_t value2) {
buffer[cursor++] = value2; buffer[cursor++] = value2;
} }
#ifdef HAS_GPS
void CayenneLPP::addGPS(gpsStatus_t value) { void CayenneLPP::addGPS(gpsStatus_t value) {
int32_t lat = value.latitude / 100; int32_t lat = value.latitude / 100;
int32_t lon = value.longitude / 100; int32_t lon = value.longitude / 100;
@ -172,6 +177,7 @@ void CayenneLPP::addGPS(gpsStatus_t value) {
buffer[cursor++] = alt >> 8; buffer[cursor++] = alt >> 8;
buffer[cursor++] = alt; buffer[cursor++] = alt;
} }
#endif
void CayenneLPP::addConfig(configData_t value) { void CayenneLPP::addConfig(configData_t value) {
buffer[cursor++] = LPP_ADR_CHANNEL; buffer[cursor++] = LPP_ADR_CHANNEL;

View File

@ -30,9 +30,11 @@ public:
uint8_t *getBuffer(void); uint8_t *getBuffer(void);
void addCount(uint16_t value1, uint16_t value2); void addCount(uint16_t value1, uint16_t value2);
void addGPS(gpsStatus_t value);
void addConfig(configData_t value); void addConfig(configData_t value);
void addStatus(uint16_t voltage, uint64_t uptime, float cputemp); void addStatus(uint16_t voltage, uint64_t uptime, float cputemp);
#ifdef HAS_GPS
void addGPS(gpsStatus_t value);
#endif
private: private:
uint8_t *buffer; uint8_t *buffer;
@ -50,9 +52,11 @@ public:
uint8_t *getBuffer(void); uint8_t *getBuffer(void);
void addCount(uint16_t value1, uint16_t value2); void addCount(uint16_t value1, uint16_t value2);
void addGPS(gpsStatus_t value);
void addConfig(configData_t value); void addConfig(configData_t value);
void addStatus(uint16_t voltage, uint64_t uptime, float cputemp); void addStatus(uint16_t voltage, uint64_t uptime, float cputemp);
#ifdef HAS_GPS
void addGPS(gpsStatus_t value);
#endif
private: private:
uint8_t *buffer; uint8_t *buffer;
@ -69,9 +73,11 @@ public:
uint8_t *getBuffer(void); uint8_t *getBuffer(void);
void addCount(uint16_t value1, uint16_t value2); void addCount(uint16_t value1, uint16_t value2);
void addGPS(gpsStatus_t value);
void addConfig(configData_t value); void addConfig(configData_t value);
void addStatus(uint16_t voltage, uint64_t uptime, float cputemp); void addStatus(uint16_t voltage, uint64_t uptime, float cputemp);
#ifdef HAS_GPS
void addGPS(gpsStatus_t value);
#endif
private: private:
uint8_t *buffer; uint8_t *buffer;