pi-top / pi-topd

pi-top System Daemon (formerly pt-device-manager)
6 stars 4 forks source link

Configure SPI bus when a change is detected #152

Closed jcapona closed 2 years ago

jcapona commented 2 years ago
Status Ticket/Issue
Ready Ticket

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

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)

If everything works OK, the miniscreen app should flicker but continue to work okay.
- Change the SPI bus again with:

OLED uses SPI bus 1

i2c_device.write_byte(0x14, 0b1)

The miniscreen app should flicker and continue to work.
- Also, make sure the CLI to change the SPI bus continues to work:

pi-top oled spi 0

and

pi-top oled spi 1



#### Tag anyone who definitely needs to review or help
-