new meter
This commit is contained in:
38
components/meter_manager/include/meter_events.h
Normal file
38
components/meter_manager/include/meter_events.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#ifndef METER_EVENTS_H
|
||||
#define METER_EVENTS_H
|
||||
|
||||
#include "esp_event.h"
|
||||
#include "meter_manager.h" // Para meter_type_t
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// 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_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;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // METER_EVENTS_H
|
||||
Reference in New Issue
Block a user