I2C bus error pytrack read_battery_voltage()
-
The pytrack regularly gives an i2c bus error when reading the battery voltage with the function "read_battery_voltage ()".
The firmware of the pytrack read out with "read_fw_version ()" returns 8The information about the version of the pyncom that I retrieve with "os.uname ()" is:
[0] LoPy4
[1] LoPy4
[2] 1.17.5.b6
[3] v1.8.6-849-56d00234 on 2018-05-18
[4] LoPy4 with ESP32
[5] 1.0.2
-
@chvl
I have the same issue with bus errors on battery read so I use a 'try' 'except' to catch the error and I limit my battery check to something reasonable - like every 10 minutes
eg:batt_check_interval = 600 # check the battery voltage every 10 minutes def readBattery(): global vBatt global last_batt_check global batt_check_interval if(utime.time() - last_batt_check > batt_check_interval): try: vBatt = pytrack.read_battery_voltage() # keep track of time since last battery check last_batt_check = utime.time() print ('Battery read: ' + str(vBatt)) if (vBatt < lowBatt): # do more here print ('Battery voltage: LOW') except Exception as e: print ('Battery read: ERROR') return return