Fix swapped voltage/current in dutlink power readings#532
Conversation
The dutlink device returns meter readings as "{current}A {voltage}V {power}W"
but the code was parsing positionally with [v, a, _], assigning current to
voltage and vice versa. Parse by unit suffix instead for correctness and
robustness.
Fixes #67
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
✅ Deploy Preview for jumpstarter-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
mangelajo
left a comment
There was a problem hiding this comment.
looking at https://github.com/jumpstarter-dev/dutlink-firmware/blob/main/application/src/control.rs#L313 this seems correct
Summary
{current}A {voltage}V {power}Wbut the code was using positional destructuring[v, a, _], assigning current to voltage and vice versaV,Asuffixes) for correctness and robustness against potential ordering changesFixes #67
Test plan
make lint-fix)make pkg-test-jumpstarter-driver-power)make pkg-test-jumpstarter-driver-dutlink- skips due to no hardware)client.power.read()should now report correct voltage (~11.99V) and current (~0.98A) matching the device'smeter readoutput🤖 Generated with Claude Code