Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OBO Betterman Ion #8321

Merged
merged 8 commits into from
Jun 6, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
wip
  • Loading branch information
andig committed Jun 5, 2023
commit 9d5242a9818404631c369a810dd06565f90091aa
8 changes: 5 additions & 3 deletions charger/obo.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,13 @@ func (wb *Obo) Status() (api.ChargeStatus, error) {
return api.StatusNone, err
}

switch i := b[1]; i {
switch u := binary.BigEndian.Uint16(b); u {
case 0, 1, 2:
return api.ChargeStatusString(string('A' + rune(i)))
// A..C
return api.ChargeStatus(string('A' + rune(u))), nil
default:
return api.StatusNone, fmt.Errorf("invalid status: %d", i)
// D, F
return api.StatusNone, fmt.Errorf("invalid status: %d", u)
}
}

Expand Down