firmware: v12 — quitar setBufferSizes ESP8266 OTA
setBufferSizes(512,512) rechazaba records TLS > 512 bytes durante la descarga del binario. La primera OTA exitosa no usaba setBufferSizes. Eliminadas todas las llamadas — buffers por defecto de BearSSL. Se mantiene el scope block que libera el cliente de version.txt antes de crear el cliente de descarga. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
// ================================================================
|
// ================================================================
|
||||||
// OTA CONFIG
|
// OTA CONFIG
|
||||||
// ================================================================
|
// ================================================================
|
||||||
#define FW_VERSION 11
|
#define FW_VERSION 12
|
||||||
#define GITEA_HOST "https://git.nacho.myds.me"
|
#define GITEA_HOST "https://git.nacho.myds.me"
|
||||||
#define GITEA_OWNER "Natxo"
|
#define GITEA_OWNER "Natxo"
|
||||||
#define GITEA_REPO "Arduino-Car"
|
#define GITEA_REPO "Arduino-Car"
|
||||||
@@ -64,11 +64,12 @@ static void checkOTA() {
|
|||||||
// ── Bloque de scope: libera el cliente BearSSL antes de la descarga ──
|
// ── Bloque de scope: libera el cliente BearSSL antes de la descarga ──
|
||||||
// BearSSL ocupa ~20KB de heap. Si los dos clientes coexisten el heap
|
// BearSSL ocupa ~20KB de heap. Si los dos clientes coexisten el heap
|
||||||
// se agota y ESPhttpUpdate falla silenciosamente.
|
// se agota y ESPhttpUpdate falla silenciosamente.
|
||||||
|
// Scope block: destruye el cliente BearSSL antes de crear el de descarga
|
||||||
|
// Libera ~20KB de heap (BearSSL con buffers por defecto) para la descarga
|
||||||
int remoteVer = 0;
|
int remoteVer = 0;
|
||||||
{
|
{
|
||||||
BearSSL::WiFiClientSecure client;
|
BearSSL::WiFiClientSecure client;
|
||||||
client.setInsecure();
|
client.setInsecure();
|
||||||
client.setBufferSizes(512, 512); // buffers mínimos — suficiente para la respuesta
|
|
||||||
HTTPClient http;
|
HTTPClient http;
|
||||||
http.begin(client, base + "version.txt" + token);
|
http.begin(client, base + "version.txt" + token);
|
||||||
http.setTimeout(10000);
|
http.setTimeout(10000);
|
||||||
@@ -79,7 +80,7 @@ static void checkOTA() {
|
|||||||
remoteVer = body.toInt();
|
remoteVer = body.toInt();
|
||||||
}
|
}
|
||||||
http.end();
|
http.end();
|
||||||
} // ← client y http se destruyen aquí, ~20KB liberados
|
} // client destruido aquí — heap recuperado
|
||||||
|
|
||||||
if (remoteVer > FW_VERSION) {
|
if (remoteVer > FW_VERSION) {
|
||||||
// 4 pitidos = ESP8266 actualizando
|
// 4 pitidos = ESP8266 actualizando
|
||||||
@@ -99,10 +100,6 @@ static void checkOTA() {
|
|||||||
|
|
||||||
BearSSL::WiFiClientSecure updateClient;
|
BearSSL::WiFiClientSecure updateClient;
|
||||||
updateClient.setInsecure();
|
updateClient.setInsecure();
|
||||||
// 4096 bytes de entrada: necesario para records TLS de datos grandes.
|
|
||||||
// 512 bytes de salida: suficiente para peticiones HTTP.
|
|
||||||
// El scope block anterior liberó ~10KB del primer cliente — hay heap.
|
|
||||||
updateClient.setBufferSizes(4096, 512);
|
|
||||||
ESPhttpUpdate.setFollowRedirects(HTTPC_STRICT_FOLLOW_REDIRECTS);
|
ESPhttpUpdate.setFollowRedirects(HTTPC_STRICT_FOLLOW_REDIRECTS);
|
||||||
ESPhttpUpdate.rebootOnUpdate(true);
|
ESPhttpUpdate.rebootOnUpdate(true);
|
||||||
ESPhttpUpdate.update(updateClient, base + "firmware.bin" + token);
|
ESPhttpUpdate.update(updateClient, base + "firmware.bin" + token);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
// ================================================================
|
// ================================================================
|
||||||
// OTA CONFIG
|
// OTA CONFIG
|
||||||
// ================================================================
|
// ================================================================
|
||||||
#define FW_VERSION 11
|
#define FW_VERSION 12
|
||||||
#define GITEA_HOST "https://git.nacho.myds.me"
|
#define GITEA_HOST "https://git.nacho.myds.me"
|
||||||
#define GITEA_OWNER "Natxo"
|
#define GITEA_OWNER "Natxo"
|
||||||
#define GITEA_REPO "Arduino-Car"
|
#define GITEA_REPO "Arduino-Car"
|
||||||
|
|||||||
Binary file not shown.
@@ -1 +1 @@
|
|||||||
11
|
12
|
||||||
Binary file not shown.
@@ -1 +1 @@
|
|||||||
11
|
12
|
||||||
Reference in New Issue
Block a user