Skip to content

Commit

Permalink
Remove flash actions from RGB
Browse files Browse the repository at this point in the history
  • Loading branch information
ReFil committed Jan 11, 2025
1 parent 7d8f2e2 commit 0e56ea9
Showing 1 changed file with 0 additions and 45 deletions.
45 changes: 0 additions & 45 deletions app/src/rgb_underglow.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <zephyr/device.h>
#include <zephyr/init.h>
#include <zephyr/kernel.h>
#include <zephyr/settings/settings.h>

#include <math.h>
#include <stdlib.h>
Expand Down Expand Up @@ -453,47 +452,8 @@ static void zmk_rgb_underglow_tick_handler(struct k_timer *timer) {

K_TIMER_DEFINE(underglow_tick, zmk_rgb_underglow_tick_handler, NULL);

#if IS_ENABLED(CONFIG_SETTINGS)
static int rgb_settings_set(const char *name, size_t len, settings_read_cb read_cb, void *cb_arg) {
const char *next;
int rc;

if (settings_name_steq(name, "state", &next) && !next) {
if (len != sizeof(state)) {
return -EINVAL;
}

rc = read_cb(cb_arg, &state, sizeof(state));
if (rc >= 0) {
if (state.on) {
k_timer_start(&underglow_tick, K_NO_WAIT, K_MSEC(50));
}

return 0;
}

return rc;
}

return -ENOENT;
}

SETTINGS_STATIC_HANDLER_DEFINE(rgb_underglow, "rgb/underglow", NULL, rgb_settings_set, NULL, NULL);

static void zmk_rgb_underglow_save_state_work(struct k_work *_work) {
settings_save_one("rgb/underglow/state", &state, sizeof(state));
}

static struct k_work_delayable underglow_save_work;
#endif

int zmk_rgb_underglow_save_state(void) {
#if IS_ENABLED(CONFIG_SETTINGS)
int ret = k_work_reschedule(&underglow_save_work, K_MSEC(CONFIG_ZMK_SETTINGS_SAVE_DEBOUNCE));
return MIN(ret, 0);
#else
return 0;
#endif
}

static int zmk_rgb_underglow_init(void) {
Expand All @@ -506,11 +466,6 @@ static int zmk_rgb_underglow_init(void) {
}
#endif

#if IS_ENABLED(CONFIG_SETTINGS)

k_work_init_delayable(&underglow_save_work, zmk_rgb_underglow_save_state_work);
#endif

state = (struct rgb_underglow_state){
color : {
h : CONFIG_ZMK_RGB_UNDERGLOW_HUE_START,
Expand Down

0 comments on commit 0e56ea9

Please sign in to comment.