Add grid and EVSE meter components with load balancer
This commit is contained in:
22
components/gridmeter/src/gridmeter_modbus.c
Normal file
22
components/gridmeter/src/gridmeter_modbus.c
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "gridmeter.h"
|
||||
#include "orno_modbus.h"
|
||||
#include "esp_event.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
static const char *TAG = "gridmeter_modbus";
|
||||
|
||||
esp_err_t gridmeter_init(void)
|
||||
{
|
||||
ESP_LOGI(TAG, "Initializing grid meter (Modbus)");
|
||||
return orno_modbus_init();
|
||||
}
|
||||
|
||||
esp_err_t gridmeter_read_current(float *current)
|
||||
{
|
||||
esp_err_t err = orno_modbus_read_current(ORNO_METER_GRID, current);
|
||||
if (err == ESP_OK)
|
||||
{
|
||||
esp_event_post(GRIDMETER_EVENT, GRIDMETER_EVENT_UPDATE, current, sizeof(float), portMAX_DELAY);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
Reference in New Issue
Block a user