Skip to content

Commit 421140c

Browse files
Calibration: fix cancel button visibility
1 parent 7dbc813 commit 421140c

File tree

1 file changed

+9
-1
lines changed
  • internal_filesystem/builtin/apps/com.micropythonos.settings/assets

1 file changed

+9
-1
lines changed

internal_filesystem/builtin/apps/com.micropythonos.settings/assets/calibrate_imu.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,46 +143,54 @@ def update_ui_for_state(self):
143143
self.action_button_label.set_text("Check Quality")
144144
self.action_button.remove_state(lv.STATE.DISABLED)
145145
self.progress_bar.add_flag(lv.obj.FLAG.HIDDEN)
146+
self.cancel_button.remove_flag(lv.obj.FLAG.HIDDEN)
146147

147148
elif self.current_state == CalibrationState.CHECKING_QUALITY:
148149
self.status_label.set_text("Checking current calibration...")
149150
self.action_button.add_state(lv.STATE.DISABLED)
150151
self.progress_bar.remove_flag(lv.obj.FLAG.HIDDEN)
151152
self.progress_bar.set_value(20, True)
153+
self.cancel_button.remove_flag(lv.obj.FLAG.HIDDEN)
152154

153155
elif self.current_state == CalibrationState.AWAITING_CONFIRMATION:
154156
# Status will be set by quality check result
155157
self.action_button_label.set_text("Calibrate Now")
156158
self.action_button.remove_state(lv.STATE.DISABLED)
157159
self.progress_bar.set_value(30, True)
160+
self.cancel_button.remove_flag(lv.obj.FLAG.HIDDEN)
158161

159162
elif self.current_state == CalibrationState.CHECKING_STATIONARITY:
160163
self.status_label.set_text("Checking if device is stationary...")
161164
self.detail_label.set_text("Keep device still on flat surface")
162165
self.action_button.add_state(lv.STATE.DISABLED)
163166
self.progress_bar.set_value(40, True)
167+
self.cancel_button.add_flag(lv.obj.FLAG.HIDDEN)
164168

165169
elif self.current_state == CalibrationState.CALIBRATING:
166170
self.status_label.set_text("Calibrating IMU...")
167171
self.detail_label.set_text("Do not move device!\nCollecting samples...")
168172
self.action_button.add_state(lv.STATE.DISABLED)
169173
self.progress_bar.set_value(60, True)
174+
self.cancel_button.add_flag(lv.obj.FLAG.HIDDEN)
170175

171176
elif self.current_state == CalibrationState.VERIFYING:
172177
self.status_label.set_text("Verifying calibration...")
173178
self.action_button.add_state(lv.STATE.DISABLED)
174179
self.progress_bar.set_value(90, True)
180+
self.cancel_button.add_flag(lv.obj.FLAG.HIDDEN)
175181

176182
elif self.current_state == CalibrationState.COMPLETE:
177183
self.status_label.set_text("Calibration complete!")
178184
self.action_button_label.set_text("Done")
179185
self.action_button.remove_state(lv.STATE.DISABLED)
180186
self.progress_bar.set_value(100, True)
187+
self.cancel_button.add_flag(lv.obj.FLAG.HIDDEN)
181188

182189
elif self.current_state == CalibrationState.ERROR:
183190
self.action_button_label.set_text("Retry")
184191
self.action_button.remove_state(lv.STATE.DISABLED)
185192
self.progress_bar.add_flag(lv.obj.FLAG.HIDDEN)
193+
self.cancel_button.add_flag(lv.obj.FLAG.HIDDEN)
186194

187195
def action_button_clicked(self, event):
188196
"""Handle action button clicks based on current state."""
@@ -444,7 +452,7 @@ def old_calibration_thread_func_UNUSED(self):
444452
def show_calibration_complete(self, result_msg):
445453
"""Show calibration completion message."""
446454
self.status_label.set_text(result_msg)
447-
self.detail_label.set_text("Calibration saved to Settings")
455+
self.detail_label.set_text("Calibration saved to storage.")
448456
self.set_state(CalibrationState.COMPLETE)
449457

450458
def handle_calibration_error(self, error_msg):

0 commit comments

Comments
 (0)