TempMeter zero-based index range extended to 0..15, ver. 2.18.1164
This commit is contained in:
parent
3e54204a17
commit
b410f473e2
@ -18,7 +18,7 @@ namespace TBF.BenchControl.Elde.TempMeter
|
||||
|
||||
public readonly ControlBoardDev ControlBoard;
|
||||
|
||||
public int Idx0 { get { return tempMtrCfg.Idx0; } } /// 0..7
|
||||
public int Idx0 { get { return tempMtrCfg.Idx0; } } /// 0..15
|
||||
public double A1 { get { return tempMtrCfg.A1; } }
|
||||
public double A2 { get { return tempMtrCfg.A2; } }
|
||||
public double A3 { get { return tempMtrCfg.A3; } }
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -19,7 +19,7 @@ namespace TBF.BenchControl.Elde.TempMeter
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public int Idx0; /// 0..7
|
||||
public int Idx0; /// 0 .. 15
|
||||
public double A1;
|
||||
public double A2;
|
||||
public double A3;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.IO;
|
||||
@ -96,10 +96,10 @@ namespace TBF.BenchControl.Elde.TempMeter
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "Invalid 'Parent Name'";
|
||||
}
|
||||
if (!int.TryParse(positionTextBox.Text, out dummy) || dummy < 0 || dummy > 7)
|
||||
if (!int.TryParse(positionTextBox.Text, out dummy) || dummy < 0 || dummy > 15)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Position' should be between 0 and 7";
|
||||
message += Environment.NewLine + "'Position' should be between 0 and 15";
|
||||
}
|
||||
|
||||
double fdummy;
|
||||
@ -167,36 +167,46 @@ namespace TBF.BenchControl.Elde.TempMeter
|
||||
if (!string.IsNullOrEmpty(lastImportFileName)) dlg.FileName = lastImportFileName;
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
try
|
||||
using (TextReader reader = new StreamReader(dlg.FileName))
|
||||
{
|
||||
using (TextReader reader = new StreamReader(dlg.FileName))
|
||||
{
|
||||
double tmp;
|
||||
string lineID = string.Format("Calch{0} =", positionTextBox.Text);
|
||||
|
||||
do
|
||||
try
|
||||
{
|
||||
string startOfLine = string.Format("Calch{0} =", positionTextBox.Text);
|
||||
bool channelFound = false;
|
||||
string line;
|
||||
|
||||
do
|
||||
{
|
||||
string line = reader.ReadLine();
|
||||
if (line != null && line.IndexOf(lineID) == 0)
|
||||
line = reader.ReadLine();
|
||||
if (!string.IsNullOrEmpty(line) && (line.IndexOf(startOfLine) == 0))
|
||||
{
|
||||
string[] factors = line.Substring(lineID.Length).Split(new char[] { ',' });
|
||||
string[] factors = line.Substring(startOfLine.Length).Split(new char[] { ',' });
|
||||
int count = factors.Length;
|
||||
if (count >= 1 && Utils.TryParseEDouble(factors[0].Trim(), out tmp)) a1TextBox.Text = factors[0].Trim();
|
||||
double tmp;
|
||||
if (count >= 1 && Utils.TryParseEDouble(factors[0].Trim(), out tmp)) a1TextBox.Text = factors[0].Trim();
|
||||
if (count >= 2 && Utils.TryParseEDouble(factors[1].Trim(), out tmp)) a2TextBox.Text = factors[1].Trim();
|
||||
if (count >= 3 && Utils.TryParseEDouble(factors[2].Trim(), out tmp)) a3TextBox.Text = factors[2].Trim();
|
||||
if (count >= 4 && Utils.TryParseEDouble(factors[3].Trim(), out tmp)) a4TextBox.Text = factors[3].Trim();
|
||||
if (count >= 5 && Utils.TryParseEDouble(factors[4].Trim(), out tmp)) a5TextBox.Text = factors[4].Trim();
|
||||
channelFound = true;
|
||||
lastImportFileName = dlg.FileName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (lineID != null);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageBox.Show("Import failed", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
while (line != null);
|
||||
|
||||
if (!channelFound)
|
||||
{
|
||||
MessageBox.Show(string.Format("Calibration factors for channel {0} not found.", positionTextBox.Text),
|
||||
"Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageBox.Show("Wrong file format, import failed.",
|
||||
"Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.18.1163.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.1163.0")]
|
||||
[assembly: AssemblyVersion("2.18.1164.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.1164.0")]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user