- char zero = '\0';
- /* We don't check for failure (full queue) here because there's not much to be
- * done about it. */
- queue_try_add(&queue, &zero);
+ static uint64_t last_button_press_time = 0;
+ uint32_t now = time_s();
+ uint32_t time_since_last_press = now - last_button_press_time;
+ if (time_since_last_press >= config_minimum_seconds_between_button_presses) {
+ last_button_press_time = now;
+ event_t e;
+ e.type = BUTTONPRESS;
+ e.buttonpress.timestamp = now;
+ /* We don't check for failure (full queue) here because there's not much to
+ * be done about it. */
+ queue_try_add(&queue, &e);
+ }