ble.py - use normal lists for history

This commit is contained in:
matt committed 2026-10-18 05:03:54 -07:00
1 parent 1a3b4b43e9
commit 74d68fdcbb
1 file changed
+3 -4
+3 -4
View File
@@ -292,8 +292,7 @@ def test(test_count = 0, bt_usb_id = None) -> None:
passed_list = [] passed_list = []
# History buffer - keep the last N snapshots (N=5) # History buffer - keep the last N snapshots (N=5)
print("Creating history variable") print("Creating history variable")
from collections import deque history = []
history = deque(maxlen=5)
print("Done") print("Done")
prev_list_snapshot = None prev_list_snapshot = None
print("Just before the loop") print("Just before the loop")
@@ -307,12 +306,12 @@ def test(test_count = 0, bt_usb_id = None) -> None:
else: else:
# List changed - reset history # List changed - reset history
print("List changed - reset history") print("List changed - reset history")
history.clear() history = []
history.append(current_list) history.append(current_list)
if len(history) == 5 and all(lst == history[0] for lst in history): if len(history) == 5 and all(lst == history[0] for lst in history):
log.warning(f"Last 5 tests have been identical, resetting adapter") log.warning(f"Last 5 tests have been identical, resetting adapter")
reset_adapter() reset_adapter()
history.clear() history = []
prev_list_snapshot = current_list prev_list_snapshot = current_list
log.info(f" Test run: {test_count} - loop {test_loop_count} start. Initializing run...") log.info(f" Test run: {test_count} - loop {test_loop_count} start. Initializing run...")