Skip to content

[Feature] Urgent Block Coding Feature. hub_menu() support, main() function name rename capability, and ability to disable run_task() #2180

@bcfletcher

Description

@bcfletcher

There does not appear to be a way in block coding to use hub_menu() which severely limits the ability to use block coding in FLL since you can't create/manipulate the hub() menu

Also, the current block coding does not let you rename the main() loop. This causes a problem when importing multiple tasks into a hub_menu program on Spike Prime. We created our hub_menu program outside of the block coding.

it appears i can use "as" in the hub_menu program:

from pybricks_class_task1_rev2 import main as pybricks_class_task1
from pybricks_class_task2_rev2 import main as pybricks_class_task2

but it would better to be able to rename the main() function and we also need a way to disable run_task(main()) otherwise the menu will automatically execute the tasks :(

however, the block coding leaves the run_task(main()) which can only be removed manually and thus breaking the the block code version.

how about the following:

Enable Menu Mode Block with one parameter which would be the name of the new "main()" for that module. it would also disable run_task(). if you add a second parameter "Enable" it would let you enable or disable run_task(). however, run_task() would use the new name for the main() routine.

there also appears to need to be an explicit way to move the hub and motor relate setup items to the menu.py otherwise you get;

OSError: [Errno 16] EBUSY: Device or resource busy

if you define your hub and motors more than once.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions