Skip to content

Conversation

@dhalbert
Copy link
Collaborator

When keypad.ShiftRegisterKeys(..., key_count=some_integer, ...) had an integer argument, the argument was not correctly converted to an integer. This error was inadvertently introduced by #8143.

Testing:

import board
import keypad

keys = keypad.ShiftRegisterKeys(
    data               = board.GP0,
   clock              = board.GP1,
   latch              = board.GP2,
   key_count          = 8,
   value_when_pressed = True,
   value_to_latch     = True,
   )

The bug is that .u_int was used instead of .u_obj. When the bug is present, keys.key_count produces 17 (which is the encoded micropython representation of 8). This fix returns 8 correctly.

@dhalbert dhalbert requested review from jepler and tannewt October 15, 2024 00:48
@dhalbert dhalbert added this to the 9.2.0 milestone Oct 15, 2024
@dhalbert
Copy link
Collaborator Author

@aseanwatson, the reporter in #9718, has tested and confirms it's a fix.

Copy link

@jepler jepler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

@dhalbert dhalbert merged commit 7107369 into adafruit:main Oct 15, 2024
470 checks passed
@dhalbert dhalbert deleted the shiftregisterkeys-key_count-fix branch October 15, 2024 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

keypad.ShiftRegisterKeys has wrong key_count

2 participants