basic led control with local btn

This commit is contained in:
2026-01-05 22:18:58 +01:00
parent 05be118dd1
commit fa6a19d1aa
17 changed files with 156 additions and 2138 deletions

View File

@ -1,6 +1,6 @@
# ESP32 LED Controller for Model Aircraft
Professional LED controller firmware for ESP32 with Web-BLE configuration interface. Designed for model aircraft with WS2812B LED strips.
Professional LED controller firmware for ESP32. Designed for model aircraft with WS2812B LED strips.
## Features
@ -26,28 +26,17 @@ Professional LED controller firmware for ESP32 with Web-BLE configuration interf
13. **Chase (RGB)** - RGB cycling chase effect
14. **Random** - Random LED colors
### Web-BLE Configuration
- **Pin Configuration**: Set GPIO pins for LED strips and PWM input
- **BLE Auto-Off**: Configure timeout (Never/1min/5min)
- **Manual Control**: Select animation modes from web interface
- **PWM Emulation**: Test mode switching without RC signal
- **OTA Firmware Update**: Upload new firmware via Bluetooth
## Project Structure
```
led-controller-firmware/
├── main/
│ ├── main.c # Application entry point
│ ├── control.c/h # BLE, NVS, initialization
│ ├── control.c/h # NVS, initialization
│ ├── led.c/h # WS2812B control (RMT driver)
│ ├── rcsignal.c/h # PWM signal reading
│ ├── localbtn.c/h # Local btn reading
│ └── animation.c/h # LED animation patterns
├── webapp/
│ ├── index.html # Web-BLE interface
│ ├── app/app.js # BLE communication logic
│ ├── css/style.css # UI styling
│ └── data/favicon.ico
├── CMakeLists.txt
├── sdkconfig.defaults
└── partitions.csv # OTA-enabled partition table
@ -107,42 +96,6 @@ GND -> Common Ground
- 1500µs threshold for mode switching
- Rising edge >1500µs after <1500µs triggers next mode
## Web-BLE Configuration
### Access the Interface
1. Open `webapp/index.html` in Chrome, Edge, or Opera (Web Bluetooth required)
2. Click "Connect via BLE"
3. Select "LED-Controller" from device list
4. Configure settings and control LEDs
### Configuration Options
#### Pin Setup
- **LED Strip A GPIO**: -1 to disable, 0-48 for GPIO pin
- **LED Strip B GPIO**: -1 to disable, 0-48 for GPIO pin
- **PWM Input GPIO**: -1 to disable, 0-48 for GPIO pin
#### BLE Timeout
- **Never**: BLE stays on until manually disabled
- **1 Minute**: Auto-disable after 1 min of boot (unless connected)
- **5 Minutes**: Auto-disable after 5 min of boot (unless connected)
#### Firmware Update
1. Build firmware: `idf.py build`
2. Find binary: `build/led_controller.bin`
3. Upload via Web-BLE interface
4. Device restarts with new firmware (settings reset)
## Default Configuration
On first boot or after reset:
- All pins: **Not configured** (-1)
- BLE timeout: **Never**
- Animation mode: **Black** (off)
Configure via Web-BLE before use.
## Development
### Adding New Animations
@ -154,7 +107,7 @@ Configure via Web-BLE before use.
### Modifying LED Count
Edit `DEFAULT_NUM_LEDS_A` and `DEFAULT_NUM_LEDS_B` in `control.c`. TODO
Edit `DEFAULT_NUM_LEDS_A` and `DEFAULT_NUM_LEDS_B` in `control.c`. TODO:
### Testing