fixed problem with missing port

This commit is contained in:
Valentin Sasek 2020-11-25 20:40:29 +02:00
parent aaf1fe5877
commit c01a8d597d
2 changed files with 8 additions and 4 deletions

View File

@ -62,10 +62,12 @@ class BusPyrate(Frame):
return False
def disconnect(self):
self.com.__del__()
del self.com
self.com = None
self.event_generate('<<disconnected>>',when='tail')
try:
self.com.__del__()
del self.com
self.com = None
except:
pass
def reset(self):
self.com.write('\x00'.encode())
@ -74,6 +76,7 @@ class BusPyrate(Frame):
self.com.flushInput()
def send(self,cmd,newline = '\n'):
if self.com is None: return
self.com.write((cmd+newline).encode())
def exec(self):

1
pyrateLab.settings.json Normal file
View File

@ -0,0 +1 @@
{"aux_mode": {"power": "Off", "mode": "Input", "aux_state": 0, "aux_pin": "AUX", "servo": 90, "pwm_freq": 1, "pwm_duty": 50}, "console": false, "mode_selector": {"modes": ["HiZ", "1-WIRE", "UART", "I2C", "SPI", "2WIRE", "3WIRE", "LCD"], "mode": "HiZ", "uart": [8, 0, 0, 0, 0], "spi": [2, 0, 0, 0, 0, 0], "i2c": [0], "2wire": [2, 1], "3wire": [2, 0, 1]}, "port_selector": {"port": "COM17", "autoconnect": true, "debug": true}, "data": {"puulup": {"None": 1, "Internal3V3": 2, "Internal5V": 3}, "output_format": {"Hex": 1, "Dec": 2, "Bin": 3, "Raw": 4}, "spi_speed": {"30KHz": 1, "125KHz": 2, "250KHz": 3, "1MHz": 4}, "spi_clock_polarity": {"Low": 1, "High": 2}, "spi_clock_edge": {"Idle": 1, "Active": 2}, "spi_input_phase": {"Middle": 1, "End": 2}, "cs_polarity": {"Positive": 1, "Negative": 2}, "output": {"OpenDrain": 1, "Normal": 2}, "uart_speed": {"300": 1, "1200": 2, "2400": 3, "4800": 4, "9600": 5, "19200": 6, "38400": 7, "57600": 8, "115200": 9}, "uart_protocol": {"Data_8_None": 1, "Data_8_Even": 2, "Data_8_Odd": 3, "Data_9_None": 4}, "uart_stop": {"1": 1, "2": 2}, "uart_polarity": {"Idle_1": 1, "Idle_0": 2}, "i2c_speed": {"I2C_5KHz": 1, "I2C_50KHz": 2, "I2C_100KHz": 3, "I2C_400KHz": 4}, "wire_speed": {"5KHz": 1, "50KHz": 2, "100KHz": 3, "400KHz": 4}, "aux_state": {"Output": 0, "Servo": 0, "PWM": 0, "pwm_freq": 1000}}, "recent": [], "last_dir": ""}