Rename meter component to ade7758 and update integration
This commit is contained in:
0
components/meter/CMakeLists.txt → components/ade7758/CMakeLists.txt
Executable file → Normal file
0
components/meter/CMakeLists.txt → components/ade7758/CMakeLists.txt
Executable file → Normal file
0
components/meter/include/ade7758.h → components/ade7758/include/ade7758.h
Executable file → Normal file
0
components/meter/include/ade7758.h → components/ade7758/include/ade7758.h
Executable file → Normal file
0
components/meter/include/meter.h → components/ade7758/include/meter.h
Executable file → Normal file
0
components/meter/include/meter.h → components/ade7758/include/meter.h
Executable file → Normal file
0
components/meter/src/ade7758.c → components/ade7758/src/ade7758.c
Executable file → Normal file
0
components/meter/src/ade7758.c → components/ade7758/src/ade7758.c
Executable file → Normal file
0
components/meter/src/energy_meter.c → components/ade7758/src/energy_meter.c
Executable file → Normal file
0
components/meter/src/energy_meter.c → components/ade7758/src/energy_meter.c
Executable file → Normal file
0
components/meter/src/meter.c → components/ade7758/src/meter.c
Executable file → Normal file
0
components/meter/src/meter.c → components/ade7758/src/meter.c
Executable file → Normal file
@@ -6,4 +6,4 @@ set(srcs
|
|||||||
|
|
||||||
idf_component_register(SRCS "${srcs}"
|
idf_component_register(SRCS "${srcs}"
|
||||||
INCLUDE_DIRS "include"
|
INCLUDE_DIRS "include"
|
||||||
REQUIRES meter_orno_modbus)
|
REQUIRES meter_orno_modbus ade7758)
|
||||||
|
|||||||
@@ -1,12 +1,30 @@
|
|||||||
#include "evsemeter.h"
|
#include "evsemeter.h"
|
||||||
#include "esp_event.h"
|
#include "esp_event.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
|
#include "ade7758.h"
|
||||||
|
|
||||||
|
#define PIN_NUM_CLK 15
|
||||||
|
#define PIN_NUM_MOSI 2
|
||||||
|
#define PIN_NUM_MISO 4
|
||||||
|
#define PIN_NUM_CS 23
|
||||||
|
#define EEPROM_HOST HSPI_HOST
|
||||||
|
|
||||||
|
#define IRMS_CAL 53416.0f
|
||||||
|
|
||||||
static const char *TAG = "evsemeter_ade7758";
|
static const char *TAG = "evsemeter_ade7758";
|
||||||
|
|
||||||
esp_err_t evsemeter_init(void)
|
esp_err_t evsemeter_init(void)
|
||||||
{
|
{
|
||||||
ESP_LOGI(TAG, "Initializing EVSE meter (ADE7758)");
|
ESP_LOGI(TAG, "Initializing EVSE meter (ADE7758)");
|
||||||
|
|
||||||
|
ESP_ERROR_CHECK(Init(EEPROM_HOST, PIN_NUM_MISO, PIN_NUM_MOSI, PIN_NUM_CLK));
|
||||||
|
ESP_ERROR_CHECK(InitSpi(PIN_NUM_CS));
|
||||||
|
|
||||||
|
gainSetup(INTEGRATOR_OFF, FULLSCALESELECT_0_5V, GAIN_1, GAIN_1);
|
||||||
|
setupDivs(1, 1, 1);
|
||||||
|
setLcycMode(0x00);
|
||||||
|
resetStatus();
|
||||||
|
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -15,7 +33,8 @@ esp_err_t evsemeter_read_current(float *current)
|
|||||||
if (!current) {
|
if (!current) {
|
||||||
return ESP_ERR_INVALID_ARG;
|
return ESP_ERR_INVALID_ARG;
|
||||||
}
|
}
|
||||||
*current = 0.0f;
|
|
||||||
|
*current = airms() / IRMS_CAL;
|
||||||
esp_event_post(EVSEMETER_EVENT, EVSEMETER_EVENT_UPDATE, current, sizeof(float), portMAX_DELAY);
|
esp_event_post(EVSEMETER_EVENT, EVSEMETER_EVENT_UPDATE, current, sizeof(float), portMAX_DELAY);
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,4 +5,4 @@ set(srcs
|
|||||||
idf_component_register(SRCS "${srcs}"
|
idf_component_register(SRCS "${srcs}"
|
||||||
INCLUDE_DIRS "include"
|
INCLUDE_DIRS "include"
|
||||||
PRIV_REQUIRES nvs_flash
|
PRIV_REQUIRES nvs_flash
|
||||||
REQUIRES config esp_wifi evse meter mongoose MicroOcpp MicroOcppMongoose)
|
REQUIRES config esp_wifi evse ade7758 mongoose MicroOcpp MicroOcppMongoose)
|
||||||
|
|||||||
@@ -19,4 +19,4 @@ set(srcs
|
|||||||
idf_component_register(SRCS "${srcs}"
|
idf_component_register(SRCS "${srcs}"
|
||||||
INCLUDE_DIRS "include"
|
INCLUDE_DIRS "include"
|
||||||
PRIV_REQUIRES nvs_flash driver esp_adc esp_timer
|
PRIV_REQUIRES nvs_flash driver esp_adc esp_timer
|
||||||
REQUIRES config evse api meter ntc_driver)
|
REQUIRES config evse api ade7758 ntc_driver)
|
||||||
|
|||||||
Reference in New Issue
Block a user