feat(v2): SupplyVoltageSource HAL for source-side V display#93
Merged
Conversation
ba9a3b9 to
c2adc53
Compare
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.
c2adc53 to
42df87a
Compare
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.
Summary
Adds
SupplyVoltageSourceso 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.SensorTasknow polls both per tick and publishesSensorEvent { LoadReading load, SupplyReading supply }.Details:
AdcSupplyVoltageSourceon HW1.3+ (V_SENSE divider into ADC3).Ap33772SupplyVoltageSourceon earlier boards (reads the AP33772 VOLTAGE register through a newPdSinkController::read_vbus_mv()).NormalViewV reads fromsupply.mvwhen output is off, fromload.vbus_mvwhen on. A always reads fromload.current_ma.SUPPLY_EMA_DEN = 8andSensorTask::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
How tested:
pio test -e native(131/131 passing). On-device verification pending.Breaking change / migration
Details:
Notes