SIGN IN SIGN UP

dotclockframebuffer: fix gpio_data range validation

The upper-bound expression used `max_bit * 8` instead of
`gpio_data_len * 8`. With `gpio_data_len = 1` (the common case),
`max_bit` is 7 and the shift becomes `(1 << 56) - 1`, which is
undefined behavior on a 32-bit `mp_int_t`. In practice the
upper bound wraps to 1, so any `gpio_data` value > 1 raises
`ValueError: gpio_data must be 0..1` even though a full byte
is legitimate.

This blocks initializing displays through
`dotclockframebuffer.ioexpander_send_init_sequence(...)` when
the init sequence contains real one-byte register writes; e.g.
the Adafruit Qualia ESP32-S3 + 4" 480x480 round TFT crashes
during display init.

The fix is to use `gpio_data_len` (which is already the field
width in bytes) directly. For `gpio_data_len = 1` this gives
the correct `(1 << 8) - 1 = 255` upper bound.
M
makermelissa-piclaw committed
074fb8824a84d6eb4be889bef5765ae0fa06f786
Parent: 6b4970b