Skip to content

LEGO Technic Move hub - add servo/stepper support#223

Draft
vicocz wants to merge 29 commits into
defaultfrom
local/lego-technic-move-servo
Draft

LEGO Technic Move hub - add servo/stepper support#223
vicocz wants to merge 29 commits into
defaultfrom
local/lego-technic-move-servo

Conversation

@vicocz

@vicocz vicocz commented May 11, 2026

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds non-PLAYVM servo support (and introduces stepper handling) for the LEGO Technic Move Hub’s C channel by switching to absolute-position commands when the channel is configured as a servo/stepper.

Changes:

  • Allow C channel to be configured as a servo in both PLAYVM and non-PLAYVM modes, and as a stepper in non-PLAYVM mode.
  • Configure port position reporting for stepper channels during connect setup.
  • Add dedicated output send paths for servo (GotoAbsPosition) and stepper (relative target based on current position) on channel C.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

// stepper for normal mode but C channel only
ChannelOutputType.StepperMotor => !EnablePlayVmMode && channel == CHANNEL_C,

// other types (such as stepper) are not supported at all

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@copilot recheck, might be fixed

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Confirmed — the comment on line 69 now reads "other types are not supported at all" without any mention of stepper, so it correctly matches the current behavior where StepperMotor is handled explicitly above it.

Comment thread BrickController2/BrickController2/DeviceManagement/TechnicMoveDevice.cs Outdated
Comment thread BrickController2/BrickController2/DeviceManagement/TechnicMoveDevice.cs Outdated
Comment thread BrickController2/BrickController2/DeviceManagement/TechnicMoveDevice.cs Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.

Comment thread BrickController2/BrickController2/DeviceManagement/TechnicMoveDevice.cs Outdated
Comment thread BrickController2/BrickController2/DeviceManagement/TechnicMoveDevice.cs Outdated
Comment thread BrickController2/BrickController2/DeviceManagement/TechnicMoveDevice.cs Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

_outputValues.Initialize();
}
_calibratedZeroAngle = default;
_calibratedZeroAngles.AsSpan().Clear();

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@copilot recheck, might be fixed

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Not fixed — line 209 still clears _calibratedZeroAngles. The flow is: AfterConnectSetupAsync (line 64 in BluetoothDevice.cs) populates calibration → StartOutputTaskAsync (line 68) → ProcessOutputsAsyncResetOutputValues (line 89 in WirelessProtocolBasedDevice.cs) clears it at line 209 before first command. The calibration is lost before it can be used.

Comment on lines +95 to +97
// stepper channels accumulate the input value as a step coefficient
_ when channel >= CHANNEL_A && channel <= CHANNEL_C && GetOutputType(channel) == ChannelOutputType.StepperMotor
=> _outputValues.AccumulateOutput(channel, (Half)validatedValue),
/// Accumulates the value into the channel's current output.
/// Non-zero values are added; zero values are ignored (input released).
/// </summary>
public bool AccumulateOutput(int channel, TValue value)
@vicocz vicocz changed the title LEGO Technic Move hub - add servo support for C channel LEGO Technic Move hub - add servo/stepper support May 28, 2026
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.

3 participants