fix evse_link
This commit is contained in:
@@ -2,42 +2,53 @@
|
||||
#define METER_EVENTS_H
|
||||
|
||||
#include "esp_event.h"
|
||||
#include "meter_manager.h" // Para meter_type_t
|
||||
#include <stdint.h> // Para int64_t
|
||||
#include "meter_manager.h" // meter_type_t
|
||||
#include <stdint.h> // int32_t, int64_t
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
// Base de eventos dos medidores
|
||||
ESP_EVENT_DECLARE_BASE(METER_EVENT);
|
||||
// Base de eventos dos medidores
|
||||
ESP_EVENT_DECLARE_BASE(METER_EVENT);
|
||||
|
||||
// IDs de eventos emitidos por medidores
|
||||
typedef enum {
|
||||
METER_EVENT_DATA_READY = 0,
|
||||
METER_EVENT_ERROR,
|
||||
METER_EVENT_STARTED,
|
||||
METER_EVENT_STOPPED,
|
||||
METER_EVENT_CONFIG_UPDATED // Novo: configuração (grid/evse) atualizada
|
||||
} meter_event_id_t;
|
||||
// IDs de eventos emitidos por medidores
|
||||
typedef enum
|
||||
{
|
||||
METER_EVENT_DATA_READY = 0,
|
||||
METER_EVENT_ERROR,
|
||||
METER_EVENT_STARTED,
|
||||
METER_EVENT_STOPPED,
|
||||
METER_EVENT_CONFIG_UPDATED
|
||||
} meter_event_id_t;
|
||||
|
||||
// Estrutura de dados enviados com METER_EVENT_DATA_READY
|
||||
typedef struct {
|
||||
const char *source; // "GRID" ou "EVSE"
|
||||
float vrms[3]; // Tensão por fase
|
||||
float irms[3]; // Corrente por fase
|
||||
int watt[3]; // Potência ativa por fase
|
||||
float frequency; // Frequência da rede (Hz)
|
||||
float power_factor; // Fator de potência
|
||||
float total_energy; // Energia acumulada (kWh)
|
||||
} meter_event_data_t;
|
||||
// Estrutura de dados enviados com METER_EVENT_DATA_READY
|
||||
// NOTA: campos não suportados pelo meter devem ficar a 0.
|
||||
typedef struct
|
||||
{
|
||||
const char *source; // "GRID" ou "EVSE"
|
||||
|
||||
// Estrutura de dados enviados com METER_EVENT_CONFIG_UPDATED
|
||||
typedef struct {
|
||||
meter_type_t grid_type; // Tipo de contador configurado para o GRID
|
||||
meter_type_t evse_type; // Tipo de contador configurado para a EVSE
|
||||
int64_t timestamp_us; // Momento da atualização (esp_timer_get_time)
|
||||
} meter_config_event_t;
|
||||
float vrms[3]; // V por fase (0 se não existir)
|
||||
float irms[3]; // A por fase (0 se não existir)
|
||||
|
||||
int32_t watt[3]; // W por fase (0 se não existir)
|
||||
int32_t watt_total; // W total ASSINADO: +import / -export (0 se não existir)
|
||||
|
||||
float frequency; // Hz (0 se não existir)
|
||||
float power_factor; // (0 se não existir)
|
||||
float total_energy; // kWh (0 se não existir)
|
||||
|
||||
int64_t timestamp_us; // esp_timer_get_time() (0 => consumidor pode usar "now")
|
||||
} meter_event_data_t;
|
||||
|
||||
// Estrutura de dados enviados com METER_EVENT_CONFIG_UPDATED
|
||||
typedef struct
|
||||
{
|
||||
meter_type_t grid_type;
|
||||
meter_type_t evse_type;
|
||||
int64_t timestamp_us; // esp_timer_get_time()
|
||||
} meter_config_event_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -17,7 +17,8 @@ typedef enum {
|
||||
METER_TYPE_DTS6619, // dts6619
|
||||
METER_TYPE_MONO_ZIGBEE, // Zigbee single-phase
|
||||
METER_TYPE_TRIF_ZIGBEE, // Zigbee three-phase
|
||||
METER_TYPE_EA777 // EA777
|
||||
METER_TYPE_EA777, // EA777
|
||||
METER_TYPE_DTS024M,
|
||||
} meter_type_t;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user