Code cleanup

This commit is contained in:
Christoffer Martinsson 2022-10-17 23:10:16 +02:00
parent 8666c30a52
commit b576b234f1

View File

@ -420,10 +420,12 @@ void scan_buttons()
{ {
if (buttons[j].keypad_kchar == kp_keypad.key[i].kchar) if (buttons[j].keypad_kchar == kp_keypad.key[i].kchar)
{ {
/* Check if FN1 key are defined to this button (Layer 0 and first position in combo array)*/
if ((buttons[j].keycode == KEY_FN1 || (buttons[j].keycode == KEY_COMBO && buttons[j].combo_keycode[0] == KEY_FN1)) && buttons[j].tap_state != 3) if ((buttons[j].keycode == KEY_FN1 || (buttons[j].keycode == KEY_COMBO && buttons[j].combo_keycode[0] == KEY_FN1)) && buttons[j].tap_state != 3)
{ {
fn_mode = 1; fn_mode = 1;
} }
/* Check if FN2 key are defined to this button (Layer 0 and first position in combo array)*/
else if ((buttons[j].keycode == KEY_FN2 || (buttons[j].keycode == KEY_COMBO && buttons[j].combo_keycode[0] == KEY_FN2)) && buttons[j].tap_state != 3) else if ((buttons[j].keycode == KEY_FN2 || (buttons[j].keycode == KEY_COMBO && buttons[j].combo_keycode[0] == KEY_FN2)) && buttons[j].tap_state != 3)
{ {
fn_mode = 2; fn_mode = 2;
@ -689,7 +691,6 @@ void setup()
/* Init HW */ /* Init HW */
pinMode(STATUS_LED, OUTPUT); pinMode(STATUS_LED, OUTPUT);
digitalWrite(STATUS_LED, LOW); digitalWrite(STATUS_LED, LOW);
Mouse.begin();
} }
void loop() void loop()
@ -697,10 +698,10 @@ void loop()
/* Update current time (ms) */ /* Update current time (ms) */
current_timestamp = millis(); current_timestamp = millis();
/* Scan buttons 5ms */ /* Scan buttons 1ms */
if (current_timestamp >= button_timestamp) if (current_timestamp >= button_timestamp)
{ {
button_timestamp = current_timestamp + 5; button_timestamp = current_timestamp + 1;
scan_buttons(); scan_buttons();
} }