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

Fixed wrong Amperage unit (current). #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

martinge17
Copy link

According to the scooter protocol documentation provided by CamiAlfa, found in the documentation folder, the battery current is specified in Amps and should be divided by 100.

pregunta 10 cosas, mAh en la batería, porcentaje, current in A /100, voltaje de la batería, temperatura

However, you are dividing it by 10 in your code.

current: payload.pop_i16()? as f32 / 10.0,

let amperage = payload.pop_i16()? as f32 / 10.0;

This causes your test to fail, as it expects 0.01 but receives 0.1.

assert_eq!(battery.current, 0.01);

Apart from that, I want to congratulate you on the excellent work you did implementing the protocol in Rust. It is very useful.

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