reformatting must do calibration charge

This commit is contained in:
atef 2024-03-20 13:52:00 +01:00
parent 3311a30a92
commit 7b5b529080
1 changed files with 7 additions and 9 deletions

View File

@ -188,13 +188,13 @@ public static class Controller
private static Boolean MustDoCalibrationCharge(this StatusRecord statusRecord)
{
var calibrationChargeForced = statusRecord.Config.ForceCalibrationChargeState;
var batteryCalibrationChargeRequested = statusRecord.Battery is { CalibrationChargeRequested: true };//BatteryCalibrationChargeRequested(statusRecord.Battery?.CalibrationChargeRequested?? false) ;
var additionalCalibrationRequired = CalibrationDateHasBeenPassed(statusRecord.Config.DayAndTimeForAdditionalCalibration);
var repetitiveCalibrationRequired = CalibrationDateHasBeenPassed(statusRecord.Config.DayAndTimeForRepetitiveCalibration);
//var batteryCalibrationChargeRequested = statusRecord.Battery is { CalibrationChargeRequested: true };
var mustDoCalibrationCharge = calibrationChargeForced == CalibrationChargeType.ChargePermanently ||
(calibrationChargeForced == CalibrationChargeType.AdditionallyOnce
&& CalibrationDateHasBeenPassed(statusRecord.Config.DayAndTimeForAdditionalCalibration)) ||
(calibrationChargeForced == CalibrationChargeType.RepetitivelyEvery &&
CalibrationDateHasBeenPassed(statusRecord.Config.DayAndTimeForRepetitiveCalibration));
var mustDoCalibrationCharge = calibrationChargeForced == CalibrationChargeType.ChargePermanently ||
(calibrationChargeForced == CalibrationChargeType.AdditionallyOnce && additionalCalibrationRequired) ||
(calibrationChargeForced == CalibrationChargeType.RepetitivelyEvery && repetitiveCalibrationRequired);
if (statusRecord.Battery is not null)
{
@ -215,7 +215,6 @@ public static class Controller
private static Boolean CalibrationDateHasBeenPassed(DateTime calibrationChargeDate)
{
if (!_hasCalibrationChargeChecked)
{
if (DateTime.Now >= calibrationChargeDate )
@ -223,8 +222,7 @@ public static class Controller
_hasCalibrationChargeChecked = true;
return true;
}
return false;
return false;
}
return true;