From b88efa604c475e69ea0b11bbb29a64b00a44236d Mon Sep 17 00:00:00 2001 From: Christoffer Martinsson Date: Fri, 2 Jun 2023 20:11:36 +0200 Subject: [PATCH] Code cleanup --- firmware/src/main.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/firmware/src/main.cpp b/firmware/src/main.cpp index 0fef638..fbe54f7 100755 --- a/firmware/src/main.cpp +++ b/firmware/src/main.cpp @@ -219,19 +219,21 @@ void process_data() int fn_mode = 0; for (int i = 0; i < LIST_MAX; i++) { - if (kp_keypad.key[i].kstate == PRESSED || kp_keypad.key[i].kstate == HOLD) + if (kp_keypad.key[i].kstate != PRESSED && kp_keypad.key[i].kstate != HOLD) { - for (int j = 0; j < NBR_OF_BUTTONS; j++) + continue; + } + + for (int j = 0; j < NBR_OF_BUTTONS; j++) + { + if (buttons[j].keypad_kchar == kp_keypad.key[i].kchar && buttons[j].keycode == KEY_FN1) { - if (buttons[j].keypad_kchar == kp_keypad.key[i].kchar && buttons[j].keycode == KEY_FN1) + /* Check if FN1 key are defined to this button (Layer 0 and first position in combo array)*/ + if (buttons[j].keycode == KEY_FN1) { - /* Check if FN1 key are defined to this button (Layer 0 and first position in combo array)*/ - if (buttons[j].keycode == KEY_FN1) - { - fn_mode++; - } - break; + fn_mode++; } + break; } } }