From 66048d5f9471c38912f9a52a5ea53b6c7cbd358e Mon Sep 17 00:00:00 2001 From: Luis Fernando Sauthier Date: Thu, 18 Dec 2025 19:24:06 -0300 Subject: [PATCH] atualizacao 18/12/2025 --- git add .bat | 2 +- src/configuracoes.h | 5 +++++ src/controle.h | 9 +++++++-- src/webserver.h | 9 ++++++--- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/git add .bat b/git add .bat index d9a0c17..f1e3495 100644 --- a/git add .bat +++ b/git add .bat @@ -1,3 +1,3 @@ git add . -git commit -m "atualizacao automatica" +git commit -m "atualizacao 18/12/2025" git push diff --git a/src/configuracoes.h b/src/configuracoes.h index 8aab022..676f16a 100644 --- a/src/configuracoes.h +++ b/src/configuracoes.h @@ -1,3 +1,6 @@ +#ifndef CONFIGURACOES_H +#define CONFIGURACOES_H + // Controle de depuração global // Defina `DEBUG_ENABLED` como 1 para habilitar logs e instrumentação // (ativa a macro `DEBUG`, habilitando `LOG/LOGLN` e trechos `#ifdef DEBUG`). @@ -46,3 +49,5 @@ // Sinalização de redraw do menu principal (extern definida em _principal.cpp) extern bool menuRedrawPending; + +#endif // CONFIGURACOES_H diff --git a/src/controle.h b/src/controle.h index 3ccda09..395b464 100644 --- a/src/controle.h +++ b/src/controle.h @@ -3,10 +3,15 @@ extern bool menuRedrawPending; void abastecimento() { - StaticJsonDocument Json; + LOG(F("FreeStack antes alloc: ")); + LOGLN(FreeStack()); + + // Reduzido para 512 para economizar RAM (antes 800 estava travando) + const size_t JSON_BUFFER_SIZE = 512; + StaticJsonDocument Json; String msgID = generateUID(); - char pub_message[MQTT_MAX_PACKET_SIZE]; + char pub_message[JSON_BUFFER_SIZE]; const char* folder = "envios"; char path[64]; diff --git a/src/webserver.h b/src/webserver.h index b704e77..ce4d40f 100644 --- a/src/webserver.h +++ b/src/webserver.h @@ -549,10 +549,13 @@ void atualizaEnviosPendentes( String mensagem) void enviarAbastecimento() { LOGLN(F("Enviando dados de abastecimento pendente")); + LOG(F("FreeStack inicio: ")); + LOGLN(FreeStack()); - StaticJsonDocument<600> Json; - char in_message[MQTT_MAX_PACKET_SIZE]; - char out_message[MQTT_MAX_PACKET_SIZE]; + const size_t JSON_BUFFER_SIZE = 512; + StaticJsonDocument Json; + char in_message[JSON_BUFFER_SIZE]; + char out_message[JSON_BUFFER_SIZE]; byte tentativas = 0;