Skip to content

Commit

Permalink
cleanup variables
Browse files Browse the repository at this point in the history
  • Loading branch information
angweekiat committed Sep 8, 2024
1 parent 63b989c commit 273ad05
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions app/src/activity.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ static uint32_t activity_last_uptime;
#if IS_ENABLED(CONFIG_ZMK_SPLIT_SYNC_LAST_ACTIVITY_TIMING) && \
IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
static uint32_t last_periodic_sync_time;
#if ZMK_SPLIT_SYNC_KEY_PRESS_INTERVAL_MS > 0
#if CONFIG_ZMK_SPLIT_SYNC_EVENT_MIN_INTERVAL_MS > 0
static uint32_t last_event_sync_time;
#endif // ZMK_SPLIT_SYNC_KEY_PRESS_INTERVAL_MS > 0
#endif // CONFIG_ZMK_SPLIT_SYNC_EVENT_MIN_INTERVAL_MS > 0
#endif // IS_ENABLED(CONFIG_ZMK_SPLIT_SYNC_LAST_ACTIVITY_TIMING) &&
// IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL)

Expand Down Expand Up @@ -76,21 +76,21 @@ int activity_event_listener(const zmk_event_t *eh) {
activity_last_uptime = k_uptime_get();

#if IS_ENABLED(CONFIG_ZMK_SPLIT_SYNC_LAST_ACTIVITY_TIMING) && \
IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL) && ZMK_SPLIT_SYNC_KEY_PRESS_INTERVAL_MS > 0
if (current - last_event_sync_time > ZMK_SPLIT_SYNC_EVENT_MIN_INTERVAL_MS) {
last_event_sync_time = current;
IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL) && CONFIG_ZMK_SPLIT_SYNC_EVENT_MIN_INTERVAL_MS > 0
if (activity_last_uptime - last_event_sync_time > CONFIG_ZMK_SPLIT_SYNC_EVENT_MIN_INTERVAL_MS) {
last_event_sync_time = activity_last_uptime;
zmk_split_bt_queue_sync_activity(0);
}
#endif // IS_ENABLED(CONFIG_ZMK_SPLIT_SYNC_LAST_ACTIVITY_TIMING) &&
// IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL) && ZMK_SPLIT_SYNC_KEY_PRESS_INTERVAL_MS > 0
// IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL) && CONFIG_ZMK_SPLIT_SYNC_EVENT_MIN_INTERVAL_MS >
// 0

return set_state(ZMK_ACTIVITY_ACTIVE);
}

void activity_work_handler(struct k_work *work) {
int32_t current = k_uptime_get();
int32_t inactive_time = current - activity_last_uptime;

#if IS_ENABLED(CONFIG_ZMK_SLEEP)
if (inactive_time > MAX_SLEEP_MS && !is_usb_power_present()) {
// Put devices in suspend power mode before sleeping
Expand Down
2 changes: 1 addition & 1 deletion app/src/split/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ config ZMK_SPLIT_SYNC_PERIODIC_INTERVAL_MS
default 30000

config ZMK_SPLIT_SYNC_EVENT_MIN_INTERVAL_MS
int "Last activity time sync interval in milliseconds"
int "Sync timings on events (key/sensors presses) as well, 0 to disable. Represents minimum interval in milliseconds"
default 0

#ZMK_SPLIT_ROLE_CENTRAL && ZMK_SPLIT_SYNC_LAST_ACTIVITY_TIMING
Expand Down

0 comments on commit 273ad05

Please sign in to comment.