Skip to content

Commit

Permalink
Storage: #ifdefs needed, IS_ENABLED(...) does not work at compile time (
Browse files Browse the repository at this point in the history
#44)

#ifdefs needed because linker links files which are not compiled when CONFIG_THINGSET_STORAGE_AUTOSAVE=n
  • Loading branch information
xsider authored May 2, 2024
1 parent 97c5750 commit c1040ed
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/storage_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ static void thingset_storage_save_handler(struct k_work *work)
LOG_WRN("Data not stored because previous load failed.");
}

if (IS_ENABLED(CONFIG_THINGSET_STORAGE_AUTOSAVE)) {
thingset_sdk_reschedule_work(dwork, K_HOURS(CONFIG_THINGSET_STORAGE_AUTOSAVE_INTERVAL));
}
#ifdef CONFIG_THINGSET_STORAGE_AUTOSAVE
thingset_sdk_reschedule_work(dwork, K_HOURS(CONFIG_THINGSET_STORAGE_AUTOSAVE_INTERVAL));
#endif
}

static int thingset_storage_init(void)
Expand All @@ -72,10 +72,9 @@ static int thingset_storage_init(void)
thingset_set_update_callback(&ts, TS_SUBSET_NVM, thingset_storage_update_handler);
}

if (IS_ENABLED(CONFIG_THINGSET_STORAGE_AUTOSAVE)) {
thingset_sdk_reschedule_work(&storage_work,
K_HOURS(CONFIG_THINGSET_STORAGE_AUTOSAVE_INTERVAL));
}
#ifdef CONFIG_THINGSET_STORAGE_AUTOSAVE
thingset_sdk_reschedule_work(&storage_work, K_HOURS(CONFIG_THINGSET_STORAGE_AUTOSAVE_INTERVAL));
#endif

return 0;
}
Expand Down

0 comments on commit c1040ed

Please sign in to comment.