new upgrade
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
// === Início de: components/evse/include/evse_error.h ===
|
||||
#ifndef EVSE_ERROR_H
|
||||
#define EVSE_ERROR_H
|
||||
|
||||
@@ -6,21 +5,23 @@
|
||||
#include <stdbool.h>
|
||||
#include "evse_pilot.h"
|
||||
|
||||
// Bits que auto-limpam passado um timeout
|
||||
#define EVSE_ERR_AUTO_CLEAR_BITS ( \
|
||||
EVSE_ERR_DIODE_SHORT_BIT | \
|
||||
EVSE_ERR_TEMPERATURE_HIGH_BIT | \
|
||||
EVSE_ERR_RCM_TRIGGERED_BIT)
|
||||
// ----------------------------------------------------
|
||||
// Holdoff interno pós-erro (sem expor "cooldown" ao resto)
|
||||
// ----------------------------------------------------
|
||||
// Após TODOS os erros reais desaparecerem (raw_bits == 0),
|
||||
// o módulo mantém o erro "visível" durante este tempo.
|
||||
// Durante este período, evse_get_error() continua != 0.
|
||||
#define EVSE_ERROR_COOLDOWN_MS 60000
|
||||
|
||||
// Error bits
|
||||
#define EVSE_ERR_DIODE_SHORT_BIT (1 << 0)
|
||||
#define EVSE_ERR_LOCK_FAULT_BIT (1 << 1)
|
||||
#define EVSE_ERR_UNLOCK_FAULT_BIT (1 << 2)
|
||||
#define EVSE_ERR_RCM_SELFTEST_FAULT_BIT (1 << 3)
|
||||
#define EVSE_ERR_RCM_TRIGGERED_BIT (1 << 4)
|
||||
#define EVSE_ERR_TEMPERATURE_HIGH_BIT (1 << 5)
|
||||
#define EVSE_ERR_PILOT_FAULT_BIT (1 << 6)
|
||||
#define EVSE_ERR_TEMPERATURE_FAULT_BIT (1 << 7)
|
||||
#define EVSE_ERR_DIODE_SHORT_BIT (1 << 0)
|
||||
#define EVSE_ERR_LOCK_FAULT_BIT (1 << 1)
|
||||
#define EVSE_ERR_UNLOCK_FAULT_BIT (1 << 2)
|
||||
#define EVSE_ERR_RCM_SELFTEST_FAULT_BIT (1 << 3)
|
||||
#define EVSE_ERR_RCM_TRIGGERED_BIT (1 << 4)
|
||||
#define EVSE_ERR_TEMPERATURE_HIGH_BIT (1 << 5)
|
||||
#define EVSE_ERR_PILOT_FAULT_BIT (1 << 6)
|
||||
#define EVSE_ERR_TEMPERATURE_FAULT_BIT (1 << 7)
|
||||
|
||||
// Inicialização do módulo de erros
|
||||
void evse_error_init(void);
|
||||
@@ -30,7 +31,7 @@ void evse_error_check(pilot_voltage_t pilot_voltage, bool is_n12v);
|
||||
void evse_temperature_check(void);
|
||||
void evse_error_tick(void);
|
||||
|
||||
// Leitura e controle de erros
|
||||
// Leitura e controle de erros (estado "visível" com holdoff)
|
||||
uint32_t evse_get_error(void);
|
||||
void evse_error_set(uint32_t bitmask);
|
||||
void evse_error_clear(uint32_t bitmask);
|
||||
@@ -40,12 +41,9 @@ uint32_t evse_error_get_bits(void);
|
||||
|
||||
// ----------------------------------------------------
|
||||
// Semântica sticky: flag "todos erros limpos"
|
||||
// (fica true quando o erro visível chega a 0; pode ser útil para UI/logs)
|
||||
// ----------------------------------------------------
|
||||
// Fica true quando TODOS os erros são limpos.
|
||||
// Volta a false assim que qualquer erro novo aparece.
|
||||
// Permanece true até o consumidor limpar explicitamente.
|
||||
bool evse_error_cleared_flag(void);
|
||||
void evse_error_reset_flag(void);
|
||||
|
||||
#endif // EVSE_ERROR_H
|
||||
// === Fim de: components/evse/include/evse_error.h ===
|
||||
|
||||
Reference in New Issue
Block a user