Looking for a guidance / comments / early review.
I added support for reading input pins via SX1509 I2C IO expander that piggy-backs on the “buttons” interface / implementation. The primary use-case is ERCF MMU unit where things are getting a bit crazy with one pre-gate sensor for each color supported, hence the need for many input pins!
I know that I2C expanders are not good for a low-latency use-cases such as endstops, but my implementation does not allow using them as endstops, only as buttons (filament sensor switch, for example).
So, I would like to know:
- Does this fit into Klipper design principles?
- Just how reasonable my implementation is? It’s basically “wait for an interrupt via GPIO pin, when received, read IO inputs via I2C register, process, rinse and repeat”, all done on Python side. No changes to MCU code.
Sample configuration:
[sx1509 expander]
i2c_address: 62
i2c_bus: i2c1a
interrupt_pin: !PB7
[filament_switch_sensor pin0]
switch_pin: ^!sx1509_expander:PIN_0
[filament_switch_sensor pin1]
switch_pin: ^!sx1509_expander:PIN_1