Skip to content

Commit f7a0235

Browse files
committed
Added interference avoidance configuration to rnodeconf
1 parent 3125b99 commit f7a0235

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

RNS/Utilities/rnodeconf.py

+24
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ class KISS():
8888
CMD_DISP_RCND = 0x68
8989
CMD_BT_CTRL = 0x46
9090
CMD_BT_PIN = 0x62
91+
CMD_DIS_IA = 0x69
9192
CMD_BOARD = 0x47
9293
CMD_PLATFORM = 0x48
9394
CMD_MCU = 0x49
@@ -689,6 +690,16 @@ def recondition_display(self):
689690
if written != len(kiss_command):
690691
raise IOError("An IO error occurred while sending display recondition command to device")
691692

693+
def set_disable_interference_avoidance(self, ia_disabled):
694+
if ia_disabled:
695+
data = bytes([0x01])
696+
else:
697+
data = bytes([0x00])
698+
kiss_command = bytes([KISS.FEND])+bytes([KISS.CMD_DIS_IA])+data+bytes([KISS.FEND])
699+
written = self.serial.write(kiss_command)
700+
if written != len(kiss_command):
701+
raise IOError("An IO error occurred while sending interference avoidance configuration command to device")
702+
692703
def set_neopixel_intensity(self, intensity):
693704
data = bytes([intensity & 0xFF])
694705
kiss_command = bytes([KISS.FEND])+bytes([KISS.CMD_NP_INT])+data+bytes([KISS.FEND])
@@ -1335,6 +1346,9 @@ def main():
13351346
parser.add_argument("--sf", action="store", metavar="factor", type=int, default=None, help="Spreading factor for TNC mode (7 - 12)")
13361347
parser.add_argument("--cr", action="store", metavar="rate", type=int, default=None, help="Coding rate for TNC mode (5 - 8)")
13371348

1349+
parser.add_argument("-x", "--ia-enable", action="store_true", help="Enable interference avoidance")
1350+
parser.add_argument("-X", "--ia-disable", action="store_true", help="Disable interference avoidance")
1351+
13381352
parser.add_argument("--eeprom-backup", action="store_true", help="Backup EEPROM to file")
13391353
parser.add_argument("--eeprom-dump", action="store_true", help="Dump EEPROM to console")
13401354
parser.add_argument("--eeprom-wipe", action="store_true", help="Unlock and wipe EEPROM")
@@ -3434,6 +3448,16 @@ def get_flasher_call(platform, fw_filename):
34343448
RNS.log("Starting display reconditioning")
34353449
rnode.recondition_display()
34363450

3451+
if isinstance(args.ia_enable, bool):
3452+
if args.ia_enable:
3453+
RNS.log("Enabling interference avoidance")
3454+
rnode.set_disable_interference_avoidance(False)
3455+
3456+
if isinstance(args.ia_disable, bool):
3457+
if args.ia_disable:
3458+
RNS.log("Disabling interference avoidance")
3459+
rnode.set_disable_interference_avoidance(True)
3460+
34373461
if isinstance(args.np, int):
34383462
di = args.np
34393463
if di < 0:

0 commit comments

Comments
 (0)