markqvist / RNode_Firmware

RNode is an open, free and flexible digital radio interface with many uses
https://unsigned.io/rnode
GNU General Public License v3.0
166 stars 56 forks source link

Fixed exception caused by global reference. #2

Closed ryanbarrie closed 6 years ago

ryanbarrie commented 6 years ago

I was getting the following error when running the example code. I added a stack trace to the RNode.py library to find what appears to be the issue. Console output below:

[2018-08-01 21:43:58] [Notice] Opening serial port /dev/ttyUSB1...
[2018-08-01 21:44:00] [Notice] Serial port /dev/ttyUSB1 is now open
[2018-08-01 21:44:00] [Verbose] Configuring RNode interface...
[2018-08-01 21:44:00] [Verbose] Validating radio configuration for RNodeInterface[My RNode]...                                                                                 
[2018-08-01 21:44:00] [Debug] RNodeInterface[My RNode] Radio reporting frequency is 433.0 MHz                                                                                  
[2018-08-01 21:44:00] [Debug] RNodeInterface[My RNode] Radio reporting bandwidth is 125.0 KHz                                                                                  
[2018-08-01 21:44:00] [Debug] RNodeInterface[My RNode] Radio reporting TX power is 2 dBm                                                                                       
[2018-08-01 21:44:00] [Debug] RNodeInterface[My RNode] Radio reporting spreading factor is 7                                                                                   
[2018-08-01 21:44:00] [Debug] RNodeInterface[My RNode] On-air bitrate is now 5.47 kbps
[2018-08-01 21:44:00] [Notice] RNodeInterface[My RNode] is configured and powered up
Waiting for packets, hit enter to send a packet, Ctrl-C to exit
[2018-08-01 21:44:05] [Error] A serial port error occurred, the contained exception was: global name 'RSSI_OFFSET' is not defined                                              
[2018-08-01 21:44:05] [Error] The interface My RNode is now offline.
Traceback (most recent call last):
  File "/home/ryan/dev/RNode_Firmware/Libraries/RNode.py", line 416, in readLoop
    self.r_stat_rssi = ord(byte)-RSSI_OFFSET
NameError: global name 'RSSI_OFFSET' is not defined
^C

I believe this is the correct fix, but please leave me feedback if it is not.