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