This PR includes changes that will make sure to configure the correct SPI bus whenever pi-topd detects that the OLED should be connected to another SPI bus by reading the hub registers. This is done by emitting an event whenever this happens that triggers a SPI bus configuration.
This is a workaround to make sure apps continue to work instead of breaking due to SPI device not found.
Screenshots (feature, test output, profiling, dev tools etc)
N/A
Other notes (e.g. implementation quirks, edge cases, questions / issues)
-
Manual testing tips
Install the PR artifacts in your pi-top[4].
Make sure to restart the miniscreen service, just in case: sudo systemctl restart pt-miniscreen
Change the SPI bus used by the oled by directly writing to the hub; this recreates how the 'no SPI device' issue happens:
Main changes
This PR includes changes that will make sure to configure the correct SPI bus whenever
pi-topd
detects that the OLED should be connected to another SPI bus by reading the hub registers. This is done by emitting an event whenever this happens that triggers a SPI bus configuration.This is a workaround to make sure apps continue to work instead of breaking due to
SPI device not found
.Screenshots (feature, test output, profiling, dev tools etc)
N/A
Other notes (e.g. implementation quirks, edge cases, questions / issues)
-
Manual testing tips
sudo systemctl restart pt-miniscreen
i2c_device = I2CDevice("/dev/i2c-1", 0x11) i2c_device.set_delays(0.001, 0.001) i2c_device.connect()
OLED uses SPI bus 0
i2c_device.write_byte(0x14, 0b101)
OLED uses SPI bus 1
i2c_device.write_byte(0x14, 0b1)
pi-top oled spi 0
pi-top oled spi 1