From 59986e0dcd7f518a80566366ed4954608418cf9f Mon Sep 17 00:00:00 2001 From: Michal Polanski Date: Wed, 18 Dec 2024 11:07:35 +0100 Subject: [PATCH 1/2] Fix missing phase angle and missing translation in EM introducion --- .../ElectricityMeterGeneralStateHandler.swift | 4 ++-- .../ElectricityMeterDetail/History/IntroductionView.swift | 8 ++++---- .../Channel/SuplaElectricityMeasurementType.swift | 4 ++-- SUPLA/SAElectricityMeterExtendedValue.h | 4 ++-- SUPLA/SAElectricityMeterExtendedValue.m | 8 ++++---- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/SUPLA/Features/Details/DetailBase/ElectricityMeter/ElectricityMeterGeneralStateHandler.swift b/SUPLA/Features/Details/DetailBase/ElectricityMeter/ElectricityMeterGeneralStateHandler.swift index 0862c43d..6caf6882 100644 --- a/SUPLA/Features/Details/DetailBase/ElectricityMeter/ElectricityMeterGeneralStateHandler.swift +++ b/SUPLA/Features/Details/DetailBase/ElectricityMeter/ElectricityMeterGeneralStateHandler.swift @@ -182,13 +182,13 @@ final class ElectricityMeterGeneralStateHandlerImpl: ElectricityMeterGeneralStat if (measuredValues.contains(.voltagePhaseAngle12)) { result.append(.init( type: .voltagePhaseAngle12, - value: formatter.format(value.voltagePhaseAngle12(), withUnit: false, precision: SuplaElectricityMeasurementType.voltagePhaseAngle12.precision) + value: formatter.format(value.voltagePhaseAngle12(), withUnit: false, precision: .customPrecision(value: SuplaElectricityMeasurementType.voltagePhaseAngle12.precision)) )) } if (measuredValues.contains(.voltagePhaseAngle13)) { result.append(.init( type: .voltagePhaseAngle13, - value: formatter.format(value.voltagePhaseAngle13(), withUnit: false, precision: SuplaElectricityMeasurementType.voltagePhaseAngle13.precision) + value: formatter.format(value.voltagePhaseAngle13(), withUnit: false, precision: .customPrecision(value: SuplaElectricityMeasurementType.voltagePhaseAngle13.precision)) )) } if (measuredValues.contains(.voltagePhaseSequence)) { diff --git a/SUPLA/Features/Details/ElectricityMeterDetail/History/IntroductionView.swift b/SUPLA/Features/Details/ElectricityMeterDetail/History/IntroductionView.swift index 262a90c7..5bd91365 100644 --- a/SUPLA/Features/Details/ElectricityMeterDetail/History/IntroductionView.swift +++ b/SUPLA/Features/Details/ElectricityMeterDetail/History/IntroductionView.swift @@ -212,7 +212,7 @@ private func mockSetsForMultiplePhases() -> ChannelChartSets { return ChannelChartSets( remoteId: 124, function: 123, - name: "Reverse active energy", + name: Strings.ElectricityMeter.forwardActiveEnergy, aggregation: .minutes, dataSets: [ HistoryDataSet( @@ -241,7 +241,7 @@ private func mockSetsForMultiplePhases() -> ChannelChartSets { active: true ) ], - typeName: "Reverse active energy" + typeName: Strings.ElectricityMeter.forwardActiveEnergy ) } @@ -251,7 +251,7 @@ private func mockSetsForSinglePhase() -> ChannelChartSets { return ChannelChartSets( remoteId: 124, function: 123, - name: "Reverse active energy", + name: Strings.ElectricityMeter.forwardActiveEnergy, aggregation: .minutes, dataSets: [ HistoryDataSet( @@ -270,7 +270,7 @@ private func mockSetsForSinglePhase() -> ChannelChartSets { active: true ) ], - typeName: "Reverse active energy" + typeName: Strings.ElectricityMeter.forwardActiveEnergy ) } diff --git a/SUPLA/Model/SuplaClient/Channel/SuplaElectricityMeasurementType.swift b/SUPLA/Model/SuplaClient/Channel/SuplaElectricityMeasurementType.swift index a8990384..692140d6 100644 --- a/SUPLA/Model/SuplaClient/Channel/SuplaElectricityMeasurementType.swift +++ b/SUPLA/Model/SuplaClient/Channel/SuplaElectricityMeasurementType.swift @@ -214,8 +214,6 @@ enum SuplaElectricityMeasurementType: Identifiable, Codable, CaseIterable, Picke var precision: Int { switch (self) { case .frequency, - .voltagePhaseAngle12, - .voltagePhaseAngle13, .voltagePhaseSequence, .currentPhaseSequence, .voltage, @@ -229,6 +227,8 @@ enum SuplaElectricityMeasurementType: Identifiable, Codable, CaseIterable, Picke .reverseActiveEnergy, .forwardReactiveEnergy, .reverseReactiveEnergy: 5 + case .voltagePhaseAngle12, + .voltagePhaseAngle13: 1 default: 0 } } diff --git a/SUPLA/SAElectricityMeterExtendedValue.h b/SUPLA/SAElectricityMeterExtendedValue.h index 47b12d0c..cfd3de51 100644 --- a/SUPLA/SAElectricityMeterExtendedValue.h +++ b/SUPLA/SAElectricityMeterExtendedValue.h @@ -41,8 +41,8 @@ NS_ASSUME_NONNULL_BEGIN - (double) totalReverseActiveEnergyBalanced; - (unsigned int) measuredValues; - (BOOL) currentIsOver65A; -- (int) voltagePhaseAngle12; -- (int) voltagePhaseAngle13; +- (double) voltagePhaseAngle12; +- (double) voltagePhaseAngle13; - (TElectricityMeter_ExtendedValue_V3) getStruct; @end diff --git a/SUPLA/SAElectricityMeterExtendedValue.m b/SUPLA/SAElectricityMeterExtendedValue.m index b36ebf4e..afccc244 100644 --- a/SUPLA/SAElectricityMeterExtendedValue.m +++ b/SUPLA/SAElectricityMeterExtendedValue.m @@ -166,12 +166,12 @@ - (BOOL) currentIsOver65A { && (_emev.measured_values & EM_VAR_CURRENT_OVER_65A) != 0; } -- (int) voltagePhaseAngle12 { - return _emev.voltage_phase_angle_12; +- (double) voltagePhaseAngle12 { + return _emev.voltage_phase_angle_12 / 10.0; } -- (int) voltagePhaseAngle13 { - return _emev.voltage_phase_angle_13; +- (double) voltagePhaseAngle13 { + return _emev.voltage_phase_angle_13 / 10.0; } - (TElectricityMeter_ExtendedValue_V3) getStruct { From e5eec050bd1352b8e1d6c93c4ca85994e4970dfb Mon Sep 17 00:00:00 2001 From: Przemek Zygmunt Date: Wed, 18 Dec 2024 20:31:33 +0100 Subject: [PATCH 2/2] Change version code to 216 --- SUPLA.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SUPLA.xcodeproj/project.pbxproj b/SUPLA.xcodeproj/project.pbxproj index 70b230f4..6973061d 100644 --- a/SUPLA.xcodeproj/project.pbxproj +++ b/SUPLA.xcodeproj/project.pbxproj @@ -8145,7 +8145,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = SUPLA/SUPLA.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 215; + CURRENT_PROJECT_VERSION = 216; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = T6ZPGSWA75; GCC_PREPROCESSOR_DEFINITIONS = ( @@ -8184,7 +8184,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = SUPLA/SUPLA.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 215; + CURRENT_PROJECT_VERSION = 216; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = T6ZPGSWA75; GCC_PREPROCESSOR_DEFINITIONS = (