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() 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