'iPerl Heads' edit feature and tool strip menu item added, delays after Quido.SetOutputs() increased to 2000ms.

This commit is contained in:
Milan Hanajik 2017-11-03 10:57:30 +01:00
parent 441d950e94
commit 996b88cb2e
14 changed files with 5096 additions and 1175 deletions

View File

@ -9,16 +9,16 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
public class CommCompletedEventArgs : EventArgs
{
public int ThreadId;
public int WMNr;
public int WMNr0; /// 0-based water meter position
public iPerlHead.IperlHead Ihead;
public Results.Entities.WaterMeter Wm;
public string CommMessage;
public CommErr CommErr;
public CommCompletedEventArgs(int threadId, int wmNr, iPerlHead.IperlHead ihead, Results.Entities.WaterMeter wm, string commMessage, CommErr commErr)
public CommCompletedEventArgs(int threadId, int wmNr0, iPerlHead.IperlHead ihead, Results.Entities.WaterMeter wm, string commMessage, CommErr commErr)
{
this.ThreadId = threadId;
this.WMNr = wmNr;
this.WMNr0 = wmNr0;
this.Ihead = ihead;
this.Wm = wm;
this.CommMessage = commMessage;

View File

@ -244,6 +244,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
const string Write2HzCorrectionStr = "Write 2Hz correction";
readonly bool checkBoxesEditMode;
DateTime startTime;
int startTimeSec;
@ -255,6 +257,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
/// <summary> Number of text boxes for serial numbers </summary>
public int WaterMetersCount;
const int MaxTextBoxesCount = 48;
int textBoxesCount;
Label[] labels;
@ -265,7 +268,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
static bool[] ckbState;
static IList<IperlHead> iperlHeads;
static IList<int> waterMeterPositions; /// keeps original 0-based indices in RegisterReaders list
static IList<int> waterMeterPositions0; /// keeps original 0-based indices in RegisterReaders list
Modbus.QuidoRS.QuidoRS quido;
@ -292,102 +295,20 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
public iPerlCommunicationForm()
{
InitializeComponent();
textBoxesCount = 48;
labels = new Label[48]
{
wmLabel1, wmLabel2, wmLabel3, wmLabel4, wmLabel5,
wmLabel6, wmLabel7, wmLabel8, wmLabel9, wmLabel10,
wmLabel11, wmLabel12, wmLabel13, wmLabel14, wmLabel15,
wmLabel16, wmLabel17, wmLabel18, wmLabel19, wmLabel20,
wmLabel21, wmLabel22, wmLabel23, wmLabel24, wmLabel25,
wmLabel26, wmLabel27, wmLabel28, wmLabel29, wmLabel30,
wmLabel31, wmLabel32, wmLabel33, wmLabel34, wmLabel35,
wmLabel36, wmLabel37, wmLabel38, wmLabel39, wmLabel40,
wmLabel41, wmLabel42, wmLabel43, wmLabel44, wmLabel45,
wmLabel46, wmLabel47, wmLabel48,
};
counters = new PictureBox[48]
{
pictureBox1, pictureBox2, pictureBox3, pictureBox4, pictureBox5,
pictureBox6, pictureBox7, pictureBox8, pictureBox9, pictureBox10,
pictureBox11, pictureBox12, pictureBox13, pictureBox14, pictureBox15,
pictureBox16, pictureBox17, pictureBox18, pictureBox19, pictureBox20,
pictureBox21, pictureBox22, pictureBox23, pictureBox24, pictureBox25,
pictureBox26, pictureBox27, pictureBox28, pictureBox29, pictureBox30,
pictureBox31, pictureBox32, pictureBox33, pictureBox34, pictureBox35,
pictureBox36, pictureBox37, pictureBox38, pictureBox39, pictureBox40,
pictureBox41, pictureBox42, pictureBox43, pictureBox44, pictureBox45,
pictureBox46, pictureBox47, pictureBox48,
};
messages = new TextBox[48]
{
wmTextBox1, wmTextBox2, wmTextBox3, wmTextBox4, wmTextBox5,
wmTextBox6, wmTextBox7, wmTextBox8, wmTextBox9, wmTextBox10,
wmTextBox11, wmTextBox12, wmTextBox13, wmTextBox14, wmTextBox15,
wmTextBox16, wmTextBox17, wmTextBox18, wmTextBox19, wmTextBox20,
wmTextBox21, wmTextBox22, wmTextBox23, wmTextBox24, wmTextBox25,
wmTextBox26, wmTextBox27, wmTextBox28, wmTextBox29, wmTextBox30,
wmTextBox31, wmTextBox32, wmTextBox33, wmTextBox34, wmTextBox35,
wmTextBox36, wmTextBox37, wmTextBox38, wmTextBox39, wmTextBox40,
wmTextBox41, wmTextBox42, wmTextBox43, wmTextBox44, wmTextBox45,
wmTextBox46, wmTextBox47, wmTextBox48,
};
checkBoxes = new CheckBoxImage[48]
{
checkBoxImage1, checkBoxImage2, checkBoxImage3, checkBoxImage4, checkBoxImage5,
checkBoxImage6, checkBoxImage7, checkBoxImage8, checkBoxImage9, checkBoxImage10,
checkBoxImage11, checkBoxImage12, checkBoxImage13, checkBoxImage14, checkBoxImage15,
checkBoxImage16, checkBoxImage17, checkBoxImage18, checkBoxImage19, checkBoxImage20,
checkBoxImage21, checkBoxImage22, checkBoxImage23, checkBoxImage24, checkBoxImage25,
checkBoxImage26, checkBoxImage27, checkBoxImage28, checkBoxImage29, checkBoxImage30,
checkBoxImage31, checkBoxImage32, checkBoxImage33, checkBoxImage34, checkBoxImage35,
checkBoxImage36, checkBoxImage37, checkBoxImage38, checkBoxImage39, checkBoxImage40,
checkBoxImage41, checkBoxImage42, checkBoxImage43, checkBoxImage44, checkBoxImage45,
checkBoxImage46, checkBoxImage47, checkBoxImage48,
};
ckbIndex = new int[48];
ckbState = new bool[48];
formCompleted = false;
startTime = DateTime.Now;
startTimeSec = StateMachine.Time;
/// Find QuidoRS
foreach (var comp in StateMachine.Components)
{
if (comp is Modbus.QuidoRS.QuidoRS)
{
quido = comp as Modbus.QuidoRS.QuidoRS;
break;
}
}
/// Attach to 'CommCompleted' handler
CommCompletedHandler += delegate(object sender, CommCompletedEventArgs args)
{
if (InvokeRequired)
{
Invoke(new EventHandler<CommCompletedEventArgs>(DoOnCommCompleted), sender, args);
}
else DoOnCommCompleted(sender, args);
};
/// Attach to 'AllCompleted' handler
AllCompletedHandler += delegate(object sender, AllCompletedEventArgs args)
{
if (InvokeRequired)
{
Invoke(new EventHandler<AllCompletedEventArgs>(DoOnAllCompleted), sender, args);
}
else DoOnAllCompleted(sender, args);
};
StartForceCloseHandler();
}
/// <summary>
/// Constructor for checkBox states (active/inactive iPerl head) editing.
/// </summary>
/// <param name="checkBoxes">Initial check box states</param>
public iPerlCommunicationForm(bool notUsed)
: this()
{
checkBoxesEditMode = true;
saveButton.Visible = true;
activityLabel.Text = Strings.Activate_Deactivate_heads;
ShuffleTextBoxes(Config.Data.WMsCount, Config.Data.LineSize);
}
/// <summary>
/// Constructor for one iPerlCommunication 'test'
@ -396,6 +317,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
public iPerlCommunicationForm(TestMethodCfg cfg, Test test, iPerlCommunicationParams testParams)
: this()
{
checkBoxesEditMode = false;
iPerlCommunicationForm.cfg = cfg;
iPerlCommunicationForm.tests = new List<Test>();
iPerlCommunicationForm.tests.Add(test);
@ -415,6 +338,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
public iPerlCommunicationForm(TestMethodCfg cfg, IList<Test> tests, IList<iPerlCommunicationParams> multiTestParams)
: this()
{
checkBoxesEditMode = false;
iPerlCommunicationForm.cfg = cfg;
iPerlCommunicationForm.tests = tests;
iPerlCommunicationForm.multiTestParams = multiTestParams;
@ -431,8 +356,48 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
void ConstructorCommon()
{
iperlHeads = new List<IperlHead>();
waterMeterPositions = new List<int>();
startTime = DateTime.Now;
startTimeSec = StateMachine.Time;
/// Find QuidoRS
if (StateMachine.Components != null)
{
foreach (var comp in StateMachine.Components)
{
if (comp is Modbus.QuidoRS.QuidoRS)
{
quido = comp as Modbus.QuidoRS.QuidoRS;
break;
}
}
}
/// Attach to 'CommCompleted' handler
CommCompletedHandler += delegate(object sender, CommCompletedEventArgs args)
{
if (InvokeRequired)
{
Invoke(new EventHandler<CommCompletedEventArgs>(DoOnCommCompleted), sender, args);
}
else DoOnCommCompleted(sender, args);
};
/// Attach to 'AllCompleted' handler
AllCompletedHandler += delegate(object sender, AllCompletedEventArgs args)
{
if (InvokeRequired)
{
Invoke(new EventHandler<AllCompletedEventArgs>(DoOnAllCompleted), sender, args);
}
else DoOnAllCompleted(sender, args);
};
formCompleted = false;
StartForceCloseHandler();
iperlHeads = new List<IperlHead>();
waterMeterPositions0 = new List<int>();
///
for (int wmPos = 0; wmPos < ProcessData.RegisterReaders.Length; wmPos++)
{
@ -441,13 +406,12 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
if (iperlHead != null)
{
iperlHeads.Add(iperlHead);
waterMeterPositions.Add(wmPos);
waterMeterPositions0.Add(wmPos);
}
}
WaterMetersCount = iperlHeads.Count;
ShuffleTextBoxes(WaterMetersCount, Config.Data.LineSize);
ShuffleTextBoxes(WaterMetersCount, Config.Data.LineSize);
///
/// Prepare worker threads, 'rfidPortNrs', 'lastGroup', etc..
@ -498,7 +462,45 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
/// <param name="lineSize">Number of watermeters in one line</param>
void ShuffleTextBoxes(int wmsCount, int lineSize)
{
if (wmsCount < textBoxesCount && lineSize > 0)
labels = new Label[MaxTextBoxesCount]
{
wmLabel1, wmLabel2, wmLabel3, wmLabel4, wmLabel5, wmLabel6, wmLabel7, wmLabel8, wmLabel9, wmLabel10,
wmLabel11, wmLabel12, wmLabel13, wmLabel14, wmLabel15, wmLabel16, wmLabel17, wmLabel18, wmLabel19, wmLabel20,
wmLabel21, wmLabel22, wmLabel23, wmLabel24, wmLabel25, wmLabel26, wmLabel27, wmLabel28, wmLabel29, wmLabel30,
wmLabel31, wmLabel32, wmLabel33, wmLabel34, wmLabel35, wmLabel36, wmLabel37, wmLabel38, wmLabel39, wmLabel40,
wmLabel41, wmLabel42, wmLabel43, wmLabel44, wmLabel45, wmLabel46, wmLabel47, wmLabel48,
};
counters = new PictureBox[MaxTextBoxesCount]
{
pictureBox1, pictureBox2, pictureBox3, pictureBox4, pictureBox5, pictureBox6, pictureBox7, pictureBox8, pictureBox9, pictureBox10,
pictureBox11, pictureBox12, pictureBox13, pictureBox14, pictureBox15, pictureBox16, pictureBox17, pictureBox18, pictureBox19, pictureBox20,
pictureBox21, pictureBox22, pictureBox23, pictureBox24, pictureBox25, pictureBox26, pictureBox27, pictureBox28, pictureBox29, pictureBox30,
pictureBox31, pictureBox32, pictureBox33, pictureBox34, pictureBox35, pictureBox36, pictureBox37, pictureBox38, pictureBox39, pictureBox40,
pictureBox41, pictureBox42, pictureBox43, pictureBox44, pictureBox45, pictureBox46, pictureBox47, pictureBox48,
};
messages = new TextBox[MaxTextBoxesCount]
{
wmTextBox1, wmTextBox2, wmTextBox3, wmTextBox4, wmTextBox5, wmTextBox6, wmTextBox7, wmTextBox8, wmTextBox9, wmTextBox10,
wmTextBox11, wmTextBox12, wmTextBox13, wmTextBox14, wmTextBox15, wmTextBox16, wmTextBox17, wmTextBox18, wmTextBox19, wmTextBox20,
wmTextBox21, wmTextBox22, wmTextBox23, wmTextBox24, wmTextBox25, wmTextBox26, wmTextBox27, wmTextBox28, wmTextBox29, wmTextBox30,
wmTextBox31, wmTextBox32, wmTextBox33, wmTextBox34, wmTextBox35, wmTextBox36, wmTextBox37, wmTextBox38, wmTextBox39, wmTextBox40,
wmTextBox41, wmTextBox42, wmTextBox43, wmTextBox44, wmTextBox45, wmTextBox46, wmTextBox47, wmTextBox48,
};
checkBoxes = new CheckBoxImage[MaxTextBoxesCount]
{
checkBoxImage1, checkBoxImage2, checkBoxImage3, checkBoxImage4, checkBoxImage5, checkBoxImage6, checkBoxImage7, checkBoxImage8, checkBoxImage9, checkBoxImage10,
checkBoxImage11, checkBoxImage12, checkBoxImage13, checkBoxImage14, checkBoxImage15, checkBoxImage16, checkBoxImage17, checkBoxImage18, checkBoxImage19, checkBoxImage20,
checkBoxImage21, checkBoxImage22, checkBoxImage23, checkBoxImage24, checkBoxImage25, checkBoxImage26, checkBoxImage27, checkBoxImage28, checkBoxImage29, checkBoxImage30,
checkBoxImage31, checkBoxImage32, checkBoxImage33, checkBoxImage34, checkBoxImage35, checkBoxImage36, checkBoxImage37, checkBoxImage38, checkBoxImage39, checkBoxImage40,
checkBoxImage41, checkBoxImage42, checkBoxImage43, checkBoxImage44, checkBoxImage45, checkBoxImage46, checkBoxImage47, checkBoxImage48,
};
ckbIndex = new int[MaxTextBoxesCount];
ckbState = new bool[MaxTextBoxesCount];
textBoxesCount = MaxTextBoxesCount;
///
if (wmsCount < textBoxesCount && lineSize > 0)
{
int nrLines = (wmsCount + lineSize - 1) / lineSize;
int gap = (textBoxesCount - wmsCount) / nrLines;
@ -516,12 +518,25 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
dest++;
}
}
textBoxesCount = wmsCount;
}
///
/// Resize the dialog to fit the enabled controls
///
if (checkBoxesEditMode)
{
for (int j = 0; j < textBoxesCount; j++) labels[j].Text = string.Format("iPerl{0}", j + 1);
}
else
{
for (int j = 0; j < Math.Min(textBoxesCount, iperlHeads.Count); j++) labels[j].Text = iperlHeads[j].Name;
}
ResizeDlgToFitEnabledControls();
}
void ResizeDlgToFitEnabledControls()
{
int xMax = 0;
int yMax = 0;
for (int i = 0; i < textBoxesCount; i++)
@ -537,10 +552,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
void Localize()
{
Text = Strings.Water_Meter_States;
for (int i = 0; i < Math.Min(textBoxesCount, iperlHeads.Count); i++)
{
labels[i].Text = iperlHeads[i].Name;
}
saveButton.Text = Strings.Save;
}
@ -548,13 +560,11 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
{
Localize();
//Height = 50 + 90 * WaterMetersCount;
for (int i = 0; i < textBoxesCount; i++)
{
labels[i].Visible = counters[i].Visible = messages[i].Visible = checkBoxes[i].Visible = true;
if (iperlHeads[i] == null || iperlHeads[i].Disabled)
if (!checkBoxesEditMode && (iperlHeads[i] == null || iperlHeads[i].Disabled))
{
checkBoxes[i].Enabled = checkBoxes[i].Checked = ckbState[i] = false;
counters[i].BackColor = Color.DarkGray;
@ -570,29 +580,33 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
TBF.LocalSettings ls = Program.LocalSettings;
Left = (ls.iPerlCommunicationsFormLeft != 0) ? ls.iPerlCommunicationsFormLeft : 150;
Top = (ls.iPerlCommunicationsFormTop != 0) ? ls.iPerlCommunicationsFormTop : 150;
if (ls.iPerlCommunicationsFormCheckboxes != 0) SetCheckBoxStates(ls.iPerlCommunicationsFormCheckboxes);
/// Reset opto-data indication
for (int i = 0; i < iperlHeads.Count; i++)
{
iperlHeads[i].FlushedDataCount = 0;
counters[i].BackColor = Color.Red;
}
///
/// Set QuidoRS outputs and start the whole communication process
/// by incrementing 'currentGroup'.
///
if (cfg.UseMuxBoards && quido != null)
if (!checkBoxesEditMode)
{
quido.SetOutputs((ushort)(16 - currentGroup - 1));
Thread.Sleep(200);
}
/// Reset opto-data indication
for (int i = 0; i < iperlHeads.Count; i++)
{
iperlHeads[i].FlushedDataCount = 0;
counters[i].BackColor = Color.Red;
}
currentGroup++;
///
/// Set QuidoRS outputs and start the whole communication process
/// by incrementing 'currentGroup'.
///
if (cfg.UseMuxBoards && quido != null)
{
quido.SetOutputs((ushort)(16 - currentGroup - 1));
Thread.Sleep(2000);
}
/// Start worker threads
int wtId = 0;
foreach (var wt in workerThreads) wt.Start(new Boxes.IntBox(wtId++));
currentGroup++;
/// Start worker threads
int wtId = 0;
foreach (var wt in workerThreads) wt.Start(new Boxes.IntBox(wtId++));
}
}
@ -611,6 +625,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
formCompleted = true;
Program.LocalSettings.iPerlCommunicationsFormLeft = Location.X;
Program.LocalSettings.iPerlCommunicationsFormTop = Location.Y;
Program.LocalSettings.iPerlCommunicationsFormCheckboxes = GetCheckBoxStates();
Program.LocalSettings.Save();
DialogResult = DialogResult.OK;
@ -684,17 +699,16 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
{
if (cfg.UseMuxBoards && threadIx >= muxBrdOrGroup14Nrs.Count) break; // quit, all RFID ports of all water meters done
int wmNr = 0;
bool wmFound = false;
for (int j = 0; j < iperlHeads.Count; j++)
for (int wmNr0 = 0; wmNr0 < iperlHeads.Count; wmNr0++)
{
IperlHead ihead = iperlHeads[j];
IperlHead ihead = iperlHeads[wmNr0];
if (ihead.Group == group && ihead.MuxBoardNrOrGroup14 == muxBrdOrGroup14Nrs[threadIx])
{
wmFound = true;
Results.Entities.WaterMeter wm = ProcessData.BatchRslts.WaterMeters[waterMeterPositions[j]];
Results.Entities.WaterMeter wm = ProcessData.BatchRslts.WaterMeters[waterMeterPositions0[wmNr0]];
CommErr error;
string resultStr = string.Empty;
@ -702,45 +716,35 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
///
/// RFID communication activity call
///
if (ihead.Disabled || !ckbState[j]) { error = CommErr.HeadDisabledByUser; }
else if (activity.ToLower().Contains(ReadConfigurationStr.ToLower())) error = ReadConfiguration(threadID, ihead, wm, ref resultStr);
else if (activity.ToLower().Contains(SetTestModeStr.ToLower())) error = SetTestMode(threadID, ihead, wm, ref resultStr);
else if (activity.ToLower().Equals(SetActiveModeStr.ToLower())) error = SetActiveMode(threadID, ihead, wm, ref resultStr);
else if (activity.ToLower().Equals(ReadCalibrationStr.ToLower())) error = ReadCalibration(threadID, ihead, wm, ref resultStr);
else if (activity.ToLower().Contains(WriteCalibrationFactorStr.ToLower())) error = WriteCalibrationFactor(threadID, ihead, wm, ref resultStr);
if (ihead.Disabled || !ckbState[wmNr0]) error = CommErr.HeadDisabledByUser;
else if (activity.ToLower().Contains(ReadConfigurationStr.ToLower())) error = ReadConfiguration(threadID, ihead, wm, ref resultStr);
else if (activity.ToLower().Contains(SetTestModeStr.ToLower())) error = SetTestMode(threadID, ihead, wm, ref resultStr);
else if (activity.ToLower().Equals(SetActiveModeStr.ToLower())) error = SetActiveMode(threadID, ihead, wm, ref resultStr);
else if (activity.ToLower().Equals(ReadCalibrationStr.ToLower())) error = ReadCalibration(threadID, ihead, wm, ref resultStr);
else if (activity.ToLower().Contains(WriteCalibrationFactorStr.ToLower())) error = WriteCalibrationFactor(threadID, ihead, wm, ref resultStr);
else if (activity.ToLower().Equals(NormalizeCalibrationFactorStr.ToLower())) error = NormalizeCalibrationFactor(threadID, ihead, wm, ref resultStr);
else if (activity.ToLower().Equals(ResetQ2CorrectionStr.ToLower())) error = ResetQ2Correction(threadID, ihead, wm, ref resultStr);
else if (activity.ToLower().Equals(WriteQ2CorrectionStr.ToLower()))
{
error = WriteQ2Correction(threadID, ihead, wm, ref resultStr, Q2CorrType.Standard, null, false);
}
else if (activity.ToLower().Equals(WriteQ2CorrectionAltStr.ToLower()))
{
error = WriteQ2Correction(threadID, ihead, wm, ref resultStr, Q2CorrType.Dewa, null, false);
}
else if (activity.ToLower().Contains(WriteQ2CorrectionGreeceStr.ToLower()))
{
error = WriteQ2Correction(threadID, ihead, wm, ref resultStr, Q2CorrType.Greece, activity.Substring(WriteQ2CorrectionGreeceStr.Length).Trim(), true);
}
else if (activity.ToLower().Equals(Reset2HzCorrectionStr.ToLower())) error = Reset2HzCorrection(threadID, ihead, wm, ref resultStr);
else if (activity.ToLower().Equals(Write2HzCorrectionStr.ToLower())) error = Write2HzCorrection(threadID, ihead, wm, ref resultStr);
else
{
error = CommErr.None;
resultStr = "Invalid activity";
}
else if (activity.ToLower().Equals(ResetQ2CorrectionStr.ToLower())) error = ResetQ2Correction(threadID, ihead, wm, ref resultStr);
else if (activity.ToLower().Equals(WriteQ2CorrectionStr.ToLower())) error = WriteQ2Correction(threadID, ihead, wm, ref resultStr, Q2CorrType.Standard, null, false);
else if (activity.ToLower().Equals(WriteQ2CorrectionAltStr.ToLower())) error = WriteQ2Correction(threadID, ihead, wm, ref resultStr, Q2CorrType.Dewa, null, false);
else if (activity.ToLower().Contains(WriteQ2CorrectionGreeceStr.ToLower())) error = WriteQ2Correction(threadID, ihead, wm, ref resultStr, Q2CorrType.Greece, activity.Substring(WriteQ2CorrectionGreeceStr.Length).Trim(), true);
else if (activity.ToLower().Equals(Reset2HzCorrectionStr.ToLower())) error = Reset2HzCorrection(threadID, ihead, wm, ref resultStr);
else if (activity.ToLower().Equals(Write2HzCorrectionStr.ToLower())) error = Write2HzCorrection(threadID, ihead, wm, ref resultStr);
else
{
error = CommErr.None;
resultStr = "Invalid activity";
}
///
/// Process the result of RFID communication activity
///
if (error == CommErr.HeadDisabledByUser || !ckbState[j])
if (error == CommErr.HeadDisabledByUser || !ckbState[wmNr0])
{
OnCommCompleted(null, new CommCompletedEventArgs(threadID, j, ihead, wm, Strings.Head_was_disabled_by_the_user, CommErr.HeadDisabledByUser));
OnCommCompleted(null, new CommCompletedEventArgs(threadID, wmNr0, ihead, wm, Strings.Head_was_disabled_by_the_user, CommErr.HeadDisabledByUser));
}
else if (error == CommErr.None)
{
OnCommCompleted(null, new CommCompletedEventArgs(threadID, wmNr, ihead, wm, resultStr, error));
OnCommCompleted(null, new CommCompletedEventArgs(threadID, wmNr0, ihead, wm, resultStr, error));
}
else if (ihead.CommFailed || error == CommErr.CommFailed)
{
@ -749,7 +753,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
wm.ResultCode |= (((int)error << 16) | ((int)tests[i].ItemNr << 20));
}
OnCommCompleted(null, new CommCompletedEventArgs(threadID, wmNr, ihead, wm, Strings.RFID_communication_failed, error));
OnCommCompleted(null, new CommCompletedEventArgs(threadID, wmNr0, ihead, wm, Strings.RFID_communication_failed, error));
}
else
{
@ -759,14 +763,14 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
}
string failureCauseLocal = string.Format(Strings.failed_0_1_exclamation, activity, error);
OnCommCompleted(null, new CommCompletedEventArgs(threadID, wmNr, ihead, wm, failureCauseLocal, error));
OnCommCompleted(null, new CommCompletedEventArgs(threadID, wmNr0, ihead, wm, failureCauseLocal, error));
rfidDataLogger.ErrorFormat("Group={0}, Board={1}, {2}", currentGroup, ihead.MuxBoardNrOrGroup14, failureCauseLocal);
ihead.CommFailed = true;
}
break;
}
wmNr++;
TBF.UiBridge.Bridge.OnTestProgress(null, new TBF.UiBridge.TestProgressEventArgs(tests[i], Config.Entities.Progress.FlowSetting));
TBF.UiBridge.Bridge.OnTestProgress(null, new TBF.UiBridge.TestProgressEventArgs(tests[i], Config.Entities.Progress.FlowSetting));
}
if (!wmFound)
@ -821,7 +825,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
{
error = CommErr.None;
ihead.ConfigStruct = ConfigStruct.FromByteArray(config);
resultStr = ihead.ConfigStruct.ToString(1);
resultStr = ihead.ConfigStruct.ToString(1);
break;
}
}
@ -1701,25 +1705,49 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
void DoOnCommCompleted(object sender, CommCompletedEventArgs data)
{
if (data.WMNr >= 0) messages[data.WMNr].Text = data.CommMessage;
///
/// Update the text message
///
if (data.WMNr0 >= 0) messages[data.WMNr0].Text = data.CommMessage;
if (data.WMNr >= 0 && data.CommErr == CommErr.HeadDisabledByUser)
///
/// Update head active/inactive switch
///
if (data.WMNr0 >= 0 && data.CommErr == CommErr.HeadDisabledByUser)
{
/// iPerl head was disabled by the user
ckbState[data.WMNr] = false;
checkBoxes[data.WMNr].Checked = false;
checkBoxes[data.WMNr].Enabled = false;
ckbState[data.WMNr0] = false;
checkBoxes[data.WMNr0].Checked = false;
checkBoxes[data.WMNr0].Enabled = false;
if (data.Ihead != null) data.Ihead.Disabled = true;
if (data.Wm != null) data.Wm.Disabled = true;
}
else if (data.WMNr >= 0 && data.CommErr == CommErr.None)
else if (data.WMNr0 >= 0 && data.CommErr == CommErr.None)
{
/// One RFID communication successful => iPerl cannot be disabled by the user anymore
ckbState[data.WMNr] = true;
checkBoxes[data.WMNr].Checked = true;
checkBoxes[data.WMNr].Enabled = false;
ckbState[data.WMNr0] = true;
checkBoxes[data.WMNr0].Checked = true;
checkBoxes[data.WMNr0].Enabled = false;
}
///
/// Update opto-communication indication
///
for (int i = 0; i < iperlHeads.Count; i++)
{
if (iperlHeads[i] == null || iperlHeads[i].Disabled)
{
counters[i].BackColor = Color.DarkGray;
}
else
{
counters[i].BackColor = (iperlHeads[i].FlushedDataDelta == 0) ? Color.Red : Color.Green;
}
}
///
/// Branch
///
lock (this)
{
completedCommCount++;
@ -1728,18 +1756,13 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
completedCommCount = 0;
}
for (int i = 0; i < iperlHeads.Count; i++)
{
counters[i].BackColor = iperlHeads[i].Disabled ? Color.DarkGray : ((iperlHeads[i].FlushedDataDelta == 0) ? Color.Red : Color.Green);
}
if (currentGroup < lastGroup)
{
/// Go to the next step / next group
if (quido != null)
{
quido.SetOutputs((ushort)(16 - currentGroup - 1));
Thread.Sleep(100);
Thread.Sleep(2000);
}
currentGroup++;
}
@ -1751,7 +1774,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
if (quido != null)
{
quido.SetOutputs((ushort)(16 - currentGroup - 1));
Thread.Sleep(100);
Thread.Sleep(2000);
}
currentGroup++;
}
@ -1812,7 +1835,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
for (int i = 0; i < iperlHeads.Count; i++)
{
Results.Entities.MeterTestRslt meterRslt =
ProcessData.BatchRslts.GetMeterTestRslt(test.Name, waterMeterPositions[i], Config.Entities.CompoundMeterId.Single);
ProcessData.BatchRslts.GetMeterTestRslt(test.Name, waterMeterPositions0[i], Config.Entities.CompoundMeterId.Single);
if (meterRslt != null && iperlHeads[i] != null)
{
@ -1873,5 +1896,44 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
private void checkBoxImage46_Click(object sender, EventArgs e) { ckbState[ckbIndex[45]] = checkBoxImage46.Checked; }
private void checkBoxImage47_Click(object sender, EventArgs e) { ckbState[ckbIndex[46]] = checkBoxImage47.Checked; }
private void checkBoxImage48_Click(object sender, EventArgs e) { ckbState[ckbIndex[47]] = checkBoxImage48.Checked; }
private long GetCheckBoxStates()
{
long result = 0;
for (int i = 0; i < 48; i++)
{
if (ckbState[ckbIndex[i]]) result += (1L << i);
}
return result;
}
private void SetCheckBoxStates(long state)
{
CheckBoxImage[] chkBoxes = new CheckBoxImage[48]
{
checkBoxImage1, checkBoxImage2, checkBoxImage3, checkBoxImage4, checkBoxImage5,
checkBoxImage6, checkBoxImage7, checkBoxImage8, checkBoxImage9, checkBoxImage10,
checkBoxImage11, checkBoxImage12, checkBoxImage13, checkBoxImage14, checkBoxImage15,
checkBoxImage16, checkBoxImage17, checkBoxImage18, checkBoxImage19, checkBoxImage20,
checkBoxImage21, checkBoxImage22, checkBoxImage23, checkBoxImage24, checkBoxImage25,
checkBoxImage26, checkBoxImage27, checkBoxImage28, checkBoxImage29, checkBoxImage30,
checkBoxImage31, checkBoxImage32, checkBoxImage33, checkBoxImage34, checkBoxImage35,
checkBoxImage36, checkBoxImage37, checkBoxImage38, checkBoxImage39, checkBoxImage40,
checkBoxImage41, checkBoxImage42, checkBoxImage43, checkBoxImage44, checkBoxImage45,
checkBoxImage46, checkBoxImage47, checkBoxImage48,
};
for (int i = 0; i < 48; i++)
{
chkBoxes[i].Checked = ckbState[ckbIndex[i]] = ((state & (1L << i)) != 0);
}
}
private void saveButton_Click(object sender, EventArgs e)
{
Program.LocalSettings.iPerlCommunicationsFormCheckboxes = GetCheckBoxStates();
DialogResult = DialogResult.OK;
Close();
}
}
}

View File

@ -226,6 +226,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
this.checkBoxImage46 = new TBF.BenchControl.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage47 = new TBF.BenchControl.TestMethods.iPerlCommunication.CheckBoxImage();
this.checkBoxImage48 = new TBF.BenchControl.TestMethods.iPerlCommunication.CheckBoxImage();
this.saveButton = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBox48)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox47)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox46)).BeginInit();
@ -1681,6 +1682,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage1
//
this.checkBoxImage1.Checked = false;
this.checkBoxImage1.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage1.Image")));
this.checkBoxImage1.Location = new System.Drawing.Point(113, 91);
this.checkBoxImage1.Name = "checkBoxImage1";
this.checkBoxImage1.Size = new System.Drawing.Size(32, 21);
@ -1693,6 +1695,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage2
//
this.checkBoxImage2.Checked = false;
this.checkBoxImage2.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage2.Image")));
this.checkBoxImage2.Location = new System.Drawing.Point(113, 120);
this.checkBoxImage2.Name = "checkBoxImage2";
this.checkBoxImage2.Size = new System.Drawing.Size(32, 21);
@ -1705,6 +1708,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage3
//
this.checkBoxImage3.Checked = false;
this.checkBoxImage3.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage3.Image")));
this.checkBoxImage3.Location = new System.Drawing.Point(113, 149);
this.checkBoxImage3.Name = "checkBoxImage3";
this.checkBoxImage3.Size = new System.Drawing.Size(32, 21);
@ -1717,6 +1721,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage4
//
this.checkBoxImage4.Checked = false;
this.checkBoxImage4.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage4.Image")));
this.checkBoxImage4.Location = new System.Drawing.Point(113, 178);
this.checkBoxImage4.Name = "checkBoxImage4";
this.checkBoxImage4.Size = new System.Drawing.Size(32, 21);
@ -1729,6 +1734,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage5
//
this.checkBoxImage5.Checked = false;
this.checkBoxImage5.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage5.Image")));
this.checkBoxImage5.Location = new System.Drawing.Point(113, 207);
this.checkBoxImage5.Name = "checkBoxImage5";
this.checkBoxImage5.Size = new System.Drawing.Size(32, 21);
@ -1741,6 +1747,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage6
//
this.checkBoxImage6.Checked = false;
this.checkBoxImage6.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage6.Image")));
this.checkBoxImage6.Location = new System.Drawing.Point(113, 236);
this.checkBoxImage6.Name = "checkBoxImage6";
this.checkBoxImage6.Size = new System.Drawing.Size(32, 21);
@ -1753,6 +1760,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage7
//
this.checkBoxImage7.Checked = false;
this.checkBoxImage7.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage7.Image")));
this.checkBoxImage7.Location = new System.Drawing.Point(113, 265);
this.checkBoxImage7.Name = "checkBoxImage7";
this.checkBoxImage7.Size = new System.Drawing.Size(32, 21);
@ -1765,6 +1773,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage8
//
this.checkBoxImage8.Checked = false;
this.checkBoxImage8.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage8.Image")));
this.checkBoxImage8.Location = new System.Drawing.Point(113, 294);
this.checkBoxImage8.Name = "checkBoxImage8";
this.checkBoxImage8.Size = new System.Drawing.Size(32, 21);
@ -1777,6 +1786,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage9
//
this.checkBoxImage9.Checked = false;
this.checkBoxImage9.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage9.Image")));
this.checkBoxImage9.Location = new System.Drawing.Point(113, 323);
this.checkBoxImage9.Name = "checkBoxImage9";
this.checkBoxImage9.Size = new System.Drawing.Size(32, 21);
@ -1789,6 +1799,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage10
//
this.checkBoxImage10.Checked = false;
this.checkBoxImage10.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage10.Image")));
this.checkBoxImage10.Location = new System.Drawing.Point(113, 352);
this.checkBoxImage10.Name = "checkBoxImage10";
this.checkBoxImage10.Size = new System.Drawing.Size(32, 21);
@ -1801,6 +1812,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage11
//
this.checkBoxImage11.Checked = false;
this.checkBoxImage11.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage11.Image")));
this.checkBoxImage11.Location = new System.Drawing.Point(113, 381);
this.checkBoxImage11.Name = "checkBoxImage11";
this.checkBoxImage11.Size = new System.Drawing.Size(32, 21);
@ -1813,6 +1825,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage12
//
this.checkBoxImage12.Checked = false;
this.checkBoxImage12.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage12.Image")));
this.checkBoxImage12.Location = new System.Drawing.Point(113, 410);
this.checkBoxImage12.Name = "checkBoxImage12";
this.checkBoxImage12.Size = new System.Drawing.Size(32, 21);
@ -1825,6 +1838,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage13
//
this.checkBoxImage13.Checked = false;
this.checkBoxImage13.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage13.Image")));
this.checkBoxImage13.Location = new System.Drawing.Point(113, 439);
this.checkBoxImage13.Name = "checkBoxImage13";
this.checkBoxImage13.Size = new System.Drawing.Size(32, 21);
@ -1837,6 +1851,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage14
//
this.checkBoxImage14.Checked = false;
this.checkBoxImage14.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage14.Image")));
this.checkBoxImage14.Location = new System.Drawing.Point(113, 468);
this.checkBoxImage14.Name = "checkBoxImage14";
this.checkBoxImage14.Size = new System.Drawing.Size(32, 21);
@ -1849,6 +1864,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage15
//
this.checkBoxImage15.Checked = false;
this.checkBoxImage15.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage15.Image")));
this.checkBoxImage15.Location = new System.Drawing.Point(113, 497);
this.checkBoxImage15.Name = "checkBoxImage15";
this.checkBoxImage15.Size = new System.Drawing.Size(32, 21);
@ -1861,6 +1877,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage16
//
this.checkBoxImage16.Checked = false;
this.checkBoxImage16.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage16.Image")));
this.checkBoxImage16.Location = new System.Drawing.Point(113, 526);
this.checkBoxImage16.Name = "checkBoxImage16";
this.checkBoxImage16.Size = new System.Drawing.Size(32, 21);
@ -1873,6 +1890,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage17
//
this.checkBoxImage17.Checked = false;
this.checkBoxImage17.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage17.Image")));
this.checkBoxImage17.Location = new System.Drawing.Point(113, 555);
this.checkBoxImage17.Name = "checkBoxImage17";
this.checkBoxImage17.Size = new System.Drawing.Size(32, 21);
@ -1885,6 +1903,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage18
//
this.checkBoxImage18.Checked = false;
this.checkBoxImage18.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage18.Image")));
this.checkBoxImage18.Location = new System.Drawing.Point(113, 584);
this.checkBoxImage18.Name = "checkBoxImage18";
this.checkBoxImage18.Size = new System.Drawing.Size(32, 21);
@ -1897,6 +1916,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage19
//
this.checkBoxImage19.Checked = false;
this.checkBoxImage19.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage19.Image")));
this.checkBoxImage19.Location = new System.Drawing.Point(113, 613);
this.checkBoxImage19.Name = "checkBoxImage19";
this.checkBoxImage19.Size = new System.Drawing.Size(32, 21);
@ -1909,6 +1929,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage20
//
this.checkBoxImage20.Checked = false;
this.checkBoxImage20.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage20.Image")));
this.checkBoxImage20.Location = new System.Drawing.Point(113, 642);
this.checkBoxImage20.Name = "checkBoxImage20";
this.checkBoxImage20.Size = new System.Drawing.Size(32, 21);
@ -1921,6 +1942,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage21
//
this.checkBoxImage21.Checked = false;
this.checkBoxImage21.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage21.Image")));
this.checkBoxImage21.Location = new System.Drawing.Point(113, 671);
this.checkBoxImage21.Name = "checkBoxImage21";
this.checkBoxImage21.Size = new System.Drawing.Size(32, 21);
@ -1933,6 +1955,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage22
//
this.checkBoxImage22.Checked = false;
this.checkBoxImage22.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage22.Image")));
this.checkBoxImage22.Location = new System.Drawing.Point(113, 700);
this.checkBoxImage22.Name = "checkBoxImage22";
this.checkBoxImage22.Size = new System.Drawing.Size(32, 21);
@ -1945,6 +1968,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage23
//
this.checkBoxImage23.Checked = false;
this.checkBoxImage23.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage23.Image")));
this.checkBoxImage23.Location = new System.Drawing.Point(113, 729);
this.checkBoxImage23.Name = "checkBoxImage23";
this.checkBoxImage23.Size = new System.Drawing.Size(32, 21);
@ -1957,6 +1981,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage24
//
this.checkBoxImage24.Checked = false;
this.checkBoxImage24.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage24.Image")));
this.checkBoxImage24.Location = new System.Drawing.Point(113, 758);
this.checkBoxImage24.Name = "checkBoxImage24";
this.checkBoxImage24.Size = new System.Drawing.Size(32, 21);
@ -1969,6 +1994,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage25
//
this.checkBoxImage25.Checked = false;
this.checkBoxImage25.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage25.Image")));
this.checkBoxImage25.Location = new System.Drawing.Point(673, 91);
this.checkBoxImage25.Name = "checkBoxImage25";
this.checkBoxImage25.Size = new System.Drawing.Size(32, 21);
@ -1981,6 +2007,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage26
//
this.checkBoxImage26.Checked = false;
this.checkBoxImage26.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage26.Image")));
this.checkBoxImage26.Location = new System.Drawing.Point(673, 120);
this.checkBoxImage26.Name = "checkBoxImage26";
this.checkBoxImage26.Size = new System.Drawing.Size(32, 21);
@ -1993,6 +2020,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage27
//
this.checkBoxImage27.Checked = false;
this.checkBoxImage27.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage27.Image")));
this.checkBoxImage27.Location = new System.Drawing.Point(673, 149);
this.checkBoxImage27.Name = "checkBoxImage27";
this.checkBoxImage27.Size = new System.Drawing.Size(32, 21);
@ -2005,6 +2033,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage28
//
this.checkBoxImage28.Checked = false;
this.checkBoxImage28.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage28.Image")));
this.checkBoxImage28.Location = new System.Drawing.Point(673, 178);
this.checkBoxImage28.Name = "checkBoxImage28";
this.checkBoxImage28.Size = new System.Drawing.Size(32, 21);
@ -2017,6 +2046,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage29
//
this.checkBoxImage29.Checked = false;
this.checkBoxImage29.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage29.Image")));
this.checkBoxImage29.Location = new System.Drawing.Point(673, 207);
this.checkBoxImage29.Name = "checkBoxImage29";
this.checkBoxImage29.Size = new System.Drawing.Size(32, 21);
@ -2029,6 +2059,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage30
//
this.checkBoxImage30.Checked = false;
this.checkBoxImage30.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage30.Image")));
this.checkBoxImage30.Location = new System.Drawing.Point(673, 236);
this.checkBoxImage30.Name = "checkBoxImage30";
this.checkBoxImage30.Size = new System.Drawing.Size(32, 21);
@ -2041,6 +2072,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage31
//
this.checkBoxImage31.Checked = false;
this.checkBoxImage31.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage31.Image")));
this.checkBoxImage31.Location = new System.Drawing.Point(673, 265);
this.checkBoxImage31.Name = "checkBoxImage31";
this.checkBoxImage31.Size = new System.Drawing.Size(32, 21);
@ -2053,6 +2085,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage32
//
this.checkBoxImage32.Checked = false;
this.checkBoxImage32.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage32.Image")));
this.checkBoxImage32.Location = new System.Drawing.Point(673, 294);
this.checkBoxImage32.Name = "checkBoxImage32";
this.checkBoxImage32.Size = new System.Drawing.Size(32, 21);
@ -2065,6 +2098,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage33
//
this.checkBoxImage33.Checked = false;
this.checkBoxImage33.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage33.Image")));
this.checkBoxImage33.Location = new System.Drawing.Point(673, 323);
this.checkBoxImage33.Name = "checkBoxImage33";
this.checkBoxImage33.Size = new System.Drawing.Size(32, 21);
@ -2077,6 +2111,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage34
//
this.checkBoxImage34.Checked = false;
this.checkBoxImage34.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage34.Image")));
this.checkBoxImage34.Location = new System.Drawing.Point(673, 352);
this.checkBoxImage34.Name = "checkBoxImage34";
this.checkBoxImage34.Size = new System.Drawing.Size(32, 21);
@ -2089,6 +2124,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage35
//
this.checkBoxImage35.Checked = false;
this.checkBoxImage35.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage35.Image")));
this.checkBoxImage35.Location = new System.Drawing.Point(673, 381);
this.checkBoxImage35.Name = "checkBoxImage35";
this.checkBoxImage35.Size = new System.Drawing.Size(32, 21);
@ -2101,6 +2137,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage36
//
this.checkBoxImage36.Checked = false;
this.checkBoxImage36.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage36.Image")));
this.checkBoxImage36.Location = new System.Drawing.Point(673, 410);
this.checkBoxImage36.Name = "checkBoxImage36";
this.checkBoxImage36.Size = new System.Drawing.Size(32, 21);
@ -2113,6 +2150,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage37
//
this.checkBoxImage37.Checked = false;
this.checkBoxImage37.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage37.Image")));
this.checkBoxImage37.Location = new System.Drawing.Point(673, 439);
this.checkBoxImage37.Name = "checkBoxImage37";
this.checkBoxImage37.Size = new System.Drawing.Size(32, 21);
@ -2125,6 +2163,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage38
//
this.checkBoxImage38.Checked = false;
this.checkBoxImage38.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage38.Image")));
this.checkBoxImage38.Location = new System.Drawing.Point(673, 468);
this.checkBoxImage38.Name = "checkBoxImage38";
this.checkBoxImage38.Size = new System.Drawing.Size(32, 21);
@ -2137,6 +2176,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage39
//
this.checkBoxImage39.Checked = false;
this.checkBoxImage39.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage39.Image")));
this.checkBoxImage39.Location = new System.Drawing.Point(673, 497);
this.checkBoxImage39.Name = "checkBoxImage39";
this.checkBoxImage39.Size = new System.Drawing.Size(32, 21);
@ -2149,6 +2189,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage40
//
this.checkBoxImage40.Checked = false;
this.checkBoxImage40.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage40.Image")));
this.checkBoxImage40.Location = new System.Drawing.Point(673, 526);
this.checkBoxImage40.Name = "checkBoxImage40";
this.checkBoxImage40.Size = new System.Drawing.Size(32, 21);
@ -2161,6 +2202,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage41
//
this.checkBoxImage41.Checked = false;
this.checkBoxImage41.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage41.Image")));
this.checkBoxImage41.Location = new System.Drawing.Point(673, 555);
this.checkBoxImage41.Name = "checkBoxImage41";
this.checkBoxImage41.Size = new System.Drawing.Size(32, 21);
@ -2173,6 +2215,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage42
//
this.checkBoxImage42.Checked = false;
this.checkBoxImage42.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage42.Image")));
this.checkBoxImage42.Location = new System.Drawing.Point(673, 584);
this.checkBoxImage42.Name = "checkBoxImage42";
this.checkBoxImage42.Size = new System.Drawing.Size(32, 21);
@ -2185,6 +2228,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage43
//
this.checkBoxImage43.Checked = false;
this.checkBoxImage43.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage43.Image")));
this.checkBoxImage43.Location = new System.Drawing.Point(673, 613);
this.checkBoxImage43.Name = "checkBoxImage43";
this.checkBoxImage43.Size = new System.Drawing.Size(32, 21);
@ -2197,6 +2241,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage44
//
this.checkBoxImage44.Checked = false;
this.checkBoxImage44.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage44.Image")));
this.checkBoxImage44.Location = new System.Drawing.Point(673, 642);
this.checkBoxImage44.Name = "checkBoxImage44";
this.checkBoxImage44.Size = new System.Drawing.Size(32, 21);
@ -2209,6 +2254,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage45
//
this.checkBoxImage45.Checked = false;
this.checkBoxImage45.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage45.Image")));
this.checkBoxImage45.Location = new System.Drawing.Point(673, 671);
this.checkBoxImage45.Name = "checkBoxImage45";
this.checkBoxImage45.Size = new System.Drawing.Size(32, 21);
@ -2221,6 +2267,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage46
//
this.checkBoxImage46.Checked = false;
this.checkBoxImage46.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage46.Image")));
this.checkBoxImage46.Location = new System.Drawing.Point(673, 700);
this.checkBoxImage46.Name = "checkBoxImage46";
this.checkBoxImage46.Size = new System.Drawing.Size(32, 21);
@ -2233,6 +2280,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage47
//
this.checkBoxImage47.Checked = false;
this.checkBoxImage47.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage47.Image")));
this.checkBoxImage47.Location = new System.Drawing.Point(673, 729);
this.checkBoxImage47.Name = "checkBoxImage47";
this.checkBoxImage47.Size = new System.Drawing.Size(32, 21);
@ -2245,6 +2293,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
// checkBoxImage48
//
this.checkBoxImage48.Checked = false;
this.checkBoxImage48.Image = ((System.Drawing.Image)(resources.GetObject("checkBoxImage48.Image")));
this.checkBoxImage48.Location = new System.Drawing.Point(673, 758);
this.checkBoxImage48.Name = "checkBoxImage48";
this.checkBoxImage48.Size = new System.Drawing.Size(32, 21);
@ -2254,12 +2303,25 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
this.checkBoxImage48.Visible = false;
this.checkBoxImage48.Click += new System.EventHandler(this.checkBoxImage48_Click);
//
// saveButton
//
this.saveButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.saveButton.Location = new System.Drawing.Point(1057, 22);
this.saveButton.Name = "saveButton";
this.saveButton.Size = new System.Drawing.Size(75, 42);
this.saveButton.TabIndex = 192;
this.saveButton.Text = "Save";
this.saveButton.UseVisualStyleBackColor = true;
this.saveButton.Visible = false;
this.saveButton.Click += new System.EventHandler(this.saveButton_Click);
//
// iPerlCommunicationForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.DarkGray;
this.ClientSize = new System.Drawing.Size(1161, 795);
this.Controls.Add(this.saveButton);
this.Controls.Add(this.checkBoxImage48);
this.Controls.Add(this.checkBoxImage47);
this.Controls.Add(this.checkBoxImage46);
@ -2755,6 +2817,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
private CheckBoxImage checkBoxImage46;
private CheckBoxImage checkBoxImage47;
private CheckBoxImage checkBoxImage48;
private System.Windows.Forms.Button saveButton;
}
}

View File

@ -7,20 +7,20 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
{
public class ConfigStruct
{
public static readonly int Length = 32;
public const int Length = 32;
public Byte Version;
public MeterState MeterState;
public UInt32 TargetTimeVeryLowBatt; /// in seconds
public UInt32 TargetTimeLowBatt; /// in seconds
public UInt32 TestModeTime; /// Max. test mode time in seconds
public UInt16 EmptyPipeThreshold;
public byte[] PCBNumber; /// 5 bytes
public byte TestModeConfig;
public UInt32 RadioAddress;
public UInt16 TempCalibration;
public UInt16 AlarmMask; /// Default 0xA3F7
public UInt16 ConfigCheckSum;
public Byte Version; /// 0: 1 byte
public MeterState MeterState; /// 1: 1 byte
public UInt32 TargetTimeVeryLowBatt; /// 2: 4 bytes in seconds
public UInt32 TargetTimeLowBatt; /// 6: 4 bytes, in seconds
public UInt32 TestModeTime; /// 10: 4 bytes, Max. test mode time in seconds
public UInt16 EmptyPipeThreshold; /// 14: 2 bytes
public byte[] PCBNumber; /// 16: 5 bytes
public byte TestModeConfig; /// 21: 1 byte
public UInt32 RadioAddress; /// 22: 4 bytes
public UInt16 TempCalibration; /// 26: 2 bytes
public UInt16 AlarmMask; /// 28: 2 bytes, Default 0xA3F7
public UInt16 ConfigCheckSum; /// 30: 2 bytes
public ConfigStruct()
{
@ -162,7 +162,16 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
}
/// <summary>
/// Converts PCBNumber to string
/// Returns PCB number string (12 characters, 12 decimal digits)
/// </summary>
/// <returns>PCB number STRING</returns>
public string GetPcbNrString()
{
return PCBNumber2String(this.PCBNumber);
}
/// <summary>
/// Converts PCBNumber to string (12 characters, 12 decimal digits)
/// </summary>
/// <param name="pcbNumber"></param>
/// <returns>PCB number string</returns>
@ -179,15 +188,6 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
return number.ToString();
}
/// <summary>
/// Converts PCBNumber to string
/// </summary>
/// <returns>PCB number string</returns>
public string PCBNumber2String()
{
return ConfigStruct.PCBNumber2String(PCBNumber);
}
public override string ToString()
{
return string.Format("Config: V{0} State={1} VLoBattT={2}s LoBattT={3}s TestModeT={4}s EPThld={5} PCB#={6} TMCfg={7} RadioAddr={8} TempCalib={9} AlarmMask={10} CfgCheckSum={11}",
@ -197,7 +197,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
TargetTimeLowBatt,
TestModeTime,
EmptyPipeThreshold,
PCBNumber2String(),
GetPcbNrString(),
TestModeConfig.ToString("X2"),
RadioAddress,
TempCalibration,
@ -214,7 +214,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
TargetTimeLowBatt,
TestModeTime,
EmptyPipeThreshold,
PCBNumber2String(),
GetPcbNrString(),
TestModeConfig.ToString("X2"),
RadioAddress,
TempCalibration,

View File

@ -46,7 +46,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
{
get
{
if (ConfigStruct != null) return configStruct.PCBNumber2String();
if (ConfigStruct != null) return configStruct.GetPcbNrString();
else return string.Empty;
}
set { }
@ -521,7 +521,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
else flowNr = "99";
optoDataLogFileName = string.Format("{0}_{1}_{2}_{3}.txt",
(ConfigStruct != null) ? ConfigStruct.PCBNumber2String() : "UnknownPcbNr",
(ConfigStruct != null) ? ConfigStruct.GetPcbNrString() : "UnknownPcbNr",
wmPosition,
flowNr,
StateMachine.CycleStartTimeStamp.ToString("HH_mm_ss"));

View File

@ -94,6 +94,7 @@ namespace TBF
/// iPerlCommunicationsForm
public int iPerlCommunicationsFormLeft;
public int iPerlCommunicationsFormTop;
public long iPerlCommunicationsFormCheckboxes;
[XmlArrayAttribute("FeedingColumnWidths")]
public int[] FeedingColumnWidths;

File diff suppressed because it is too large Load Diff

View File

@ -3,10 +3,7 @@
///
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using log4net;
using Config.Entities;
@ -102,8 +99,14 @@ namespace TBF
Users.GlobalData.CurrentUser.IsMemberOf(Users.Grp.GID.HeadOfLab);
upgradeTSMenuItem.Visible = Users.GlobalData.CurrentUser.IsMemberOf(Users.Grp.GID.Administrators) && Users.GlobalData.CurrentUser.IsPowerUser();
#if IPERL
iPerlHeadsToolStripMenuItem.Visible = true;
iPerlHeadsToolStripMenuItem.Enabled = false;
#else
iPerlHeadsToolStripMenuItem.Visible = false;
#endif
benchInitializationFailed = false;
benchInitializationFailed = false;
///
if (Config.Data.CurrentBench.IsRealBench)
{
@ -363,9 +366,12 @@ namespace TBF
return;
}
procedureComboBox.Enabled = ((args.Flags & UiBridge.ButtonsEtc.ProcedureCmbBoxEn) != 0);
bool noCycleRunning = ((args.Flags & UiBridge.ButtonsEtc.ProcedureCmbBoxEn) != 0);
if (procedureComboBox.Enabled && ProceduresUpdated)
procedureComboBox.Enabled = noCycleRunning;
iPerlHeadsToolStripMenuItem.Enabled = noCycleRunning;
if (noCycleRunning && ProceduresUpdated)
{
ReloadProcedures();
}
@ -667,5 +673,10 @@ namespace TBF
{
new Forms.UpgradeSelectionDlg().Show();
}
private void iPerlHeadsToolStripMenuItem_Click(object sender, EventArgs e)
{
new BenchControl.TestMethods.iPerlCommunication.iPerlCommunicationForm(true).ShowDialog();
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -141,6 +141,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Activate / Deactivate Heads.
/// </summary>
internal static string Activate_Deactivate_heads {
get {
return ResourceManager.GetString("Activate_Deactivate_heads", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Activity.
/// </summary>
@ -3597,6 +3606,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Save.
/// </summary>
internal static string Save {
get {
return ResourceManager.GetString("Save", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Save again.
/// </summary>

View File

@ -1284,4 +1284,10 @@
<data name="Density_correction" xml:space="preserve">
<value>Korekce hustoty</value>
</data>
<data name="Save" xml:space="preserve">
<value>Uložit</value>
</data>
<data name="Activate_Deactivate_heads" xml:space="preserve">
<value>Aktivujte / deaktivujte hlavice</value>
</data>
</root>

View File

@ -1774,6 +1774,9 @@
<data name="failed_0_1_exclamation" xml:space="preserve">
<value>'{0}' activity failed ({1}) !!!</value>
</data>
<data name="Save" xml:space="preserve">
<value>Save</value>
</data>
<data name="Control_water_temp_chdr" xml:space="preserve">
<value>Control water temp.</value>
</data>
@ -1801,4 +1804,7 @@
<data name="Legalizator" xml:space="preserve">
<value>Legalizator</value>
</data>
<data name="Activate_Deactivate_heads" xml:space="preserve">
<value>Activate / Deactivate Heads</value>
</data>
</root>

View File

@ -25,7 +25,7 @@ namespace TBF.Screens
InitializeComponent();
cameraPictures = new List<TBF.UiControls.ICameraPicture>();
resolution = Program.LocalSettings.Resolution;
if (Program.LocalSettings != null) resolution = Program.LocalSettings.Resolution;
System.Windows.Forms.Timer timer;
timer = new System.Windows.Forms.Timer();