From 3bdb3d7351c75b25b9c82a138ff77d8551e41b92 Mon Sep 17 00:00:00 2001 From: Timothy Yin Date: Mon, 20 Apr 2026 13:09:30 +0800 Subject: [PATCH] =?UTF-8?q?feat(firmware):=20=E6=89=A9=E5=B1=95=20MeterVal?= =?UTF-8?q?uesSampledData=20=E9=85=8D=E7=BD=AE=E4=BB=A5=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=9B=B4=E5=A4=9A=E6=B5=8B=E9=87=8F=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hardware/firmware/src/main.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hardware/firmware/src/main.cpp b/hardware/firmware/src/main.cpp index 7b2a991..01f038d 100644 --- a/hardware/firmware/src/main.cpp +++ b/hardware/firmware/src/main.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -1201,6 +1202,20 @@ void setup() { return s_meter_data_ready ? s_meter_b.powerFactor : 0.0f; }, "Power.Factor", nullptr, nullptr, nullptr, 2); + // MicroOcpp defaults MeterValuesSampledData to Energy + Power only. + // Expand sampled measurands so CSMS can receive voltage/current/PF/frequency/temperature. + static const char *kMeterValuesSampledData = + "Energy.Active.Import.Register,Power.Active.Import,Voltage,Current.Import,Power.Factor,Frequency,Temperature"; + if (auto *cfg = MicroOcpp::getConfigurationPublic("MeterValuesSampledData")) + { + cfg->setString(kMeterValuesSampledData); + } + if (auto *cfg = MicroOcpp::getConfigurationPublic("MeterValuesAlignedData")) + { + cfg->setString(kMeterValuesSampledData); + } + MicroOcpp::configuration_save(); + // Custom RemoteStartTransaction policy: // accept only when target connector is idle + operative + plugged. setRequestHandler(