Open LoooooKe opened 1 month ago
The BattAnalog widget shows 1% when the battery is fully charged. I narrowed it down to the following line:
https://github.com/EdgeTX/edgetx-sdcard/blob/b236171b6fae5ff247748acb303b8177c61aaba3/sdcard/c480x272/WIDGETS/BattAnalog/main.lua#L257
If the voltage is equal or even .01 above the value in voltageRange, the method returns the wrong cell count, which then leads to a wrong calculation of the cellPercentage value here:
https://github.com/EdgeTX/edgetx-sdcard/blob/b236171b6fae5ff247748acb303b8177c61aaba3/sdcard/c480x272/WIDGETS/BattAnalog/main.lua#L326
My suggestion is to round singleVoltage to one decimal and change the '<' to a '<='. This should fix the issue for all battery types.
The BattAnalog widget shows 1% when the battery is fully charged. I narrowed it down to the following line:
https://github.com/EdgeTX/edgetx-sdcard/blob/b236171b6fae5ff247748acb303b8177c61aaba3/sdcard/c480x272/WIDGETS/BattAnalog/main.lua#L257
If the voltage is equal or even .01 above the value in voltageRange, the method returns the wrong cell count, which then leads to a wrong calculation of the cellPercentage value here:
https://github.com/EdgeTX/edgetx-sdcard/blob/b236171b6fae5ff247748acb303b8177c61aaba3/sdcard/c480x272/WIDGETS/BattAnalog/main.lua#L326
My suggestion is to round singleVoltage to one decimal and change the '<' to a '<='. This should fix the issue for all battery types.