Skip to content

Commit

Permalink
leds: silent update timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
SpComb committed Jan 6, 2025
1 parent ad95dc9 commit b9ee7b6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion main/leds.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ int update_leds(struct leds_state *state, enum user_activity leds_activity)
return err;
}

user_activity(leds_activity);
if (leds_activity) {
user_activity(leds_activity);
}

if ((err = leds_tx(state->leds))) {
LOG_ERROR("leds_tx");
Expand Down
6 changes: 4 additions & 2 deletions main/leds_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ static void leds_main(void *ctx)
for(struct stats_timer_sample loop_sample;; stats_timer_stop(&stats->loop, &loop_sample)) {
EventBits_t event_bits = leds_task_wait(state);
enum user_activity update_activity = 0;
bool update_timeout = false;

loop_sample = stats_timer_start(&stats->loop);

Expand Down Expand Up @@ -144,14 +145,15 @@ static void leds_main(void *ctx)
}

if (leds_update_active(state)) {
update_activity = USER_ACTIVITY_LEDS_UPDATE_TIMEOUT;
// update without activity
update_timeout = true;

LOG_DEBUG("update timeout");

stats_counter_increment(&stats->update_timeout);
}

if (update_activity) {
if (update_activity || update_timeout) {
state->update_tick = xTaskGetTickCount();

WITH_STATS_TIMER(&stats->update) {
Expand Down
1 change: 0 additions & 1 deletion main/user.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ const char *user_activity_str(enum user_activity activity)
case USER_ACTIVITY_LEDS_ARTNET: return "LEDS_ARTNET";
case USER_ACTIVITY_LEDS_ARTNET_TIMEOUT: return "LEDS_ARTNET_TIMEOUT";
case USER_ACTIVITY_LEDS_TEST: return "LEDS_TEST";
case USER_ACTIVITY_LEDS_UPDATE_TIMEOUT: return "LEDS_UPDATE_TIMEOUT";

case USER_ACTIVITY_DMX_INPUT: return "DMX_INPUT";
case USER_ACTIVITY_DMX_OUTPUT: return "DMX_OUTPUT";
Expand Down
1 change: 0 additions & 1 deletion main/user.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ enum user_activity {
USER_ACTIVITY_LEDS_ARTNET,
USER_ACTIVITY_LEDS_ARTNET_TIMEOUT,
USER_ACTIVITY_LEDS_TEST,
USER_ACTIVITY_LEDS_UPDATE_TIMEOUT,

USER_ACTIVITY_DMX_INPUT,
USER_ACTIVITY_DMX_OUTPUT,
Expand Down

0 comments on commit b9ee7b6

Please sign in to comment.