chore: snapshot before shared RS485 bus integration

This commit is contained in:
2026-07-22 15:36:04 +01:00
parent ef02e5c5f5
commit 2a803fcef1
167 changed files with 5749 additions and 1128 deletions

17
components/protocols/include/mqtt.h Executable file → Normal file
View File

@@ -16,30 +16,17 @@ extern "C"
#define MQTT_USERNAME_MAX_LEN 32
#define MQTT_PASSWORD_MAX_LEN 64
// =============================
// Limit modes (cmd/evse/limit)
// =============================
typedef enum
{
LIMIT_MODE_OFF = 0, ///< sem limite, usa max do hardware
LIMIT_MODE_MANUAL, ///< corrente fixa definida pelo utilizador
LIMIT_MODE_LOADBALANCER, ///< limita pelo contador da instalação
LIMIT_MODE_SOLAR ///< só com excedente FV
} limit_mode_t;
/**
* @brief Inicializa o módulo MQTT.
*
* - Carrega configuração da NVS
* - Regista handlers de eventos (AUTH, SCHED, LOADBALANCER, METER, EVSE, NETWORK)
* - Cria a task de telemetria periódica
* - Aplica o modo de limite persistido
*
* Não inicia a ligação ao broker imediatamente; isso acontece quando existir IP
* (NETWORK_EVENT_STA_GOT_IP) e `enabled == true`.
*
* IMPORTANTE: chamar DEPOIS de loadbalancer_init() para o restauro do modo
* de limite funcionar correctamente.
* IMPORTANTE: chamar DEPOIS de loadbalancer_init() para o estado publicado
* refletir a política local já restaurada.
*/
esp_err_t mqtt_init(void);