Como Enviar Coordenadas em Lora

Olá malta deixo aqui uma bela forma de enviar coordenadas por Lora usando pandas 8 bytes
Encode:
int32_t lat = fix.latitude() * 1000000;
int32_t lon = fix.longitude() * 1000000;
coords[0] = lat;
coords[1] = lat >> 8;
coords[2] = lat >> 16;
coords[3] = lat >> 24;

    coords[4] = lon;
    coords[5] = lon >> 8;
    coords[6] = lon >> 16;
    coords[7] = lon >> 24;

DECODE:

lat = (b[0] | b[1]<<8 | b[2]<<16 | b[3]<<24 | (b[3] & 0x80 ? 0xFF<<24 : 0)) / 1000000;
lng = (b[4] | b[5]<<8 | b[6]<<16 | b[7]<<24 | (b[7] & 0x80 ? 0xFF<<24 : 0)) / 1000000;

:slight_smile:22

Projeto relacionado :slight_smile:

Hi, it is nice to see a reference to our gtihub. The way of decoding GPS location into 9 bytes is the format what was used for ttnmapper.org - very insightful if you want to encode data.

My projects are based on the Lora32u4 board, €12 on aliexpress. I always add a €10 GPS to make things easier.
Let me know if you’d like help.

1 Like

Hello Marco, yes sure!! Tell me what you need :slight_smile:

I’d like to make a how-to instruction for the public. So everyone can build this and activate on TTN. I have started a how-to document on the github you found, but have to rewrite it to reduce it in size and detail. I think it also explains the decoder.

I may need a proofreader.

1 Like

Sure :slight_smile:
I can check, thanks for the first document :slight_smile: