adafruit / TinyLoRa

LoRaWAN Library
68 stars 37 forks source link

Fix corrupt message sends due to encryption #13

Closed brentru closed 5 years ago

brentru commented 5 years ago

In the examples, a fixed string is created to send the message "Hello LoRa" but when the message to be transmitted is processed, the contents of the data array passed to senData are destroyed during the encryption process.

https://github.com/adafruit/TinyLoRa/issues/11

I've addressed this by creating a local copy of the Data (tmpData) in each lora.sendData() call to preserve the contents of the original data sent to the sendData() function. The new, encrypted data (tmpData) is used to build the radio package, instead of Data.