From 7dd77fe8554a93fae73651238057cf1f8b319df0 Mon Sep 17 00:00:00 2001 From: Jeff Gough <j@jeffreygough.com> Date: Thu, 22 Aug 2019 23:21:01 +0200 Subject: [PATCH] Increase delay to 5 seconds --- epicardium/ble/app/common/app_db.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/epicardium/ble/app/common/app_db.c b/epicardium/ble/app/common/app_db.c index 46c307559..d79a998ee 100644 --- a/epicardium/ble/app/common/app_db.c +++ b/epicardium/ble/app/common/app_db.c @@ -99,7 +99,7 @@ static appDbRec_t *pAppDbNewRec = appDb.rec; static TimerHandle_t store_timer; static StaticTimer_t store_timer_buffer; 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) ); } +/* 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) { - LOG_DEBUG("appDb", "store() called, resetting timer"); + LOG_INFO("appDb", "store() called, resetting timer"); if (xTimerReset(store_timer, 10) != pdPASS) { /* (Re)start the timer */ /* Store timer could not be reset, write to persistent storage anyway */ store_callback(); @@ -140,10 +142,11 @@ static void store(void) static void store_callback() { + LOG_INFO("appDb", "STORE_DELAY passed, writing to persistent storage"); + int fd = epic_file_open("pairings.bin", "w"); if(fd >= 0) { if(epic_file_write(fd, &appDb, sizeof(appDb)) != sizeof(appDb)) { - LOG_DEBUG("appDb", "STORE_DELAY passed, writing to persistent storage"); } epic_file_close(fd); } -- GitLab