Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions lib/spectrum/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion lib/spectrum/pump_levels.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading