espp/remote_debug

1.0.34

Latest
uploaded 1 day ago
Remote debugging server with GPIO and ADC control

readme

# Remote Debug

[![Badge](https://components.espressif.com/components/espp/remote_debug/badge.svg)](https://components.espressif.com/components/espp/remote_debug)

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.

https://github.com/user-attachments/assets/ee806c6c-0f6b-4dd0-a5b0-82b80410b5bc

<img width="607" height="2048" alt="image" src="https://github.com/user-attachments/assets/5977033c-eee8-4be2-a9c4-634fd3100480" />

## 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

- [ESP-IDF HTTP Server Documentation](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/protocols/esp_http_server.html)
- [ADC Continuous Mode](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/adc_continuous.html)

Links

Supports all targets

Maintainer

  • William Emfinger <waemfinger@gmail.com>

License: MIT

To add this component to your project, run:

idf.py add-dependency "espp/remote_debug^1.0.34"

download archive

Stats

  • Archive size
    Archive size ~ 21.07 KB
  • Downloaded in total
    Downloaded in total 0 times
  • Downloaded this version
    This version: 0 times

Badge

espp/remote_debug version: 1.0.34
|