OPEnSLab-OSU / Loom

Arduino library for Internet of Things Rapid Prototyping in environmental sensing
GNU General Public License v3.0
26 stars 3 forks source link

Communication error after changing RadioHead address to NodeID on LoRa #180

Open SmithJar-rov opened 2 years ago

SmithJar-rov commented 2 years ago

+TITLE: Issue

The constructor in the LoRa module is changed so that, instead of initializing the address variable from config.h, it's instead initialized with device_manager->get_instance_num() to get the device ID. This way, the device ID and RadioHead ID match. After making these code changes, there is no packet received on the hub side and no acknowledgement received on the node side. Calls to the transmission function on the hub side seem to take much longer than they had previously. Communication works fine with the code reverted to the current state of the deployV3, or the commit prior to the most recent commit on FWV3.

Hardware: two M0 LoRa feathers To reproduce:

  1. Include Manager.h in LoRa.cpp
  2. Change the LoRa constructor so that it takes device_manager->get_instance_num() instead of address. (line 30 in LoRa.cpp)
  3. Remove address from the parameters of the constructor (line 21 in LoRa.cpp)
  4. Change the overloaded constructor to take EXPAND_ARRAY(p, 5) instead of EXPAND_ARRAY(p, 6) (line 89 in LoRa.cpp)
  5. Remove address from the parameters of the constructor in the header file (line 106 in LoRa.h)
  6. Remove the address paramaters from the header files of the LoRa/Transmit, LoRa/Receive, and LoRa/Receive_Blocking examples
  7. Upload the LoRa Receive example to one feather, and the Transmit example to the other feather.

You can view these changes in the most recent commit of FWV3. Note that I also changed some print statements, but these shouldn't effect anything.

Expected behavior: A print statement on the transmit side indicated a received acknowledgement, and the received packet printed out on the receive side. Packet number increasing sequentially to indicate no packet loss.

Code: All code changes are in LoRa.cpp and LoRa.h in src/CommPlats. The examples used are Receive.ino and Transmit.ino in examples/"Communication Platforms"/LoRa