From dbbe3c38c0af87ac47d28b6b259be08013ceee53 Mon Sep 17 00:00:00 2001 From: Peter Simpson <38855929+Peter-Simpson@users.noreply.github.com> Date: Sun, 25 Aug 2024 10:28:27 +0100 Subject: [PATCH] CoverCalibrator - Fix incorrect Issue report when testing calibrators that change state in less than 1 second. --- ConformU/Conform/CoverCalibratorTester.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ConformU/Conform/CoverCalibratorTester.cs b/ConformU/Conform/CoverCalibratorTester.cs index 87e26af..2c3b758 100644 --- a/ConformU/Conform/CoverCalibratorTester.cs +++ b/ConformU/Conform/CoverCalibratorTester.cs @@ -890,7 +890,7 @@ private bool CoverIsMoving(string operation) /// Determine whether the calibrator is changing, ensuring that the CalibratorChanging and CalibratorState properties agree in ICoverCalibratorV2 and later interfaces /// /// - /// True if the calibrator is not ready + /// True if the calibrator is ready private bool CalibratorReady(string operation) { // Get the calibrator state @@ -942,8 +942,11 @@ private void TestCalibratorOn(int requestedBrightness) // Check whether the call was synchronous or asynchronous if (CalibratorReady("CalibratorOn")) // Synchronous call { - // Check the outcome + // Get the outcome state LogCallToDriver("CalibratorOn", "About to call CalibratorState property"); + calibratorState = coverCalibratorDevice.CalibratorState; + + // Check the outcome if ((requestedBrightness < 0) | (requestedBrightness > maxBrightness)) // An invalid value should have been thrown so this code should never be reached LogIssue("CalibratorOn", $"CalibratorOn with brightness {requestedBrightness} should have thrown an InvalidValueException but did not."); else if (calibratorState == CalibratorStatus.Ready) // A valid brightness was set and a Ready status was returned @@ -979,7 +982,7 @@ private void TestCalibratorOn(int requestedBrightness) LogIssue("CalibratorOn", $"The Brightness property value: {returnedBrightness} does not match the value that was set: {requestedBrightness}"); } else// A valid brightness was set but a status other than Ready was returned - LogIssue("CalibratorOn", $"CalibratorOn with brightness {requestedBrightness} was unsuccessful - the returned CalibratorState was '{coverCalibratorDevice.CalibratorState.ToString().Trim()}' instead of 'Ready'. The synchronous operation took {sw.Elapsed.TotalSeconds:0.0} seconds"); + LogIssue("CalibratorOn", $"CalibratorOn with brightness {requestedBrightness} was unsuccessful - the returned CalibratorState was '{calibratorState}' instead of 'Ready'. The synchronous operation took {sw.Elapsed.TotalSeconds:0.0} seconds"); } else // Asynchronous call {