mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-08-01 16:58:06 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a0c80d934a |
@@ -625,14 +625,24 @@ class DisplayController:
|
|||||||
# Check if per-day schedule is configured
|
# Check if per-day schedule is configured
|
||||||
days_config = schedule_config.get('days')
|
days_config = schedule_config.get('days')
|
||||||
|
|
||||||
# Determine which schedule to use
|
# Determine which schedule to use. Respect an explicit 'mode' field
|
||||||
|
# (like the dim schedule does) so a stray/legacy 'days' dict left over
|
||||||
|
# from config migration or a prior per-day setup can't silently
|
||||||
|
# override a user's Global schedule selection.
|
||||||
|
mode = schedule_config.get('mode')
|
||||||
|
mode_normalized = mode.replace('_', '-') if mode else None
|
||||||
|
|
||||||
use_per_day = False
|
use_per_day = False
|
||||||
if days_config:
|
if mode_normalized == 'global':
|
||||||
# Check if days dict is not empty and contains current day
|
use_per_day = False
|
||||||
if days_config and current_day in days_config:
|
elif mode_normalized == 'per-day':
|
||||||
|
use_per_day = bool(days_config and current_day in days_config)
|
||||||
|
elif days_config:
|
||||||
|
# No explicit mode recorded (legacy config) - fall back to
|
||||||
|
# inferring from presence of a 'days' dict for the current day.
|
||||||
|
if current_day in days_config:
|
||||||
use_per_day = True
|
use_per_day = True
|
||||||
elif days_config:
|
else:
|
||||||
# Days dict exists but doesn't have current day - fall back to global
|
|
||||||
logger.debug("Per-day schedule exists but %s not configured, using global schedule", current_day)
|
logger.debug("Per-day schedule exists but %s not configured, using global schedule", current_day)
|
||||||
|
|
||||||
if use_per_day:
|
if use_per_day:
|
||||||
|
|||||||
@@ -329,6 +329,7 @@ def save_schedule_config():
|
|||||||
}
|
}
|
||||||
|
|
||||||
mode = data.get('mode', 'global')
|
mode = data.get('mode', 'global')
|
||||||
|
schedule_config['mode'] = mode
|
||||||
|
|
||||||
if mode == 'global':
|
if mode == 'global':
|
||||||
# Simple global schedule
|
# Simple global schedule
|
||||||
|
|||||||
Reference in New Issue
Block a user