Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Piet Gömpel <[email protected]>
Signed-off-by: Kai Hermann <[email protected]>
  • Loading branch information
hikinggrass and Pietfried authored Feb 22, 2024
1 parent b26ca75 commit 6f20c95
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions modules/OCPP201/OCPP201.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ ocpp::v201::MeterValue get_meter_value(const types::powermeter::Powermeter& powe
if (power_meter.energy_Wh_export.value().L1.has_value()) {
sampled_value = get_sampled_value(reading_context, ocpp::v201::MeasurandEnum::Energy_Active_Export_Register,
"Wh", ocpp::v201::PhaseEnum::L1);
sampled_value.value = power_meter.energy_Wh_import.L1.value();
sampled_value.value = power_meter.energy_Wh_export.L1.value();
if (power_meter.energy_Wh_export_signed.has_value()) {
const auto& energy_Wh_export_signed = power_meter.energy_Wh_export_signed.value();
if (energy_Wh_export_signed.L1.has_value()) {
Expand All @@ -227,7 +227,7 @@ ocpp::v201::MeterValue get_meter_value(const types::powermeter::Powermeter& powe
if (power_meter.energy_Wh_export.value().L2.has_value()) {
sampled_value = get_sampled_value(reading_context, ocpp::v201::MeasurandEnum::Energy_Active_Export_Register,
"Wh", ocpp::v201::PhaseEnum::L2);
sampled_value.value = power_meter.energy_Wh_import.L2.value();
sampled_value.value = power_meter.energy_Wh_export.L2.value();
if (power_meter.energy_Wh_export_signed.has_value()) {
const auto& energy_Wh_export_signed = power_meter.energy_Wh_export_signed.value();
if (energy_Wh_export_signed.L2.has_value()) {
Expand All @@ -239,7 +239,7 @@ ocpp::v201::MeterValue get_meter_value(const types::powermeter::Powermeter& powe
if (power_meter.energy_Wh_export.value().L3.has_value()) {
sampled_value = get_sampled_value(reading_context, ocpp::v201::MeasurandEnum::Energy_Active_Export_Register,
"Wh", ocpp::v201::PhaseEnum::L3);
sampled_value.value = power_meter.energy_Wh_import.L3.value();
sampled_value.value = power_meter.energy_Wh_export.L3.value();
if (power_meter.energy_Wh_export_signed.has_value()) {
const auto& energy_Wh_export_signed = power_meter.energy_Wh_export_signed.value();
if (energy_Wh_export_signed.L3.has_value()) {
Expand All @@ -265,7 +265,7 @@ ocpp::v201::MeterValue get_meter_value(const types::powermeter::Powermeter& powe
if (power_meter.power_W.value().L1.has_value()) {
sampled_value = get_sampled_value(reading_context, ocpp::v201::MeasurandEnum::Power_Active_Import, "W",
ocpp::v201::PhaseEnum::L1);
sampled_value.value = power_meter.energy_Wh_import.L1.value();
sampled_value.value = power_meter.power_W.L1.value();
if (power_meter.power_W_signed.has_value()) {
const auto& power_W_signed = power_meter.power_W_signed.value();
if (power_W_signed.L1.has_value()) {
Expand All @@ -277,7 +277,7 @@ ocpp::v201::MeterValue get_meter_value(const types::powermeter::Powermeter& powe
if (power_meter.power_W.value().L2.has_value()) {
sampled_value = get_sampled_value(reading_context, ocpp::v201::MeasurandEnum::Power_Active_Import, "W",
ocpp::v201::PhaseEnum::L2);
sampled_value.value = power_meter.energy_Wh_import.L2.value();
sampled_value.value = power_meter.power_W.L2.value();
if (power_meter.power_W_signed.has_value()) {
const auto& power_W_signed = power_meter.power_W_signed.value();
if (power_W_signed.L2.has_value()) {
Expand All @@ -289,7 +289,7 @@ ocpp::v201::MeterValue get_meter_value(const types::powermeter::Powermeter& powe
if (power_meter.power_W.value().L3.has_value()) {
sampled_value = get_sampled_value(reading_context, ocpp::v201::MeasurandEnum::Power_Active_Import, "W",
ocpp::v201::PhaseEnum::L3);
sampled_value.value = power_meter.energy_Wh_import.L3.value();
sampled_value.value = power_meter.power_W.L3.value();
if (power_meter.power_W_signed.has_value()) {
const auto& power_W_signed = power_meter.power_W_signed.value();
if (power_W_signed.L3.has_value()) {
Expand All @@ -315,7 +315,7 @@ ocpp::v201::MeterValue get_meter_value(const types::powermeter::Powermeter& powe
if (power_meter.VAR.value().L1.has_value()) {
sampled_value = get_sampled_value(reading_context, ocpp::v201::MeasurandEnum::Power_Reactive_Import, "var",
ocpp::v201::PhaseEnum::L1);
sampled_value.value = power_meter.energy_Wh_import.L1.value();
sampled_value.value = power_meter.VAR.value().L1.value();
if (power_meter.VAR_signed.has_value()) {
const auto& VAR_signed = power_meter.VAR_signed.value();
if (VAR_signed.L1.has_value()) {
Expand All @@ -327,7 +327,7 @@ ocpp::v201::MeterValue get_meter_value(const types::powermeter::Powermeter& powe
if (power_meter.VAR.value().L2.has_value()) {
sampled_value = get_sampled_value(reading_context, ocpp::v201::MeasurandEnum::Power_Reactive_Import, "var",
ocpp::v201::PhaseEnum::L2);
sampled_value.value = power_meter.energy_Wh_import.L2.value();
sampled_value.value = power_meter.VAR.value().L2.value();
if (power_meter.VAR_signed.has_value()) {
const auto& VAR_signed = power_meter.VAR_signed.value();
if (VAR_signed.L2.has_value()) {
Expand All @@ -339,7 +339,7 @@ ocpp::v201::MeterValue get_meter_value(const types::powermeter::Powermeter& powe
if (power_meter.VAR.value().L3.has_value()) {
sampled_value = get_sampled_value(reading_context, ocpp::v201::MeasurandEnum::Power_Reactive_Import, "var",
ocpp::v201::PhaseEnum::L3);
sampled_value.value = power_meter.energy_Wh_import.L3.value();
sampled_value.value = power_meter.VAR.value().L3.value();
if (power_meter.VAR_signed.has_value()) {
const auto& VAR_signed = power_meter.VAR_signed.value();
if (VAR_signed.L3.has_value()) {
Expand Down

0 comments on commit 6f20c95

Please sign in to comment.