From 9928e732ffd2bb8e4ef36af913fb510ec3e18d8b Mon Sep 17 00:00:00 2001 From: atef Date: Mon, 18 Sep 2023 11:15:18 +0200 Subject: [PATCH] Change TimeSinceTOC from Uint16 to TimeSpan --- .../Lib/Devices/Battery48TL/Battery48TlRecord.Api.cs | 11 +++++------ csharp/Lib/Devices/Battery48TL/Battery48TlRecords.cs | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/csharp/Lib/Devices/Battery48TL/Battery48TlRecord.Api.cs b/csharp/Lib/Devices/Battery48TL/Battery48TlRecord.Api.cs index e1bbe7d92..56e43bc9a 100644 --- a/csharp/Lib/Devices/Battery48TL/Battery48TlRecord.Api.cs +++ b/csharp/Lib/Devices/Battery48TL/Battery48TlRecord.Api.cs @@ -12,7 +12,6 @@ using Strings = IReadOnlyList; [SuppressMessage("ReSharper", "ConvertToAutoProperty")] public partial class Battery48TlRecord { - private UInt16 OneWeekInMinutes => 10080; public Dc_ Dc => new Dc_(this); public Leds_ Leds => new Leds_(this); public Temperatures_ Temperatures => new Temperatures_(this); @@ -31,12 +30,12 @@ public partial class Battery48TlRecord // Time since TOC is a counter from the last moment when the battery reached EOC // When The battery is full charged (reached EOC) the Time Since TOC is set to 0 - public UInt16 TimeSinceTOC => _TimeSinceToc; - public Current BusCurrent => _BusCurrent; - public Current HeatingCurrent => _BusCurrent - _CellsCurrent; - public DcPower HeatingPower => HeatingCurrent * Dc.Voltage; + public TimeSpan TimeSinceTOC => TimeSpan.FromMinutes(_TimeSinceToc); + public Current BusCurrent => _BusCurrent; + public Current HeatingCurrent => _BusCurrent - _CellsCurrent; + public DcPower HeatingPower => HeatingCurrent * Dc.Voltage; - public Boolean CalibrationChargeRequested => TimeSinceTOC > OneWeekInMinutes; + public Boolean CalibrationChargeRequested => TimeSinceTOC > TimeSpan.FromDays(7); public readonly struct Leds_ { diff --git a/csharp/Lib/Devices/Battery48TL/Battery48TlRecords.cs b/csharp/Lib/Devices/Battery48TL/Battery48TlRecords.cs index 84129e61e..7053f295e 100644 --- a/csharp/Lib/Devices/Battery48TL/Battery48TlRecords.cs +++ b/csharp/Lib/Devices/Battery48TL/Battery48TlRecords.cs @@ -14,7 +14,7 @@ public class Battery48TlRecords public required Percent CurrentMinSoc { get; init; } public required Temperature Temperature { get; init; } public required DcPower HeatingPower { get; init; } - public required UInt16 TimeSinceToc { get; init; } + public required TimeSpan TimeSinceToc { get; init; } public required Boolean CalibrationChargeRequested { get; init; } public required IReadOnlyList Devices { get; init; }