File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 1919import questionary
2020from argcomplete .completers import FilesCompleter
2121
22+ from packaging .version import Version
2223from pybricksdev import __name__ as MODULE_NAME
2324from pybricksdev import __version__ as MODULE_VERSION
2425from pybricksdev .connections .pybricks import (
@@ -243,8 +244,9 @@ def is_pybricks_usb(dev):
243244 class ResponseOptions (IntEnum ):
244245 RECOMPILE_RUN = 0
245246 RECOMPILE_DOWNLOAD = 1
246- CHANGE_TARGET_FILE = 2
247- EXIT = 3
247+ RERUN_STORED = 2
248+ CHANGE_TARGET_FILE = 3
249+ EXIT = 4
248250
249251 async def reconnect_hub ():
250252 if not await questionary .confirm (
@@ -271,6 +273,7 @@ async def reconnect_hub():
271273 response_options = [
272274 "Recompile and Run" ,
273275 "Recompile and Download" ,
276+ "Re-run Stored Program" ,
274277 "Change Target File" ,
275278 "Exit" ,
276279 ]
@@ -311,6 +314,15 @@ async def reconnect_hub():
311314 with _get_script_path (args .file ) as script_path :
312315 await hub .download (script_path )
313316
317+ case ResponseOptions .RERUN_STORED :
318+ if hub .fw_version < Version ("v1.2.0" ):
319+ print (
320+ "Running a stored program remotely is only supported in firmware version >= v1.2.0."
321+ )
322+ else :
323+ await hub .start_user_program ()
324+ await hub ._wait_for_user_program_stop ()
325+
314326 case ResponseOptions .CHANGE_TARGET_FILE :
315327 args .file .close ()
316328 while True :
You can’t perform that action at this time.
0 commit comments