diff --git a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/FM2014.cs b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/FM2014.cs
index d0ab860c..9dbe014a 100644
--- a/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/FM2014.cs
+++ b/Common/Hardware/WaterMeter/MechanicalMeter/FM2014/FM2014Core/FM2014.cs
@@ -232,7 +232,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
///
/// Marker if broadcast connection was last communication
///
- private static CmdType SharedCmdTypeReminderLastCmd { get; set; }
+ public static CmdType SharedCmdTypeReminderLastCmd { get; set; }
///
/// Reminder of last individual address of FM2014 to initiate a new communication to another device.
@@ -284,6 +284,11 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
}
}
+ ///
+ /// The broadcast FM2014 will be used to dispatch the address 0 on the
+ ///
+ private static FM2014 BroadcastFm2014 { get; set; }
+
#endregion ---------------------------------------- static properties -----------------------------------------
#region ------------------------------------------- object properties -----------------------------------------
@@ -699,7 +704,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
/// - It is a broadcast command which will reset all connected devices!
///
///
- ///
+ ///
/// - Initial.
///
public static Boolean ResetHardwareAllDevices()
@@ -707,8 +712,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
if (SharedCyclicMeasSequ == CyclicMeasSequ.idle)
return true;
- var firstActiveFm2014 = GetFirstConnectedAndLoggedInFm2014();
- if (firstActiveFm2014 == null)
+ if (BroadcastFm2014 == null)
return false;
// Exit tasks
@@ -722,7 +726,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
{
// Reset measurement
var infoStr = GetCmdInfo(CmdName.CmdResetMeasurement);
- if (!Write(CmdName.CmdResetMeasurement, firstActiveFm2014))
+ if (!Write(CmdName.CmdResetMeasurement, BroadcastFm2014))
return;
// Wait until FM2014 calibration finished
@@ -734,10 +738,10 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
// Change the SI unit to ms instead of seconds
var response = new CmdResponse(CmdName.CmdResetMeasurement, infoStr, (UInt32)resetDelayCtr_ms,
unit: "m" + Units.GetInfo(Units.Name.TIME_s));
- PublishResponse(firstActiveFm2014, new ProcessExecEventArgs("",
- actualProcessMessage: infoStr,
- actualProcessPercent: ActualProcessProgress_percent,
- specificInfoObj: response));
+ PublishResponse(BroadcastFm2014, new ProcessExecEventArgs("",
+ actualProcessMessage: infoStr,
+ actualProcessPercent: ActualProcessProgress_percent,
+ specificInfoObj: response));
Thread.Sleep(loopTime_ms);
resetDelayCtr_ms -= loopTime_ms;
ActualProcessProgress++;
@@ -1452,7 +1456,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
SharedCyclicMeasSequ = CyclicMeasSequ.timeMeasurement;
// Set up the progress maximal counter value base on required pulses for REF or DUT
- InitActualProcessProgress(refPulsesRequired != null ? (Int32)firstActiveFm2014.RefPulsesRequired :
+ InitActualProcessProgress(refPulsesRequired != null ? (Int32)firstActiveFm2014.RefPulsesRequired :
(Int32)firstActiveFm2014.DutPulsesRequired, disableWriteReadIncrease: true);
do
@@ -1600,8 +1604,8 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
// Is converting to a real time in seconds
if (fm2014.RefTimeMeasured_s > 0.0)
{
- fm2014.DutToRefToleranceMeasured_percent =
- (1.0 - fm2014.DutTimeMeasured_s / fm2014.RefTimeMeasured_s) * 100.0;
+ fm2014.DutToRefToleranceMeasured_percent =
+ (1.0 - fm2014.DutTimeMeasured_s / fm2014.RefTimeMeasured_s) * 100.0;
// Check the threshold for OOR
if (fm2014.DutToRefToleranceMeasured_percent >
@@ -1763,13 +1767,14 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
/// - If the dataObj is a string, this is going to be sent as is (e.g. "1000K2"),
/// - If the dataObj is an UInt16 or Byte this will be assembled with the command code (e.g. "3T"),
/// - Every 'Write' is a string delimited here with 'CR',
+ /// - If the broadcast address will be used, the will be published for logging,
/// - An exception has to be caught by the caller.
///
///
///
///
///
- ///
+ ///
/// - Initial.
///
private static Boolean Write(CmdName cmdName, FM2014 fm2014, Object dataObj = null)
@@ -1799,12 +1804,10 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
else
{
if (ReminderLastIndividualCommFm2014Address != fm2014.Address ||
- SharedCmdTypeReminderLastCmd != CmdType.individual ||
SharedCmdTypeReminderLastCmd != CmdType.individual)
{
retVal = InitiateIndividualComm(fm2014);
- if (retVal)
- ReminderLastIndividualCommFm2014Address = fm2014.Address;
+ if (retVal) ReminderLastIndividualCommFm2014Address = fm2014.Address;
}
}
@@ -1854,7 +1857,9 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
}
var statusReturn = retVal ? StatusReturn.Okay : StatusReturn.Failed;
- ResponseEvent(fm2014, response, statusReturn);
+ // Dispatch broadcast address if not individual communication
+ var actualFm2014 = CmdType.broadcast == GetCmdType(cmdName) ? BroadcastFm2014 : fm2014;
+ ResponseEvent(actualFm2014, response, statusReturn);
return retVal;
}
@@ -2009,6 +2014,7 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
RegisteredFm2014s = null;
SharedSerialPort?.Dispose();
SharedSerialPort = null;
+ BroadcastFm2014 = null;
}
#endregion ---------------------------------------- static methods --------------------------------------------
@@ -2265,6 +2271,18 @@ namespace Sensus.Common.Hardware.WaterMeter.MechanicalMeter.FM2014.FM2014Core
SharedSerialPort.ReadTimeout = 1000;
SharedSerialPort.WriteTimeout = 1000;
}
+
+ // The brodcast FM2014 is used to deliver a message to the GUI
+ if (BroadcastFm2014 == null)
+ {
+ BroadcastFm2014 = new FM2014
+ {
+ Address = 0
+ };
+ // Capture the event of the first connected FM2014
+ BroadcastFm2014.OnRawRecordReceived = OnRawRecordReceived;
+ }
+
var cmdName = CmdName.CmdSerialNumber;
try
{
diff --git a/FM2014TestApp/Ui/Fm2014sTest/FM2014TestBenchWindow.xaml.cs b/FM2014TestApp/Ui/Fm2014sTest/FM2014TestBenchWindow.xaml.cs
index 2bedeb05..265dd127 100644
--- a/FM2014TestApp/Ui/Fm2014sTest/FM2014TestBenchWindow.xaml.cs
+++ b/FM2014TestApp/Ui/Fm2014sTest/FM2014TestBenchWindow.xaml.cs
@@ -34,9 +34,9 @@ using Xylem.Common.Utils.ProcessExec.EventArguments;
using CheckBox = System.Windows.Controls.CheckBox;
using KeyEventArgs = System.Windows.Input.KeyEventArgs;
using Label = System.Windows.Controls.Label;
-using Properties = Sensus.Ui.Fm2014TestBench.Properties;
using TextBox = System.Windows.Controls.TextBox;
using UserControl = System.Windows.Controls.UserControl;
+using static Sensus.Ui.Fm2014TestBench.Properties.Resources;
namespace Sensus.Ui.FM2014TestBench
{
@@ -170,6 +170,9 @@ namespace Sensus.Ui.FM2014TestBench
// Hide button to avoid stress to EEPROM of FM2014
private readonly Boolean _displayBtnSaveSetupToFm2014 = false;
+ // Reminder for the last address of received message for separator mark between two devices
+ private Int32 _lastAddressReceived;
+
#endregion ---------------------------------------- Properties ------------------------------------------------
#region ------------------------------------------- FormControls ----------------------------------------------
///
@@ -577,12 +580,12 @@ namespace Sensus.Ui.FM2014TestBench
cbxProgramComPort.Text = cbxProgramComPort.Items[_comPortIdx]?.ToString();
// Dispatch multilingual denotation to GUI elements
- btnFM2014Connect.Content = Properties.Resources.StrBtnConnect;
+ btnFM2014Connect.Content = StrBtnConnect;
// Measurement selection tab setup
- tabDutToRefRegulation.Header = Properties.Resources.StrGbxDutToRefRegulation;
- tabDutToRefCalibration.Header = Properties.Resources.StrGbxDutToRefCalibration;
- tabRefToScaleCalibration.Header = Properties.Resources.StrGbxManualRefCalibration;
+ tabDutToRefRegulation.Header = StrGbxDutToRefRegulation;
+ tabDutToRefCalibration.Header = StrGbxDutToRefCalibration;
+ tabRefToScaleCalibration.Header = StrGbxManualRefCalibration;
// Menu setup
//hlpMenu.Header = Properties.Resources.StrLblHelp;
@@ -590,57 +593,57 @@ namespace Sensus.Ui.FM2014TestBench
//optMenuLogin.Header = Properties.Resources.StrLblOptionsLogin;
//optMenuLogout.Header = Properties.Resources.StrLblOptionsLogout;
//optMenuChangePassword.Header = Properties.Resources.StrLblOptionsChangePassword;
- portMenu.Content = Properties.Resources.StrLblComPort;
+ portMenu.Content = StrLblComPort;
// Static labels for all devices
- lblSerialNumberText.Content = Properties.Resources.StrLblFM2014SerialNumber;
- lblLifeTimeText.Content = Properties.Resources.StrLblLifetime;
- lblSlotSelection.Content = Properties.Resources.StrLblSlotSelection;
+ lblSerialNumberText.Content = StrLblFM2014SerialNumber;
+ lblLifeTimeText.Content = StrLblLifetime;
+ lblSlotSelection.Content = StrLblSlotSelection;
// DUT to REF Regulation
- lblRefPulsesPerCm.Content = Properties.Resources.StrLblRefPulsesPerCmRatio;
- lblDutPulsesPerCm.Content = Properties.Resources.StrLblDutPulsesPerCmRatio;
- lblScaleRefToDut.Content = Properties.Resources.StrLblRefToDutScale;
+ lblRefPulsesPerCm.Content = StrLblRefPulsesPerCmRatio;
+ lblDutPulsesPerCm.Content = StrLblDutPulsesPerCmRatio;
+ lblScaleRefToDut.Content = StrLblRefToDutScale;
tbxScaleRefToDut.IsReadOnly = true;
- lblToleranceDisplayAttenuation.Content = Properties.Resources.StrLblDisplayAttenuation;
- btnSaveSetupToFm2014.Content = Properties.Resources.StrBtnSaveRegulationSetup;
+ lblToleranceDisplayAttenuation.Content = StrLblDisplayAttenuation;
+ btnSaveSetupToFm2014.Content = StrBtnSaveRegulationSetup;
UiElmEnable(btnSaveSetupToFm2014, false, _displayBtnSaveSetupToFm2014);
- lblToleranceDisplayRange.Content = Properties.Resources.StrLblFM2014Tolerance;
- chkUseDampedTolerance.Content = Properties.Resources.StrChkUseDampedTolerance;
- btnDutToRefRegulation.Content = Properties.Resources.StrBtnStartRegulation;
+ lblToleranceDisplayRange.Content = StrLblFM2014Tolerance;
+ chkUseDampedTolerance.Content = StrChkUseDampedTolerance;
+ btnDutToRefRegulation.Content = StrBtnStartRegulation;
// Time measurement / DUT to REF Calibration
- rbtRefTimeMeasurement.Content = Properties.Resources.StrSelectRefTimeMeasurement;
- rbtDutTimeMeasurement.Content = Properties.Resources.StrSelectDutTimeMeasurement;
- rbtDutToRefCalibration.Content = Properties.Resources.StrSelectDutToRefCalibration;
+ rbtRefTimeMeasurement.Content = StrSelectRefTimeMeasurement;
+ rbtDutTimeMeasurement.Content = StrSelectDutTimeMeasurement;
+ rbtDutToRefCalibration.Content = StrSelectDutToRefCalibration;
rbtDutToRefCalibration.IsChecked = true;
- lblRefPulsesRequired.Content = Properties.Resources.StrLblRefPulsesRequired;
- lblDutPulsesRequired.Content = Properties.Resources.StrLblDutPulsesRequired;
- lblDoublePulseDeadtime.Content = Properties.Resources.StrLblDoublePulseDeadTime;
- lblDutToRefTolMax.Content = Properties.Resources.StrLblDutToRefToleranceMax;
- lblDutToRefTolMin.Content = Properties.Resources.StrLblDutToRefToleranceMin;
+ lblRefPulsesRequired.Content = StrLblRefPulsesRequired;
+ lblDutPulsesRequired.Content = StrLblDutPulsesRequired;
+ lblDoublePulseDeadtime.Content = StrLblDoublePulseDeadTime;
+ lblDutToRefTolMax.Content = StrLblDutToRefToleranceMax;
+ lblDutToRefTolMin.Content = StrLblDutToRefToleranceMin;
// Pulse counter measurement / Manual REF to Volume Calibration
- chkRefPulsesMeasured.Content = Properties.Resources.StrLblRefPulsesMeasured;
+ chkRefPulsesMeasured.Content = StrLblRefPulsesMeasured;
chkRefPulsesMeasured.IsChecked = true;
tbxRefPulsesMeasured.Text = "";
tbxRefPulsesMeasured.IsReadOnly = true;
- chkDutPulsesMeasured.Content = Properties.Resources.StrLblDutPulsesMeasured;
+ chkDutPulsesMeasured.Content = StrLblDutPulsesMeasured;
chkDutPulsesMeasured.IsChecked = false;
tbxDutPulsesMeasured.Text = "";
tbxDutPulsesMeasured.IsReadOnly = true;
- lblVolumeMeasuredLiters.Content = Properties.Resources.StrLblVolumeMeasured;
+ lblVolumeMeasuredLiters.Content = StrLblVolumeMeasured;
tbxVolumeMeasuredLiters.Text = "";
- lblRefPulsesPerCmScale.Content = Properties.Resources.StrLblRefPulsesPerCmRatio;
+ lblRefPulsesPerCmScale.Content = StrLblRefPulsesPerCmRatio;
tbxRefPulsesPerCmCalib.Text = "";
tbxRefPulsesPerCmCalib.IsReadOnly = true;
- btnRefToVolumeCalibration.Content = Properties.Resources.StrBtnStartCalibration;
+ btnRefToVolumeCalibration.Content = StrBtnStartCalibration;
//// Process status
//lblActualProcessLabel.Content = Properties.Resources.StrLblActualProcessStatus;
//lblTotalProcessLabel.Content = Properties.Resources.StrLblOverallProcessStatus;
- lblTimeText.Text = Properties.Resources.StrLblTime;
+ lblTimeText.Text = StrLblTime;
});
}
@@ -709,7 +712,7 @@ namespace Sensus.Ui.FM2014TestBench
if (string.IsNullOrEmpty(cbxProgramComPort?.SelectedItem?.ToString()) ||
cbxProgramComPort.SelectedItem.ToString().Equals("?"))
{
- var text = Properties.Resources.StrErrorMsgComPortNotAssigned;
+ var text = StrErrorMsgComPortNotAssigned;
//MessageBox.Show(text, Properties.Resources.StrError, MessageBoxButtons.OK, MessageBoxIcon.Error);
LogText(text);
return;
@@ -721,7 +724,7 @@ namespace Sensus.Ui.FM2014TestBench
ResetCancellationToken();
FM2014.SharedCancellationToken = _cancellationToken;
- UpdateContentControl(lblActualProcessText, Properties.Resources.StrMsgConnecting);
+ UpdateContentControl(lblActualProcessText, StrMsgConnecting);
var comPort = cbxProgramComPort.SelectedItem.ToString();
@@ -752,7 +755,7 @@ namespace Sensus.Ui.FM2014TestBench
if (!fm2014.IsLoggedOn)
{
- LogErrorText(Properties.Resources.StrErrorMsgFM2014AccessDenied);
+ LogErrorText(StrErrorMsgFM2014AccessDenied);
continue;
}
@@ -760,13 +763,14 @@ namespace Sensus.Ui.FM2014TestBench
{
// Logging to history window
LogText(StrSeparator);
- LogText("FM2014 ID: " + fm2014.ConnectResponse);
- LogText("FM2014 Firmware Version: " + fm2014.FwVersion);
- LogText($"FM2014 {Properties.Resources.StrLblFM2014SerialNumber} {fm2014.SerialNumber}");
- LogText($"FW2014 {Properties.Resources.StrLblFM2014Address} {fm2014.Address}");
+ LogText($"{StrLblFM2014Address} {fm2014.Address} - FM2014 ID: {fm2014.ConnectResponse}");
+ LogText($"{StrLblFM2014Address} {fm2014.Address} - FM2014 Firmware Version: {fm2014.FwVersion}");
+ LogText($"{StrLblFM2014Address} {fm2014.Address} - FM2014 {StrLblFM2014SerialNumber} " +
+ $"{fm2014.SerialNumber}");
+ LogText($"{StrLblFM2014Address} {fm2014.Address} - FW2014 {StrLblFM2014Address} {fm2014.Address}");
var dt = DateTime.UtcNow;
var msg = $"{dt:yyyy-MM-dd HH:mm:ss} UTC";
- LogText($"{Properties.Resources.StrMsgPcDateTime} {msg}");
+ LogText($"{StrMsgPcDateTime} {msg}");
LogText(StrSeparator);
}
}
@@ -911,7 +915,7 @@ namespace Sensus.Ui.FM2014TestBench
Dispatcher.Invoke(() =>
{
tbxScaleRefToDut.Background = ColorProcessFailed;
- tbxScaleRefToDut.Text = Properties.Resources.StrError;
+ tbxScaleRefToDut.Text = StrError;
btnSaveSetupToFm2014.IsEnabled = false;
btnDutToRefRegulation.IsEnabled = false;
});
@@ -1092,9 +1096,9 @@ namespace Sensus.Ui.FM2014TestBench
UiElmEnable(btnRefToVolumeCalibration, true);
// Prepare test output to start as it is used for strat and stop
- UpdateContentControl(btnRefToVolumeCalibration, Properties.Resources.StrBtnStartCalibration);
- UpdateContentControl(btnDutToRefCalibration, Properties.Resources.StrBtnStartCalibration);
- UpdateContentControl(btnDutToRefRegulation, Properties.Resources.StrBtnStartRegulation);
+ UpdateContentControl(btnRefToVolumeCalibration, StrBtnStartCalibration);
+ UpdateContentControl(btnDutToRefCalibration, StrBtnStartCalibration);
+ UpdateContentControl(btnDutToRefRegulation, StrBtnStartRegulation);
var dutPulseMeasurementIsActive = false;
var refPulseMeasurementIsActive = true;
@@ -1148,7 +1152,7 @@ namespace Sensus.Ui.FM2014TestBench
///
/// Feedback from FM2014being parsed to GUI
///
- ///
+ ///
/// - Initial.
///
private void DataReceived_Handler(Object sender, ProcessExecEventArgs e)
@@ -1161,7 +1165,15 @@ namespace Sensus.Ui.FM2014TestBench
if (sender is FM2014 fm2014)
{
var idx = fm2014.Address - 1;
- ucFm2014 = (UcFM2014Device)UcFM2014s[idx];
+ // Broadcast address is 0 !!!!
+ if (idx < 0)
+ {
+ ucFm2014 = null;
+ }
+ else
+ {
+ ucFm2014 = (UcFM2014Device)UcFM2014s[idx];
+ }
}
else return;
@@ -1191,6 +1203,11 @@ namespace Sensus.Ui.FM2014TestBench
// Used as marker for error, null means measurement is in range or status or health is good
Brush statusColor = null;
+ // Put a separator line to the output for better visibility
+ if (_lastAddressReceived != fm2014.Address)
+ LogText(StrSeparator);
+ _lastAddressReceived = fm2014.Address;
+
// Color the output for the user display for quick check capability
if (e.StatusReturn == StatusReturn.MeasurementOutOfRange)
statusColor = ColorProcessFailed;
@@ -1199,35 +1216,35 @@ namespace Sensus.Ui.FM2014TestBench
if (e.StatusReturn == StatusReturn.Failed)
{
- LogErrorText(resp.AnswerStr);
+ LogErrorText($"{StrLblFM2014Address} {fm2014.Address} - {resp.AnswerStr}");
//ErrorHandler(resp.CmdName);
}
else if (resp.IntValue == null && resp.DoubleValue == null)
{
- LogText(resp.AnswerStr);
+ LogText($"{StrLblFM2014Address} {fm2014.Address} - {resp.AnswerStr}");
}
else if (resp.IntValue != null)
{
- LogText($"{resp.AnswerStr}: {resp.IntValue:D} {resp.Unit}");
+ LogText($"{StrLblFM2014Address} {fm2014.Address} - {resp.AnswerStr}: {resp.IntValue:D} {resp.Unit}");
switch (resp.CmdName)
{
case CmdName.CmdGetRefPulsesRemaining:
- ucFm2014.SetValue(CAL_LBL_IDX_REF_RMN_PLS, $"{resp.IntValue:D}", statusColor);
+ ucFm2014?.SetValue(CAL_LBL_IDX_REF_RMN_PLS, $"{resp.IntValue:D}", statusColor);
break;
case CmdName.CmdGetDutPulsesRemaining:
- ucFm2014.SetValue(CAL_LBL_IDX_DUT_RMN_PLS, $"{resp.IntValue:D}", statusColor);
+ ucFm2014?.SetValue(CAL_LBL_IDX_DUT_RMN_PLS, $"{resp.IntValue:D}", statusColor);
break;
case CmdName.CmdGetRefPulsesCounted:
case CmdName.CmdGetRefPulsesCountedBackup:
if (firstFm2014 != null && firstFm2014.Address == fm2014.Address)
UpdateTextBox(tbxRefPulsesMeasured, $"{resp.IntValue:D}", statusColor);
- ucFm2014.SetValue(CTR_LBL_IDX_REF_PLS, $"{resp.IntValue:D}", statusColor);
+ ucFm2014?.SetValue(CTR_LBL_IDX_REF_PLS, $"{resp.IntValue:D}", statusColor);
break;
case CmdName.CmdGetDutPulsesCounted:
case CmdName.CmdGetDutPulsesCountedBackup:
if (firstFm2014 != null && firstFm2014.Address == fm2014.Address)
UpdateTextBox(tbxDutPulsesMeasured, $"{resp.IntValue:D}", statusColor);
- ucFm2014.SetValue(CTR_LBL_IDX_DUT_PLS, $"{resp.IntValue:D}", statusColor);
+ ucFm2014?.SetValue(CTR_LBL_IDX_DUT_PLS, $"{resp.IntValue:D}", statusColor);
break;
case CmdName.CmdSetRefPulsesPerCm:
if (firstFm2014 != null && firstFm2014.Address == fm2014.Address)
@@ -1252,7 +1269,7 @@ namespace Sensus.Ui.FM2014TestBench
break;
case CmdName.CmdGetRefFrequency:
valueStr = $"{resp.IntValue:D}";
- ucFm2014.SetValue(REG_LBL_IDX_REF_FREQU, valueStr, statusColor);
+ ucFm2014?.SetValue(REG_LBL_IDX_REF_FREQU, valueStr, statusColor);
break;
case CmdName.CmdResetMeasurement:
// Immediately lock all buttons and input fields until reset is finished
@@ -1260,31 +1277,35 @@ namespace Sensus.Ui.FM2014TestBench
UiElmEnable(lblActualProgressPercent, true);
// Check countdown of reset method
if (resp.IntValue == 0)
+ {
ActionControl(false);
+ LogText(StrSeparator);
+ }
+
break;
}
}
else if (resp.DoubleValue != null)
{
- LogText($"{resp.AnswerStr}: {resp.DoubleValue:F4} {resp.Unit}");
+ LogText($"{StrLblFM2014Address} {fm2014.Address} - {resp.AnswerStr}: {resp.DoubleValue:F4} {resp.Unit}");
switch (resp.CmdName)
{
case CmdName.CmdGetRefTimerTicks:
valueStr = $"{resp.DoubleValue:F4}";
- ucFm2014.SetValue(CAL_LBL_IDX_REF_MEAS_TMR, valueStr, statusColor);
+ ucFm2014?.SetValue(CAL_LBL_IDX_REF_MEAS_TMR, valueStr, statusColor);
break;
case CmdName.CmdGetDutTimerTicks:
valueStr = $"{resp.DoubleValue:F4}";
- ucFm2014.SetValue(CAL_LBL_IDX_DUT_MEAS_TMR, valueStr, statusColor);
+ ucFm2014?.SetValue(CAL_LBL_IDX_DUT_MEAS_TMR, valueStr, statusColor);
break;
case CmdName.CmdCalculatedDutToRefTolerance:
valueStr = $"{resp.DoubleValue:F4}";
- ucFm2014.SetValue(CAL_LBL_IDX_DUT_TO_REF_TOL, valueStr, statusColor);
+ ucFm2014?.SetValue(CAL_LBL_IDX_DUT_TO_REF_TOL, valueStr, statusColor);
break;
case CmdName.CmdGetDutToRefToleranceUndamped:
case CmdName.CmdGetDutToRefToleranceDamped:
valueStr = $"{resp.DoubleValue:F3}";
- ucFm2014.SetValue(REG_LBL_IDX_DUT_TO_REF_TOL, valueStr, statusColor);
+ ucFm2014?.SetValue(REG_LBL_IDX_DUT_TO_REF_TOL, valueStr, statusColor);
break;
case CmdName.CmdRefToDutScale:
if (firstFm2014 != null && firstFm2014.Address == fm2014.Address)
@@ -1305,7 +1326,7 @@ namespace Sensus.Ui.FM2014TestBench
// break;
case CmdName.CmdCalculatedFlowRefFrequ:
valueStr = $"{resp.DoubleValue:F3}";
- ucFm2014.SetValue(REG_LBL_IDX_FLOW_RATE, valueStr, statusColor);
+ ucFm2014?.SetValue(REG_LBL_IDX_FLOW_RATE, valueStr, statusColor);
//UpdateTextBox(tbxRefFlowRateFromRefFrequencyCmPerH, valueStr);
// TODO THW Check if the actual flow shall be taken based on 'REF Frequency'
//UpdateTextBox(tbxActualFlowRateCmPerHour, valueStr);
@@ -1377,26 +1398,26 @@ namespace Sensus.Ui.FM2014TestBench
if (refPulsesRequired != null)
{
UpdateContentControl(MeasurementLabels[CAL_LBL_IDX_REF_REQ_PLS],
- Properties.Resources.StrLblRefPulsesRequired);
+ StrLblRefPulsesRequired);
UpdateContentControl(MeasurementLabels[CAL_LBL_IDX_REF_RMN_PLS],
- Properties.Resources.StrLblRefPulsesRemaining);
- UpdateContentControl(MeasurementLabels[CAL_LBL_IDX_REF_MEAS_TMR], Properties.Resources.StrLblRefTimeMeasured);
+ StrLblRefPulsesRemaining);
+ UpdateContentControl(MeasurementLabels[CAL_LBL_IDX_REF_MEAS_TMR], StrLblRefTimeMeasured);
}
if (dutPulsesRequired != null)
{
UpdateContentControl(MeasurementLabels[CAL_LBL_IDX_DUT_REQ_PLS],
- Properties.Resources.StrLblDutPulsesRequired);
+ StrLblDutPulsesRequired);
UpdateContentControl(MeasurementLabels[CAL_LBL_IDX_DUT_RMN_PLS],
- Properties.Resources.StrLblDutPulsesRemaining);
- UpdateContentControl(MeasurementLabels[CAL_LBL_IDX_DUT_MEAS_TMR], Properties.Resources.StrLblDutTimeMeasured);
+ StrLblDutPulsesRemaining);
+ UpdateContentControl(MeasurementLabels[CAL_LBL_IDX_DUT_MEAS_TMR], StrLblDutTimeMeasured);
}
if (refPulsesRequired != null && dutPulsesRequired != null)
{
UpdateContentControl(MeasurementLabels[CAL_LBL_IDX_DUT_TO_REF_TOL],
- Properties.Resources.StrLblDutToRefToleranceMeasured);
+ StrLblDutToRefToleranceMeasured);
}
UiElmEnable(MeasurementLabels[CAL_LBL_IDX_REF_REQ_PLS], true);
@@ -1436,7 +1457,7 @@ namespace Sensus.Ui.FM2014TestBench
{
_autoProgressBar = false;
ActionControl(true);
- UpdateContentControl(btnDutToRefCalibration, Properties.Resources.StrBtnStopCalibration);
+ UpdateContentControl(btnDutToRefCalibration, StrBtnStopCalibration);
UiElmEnable(btnDutToRefCalibration, true);
}
}
@@ -1464,9 +1485,9 @@ namespace Sensus.Ui.FM2014TestBench
UiElmEnable(measLbl, false, false);
// Set the measurement labels
- UpdateContentControl(MeasurementLabels[REG_LBL_IDX_REF_FREQU], Properties.Resources.StrLblRefFrequencyHz);
- UpdateContentControl(MeasurementLabels[REG_LBL_IDX_FLOW_RATE], Properties.Resources.StrLblFlowRateMeasured);
- UpdateContentControl(MeasurementLabels[REG_LBL_IDX_DUT_TO_REF_TOL], Properties.Resources.StrLblDutToRefToleranceMeasured);
+ UpdateContentControl(MeasurementLabels[REG_LBL_IDX_REF_FREQU], StrLblRefFrequencyHz);
+ UpdateContentControl(MeasurementLabels[REG_LBL_IDX_FLOW_RATE], StrLblFlowRateMeasured);
+ UpdateContentControl(MeasurementLabels[REG_LBL_IDX_DUT_TO_REF_TOL], StrLblDutToRefToleranceMeasured);
UiElmEnable(MeasurementLabels[REG_LBL_IDX_REF_FREQU], true);
UiElmEnable(MeasurementLabels[REG_LBL_IDX_FLOW_RATE], true);
UiElmEnable(MeasurementLabels[REG_LBL_IDX_DUT_TO_REF_TOL], true);
@@ -1492,7 +1513,7 @@ namespace Sensus.Ui.FM2014TestBench
{
_autoProgressBar = true;
ActionControl(true);
- UpdateContentControl(btnDutToRefRegulation, Properties.Resources.StrBtnStopRegulation);
+ UpdateContentControl(btnDutToRefRegulation, StrBtnStopRegulation);
UiElmEnable(btnDutToRefRegulation, true);
}
}
@@ -1521,8 +1542,8 @@ namespace Sensus.Ui.FM2014TestBench
UiElmEnable(measLbl, false, false);
// Set the measurement labels
- UpdateContentControl(MeasurementLabels[CTR_LBL_IDX_REF_PLS], Properties.Resources.StrLblRefPulsesMeasured);
- UpdateContentControl(MeasurementLabels[CTR_LBL_IDX_DUT_PLS], Properties.Resources.StrLblDutPulsesMeasured);
+ UpdateContentControl(MeasurementLabels[CTR_LBL_IDX_REF_PLS], StrLblRefPulsesMeasured);
+ UpdateContentControl(MeasurementLabels[CTR_LBL_IDX_DUT_PLS], StrLblDutPulsesMeasured);
UiElmEnable(MeasurementLabels[CTR_LBL_IDX_REF_PLS], true);
UiElmEnable(MeasurementLabels[CTR_LBL_IDX_DUT_PLS], true);
@@ -1558,7 +1579,7 @@ namespace Sensus.Ui.FM2014TestBench
{
_autoProgressBar = true;
ActionControl(true);
- UpdateContentControl(btnRefToVolumeCalibration, Properties.Resources.StrBtnStopCalibration);
+ UpdateContentControl(btnRefToVolumeCalibration, StrBtnStopCalibration);
UiElmEnable(btnRefToVolumeCalibration, true);
}
}
@@ -2501,7 +2522,7 @@ namespace Sensus.Ui.FM2014TestBench
{
tbxVolumeMeasuredLiters.Background = ColorProcessFailed;
tbxRefPulsesPerCmCalib.Background = ColorProcessFailed;
- tbxRefPulsesPerCm.Text = Properties.Resources.StrError;
+ tbxRefPulsesPerCm.Text = StrError;
}
}
});