-
Notifications
You must be signed in to change notification settings - Fork 1
Description
On a Raspberry Pi running RaspiOS Bookworm (Debian 12) with sparkfun-qwiic-serlcd installed, many functions documented to return bool are returning None.
setCursor() returns None, as do writeChar(), setFastBacklight(), disableSystemMessages(), setContrast(), and clearScreen(). The issue ultimately lies with the calls to self._i2c.writeByte() within qwiic_serlcd.py. It doesn't seem as if the available Python I2C drivers will return bool from writeByte() yet qwiic_serlcd.py appears to have been written as if they do this.
Incidentally, print() always returns True because its call to self._i2c.writeCommand() in qwiic_serlcd.py compares the None from writeCommand() to False and returns True by default. So it has the same root cause bug, but the surface manifestation is different.
The demo code appears to have been written with the understanding that these functions won't return bool as well - they just make the calls and hope they were successful.
At the very least, code function and documentation should match. It'd be ideal if we actually could get a bool back from these functions to know if the operation completed successfully. Maybe we could all avoid all these sleep() commands to reduce the number of OSError exceptions thrown by the library because we can't tell if the device is ready for the next command.