Write given calibration factors function added, database almost implemented, version 1.5.88.

This commit is contained in:
Milan Hanajik
2015-08-21 14:30:47 +02:00
parent be1344034e
commit db8598579d
4 changed files with 198 additions and 47 deletions
@@ -521,7 +521,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
else if (activity.ToLower().Contains(SetTestModeStr.ToLower())) error = SetTestMode(wm, ref resultStr);
else if (activity.ToLower().Equals(SetActiveModeStr.ToLower())) error = SetActiveMode(wm, ref resultStr);
else if (activity.ToLower().Equals(ReadCalibrationStr.ToLower())) error = ReadCalibration(wm, ref resultStr);
else if (activity.ToLower().Equals(WriteCalibrationFactorStr.ToLower())) error = WriteCalibrationFactor(wm, ref resultStr);
else if (activity.ToLower().Contains(WriteCalibrationFactorStr.ToLower())) error = WriteCalibrationFactor(wm, ref resultStr);
else if (activity.ToLower().Equals(ResetQ2CorrectionStr.ToLower())) error = ResetQ2Correction(wm, ref resultStr);
else if (activity.ToLower().Equals(WriteQ2CorrectionStr.ToLower())) error = WriteQ2Correction(wm, ref resultStr);
else
@@ -805,8 +805,23 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
CommErr error = CommErr.Write;
UInt16 newCalibFactor = 3000; /// Default value
///
if (activity.Length > WriteCalibrationFactorStr.Length)
{
string calibFactrorStr = activity.Substring(WriteCalibrationFactorStr.Length + 1);
UInt16 val;
if (UInt16.TryParse(calibFactrorStr, out val) && val > 0)
{
newCalibFactor = val; /// Update with specified value
}
}
else
{
/// Write the calculated calibration factor
UInt16 newCalibFactor = wm.CalculateNewCalibFactor(wm.CalibrationFactor);
newCalibFactor = wm.CalculateNewCalibFactor(wm.CalibrationFactor);
}
byte[] data = new byte[2] { (byte)(newCalibFactor & 0x00FF), (byte)((newCalibFactor >> 8) & 0x00FF) };
for (int j = 0; j < MaxCommRetries; j++)
{