Add an config input to display iundvidual batteries
This commit is contained in:
parent
1d6aafec60
commit
71fb914c41
|
@ -16,6 +16,7 @@ public class Config //TODO: let IE choose from config files (Json) and connect t
|
|||
|
||||
public required Double MinSoc { get; set; }
|
||||
public required Boolean ForceCalibrationCharge { get; set; }
|
||||
public required Boolean DisplayIndividualBatteries { get; set; }
|
||||
public required Double PConstant { get; set; }
|
||||
public required Double GridSetPoint { get; set; }
|
||||
public required Double BatterySelfDischargePower { get; set; }
|
||||
|
@ -40,6 +41,7 @@ public class Config //TODO: let IE choose from config files (Json) and connect t
|
|||
{
|
||||
MinSoc = 20,
|
||||
ForceCalibrationCharge = false,
|
||||
DisplayIndividualBatteries = false,
|
||||
PConstant = .5,
|
||||
GridSetPoint = 0,
|
||||
BatterySelfDischargePower = 200,
|
||||
|
@ -116,6 +118,7 @@ public class Config //TODO: let IE choose from config files (Json) and connect t
|
|||
{
|
||||
MinSoc = 20,
|
||||
ForceCalibrationCharge = false,
|
||||
DisplayIndividualBatteries = false,
|
||||
PConstant = .5,
|
||||
GridSetPoint = 0,
|
||||
BatterySelfDischargePower = 200,
|
||||
|
|
|
@ -368,27 +368,22 @@ public static class Topology
|
|||
var bat = status.Battery;
|
||||
var batteryAvgBox = CreateAveragedBatteryBox(bat);
|
||||
|
||||
return batteryAvgBox; // TODO: individualBatteries hidden atm
|
||||
|
||||
|
||||
#pragma warning disable CS0162
|
||||
var batteryBoxes = bat
|
||||
.Devices
|
||||
.Select(CreateBatteryBox)
|
||||
.ToReadOnlyList();
|
||||
|
||||
var individualBatteries = batteryBoxes.Any()
|
||||
? TextBlock.AlignLeft(batteryBoxes)
|
||||
: TextBlock.Empty;
|
||||
|
||||
return TextBlock
|
||||
.AlignCenterVertical
|
||||
(
|
||||
batteryAvgBox ,
|
||||
individualBatteries
|
||||
);
|
||||
var individualWithAvgBox = TextBlock
|
||||
.AlignCenterVertical
|
||||
(
|
||||
batteryAvgBox ,
|
||||
batteryBoxes.Any()
|
||||
? TextBlock.AlignLeft(batteryBoxes)
|
||||
: TextBlock.Empty
|
||||
);
|
||||
|
||||
#pragma warning enable CS0162
|
||||
return status.Config.DisplayIndividualBatteries ? individualWithAvgBox : batteryAvgBox;
|
||||
}
|
||||
|
||||
private static TextBlock CreateAveragedBatteryBox(Battery48TlRecords? bat)
|
||||
|
|
Loading…
Reference in New Issue