Repository navigation
Conversation
`shape_num = 2` is an assignment, not a comparison. Every rotation during a shape rewrites shape_num to 2, so the routine turns into a triangle at its first corner. examples/path shapes/square/square.ino reproduces it unmodified. The MicroLink app is unaffected: it leaves _manual_mode at 0, so || short -circuits before the assignment runs. Sketches hit it because DriveSquare(), DriveInfinity() and Rotate() all set _manual_mode = 1. `==` is not the fix. The condition is always true today and the body has to run: DriveHandler mirrors leg angles, and rotation targets use the same frame, so skipping the transform leaves corners 180 degrees out. Dropping the always-true condition keeps behaviour identical.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
shape_num = 2inRotateHandleris an assignment, not a comparison. Every rotation during a shape rewritesshape_numto 2, so the routine turns into a triangle at its first corner.Reproduce with
examples/path shapes/square/square.inounmodified — the robot drives a triangle instead of a square.The MicroLink app is unaffected: it drives through
rx_joystick_x/y, leaving_manual_modeat 0, so||short-circuits before the assignment runs. Sketches hit it becauseDriveSquare(),DriveInfinity()andRotate()all set_manual_mode = 1. Triangle escapes only because it is already shape 2.==is not the fix. The condition is always true today and the body has to run —DriveHandlermirrors leg angles witha < 180 ? 180-a : (360-a)+180, and rotation targets are in that same frame:Each rotation lands on the next leg's heading. With
==, manual-mode squares would skip the transform and two of four corners would be 180° out. Dropping the always-true condition keeps behaviour identical and removes only the stray write.