Skip to content

Fix ActiveMotor not moving on Build HAT#2556

Open
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-active-motor-buildhat-issue
Open

Fix ActiveMotor not moving on Build HAT#2556
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-active-motor-buildhat-issue

Conversation

Copilot AI commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

ActiveMotor operations (MoveForSeconds, MoveToPosition, MoveForDegrees, MoveToAbsolutePosition, SetMotorPower) silently failed on a Raspberry Pi Build HAT — the firmware returned Error and the motor never moved, despite no exception being thrown.

The attached log showed the firmware rejecting the motor command:

SND:port 0 ; pid 0 0 0 s1 1 0 0.003 0.01 0 100; set pulse 50 0.0 5 0
RCV:Error

The pid command strings were missing the trailing integral windup-limit argument that current Build HAT firmware requires. The reference python-build-hat library always sends it.

Changes

  • Brick.cs — appended the missing 0.01 parameter to all five pid commands:
    • pulse / free-run: pid <port> 0 0 s1 1 0 0.003 0.01 0 100... 0 100 0.01
    • positional ramp: pid <port> 0 1 s4 0.0027777778 0 5 0 .1 3... .1 3 0.01

This brings the emitted serial commands in line with python-build-hat and the firmware's expected argument count.

Copilot AI linked an issue Jun 2, 2026 that may be closed by this pull request
@dotnet-policy-service dotnet-policy-service Bot added the area-device-bindings Device Bindings for audio, sensor, motor, and display hardware that can used with System.Device.Gpio label Jun 2, 2026
Copilot AI changed the title [WIP] Fix ActiveMotor functionality on BuildHat Fix ActiveMotor not moving on Build HAT Jun 2, 2026
Copilot AI requested a review from raffaeler June 2, 2026 15:58
@pgrawehr pgrawehr marked this pull request as ready for review June 6, 2026 15:34
@pgrawehr

pgrawehr commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

@copilot Can you check whether this was caused by a firmware update? Do we need to add a check for a particular firmware version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-device-bindings Device Bindings for audio, sensor, motor, and display hardware that can used with System.Device.Gpio

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ActiveMotor doesn't work on BuildHat

3 participants