Skip to content

feat: automatically stop all motors when a breakpoint is triggered#22

Merged
lewisfm merged 19 commits into
vexide:mainfrom
speedskater1610:main
Jul 21, 2026
Merged

feat: automatically stop all motors when a breakpoint is triggered#22
lewisfm merged 19 commits into
vexide:mainfrom
speedskater1610:main

Conversation

@speedskater1610

Copy link
Copy Markdown
Contributor

Summary

Adds a configurable feature that stops all connected Smart Motors (11W and 5,5W) when a breakpoint fires, before the GDB console loop even begins. This prevents a robot from driving away, and all motion in general.

Motivation

I want to learn the codebase, and I generally do that well by adding something to it.

API changed

// sets the default at construction time (persists) :
v5gdb::install(
    V5Debugger::new(StdioTransport)
        .with_motor_stop(true),
);

// Or leave it off (the default) and toggle it live from gdb :
// (gdb) monitor stop_motors on
// (gdb) monitor stop_motors off
// (gdb) monitor stop_motors                 # prints current state
// (gdb) monitor stop                        # one-shot manual stop, always available

Behaviour notes

  • Default is false; meaning no change in behaviour for existing users.
  • Live toggle - monitor stop_motors on/off takes effect on the very next breakpoint without having to restarting the program.
  • Single step is unaffected - the auto-stop only fires on the initial breakpoint entry (show_debug_console path), not on each single step instruction. Calling stop_all_motors() on every single instruction would make stepping unusably slow and would clear motor state the user may be observing.

Testing

I tested on a physical brain didn't really see how testing with Qemu would help

Comment thread src/motors.rs Outdated
Comment thread examples/motor-stop.rs Outdated
Comment thread src/debugger/mod.rs Outdated
Comment thread src/gdb_target/monitor.rs Outdated

@lewisfm lewisfm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The overall logic seems good, I just have a few code quality concerns to point out.

@speedskater1610

Copy link
Copy Markdown
Contributor Author

Okay thanks because it is kinda late I will get to them tommarow.

@lewisfm lewisfm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A few small things mainly about the way you have docs set up, the core functionality looks good. Make sure to run rustfmt

Comment thread src/debugger/mod.rs Outdated
Comment thread src/debugger/mod.rs Outdated
Comment thread src/debugger/mod.rs Outdated
Comment thread src/debugger/mod.rs Outdated
Comment thread src/debugger/mod.rs Outdated
Comment thread src/gdb_target/monitor.rs Outdated
Comment thread src/sdk/mod.rs Outdated
@speedskater1610

Copy link
Copy Markdown
Contributor Author

@lewisfm Sorry I got really caught up in some personal things but I will try to fix this by the end of the week since it has been a long time since I opened the pr.

@speedskater1610

Copy link
Copy Markdown
Contributor Author

@lewisfm could you run CI then I can fix merge conflicts and should be ready to go.

@lewisfm

lewisfm commented Jul 18, 2026

Copy link
Copy Markdown
Member

@lewisfm could you run CI then I can fix merge conflicts and should be ready to go.

It won't let me run CI until merge conflicts are fixed (https://github.com/orgs/community/discussions/11265), you should just be able to run them yourself:

cargo clippy --target armv7a-vex-v5 --all-targets
cargo fmt --all --check

@speedskater1610

Copy link
Copy Markdown
Contributor Author

I will get to it in the morning to tired for this right now

@speedskater1610

Copy link
Copy Markdown
Contributor Author

@lewisfm Should be good to go now

@lewisfm

lewisfm commented Jul 18, 2026

Copy link
Copy Markdown
Member

Looks like the build is failing, I think the merge messed up the pr

@speedskater1610

Copy link
Copy Markdown
Contributor Author

@lewisfm Okay everything builds and rustfmt works now.

@speedskater1610

Copy link
Copy Markdown
Contributor Author

@lewisfm Everything SHOULD pass now I wasnt checking lint and rustfmt the same way ci is

@lewisfm
lewisfm merged commit 0cd5149 into vexide:main Jul 21, 2026
3 checks 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