From c9ca2ad4d315cb6946c9682cacbe4f92c69f7cd0 Mon Sep 17 00:00:00 2001
From: schneider <schneider@blinkenlichts.net>
Date: Sat, 9 May 2020 03:45:07 +0200
Subject: [PATCH] fix(ble): Don't write PeerSignCounter if it didn't change

---
 epicardium/ble/app/common/app_db.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/epicardium/ble/app/common/app_db.c b/epicardium/ble/app/common/app_db.c
index d79a998ee..cf054afd2 100644
--- a/epicardium/ble/app/common/app_db.c
+++ b/epicardium/ble/app/common/app_db.c
@@ -713,8 +713,10 @@ uint32_t AppDbGetPeerSignCounter(appDbHdl_t hdl)
 /*************************************************************************************************/
 void AppDbSetPeerSignCounter(appDbHdl_t hdl, uint32_t signCounter)
 {
-  ((appDbRec_t *)hdl)->peerSignCounter = signCounter;
-  store();
+  if(((appDbRec_t *)hdl)->peerSignCounter != signCounter) {
+    ((appDbRec_t *)hdl)->peerSignCounter = signCounter;
+    store();
+  }
 }
 
 /*************************************************************************************************/
-- 
GitLab