Skip to content

Add second mock battery - #37

Open
dymk wants to merge 1 commit into
OpenDevicePartnership:mainfrom
dymk:dymk/two-mock-batteries
Open

Add second mock battery#37
dymk wants to merge 1 commit into
OpenDevicePartnership:mainfrom
dymk:dymk/two-mock-batteries

Conversation

@dymk

@dymk dymk commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • register a 3S mock fuel gauge as battery 0
  • register a distinct 2S mock fuel gauge as battery 1
  • keep both mock state machines updated independently

This fixture enables end-to-end validation of battery-ID selection through OpenDevicePartnership/odp-secure-services#88.

Validation

  • cargo fmt --check
  • cargo build --locked
  • cargo clippy --locked -- -D warnings

Register a distinct 2S fuel gauge as battery 1 so integration tests can verify that callers select a battery by ID.

Assisted-by: GitHub Copilot:gpt-5.6-sol

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a3539bc8-3a1f-44b3-ba4a-c171a7822595
Copilot AI review requested due to automatic review settings July 27, 2026 21:57
@dymk
dymk requested a review from a team as a code owner July 27, 2026 21:57

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

Extends the platform-common mock battery fixture to expose two independently-driven mock fuel gauges, enabling end-to-end validation of battery-ID selection through the battery service.

Changes:

  • Expand the mock battery registration from 1 to 2 fuel gauges (battery 0 = 3S, battery 1 = 2S).
  • Initialize and drive each mock fuel gauge independently by spawning separate update tasks.
  • Increase the Embassy task pool size to allow multiple update_data_task instances.

Comment on lines +28 to +33
for fuel_gauge in [fuel_gauge_0, fuel_gauge_1] {
bs::mock::init_state_machine(fuel_gauge)
.await
.expect("Failed to initialize battery state machine");
spawner.spawn(update_data_task(fuel_gauge).expect("Failed to spawn battery update data task"));
}
@kurtjd

kurtjd commented Jul 27, 2026

Copy link
Copy Markdown
Member

@jerrysxie Looks like CI is failing due to odp-platform-common being private now like we discussed. Might need to manually override it until that repo can be made public again.

@kurtjd

kurtjd commented Jul 27, 2026

Copy link
Copy Markdown
Member

@dymk Looks like I can merge and bypass the failed job myself, let me know when you want it merged.

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.

4 participants