fix: encodage

This commit is contained in:
2025-08-21 07:38:58 +02:00
parent fcee080589
commit fc108a4b7f
2 changed files with 29 additions and 9 deletions

View File

@@ -14,23 +14,27 @@ Radio internet WiFi basée sur ESP32 avec interface web intégrée et contrôles
### Utilisation quotidienne
#### Contrôles physiques
- **🔘 Appui court** : Mise en veille (économie d'énergie)
- **🔘 Appui long (2s)** : Mode sélection de stations (LED clignote 3x)
- **🔘 Appui très long (5s)** : Reset WiFi et retour en mode configuration
- **🎛️ Potentiomètre** :
- **🎛️ Potentiomètre** :
- Mode normal : Contrôle du volume
- Mode sélection : Choix de la station radio
#### Interface web
Accédez à l'interface via l'adresse IP de la radio (affichée au démarrage) :
- **🎵 Contrôle de lecture** : Play/Stop/Changement de station
- **📻 Gestion des stations** : Ajouter/supprimer jusqu'à 10 stations
- **🌐 Configuration WiFi** : Modifier les paramètres réseau
- **📱 Compatible mobile** : Interface responsive
### Stations pré-configurées
- France Inter
- FIP
- FIP
- France Info
- 80s Hits
- BBC Radio 1
@@ -38,6 +42,7 @@ Accédez à l'interface via l'adresse IP de la radio (affichée au démarrage) :
## ⚙️ Pour le développeur
### Prérequis
- **Arduino CLI** installé et configuré
- **Board ESP32** : `esp32:esp32:esp32`
- **Bibliothèques** :
@@ -47,11 +52,12 @@ Accédez à l'interface via l'adresse IP de la radio (affichée au démarrage) :
- EEPROM (intégrée)
### Schéma de câblage
```
ESP32 Pin | Composant
-----------|----------
25 | I2S_DOUT (vers DAC)
26 | I2S_LRC (vers DAC)
26 | I2S_LRC (vers DAC)
27 | I2S_BCLK (vers DAC)
32 | LED de statut
33 | Bouton d'alimentation
@@ -59,8 +65,10 @@ ESP32 Pin | Composant
```
### Configuration WiFi
1. Copiez `wifiinfo.h.sample` vers `wifiinfo.h`
2. Modifiez les paramètres par défaut :
```cpp
#define WIFI_SSID "VotreSSID"
#define WIFI_PASSWD "VotreMotDePasse"
@@ -70,11 +78,13 @@ ESP32 Pin | Composant
### Compilation et upload
#### Méthode simple
```bash
make all # Compile + Upload + Monitor
```
#### Méthode détaillée
```bash
make compile # Compilation uniquement
make upload # Upload vers ESP32
@@ -82,7 +92,9 @@ make watch # Monitoring série (screen)
```
#### Troubleshooting upload
Si l'upload échoue avec "Device or resource busy" :
```bash
lsof /dev/ttyUSB0 # Vérifier les processus
kill <PID> # Tuer le processus si nécessaire
@@ -91,11 +103,13 @@ kill <PID> # Tuer le processus si nécessaire
### Architecture du code
#### Fichiers principaux
- `esp32_radio.ino` : Code principal
- `wifiinfo.h` : Configuration WiFi (non versionné)
- `Makefile` : Scripts de build
#### Fonctions clés
- `setup()` : Initialisation, gestion du réveil, connexion WiFi
- `loop()` : Boucle principale (audio, web, contrôles)
- `wifi_init()` : Gestion intelligente de la connexion WiFi
@@ -104,6 +118,7 @@ kill <PID> # Tuer le processus si nécessaire
- `handleRoot()` : Interface web principale
#### Stockage EEPROM
```cpp
EEPROM_SIZE = 2048
├── WiFi credentials (0-96)
@@ -113,6 +128,7 @@ EEPROM_SIZE = 2048
```
#### Modes de fonctionnement
1. **Normal** : Lecture + contrôles standard
2. **Sélection** : Potentiomètre = sélection station
3. **Configuration** : Point d'accès + interface web
@@ -121,9 +137,11 @@ EEPROM_SIZE = 2048
### Personnalisation
#### Ajouter des stations par défaut
Modifiez `loadStationsFromEEPROM()` ligne 428-441.
#### Modifier les timeouts
```cpp
#define CONNECTION_TIMEOUT 10 // Timeout WiFi (secondes)
#define LONG_PRESS_TIME 2000 // Appui long (ms)
@@ -131,9 +149,11 @@ Modifiez `loadStationsFromEEPROM()` ligne 428-441.
```
#### Pins personnalisées
Modifiez les defines lignes 9-14 selon votre câblage.
### API Web
- `GET /` : Interface principale
- `POST /add` : Ajouter station (`name`, `url`)
- `POST /delete?id=X` : Supprimer station

View File

@@ -443,7 +443,7 @@ void loadStationsFromEEPROM() {
// Web server functions
void handleRoot() {
String html = "<!DOCTYPE html><html><head><title>ESP32 Radio Config</title>";
String html = "<!DOCTYPE html><html><head><meta charset='UTF-8'><title>ESP32 Radio Config</title>";
html += "<style>body{font-family:Arial;margin:20px}table{border-collapse:collapse;width:100%}";
html += "th,td{border:1px solid #ddd;padding:8px;text-align:left}th{background-color:#f2f2f2}";
html += "input[type=text]{width:90%;padding:5px}button{padding:10px;margin:5px}</style></head><body>";
@@ -499,7 +499,7 @@ void handleRoot() {
html += "fetch('/stop',{method:'POST'}).then(()=>location.reload());}";
html += "</script></body></html>";
server.send(200, "text/html", html);
server.send(200, "text/html; charset=utf-8", html);
}
void handleAdd() {
@@ -580,7 +580,7 @@ void handleStop() {
}
void handleWiFiConfig() {
String html = "<!DOCTYPE html><html><head><title>Configuration WiFi</title>";
String html = "<!DOCTYPE html><html><head><meta charset='UTF-8'><title>Configuration WiFi</title>";
html += "<style>body{font-family:Arial;margin:20px}input[type=text],input[type=password]{width:300px;padding:10px;margin:5px 0}";
html += "button{padding:10px 20px;margin:10px 5px;font-size:16px}";
html += ".back-btn{background-color:#6c757d;color:white;text-decoration:none;padding:10px 20px;display:inline-block;margin:10px 0}</style></head><body>";
@@ -608,7 +608,7 @@ void handleWiFiConfig() {
html += "<a href='/' class='back-btn'>⬅️ Retour</a>";
html += "</body></html>";
server.send(200, "text/html", html);
server.send(200, "text/html; charset=utf-8", html);
}
void handleSaveWiFi() {
@@ -632,7 +632,7 @@ void handleSaveWiFi() {
response += "SSID: " + newSSID + "<br>";
response += "Appareil: " + newHostname;
server.send(200, "text/html", response);
server.send(200, "text/html; charset=utf-8", response);
Serial.println("Nouvelles credentials WiFi sauvegardées, redémarrage...");
delay(2000);
@@ -641,7 +641,7 @@ void handleSaveWiFi() {
void handleResetWiFi() {
resetWiFiCredentials();
server.send(200, "text/html", "Configuration WiFi effacée. Redémarrage en mode configuration...");
server.send(200, "text/html; charset=utf-8", "Configuration WiFi effacée. Redémarrage en mode configuration...");
delay(2000);
ESP.restart();
}