mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-10-01 03:15:44 -04:00
Compare commits
4 Commits
44579bb7ed
...
94dd0e8580
Author | SHA1 | Date | |
---|---|---|---|
|
94dd0e8580 | ||
|
1c56385473 | ||
|
787af92ade | ||
|
9a97195b8c |
@ -249,6 +249,7 @@ class RNodeMultiInterface(Interface):
|
|||||||
if (not self.validcfg):
|
if (not self.validcfg):
|
||||||
raise ValueError("The configuration for "+str(self)+" contains errors, interface is offline")
|
raise ValueError("The configuration for "+str(self)+" contains errors, interface is offline")
|
||||||
|
|
||||||
|
def start(self):
|
||||||
try:
|
try:
|
||||||
self.open_port()
|
self.open_port()
|
||||||
|
|
||||||
@ -323,8 +324,8 @@ class RNodeMultiInterface(Interface):
|
|||||||
lt_alock=subint[9]
|
lt_alock=subint[9]
|
||||||
)
|
)
|
||||||
|
|
||||||
interface.OUT = self.OUT
|
interface.OUT = subint[10]
|
||||||
interface.IN = self.IN
|
interface.IN = True
|
||||||
|
|
||||||
interface.announce_rate_target = self.announce_rate_target
|
interface.announce_rate_target = self.announce_rate_target
|
||||||
interface.mode = self.mode
|
interface.mode = self.mode
|
||||||
@ -1006,6 +1007,11 @@ class RNodeSubInterface(Interface):
|
|||||||
self.parent_interface = parent_interface
|
self.parent_interface = parent_interface
|
||||||
self.announce_rate_target = None
|
self.announce_rate_target = None
|
||||||
|
|
||||||
|
self.mode = None
|
||||||
|
self.announce_cap = None
|
||||||
|
self.bitrate = None
|
||||||
|
self.ifac_size = None
|
||||||
|
|
||||||
# add this interface to the subinterfaces array
|
# add this interface to the subinterfaces array
|
||||||
self.parent_interface.subinterfaces[index] = self
|
self.parent_interface.subinterfaces[index] = self
|
||||||
|
|
||||||
|
@ -971,7 +971,7 @@ class Reticulum:
|
|||||||
enabled_count += 1
|
enabled_count += 1
|
||||||
|
|
||||||
# Create an array with a row for each subinterface
|
# Create an array with a row for each subinterface
|
||||||
subint_config = [[0 for x in range(10)] for y in range(enabled_count)]
|
subint_config = [[0 for x in range(11)] for y in range(enabled_count)]
|
||||||
subint_index = 0
|
subint_index = 0
|
||||||
|
|
||||||
for subinterface in c:
|
for subinterface in c:
|
||||||
@ -1000,6 +1000,11 @@ class Reticulum:
|
|||||||
subint_config[subint_index][8] = st_alock
|
subint_config[subint_index][8] = st_alock
|
||||||
lt_alock = float(subinterface_config["airtime_limit_long"]) if "airtime_limit_long" in subinterface_config else None
|
lt_alock = float(subinterface_config["airtime_limit_long"]) if "airtime_limit_long" in subinterface_config else None
|
||||||
subint_config[subint_index][9] = lt_alock
|
subint_config[subint_index][9] = lt_alock
|
||||||
|
|
||||||
|
if "outgoing" in subinterface_config and subinterface_config.as_bool("outgoing") == False:
|
||||||
|
subint_config[subint_index][10] = False
|
||||||
|
else:
|
||||||
|
subint_config[subint_index][10] = True
|
||||||
subint_index += 1
|
subint_index += 1
|
||||||
|
|
||||||
# if no subinterfaces are defined
|
# if no subinterfaces are defined
|
||||||
@ -1025,10 +1030,8 @@ class Reticulum:
|
|||||||
id_callsign = id_callsign
|
id_callsign = id_callsign
|
||||||
)
|
)
|
||||||
|
|
||||||
if "outgoing" in c and c.as_bool("outgoing") == False:
|
interface.IN = False
|
||||||
interface.OUT = False
|
interface.OUT = False
|
||||||
else:
|
|
||||||
interface.OUT = True
|
|
||||||
|
|
||||||
interface.mode = interface_mode
|
interface.mode = interface_mode
|
||||||
|
|
||||||
@ -1079,6 +1082,9 @@ class Reticulum:
|
|||||||
|
|
||||||
RNS.Transport.interfaces.append(interface)
|
RNS.Transport.interfaces.append(interface)
|
||||||
|
|
||||||
|
if isinstance(interface, RNS.Interfaces.RNodeMultiInterface.RNodeMultiInterface):
|
||||||
|
interface.start()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
RNS.log("Skipping disabled interface \""+name+"\"", RNS.LOG_DEBUG)
|
RNS.log("Skipping disabled interface \""+name+"\"", RNS.LOG_DEBUG)
|
||||||
|
|
||||||
|
@ -81,7 +81,9 @@ class KISS():
|
|||||||
CMD_BLINK = 0x30
|
CMD_BLINK = 0x30
|
||||||
CMD_RANDOM = 0x40
|
CMD_RANDOM = 0x40
|
||||||
CMD_DISP_INT = 0x45
|
CMD_DISP_INT = 0x45
|
||||||
|
CMD_NP_INT = 0x65
|
||||||
CMD_DISP_ADR = 0x63
|
CMD_DISP_ADR = 0x63
|
||||||
|
CMD_DISP_BLNK = 0x64
|
||||||
CMD_BT_CTRL = 0x46
|
CMD_BT_CTRL = 0x46
|
||||||
CMD_BT_PIN = 0x62
|
CMD_BT_PIN = 0x62
|
||||||
CMD_BOARD = 0x47
|
CMD_BOARD = 0x47
|
||||||
@ -637,6 +639,20 @@ class RNode():
|
|||||||
if written != len(kiss_command):
|
if written != len(kiss_command):
|
||||||
raise IOError("An IO error occurred while sending display intensity command to device")
|
raise IOError("An IO error occurred while sending display intensity command to device")
|
||||||
|
|
||||||
|
def set_display_blanking(self, blanking_timeout):
|
||||||
|
data = bytes([blanking_timeout & 0xFF])
|
||||||
|
kiss_command = bytes([KISS.FEND])+bytes([KISS.CMD_DISP_BLNK])+data+bytes([KISS.FEND])
|
||||||
|
written = self.serial.write(kiss_command)
|
||||||
|
if written != len(kiss_command):
|
||||||
|
raise IOError("An IO error occurred while sending display blanking timeout 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])
|
||||||
|
written = self.serial.write(kiss_command)
|
||||||
|
if written != len(kiss_command):
|
||||||
|
raise IOError("An IO error occurred while sending NeoPixel intensity command to device")
|
||||||
|
|
||||||
def set_display_address(self, address):
|
def set_display_address(self, address):
|
||||||
data = bytes([address & 0xFF])
|
data = bytes([address & 0xFF])
|
||||||
kiss_command = bytes([KISS.FEND])+bytes([KISS.CMD_DISP_ADR])+data+bytes([KISS.FEND])
|
kiss_command = bytes([KISS.FEND])+bytes([KISS.CMD_DISP_ADR])+data+bytes([KISS.FEND])
|
||||||
@ -1261,8 +1277,11 @@ def main():
|
|||||||
parser.add_argument("-p", "--bluetooth-pair", action="store_true", help="Put device into bluetooth pairing mode")
|
parser.add_argument("-p", "--bluetooth-pair", action="store_true", help="Put device into bluetooth pairing mode")
|
||||||
|
|
||||||
parser.add_argument("-D", "--display", action="store", metavar="i", type=int, default=None, help="Set display intensity (0-255)")
|
parser.add_argument("-D", "--display", action="store", metavar="i", type=int, default=None, help="Set display intensity (0-255)")
|
||||||
|
parser.add_argument("-t", "--timeout", action="store", metavar="s", type=int, default=None, help="Set display timeout in seconds, 0 to disable")
|
||||||
parser.add_argument("--display-addr", action="store", metavar="byte", type=str, default=None, help="Set display address as hex byte (00 - FF)")
|
parser.add_argument("--display-addr", action="store", metavar="byte", type=str, default=None, help="Set display address as hex byte (00 - FF)")
|
||||||
|
|
||||||
|
parser.add_argument("--np", action="store", metavar="i", type=int, default=None, help="Set NeoPixel intensity (0-255)")
|
||||||
|
|
||||||
parser.add_argument("--freq", action="store", metavar="Hz", type=int, default=None, help="Frequency in Hz for TNC mode")
|
parser.add_argument("--freq", action="store", metavar="Hz", type=int, default=None, help="Frequency in Hz for TNC mode")
|
||||||
parser.add_argument("--bw", action="store", metavar="Hz", type=int, default=None, help="Bandwidth in Hz for TNC mode")
|
parser.add_argument("--bw", action="store", metavar="Hz", type=int, default=None, help="Bandwidth in Hz for TNC mode")
|
||||||
parser.add_argument("--txp", action="store", metavar="dBm", type=int, default=None, help="TX power in dBm for TNC mode")
|
parser.add_argument("--txp", action="store", metavar="dBm", type=int, default=None, help="TX power in dBm for TNC mode")
|
||||||
@ -3168,6 +3187,27 @@ def main():
|
|||||||
RNS.log("Setting display intensity to "+str(di))
|
RNS.log("Setting display intensity to "+str(di))
|
||||||
rnode.set_display_intensity(di)
|
rnode.set_display_intensity(di)
|
||||||
|
|
||||||
|
if isinstance(args.timeout, int):
|
||||||
|
di = args.timeout
|
||||||
|
if di < 0:
|
||||||
|
di = 0
|
||||||
|
if di > 255:
|
||||||
|
di = 255
|
||||||
|
if di == 0:
|
||||||
|
RNS.log("Disabling display blanking")
|
||||||
|
else:
|
||||||
|
RNS.log("Setting display timeout to "+str(di))
|
||||||
|
rnode.set_display_blanking(di)
|
||||||
|
|
||||||
|
if isinstance(args.np, int):
|
||||||
|
di = args.np
|
||||||
|
if di < 0:
|
||||||
|
di = 0
|
||||||
|
if di > 255:
|
||||||
|
di = 255
|
||||||
|
RNS.log("Setting NeoPixel intensity to "+str(di))
|
||||||
|
rnode.set_neopixel_intensity(di)
|
||||||
|
|
||||||
if isinstance(args.display_addr, str):
|
if isinstance(args.display_addr, str):
|
||||||
set_addr = False
|
set_addr = False
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user