Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fweo 1254 pinpad nano #832

Merged
merged 2 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib_nbgl/src/nbgl_layout_keypad_nanos.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ int nbgl_layoutUpdateKeypad(nbgl_layout_t *layout,
// if validate key is enabled and was not, select it directly
keypad->selectedKey = 11;
}
else {
// otherwise let the draw function pick a new selected
// Shuffle if selected key was not backspace or if the last pin entry has been deleted
else if ((keypad->selectedKey != 0) || (keypad->enableBackspace && !enableBackspace)) {
keypad->selectedKey = 0xFF;
}
keypad->enableValidate = enableValidate;
Expand Down
20 changes: 2 additions & 18 deletions lib_nbgl/src/nbgl_obj_keypad_nanos.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,24 +165,8 @@ static void keypadInitSelected(nbgl_keypad_t *keypad)
keypad->selectedKey = 1 + INIT_DIGIT_VALUE;
}
else {
uint8_t nbChoices = 10;
uint8_t random;
if (keypad->enableBackspace) {
nbChoices++;
}
if (keypad->enableValidate) {
nbChoices++;
}
random = cx_rng_u32_range(0, nbChoices);
if (random < 10) {
keypad->selectedKey = 1 + random;
}
else if (random == 10) {
keypad->selectedKey = 0;
}
else if (random == 11) {
keypad->selectedKey = 11;
}
// Exclude backspace and validate keys ([0,11]), shuffle only digits
keypad->selectedKey = cx_rng_u32_range(1, 11);
}
}

Expand Down
Loading