From becdf35a27e287701dca34b5f835fce1c8e09556 Mon Sep 17 00:00:00 2001 From: Siwat Sirichai Date: Mon, 12 Feb 2024 16:25:47 +0700 Subject: [PATCH] beta-ready CT code --- ESPMegaPRO-OS-SDK/lib/ESPMegaPRO/CurrentTransformerIoT.cpp | 3 +++ ESPMegaPRO-OS-SDK/src/main.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ESPMegaPRO-OS-SDK/lib/ESPMegaPRO/CurrentTransformerIoT.cpp b/ESPMegaPRO-OS-SDK/lib/ESPMegaPRO/CurrentTransformerIoT.cpp index 18f5571..f149df7 100644 --- a/ESPMegaPRO-OS-SDK/lib/ESPMegaPRO/CurrentTransformerIoT.cpp +++ b/ESPMegaPRO-OS-SDK/lib/ESPMegaPRO/CurrentTransformerIoT.cpp @@ -61,3 +61,6 @@ bool CurrentTransformerIoT::processSetEnergyMessage(char* topic, char* payload, return true; } +void CurrentTransformerIoT::handleCTCallback(float current, double energy) { + this->publishReport(); +} \ No newline at end of file diff --git a/ESPMegaPRO-OS-SDK/src/main.cpp b/ESPMegaPRO-OS-SDK/src/main.cpp index 7e1c6b9..957ec89 100644 --- a/ESPMegaPRO-OS-SDK/src/main.cpp +++ b/ESPMegaPRO-OS-SDK/src/main.cpp @@ -38,7 +38,7 @@ float adc2current(uint16_t adcValue) } AnalogCard analogCard = AnalogCard(); float voltage = 220.0; -CurrentTransformer ct = CurrentTransformer(&analogCard, 0, &voltage, adc2current, 1000); +CurrentTransformerCard ct = CurrentTransformerCard(&analogCard, 0, &voltage, adc2current, 1000); #endif #ifdef CLIMATE_CARD_ENABLE