From 43c83a4b8b130138b9f3e2e820d54dc0890fbc3d Mon Sep 17 00:00:00 2001
From: schneider <schneider@blinkenlichts.net>
Date: Thu, 15 Aug 2019 16:01:06 +0200
Subject: [PATCH] fix(ble): Do not try to schedule 0 tick WSF timers

---
 epicardium/ble/ble.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/epicardium/ble/ble.c b/epicardium/ble/ble.c
index 9a2da1942..a91c381b0 100644
--- a/epicardium/ble/ble.c
+++ b/epicardium/ble/ble.c
@@ -1,7 +1,6 @@
 #include "modules/log.h"
 
 #include "fs_util.h"
-
 #include "wsf_types.h"
 #include "wsf_buf.h"
 #include "wsf_trace.h"
@@ -161,6 +160,13 @@ static void scheduleTimer(void)
 	if (timerRunning) {
 		//printf("time_to_next_expire = %d\n", time_to_next_expire);
 		//printf("change period\n");
+		/* We need to make sure not to schedule a 0 ticks timer.
+		 * Maybe it would also be enough to simply call the dispatcher
+		 * in this case... */
+		if(time_to_next_expire == 0 ) {
+			time_to_next_expire = 1;
+		}
+
 		if (timerWakeup != NULL) {
 			xTimerChangePeriod(
 				timerWakeup,
-- 
GitLab