• Camera/LED.cs
• Added null-checks so labels are created dynamically when lblVorI is null (uses MainForm.Instance.AddLabelToPanel). • Camera/CameraModules.cs • Added null-label handling to create dynamic module labels with the correct content (OK or the error message). • AiQ_GUI.cs • Increased dynamic label width in MakeNewLabel from 220 → 700 to avoid truncated messages. • Succesfully ran through a pre-test with dynamic labels
This commit is contained in:
@@ -11,6 +11,23 @@
|
||||
double medianVorI = (VorI[2] + VorI[3]) / 2.0; // Will always be even (6) number of channels therefore average the two middle elements
|
||||
string medianText = $"Median: {medianVorI}{VormA}";
|
||||
|
||||
//Expected value of 0 means informational only (force green)
|
||||
if (ExpVorI == 0)
|
||||
{
|
||||
if (lblVorI == null)
|
||||
{
|
||||
MainForm.Instance.AddLabelToPanel($"LED {VormA} = {medianText}", false);
|
||||
return;
|
||||
}
|
||||
|
||||
lblVorI.Invoke(() =>
|
||||
{
|
||||
lblVorI.Text = lblVorI.Text.TrimEnd('=', ' ') + " = " + medianText;
|
||||
lblVorI.ForeColor = Color.LimeGreen;
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// Define the 20% threshold ranges
|
||||
double LowerThreshold = ExpVorI * 0.8;
|
||||
double UpperThreshold = ExpVorI * 1.2;
|
||||
@@ -19,6 +36,11 @@
|
||||
if (medianVorI < LowerThreshold || medianVorI > UpperThreshold)
|
||||
{
|
||||
medianText += $" (away from expected {ExpVorI}{VormA})";
|
||||
if (lblVorI == null)
|
||||
{
|
||||
MainForm.Instance.AddLabelToPanel($"LED {VormA} = {medianText}", true);
|
||||
return;
|
||||
}
|
||||
lblVorI.Invoke(() =>
|
||||
{
|
||||
lblVorI.Text = lblVorI.Text.TrimEnd('=', ' ') + " = " + medianText;
|
||||
@@ -39,6 +61,11 @@
|
||||
// If there are no single channels outside the threshold then green, else red
|
||||
if (outOfRangeVoltageChannels.Count == 0)
|
||||
{
|
||||
if (lblVorI == null)
|
||||
{
|
||||
MainForm.Instance.AddLabelToPanel($"LED {VormA} = {medianText}", false);
|
||||
return;
|
||||
}
|
||||
lblVorI.Invoke(() =>
|
||||
{
|
||||
lblVorI.Text = lblVorI.Text.TrimEnd('=', ' ') + " = " + medianText;
|
||||
@@ -48,6 +75,11 @@
|
||||
else if (outOfRangeVoltageChannels.Count != 0)
|
||||
{
|
||||
string errorText = medianText + " (error on " + string.Join(", ", outOfRangeVoltageChannels) + ")";
|
||||
if (lblVorI == null)
|
||||
{
|
||||
MainForm.Instance.AddLabelToPanel($"LED {VormA} = {errorText}", true);
|
||||
return;
|
||||
}
|
||||
lblVorI.Invoke(() =>
|
||||
{
|
||||
lblVorI.Text = lblVorI.Text.TrimEnd('=', ' ') + " = " + errorText;
|
||||
|
||||
Reference in New Issue
Block a user