mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-10-05 14:55:08 +00:00
fix(display): Vegas resumes after live priority, and six smaller runtime fixes (#644)
- Vegas: a live-priority pause was only lifted from inside run_frame(), which returns before that check while paused, so the ticker never came back until a restart. run_iteration() now resumes it (the controller only calls it when nothing preempts Vegas); start()/stop() clear the pause state. Iteration length is timed with the monotonic clock. - Dim schedule: a per-day disabled day now updates the minute-gate cache, so brightness no longer flips back to dim within each minute. - On-demand: a second request no longer overwrites the rotation resume index with the first request's mode. - Render pipeline: reset() drops the prepared group and deferred queue, and a prefetch in flight across a reset discards its result. - Sync: stop() removes the status file (and the controller's cleanup now calls it), standalone removes a stale one at startup, and writes use a unique mkstemp temp file. - render_gate.swap_releases_gil() delegates to frame_timing. - Stale docstrings/comments corrected. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -52,6 +52,12 @@ class RenderPipeline:
|
||||
# A panel measured within this fraction of its cap is keeping up with it.
|
||||
REFRESH_TOLERANCE = 0.03
|
||||
|
||||
# Bumped by reset(). A prefetch thread records the value it started under
|
||||
# and drops its group if a reset happened meanwhile, so a fetch still in
|
||||
# flight when Vegas stops cannot land in the next run. Class-level so
|
||||
# pipelines built without __init__ (tests) still have it.
|
||||
_prefetch_generation = 0
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
config: VegasModeConfig,
|
||||
@@ -373,6 +379,7 @@ class RenderPipeline:
|
||||
return
|
||||
if self._prepared_group is not None:
|
||||
return # already have one waiting
|
||||
generation = self._prefetch_generation
|
||||
|
||||
def _work():
|
||||
# Deprioritise against the render loop. Linux applies nice
|
||||
@@ -394,6 +401,8 @@ class RenderPipeline:
|
||||
logger.exception("Background prefetch failed")
|
||||
group = []
|
||||
with self._prefetch_lock:
|
||||
if generation != self._prefetch_generation:
|
||||
return # Vegas was reset while this was fetching
|
||||
self._prepared_group = group
|
||||
|
||||
self._prefetch_thread = threading.Thread(
|
||||
@@ -602,7 +611,8 @@ class RenderPipeline:
|
||||
"""
|
||||
Render a single frame to the display.
|
||||
|
||||
Should be called at ~125 FPS (8ms intervals).
|
||||
Called once per frame by the coordinator, which paces the calls by
|
||||
frame_interval (see that property) rather than a fixed rate.
|
||||
|
||||
Returns:
|
||||
True if frame was rendered, False if no content
|
||||
@@ -917,6 +927,15 @@ class RenderPipeline:
|
||||
self._segments_in_scroll = []
|
||||
self._frame_times = deque(maxlen=100)
|
||||
|
||||
# Content lined up for the old run belongs to it. Left in place, the
|
||||
# first extension after Vegas is switched back on appended that stale
|
||||
# group -- including plugins disabled in the meantime -- and the
|
||||
# deferred queue went on fetching the old run's plugins.
|
||||
with self._prefetch_lock:
|
||||
self._prefetch_generation += 1
|
||||
self._prepared_group = None
|
||||
self._deferred_queue = []
|
||||
|
||||
self.display_manager.set_scrolling_state(False)
|
||||
|
||||
logger.info("RenderPipeline reset")
|
||||
|
||||
Reference in New Issue
Block a user