Fix up via keymap builds. (#20383)

* Fix up via keymap builds.

- Usages of old IS_PRESSED.

* Fix up bad code.

* Fix up bad code.
This commit is contained in:
Nick Brassel 2023-04-09 22:41:32 +10:00 committed by GitHub
parent 441988ef38
commit 5d6d959421
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 73 additions and 73 deletions

View file

@ -86,13 +86,13 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
} }
void matrix_scan_user(void) { void matrix_scan_user(void) {
if (IS_PRESSED(encoder_ccw)) { if (encoder_ccw.pressed) {
encoder_ccw.pressed = false; encoder_ccw.pressed = false;
encoder_ccw.time = timer_read(); encoder_ccw.time = timer_read();
action_exec(encoder_ccw); action_exec(encoder_ccw);
} }
if (IS_PRESSED(encoder_cw)) { if (encoder_cw.pressed) {
encoder_cw.pressed = false; encoder_cw.pressed = false;
encoder_cw.time = timer_read(); encoder_cw.time = timer_read();
action_exec(encoder_cw); action_exec(encoder_cw);

View file

@ -113,30 +113,30 @@ keyevent_t encoder_right_ccw = {
keyevent_t encoder_right_cw = { keyevent_t encoder_right_cw = {
.key = (keypos_t){.row = 5, .col = 3}, .key = (keypos_t){.row = 5, .col = 3},
.pressed = false .pressed = false,
.type = KEY_EVENT .type = KEY_EVENT
}; };
void matrix_scan_user(void) { void matrix_scan_user(void) {
if (IS_PRESSED(encoder_left_ccw)) { if (encoder_left_ccw.pressed) {
encoder_left_ccw.pressed = false; encoder_left_ccw.pressed = false;
encoder_left_ccw.time = timer_read(); encoder_left_ccw.time = timer_read();
action_exec(encoder_left_ccw); action_exec(encoder_left_ccw);
} }
if (IS_PRESSED(encoder_left_cw)) { if (encoder_left_cw.pressed) {
encoder_left_cw.pressed = false; encoder_left_cw.pressed = false;
encoder_left_cw.time = timer_read(); encoder_left_cw.time = timer_read();
action_exec(encoder_left_cw); action_exec(encoder_left_cw);
} }
if (IS_PRESSED(encoder_right_ccw)) { if (encoder_right_ccw.pressed) {
encoder_right_ccw.pressed = false; encoder_right_ccw.pressed = false;
encoder_right_ccw.time = timer_read(); encoder_right_ccw.time = timer_read();
action_exec(encoder_right_ccw); action_exec(encoder_right_ccw);
} }
if (IS_PRESSED(encoder_right_cw)) { if (encoder_right_cw.pressed) {
encoder_right_cw.pressed = false; encoder_right_cw.pressed = false;
encoder_right_cw.time = timer_read(); encoder_right_cw.time = timer_read();
action_exec(encoder_right_cw); action_exec(encoder_right_cw);

View file

@ -75,25 +75,25 @@ keyevent_t encoder2_cw = {
}; };
void matrix_scan_user(void) { void matrix_scan_user(void) {
if (IS_PRESSED(encoder1_ccw)) { if (encoder1_ccw.pressed) {
encoder1_ccw.pressed = false; encoder1_ccw.pressed = false;
encoder1_ccw.time = timer_read(); encoder1_ccw.time = timer_read();
action_exec(encoder1_ccw); action_exec(encoder1_ccw);
} }
if (IS_PRESSED(encoder1_cw)) { if (encoder1_cw.pressed) {
encoder1_cw.pressed = false; encoder1_cw.pressed = false;
encoder1_cw.time = timer_read(); encoder1_cw.time = timer_read();
action_exec(encoder1_cw); action_exec(encoder1_cw);
} }
if (IS_PRESSED(encoder2_ccw)) { if (encoder2_ccw.pressed) {
encoder2_ccw.pressed = false; encoder2_ccw.pressed = false;
encoder2_ccw.time = timer_read(); encoder2_ccw.time = timer_read();
action_exec(encoder2_ccw); action_exec(encoder2_ccw);
} }
if (IS_PRESSED(encoder2_cw)) { if (encoder2_cw.pressed) {
encoder2_cw.pressed = false; encoder2_cw.pressed = false;
encoder2_cw.time = timer_read(); encoder2_cw.time = timer_read();
action_exec(encoder2_cw); action_exec(encoder2_cw);

View file

@ -67,25 +67,25 @@ keyevent_t encoder2_cw = {
}; };
void matrix_scan_user(void) { void matrix_scan_user(void) {
if (IS_PRESSED(encoder1_ccw)) { if (encoder1_ccw.pressed) {
encoder1_ccw.pressed = false; encoder1_ccw.pressed = false;
encoder1_ccw.time = timer_read(); encoder1_ccw.time = timer_read();
action_exec(encoder1_ccw); action_exec(encoder1_ccw);
} }
if (IS_PRESSED(encoder1_cw)) { if (encoder1_cw.pressed) {
encoder1_cw.pressed = false; encoder1_cw.pressed = false;
encoder1_cw.time = timer_read(); encoder1_cw.time = timer_read();
action_exec(encoder1_cw); action_exec(encoder1_cw);
} }
if (IS_PRESSED(encoder2_ccw)) { if (encoder2_ccw.pressed) {
encoder2_ccw.pressed = false; encoder2_ccw.pressed = false;
encoder2_ccw.time = timer_read(); encoder2_ccw.time = timer_read();
action_exec(encoder2_ccw); action_exec(encoder2_ccw);
} }
if (IS_PRESSED(encoder2_cw)) { if (encoder2_cw.pressed) {
encoder2_cw.pressed = false; encoder2_cw.pressed = false;
encoder2_cw.time = timer_read(); encoder2_cw.time = timer_read();
action_exec(encoder2_cw); action_exec(encoder2_cw);

View file

@ -130,49 +130,49 @@ keyevent_t encoder4_cw = {
void matrix_scan_user(void) { void matrix_scan_user(void) {
if (IS_PRESSED(encoder1_ccw)) { if (encoder1_ccw.pressed) {
encoder1_ccw.pressed = false; encoder1_ccw.pressed = false;
encoder1_ccw.time = timer_read(); encoder1_ccw.time = timer_read();
action_exec(encoder1_ccw); action_exec(encoder1_ccw);
} }
if (IS_PRESSED(encoder1_cw)) { if (encoder1_cw.pressed) {
encoder1_cw.pressed = false; encoder1_cw.pressed = false;
encoder1_cw.time = timer_read(); encoder1_cw.time = timer_read();
action_exec(encoder1_cw); action_exec(encoder1_cw);
} }
if (IS_PRESSED(encoder2_ccw)) { if (encoder2_ccw.pressed) {
encoder2_ccw.pressed = false; encoder2_ccw.pressed = false;
encoder2_ccw.time = timer_read(); encoder2_ccw.time = timer_read();
action_exec(encoder2_ccw); action_exec(encoder2_ccw);
} }
if (IS_PRESSED(encoder2_cw)) { if (encoder2_cw.pressed) {
encoder2_cw.pressed = false; encoder2_cw.pressed = false;
encoder2_cw.time = timer_read(); encoder2_cw.time = timer_read();
action_exec(encoder2_cw); action_exec(encoder2_cw);
} }
if (IS_PRESSED(encoder3_ccw)) { if (encoder3_ccw.pressed) {
encoder3_ccw.pressed = false; encoder3_ccw.pressed = false;
encoder3_ccw.time = timer_read(); encoder3_ccw.time = timer_read();
action_exec(encoder3_ccw); action_exec(encoder3_ccw);
} }
if (IS_PRESSED(encoder3_cw)) { if (encoder3_cw.pressed) {
encoder3_cw.pressed = false; encoder3_cw.pressed = false;
encoder3_cw.time = timer_read(); encoder3_cw.time = timer_read();
action_exec(encoder3_cw); action_exec(encoder3_cw);
} }
if (IS_PRESSED(encoder4_ccw)) { if (encoder4_ccw.pressed) {
encoder4_ccw.pressed = false; encoder4_ccw.pressed = false;
encoder4_ccw.time = timer_read(); encoder4_ccw.time = timer_read();
action_exec(encoder4_ccw); action_exec(encoder4_ccw);
} }
if (IS_PRESSED(encoder4_cw)) { if (encoder4_cw.pressed) {
encoder4_cw.pressed = false; encoder4_cw.pressed = false;
encoder4_cw.time = timer_read(); encoder4_cw.time = timer_read();
action_exec(encoder4_cw); action_exec(encoder4_cw);

View file

@ -65,13 +65,13 @@ keyevent_t encoder_cw = {
}; };
void matrix_scan_user(void) { void matrix_scan_user(void) {
if (IS_PRESSED(encoder_ccw)) { if (encoder_ccw.pressed) {
encoder_ccw.pressed = false; encoder_ccw.pressed = false;
encoder_ccw.time = timer_read(); encoder_ccw.time = timer_read();
action_exec(encoder_ccw); action_exec(encoder_ccw);
} }
if (IS_PRESSED(encoder_cw)) { if (encoder_cw.pressed) {
encoder_cw.pressed = false; encoder_cw.pressed = false;
encoder_cw.time = timer_read(); encoder_cw.time = timer_read();
action_exec(encoder_cw); action_exec(encoder_cw);

View file

@ -100,7 +100,7 @@ void encoder_action_register(uint8_t index, bool clockwise) {
keyevent_t encoder_event = (keyevent_t) { keyevent_t encoder_event = (keyevent_t) {
.key = clockwise ? ENC_CW : ENC_CCW, .key = clockwise ? ENC_CW : ENC_CCW,
.pressed = true, .pressed = true,
.time = timer_read() .time = timer_read(),
.type = KEY_EVENT .type = KEY_EVENT
}; };
encoder_state = (clockwise ^ 1) | (clockwise << 1); encoder_state = (clockwise ^ 1) | (clockwise << 1);

View file

@ -59,13 +59,13 @@ keyevent_t encoder_cw = {
}; };
void matrix_scan_user(void) { void matrix_scan_user(void) {
if (IS_PRESSED(encoder_ccw)) { if (encoder_ccw.pressed) {
encoder_ccw.pressed = false; encoder_ccw.pressed = false;
encoder_ccw.time = timer_read(); encoder_ccw.time = timer_read();
action_exec(encoder_ccw); action_exec(encoder_ccw);
} }
if (IS_PRESSED(encoder_cw)) { if (encoder_cw.pressed) {
encoder_cw.pressed = false; encoder_cw.pressed = false;
encoder_cw.time = timer_read(); encoder_cw.time = timer_read();
action_exec(encoder_cw); action_exec(encoder_cw);

View file

@ -65,13 +65,13 @@ keyevent_t encoder_cw = {
}; };
void matrix_scan_user(void) { void matrix_scan_user(void) {
if (IS_PRESSED(encoder_ccw)) { if (encoder_ccw.pressed) {
encoder_ccw.pressed = false; encoder_ccw.pressed = false;
encoder_ccw.time = timer_read(); encoder_ccw.time = timer_read();
action_exec(encoder_ccw); action_exec(encoder_ccw);
} }
if (IS_PRESSED(encoder_cw)) { if (encoder_cw.pressed) {
encoder_cw.pressed = false; encoder_cw.pressed = false;
encoder_cw.time = timer_read(); encoder_cw.time = timer_read();
action_exec(encoder_cw); action_exec(encoder_cw);

View file

@ -40,13 +40,13 @@ keyevent_t encoder_cw = {
}; };
void matrix_scan_user(void) { void matrix_scan_user(void) {
if (IS_PRESSED(encoder_ccw)) { if (encoder_ccw.pressed) {
encoder_ccw.pressed = false; encoder_ccw.pressed = false;
encoder_ccw.time = timer_read(); encoder_ccw.time = timer_read();
action_exec(encoder_ccw); action_exec(encoder_ccw);
} }
if (IS_PRESSED(encoder_cw)) { if (encoder_cw.pressed) {
encoder_cw.pressed = false; encoder_cw.pressed = false;
encoder_cw.time = timer_read(); encoder_cw.time = timer_read();
action_exec(encoder_cw); action_exec(encoder_cw);

View file

@ -48,13 +48,13 @@ keyevent_t encoder_cw = {
}; };
void matrix_scan_user(void) { void matrix_scan_user(void) {
if (IS_PRESSED(encoder_ccw)) { if (encoder_ccw.pressed) {
encoder_ccw.pressed = false; encoder_ccw.pressed = false;
encoder_ccw.time = timer_read(); encoder_ccw.time = timer_read();
action_exec(encoder_ccw); action_exec(encoder_ccw);
} }
if (IS_PRESSED(encoder_cw)) { if (encoder_cw.pressed) {
encoder_cw.pressed = false; encoder_cw.pressed = false;
encoder_cw.time = timer_read(); encoder_cw.time = timer_read();
action_exec(encoder_cw); action_exec(encoder_cw);

View file

@ -48,13 +48,13 @@ keyevent_t encoder1_ccw = {.key = (keypos_t){.row = 4, .col = 4}, .pressed = fal
keyevent_t encoder1_cw = {.key = (keypos_t){.row = 4, .col = 6}, .pressed = false, .type = KEY_EVENT}; keyevent_t encoder1_cw = {.key = (keypos_t){.row = 4, .col = 6}, .pressed = false, .type = KEY_EVENT};
void matrix_scan_user(void) { void matrix_scan_user(void) {
if (IS_PRESSED(encoder1_ccw)) { if (encoder1_ccw.pressed) {
encoder1_ccw.pressed = false; encoder1_ccw.pressed = false;
encoder1_ccw.time = timer_read(); encoder1_ccw.time = timer_read();
action_exec(encoder1_ccw); action_exec(encoder1_ccw);
} }
if (IS_PRESSED(encoder1_cw)) { if (encoder1_cw.pressed) {
encoder1_cw.pressed = false; encoder1_cw.pressed = false;
encoder1_cw.time = timer_read(); encoder1_cw.time = timer_read();
action_exec(encoder1_cw); action_exec(encoder1_cw);

View file

@ -205,7 +205,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
break; break;
#ifdef ZEAL_RGB #ifdef ZEAL_RGB
case BL_TOGG: case BL_TOGG:
if (IS_PRESSED(record->event)) { if (record->event.pressed) {
if (g_config.effect) { if (g_config.effect) {
last_effect = g_config.effect; last_effect = g_config.effect;
g_config.effect = 0; g_config.effect = 0;
@ -215,7 +215,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} }
return false; return false;
case EFFECT...EFFECT_END: case EFFECT...EFFECT_END:
if (IS_PRESSED(record->event)) { if (record->event.pressed) {
uint8_t effect = keycode - EFFECT; uint8_t effect = keycode - EFFECT;
if(effect == g_config.effect) if(effect == g_config.effect)
effect = 0; // Toggle effect on second press effect = 0; // Toggle effect on second press