mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-11-23 06:00:18 +00:00
Cleanup in interfaces
This commit is contained in:
parent
67fc7685ec
commit
8c506b0c78
@ -25,8 +25,8 @@ class KISS():
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def escape(data):
|
def escape(data):
|
||||||
data = data.replace(bytes([0xdb]), bytes([0xdb])+bytes([0xdd]))
|
data = data.replace(bytes([0xdb]), bytes([0xdb, 0xdd]))
|
||||||
data = data.replace(bytes([0xc0]), bytes([0xdb])+bytes([0xdc]))
|
data = data.replace(bytes([0xc0]), bytes([0xdb, 0xdc]))
|
||||||
return data
|
return data
|
||||||
|
|
||||||
class AX25():
|
class AX25():
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
from .Interface import Interface
|
from .Interface import Interface
|
||||||
from time import sleep
|
from time import sleep
|
||||||
import sys
|
import sys
|
||||||
@ -25,8 +24,8 @@ class KISS():
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def escape(data):
|
def escape(data):
|
||||||
data = data.replace(bytes([0xdb]), bytes([0xdb])+bytes([0xdd]))
|
data = data.replace(bytes([0xdb]), bytes([0xdb, 0xdd]))
|
||||||
data = data.replace(bytes([0xc0]), bytes([0xdb])+bytes([0xdc]))
|
data = data.replace(bytes([0xc0]), bytes([0xdb, 0xdc]))
|
||||||
return data
|
return data
|
||||||
|
|
||||||
class KISSInterface(Interface):
|
class KISSInterface(Interface):
|
||||||
@ -53,7 +52,7 @@ class KISSInterface(Interface):
|
|||||||
self.online = False
|
self.online = False
|
||||||
|
|
||||||
self.packet_queue = []
|
self.packet_queue = []
|
||||||
self.flow_control = flow_control
|
self.flow_control = flow_control
|
||||||
self.interface_ready = False
|
self.interface_ready = False
|
||||||
|
|
||||||
self.preamble = preamble if preamble != None else 350;
|
self.preamble = preamble if preamble != None else 350;
|
||||||
@ -203,7 +202,7 @@ class KISSInterface(Interface):
|
|||||||
in_frame = False
|
in_frame = False
|
||||||
escape = False
|
escape = False
|
||||||
command = KISS.CMD_UNKNOWN
|
command = KISS.CMD_UNKNOWN
|
||||||
data_buffer = ""
|
data_buffer = b""
|
||||||
last_read_ms = int(time.time()*1000)
|
last_read_ms = int(time.time()*1000)
|
||||||
|
|
||||||
while self.serial.is_open:
|
while self.serial.is_open:
|
||||||
|
@ -48,8 +48,8 @@ class KISS():
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def escape(data):
|
def escape(data):
|
||||||
data = data.replace(bytes([0xdb]), bytes([0xdb])+bytes([0xdd]))
|
data = data.replace(bytes([0xdb]), bytes([0xdb, 0xdd]))
|
||||||
data = data.replace(bytes([0xc0]), bytes([0xdb])+bytes([0xdc]))
|
data = data.replace(bytes([0xc0]), bytes([0xdb, 0xdc]))
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
@ -419,10 +419,6 @@ class RNodeInterface(Interface):
|
|||||||
else:
|
else:
|
||||||
RNS.log(str(self)+" hardware error (code "+RNS.hexrep(byte)+")", RNS.LOG_ERROR)
|
RNS.log(str(self)+" hardware error (code "+RNS.hexrep(byte)+")", RNS.LOG_ERROR)
|
||||||
elif (command == KISS.CMD_READY):
|
elif (command == KISS.CMD_READY):
|
||||||
# TODO: Flow control is disabled by default now.
|
|
||||||
# Add timed flow control ready-inidication to the
|
|
||||||
# RNode firmware to make sure flow control doesn't
|
|
||||||
# hang if it is enabled
|
|
||||||
self.process_queue()
|
self.process_queue()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user