findLed: If key coordinates are used, don't search the keymap

If we have key coordinates set, we don't need to search the keymap, we can just
use the coordinates as-is.

Fixes #10.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/365/head
Gergely Nagy 6 years ago
parent 66112d4700
commit 5c086122b8

@ -36,16 +36,19 @@ BootGreetingEffect::BootGreetingEffect(byte pos_row, byte pos_col) {
}
void BootGreetingEffect::findLed(void) {
if (key_col != 255 && key_row != 255) {
row_ = key_row;
col_ = key_col;
done_ = true;
return;
}
// Find the LED key.
for (uint8_t r = 0; r < ROWS; r++) {
for (uint8_t c = 0; c < COLS; c++) {
Key k = Layer.lookupOnActiveLayer(r, c);
if (
//If key row and col explicitly set, ignore the search key
(k.raw == search_key.raw && key_row == 255 && key_row == 255)
|| (key_row != 255 && key_col != 255 && key_row == r && key_col == c)
) {
if (k.raw == search_key.raw) {
row_ = r;
col_ = c;
return;

Loading…
Cancel
Save