In FlexiAPI SetVaxtorMinMaxPlate() Has been added + Other small changes

This commit is contained in:
2025-10-21 14:04:59 +01:00
parent a2f86625be
commit b59d023887
5 changed files with 67 additions and 25 deletions

40
AiQ_GUI.Designer.cs generated
View File

@@ -148,6 +148,7 @@ namespace AiQ_GUI
BtnFirewall = new Button(); BtnFirewall = new Button();
TabImages = new TabPage(); TabImages = new TabPage();
TabSoak = new TabPage(); TabSoak = new TabPage();
BtnFactoryDefault = new Button();
SetGodModeAll = new Button(); SetGodModeAll = new Button();
BtnUploadBlob = new Button(); BtnUploadBlob = new Button();
CkBxTickAll = new CheckBox(); CkBxTickAll = new CheckBox();
@@ -157,7 +158,6 @@ namespace AiQ_GUI
LblGUIVers = new Label(); LblGUIVers = new Label();
timerTypeIP = new System.Windows.Forms.Timer(components); timerTypeIP = new System.Windows.Forms.Timer(components);
TimerFlash = new System.Windows.Forms.Timer(components); TimerFlash = new System.Windows.Forms.Timer(components);
BtnFactoryDefault = new Button();
((System.ComponentModel.ISupportInitialize)PicBxMAV).BeginInit(); ((System.ComponentModel.ISupportInitialize)PicBxMAV).BeginInit();
((System.ComponentModel.ISupportInitialize)PicBxAiQ).BeginInit(); ((System.ComponentModel.ISupportInitialize)PicBxAiQ).BeginInit();
((System.ComponentModel.ISupportInitialize)PicBxIRF2).BeginInit(); ((System.ComponentModel.ISupportInitialize)PicBxIRF2).BeginInit();
@@ -270,7 +270,7 @@ namespace AiQ_GUI
CbBxUserName.Font = new Font("Segoe UI Semibold", 10F, FontStyle.Bold); CbBxUserName.Font = new Font("Segoe UI Semibold", 10F, FontStyle.Bold);
CbBxUserName.ForeColor = SystemColors.Control; CbBxUserName.ForeColor = SystemColors.Control;
CbBxUserName.FormattingEnabled = true; CbBxUserName.FormattingEnabled = true;
CbBxUserName.Items.AddRange(new object[] { "Guest", "Clive", "Conor", "Charlie", "Henry", "Sam C", "Sam L", "Simon", "Toby", "Tom" }); CbBxUserName.Items.AddRange(new object[] { "Guest", "Clive", "Conor", "Charlie", "Henry", "Sam C", "Sam L", "Simon", "Sophie", "Toby", "Tom" });
CbBxUserName.Location = new Point(10, 262); CbBxUserName.Location = new Point(10, 262);
CbBxUserName.Margin = new Padding(4, 3, 4, 3); CbBxUserName.Margin = new Padding(4, 3, 4, 3);
CbBxUserName.Name = "CbBxUserName"; CbBxUserName.Name = "CbBxUserName";
@@ -1910,6 +1910,24 @@ namespace AiQ_GUI
TabSoak.TabIndex = 2; TabSoak.TabIndex = 2;
TabSoak.Text = "Soak"; TabSoak.Text = "Soak";
// //
// BtnFactoryDefault
//
BtnFactoryDefault.BackColor = Color.FromArgb(70, 65, 80);
BtnFactoryDefault.Enabled = false;
BtnFactoryDefault.FlatAppearance.BorderColor = Color.FromArgb(70, 65, 80);
BtnFactoryDefault.FlatAppearance.BorderSize = 0;
BtnFactoryDefault.FlatStyle = FlatStyle.Flat;
BtnFactoryDefault.Font = new Font("Segoe UI Semibold", 10F, FontStyle.Bold);
BtnFactoryDefault.ForeColor = SystemColors.Control;
BtnFactoryDefault.Location = new Point(222, 209);
BtnFactoryDefault.Margin = new Padding(4, 3, 4, 3);
BtnFactoryDefault.Name = "BtnFactoryDefault";
BtnFactoryDefault.Size = new Size(181, 49);
BtnFactoryDefault.TabIndex = 242;
BtnFactoryDefault.Text = "Set Modules to Factory Defaults";
BtnFactoryDefault.UseVisualStyleBackColor = false;
BtnFactoryDefault.Click += BtnFactoryDefault_Click;
//
// SetGodModeAll // SetGodModeAll
// //
SetGodModeAll.BackColor = Color.FromArgb(70, 65, 80); SetGodModeAll.BackColor = Color.FromArgb(70, 65, 80);
@@ -2000,24 +2018,6 @@ namespace AiQ_GUI
timerTypeIP.Interval = 2000; timerTypeIP.Interval = 2000;
timerTypeIP.Tick += timerTypeIP_Tick; timerTypeIP.Tick += timerTypeIP_Tick;
// //
// BtnFactoryDefault
//
BtnFactoryDefault.BackColor = Color.FromArgb(70, 65, 80);
BtnFactoryDefault.Enabled = false;
BtnFactoryDefault.FlatAppearance.BorderColor = Color.FromArgb(70, 65, 80);
BtnFactoryDefault.FlatAppearance.BorderSize = 0;
BtnFactoryDefault.FlatStyle = FlatStyle.Flat;
BtnFactoryDefault.Font = new Font("Segoe UI Semibold", 10F, FontStyle.Bold);
BtnFactoryDefault.ForeColor = SystemColors.Control;
BtnFactoryDefault.Location = new Point(222, 209);
BtnFactoryDefault.Margin = new Padding(4, 3, 4, 3);
BtnFactoryDefault.Name = "BtnFactoryDefault";
BtnFactoryDefault.Size = new Size(181, 49);
BtnFactoryDefault.TabIndex = 242;
BtnFactoryDefault.Text = "Set Modules to Factory Defaults";
BtnFactoryDefault.UseVisualStyleBackColor = false;
BtnFactoryDefault.Click += BtnFactoryDefault_Click;
//
// MainForm // MainForm
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);

View File

@@ -42,7 +42,7 @@ namespace AiQ_GUI
Stopwatch stopwatch = Stopwatch.StartNew(); Stopwatch stopwatch = Stopwatch.StartNew();
Task? closeProcessesTask = Windows.CloseProcesses(); // Fire and forget closing other apps Task? closeProcessesTask = Windows.CloseProcesses(); // Fire and forget closing other apps
Windows.UpdateFirewall(); //Windows.UpdateFirewall();
Task UniDataTask = Task.Run(() => Access.ReadUniData()); // Get universal data Task UniDataTask = Task.Run(() => Access.ReadUniData()); // Get universal data
Task<LocalDataStore> LDSWAIT = Task.Run(() => LDS.GetLDS()); // Get and deserialise LDS.json Task<LocalDataStore> LDSWAIT = Task.Run(() => LDS.GetLDS()); // Get and deserialise LDS.json
Task<string> guiVerTask = Task.Run(() => GUIUpdate.FindGUIVersion()); // Get GUI Version Task<string> guiVerTask = Task.Run(() => GUIUpdate.FindGUIVersion()); // Get GUI Version
@@ -209,6 +209,7 @@ namespace AiQ_GUI
if (!LEDreply.Contains("Power levels set successfully")) if (!LEDreply.Contains("Power levels set successfully"))
AddToActionsList($"LED level could not be set: {LEDreply}"); AddToActionsList($"LED level could not be set: {LEDreply}");
} }
await FlexiAPI.SetVaxtorMinMaxPlate(CamOnTest.IP);
DateTime PCTime = DateTime.Now; // Grab PC time as close to the API as possible to pass onto PDF later DateTime PCTime = DateTime.Now; // Grab PC time as close to the API as possible to pass onto PDF later
@@ -1854,9 +1855,9 @@ namespace AiQ_GUI
//double Spd = EstimateSpeed(frames); //double Spd = EstimateSpeed(frames);
//AddToActionsList("Estimated Speed: " + Spd.ToString("F2") + " MPH"); //AddToActionsList("Estimated Speed: " + Spd.ToString("F2") + " MPH");
await FlexiAPI.SetVaxtorMinMaxPlate(CamOnTest.IP);
StatsExcel excelExporter = new(); //StatsExcel excelExporter = new();
excelExporter.ExportDatabaseToExcel(); //excelExporter.ExportDatabaseToExcel();
//FakeCamera fakeCamera = new FakeCamera(80); // Create an instance of FakeCamera //FakeCamera fakeCamera = new FakeCamera(80); // Create an instance of FakeCamera

View File

@@ -159,6 +159,37 @@ namespace AiQ_GUI
return null; // If it fails to parse the JSON return null; // If it fails to parse the JSON
} }
} }
public static async Task<bool> SetVaxtorMinMaxPlate(string IP)
{
try
{
// Build JSON array for Vaxtor min/max plate configuration
string[,] Vaxtor_JSON = { { "propMinCharHeight", "18" }, { "propMinGlobalConfidence", "30" } };
string response = await HTTP_Update("RaptorOCR".Trim(), IP, Vaxtor_JSON);
// Treat "operation was canceled" as a successful apply
if (response.Contains("The operation was canceled", StringComparison.OrdinalIgnoreCase))
{
Logging.LogMessage("SetVaxtorMinMaxPlate: Camera applied config but closed connection early (safe to ignore).");
return true;
}
if (response.Contains("error", StringComparison.OrdinalIgnoreCase))
{
MainForm.Instance.DisplayQuestion($"SetVaxtorMinMaxPlate: failed - Please set manually");
return false;
}
return true;
}
catch (Exception ex)
{
MainForm.Instance.AddToActionsList($"Could not set Vaxtor Plate height and min confidence: {ex.Message}");
return false;
}
}
public static async Task<bool> SetZoomLockOn(string IP) public static async Task<bool> SetZoomLockOn(string IP)
{ {
@@ -404,5 +435,13 @@ namespace AiQ_GUI
public class Property public class Property
{ {
public string Value { get; set; } = string.Empty; public string Value { get; set; } = string.Empty;
public string datatype { get; set; }
}
public class VaxtorConfig
{
public string id { get; set; }
public long configHash { get; set; }
public Property propMinCharHeight { get; set; }
public Property propMinGlobalConfidence { get; set; }
} }
} }

2
LDS.cs
View File

@@ -35,7 +35,9 @@ namespace AiQ_GUI
} }
catch // If file can't deserialise catch // If file can't deserialise
{ {
MainForm.Instance.AddToActionsList("Error loading Local Data Store");
return null; // Return null to indicate failure return null; // Return null to indicate failure
} }
} }

View File

@@ -11,7 +11,7 @@ namespace AiQ_GUI.Microsoft
@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=G:\Shared drives\MAV Production GUI's\AiQ\GUI's\AiQ_Final_Test.accdb;Persist Security Info=False;OLE DB Services=-1;"; @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=G:\Shared drives\MAV Production GUI's\AiQ\GUI's\AiQ_Final_Test.accdb;Persist Security Info=False;OLE DB Services=-1;";
private readonly string exportPath = private readonly string exportPath =
@"C:\Users\BradleyBorn\OneDrive - MAV Systems Ltd\Desktop\AiQ_Test_Stats.xlsx"; @"G:\Shared drives\MAV Production GUI's\AiQ\GUI's\AiQ_Test_Stats.xlsx";
public void ExportDatabaseToExcel() public void ExportDatabaseToExcel()
{ {