Fixed invalid driver proxy for Qinheng CH34x chips on Android

This commit is contained in:
Mark Qvist 2022-12-15 17:14:09 +01:00
parent e28dbd4afa
commit 2a264fa7d6

View File

@ -254,13 +254,14 @@ class RNodeInterface(Interface):
# Driver overrides for speficic chips # Driver overrides for speficic chips
from usbserial4a import serial4a as pyserial from usbserial4a import serial4a as pyserial
proxy = pyserial.get_serial_port
if vid == 0x1A86 and pid == 0x55D4: if vid == 0x1A86 and pid == 0x55D4:
# Force CDC driver for Qinheng CH34x # Force CDC driver for Qinheng CH34x
RNS.log("Using CDC driver for "+RNS.hexrep(vid)+":"+RNS.hexrep(pid), RNS.LOG_DEBUG) RNS.log("Using CDC driver for "+RNS.hexrep(vid)+":"+RNS.hexrep(pid), RNS.LOG_DEBUG)
from usbserial4a.cdcacmserial4a import CdcAcmSerial from usbserial4a.cdcacmserial4a import CdcAcmSerial
proxy = CdcAcmSerial proxy = CdcAcmSerial
serial = pyserial.get_serial_port( serial = proxy(
port, port,
baudrate = 115200, baudrate = 115200,
bytesize = 8, bytesize = 8,
@ -554,7 +555,7 @@ class RNodeInterface(Interface):
thread.start() thread.start()
self.detect() self.detect()
sleep(0.4) sleep(0.5)
if not self.detected: if not self.detected:
raise IOError("Could not detect device") raise IOError("Could not detect device")
@ -592,22 +593,22 @@ class RNodeInterface(Interface):
def initRadio(self): def initRadio(self):
self.setFrequency() self.setFrequency()
time.sleep(0.1) time.sleep(0.15)
self.setBandwidth() self.setBandwidth()
time.sleep(0.1) time.sleep(0.15)
self.setTXPower() self.setTXPower()
time.sleep(0.1) time.sleep(0.15)
self.setSpreadingFactor() self.setSpreadingFactor()
time.sleep(0.1) time.sleep(0.15)
self.setCodingRate() self.setCodingRate()
time.sleep(0.1) time.sleep(0.15)
self.setRadioState(KISS.RADIO_STATE_ON) self.setRadioState(KISS.RADIO_STATE_ON)
time.sleep(0.1) time.sleep(0.15)
def detect(self): def detect(self):
kiss_command = bytes([KISS.FEND, KISS.CMD_DETECT, KISS.DETECT_REQ, KISS.FEND, KISS.CMD_FW_VERSION, 0x00, KISS.FEND, KISS.CMD_PLATFORM, 0x00, KISS.FEND, KISS.CMD_MCU, 0x00, KISS.FEND]) kiss_command = bytes([KISS.FEND, KISS.CMD_DETECT, KISS.DETECT_REQ, KISS.FEND, KISS.CMD_FW_VERSION, 0x00, KISS.FEND, KISS.CMD_PLATFORM, 0x00, KISS.FEND, KISS.CMD_MCU, 0x00, KISS.FEND])