feat(firmware): 扩展 MeterValuesSampledData 配置以支持更多测量数据
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include <MicroOcpp.h>
|
||||
#include <MicroOcppMongooseClient.h>
|
||||
#include <MicroOcpp/Core/Context.h>
|
||||
#include <MicroOcpp/Core/Configuration.h>
|
||||
|
||||
#include <Adafruit_SSD1306.h>
|
||||
#include <SmartLeds.h>
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user