Skip to content
Snippets Groups Projects
Commit 7dd77fe8 authored by Jeff Gough's avatar Jeff Gough
Browse files

Increase delay to 5 seconds

parent dbc3b8fb
No related branches found
No related tags found
1 merge request!207Timer to group calls to appDb store() method
...@@ -99,7 +99,7 @@ static appDbRec_t *pAppDbNewRec = appDb.rec; ...@@ -99,7 +99,7 @@ static appDbRec_t *pAppDbNewRec = appDb.rec;
static TimerHandle_t store_timer; static TimerHandle_t store_timer;
static StaticTimer_t store_timer_buffer; static StaticTimer_t store_timer_buffer;
static void store_callback(); static void store_callback();
#define STORE_DELAY pdMS_TO_TICKS(1000) #define STORE_DELAY pdMS_TO_TICKS(5000)
/*************************************************************************************************/ /*************************************************************************************************/
/*! /*!
...@@ -129,9 +129,11 @@ void AppDbInit(void) ...@@ -129,9 +129,11 @@ void AppDbInit(void)
); );
} }
/* TODO this should actually put tasks into a queue. On the other end of the queue */
/* a worker task can read tasks off the queue and execute them */
static void store(void) static void store(void)
{ {
LOG_DEBUG("appDb", "store() called, resetting timer"); LOG_INFO("appDb", "store() called, resetting timer");
if (xTimerReset(store_timer, 10) != pdPASS) { /* (Re)start the timer */ if (xTimerReset(store_timer, 10) != pdPASS) { /* (Re)start the timer */
/* Store timer could not be reset, write to persistent storage anyway */ /* Store timer could not be reset, write to persistent storage anyway */
store_callback(); store_callback();
...@@ -140,10 +142,11 @@ static void store(void) ...@@ -140,10 +142,11 @@ static void store(void)
static void store_callback() static void store_callback()
{ {
LOG_INFO("appDb", "STORE_DELAY passed, writing to persistent storage");
int fd = epic_file_open("pairings.bin", "w"); int fd = epic_file_open("pairings.bin", "w");
if(fd >= 0) { if(fd >= 0) {
if(epic_file_write(fd, &appDb, sizeof(appDb)) != sizeof(appDb)) { if(epic_file_write(fd, &appDb, sizeof(appDb)) != sizeof(appDb)) {
LOG_DEBUG("appDb", "STORE_DELAY passed, writing to persistent storage");
} }
epic_file_close(fd); epic_file_close(fd);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment