From bcb6ccc1aff77975037f88cc8b59e19e30424873 Mon Sep 17 00:00:00 2001
From: schneider <schneider@blinkenlichts.net>
Date: Sat, 30 Jan 2021 18:43:03 +0100
Subject: [PATCH] fix(exnostat): Consume all BLE events

---
 preload/apps/exnostat/__init__.py | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/preload/apps/exnostat/__init__.py b/preload/apps/exnostat/__init__.py
index 57c69fc19..60cf16d3b 100644
--- a/preload/apps/exnostat/__init__.py
+++ b/preload/apps/exnostat/__init__.py
@@ -100,14 +100,17 @@ def process_scan_report(scan_report):
 
 
 def ble_callback(_):
-    event = sys_ble.get_event()
-    if event == sys_ble.EVENT_SCAN_REPORT:
-        while True:
-            scan_report = sys_ble.get_scan_report()
-            if scan_report == None:
-                break
-            process_scan_report(scan_report)
-        prune()
+    while True:
+        event = sys_ble.get_event()
+        if event == sys_ble.EVENT_NONE:
+            break
+        if event == sys_ble.EVENT_SCAN_REPORT:
+            while True:
+                scan_report = sys_ble.get_scan_report()
+                if scan_report == None:
+                    break
+                process_scan_report(scan_report)
+            prune()
 
 
 def show_stats():
-- 
GitLab