mirror of
https://github.com/markqvist/Reticulum.git
synced 2025-08-10 23:40:55 -04:00
Conditional imports for serial-based interfaces
This commit is contained in:
parent
10854bfdbc
commit
259c2aa397
5 changed files with 29 additions and 5 deletions
|
@ -1,7 +1,6 @@
|
|||
from .Interface import Interface
|
||||
from time import sleep
|
||||
import sys
|
||||
import serial
|
||||
import threading
|
||||
import time
|
||||
import RNS
|
||||
|
@ -31,6 +30,13 @@ class SerialInterface(Interface):
|
|||
serial = None
|
||||
|
||||
def __init__(self, owner, name, port, speed, databits, parity, stopbits):
|
||||
if importlib.util.find_spec('serial') != None:
|
||||
import serial
|
||||
else:
|
||||
RNS.log("Using the Serial interface requires a serial communication module to be installed.", RNS.LOG_CRITICAL)
|
||||
RNS.log("You can install one with the command: python3 -m pip install pyserial", RNS.LOG_CRITICAL)
|
||||
RNS.panic()
|
||||
|
||||
self.rxb = 0
|
||||
self.txb = 0
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue