Files
LEDMatrix/plugin-repos/web-ui-info
Chuck efe6b1fe23 fix: reduce CPU usage, fix Vegas refresh, throttle high-FPS ticks (#304)
* fix: reduce CPU usage, fix Vegas mid-cycle refresh, and throttle high-FPS plugin ticks

Web UI Info plugin was causing 90%+ CPU on RPi4 due to frequent subprocess
calls and re-rendering. Fixed by: trying socket-based IP detection first
(zero subprocess overhead), caching AP mode checks with 60s TTL, reducing
IP refresh from 30s to 5m, caching rendered display images, and loading
fonts once at init.

Vegas mode was not updating the display mid-cycle because hot_swap_content()
reset the scroll position to 0 on every recomposition. Now saves and
restores scroll position for mid-cycle updates.

High-FPS display loop was calling _tick_plugin_updates() 125x/sec with no
benefit. Added throttled wrapper that limits to 1 call/sec.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address PR review — respect plugin update_interval, narrow exception handlers

Make _tick_plugin_updates_throttled default to no-throttle (min_interval=0)
so plugin-configured update_interval values are never silently capped.
The high-FPS call site passes an explicit 1.0s interval.

Narrow _load_font exception handler from bare Exception to
FileNotFoundError | OSError so unexpected errors surface.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(vegas): scale scroll position proportionally on mid-cycle hot-swap

When content width changes during a mid-cycle recomposition (e.g., a
plugin gains or loses items), blindly restoring the old scroll_position
and total_distance_scrolled could overshoot the new total_scroll_width
and trigger immediate false completion. Scale both values proportionally
to the new width and clamp scroll_position to stay in bounds.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Chuck <chuck@example.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 08:46:52 -04:00
..
2025-12-27 14:15:49 -05:00
2025-12-27 14:15:49 -05:00
2025-12-27 14:15:49 -05:00

Web UI Info Plugin

A simple built-in plugin for LEDMatrix that displays the web UI URL for easy access.

Features

  • Displays "visit web ui at http://[deviceID]:5000" on the LED matrix
  • Automatically detects device hostname
  • Easily enabled/disabled via web interface
  • Configurable display duration

Configuration

The plugin can be configured in config/config.json:

{
  "web-ui-info": {
    "enabled": true,
    "display_duration": 10,
    "transition": {
      "type": "redraw",
      "speed": 2,
      "enabled": true
    }
  }
}

Configuration Options

  • enabled (boolean): Enable or disable the plugin (default: true)
  • display_duration (number): How long to display the message in seconds (default: 10, range: 1-300)
  • transition (object): Transition settings for switching to/from this display

Usage

The plugin will automatically be discovered and loaded when the LEDMatrix system starts. It will display the web UI URL during the normal rotation cycle.

To enable/disable the plugin:

  1. Open the web UI at http://[your-device]:5000
  2. Navigate to the Plugins tab
  3. Find "Web UI Info" in the plugin list
  4. Toggle the enable/disable checkbox

Device ID

The plugin uses socket.gethostname() to determine the device hostname. If the hostname cannot be determined, it falls back to "localhost".

Display

The plugin displays two lines of text:

  • Line 1: "visit web ui"
  • Line 2: "at [deviceID]:5000"

Text is centered horizontally on the display and rendered in white.

Notes

  • This is a built-in plugin that comes with the LEDMatrix repository
  • No external dependencies required
  • The plugin does not fetch any external data - it only displays the local device information