Conversation
- src/main.cpp : implémentation complète WiFiMulti (secrets.h), ArduinoOTA, WebServer (port 80), route /api/status (JSON), page OTA /update embarquée, mDNS gateway-lab-v1.local, reconnexion automatique dans loop() - web_src/index.html : page minimaliste (titre, cartouche réseau SSID/IP/RSSI/ uptime, badge statut, bouton OTA), rafraîchissement auto toutes les 10 s - tools/minify_web.py : réécrit pour HTML→data/index.html (SPIFFS) ; dual-mode standalone + pre-script PlatformIO ; fallback sans rcssmin/rjsmin - platformio.ini : version 0.0.2, extra_scripts pre:tools/minify_web.py, lib_deps ArduinoJson v7, suppression des chemins Windows - data/index.html : HTML minifié généré (3 789 octets, gain 22,6 %) https://claude.ai/code/session_01BpBsDWinsYCTLri3RkiDg3
feat(v0.0.2): WiFiMulti, OTA web, WebServer, minification HTML→SPIFFS
- include/web_interface.h : généré automatiquement par minify_web.py, contient INDEX_HTML[] PROGMEM (3 789 octets, gain 22,6 %) - src/main.cpp : serve INDEX_HTML via server.send_P() sans SPIFFS, supprime les dépendances SPIFFS.h et SPIFFS.begin() - tools/minify_web.py : génère maintenant include/web_interface.h en plus de data/index.html - platformio.ini : retire board_build.filesystem=spiffs (inutile) Plus aucune étape 'Upload Filesystem Image' requise. https://claude.ai/code/session_01BpBsDWinsYCTLri3RkiDg3
fix: HTML embarqué en PROGMEM via web_interface.h, suppression SPIFFS
- app_config.h : ajout de MDNS_HOSTNAME "gateway-lab-v1" - main.cpp : ArduinoOTA, MDNS.begin() et /api/status utilisent MDNS_HOSTNAME https://claude.ai/code/session_01BpBsDWinsYCTLri3RkiDg3
feat: MDNS_HOSTNAME centralisé dans app_config.h
…uche - include/web_interface_ota.h : nouveau header PROGMEM pour la page /update (OTA_PAGE), extrait de main.cpp - web_src/index.html : ajout ligne "mDNS" dans le cartouche réseau (hostname.local via /api/status), JS mis à jour en conséquence - include/web_interface.h : regénéré (mDNS row inclus, 3 992 octets) - src/main.cpp : remplace le bloc HTML inline par #include des deux headers https://claude.ai/code/session_01BpBsDWinsYCTLri3RkiDg3
refactor: page OTA déportée dans web_interface_ota.h, mDNS dans carto…
- web_src/ota.html : source lisible de la page OTA (extraite du header), respecte la convention web_src/ comme seul endroit pour éditer le HTML - tools/minify_web.py : traite maintenant N pages via table PAGES[] ; génère include/web_interface.h (INDEX_HTML) et include/web_interface_ota.h (OTA_PAGE) en une seule passe - include/web_interface_ota.h : regénéré depuis ota.html (2 483 octets, gain 22,8%) - CHANGELOG.md : historique v0.0.1 et v0.0.2 https://claude.ai/code/session_01BpBsDWinsYCTLri3RkiDg3
feat: web_src/ota.html source + minification dual-page + CHANGELOG
docs: enrichissement CHANGELOG v0.0.1 et v0.0.2 (sections Technique e…
There was a problem hiding this comment.
Pull request overview
Cette PR finalise une base fonctionnelle pour Gateway Lab V1 sur ESP32-S3, en ajoutant une interface web embarquée (PROGMEM), une API de statut, et un mécanisme de mise à jour OTA (ArduinoOTA + OTA via navigateur), avec génération automatique des assets web avant build.
Changes:
- Ajout de deux pages web (
/et/update) servies depuis la flash (PROGMEM) + APIGET /api/status. - Ajout de l’OTA dual-stack : ArduinoOTA (réseau) et OTA via WebServer +
Update(upload.bin). - Refonte/industrialisation de la minification HTML → génération de headers C++ via
tools/minify_web.pyexécuté en pre-script PlatformIO.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| web_src/index.html | Page d’accueil affichant l’état réseau et rafraîchissement via /api/status. |
| web_src/ota.html | Page d’upload firmware (OTA web) avec barre de progression. |
| tools/minify_web.py | Minifie HTML (CSS/JS inline) et génère des headers PROGMEM pour l’embarqué. |
| src/main.cpp | Implémentation WiFiMulti, mDNS, ArduinoOTA, WebServer + routes /, /api/status, /update. |
| platformio.ini | Ajout du pre-script de minification, bump version, ajout ArduinoJson v7. |
| include/web_interface.h | Header généré contenant INDEX_HTML en PROGMEM. |
| include/web_interface_ota.h | Header généré contenant OTA_PAGE en PROGMEM. |
| include/app_config.h | Ajout MDNS_HOSTNAME et flags features (OTA/Web/mDNS). |
| data/index.html | Copie minifiée optionnelle de la page d’accueil. |
| data/.gitkeep | Placeholder du dossier data/. |
| CHANGELOG.md | Nouveau changelog décrivant v0.0.1 et v0.0.2. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| static void handleOtaUploadDone() { | ||
| server.sendHeader("Connection", "close"); | ||
| server.send(200, "text/plain", Update.hasError() ? "FAIL" : "OK"); | ||
| delay(500); | ||
| ESP.restart(); | ||
| } |
| static void setupWebServer() { | ||
| server.on("/", HTTP_GET, handleRoot); | ||
| server.on("/api/status", HTTP_GET, handleApiStatus); | ||
| server.on("/update", HTTP_GET, handleOtaGet); | ||
| server.on("/update", HTTP_POST, handleOtaUploadDone, handleOtaUpload); | ||
|
|
| if (WiFi.status() != WL_CONNECTED) { | ||
| wifiMulti.run(); | ||
| } | ||
|
|
||
| // put function definitions here: | ||
| int myFunction(int x, int y) { | ||
| return x + y; | ||
| } No newline at end of file | ||
| server.handleClient(); | ||
| } |
| xhr.upload.onprogress = function(e) { | ||
| document.getElementById('pg').style.display = 'block'; | ||
| document.getElementById('bar').style.width = (e.loaded / e.total * 100) + '%'; | ||
| }; |
| xhr.onload = function() { | ||
| var m = document.getElementById('msg'); | ||
| if (xhr.status === 200) { | ||
| m.style.color = '#10b981'; | ||
| m.textContent = 'Succès — redémarrage en cours…'; | ||
| } else { | ||
| m.style.color = '#ef4444'; | ||
| m.textContent = 'Erreur : ' + xhr.responseText; | ||
| } | ||
| }; |
| # Pages à traiter : (source, header_dest, const_name) | ||
| # --------------------------------------------------------------------------- |
| build_dir = C:/pio_builds/build | ||
| build_cache_dir = C:/pio_builds/cache | ||
|
|
||
| extra_scripts = pre:tools/minify_web.py | ||
|
|
| - `src/main.cpp` : implémentation complète (stub remplacé) | ||
| - `platformio.ini` : `PROJECT_VERSION` → `0.0.2`, ajout `lib_deps` (ArduinoJson v7), `extra_scripts` (minification pre-build), suppression des chemins Windows | ||
| - `tools/minify_web.py` : refonte complète — traite plusieurs pages, génère des headers PROGMEM paramétrables, dual-mode standalone/PlatformIO |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f534abe80f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| server.on("/", HTTP_GET, handleRoot); | ||
| server.on("/api/status", HTTP_GET, handleApiStatus); | ||
| server.on("/update", HTTP_GET, handleOtaGet); | ||
| server.on("/update", HTTP_POST, handleOtaUploadDone, handleOtaUpload); |
There was a problem hiding this comment.
Require auth before accepting web OTA uploads
When the device is connected to any Wi-Fi where another client can reach it, this POST route accepts /update and streams the body into Update without any password, session, or token check in setupWebServer; that lets any LAN client replace the firmware. Gate both the update page and upload handler behind authentication before processing OTA data.
Useful? React with 👍 / 👎.
| server.send(200, "text/plain", Update.hasError() ? "FAIL" : "OK"); | ||
| delay(500); | ||
| ESP.restart(); |
There was a problem hiding this comment.
Return an error status when OTA finalization fails
When Update.begin, Update.write, or Update.end fails for an invalid/truncated image or insufficient OTA space, this still returns HTTP 200 and then restarts. The new OTA page treats any 200 as success, so users see a successful update and get a reboot even though no firmware was applied; return a non-2xx status and only restart when !Update.hasError().
Useful? React with 👍 / 👎.
| if (WiFi.status() != WL_CONNECTED) { | ||
| wifiMulti.run(); |
There was a problem hiding this comment.
Start services after a delayed Wi-Fi connection
If the configured AP is unavailable during the initial 15-second boot window, the setup code skips web, mDNS, and ArduinoOTA startup; these reconnect lines can later obtain Wi-Fi, but nothing starts the skipped services afterward. In that scenario the device is connected but the new web UI and OTA endpoints remain unreachable until a reboot, so handle the disconnected-to-connected transition by starting the services once.
Useful? React with 👍 / 👎.
| build_dir = C:/pio_builds/build | ||
| build_cache_dir = C:/pio_builds/cache | ||
|
|
||
| extra_scripts = pre:tools/minify_web.py |
There was a problem hiding this comment.
Put the minifier script in the build environment
I checked the PlatformIO docs: [platformio] only lists core generic/directory options, while extra_scripts is documented under [env] advanced options as the PRE/POST script list. With this line in [platformio], the pre-build minifier will not be attached to esp32s3_n16r8, so edits to web_src/*.html can silently compile stale generated headers unless someone runs the script manually.
Useful? React with 👍 / 👎.
|
Version 0.0.2 — Mise en place complète de l’infrastructure réseau, OTA et Web Cette version introduit la structure fonctionnelle de base du projet Gateway Lab V1 : Ajout de WiFiMulti, ArduinoOTA, mDNS, WebServer et des routes API/OTA Mise en place du système HTML embarqué en PROGMEM, sans SPIFFS Pages web (index.html + ota.html) minifiées automatiquement et injectées dans le firmware Implémentation complète du main.cpp Refonte du script minify_web.py (multi-pages, dual-mode, headers PROGMEM) Ajout de app_config.h, mise à jour du platformio.ini, nettoyage des chemins Windows Architecture web stabilisée et extensible Cette release pose les fondations du firmware : réseau robuste, OTA dual-stack, serveur web minimaliste, API JSON, et pipeline de build entièrement automatisé. |
feat(core): intégration complète WiFiMulti, OTA, WebServer et pipeline HTML embarqué - Ajout WiFiMulti (multi-SSID, reconnexion non bloquante) - Ajout ArduinoOTA + page OTA HTTP (upload .bin) - Ajout WebServer (/, /api/status, /update) - Ajout mDNS (hostname configurable) - Pages web index/OTA minifiées et injectées en PROGMEM - Implémentation complète du main.cpp - Refonte du script minify_web.py (multi-pages, dual-mode) - Mise à jour platformio.ini (PROJECT_VERSION=0.0.2, lib_deps, extra_scripts) - Nettoyage des chemins Windows - Ajout app_config.h et mise à jour de la structure du projet
feat(core): intégration complète WiFiMulti, OTA, WebServer et pipeline HTML embarqué - Ajout WiFiMulti (multi-SSID, reconnexion non bloquante) - Ajout ArduinoOTA + page OTA HTTP (upload .bin) - Ajout WebServer (/, /api/status, /update) - Ajout mDNS (hostname configurable) - Pages web index/OTA minifiées et injectées en PROGMEM - Implémentation complète du main.cpp - Refonte du script minify_web.py (multi-pages, dual-mode) - Mise à jour platformio.ini (PROJECT_VERSION=0.0.2, lib_deps, extra_scripts) - Nettoyage des chemins Windows - Ajout app_config.h et mise à jour de la structure du projet
feat(core): intégration complète WiFiMulti, OTA, WebServer et pipeline HTML embarqué - Ajout WiFiMulti (multi-SSID, reconnexion non bloquante) - Ajout ArduinoOTA + page OTA HTTP (upload .bin) - Ajout WebServer (/, /api/status, /update) - Ajout mDNS (hostname configurable) - Pages web index/OTA minifiées et injectées en PROGMEM - Implémentation complète du main.cpp - Refonte du script minify_web.py (multi-pages, dual-mode) - Mise à jour platformio.ini (PROJECT_VERSION=0.0.2, lib_deps, extra_scripts) - Nettoyage des chemins Windows - Ajout app_config.h et mise à jour de la structure du projet
Structure de base du projet finalisée.