Skip to content

Latest commit

 

History

History
76 lines (53 loc) · 3.33 KB

File metadata and controls

76 lines (53 loc) · 3.33 KB

Remote Debug

Badge

Web-based remote debugging interface providing GPIO control, real-time ADC monitoring, and optional console log viewing over HTTP. Uses espp::Timer for efficient, configurable periodic updates.

remote-monitoring-2.mp4
image

Features

  • GPIO Control: Configure pins as input/output, read states, control outputs via web interface
  • ADC Monitoring: Real-time visualization of ADC channels with configurable sample rates
  • Console Log Viewer: Optional stdout redirection to web-viewable log with ANSI color support
  • Efficient Updates: Uses espp::Timer for optimal performance with configurable priority
  • RESTful API: JSON endpoints for programmatic access
  • Responsive UI: Modern web interface that works on desktop and mobile
  • Multi-client Support: Optimized for multiple concurrent clients through batched updates

Performance

The component has been optimized for efficiency:

  • Uses espp::Timer for precise, lightweight periodic updates
  • Configurable task priority and stack size
  • Batched ADC data updates reduce HTTP overhead
  • Ring buffer implementation for efficient data management
  • Efficient JSON generation minimizes processing overhead

Dependencies

  • espp::Timer - Periodic task execution
  • espp::Adc - ADC channel management
  • espp::FileSystem - LittleFS for optional log storage
  • ESP HTTP Server - Web interface hosting

Console Logging

When enable_log_capture is enabled in the config, stdout is redirected to a file viewable in the web interface. The log viewer supports ANSI color codes.

Important: For real-time log updates, enable LittleFS file flushing:

CONFIG_LITTLEFS_FLUSH_FILE_EVERY_WRITE=y

API Endpoints

The component exposes the following HTTP endpoints:

  • GET / - Main web interface (HTML page)
  • GET /api/gpio/get - Get all GPIO states and configurations (JSON)
  • POST /api/gpio/set - Set GPIO output state (JSON: {"pin": N, "value": 0|1})
  • POST /api/gpio/config - Configure GPIO direction (JSON: {"pin": N, "mode": 1|3})
    • Mode values: 1 = INPUT, 3 = INPUT_OUTPUT (OUTPUT is promoted to INPUT_OUTPUT for safety)
  • GET /api/adc/data - Get ADC readings and plot data (JSON with ring buffer indices)
  • GET /api/logs - Get console log contents (text/plain with ANSI colors)
  • POST /api/logs/start - Start log capture (redirects stdout to file)
  • POST /api/logs/stop - Stop log capture (restores stdout to /dev/console)

Set this in your sdkconfig.defaults or via idf.py menuconfig → Component config → LittleFS. Without this, logs only appear after the buffer fills.

Example

See the example in the example/ folder for a complete demonstration with WiFi connection, GPIO control, ADC monitoring, and console log viewing.

External Resources