Harden HID, Wi-Fi, and web server handling

This commit is contained in:
2026-08-31 11:54:11 +02:00
parent 072cd793c4
commit 3db3c20a7b
3 changed files with 137 additions and 33 deletions
+11
View File
@@ -47,6 +47,7 @@ CONFIG_DESCRIPTOR = bytes((
STRINGS = [None, "PolterHID", "Awareness trainer", "PHID-001"]
_GET_DESCRIPTOR = 0x06
_DESCRIPTOR_TYPE_REPORT = 0x22
_MAX_PENDING_REPORTS = 8
_INSTANCE = None
@@ -117,6 +118,16 @@ class HID:
self._busy = False
def _send(self, report):
if not self._ready:
return
report_id = report[0]
for index, pending in enumerate(self._pending):
if pending[0] == report_id:
self._pending[index] = report
self._flush()
return
if len(self._pending) >= _MAX_PENDING_REPORTS:
self._pending.pop(0)
self._pending.append(report)
self._flush()