aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2021-06-23 09:42:28 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2021-06-23 09:42:28 +0300
commit3b661bbfd2b66788efcf6f445e03069df7248889 (patch)
tree90fd360a2a705d05e0fc071914770201907dd578
parent230f73f478a6428a975a51789b6f43ca7a8a5ef8 (diff)
downloadTango-3b661bbfd2b66788efcf6f445e03069df7248889.tar.gz
Tango-3b661bbfd2b66788efcf6f445e03069df7248889.zip
Implemented head type checking on PPC.
-rw-r--r--Software/PMR/Messages/Connection/DeviceInformation.proto4
-rw-r--r--Software/PMR/Messages/Diagnostics/HeadType.proto10
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs28
-rw-r--r--Software/Visual_Studio/Tango.PMR/Connection/DeviceInformation.cs46
-rw-r--r--Software/Visual_Studio/Tango.PMR/Diagnostics/HeadType.cs45
-rw-r--r--Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj3
6 files changed, 127 insertions, 9 deletions
diff --git a/Software/PMR/Messages/Connection/DeviceInformation.proto b/Software/PMR/Messages/Connection/DeviceInformation.proto
index 3e5e3e347..744da1985 100644
--- a/Software/PMR/Messages/Connection/DeviceInformation.proto
+++ b/Software/PMR/Messages/Connection/DeviceInformation.proto
@@ -1,5 +1,7 @@
syntax = "proto3";
+import "HeadType.proto";
+
package Tango.PMR.Connection;
option java_package = "com.twine.tango.pmr.connection";
@@ -18,4 +20,6 @@ message DeviceInformation
//Diagnostics interval in milliseconds
uint32 DiagnosticsInterval = 9;
+
+ PMR.Diagnostics.HeadType HeadType = 10;
} \ No newline at end of file
diff --git a/Software/PMR/Messages/Diagnostics/HeadType.proto b/Software/PMR/Messages/Diagnostics/HeadType.proto
new file mode 100644
index 000000000..7dcc20d63
--- /dev/null
+++ b/Software/PMR/Messages/Diagnostics/HeadType.proto
@@ -0,0 +1,10 @@
+syntax = "proto3";
+
+package Tango.PMR.Diagnostics;
+option java_package = "com.twine.tango.pmr.diagnostics";
+
+enum HeadType
+{
+ Flat = 0;
+ Arc = 1;
+} \ No newline at end of file
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs
index c22d690aa..9074bcd4c 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs
@@ -22,6 +22,7 @@ using Tango.PPC.UI.Dialogs;
using Tango.SharedUI;
using System.Data.Entity;
using Tango.PPC.UI.AppBarItems;
+using Tango.PPC.Common.Notifications.NotificationItems;
namespace Tango.PPC.UI.ViewModels
{
@@ -36,6 +37,7 @@ namespace Tango.PPC.UI.ViewModels
private bool _isThreadLoadingShown;
private PowerUpAppBarItem _powerUpAppBar;
private bool _started;
+ private MessageNotificationItem _headTypeNotification;
private DateTime _currentDateTime;
/// <summary>
@@ -53,6 +55,12 @@ namespace Tango.PPC.UI.ViewModels
_date_timer.Interval = TimeSpan.FromSeconds(1);
_date_timer.Tick += _date_timer_Tick;
_date_timer.Start();
+
+ _headTypeNotification = new MessageNotificationItem();
+ _headTypeNotification.CanClose = false;
+ _headTypeNotification.MessageType = MessageNotificationItem.MessageNotificationItemTypes.Error;
+ _headTypeNotification.Priority = NotificationItem.NotificationPriority.Critical;
+ _headTypeNotification.Message = "Machine head type mismatch.";
}
/// <summary>
@@ -74,6 +82,8 @@ namespace Tango.PPC.UI.ViewModels
MachineProvider.MachineOperator.PowerUpStarted += MachineOperator_PowerUpStarted;
MachineProvider.MachineOperator.PowerUpProgress += MachineOperator_PowerUpProgress;
MachineProvider.MachineOperator.PowerUpEnded += MachineOperator_PowerUpEnded;
+
+ MachineProvider.MachineConnected += MachineProvider_MachineConnected;
}
#region Power Up
@@ -247,5 +257,23 @@ namespace Tango.PPC.UI.ViewModels
// DisplayThreadLoading(e);
}
#endregion
+
+ #region Head Type Check
+
+ private void MachineProvider_MachineConnected(object sender, EventArgs e)
+ {
+ NotificationProvider.PopNotification(_headTypeNotification);
+
+ if (MachineProvider.MachineOperator.DeviceInformation != null)
+ {
+ if (MachineProvider.Machine.HeadType != (int)MachineProvider.MachineOperator.DeviceInformation.HeadType)
+ {
+ _headTypeNotification.ExpandedMessage = $"Machine configuration reports head type '{MachineProvider.Machine.MachineHeadType}' while firmware device reports '{MachineProvider.MachineOperator.DeviceInformation.HeadType}'.";
+ NotificationProvider.PushNotification(_headTypeNotification);
+ }
+ }
+ }
+
+ #endregion
}
}
diff --git a/Software/Visual_Studio/Tango.PMR/Connection/DeviceInformation.cs b/Software/Visual_Studio/Tango.PMR/Connection/DeviceInformation.cs
index 3b5b4cfa7..77129d5db 100644
--- a/Software/Visual_Studio/Tango.PMR/Connection/DeviceInformation.cs
+++ b/Software/Visual_Studio/Tango.PMR/Connection/DeviceInformation.cs
@@ -23,16 +23,18 @@ namespace Tango.PMR.Connection {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"ChdEZXZpY2VJbmZvcm1hdGlvbi5wcm90bxIUVGFuZ28uUE1SLkNvbm5lY3Rp",
- "b24i1AEKEURldmljZUluZm9ybWF0aW9uEgwKBE5hbWUYASABKAkSDwoHVmVy",
- "c2lvbhgCIAEoCRIRCglCdWlsZERhdGUYAyABKAkSFQoNQm9hcmRSZXZpc2lv",
- "bhgEIAEoCRIXCg9Bc3NlbWJseVZlcnNpb24YBSABKAkSFAoMRlBHQTFWZXJz",
- "aW9uGAYgASgJEhQKDEZQR0EyVmVyc2lvbhgHIAEoCRIUCgxGUEdBM1ZlcnNp",
- "b24YCCABKAkSGwoTRGlhZ25vc3RpY3NJbnRlcnZhbBgJIAEoDUIgCh5jb20u",
- "dHdpbmUudGFuZ28ucG1yLmNvbm5lY3Rpb25iBnByb3RvMw=="));
+ "b24aDkhlYWRUeXBlLnByb3RvIocCChFEZXZpY2VJbmZvcm1hdGlvbhIMCgRO",
+ "YW1lGAEgASgJEg8KB1ZlcnNpb24YAiABKAkSEQoJQnVpbGREYXRlGAMgASgJ",
+ "EhUKDUJvYXJkUmV2aXNpb24YBCABKAkSFwoPQXNzZW1ibHlWZXJzaW9uGAUg",
+ "ASgJEhQKDEZQR0ExVmVyc2lvbhgGIAEoCRIUCgxGUEdBMlZlcnNpb24YByAB",
+ "KAkSFAoMRlBHQTNWZXJzaW9uGAggASgJEhsKE0RpYWdub3N0aWNzSW50ZXJ2",
+ "YWwYCSABKA0SMQoISGVhZFR5cGUYCiABKA4yHy5UYW5nby5QTVIuRGlhZ25v",
+ "c3RpY3MuSGVhZFR5cGVCIAoeY29tLnR3aW5lLnRhbmdvLnBtci5jb25uZWN0",
+ "aW9uYgZwcm90bzM="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
- new pbr::FileDescriptor[] { },
+ new pbr::FileDescriptor[] { global::Tango.PMR.Diagnostics.HeadTypeReflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] {
- new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Connection.DeviceInformation), global::Tango.PMR.Connection.DeviceInformation.Parser, new[]{ "Name", "Version", "BuildDate", "BoardRevision", "AssemblyVersion", "FPGA1Version", "FPGA2Version", "FPGA3Version", "DiagnosticsInterval" }, null, null, null)
+ new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Connection.DeviceInformation), global::Tango.PMR.Connection.DeviceInformation.Parser, new[]{ "Name", "Version", "BuildDate", "BoardRevision", "AssemblyVersion", "FPGA1Version", "FPGA2Version", "FPGA3Version", "DiagnosticsInterval", "HeadType" }, null, null, null)
}));
}
#endregion
@@ -72,6 +74,7 @@ namespace Tango.PMR.Connection {
fPGA2Version_ = other.fPGA2Version_;
fPGA3Version_ = other.fPGA3Version_;
diagnosticsInterval_ = other.diagnosticsInterval_;
+ headType_ = other.headType_;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -181,6 +184,17 @@ namespace Tango.PMR.Connection {
}
}
+ /// <summary>Field number for the "HeadType" field.</summary>
+ public const int HeadTypeFieldNumber = 10;
+ private global::Tango.PMR.Diagnostics.HeadType headType_ = 0;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public global::Tango.PMR.Diagnostics.HeadType HeadType {
+ get { return headType_; }
+ set {
+ headType_ = value;
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as DeviceInformation);
@@ -203,6 +217,7 @@ namespace Tango.PMR.Connection {
if (FPGA2Version != other.FPGA2Version) return false;
if (FPGA3Version != other.FPGA3Version) return false;
if (DiagnosticsInterval != other.DiagnosticsInterval) return false;
+ if (HeadType != other.HeadType) return false;
return true;
}
@@ -218,6 +233,7 @@ namespace Tango.PMR.Connection {
if (FPGA2Version.Length != 0) hash ^= FPGA2Version.GetHashCode();
if (FPGA3Version.Length != 0) hash ^= FPGA3Version.GetHashCode();
if (DiagnosticsInterval != 0) hash ^= DiagnosticsInterval.GetHashCode();
+ if (HeadType != 0) hash ^= HeadType.GetHashCode();
return hash;
}
@@ -264,6 +280,10 @@ namespace Tango.PMR.Connection {
output.WriteRawTag(72);
output.WriteUInt32(DiagnosticsInterval);
}
+ if (HeadType != 0) {
+ output.WriteRawTag(80);
+ output.WriteEnum((int) HeadType);
+ }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -296,6 +316,9 @@ namespace Tango.PMR.Connection {
if (DiagnosticsInterval != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(DiagnosticsInterval);
}
+ if (HeadType != 0) {
+ size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) HeadType);
+ }
return size;
}
@@ -331,6 +354,9 @@ namespace Tango.PMR.Connection {
if (other.DiagnosticsInterval != 0) {
DiagnosticsInterval = other.DiagnosticsInterval;
}
+ if (other.HeadType != 0) {
+ HeadType = other.HeadType;
+ }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -377,6 +403,10 @@ namespace Tango.PMR.Connection {
DiagnosticsInterval = input.ReadUInt32();
break;
}
+ case 80: {
+ headType_ = (global::Tango.PMR.Diagnostics.HeadType) input.ReadEnum();
+ break;
+ }
}
}
}
diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/HeadType.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/HeadType.cs
new file mode 100644
index 000000000..215180e25
--- /dev/null
+++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/HeadType.cs
@@ -0,0 +1,45 @@
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: HeadType.proto
+#pragma warning disable 1591, 0612, 3021
+#region Designer generated code
+
+using pb = global::Google.Protobuf;
+using pbc = global::Google.Protobuf.Collections;
+using pbr = global::Google.Protobuf.Reflection;
+using scg = global::System.Collections.Generic;
+namespace Tango.PMR.Diagnostics {
+
+ /// <summary>Holder for reflection information generated from HeadType.proto</summary>
+ public static partial class HeadTypeReflection {
+
+ #region Descriptor
+ /// <summary>File descriptor for HeadType.proto</summary>
+ public static pbr::FileDescriptor Descriptor {
+ get { return descriptor; }
+ }
+ private static pbr::FileDescriptor descriptor;
+
+ static HeadTypeReflection() {
+ byte[] descriptorData = global::System.Convert.FromBase64String(
+ string.Concat(
+ "Cg5IZWFkVHlwZS5wcm90bxIVVGFuZ28uUE1SLkRpYWdub3N0aWNzKh0KCEhl",
+ "YWRUeXBlEggKBEZsYXQQABIHCgNBcmMQAUIhCh9jb20udHdpbmUudGFuZ28u",
+ "cG1yLmRpYWdub3N0aWNzYgZwcm90bzM="));
+ descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
+ new pbr::FileDescriptor[] { },
+ new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tango.PMR.Diagnostics.HeadType), }, null));
+ }
+ #endregion
+
+ }
+ #region Enums
+ public enum HeadType {
+ [pbr::OriginalName("Flat")] Flat = 0,
+ [pbr::OriginalName("Arc")] Arc = 1,
+ }
+
+ #endregion
+
+}
+
+#endregion Designer generated code
diff --git a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj
index 32ffc0eeb..7e3ec022f 100644
--- a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj
+++ b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj
@@ -129,6 +129,7 @@
<Compile Include="Diagnostics\DoubleArray.cs" />
<Compile Include="Diagnostics\Event.cs" />
<Compile Include="Diagnostics\EventType.cs" />
+ <Compile Include="Diagnostics\HeadType.cs" />
<Compile Include="Diagnostics\HeaterState.cs" />
<Compile Include="Diagnostics\HeaterType.cs" />
<Compile Include="Diagnostics\InterfaceIOs.cs" />
@@ -507,7 +508,7 @@
</PropertyGroup>
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
+ <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file