mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-07-05 17:31:39 +02:00
fix(channels): use device-reported max_channels instead of hardcoded 8
Firmware reports MAX_GROUP_CHANNELS (typically 40 for companion builds) in the DEVICE_INFO response. Fetch it at startup and use it in all channel iteration loops. Previously hardcoded range(8) prevented channels 8+ from appearing and blocked adding new channels. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+3
-3
@@ -284,7 +284,7 @@ def get_channels() -> Tuple[bool, List[Dict]]:
|
||||
try:
|
||||
dm = _get_dm()
|
||||
channels = []
|
||||
for idx in range(8):
|
||||
for idx in range(dm._max_channels):
|
||||
info = dm.get_channel_info(idx)
|
||||
if info and info.get('name'):
|
||||
channels.append({
|
||||
@@ -302,8 +302,8 @@ def add_channel(name: str) -> Tuple[bool, str, Optional[str]]:
|
||||
"""Add a new channel."""
|
||||
try:
|
||||
dm = _get_dm()
|
||||
# Find first free slot (1-7, slot 0 is Public)
|
||||
for idx in range(1, 8):
|
||||
# Find first free slot (1+, slot 0 is Public)
|
||||
for idx in range(1, dm._max_channels):
|
||||
info = dm.get_channel_info(idx)
|
||||
if not info or not info.get('name'):
|
||||
result = dm.set_channel(idx, name)
|
||||
|
||||
Reference in New Issue
Block a user