Skip to content

Commit 43d83ed

Browse files
committed
- Run task tab no longer automatically starts uploading framework on connecting to a board without framework installed, instead the user is prompted to load the framework using the config dialog.
- Config dialog now prompts users to disable the USB flash drive before loading the framework if they try and load the framework on a board with the flashdrive enabled. Implemented because disabling the USB flashdrive greatly reduces occurence of pyboard filesystem corruption.
1 parent be7a9e4 commit 43d83ed

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

gui/dialogs.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88

99
# Board_config_dialog -------------------------------------------------
1010

11+
flashdrive_message = (
12+
'It is recommended to disable the pyboard filesystem from acting as a '
13+
'USB flash drive before loading the framework, as this helps prevent the '
14+
'filesystem getting corrupted. Do you want to disable the flashdrive?')
15+
1116
class Board_config_dialog(QtGui.QDialog):
1217

1318
def __init__(self, parent=None):
@@ -41,6 +46,13 @@ def exec_(self, board):
4146

4247
def load_framework(self):
4348
self.accept()
49+
if self.flashdrive_enabled:
50+
reply = QtGui.QMessageBox.question(self, 'Disable flashdrive',
51+
flashdrive_message, QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
52+
if reply == QtGui.QMessageBox.Yes:
53+
self.board.disable_mass_storage()
54+
self.disconnect = True
55+
return
4456
self.board.load_framework()
4557

4658
def load_hardware_definition(self):

gui/run_experiment_tab.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ def setup_experiment(self, experiment):
119119
print_func('Connection failed.')
120120
self.abort_experiment()
121121
return
122+
if not self.boards[i].status['framework']:
123+
print_func('\nInstall pyControl framework on board before running experiment.')
124+
self.abort_experiment()
125+
return
122126
self.boards[i].subject = experiment['subjects'][setup]
123127
# Hardware test.
124128
if experiment['hardware_test'] != 'no hardware test':

gui/run_task_tab.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ def open_config_dialog(self):
228228
self.task_changed()
229229
if self.GUI_main.config_dialog.disconnect:
230230
self.disconnect()
231+
if self.connected and self.board.status['framework']:
232+
self.task_groupbox.setEnabled(True)
231233

232234
# Widget methods.
233235

@@ -243,17 +245,20 @@ def connect(self):
243245
self.board = Pycboard(port, print_func=self.print_to_log, data_logger=self.data_logger)
244246
self.connected = True
245247
self.config_button.setEnabled(True)
246-
self.task_groupbox.setEnabled(True)
247248
self.connect_button.setEnabled(True)
248249
self.connect_button.setText('Disconnect')
249250
self.status_text.setText('Connected')
251+
if self.board.status['framework']:
252+
self.task_groupbox.setEnabled(True)
253+
else:
254+
self.print_to_log(
255+
"\nLoad pyControl framework using 'Config' button.")
250256
except SerialException:
251257
self.status_text.setText('Connection failed')
252258
self.print_to_log('Connection failed.')
253259
self.connect_button.setEnabled(True)
254260
self.board_select.setEnabled(True)
255-
if self.connected and not self.board.status['framework']:
256-
self.board.load_framework()
261+
257262

258263
def disconnect(self):
259264
# Disconnect from pyboard.

0 commit comments

Comments
 (0)