Skip to content

Commit

Permalink
Added interference avoidance configuration to rnodeconf
Browse files Browse the repository at this point in the history
  • Loading branch information
markqvist committed Jan 9, 2025
1 parent 3125b99 commit f7a0235
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions RNS/Utilities/rnodeconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class KISS():
CMD_DISP_RCND = 0x68
CMD_BT_CTRL = 0x46
CMD_BT_PIN = 0x62
CMD_DIS_IA = 0x69
CMD_BOARD = 0x47
CMD_PLATFORM = 0x48
CMD_MCU = 0x49
Expand Down Expand Up @@ -689,6 +690,16 @@ def recondition_display(self):
if written != len(kiss_command):
raise IOError("An IO error occurred while sending display recondition command to device")

def set_disable_interference_avoidance(self, ia_disabled):
if ia_disabled:
data = bytes([0x01])
else:
data = bytes([0x00])
kiss_command = bytes([KISS.FEND])+bytes([KISS.CMD_DIS_IA])+data+bytes([KISS.FEND])
written = self.serial.write(kiss_command)
if written != len(kiss_command):
raise IOError("An IO error occurred while sending interference avoidance configuration command to device")

def set_neopixel_intensity(self, intensity):
data = bytes([intensity & 0xFF])
kiss_command = bytes([KISS.FEND])+bytes([KISS.CMD_NP_INT])+data+bytes([KISS.FEND])
Expand Down Expand Up @@ -1335,6 +1346,9 @@ def main():
parser.add_argument("--sf", action="store", metavar="factor", type=int, default=None, help="Spreading factor for TNC mode (7 - 12)")
parser.add_argument("--cr", action="store", metavar="rate", type=int, default=None, help="Coding rate for TNC mode (5 - 8)")

parser.add_argument("-x", "--ia-enable", action="store_true", help="Enable interference avoidance")
parser.add_argument("-X", "--ia-disable", action="store_true", help="Disable interference avoidance")

parser.add_argument("--eeprom-backup", action="store_true", help="Backup EEPROM to file")
parser.add_argument("--eeprom-dump", action="store_true", help="Dump EEPROM to console")
parser.add_argument("--eeprom-wipe", action="store_true", help="Unlock and wipe EEPROM")
Expand Down Expand Up @@ -3434,6 +3448,16 @@ def get_flasher_call(platform, fw_filename):
RNS.log("Starting display reconditioning")
rnode.recondition_display()

if isinstance(args.ia_enable, bool):
if args.ia_enable:
RNS.log("Enabling interference avoidance")
rnode.set_disable_interference_avoidance(False)

if isinstance(args.ia_disable, bool):
if args.ia_disable:
RNS.log("Disabling interference avoidance")
rnode.set_disable_interference_avoidance(True)

if isinstance(args.np, int):
di = args.np
if di < 0:
Expand Down

0 comments on commit f7a0235

Please sign in to comment.