Skip to content

fix(throttle): avoid duplicate cruise command - #123

Merged
zjwhitehead merged 1 commit into
masterfrom
perf/remove-duplicate-cruise-command
Aug 24, 2026
Merged

fix(throttle): avoid duplicate cruise command#123
zjwhitehead merged 1 commit into
masterfrom
perf/remove-duplicate-cruise-command

Conversation

@zjwhitehead

Copy link
Copy Markdown
Member

Summary

  • remove the duplicate ESC throttle request emitted during every ARMED_CRUISING control iteration
  • keep cruise handling focused on override/disengagement state changes
  • retain the common, relay-aware ESC send path as the sole command publisher

Why

Cruise mode currently queues the same throttle command once inside handleCruisingThrottle() and again through handleThrottle()'s common send path. This doubles cruise-mode CAN command and response work inside the 50 Hz control task without changing the requested throttle.

Validation

  • pio test -e native-test: 60 passed
  • ./test/test_screenshots/build_and_run.sh: 34 passed
  • pio run -e OpenPPG-CESP32S3-CAN-SP140: successful target build

@zjwhitehead zjwhitehead left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

LGTM. Cruise now publishes only through the shared relay-aware setESCThrottle path. Override behavior is unchanged.

(Could not formally approve: GitHub blocks self-approval on your own PR.)

@zjwhitehead

Copy link
Copy Markdown
Member Author

Hardware-in-loop validation (M5Stack StampS3 over USB, no ESC/BMS connected): instrumented baseline produced 251 cruise control cycles and 502 high-level throttle commands in a full 5.0 s safe dry-cruise window. This PR produced 251 cycles and 251 commands. Control cadence remained 50 Hz, free heap was unchanged at 100,892 bytes, LVGL redraw traffic completed with 0 skipped flushes, and the controller restored to DISARMED after the 10 s probe. ESC transmission was explicitly suppressed at setESCThrottle for the probe. This confirms the duplicate-command hypothesis and the intended 50% reduction in cruise command work on real hardware.

@zjwhitehead
zjwhitehead merged commit 6023a87 into master Aug 24, 2026
10 checks passed
@zjwhitehead
zjwhitehead deleted the perf/remove-duplicate-cruise-command branch August 24, 2026 01:53
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.

1 participant