-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Hi,
The ChoiceList.choose(index) method states:
Choice index must be in [1, 6]
ragger/src/ragger/firmware/touch/layouts.py
Lines 24 to 28 in 4ceede3
| class ChoiceList(Element): | |
| def choose(self, index: int): | |
| assert 1 <= index <= 6, "Choice index must be in [1, 6]" | |
| self.client.finger_touch(*self.positions[index]) |
However, using an index of 6 i.e. ChoiceList.choose(6) gives the following error:
KeyError: 6
This error occurs because there are only 5 keys defined in the ChoiceList positions dictionary:
ragger/src/ragger/firmware/touch/positions.py
Lines 68 to 85 in 4ceede3
| "ChoiceList": { | |
| DeviceType.STAX: { | |
| # Up to 5 choices in a list | |
| 1: Position(STAX_X_CENTER, 140), | |
| 2: Position(STAX_X_CENTER, 235), | |
| 3: Position(STAX_X_CENTER, 330), | |
| 4: Position(STAX_X_CENTER, 425), | |
| 5: Position(STAX_X_CENTER, 520), | |
| }, | |
| DeviceType.FLEX: { | |
| # Up to 5 choices in a list | |
| 1: Position(FLEX_X_CENTER, 150), | |
| 2: Position(FLEX_X_CENTER, 240), | |
| 3: Position(FLEX_X_CENTER, 330), | |
| 4: Position(FLEX_X_CENTER, 420), | |
| 5: Position(FLEX_X_CENTER, 510), | |
| } | |
| }, |
An extra key should probably be added to cater for choice buttons at the very bottom of a screen e.g.:
"ChoiceList": {
DeviceType.STAX: {
# Up to 5 choices in a list
1: Position(STAX_X_CENTER, 140),
2: Position(STAX_X_CENTER, 235),
3: Position(STAX_X_CENTER, 330),
4: Position(STAX_X_CENTER, 425),
5: Position(STAX_X_CENTER, 520),
6: Position(STAX_X_CENTER, 615),
},
DeviceType.FLEX: {
# Up to 5 choices in a list
1: Position(FLEX_X_CENTER, 150),
2: Position(FLEX_X_CENTER, 240),
3: Position(FLEX_X_CENTER, 330),
4: Position(FLEX_X_CENTER, 420),
5: Position(FLEX_X_CENTER, 510),
6: Position(FLEX_X_CENTER, 600),
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels