timmbogner / Farm-Data-Relay-System

A system that uses ESP-NOW, LoRa, and other protocols to transport sensor data in remote areas without relying on WiFi.
MIT License
485 stars 108 forks source link

decouple READING_ID from LoRa address #91

Closed aviateur17 closed 1 year ago

aviateur17 commented 1 year ago

Change READING_ID back to integer and decouple it from the LoRa address.

timmbogner commented 1 year ago

oop, missed this while I was yapping over in the other topic 😶

Looks good for now. We do need to make them unique, though.

One quick confession: I thought there was a way to tell the compiler to insert a random number into the sketch, like __RANDOM__ or something. I just looked and this does not exist.

__DATE__ and __TIME__ do exist, however and I think we can process those into a unique address.

timmbogner commented 1 year ago

After some thought and research, I think the best route to take is to borrow the last two digits of the MAC address if it is an ESP. If it is not, I found the ArduinoUniqueID library, which should get us unique addresses for other chipsets.

As a note, ArduinoUniqueID was designed for a library named LoRaNow, which is much like what we're doing. I was made aware of LoRaNow a while back, but it lacks a "sender address" in the packet structure, making it unsuitable for FDRS. Definitely worth looking at, though.