Closed AlexKlimaj closed 6 years ago
Solved by making higher level functions with error handling.
def battery_block_read(address, register, numberofbytes): tmp = None while (tmp == None): with SMBusWrapper(1) as bus: try: tmp = bus.read_i2c_block_data(address, register, numberofbytes) if (tmp != None): return tmp; except: print("SMBUS read block error") return;
Yep, you’ll need to add error handling yourself. The philosophy is to keep the library as small as possible :)
Is there a way to gracefully handle this in a program?
This happens very rarely in my code, but when it does, it exits a long running test.