Files
webradiotest/README.md
DESKTOP-PUHFO60\dsx2016 d75c252b9e Add CYD web radio: WiFi provision + HTTP MP3 to DAC26.
Supports 2.8/3.5 boards with on-screen station list; ships flashable firmware packages.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-28 08:04:11 +08:00

70 lines
2.3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# CYD 网络电台(Web Radio)
ESP32 Cheap Yellow Display 上网听 MP3 电台。显示/触控/配网对齐 [wifitest](../wifitest) 与 [CYD_PROJECT_GUIDE.md](../CYD_PROJECT_GUIDE.md);音频走板载喇叭 **GPIO26(DAC2)**。
| 板型 | env | 屏 / 触控 | 背光 | 喇叭 |
|------|-----|-----------|------|------|
| **2.8" · 2432S028R** | `cyd`(默认) | ILI9341 + XPT2046 SoftSPI | GPIO**21** | GPIO**26** |
| **3.5" · 3248S035C** | `cyd_35r` | ST7796 + GT911 I2C | GPIO**27** | GPIO**26** |
> **禁止占用 GPIO25**:2.8 是触控 CLK,3.5 是 GT911 RST。固件在开内置 DAC 后强制只启用 DAC2(GPIO26)。
## 功能
1. **WiFi 配网**(复用 `wifi_prov` / `wifi_ui`):屏上扫网 + 键盘,或 SoftAP `CYD-Setup` 门户;凭证进 NVS。
2. **连上后进电台页**:内置若干 SomaFM / Radio Swiss 等 HTTP MP3 流。
3. **Prev / Play·Stop / Next**、音量、点列表切台;**WiFi Setup** 可返回配网(会停播)。
解码:`ESP8266Audio`(HTTP → 缓冲 → MP3 → I2S 内置 DAC)。
## 刷写
| 板型 | 目录 |
|------|------|
| 2.8" | [`firmware/cyd/`](firmware/cyd/) |
| 3.5" | [`firmware/cyd_35r/`](firmware/cyd_35r/) |
```powershell
cd firmware\cyd # 或 firmware\cyd_35r
.\flash.ps1
# 或
.\flash.ps1 -Port COM3
```
源码:
```powershell
pio run -e cyd -t upload # 2.8
pio run -e cyd_35r -t upload # 3.5
pio device monitor -b 460800
```
重新打包:
```powershell
.\firmware\export_from_build.ps1
.\firmware\export_from_build.ps1 -Env cyd_35r
```
## 使用
1. 首次无 WiFi:屏上 **Scan → 选网 → 密码 → Join**,或手机连 `CYD-Setup` 打开 `http://192.168.4.1/`。
2. 连上后自动进 **Web Radio**;点台或 Play。
3. 喇叭接 P4;音量从低开始调。
## 模块
| 文件 | 职责 |
|------|------|
| `touch.*` / `pins.h` | 双板触控与引脚 |
| `wifi_prov.*` / `wifi_ui.*` | 配网核心 + LVGL UI |
| `radio_player.*` | 电台列表 + HTTP MP3 + DAC26 |
| `radio_ui.*` | 电台界面 |
| `main.cpp` | 启动顺序与 loop |
## 注意
- 流媒体需外网;部分源站可能间歇不可用,可改 `radio_player.cpp` 里 `k_stations[]`。
- 分区用 `min_spiffs.csv`(解码库体积大)。
- 3.5:`DRAW_BUF_DIV=20`、`LV_MEM_SIZE=32768`;外设脚仍是 **22+21**(本工程无外设接线)。