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
@ -169,4 +167,5 @@
KC_1HR , _______, KC_30MIN, KC_NO , KC_NO , RGB_HUI, 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

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

View File

@ -390,4 +390,4 @@ void handle_work_timer(void) {
*/
void work_timer_task(void) {
update_work_timer();
}
}

View File

@ -86,4 +86,4 @@ void toggle_work_timer(void);
void work_timer_task(void);
// Functions for checking timer states
bool is_timer_pulse_active(void);
bool is_timer_pulse_active(void);

View File

@ -1 +1,5 @@
SRC += rgb_effects/rgb_effects.c rgb_effects/work_timer.c
# 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,15 +78,11 @@
/**
* 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();
handle_work_timer();
}
}
// 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) {}