Skip to content

Commit

Permalink
Catch runtime error on deleted callback
Browse files Browse the repository at this point in the history
  • Loading branch information
Ultrawipf committed Apr 7, 2023
1 parent 822c71b commit 6864fa1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions encoderconf_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def initUI(self):
layout.setContentsMargins(0,0,0,0)

self.spinBox_cs = QSpinBox()
self.spinBox_cs.setRange(1,3)
self.spinBox_cs.setRange(1,3)
self.spinBox_bits = QSpinBox()
self.spinBox_bits.setRange(1,32)
layout.addWidget(QLabel("SPI3 extension port"))
Expand All @@ -172,7 +172,7 @@ def initUI(self):
layout.setContentsMargins(0,0,0,0)

self.spinBox_cs = QSpinBox()
self.spinBox_cs.setRange(1,3)
self.spinBox_cs.setRange(1,3)
self.spinBox_bits = QSpinBox()
self.spinBox_bits.setRange(1,32)
self.comboBox_mode = QComboBox()
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
import simplemotion_ui

# This GUIs version
VERSION = "1.13.1"
VERSION = "1.13.2"

# Minimal supported firmware version.
# Major version of firmware must match firmware. Minor versions must be higher or equal
Expand Down
8 changes: 7 additions & 1 deletion serial_comms.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,13 @@ def processMatchedReply(self,match):
continue
if(callbackObject["convert"]):
reply = callbackObject["convert"](reply)
callbackObject["callback"](reply)
try:
callbackObject["callback"](reply)

except RuntimeError as e:
self.logger.error("Error calling object: " + str(e))
callbackObject["delete"] = True # force delete

if callbackObject["delete"]: # delete if flag is set
#print("Deleting",callbackObject)
SerialComms.callbackDict[cls].remove(callbackObject)
Expand Down

0 comments on commit 6864fa1

Please sign in to comment.