Conditional imports for serial-based interfaces

pull/10/head
Mark Qvist 2021-12-01 13:57:40 +01:00
rodzic 259c2aa397
commit c44c6f9086
4 zmienionych plików z 4 dodań i 0 usunięć

Wyświetl plik

@ -47,6 +47,7 @@ class AX25KISSInterface(Interface):
serial = None
def __init__(self, owner, name, callsign, ssid, port, speed, databits, parity, stopbits, preamble, txtail, persistence, slottime, flow_control):
import importlib
if importlib.util.find_spec('serial') != None:
import serial
else:

Wyświetl plik

@ -39,6 +39,7 @@ class KISSInterface(Interface):
serial = None
def __init__(self, owner, name, port, speed, databits, parity, stopbits, preamble, txtail, persistence, slottime, flow_control, beacon_interval, beacon_data):
import importlib
if importlib.util.find_spec('serial') != None:
import serial
else:

Wyświetl plik

@ -71,6 +71,7 @@ class RNodeInterface(Interface):
CALLSIGN_MAX_LEN = 32
def __init__(self, owner, name, port, frequency = None, bandwidth = None, txpower = None, sf = None, cr = None, flow_control = False, id_interval = None, id_callsign = None):
import importlib
if importlib.util.find_spec('serial') != None:
import serial
else:

Wyświetl plik

@ -30,6 +30,7 @@ class SerialInterface(Interface):
serial = None
def __init__(self, owner, name, port, speed, databits, parity, stopbits):
import importlib
if importlib.util.find_spec('serial') != None:
import serial
else: