Where is this LPP_GPS
defined? If defined in some library then I’d assume it would also provide functions such as, say, addGPS
? Also, if properly encoded using Cayenne LPP then TTN Console can decode for you out of the box, if you select the proper payload format:
That said, assuming coords
is some 8 bits data type, then it seems your code looks okay. You don’t need to use the channel in bytes[0]
if your device only has a single GPS receiver. Also, you don’t need to validate bytes[1]
if you know what you’re sending… In fact, you could also not use Cayenne LPP and not send those 2 bytes, and use a decoder like you did. Altitude could then maybe use fewer bytes too. In all, that would only limit the total payload from 13 + 11 = 24 bytes to about 13 + 7 or 8 = 20 or 21 bytes. (A LoRaWAN packet always needs at least 13 bytes of overhead.)
Aside: please see How do I format my forum post? [HowTo]