In my case, the voltage variable would stay initialized as -1,
which caused the calculation of battery charge percentage to be
incorrect (I would get the message that there is no battery present
or even -0% charge).
I have no idea how this would affect other systems, since I don't
have a chance to test this.
* ampere to watt */
if (!watt_as_unit) {
present_rate = (((float)voltage / 1000.0) * ((float)present_rate / 1000.0));
- remaining = (((float)voltage / 1000.0) * ((float)remaining / 1000.0));
- full_design = (((float)voltage / 1000.0) * ((float)full_design / 1000.0));
+
+ if (voltage != -1) {
+ remaining = (((float)voltage / 1000.0) * ((float)remaining / 1000.0));
+ full_design = (((float)voltage / 1000.0) * ((float)full_design / 1000.0));
+ }
}
if ((full_design == -1) || (remaining == -1)) {