Skip to content

Conversation

@alan412
Copy link
Collaborator

@alan412 alan412 commented Oct 26, 2025

This adds a steps block to opmodes that create a steps method for an easier way for students to create their autonomous opmodes.

There are two changes I know need to be made after this PR.

  1. don't allow users to create a method named steps in an opmode
  2. change the version of the file stored so that you won't try to read this with an older one. (but no migration code is needed)

@alan412 alan412 requested a review from lizlooney October 26, 2025 00:32
Copy link
Collaborator

@lizlooney lizlooney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't done a full review yet.

Copy link
Collaborator

@lizlooney lizlooney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you pull the recent changes from main into your branch?

@alan412 alan412 requested a review from lizlooney October 30, 2025 23:24
Initialize mrcStepNames to [].
Removed "if (state && state.stepNames) {" from loadExtraState.
Add braces to if statements.
Changed python code that checks whether _initialize_steps has been set.
Added createStepsBlocks function to create the steps block for the toolbox.

In methods_category.ts:
Modified MethodsCategory.methodsFlyout to call createStepsBlocks to create the mrc_steps block for the toolbox.
Copy link
Collaborator

@lizlooney lizlooney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've addressed most of my comments in
alan412#17

alan412 and others added 2 commits October 31, 2025 13:25
Addressed most of my comments on PR 291
Added renameSteps function.

In mrc_step_container:
Added conditionShadowState, conditionTargetConnection, statementTargetConnection to StepItemMixin.

In mrc_steps:
Renamed INPUT_STEP_PREFIX to INPUT_STATEMENT_PREFIX.
Added saveConnections method to keep track of connections during mutation. (This is what blockly's controls_if block does.)
Changed compose method to reconnect connections. (This is what blockly's controls_if block does.)
Call renameSteps (from mrc_jump_to_step) when steps are renamed.
Changed updateShape_ to remove all inputs and create new ones. (This is what blockly's controls_if block does.)
@lizlooney
Copy link
Collaborator

I created alan412#18 to reconnect the blocks if they are reordered.

lizlooney and others added 5 commits November 4, 2025 19:58
@lizlooney lizlooney merged commit 2523d8a into wpilibsuite:main Nov 6, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants