Dynamic labels & Changed color to light green

- Filesystem size
- Flexi version
- Flexi Revision
- MAC
- Timestamp
- Temperature
- ZoomLock
- Serial and model Number
- Licenses
- CPU usage
This commit is contained in:
2025-12-23 13:01:15 +00:00
parent 872be2e105
commit 36f9639baa
7 changed files with 182 additions and 419 deletions

View File

@@ -2,9 +2,8 @@
using AiQ_GUI.AiQ_Tests;
public class AiQTests
{
public static async void AiQPreTest()
{
public static async Task AiQPreTest()
{
if (!await CameraModules.SetZoomLockOn(MainForm.Instance.CamOnTest.IP))
Helper.RestartApp();
@@ -60,9 +59,8 @@ public class AiQTests
}
public static async void AiQFinalTest()
public static async Task 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.
@@ -70,11 +68,9 @@ public class AiQTests
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");
//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");

View File

@@ -22,90 +22,77 @@ namespace AiQ_GUI.AiQ_Tests
{
DiagsAPI = await FlexiAPI.GetDiagnostics(MainForm.Instance.CamOnTest.IP); // Diagnostic API request
MainForm.Instance.lblFlexiVer.Text += DiagsAPI.FlexiVersion; // Check Flexi Version
// Check Flexi Version
string flexiVerText = "Flexi Version = " + DiagsAPI.FlexiVersion;
bool flexiVerGreen = DiagsAPI.FlexiVersion == UniversalData.ExpFlexiVer;
if (!flexiVerGreen)
flexiVerText += " Expected = " + UniversalData.ExpFlexiVer;
MainForm.Instance.AddLabelToPanel(flexiVerText, !flexiVerGreen);
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
// Check Flexi Revision
string flexiRevText = "Flexi Revision = " + DiagsAPI.FlexiRevision;
bool flexiRevGreen = DiagsAPI.FlexiRevision == UniversalData.ExpFlexiRev;
if (!flexiRevGreen)
flexiRevText += " Expected = " + UniversalData.ExpFlexiRev;
MainForm.Instance.AddLabelToPanel(flexiRevText, !flexiRevGreen);
// Display MAC
string macText = "MAC = " + DiagsAPI.MAC;
bool macIsRed = false;
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;
// Valid NVIDIA MAC
}
else if (RegexCache.MACRegex().IsMatch(DiagsAPI.MAC)) // Is a valid MAC, but not NVIDIA
{
MainForm.Instance.lblMac.ForeColor = Color.Red;
macIsRed = true;
MainForm.Instance.AddToActionsList($"{DiagsAPI.MAC} not recognised as NVIDIA MAC address", Level.ERROR);
}
else
{
MainForm.Instance.lblMac.ForeColor = Color.Red;
macIsRed = true;
MainForm.Instance.AddToActionsList($"{DiagsAPI.MAC} not recognised as a MAC address", Level.ERROR);
}
MainForm.Instance.AddLabelToPanel(macText, macIsRed);
// 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;
string timestampText = "Timestamp = " + dateTime;
bool timestampIsRed = false;
if (timediff > 10) // Over 10 seconds ago
{
MainForm.Instance.lbltimestamp.Text += $" Time behind by {timediff}s";
MainForm.Instance.lbltimestamp.ForeColor = Color.Red;
timestampText += $" Time behind by {timediff}s";
timestampIsRed = true;
}
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;
timestampText += $" Time is in the future by {Math.Abs(timediff)}s";
timestampIsRed = true;
}
else
MainForm.Instance.lbltimestamp.ForeColor = Color.LightGreen;
MainForm.Instance.AddLabelToPanel(timestampText, timestampIsRed);
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;
// Check Temperature
string tempText = "Temperature = " + DiagsAPI.IntTemperature + "°C";
bool tempIsRed = DiagsAPI.IntTemperature <= 20 || DiagsAPI.IntTemperature >= 70;
MainForm.Instance.AddLabelToPanel(tempText, tempIsRed);
// Check Zoom Lock
string zoomLockText = "Zoom Lock = " + DiagsAPI.zoomLock;
bool zoomLockIsRed = false;
if (DiagsAPI.zoomLock == true)
{
if (DiagsAPI.IRmodule.zoom == DiagsAPI.OVmodule.zoom) // Checks if zoomlock is doing what is says it should
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;
zoomLockText += $" Zoomlock on but {DiagsAPI.IRmodule.zoom}≠{DiagsAPI.OVmodule.zoom}";
zoomLockIsRed = true;
}
}
else
MainForm.Instance.lblZoomLock.ForeColor = Color.Red;
zoomLockIsRed = true;
MainForm.Instance.AddLabelToPanel(zoomLockText, zoomLockIsRed);
}
public static async Task CheckDiagsAPIPt2() // Parts only done on final test
@@ -115,17 +102,19 @@ namespace AiQ_GUI.AiQ_Tests
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;
string serialText = "Serial Number = " + DiagsAPI.serialNumber;
bool serialIsRed = !RegexCache.SerialRegex().IsMatch(DiagsAPI.serialNumber);
MainForm.Instance.AddLabelToPanel(serialText, serialIsRed);
string modelText = "Model Number = " + DiagsAPI.modelNumber;
bool modelIsRed = !RegexCache.ModelRegex().IsMatch(DiagsAPI.modelNumber);
MainForm.Instance.AddLabelToPanel(modelText, modelIsRed);
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
{
@@ -153,7 +142,10 @@ namespace AiQ_GUI.AiQ_Tests
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 { }
catch (Exception ex)
{
MainForm.Instance.AddToActionsList($"Error in CheckDiagsAPIPt2 serial/model: {ex.Message}", Level.ERROR);
}
// Check licenses
List<string> licensesOnCam = []; // Temporary list for licenses on camera
@@ -170,73 +162,59 @@ namespace AiQ_GUI.AiQ_Tests
licensesOnCam.Add("Audit");
if (DiagsAPI.licenses.stream)
licensesOnCam.Add("Stream");
if (MainForm.Instance.sshData.tailscale)
if (MainForm.Instance.sshData != null && 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;
string licText = "Licenses = " + (licensesOnCam.Count == 0 ? "None" : string.Join(", ", licensesOnCam));
MainForm.Instance.AddLabelToPanel(licText, false);
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;
}
string cpuText = "CPU Usage = " + CPUround + "%";
bool cpuIsRed = CPUround <= 50 || CPUround >= 98;
MainForm.Instance.AddLabelToPanel(cpuText, cpuIsRed);
// Check Vaxtor if it doesn't need or have license OR has and wants one then pass
bool vaxtorIsRed = false;
string vaxtorText = "Vaxtor Key ID = " + DiagsAPI.licenses.raptorKeyID;
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;
// OK - passes condition
vaxtorIsRed = false;
}
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
if (!RegexCache.VaxtorRegex().IsMatch(ProdcutKeyID)) // Means they chose valid Key ID
{
DiagsAPI.licenses.raptorKeyID = MainForm.Instance.TxBxProductKey.Text;
vaxtorText = "Vaxtor Key ID = " + DiagsAPI.licenses.raptorKeyID;
vaxtorIsRed = false;
}
else
{
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");
vaxtorIsRed = true;
}
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
else // Should have license but doesn't OR shouldn't have but does + any other unforeseen circumstance then fail
{
MainForm.Instance.lblVaxtor.Text += DiagsAPI.licenses.raptorKeyID;
MainForm.Instance.lblVaxtor.ForeColor = Color.Red;
vaxtorIsRed = true;
}
MainForm.Instance.AddLabelToPanel(vaxtorText, vaxtorIsRed);
// 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];
string trimText = "Trim = 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;
bool trimIsRed = Math.Abs(DiagsAPI.trim[0]) > HMax || Math.Abs(DiagsAPI.trim[1]) > VMax;
MainForm.Instance.AddLabelToPanel(trimText, trimIsRed);
}
}
}

291
AiQ_GUI.Designer.cs generated
View File

@@ -43,21 +43,6 @@ namespace AiQ_GUI
BtnClose = new Button();
PicBxMAV = new PictureBox();
PicBxAiQ = new PictureBox();
lblFlexiVer = new Label();
lblFlexiRev = new Label();
lblMac = new Label();
lbltimestamp = new Label();
lblSerial = new Label();
lblModel = new Label();
lblLic = new Label();
lblVaxtor = new Label();
lblTemp = new Label();
lblTrim = new Label();
lblZoomLock = new Label();
LblLEDI = new Label();
LblLEDV = new Label();
LblOVModule = new Label();
LblIRModule = new Label();
BtnTest = new Button();
PicBxIRF2 = new PictureBox();
LblIRImageF2 = new Label();
@@ -127,10 +112,6 @@ namespace AiQ_GUI
BtnEzOn = new Button();
BtnSetAll211 = new Button();
PnlLbls = new Panel();
LblRouter = new Label();
LblDC = new Label();
LblFilesystemSize = new Label();
LblCPUusage = new Label();
BtnOpenWebpage = new Button();
LblIRImageF16 = new Label();
ToolTipClipboard = new ToolTip(components);
@@ -172,7 +153,6 @@ namespace AiQ_GUI
PnlQuestion.SuspendLayout();
PnlInputValue.SuspendLayout();
((System.ComponentModel.ISupportInitialize)RMANumBox).BeginInit();
PnlLbls.SuspendLayout();
TabImagesandSettings.SuspendLayout();
TabControls.SuspendLayout();
groupBox4.SuspendLayout();
@@ -202,7 +182,7 @@ namespace AiQ_GUI
CbBxCameraModel.Name = "CbBxCameraModel";
CbBxCameraModel.Size = new Size(494, 25);
CbBxCameraModel.TabIndex = 188;
CbBxCameraModel.SelectedIndexChanged += CbBxCameraModel_SelectedIndexChanged;
CbBxCameraModel.SelectedIndexChanged += CbBxCamTypSelectedIndexChanged;
//
// BtnStartTest
//
@@ -370,201 +350,6 @@ namespace AiQ_GUI
PicBxAiQ.TabIndex = 173;
PicBxAiQ.TabStop = false;
//
// lblFlexiVer
//
lblFlexiVer.BackColor = Color.Transparent;
lblFlexiVer.Font = new Font("Segoe UI Semibold", 10F, FontStyle.Bold, GraphicsUnit.Point, 0);
lblFlexiVer.ForeColor = SystemColors.Control;
lblFlexiVer.Location = new Point(5, 46);
lblFlexiVer.Margin = new Padding(4, 0, 4, 0);
lblFlexiVer.Name = "lblFlexiVer";
lblFlexiVer.Padding = new Padding(2);
lblFlexiVer.Size = new Size(481, 23);
lblFlexiVer.TabIndex = 174;
lblFlexiVer.Text = "Flexi Version = ";
//
// lblFlexiRev
//
lblFlexiRev.BackColor = Color.Transparent;
lblFlexiRev.Font = new Font("Segoe UI Semibold", 10F, FontStyle.Bold);
lblFlexiRev.ForeColor = SystemColors.Control;
lblFlexiRev.Location = new Point(5, 69);
lblFlexiRev.Margin = new Padding(4, 0, 4, 0);
lblFlexiRev.Name = "lblFlexiRev";
lblFlexiRev.Padding = new Padding(2);
lblFlexiRev.Size = new Size(481, 23);
lblFlexiRev.TabIndex = 175;
lblFlexiRev.Text = "Flexi Revision = ";
//
// lblMac
//
lblMac.BackColor = Color.Transparent;
lblMac.Font = new Font("Segoe UI Semibold", 10F, FontStyle.Bold);
lblMac.ForeColor = SystemColors.Control;
lblMac.Location = new Point(5, 92);
lblMac.Margin = new Padding(4, 0, 4, 0);
lblMac.Name = "lblMac";
lblMac.Padding = new Padding(2);
lblMac.Size = new Size(481, 23);
lblMac.TabIndex = 176;
lblMac.Text = "MAC Address = ";
//
// lbltimestamp
//
lbltimestamp.BackColor = Color.Transparent;
lbltimestamp.Font = new Font("Segoe UI Semibold", 10F, FontStyle.Bold);
lbltimestamp.ForeColor = SystemColors.Control;
lbltimestamp.Location = new Point(4, 209);
lbltimestamp.Margin = new Padding(4, 0, 4, 0);
lbltimestamp.Name = "lbltimestamp";
lbltimestamp.Padding = new Padding(2);
lbltimestamp.Size = new Size(481, 23);
lbltimestamp.TabIndex = 177;
lbltimestamp.Text = "Camera Time = ";
//
// lblSerial
//
lblSerial.BackColor = Color.Transparent;
lblSerial.Font = new Font("Segoe UI Semibold", 10F, FontStyle.Bold);
lblSerial.ForeColor = SystemColors.Control;
lblSerial.Location = new Point(5, 0);
lblSerial.Margin = new Padding(4, 0, 4, 0);
lblSerial.Name = "lblSerial";
lblSerial.Padding = new Padding(2);
lblSerial.Size = new Size(481, 23);
lblSerial.TabIndex = 178;
lblSerial.Text = "Serial Number = ";
//
// lblModel
//
lblModel.BackColor = Color.Transparent;
lblModel.Font = new Font("Segoe UI Semibold", 10F, FontStyle.Bold);
lblModel.ForeColor = SystemColors.Control;
lblModel.Location = new Point(5, 23);
lblModel.Margin = new Padding(4, 0, 4, 0);
lblModel.Name = "lblModel";
lblModel.Padding = new Padding(2);
lblModel.Size = new Size(481, 23);
lblModel.TabIndex = 179;
lblModel.Text = "Model Number = ";
//
// lblLic
//
lblLic.BackColor = Color.Transparent;
lblLic.Font = new Font("Segoe UI Semibold", 10F, FontStyle.Bold);
lblLic.ForeColor = SystemColors.Control;
lblLic.Location = new Point(5, 114);
lblLic.Margin = new Padding(4, 0, 4, 0);
lblLic.Name = "lblLic";
lblLic.Padding = new Padding(2);
lblLic.Size = new Size(481, 23);
lblLic.TabIndex = 180;
lblLic.Text = "Licenses = ";
//
// lblVaxtor
//
lblVaxtor.BackColor = Color.Transparent;
lblVaxtor.Font = new Font("Segoe UI Semibold", 10F, FontStyle.Bold);
lblVaxtor.ForeColor = SystemColors.Control;
lblVaxtor.Location = new Point(5, 160);
lblVaxtor.Margin = new Padding(4, 0, 4, 0);
lblVaxtor.Name = "lblVaxtor";
lblVaxtor.Padding = new Padding(2);
lblVaxtor.Size = new Size(481, 25);
lblVaxtor.TabIndex = 181;
lblVaxtor.Text = "Vaxtor Key ID = ";
//
// lblTemp
//
lblTemp.BackColor = Color.Transparent;
lblTemp.Font = new Font("Segoe UI Semibold", 10F, FontStyle.Bold);
lblTemp.ForeColor = SystemColors.Control;
lblTemp.Location = new Point(4, 232);
lblTemp.Margin = new Padding(4, 0, 4, 0);
lblTemp.Name = "lblTemp";
lblTemp.Padding = new Padding(2);
lblTemp.Size = new Size(481, 27);
lblTemp.TabIndex = 182;
lblTemp.Text = "Internal Temperature = ";
//
// lblTrim
//
lblTrim.BackColor = Color.Transparent;
lblTrim.Font = new Font("Segoe UI Semibold", 10F, FontStyle.Bold);
lblTrim.ForeColor = SystemColors.Control;
lblTrim.Location = new Point(5, 186);
lblTrim.Margin = new Padding(4, 0, 4, 0);
lblTrim.Name = "lblTrim";
lblTrim.Padding = new Padding(2);
lblTrim.Size = new Size(481, 23);
lblTrim.TabIndex = 183;
lblTrim.Text = "Trim = ";
//
// lblZoomLock
//
lblZoomLock.BackColor = Color.Transparent;
lblZoomLock.Font = new Font("Segoe UI Semibold", 10F, FontStyle.Bold);
lblZoomLock.ForeColor = SystemColors.Control;
lblZoomLock.Location = new Point(4, 278);
lblZoomLock.Margin = new Padding(4, 0, 4, 0);
lblZoomLock.Name = "lblZoomLock";
lblZoomLock.Padding = new Padding(2);
lblZoomLock.Size = new Size(481, 23);
lblZoomLock.TabIndex = 184;
lblZoomLock.Text = "ZoomLock = ";
//
// LblLEDI
//
LblLEDI.BackColor = Color.Transparent;
LblLEDI.Font = new Font("Segoe UI Semibold", 10F, FontStyle.Bold);
LblLEDI.ForeColor = SystemColors.Control;
LblLEDI.Location = new Point(4, 324);
LblLEDI.Margin = new Padding(4, 0, 4, 0);
LblLEDI.Name = "LblLEDI";
LblLEDI.Padding = new Padding(2);
LblLEDI.Size = new Size(481, 23);
LblLEDI.TabIndex = 186;
LblLEDI.Text = "LED Current = ";
//
// LblLEDV
//
LblLEDV.BackColor = Color.Transparent;
LblLEDV.Font = new Font("Segoe UI Semibold", 10F, FontStyle.Bold);
LblLEDV.ForeColor = SystemColors.Control;
LblLEDV.Location = new Point(4, 301);
LblLEDV.Margin = new Padding(4, 0, 4, 0);
LblLEDV.Name = "LblLEDV";
LblLEDV.Padding = new Padding(2);
LblLEDV.Size = new Size(481, 27);
LblLEDV.TabIndex = 185;
LblLEDV.Text = "LED Voltage = ";
//
// LblOVModule
//
LblOVModule.BackColor = Color.Transparent;
LblOVModule.Font = new Font("Segoe UI Semibold", 10F, FontStyle.Bold);
LblOVModule.ForeColor = SystemColors.Control;
LblOVModule.Location = new Point(4, 370);
LblOVModule.Margin = new Padding(4, 0, 4, 0);
LblOVModule.Name = "LblOVModule";
LblOVModule.Padding = new Padding(2);
LblOVModule.Size = new Size(481, 23);
LblOVModule.TabIndex = 189;
LblOVModule.Text = "OV Camera Module = ";
//
// LblIRModule
//
LblIRModule.BackColor = Color.Transparent;
LblIRModule.Font = new Font("Segoe UI Semibold", 10F, FontStyle.Bold);
LblIRModule.ForeColor = SystemColors.Control;
LblIRModule.Location = new Point(4, 347);
LblIRModule.Margin = new Padding(4, 0, 4, 0);
LblIRModule.Name = "LblIRModule";
LblIRModule.Padding = new Padding(2);
LblIRModule.Size = new Size(481, 23);
LblIRModule.TabIndex = 188;
LblIRModule.Text = "IR Camera Module = ";
//
// BtnTest
//
BtnTest.BackColor = Color.FromArgb(70, 65, 80);
@@ -1568,85 +1353,12 @@ namespace AiQ_GUI
// PnlLbls
//
PnlLbls.BackColor = Color.Transparent;
PnlLbls.Controls.Add(LblRouter);
PnlLbls.Controls.Add(LblDC);
PnlLbls.Controls.Add(LblFilesystemSize);
PnlLbls.Controls.Add(lblVaxtor);
PnlLbls.Controls.Add(LblCPUusage);
PnlLbls.Controls.Add(LblLEDV);
PnlLbls.Controls.Add(lblFlexiVer);
PnlLbls.Controls.Add(lblFlexiRev);
PnlLbls.Controls.Add(LblIRModule);
PnlLbls.Controls.Add(lblMac);
PnlLbls.Controls.Add(LblOVModule);
PnlLbls.Controls.Add(lbltimestamp);
PnlLbls.Controls.Add(lblSerial);
PnlLbls.Controls.Add(lblModel);
PnlLbls.Controls.Add(lblZoomLock);
PnlLbls.Controls.Add(lblLic);
PnlLbls.Controls.Add(lblTrim);
PnlLbls.Controls.Add(lblTemp);
PnlLbls.Controls.Add(LblLEDI);
PnlLbls.Location = new Point(7, 517);
PnlLbls.Margin = new Padding(4, 3, 4, 3);
PnlLbls.Name = "PnlLbls";
PnlLbls.Size = new Size(503, 452);
PnlLbls.TabIndex = 198;
//
// LblRouter
//
LblRouter.BackColor = Color.Transparent;
LblRouter.Font = new Font("Segoe UI Semibold", 10F, FontStyle.Bold);
LblRouter.ForeColor = SystemColors.Control;
LblRouter.Location = new Point(5, 417);
LblRouter.Margin = new Padding(4, 0, 4, 0);
LblRouter.Name = "LblRouter";
LblRouter.Padding = new Padding(2);
LblRouter.Size = new Size(481, 23);
LblRouter.TabIndex = 193;
LblRouter.Text = "Router = ";
LblRouter.Visible = false;
//
// LblDC
//
LblDC.BackColor = Color.Transparent;
LblDC.Font = new Font("Segoe UI Semibold", 10F, FontStyle.Bold);
LblDC.ForeColor = SystemColors.Control;
LblDC.Location = new Point(5, 393);
LblDC.Margin = new Padding(4, 0, 4, 0);
LblDC.Name = "LblDC";
LblDC.Padding = new Padding(2);
LblDC.Size = new Size(481, 23);
LblDC.TabIndex = 192;
LblDC.Text = "DC Power = ";
LblDC.Visible = false;
//
// LblFilesystemSize
//
LblFilesystemSize.BackColor = Color.Transparent;
LblFilesystemSize.Font = new Font("Segoe UI Semibold", 10F, FontStyle.Bold);
LblFilesystemSize.ForeColor = SystemColors.Control;
LblFilesystemSize.Location = new Point(5, 137);
LblFilesystemSize.Margin = new Padding(4, 0, 4, 0);
LblFilesystemSize.Name = "LblFilesystemSize";
LblFilesystemSize.Padding = new Padding(2);
LblFilesystemSize.Size = new Size(481, 25);
LblFilesystemSize.TabIndex = 191;
LblFilesystemSize.Text = "Filesystem Size = ";
//
// LblCPUusage
//
LblCPUusage.BackColor = Color.Transparent;
LblCPUusage.Font = new Font("Segoe UI Semibold", 10F, FontStyle.Bold);
LblCPUusage.ForeColor = SystemColors.Control;
LblCPUusage.Location = new Point(5, 256);
LblCPUusage.Margin = new Padding(4, 0, 4, 0);
LblCPUusage.Name = "LblCPUusage";
LblCPUusage.Padding = new Padding(2);
LblCPUusage.Size = new Size(481, 25);
LblCPUusage.TabIndex = 190;
LblCPUusage.Text = "CPU Usage = ";
//
// BtnOpenWebpage
//
BtnOpenWebpage.BackColor = Color.FromArgb(70, 65, 80);
@@ -2152,7 +1864,6 @@ namespace AiQ_GUI
PnlInputValue.ResumeLayout(false);
PnlInputValue.PerformLayout();
((System.ComponentModel.ISupportInitialize)RMANumBox).EndInit();
PnlLbls.ResumeLayout(false);
TabImagesandSettings.ResumeLayout(false);
TabControls.ResumeLayout(false);
groupBox4.ResumeLayout(false);

View File

@@ -178,11 +178,12 @@ namespace AiQ_GUI
BtnPreTest.Enabled = BtnStartTest.Enabled = false; // Disable buttons to stop user rnning multiple tests at the same time.
Logging.LogMessage("Final Test Started");
if (CbBxCameraModel.Text == "AiQ")
if (CbBxCamType.Text == "AiQ")
{
AiQTests.AiQFinalTest();
await AiQTests.AiQFinalTest();
}
else if (CbBxCameraModel.Text == "Mobile")
else if (CbBxCamType.Text == "Mobile")
{
await PreTestPassed();
}
@@ -197,7 +198,7 @@ namespace AiQ_GUI
Logging.LogMessage("Pre Test Started");
if (CbBxCamType.Text == "AiQ")
{
AiQTests.AiQPreTest();
await AiQTests.AiQPreTest();
}
else if (CbBxCamType.Text == "Mobile")
{
@@ -596,11 +597,6 @@ namespace AiQ_GUI
TestStartConditions();
}
private void CbBxCameraModel_SelectedIndexChanged(object sender, EventArgs e)
{
TestStartConditions();
}
private void btnPsuOn_Click(object sender, EventArgs e)
{
@@ -675,6 +671,12 @@ namespace AiQ_GUI
RhTxBxActions.ScrollToCaret();
}
private void CbBxCamTypSelectedIndexChanged(object sender, EventArgs e)
{
TestStartConditions();
}
private async void TestStartConditions()
{
if (Flags.Start)
@@ -1433,11 +1435,62 @@ namespace AiQ_GUI
Stopwatch stopWatchTest = Stopwatch.StartNew();
await MobilePreTest.CheckFirmwareAsync();
//await MobilePreTest.CheckFirmwareAsync();
//AddLabelToPanel("Test Complete", false);
FakeCamera fakeCamera = new FakeCamera(80); // Create an instance of FakeCamera
//CamOnTest.IP = CbBxFoundCams.Text;
_ = fakeCamera.StartAsync(CAMTYPE.GOOD).ContinueWith(task =>
{
//Network.Initialize("developer", "Pass123");
if (task.IsFaulted)
{
AddToActionsList("Error starting FakeCamera: " + task.Exception?.Message);
}
else
{
AddToActionsList($"FakeCamera started successfully. IP: {fakeCamera}");
}
});
await Task.Delay(3000); // Wait for server to start
CbBxFoundCams.Text = "localhost"; // Should force update in creds an network reinit
CmBoFoundCams_TextChanged(sender, e);
CbBxCameraModel.SelectedIndex = CbBxCameraModel.Items.Count - 1; // Selects AB12CD as model number
await Task.Delay(3000); // Wait for server to start
BtnStartTest_Click(sender, e);
AddToActionsList("RunTime " + stopWatchTest.Elapsed.ToString(@"hh\:mm\:ss\.ff"), Level.LOG);
}
public static Label MakeNewLabel(string text, bool isRed, int yLoc)
{
return new Label
{
Location = new Point(5, yLoc),
Height = 20,
Width = 220,
ForeColor = isRed ? Color.Red : Color.LightGreen,
Text = text,
Name = "Lbl_" + Guid.NewGuid(),
AutoSize = false
};
}
public void AddLabelToPanel(string text, bool isRed)
{
int yLoc = PnlLbls.Controls
.OfType<Label>()
.Count() * 22; // 20 height + 2px spacing
Label lbl = MakeNewLabel(text, isRed, yLoc);
PnlLbls.Controls.Add(lbl);
}
}
}

View File

@@ -43,12 +43,12 @@ namespace AiQ_GUI
{
if (string.IsNullOrWhiteSpace(errMssg))
{
Lbl.Text += "OK";
Lbl.ForeColor = Color.LightGreen;
Lbl.Text = Lbl.Text.TrimEnd('=', ' ') + " = OK"; // SET the text with proper format
Lbl.ForeColor = Color.LimeGreen;
}
else
{
Lbl.Text += errMssg;
Lbl.Text = Lbl.Text.TrimEnd('=', ' ') + " = " + errMssg; // SET the text with error message
Lbl.ForeColor = Color.Red;
}
});

View File

@@ -9,7 +9,7 @@
{
VorI.Sort(); // Sort the list from lowest to highest to prepare for finding the median
double medianVorI = (VorI[2] + VorI[3]) / 2.0; // Will always be even (6) number of channels therefore average the two middle elements
lblVorI.Text += $"Median: {medianVorI}{VormA} "; // Display median value
string medianText = $"Median: {medianVorI}{VormA}";
// Define the 20% threshold ranges
double LowerThreshold = ExpVorI * 0.8;
@@ -18,8 +18,12 @@
// Check median is within 20% of the expected value
if (medianVorI < LowerThreshold || medianVorI > UpperThreshold)
{
lblVorI.Text += $" Median away from excepted {ExpVorI}{VormA}";
lblVorI.ForeColor = Color.Red;
medianText += $" (away from expected {ExpVorI}{VormA})";
lblVorI.Invoke(() =>
{
lblVorI.Text = lblVorI.Text.TrimEnd('=', ' ') + " = " + medianText;
lblVorI.ForeColor = Color.Red;
});
return;
}
@@ -35,12 +39,20 @@
// If there are no single channels outside the threshold then green, else red
if (outOfRangeVoltageChannels.Count == 0)
{
lblVorI.ForeColor = Color.LightGreen;
lblVorI.Invoke(() =>
{
lblVorI.Text = lblVorI.Text.TrimEnd('=', ' ') + " = " + medianText;
lblVorI.ForeColor = Color.LimeGreen;
});
}
else if (outOfRangeVoltageChannels.Count != 0)
{
lblVorI.Text += "error on " + string.Join(", ", outOfRangeVoltageChannels); // Join all problem channels together to present on form
lblVorI.ForeColor = Color.Red;
string errorText = medianText + " (error on " + string.Join(", ", outOfRangeVoltageChannels) + ")";
lblVorI.Invoke(() =>
{
lblVorI.Text = lblVorI.Text.TrimEnd('=', ' ') + " = " + errorText;
lblVorI.ForeColor = Color.Red;
});
}
}
catch (Exception ex)

View File

@@ -40,6 +40,13 @@ namespace AiQ_GUI
{
SshClient client = SshConnect(IPAddress);
// CRITICAL: Check if connection actually succeeded
if (client == null)
{
MainForm.Instance.AddToActionsList($"SSH connection failed for {IPAddress}", Level.ERROR);
return Data; // Return empty data
}
try
{
Data.packages = GetVaxtorPackages(client);
@@ -78,9 +85,6 @@ namespace AiQ_GUI
MainForm.Instance.AddToActionsList($"SSH connection failed: {ex.Message}. Check password or network. ", Level.WARNING);
}
string LogMssg = string.Join(" | ", typeof(SSHData).GetProperties().Select(p => $"{p.Name}: {p.GetValue(Data)}"));
Logging.LogMessage(LogMssg); // Log all of Data
return Data;
}
@@ -234,6 +238,14 @@ namespace AiQ_GUI
const double Deviation = 20.0; // ±20GB
double currentSize = NormaliseFSSize(sshData.FilesystemSize);
// Create label dynamically if not provided
if (LblFSSize == null)
{
MainForm.Instance.AddLabelToPanel($"Filesystem Size = {currentSize}GB", currentSize < (GoodSize - Deviation) || currentSize > (GoodSize + Deviation));
return sshData;
}
LblFSSize.Text = $"Filesystem Size = {currentSize}GB";
if (Math.Abs(GoodSize - currentSize) < Deviation)
@@ -280,7 +292,8 @@ namespace AiQ_GUI
{
try
{
if (string.IsNullOrWhiteSpace(rootSize)) return 0;
if (string.IsNullOrWhiteSpace(rootSize))
return 0;
// Extract value & unit
System.Text.RegularExpressions.Match match = RegexCache.FileSizeRegex().Match(rootSize.Trim());