From 89287ab0cdf069b49d7f576df65902cf7699e960 Mon Sep 17 00:00:00 2001 From: Brad Barnett <127794626+bdbarnett@users.noreply.github.com> Date: Sat, 7 Nov 2026 05:29:14 -0600 Subject: [PATCH 1/2] Spectrum: the pump's levels run on CPython too pump_levels took ticks_ms from time, which only MicroPython has, so the MP3 player's spectrum failed to start on a computer. It now uses multimer, as the rest of the apps do. --- lib/spectrum/pump_levels.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/spectrum/pump_levels.py b/lib/spectrum/pump_levels.py index cc4bce5..51d09ad 100644 --- a/lib/spectrum/pump_levels.py +++ b/lib/spectrum/pump_levels.py @@ -22,7 +22,7 @@ has far less energy up there than a bar chart would like. """ -from time import ticks_diff, ticks_ms +from multimer import ticks_diff, ticks_ms import audiometer From 86418407dc845aa166a976943828b4469c463c40 Mon Sep 17 00:00:00 2001 From: Brad Barnett <127794626+bdbarnett@users.noreply.github.com> Date: Sat, 7 Nov 2026 05:46:34 -0600 Subject: [PATCH 2/2] Spectrum: present a desktop window after each frame An app that leaves presenting to LVGL (touchkit's quiet_app_timers) stops appdev's refresh, so on a desktop window the bars reached the screen only when LVGL next drew something, about once a second. A display that needs presenting and has no row refresh is now shown after each frame. --- lib/spectrum/analyzer.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/spectrum/analyzer.py b/lib/spectrum/analyzer.py index 27cf457..21bace0 100644 --- a/lib/spectrum/analyzer.py +++ b/lib/spectrum/analyzer.py @@ -115,6 +115,11 @@ def __init__(self, display_drv, source, *, bands=None, height=None, y=None, x=0, self.present_rows = bool(getattr(display_drv, "needs_refresh", False)) and hasattr( getattr(display_drv, "_raw_buffer", None), "refresh_rect" ) + # Any other display that needs presenting (a desktop window) is shown + # whole after each frame: an app that leaves presenting to LVGL has + # stopped appdev's refresh, so the bars would show only when LVGL + # next drew something. + self.present_all = bool(getattr(display_drv, "needs_refresh", False)) and not self.present_rows self._send = self._panel_blit() self._dirty = [0, 0] # rows touched this frame, top and bottom self._stats = [0, 0, 0, 0, 0] # frames, data us, update us, draw us, report start @@ -187,8 +192,11 @@ def tick(self, _=None): dirty = self._dirty dirty[0], dirty[1] = self.y + view.height, 0 view.render_columns(self._blit) - if self.present_rows and dirty[1] > dirty[0]: - self.display_drv.flush_rect(self.x, dirty[0], view.width, dirty[1] - dirty[0]) + if dirty[1] > dirty[0]: + if self.present_rows: + self.display_drv.flush_rect(self.x, dirty[0], view.width, dirty[1] - dirty[0]) + elif self.present_all: + self.display_drv.show() if not self.report: return d = ticks_us()