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

cwa-convert Java - CwaBlock battery level uses signed byte #8

Closed
Woodz opened this issue Mar 24, 2015 · 1 comment
Closed

cwa-convert Java - CwaBlock battery level uses signed byte #8

Woodz opened this issue Mar 24, 2015 · 1 comment
Labels

Comments

@Woodz
Copy link

Woodz commented Mar 24, 2015

The battery level is stored as an unsigned byte in index 23 in the data packet. However, in the Java code, this is read as a signed byte before upcasting to a short (https://github.com/digitalinteraction/openmovement/blob/master/Software/AX3/cwa-convert/java/src/newcastle/cwa/CwaBlock.java#L203). Therefore for battery levels about 127 they wrap-round to -128 giving a negative battery voltage.

danielgjackson added a commit that referenced this issue Mar 24, 2015
…va#L130 is incorrect as it only copies some of the fields. The temperature, battery, light, events and number of samples are left as the default 0 value".
@danielgjackson
Copy link
Member

Thanks for the bug report -- the battery conversion has now been fixed. The Java code has not been used very heavily before, so this issue had gone unnoticed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants