From e22d58101c45ffcb6d04610402d632b4c6d29bc0 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Sun, 14 Feb 2016 19:02:07 +0100 Subject: [PATCH] Correct start-up message when there is no CB component, version 2.1.214 --- TestBenchFramework/BenchControl/StateMachine.cs | 9 ++++++++- .../iPerlCommunication/iPerlCommunicationForm.cs | 2 +- TestBenchFramework/MainWnd.cs | 6 +++--- TestBenchFramework/Properties/AssemblyInfo.cs | 4 ++-- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/TestBenchFramework/BenchControl/StateMachine.cs b/TestBenchFramework/BenchControl/StateMachine.cs index 21780eeb3..33fd2eccd 100644 --- a/TestBenchFramework/BenchControl/StateMachine.cs +++ b/TestBenchFramework/BenchControl/StateMachine.cs @@ -272,7 +272,14 @@ namespace TBF.BenchControl for (int i = 0; i < tankCapacities.Length; i++) tankCapacities[i] = balances[i].Capacity; /// Pre-initialize the control board (= buffer the arguments ctrlBrdComponent, tankCapacities) - ControlBoard.InitializeComponent(ctrlBrdComponent, valvesToInvert, tankCapacities); + if (ControlBoard != null) + { + ControlBoard.InitializeComponent(ctrlBrdComponent, valvesToInvert, tankCapacities); + } + else + { + throw new Exception("Control board component is missing"); + } } public static string InitializeDevices() diff --git a/TestBenchFramework/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs b/TestBenchFramework/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs index 5717ffdd2..8099b2cc5 100644 --- a/TestBenchFramework/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs +++ b/TestBenchFramework/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs @@ -995,7 +995,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication return error; } - + const int Hz2CorrFactorsAddr = 0x1875; /// Used by Reset2HzCorrection(...) and Write2HzCorrection(...) const int Q2CorrFactorsAddr = 0x1878; /// Used by ResetQ2Correction(...) and WriteQ2Correction(...) diff --git a/TestBenchFramework/MainWnd.cs b/TestBenchFramework/MainWnd.cs index 5d6214fdb..a9f20c81a 100644 --- a/TestBenchFramework/MainWnd.cs +++ b/TestBenchFramework/MainWnd.cs @@ -110,9 +110,9 @@ namespace TBF catch (Exception exc) { benchInitializationFailed = true; - log.Fatal("Failed to initialize a test bench component", exc); - MessageBox.Show(exc.Message, Strings.Error, System.Windows.Forms.MessageBoxButtons.OK, - System.Windows.Forms.MessageBoxIcon.Exclamation); + log.FatalFormat("Failed to initialize a test bench component: {0}", exc.Message); + MessageBox.Show(string.Format("Failed to initialize a test bench component: {0}", exc.Message), + Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } diff --git a/TestBenchFramework/Properties/AssemblyInfo.cs b/TestBenchFramework/Properties/AssemblyInfo.cs index f254c666c..7868ead1e 100644 --- a/TestBenchFramework/Properties/AssemblyInfo.cs +++ b/TestBenchFramework/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("2.1.213.1")] -[assembly: AssemblyFileVersion("2.1.213.1")] +[assembly: AssemblyVersion("2.1.214.1")] +[assembly: AssemblyFileVersion("2.1.214.1")]