Refactor encoder update handling and improve work timer functionality. Update rules.mk for encoder map enablement and clean up unused code.

This commit is contained in:
TS Design Works 2025-05-18 07:38:10 -04:00
parent 7f49c0408f
commit 1653d6966d
6 changed files with 20 additions and 23 deletions

View File

@ -38,15 +38,13 @@
KC_10HR, // 10-hour timer
};
// Function to handle rotary encoder updates
bool encoder_update_user(uint8_t index, bool clockwise) {
if (clockwise) {
tap_code(KC_VOLU); // Rotate right: Volume up
} else {
tap_code(KC_VOLD); // Rotate left: Volume down
}
return true;
}
// Replace encoder update function with encoder map
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
[BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[FN] = { ENCODER_CCW_CW(_______, _______) },
};
#endif
/**
* Key processing function
@ -170,3 +168,4 @@
KC_NO , _______, _______, _______, RGB_RMOD, RGB_HUD, RGB_MOD, KC_NO , _______, _______, KC_NO , KC_NO , KC_NO , KC_WRKPAU, KC_NO , KC_NO , _______, KC_NO , _______, _______, _______
),
};

View File

@ -82,3 +82,4 @@
result.b = start.b + (int)((float)(end.b - start.b) * progress);
return result;
}

View File

@ -1 +1,5 @@
# This is the rules.mk file for the RGB Effects firmware.
SRC += rgb_effects/rgb_effects.c rgb_effects/work_timer.c
# Enable encoder map functionality
ENCODER_MAP_ENABLE = yes

View File

@ -62,9 +62,6 @@
* Power management function - Called when system is waking from sleep
*/
void suspend_wakeup_init_kb(void) {
// Re-enable RGB effects when computer wakes up
rgb_matrix_set_suspend_state(false);
// Make sure the timer pulse state is properly reflected
// This ensures the timer visuals are immediately visible
if (is_timer_pulse_active()) {
@ -81,7 +78,7 @@
/**
* Regular task hook to ensure timer updates even during suspend
*/
void housekeeping_task_user(void) {
void housekeeping_task_kb(void) {
// Update work timer even during suspend
if (is_timer_pulse_active()) {
update_work_timer();
@ -89,7 +86,3 @@
}
}
// Default implementations for weak functions
__attribute__((weak)) void keyboard_post_init_user(void) {}
__attribute__((weak)) void suspend_power_down_user(void) {}
__attribute__((weak)) void suspend_wakeup_init_user(void) {}