V4.5
This commit is contained in:
@@ -159,10 +159,7 @@ namespace AiQ_GUI
|
||||
await Task.Delay(500); // Wait for the change to take effect
|
||||
|
||||
if (!await Checkflashline(driver, CamAct))
|
||||
{
|
||||
Logging.LogWarningMessage("Bad flashline after changing: " + fullId, SoakLogFile);
|
||||
MainForm.Instance.AddToActionsList("Bad flashline after changing: " + fullId);
|
||||
}
|
||||
}
|
||||
|
||||
// Monitors the flashline element's color to determine success (green) or failure (red) of a camera
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace AiQ_GUI
|
||||
internal class SoakTest
|
||||
{
|
||||
// Main soak test loop: Randomise dropdowns, run luminance test every hour, power cycle at 7am
|
||||
public static async Task StartSoak(Camera CamInfo, CancellationToken token)
|
||||
public static async Task StartSoak(Camera CamInfo, CheckBox CkBx, CancellationToken token)
|
||||
{
|
||||
if (CamInfo.Serial == "N/A")
|
||||
CamInfo.Serial = "UNKNOWN"; // If serial is not set, set it to UNKNOWN. Cannot have N/A in file names.
|
||||
@@ -34,7 +34,7 @@ namespace AiQ_GUI
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logging.LogErrorMessage($"Initial connection failed: {ex.Message}", SoakLogFile);
|
||||
SoakError($"Initial connection failed: {ex.Message}", SoakLogFile, CamInfo.CheckBox);
|
||||
MainForm.Instance.AddToActionsList($"[{CamInfo.IP}] Initial connection failed: {ex.Message}");
|
||||
|
||||
// Wait 10 seconds before trying again
|
||||
@@ -50,7 +50,7 @@ namespace AiQ_GUI
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logging.LogErrorMessage($"Failed to get element IDs: {ex.Message}", SoakLogFile);
|
||||
SoakError($"Failed to get element IDs: {ex.Message}", SoakLogFile, CamInfo.CheckBox);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace AiQ_GUI
|
||||
// Retry ping until camera responds or cancelled
|
||||
while (!await Network.PingIP(CamInfo.IP) && !token.IsCancellationRequested)
|
||||
{
|
||||
Logging.LogErrorMessage($"Camera did not respond after restart.", SoakLogFile);
|
||||
SoakError($"Camera did not respond after restart.", SoakLogFile, CamInfo.CheckBox);
|
||||
await Task.Delay(TimeSpan.FromMinutes(1), token); // Retry after delay of 1 minute
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace AiQ_GUI
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logging.LogErrorMessage($"Error during power cycle: {ex.Message}", SoakLogFile);
|
||||
SoakError($"Error during power cycle: {ex.Message}", SoakLogFile, CamInfo.CheckBox);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,11 +96,11 @@ namespace AiQ_GUI
|
||||
Logging.LogMessage($"Hour changed to {currentHour}, running ImageCheck.", SoakLogFile);
|
||||
try
|
||||
{
|
||||
ImageCheck(driver, SoakLogFile, CamInfo.IP, CamInfo.DevPass, elementID);
|
||||
ImageCheck(driver, SoakLogFile, CamInfo, elementID);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logging.LogErrorMessage($"ImageCheck failed: {ex.Message}", SoakLogFile);
|
||||
SoakError($"ImageCheck failed: {ex.Message}", SoakLogFile, CamInfo.CheckBox);
|
||||
}
|
||||
lastHour = currentHour;
|
||||
}
|
||||
@@ -119,7 +119,7 @@ namespace AiQ_GUI
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logging.LogErrorMessage($"ChangeRandomDropdown failed: {ex.Message}", SoakLogFile);
|
||||
SoakError($"ChangeRandomDropdown failed: {ex.Message}", SoakLogFile, CamInfo.CheckBox);
|
||||
}
|
||||
|
||||
try
|
||||
@@ -144,6 +144,8 @@ namespace AiQ_GUI
|
||||
|
||||
if (SoakTestPath != null)
|
||||
{
|
||||
CamInfo.TestReportLoc = SoakTestPath;
|
||||
|
||||
// Delete the soak test log file if the report was created successfully
|
||||
try
|
||||
{
|
||||
@@ -152,7 +154,7 @@ namespace AiQ_GUI
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logging.LogErrorMessage($"Failed to delete soak log file: {ex.Message}{Environment.NewLine}Please delete if you find this.", SoakLogFile);
|
||||
SoakError($"Failed to delete soak log file: {ex.Message}{Environment.NewLine}Please delete if you find this.", SoakLogFile, CamInfo.CheckBox);
|
||||
}
|
||||
|
||||
// Find the final test report PDF for this camera
|
||||
@@ -198,7 +200,7 @@ namespace AiQ_GUI
|
||||
}
|
||||
|
||||
// Capture's bright and dark images, then compares their luminance to verify sufficient contrast and adds results to the log
|
||||
public static async Task LuminescenceMean(string FullID, ChromeDriver driver, string[] SettingMinMax, string SoakLogFile, string IP, string DevPass, string CamAct)
|
||||
public static async Task LuminescenceMean(string FullID, ChromeDriver driver, string[] SettingMinMax, string SoakLogFile, Camera CamInfo, string CamAct)
|
||||
{
|
||||
string controlType = FullID.Split('_')[0]; // Extract control type from FullID (e.g. "Shutter_1234" → "Shutter")
|
||||
|
||||
@@ -208,7 +210,7 @@ namespace AiQ_GUI
|
||||
await Task.Delay(500);
|
||||
|
||||
// Take bright image
|
||||
Image ImageBright = await ImageProcessing.GetProcessedImage("Infrared", IP, DevPass);
|
||||
Image ImageBright = await ImageProcessing.GetProcessedImage("Infrared", CamInfo.IP, CamInfo.DevPass);
|
||||
if (ImageBright == null)
|
||||
{
|
||||
Logging.LogWarningMessage($"Bright image is null for {controlType} at setting {SettingMinMax[0]}", SoakLogFile);
|
||||
@@ -222,7 +224,7 @@ namespace AiQ_GUI
|
||||
await Task.Delay(500);
|
||||
|
||||
// Take dark image
|
||||
Image ImageDark = await ImageProcessing.GetProcessedImage("Infrared", IP, DevPass);
|
||||
Image ImageDark = await ImageProcessing.GetProcessedImage("Infrared", CamInfo.IP, CamInfo.DevPass);
|
||||
if (ImageDark == null)
|
||||
{
|
||||
Logging.LogWarningMessage($"Dark image is null for {controlType} at setting {SettingMinMax[1]}", SoakLogFile);
|
||||
@@ -236,9 +238,10 @@ namespace AiQ_GUI
|
||||
|
||||
if (Bright_Lum < Dark_Lum * 1.01)
|
||||
{
|
||||
Logging.LogErrorMessage(
|
||||
SoakError(
|
||||
$"Insufficient luminance contrast. Bright: {Bright_Lum:F2}, Dark: {Dark_Lum:F2} | Type: {controlType} | Bright Setting: {SettingMinMax[0]}, Dark Setting: {SettingMinMax[1]}",
|
||||
SoakLogFile
|
||||
SoakLogFile,
|
||||
CamInfo.CheckBox
|
||||
);
|
||||
}
|
||||
else
|
||||
@@ -251,7 +254,7 @@ namespace AiQ_GUI
|
||||
}
|
||||
|
||||
// Performs a series of camera control adjustments and luminance checks to verify image settings functionality
|
||||
public async static void ImageCheck(ChromeDriver driver, string SoakLogFile, string IP, string DevPass, ElementID elementID)
|
||||
public async static void ImageCheck(ChromeDriver driver, string SoakLogFile, Camera CamInfo, ElementID elementID)
|
||||
{
|
||||
await Selenium.Dropdown_Change(elementID.modeId, "Manual", driver, SoakLogFile, elementID.CamAct);
|
||||
await Selenium.Dropdown_Change(elementID.shutterId, "1/1000", driver, SoakLogFile, elementID.CamAct);
|
||||
@@ -259,11 +262,11 @@ namespace AiQ_GUI
|
||||
await Selenium.Dropdown_Change(elementID.irisId, "F4.0", driver, SoakLogFile, elementID.CamAct);
|
||||
await Selenium.Dropdown_Change(elementID.irLevelId, "Safe", driver, SoakLogFile, elementID.CamAct);
|
||||
|
||||
await LuminescenceMean(elementID.shutterId, driver, ["1/100", "1/10000"], SoakLogFile, IP, DevPass, elementID.CamAct); // Check Shutter goes from min to max
|
||||
await LuminescenceMean(elementID.shutterId, driver, ["1/100", "1/10000"], SoakLogFile, CamInfo, elementID.CamAct); // Check Shutter goes from min to max
|
||||
await Selenium.Dropdown_Change(elementID.shutterId, "1/1000", driver, SoakLogFile, elementID.CamAct); // Reset to default
|
||||
await LuminescenceMean(elementID.irisId, driver, ["F2.0", "F16"], SoakLogFile, IP, DevPass, elementID.CamAct); // Check iris goes from min to max
|
||||
await LuminescenceMean(elementID.irisId, driver, ["F2.0", "F16"], SoakLogFile, CamInfo, elementID.CamAct); // Check iris goes from min to max
|
||||
await Selenium.Dropdown_Change(elementID.irisId, "F4.0", driver, SoakLogFile, elementID.CamAct); // Reset to default
|
||||
await LuminescenceMean(elementID.gainId, driver, ["20dB", "0dB"], SoakLogFile, IP, DevPass, elementID.CamAct); // Check gain goes from min to max
|
||||
await LuminescenceMean(elementID.gainId, driver, ["20dB", "0dB"], SoakLogFile, CamInfo, elementID.CamAct); // Check gain goes from min to max
|
||||
}
|
||||
|
||||
public async static Task ChangeRandomDropdown(ChromeDriver driver, string SoakLogFile, ElementID elementID)
|
||||
@@ -319,6 +322,12 @@ namespace AiQ_GUI
|
||||
|
||||
return dynamicButton;
|
||||
}
|
||||
|
||||
private static void SoakError(string ErrMssg, string LogFile, CheckBox CkBx)
|
||||
{
|
||||
Logging.LogErrorMessage(ErrMssg, LogFile);
|
||||
CkBx.ForeColor = Color.Red;
|
||||
}
|
||||
}
|
||||
|
||||
public class ElementID
|
||||
|
||||
Reference in New Issue
Block a user