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 KC_10HR, // 10-hour timer
}; };
// Function to handle rotary encoder updates // Replace encoder update function with encoder map
bool encoder_update_user(uint8_t index, bool clockwise) { #ifdef ENCODER_MAP_ENABLE
if (clockwise) { const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
tap_code(KC_VOLU); // Rotate right: Volume up [BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
} else { [FN] = { ENCODER_CCW_CW(_______, _______) },
tap_code(KC_VOLD); // Rotate left: Volume down };
} #endif
return true;
}
/** /**
* Key processing function * 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 , _______, _______, _______ 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); result.b = start.b + (int)((float)(end.b - start.b) * progress);
return result; 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 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 * Power management function - Called when system is waking from sleep
*/ */
void suspend_wakeup_init_kb(void) { 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 // Make sure the timer pulse state is properly reflected
// This ensures the timer visuals are immediately visible // This ensures the timer visuals are immediately visible
if (is_timer_pulse_active()) { if (is_timer_pulse_active()) {
@ -81,7 +78,7 @@
/** /**
* Regular task hook to ensure timer updates even during suspend * 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 // Update work timer even during suspend
if (is_timer_pulse_active()) { if (is_timer_pulse_active()) {
update_work_timer(); 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) {}