mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-05-02 03:22:40 +02:00
Second slice of the per-channel region-scope feature — firmware plumbing. No UI, routes, or send-flow integration yet; those land in PR #3 / #4. - _send_lock: threading.Lock added to __init__ (consumed in PR #4 to serialize the set-scope + send-channel-message pair across Flask threads; introduced here to keep the init diff small). - set_flood_scope_key(key_hex): thin wrapper over the existing meshcore-py `set_flood_scope(bytes)` path (CMD 54). None/empty clears the volatile scope. Used on the channel-send hot path in PR #4. - set_default_flood_scope(name, key_hex): hand-rolled CMD 63 frame (opcode + 31-byte NUL-padded name + 16-byte key = 48 bytes) via the lib's generic send() with [OK, ERROR] wait. Installed meshcore-py (<=2.2.15) has no wrapper for this opcode; frame format matches MyMesh.cpp lines 1893-1909. - Deliberately NOT implementing CMD 64 (GET_DEFAULT_FLOOD_SCOPE): the library's reader drops RESP_CODE 28 as "unhandled" (reader.py:919-921), so there is no Event we can wait for. Until upstream adds support, mc-webui treats its own regions.is_default row as the source of truth and pushes one-way via CMD 63. Comment in code documents the reason.