Changes:
- Code refactored, DIagsPt1 and 2 moved into there own folder called DIagnostics - Pre tests and final tests moved into a AiQ tests - Mobile Pre Tests added - Mobile pre test - Added firmware check for the SRZ
This commit is contained in:
162
AiQ Tests/AiQTests.cs
Normal file
162
AiQ Tests/AiQTests.cs
Normal file
@@ -0,0 +1,162 @@
|
||||
using AiQ_GUI;
|
||||
using AiQ_GUI.AiQ_Tests;
|
||||
public class AiQTests
|
||||
{
|
||||
public static async void AiQPreTest()
|
||||
{
|
||||
|
||||
if (!await CameraModules.SetZoomLockOn(MainForm.Instance.CamOnTest.IP))
|
||||
Helper.RestartApp();
|
||||
|
||||
string LEDreply = await FlexiAPI.APIHTTPLED(MainForm.Instance.CamOnTest.IP, LEDPOWER.MID); // Set LED's to medium (0x30)
|
||||
|
||||
if (!LEDreply.Contains("Power levels set successfully"))
|
||||
MainForm.Instance.AddToActionsList($"LED level could not be set: {LEDreply}", Level.ERROR);
|
||||
|
||||
await CameraModules.FactoryResetModules(MainForm.Instance.CamOnTest.IP); // Reset both modules and double check
|
||||
|
||||
MainForm.Instance.sshData = SSH.CollectSSHData(MainForm.Instance.CamOnTest.IP); // SSH into camera to get Vaxtor packages, filesystem size and if tailscale is installed.
|
||||
await SSH.CheckFSSize(MainForm.Instance.CamOnTest.IP, MainForm.Instance.LblFilesystemSize, MainForm.Instance.sshData); // Check Filesystem size is between 100GB & 150GB
|
||||
|
||||
Helper.DCPowerCheck(MainForm.Instance.LblDC); // If the camera is DC powered check it is within limits
|
||||
|
||||
// Requests, deserialises and checks the diagnostics API is correct
|
||||
await TestingFunctions.CheckDiagsAPIPt1();
|
||||
|
||||
// Check module has gone to default config
|
||||
CameraModules.CheckCamModule(TestingFunctions.DiagsAPI.IRmodule, MainForm.Instance.LblIRModule, MainForm.Instance.CamOnTest); // IR
|
||||
CameraModules.CheckCamModule(TestingFunctions.DiagsAPI.OVmodule, MainForm.Instance.LblOVModule, MainForm.Instance.CamOnTest); // OV
|
||||
|
||||
// Check voltage and current are OK.
|
||||
LED.CheckLEDs(TestingFunctions.DiagsAPI.LedVoltage, MainForm.Instance.LblLEDV, "V", CameraAccessInfo.LED_V); // Voltage
|
||||
LED.CheckLEDs(TestingFunctions.DiagsAPI.LedCurrent, MainForm.Instance.LblLEDI, "mA", CameraAccessInfo.LED_I); // Current
|
||||
|
||||
MainForm.Instance.Refresh(); // Make sure all labels are updated before checking them
|
||||
|
||||
// If there are any actions identified then fail the test.
|
||||
// If any labels are red then fail. Only labels in panel so can foreach on labels not controls
|
||||
if (MainForm.Instance.RhTxBxActions.Text.Length < 2 && MainForm.Instance.PnlLbls.Controls.OfType<Label>().Any(c => c.ForeColor == Color.Red) == false)
|
||||
{
|
||||
// If camera already has a model or serial then ask if it is new
|
||||
if (RegexCache.SerialRegex().IsMatch(TestingFunctions.DiagsAPI.serialNumber) || RegexCache.ModelRegex().IsMatch(TestingFunctions.DiagsAPI.modelNumber))
|
||||
{
|
||||
if (await MainForm.Instance.DisplayQuestion($"Would you like to allocate a serial number to this camera?"))
|
||||
await MainForm.Instance.AllocateSerial();
|
||||
else if (GoogleAPI.UpdateSpreadSheetRePreTest(CameraAccessInfo.SpreadsheetID, MainForm.Instance.Vers) != "OK") // If rerun might be different values so update SS
|
||||
MainForm.Instance.AddToActionsList("Failed to write to spreadsheet, please check manually", Level.WARNING);
|
||||
// else if (Excel.UpdateSpreadSheetPreTest(CameraAccessInfo.SpreadsheetID, Vers, CamOnTest.GetCamDesc(), CamOnTest.Model) != "OK")
|
||||
// AddToActionsList("Failed to write to spreadsheet, please check manually");
|
||||
}
|
||||
else // No serial or model so allocate one
|
||||
await MainForm.Instance.AllocateSerial();
|
||||
|
||||
if (MainForm.Instance.RhTxBxActions.Text.Length < 2 && MainForm.Instance.PnlLbls.Controls.OfType<Label>().Any(c => c.ForeColor == Color.Red) == false)
|
||||
await MainForm.Instance.PreTestPassed();
|
||||
}
|
||||
else
|
||||
{
|
||||
await MainForm.Instance.PreTestFailed("Diagnostic Failure");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static async void AiQFinalTest()
|
||||
{
|
||||
|
||||
if (MainForm.Instance.LblTestTubePing.Text == "❌") // No test tube so test like an IQ
|
||||
{
|
||||
string LEDreply = await FlexiAPI.APIHTTPLED(MainForm.Instance.CamOnTest.IP, LEDPOWER.SAFE); // Set LED's to safe (0x0E) to help with eye safety and trim check.
|
||||
|
||||
if (!LEDreply.Contains("Power levels set successfully"))
|
||||
MainForm.Instance.AddToActionsList($"LED level could not be set: {LEDreply}", Level.ERROR);
|
||||
}
|
||||
else if (!await TestTube.CheckInTestTube(MainForm.Instance.CamOnTest.IP)) // Sets LED's to medium power after checking it is in the test tube
|
||||
await MainForm.Instance.TestFailed(MainForm.Instance.BtnStartTest, "Camera not in test tube");
|
||||
|
||||
Task VisCheck = Helper.VisualCheck(MainForm.Instance.BtnStartTest);
|
||||
|
||||
if (!await CameraModules.ZoomModules("1F40", MainForm.Instance.CamOnTest.IP)) // Zoom to 8000 (1F40h) at the same time.
|
||||
await MainForm.Instance.TestFailed(MainForm.Instance.BtnStartTest, "Could not zoom modules to 8000");
|
||||
|
||||
if (!await CameraModules.SetZoomLockOn(MainForm.Instance.CamOnTest.IP))
|
||||
Helper.RestartApp();
|
||||
|
||||
await Task.Delay(1000); // Without sleep it kept failing the factory reset as camera modules were not ready yet
|
||||
|
||||
await CameraModules.FactoryResetModules(MainForm.Instance.CamOnTest.IP); // Reset both modules and double check
|
||||
|
||||
string VISCAReply = await FlexiAPI.APIHTTPVISCA(MainForm.Instance.CamOnTest.IP, "8101043903FF", true); // Manual mode to be able to manipulate the SIG settings.
|
||||
if (VISCAReply != "9041FF9051FF")
|
||||
MainForm.Instance.AddToActionsList("Couldn't set to manual mode", Level.ERROR);
|
||||
|
||||
await CameraModules.SetSIG(MainForm.Instance.CbBxShutter, MainForm.Instance.CbBxIris, MainForm.Instance.CbBxGain, MainForm.Instance.CamOnTest.IP); // Set SIG according to the drop downs in settings for a good picture ready for image check
|
||||
await ImageProcessing.ImageCheck(MainForm.Instance.PicBxOV, MainForm.Instance.PicBxIRF2, MainForm.Instance.PicBxIRF16, MainForm.Instance.LblIRImageF2, MainForm.Instance.LblIRImageF16, MainForm.Instance.CamOnTest); // Populates the picture boxes and checks iris changes
|
||||
|
||||
await VisCheck; // Before changing UI elements wait for user to finish Visual check
|
||||
|
||||
MainForm.Instance.TabImagesandSettings.SelectedIndex = 2; // Swaps to the images tab
|
||||
MainForm.Instance.Refresh(); // Show user things are happening by displaying images taken
|
||||
// TODO - Force expire sighting.
|
||||
Task Wait = Task.Delay(5000); // Wait for 5 seconds to allow the camera to zoom in, set settings and capture some plates before auto trim
|
||||
|
||||
if (CameraAccessInfo.HardwareExtras.Contains("GPS")) // Check GPS if the hardware has it
|
||||
await FlexiAPI.GPSFix(MainForm.Instance.CamOnTest.IP);
|
||||
|
||||
// While waiting do the SSH tasks.
|
||||
MainForm.Instance.sshData = SSH.CollectSSHData(MainForm.Instance.CamOnTest.IP); // SSH into camera to get Vaxtor packages, filesystem size and if tailscale is installed.
|
||||
await SSH.CheckFSSize(MainForm.Instance.CamOnTest.IP, MainForm.Instance.LblFilesystemSize, MainForm.Instance.sshData); // Check Filesystem size is between 100GB & 150GB
|
||||
|
||||
Helper.DCPowerCheck(MainForm.Instance.LblDC); // If the camera is DC powered check it is within limits
|
||||
|
||||
if (CameraAccessInfo.HardwareExtras.Contains("4G")) // If it is a router camera then test the router.
|
||||
{
|
||||
MainForm.Instance.LblRouter.Visible = true;
|
||||
|
||||
if (Router.CheckRouter(Router.GetRouterInfo()))
|
||||
MainForm.Instance.LblRouter.Text += "OK";
|
||||
else
|
||||
MainForm.Instance.LblRouter.Text += "Error with router";
|
||||
}
|
||||
|
||||
await Wait; // Finished to 5s wait
|
||||
await FlexiAPI.SetTrim(MainForm.Instance.CamOnTest.IP, MainForm.Instance.LblTestTubePing.Text); // Auto trims the cameras, some plates should have been captured in the meantime
|
||||
|
||||
if (!await CameraModules.ZoomModules("0000", MainForm.Instance.CamOnTest.IP)) // Zoom to full wide
|
||||
await MainForm.Instance.TestFailed(MainForm.Instance.BtnStartTest, "Could not zoom modules to full wide");
|
||||
|
||||
await Task.Delay(1000); // Wait to be sure cameras are zoomed out.
|
||||
|
||||
await CameraModules.FactoryResetModules(MainForm.Instance.CamOnTest.IP); // Reset both modules and double check
|
||||
|
||||
if (MainForm.Instance.LblTestTubePing.Text == "❌") // Set LED's to MID in prep for diagnostics API
|
||||
{
|
||||
string LEDreply = await FlexiAPI.APIHTTPLED(MainForm.Instance.CamOnTest.IP, LEDPOWER.MID); // Set LED's to medium (0x30)
|
||||
|
||||
if (!LEDreply.Contains("Power levels set successfully"))
|
||||
MainForm.Instance.AddToActionsList($"LED level could not be set: {LEDreply}", Level.ERROR);
|
||||
}
|
||||
await FlexiAPI.SetVaxtorMinMaxPlate(MainForm.Instance.CamOnTest.IP);
|
||||
|
||||
DateTime PCTime = DateTime.Now; // Grab PC time as close to the API as possible to pass onto PDF later
|
||||
|
||||
await TestingFunctions.CheckDiagsAPIPt1(); // Requests, deserialises and checks the diagnostics API is correct
|
||||
await TestingFunctions.CheckDiagsAPIPt2(); // For only final test parts
|
||||
|
||||
// Check module has gone to default config
|
||||
CameraModules.CheckCamModule(TestingFunctions.DiagsAPI.IRmodule, MainForm.Instance.LblIRModule, MainForm.Instance.CamOnTest); // IR
|
||||
CameraModules.CheckCamModule(TestingFunctions.DiagsAPI.OVmodule, MainForm.Instance.LblOVModule, MainForm.Instance.CamOnTest); // OV
|
||||
|
||||
// Check voltage and current are OK.
|
||||
LED.CheckLEDs(TestingFunctions.DiagsAPI.LedVoltage, MainForm.Instance.LblLEDV, "V", CameraAccessInfo.LED_V); // Voltage
|
||||
LED.CheckLEDs(TestingFunctions.DiagsAPI.LedCurrent, MainForm.Instance.LblLEDI, "mA", CameraAccessInfo.LED_I); // Current
|
||||
|
||||
MainForm.Instance.Refresh(); // Make sure all labels are updated before checking them
|
||||
|
||||
// If there are any actions identified then fail the test.
|
||||
// If any labels are red then fail. Only labels in panel so can foreach on labels not controls
|
||||
if (MainForm.Instance.RhTxBxActions.Text.Length > 2 || MainForm.Instance.PnlLbls.Controls.OfType<Label>().Any(c => c.ForeColor == Color.Red) == true)
|
||||
await MainForm.Instance.TestFailed(MainForm.Instance.BtnStartTest, "Diagnostic Failure");// If approved then pass otherwise GUI would have restarted before getting to TestPassed.
|
||||
|
||||
await MainForm.Instance.TestPassed(PCTime);
|
||||
}
|
||||
}
|
||||
242
AiQ Tests/Diagnostics.cs
Normal file
242
AiQ Tests/Diagnostics.cs
Normal file
@@ -0,0 +1,242 @@
|
||||
using Renci.SshNet.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
|
||||
namespace AiQ_GUI.AiQ_Tests
|
||||
{
|
||||
|
||||
public class TestingFunctions
|
||||
{
|
||||
public static Diags DiagsAPI = new();
|
||||
|
||||
// Colours
|
||||
public static readonly Color BtnColour = Color.FromArgb(70, 65, 80);
|
||||
public static readonly Color TxBxColour = Color.FromArgb(53, 51, 64);
|
||||
|
||||
// ***** Testing functions *****
|
||||
|
||||
|
||||
public static async Task CheckDiagsAPIPt1() // Parts done on pre and final test
|
||||
{
|
||||
DiagsAPI = await FlexiAPI.GetDiagnostics(MainForm.Instance.CamOnTest.IP); // Diagnostic API request
|
||||
|
||||
MainForm.Instance.lblFlexiVer.Text += DiagsAPI.FlexiVersion; // Check Flexi Version
|
||||
|
||||
if (DiagsAPI.FlexiVersion == UniversalData.ExpFlexiVer)
|
||||
{
|
||||
MainForm.Instance.lblFlexiVer.ForeColor = Color.LightGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
MainForm.Instance.lblFlexiVer.Text += " Expected = " + UniversalData.ExpFlexiVer;
|
||||
MainForm.Instance.lblFlexiVer.ForeColor = Color.Red;
|
||||
}
|
||||
|
||||
MainForm.Instance.lblFlexiRev.Text += DiagsAPI.FlexiRevision; // Check Flexi Revision
|
||||
|
||||
if (DiagsAPI.FlexiRevision == UniversalData.ExpFlexiRev)
|
||||
{
|
||||
MainForm.Instance.lblFlexiRev.ForeColor = Color.LightGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
MainForm.Instance.lblFlexiRev.Text += " Expected = " + UniversalData.ExpFlexiRev;
|
||||
MainForm.Instance.lblFlexiRev.ForeColor = Color.Red;
|
||||
}
|
||||
|
||||
MainForm.Instance.lblMac.Text += DiagsAPI.MAC; // Display MAC
|
||||
|
||||
if (RegexCache.MACRegexNVIDIA().IsMatch(DiagsAPI.MAC)) // Checks it is in the right format and is a NVIDIA registered MAC address
|
||||
{
|
||||
MainForm.Instance.lblMac.ForeColor = Color.LightGreen;
|
||||
}
|
||||
else if (RegexCache.MACRegex().IsMatch(DiagsAPI.MAC)) // Is a valid MAC, but not NVIDIA
|
||||
{
|
||||
MainForm.Instance.lblMac.ForeColor = Color.Red;
|
||||
MainForm.Instance.AddToActionsList($"{DiagsAPI.MAC} not recognised as NVIDIA MAC address", Level.ERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
MainForm.Instance.lblMac.ForeColor = Color.Red;
|
||||
MainForm.Instance.AddToActionsList($"{DiagsAPI.MAC} not recognised as a MAC address", Level.ERROR);
|
||||
}
|
||||
|
||||
// Check timestamp
|
||||
DateTime dateTime = new(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
dateTime = dateTime.AddSeconds(DiagsAPI.timeStamp).ToLocalTime();
|
||||
|
||||
MainForm.Instance.lbltimestamp.Text += dateTime;
|
||||
long timediff = DateTimeOffset.UtcNow.ToUnixTimeSeconds() - DiagsAPI.timeStamp;
|
||||
|
||||
if (timediff > 10) // Over 10 seconds ago
|
||||
{
|
||||
MainForm.Instance.lbltimestamp.Text += $" Time behind by {timediff}s";
|
||||
MainForm.Instance.lbltimestamp.ForeColor = Color.Red;
|
||||
}
|
||||
else if (timediff < 0) // Time is in the future.
|
||||
{
|
||||
MainForm.Instance.lbltimestamp.Text += $" Time is in the future by {Math.Abs(timediff)}s";
|
||||
MainForm.Instance.lbltimestamp.ForeColor = Color.Red;
|
||||
}
|
||||
else
|
||||
MainForm.Instance.lbltimestamp.ForeColor = Color.LightGreen;
|
||||
|
||||
MainForm.Instance.lblTemp.Text += DiagsAPI.IntTemperature + "°C"; // Diagnostic API request
|
||||
|
||||
if (DiagsAPI.IntTemperature > 20 && DiagsAPI.IntTemperature < 70)
|
||||
MainForm.Instance.lblTemp.ForeColor = Color.LightGreen;
|
||||
else
|
||||
MainForm.Instance.lblTemp.ForeColor = Color.Red;
|
||||
|
||||
MainForm.Instance.lblZoomLock.Text += DiagsAPI.zoomLock;
|
||||
|
||||
if (DiagsAPI.zoomLock == true)
|
||||
{
|
||||
if (DiagsAPI.IRmodule.zoom == DiagsAPI.OVmodule.zoom) // Checks if zoomlock is doing what is says it should
|
||||
{
|
||||
MainForm.Instance.lblZoomLock.ForeColor = Color.LightGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
MainForm.Instance.lblZoomLock.Text += $" Zoomlock on but {DiagsAPI.IRmodule.zoom}≠{DiagsAPI.OVmodule.zoom}";
|
||||
MainForm.Instance.lblZoomLock.ForeColor = Color.Red;
|
||||
}
|
||||
}
|
||||
else
|
||||
MainForm.Instance.lblZoomLock.ForeColor = Color.Red;
|
||||
}
|
||||
|
||||
public static async Task CheckDiagsAPIPt2() // Parts only done on final test
|
||||
{
|
||||
if (MainForm.Instance.RhTxBxActions.Text.Contains("Error reading JSON")) // If failed to deserialise in part 1
|
||||
return;
|
||||
|
||||
try // In case serial or model are blank
|
||||
{
|
||||
MainForm.Instance.lblModel.Text += DiagsAPI.modelNumber; // Update labels with serial and model
|
||||
MainForm.Instance.lblSerial.Text += DiagsAPI.serialNumber;
|
||||
|
||||
if (RegexCache.SerialRegex().IsMatch(DiagsAPI.serialNumber) && RegexCache.ModelRegex().IsMatch(DiagsAPI.modelNumber))
|
||||
{
|
||||
MainForm.Instance.lblSerial.ForeColor = MainForm.Instance.lblModel.ForeColor = Color.LightGreen; // Set both to green
|
||||
|
||||
if (DiagsAPI.modelNumber != MainForm.Instance.CamOnTest.Model)
|
||||
{
|
||||
MainForm.Instance.AddToActionsList("Model number in camera doesn't match what has been selected", Level.WARNING);
|
||||
MainForm.Instance.lblModel.ForeColor = Color.Red;
|
||||
}
|
||||
else if (!GoogleAPI.CheckWIP(DiagsAPI.serialNumber, CameraAccessInfo.SpreadsheetID)) // Check WIP column in serial number register, if not ticked then RMA
|
||||
{
|
||||
MainForm.Instance.CamOnTest.RMANum = GoogleAPI.CheckRMANum(DiagsAPI.serialNumber, DiagsAPI.modelNumber); // Corrected by qualifying with the type name
|
||||
|
||||
if (MainForm.Instance.CamOnTest.RMANum == 0) // Couldn't find RMA num in spreadsheet
|
||||
{
|
||||
MainForm.Instance.CamOnTest.RMANum = Convert.ToInt32(await MainForm.Instance.DisplayInput("What is the RMA number?"));
|
||||
|
||||
if (MainForm.Instance.CamOnTest.RMANum == -1) // Means they chose the 'I don't know' option
|
||||
await MainForm.Instance.TestFailed(MainForm.Instance.BtnStartTest, "Please get RMA number from operations team before continuing");
|
||||
}
|
||||
// Found RMA num and want to verify it with user
|
||||
else if (!await MainForm.Instance.DisplayQuestion($"Is {MainForm.Instance.CamOnTest.RMANum} the RMA Number?")) // '!' because if its not the right RMA number let the user to it manually
|
||||
{
|
||||
MainForm.Instance.CamOnTest.RMANum = Convert.ToInt32(await MainForm.Instance.DisplayInput("What is the RMA number?"));
|
||||
|
||||
if (MainForm.Instance.CamOnTest.RMANum == -1) // Means they chose the 'I don't know' option
|
||||
await MainForm.Instance.TestFailed(MainForm.Instance.BtnStartTest, "Please get RMA number from operations team before continuing");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MainForm.Instance.AddToActionsList("Camera has not been given a valid serial and model number, suggest you run through pre test again and check serial number register for any issues.", Level.ERROR);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
// Check licenses
|
||||
List<string> licensesOnCam = []; // Temporary list for licenses on camera
|
||||
|
||||
if (DiagsAPI.licenses.saf1)
|
||||
licensesOnCam.Add("SAF1");
|
||||
if (DiagsAPI.licenses.saf2)
|
||||
licensesOnCam.Add("SAF2");
|
||||
if (DiagsAPI.licenses.saf3)
|
||||
licensesOnCam.Add("SAF3");
|
||||
if (DiagsAPI.licenses.saf4)
|
||||
licensesOnCam.Add("SAF4");
|
||||
if (DiagsAPI.licenses.audit)
|
||||
licensesOnCam.Add("Audit");
|
||||
if (DiagsAPI.licenses.stream)
|
||||
licensesOnCam.Add("Stream");
|
||||
if (MainForm.Instance.sshData.tailscale)
|
||||
licensesOnCam.Add("Tailscale");
|
||||
|
||||
if (licensesOnCam.Count == 0) // No licenses found
|
||||
MainForm.Instance.lblLic.Text += "None";
|
||||
else if (licensesOnCam.Count != 0) // Join them comma and space seperated for displaying
|
||||
MainForm.Instance.lblLic.Text += string.Join(", ", licensesOnCam);
|
||||
|
||||
MainForm.Instance.lblLic.ForeColor = Color.LightGreen;
|
||||
|
||||
double CPUround = Math.Round(DiagsAPI.CPUusage); // Check CPU usage isn't near max
|
||||
MainForm.Instance.LblCPUusage.Text += CPUround + "%";
|
||||
|
||||
if (CPUround <= 50)
|
||||
{
|
||||
MainForm.Instance.LblCPUusage.Text += " Unexpectedly low CPU usage";
|
||||
MainForm.Instance.LblCPUusage.ForeColor = Color.Red;
|
||||
}
|
||||
else if (CPUround >= 98)
|
||||
{
|
||||
MainForm.Instance.LblCPUusage.Text += " Unexpectedly high CPU usage";
|
||||
MainForm.Instance.LblCPUusage.ForeColor = Color.Red;
|
||||
}
|
||||
else
|
||||
{
|
||||
MainForm.Instance.LblCPUusage.ForeColor = Color.LightGreen;
|
||||
}
|
||||
|
||||
// Check Vaxtor if it doesn't need or have license OR has and wants one then pass
|
||||
if (CameraAccessInfo.VaxtorLic == false && DiagsAPI.licenses.raptorKeyID == "Not Licensed" || CameraAccessInfo.VaxtorLic == true && DiagsAPI.licenses.raptorKeyID != "Not Licensed")
|
||||
{
|
||||
MainForm.Instance.lblVaxtor.Text += DiagsAPI.licenses.raptorKeyID;
|
||||
MainForm.Instance.lblVaxtor.ForeColor = Color.LightGreen;
|
||||
}
|
||||
else if (await MainForm.Instance.DisplayQuestion("Was this camera licensed manually?"))
|
||||
{
|
||||
string ProdcutKeyID = await MainForm.Instance.DisplayInput("What is the Key ID?", false);
|
||||
|
||||
if (RegexCache.VaxtorRegex().IsMatch(ProdcutKeyID)) // Means they chose the 'I don't know' option or isn't valid Key ID
|
||||
{
|
||||
Access.Stats("Please Get A Valid Vaxtor Product Key Before Continuing", MainForm.Instance.CamOnTest.Model);
|
||||
await MainForm.Instance.TestFailed(MainForm.Instance.BtnStartTest, "Please get a valid Vaxtor Product Key before continuing");
|
||||
}
|
||||
|
||||
|
||||
DiagsAPI.licenses.raptorKeyID = MainForm.Instance.TxBxProductKey.Text;
|
||||
MainForm.Instance.lblVaxtor.Text += DiagsAPI.licenses.raptorKeyID;
|
||||
MainForm.Instance.lblVaxtor.ForeColor = Color.LightGreen;
|
||||
}
|
||||
else // Should have license but doesn't OR shouldn't have but does + any other unforseen circumstance then fail
|
||||
{
|
||||
MainForm.Instance.lblVaxtor.Text += DiagsAPI.licenses.raptorKeyID;
|
||||
MainForm.Instance.lblVaxtor.ForeColor = Color.Red;
|
||||
}
|
||||
|
||||
// Check trim is within 10% both horizontally and vertically, from auto set done earlier in the test
|
||||
MainForm.Instance.lblTrim.Text += "H: " + DiagsAPI.trim[0] + " V: " + DiagsAPI.trim[1];
|
||||
|
||||
// Offset accounted for in the SetTrim function, so value should be close to 0,0.
|
||||
const int HMax = 96; // 5% of 1920 each way = ±96
|
||||
const int VMax = 54; // 5% of 1080 each way = ±54
|
||||
|
||||
if (Math.Abs(DiagsAPI.trim[0]) <= HMax && Math.Abs(DiagsAPI.trim[1]) <= VMax)
|
||||
MainForm.Instance.lblTrim.ForeColor = Color.LightGreen;
|
||||
else
|
||||
MainForm.Instance.lblTrim.ForeColor = Color.Red;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user