Skip to content

Commit 701cc60

Browse files
committed
Fixed TMC4671 tab cal popup blocking thread
1 parent a3bc7f1 commit 701cc60

File tree

3 files changed

+21
-15
lines changed

3 files changed

+21
-15
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
### Changes this version:
2-
- Added MagnTek mode selector. Support for MT6835
2+
- Fixed TMC4671 tab calibration warning popup blocking thread causing timeouts
33

44
### Changes in v16.x:
55
- Added RMD CAN motor tab
@@ -13,4 +13,5 @@
1313
- Added expo curve tuning UI (If used with v1.16.4 FW)
1414
- Using $XDG_CONFIG_HOME/openffb on linux if no local profile file found
1515
- Improved python 3.13 compatibility
16-
- Fixed analog input range sliders not updating correctly when autotune is toggled after changing channel numbers
16+
- Fixed analog input range sliders not updating correctly when autotune is toggled after changing channel numbers
17+
- Added MagnTek mode selector. Support for MT6835

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
import canremote_ui
5959

6060
# This GUIs version
61-
VERSION = "1.16.7"
61+
VERSION = "1.16.8"
6262

6363
# Minimal supported firmware version.
6464
# Major version of firmware must match firmware. Minor versions must be higher or equal

tmc4671_ui.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,14 @@ def __init__(self, main=None, unique=0):
135135
self.pushButton_calibrate.clicked.connect(lambda : self.send_command("tmc","calibrate",self.axis))
136136
self.checkBox_fluxdissipate.stateChanged.connect(lambda x : self.send_value("tmc","fluxbrake",val=1 if x else 0,instance=self.axis))
137137

138+
# Messageboxes
139+
self.calmsg = QMessageBox()
140+
self.calmsg.setIcon(QMessageBox.Icon.Warning)
141+
self.calmsg.setWindowTitle(self.tr("Calibration required"))
142+
self.calmsg.setText(self.tr("A calibration of ADC offsets and encoder settings is required."))
143+
self.calmsg.setInformativeText(self.tr("Please set up the encoder and motor parameters correctly, apply power and start the full calibration by clicking OK or Cancel and start the calibration manually later once everything is set up.\n\nCertain ADC and encoder settings are stored in flash to accelerate the startup.\nIf a new board is used a new calibration must be done."))
144+
self.calmsg.setStandardButtons(QMessageBox.StandardButton.Ok | QMessageBox.StandardButton.Cancel)
145+
138146
# Callbacks
139147
self.register_callback("tmc","temp",self.updateTemp,self.axis,int)
140148
self.register_callback("sys","vint",self.vintCb,0,int)
@@ -444,7 +452,7 @@ def init_ui(self):
444452
try:
445453
# Fill encoder source types
446454
self.send_commands("tmc",["mtype","encsrc","tmcHwType","trqbq_mode"],self.axis,'!')
447-
self.send_commands("tmc",["tmctype","tmcHwType","iScale","calibrated","trqbq_f"],self.axis)
455+
self.send_commands("tmc",["tmctype","tmcHwType","iScale","trqbq_f"],self.axis)
448456
self.getMotor()
449457
self.getPids()
450458
if not self.init_done:
@@ -474,17 +482,14 @@ def tmcChipTypeCB(self,type : str):
474482

475483
def calibrated(self,v):
476484
v = int(v)
477-
if not v and self.isEnabled():
478-
msg = QMessageBox()
479-
msg.setIcon(QMessageBox.Icon.Warning)
480-
msg.setWindowTitle(self.tr("Calibration required"))
481-
msg.setText(self.tr("A calibration of ADC offsets and encoder settings is required."))
482-
msg.setInformativeText(self.tr("Please set up the encoder and motor parameters correctly, apply power and start the full calibration by clicking OK or Cancel and start the calibration manually later once everything is set up.\n\nCertain ADC and encoder settings are stored in flash to accelerate the startup.\nIf a new board is used a new calibration must be done."))
483-
msg.setStandardButtons(QMessageBox.StandardButton.Ok | QMessageBox.StandardButton.Cancel)
484-
ret = msg.exec()
485+
if not v and self.isEnabled() and self.comboBox_mtype.currentIndex() != 0 and self.comboBox_enc.currentIndex() != 0:
485486
# Warning displayed
486-
if ret == QMessageBox.StandardButton.Ok:
487-
self.send_command("tmc","calibrate",self.axis)
487+
def cb(ret):
488+
print(ret)
489+
if ret == QMessageBox.StandardButton.Ok:
490+
self.send_command("tmc","calibrate",self.axis)
491+
self.calmsg.finished.connect(cb)
492+
self.calmsg.open()
488493

489494

490495
def encsCb(self,encsrcs):
@@ -522,7 +527,7 @@ def f(res):
522527

523528

524529
def getMotor(self):
525-
commands=["mtype","poles","encsrc","cpr","abnindex","abnpol","combineEncoder","invertForce","fluxbrake"]
530+
commands=["mtype","poles","encsrc","cpr","abnindex","abnpol","combineEncoder","invertForce","fluxbrake","calibrated"]
526531
self.send_commands("tmc",commands,self.axis)
527532

528533

0 commit comments

Comments
 (0)