Skip to content

feat(v2): SupplyVoltageSource HAL for source-side V display#93

Merged
kawinie merged 2 commits into
mainfrom
feat/v2-supply-voltage-source
May 16, 2026
Merged

feat(v2): SupplyVoltageSource HAL for source-side V display#93
kawinie merged 2 commits into
mainfrom
feat/v2-supply-voltage-source

Conversation

@kawinie
Copy link
Copy Markdown
Collaborator

@kawinie kawinie commented May 16, 2026

Summary

Adds SupplyVoltageSource so the Normal screen shows source-side voltage when the output gate is closed. INA226 reads VBUS at the load, between the shunt and the gate, so its register doesn't track the source while the gate is open. SensorTask now polls both per tick and publishes SensorEvent { LoadReading load, SupplyReading supply }.

Details:

  • AdcSupplyVoltageSource on HW1.3+ (V_SENSE divider into ADC3).
  • Ap33772SupplyVoltageSource on earlier boards (reads the AP33772 VOLTAGE register through a new PdSinkController::read_vbus_mv()).
  • NormalView V reads from supply.mv when output is off, from load.vbus_mv when on. A always reads from load.current_ma.
  • SUPPLY_EMA_DEN = 8 and SensorTask::PERIOD_MS = 40. Supply ADC reads on the V_SENSE divider are noisier than INA226, so the supply path gets a heavier filter than load (den 4) and a slightly longer integration window.

Linked issues

Hardware tested

  • HW1_3

How tested: pio test -e native (131/131 passing). On-device verification pending.

Breaking change / migration

Details:

Notes

@kawinie kawinie force-pushed the feat/v2-supply-voltage-source branch 2 times, most recently from ba9a3b9 to c2adc53 Compare May 16, 2026 20:46
@kawinie kawinie marked this pull request as ready for review May 16, 2026 21:29
kawinie added 2 commits May 16, 2026 14:30
INA226 reads VBUS at the load, between the shunt and the output gate, so its register doesn't track the source while the gate is open. NormalView falls back to a supply-side read in that case: V_SENSE ADC divider on HW1.3+, or the AP33772 VOLTAGE register on earlier boards. With the gate enabled, V reads from the INA226 load. A always reads from the shunt.
Supply ADC reads on the V_SENSE divider are noisier than INA226. `SUPPLY_EMA_DEN` is 8 (load stays at 4) and `SensorTask::PERIOD_MS` goes from 33 to 40 ms, so the supply path gets both a heavier filter and a slightly longer integration window.
@kawinie kawinie force-pushed the feat/v2-supply-voltage-source branch from c2adc53 to 42df87a Compare May 16, 2026 21:31
@kawinie kawinie merged commit 883c10f into main May 16, 2026
1 check passed
@kawinie kawinie deleted the feat/v2-supply-voltage-source branch May 16, 2026 21:36
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