Skip to content

Commit

Permalink
CoverCalibrator - Fix incorrect Issue report when testing calibrators…
Browse files Browse the repository at this point in the history
… that change state in less than 1 second.
  • Loading branch information
Peter-Simpson committed Aug 25, 2024
1 parent 6a24d14 commit dbbe3c3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ConformU/Conform/CoverCalibratorTester.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
/// </summary>
/// <param name="operation"></param>
/// <returns>True if the calibrator is not ready</returns>
/// <returns>True if the calibrator is ready</returns>
private bool CalibratorReady(string operation)
{
// Get the calibrator state
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
{
Expand Down

0 comments on commit dbbe3c3

Please sign in to comment.