PiSupply / PiJuice

Resources for PiJuice HAT for Raspberry Pi - use your Pi Anywhere
https://www.pi-supply.com/product/pijuice-standard/
GNU General Public License v3.0
433 stars 102 forks source link

Incorrect temperature reading using fimware 1.5+ #1033

Open MediaMeasure opened 7 months ago

MediaMeasure commented 7 months ago

Good Day,

I have a custom battery pack with a 10k NTC. I've setup a custom profile etc that wall works well on Firmware V 1.4. However when trying firmware 1.5 or 1.6 the pijuice_cli status screen shows temperature levels in the 60k range.

my custom battery profile NTC resistance is set at 10000.

only changing the firmware causes this issue, downgrading and temperature works again.

tvoverbeek commented 7 months ago

You are using an older version of pijuice_cli (package version < 1.7). Uodate the pijuice-base and pijuice-gui packages to 1.8. From the 1.7 changelog for pijuice.py: - Fixed Bad signed conversion in function GetBatteryTemperature. Any temperature > 32.767 will be wrong (temp is 16-bit signed /1000 before 1.7) See lines 264-265 in https://github.com/PiSupply/PiJuice/blob/master/Software/Source/pijuice.py which were added in 1.7 See also https://github.com/PiSupply/PiJuice/blob/master/Software/Source/debian-base/changelog

PS Do you have the correct NTC B constant for your battery?