From d1dc68496c5e2d103db149bbbe40546acf58bb85 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 18 Oct 2018 13:57:15 +0300 Subject: Implemented directional homing for motors and dispensers. --- .../Editors/DispenserElementEditor.xaml | 29 ++++++++++++++++++-- .../Editors/DispenserElementEditor.xaml.cs | 14 +++++++++- .../Editors/MotorElementEditor.xaml | 31 +++++++++++++++++++--- .../Editors/MotorElementEditor.xaml.cs | 18 ++++++++----- .../Editors/MotorGroupElementEditor.xaml.cs | 2 +- .../Editors/ThreadMotionElementEditor.xaml.cs | 2 +- .../TechItems/MotorActionType.cs | 3 ++- .../ViewModels/MachineTechViewVM.cs | 6 +++-- 8 files changed, 88 insertions(+), 17 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml index 630dddec7..78b7d63c0 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml @@ -35,7 +35,32 @@ - + + + + @@ -112,7 +137,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml.cs index f29d0a78d..f0056a740 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml.cs @@ -146,7 +146,7 @@ namespace Tango.MachineStudio.Technician.Editors private void OnHomingStarted(object sender, RoutedEventArgs e) { AnimateLeft(); - DispenserItem.RaiseAction(MotorActionType.HomingStarted); + DispenserItem.RaiseAction(MotorActionType.HomingForwardStarted); } private void OnHomingStopped(object sender, RoutedEventArgs e) @@ -182,5 +182,17 @@ namespace Tango.MachineStudio.Technician.Editors propRotate.BeginAnimation(RotateTransform.AngleProperty, null); }); } + + private void OnHomingBackwardStarted(object sender, RoutedEventArgs e) + { + AnimateLeft(); + DispenserItem.RaiseAction(MotorActionType.HomingBackwardStarted); + } + + private void OnHomingForwardStarted(object sender, RoutedEventArgs e) + { + AnimateRight(); + DispenserItem.RaiseAction(MotorActionType.HomingForwardStarted); + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml index 25907fd8f..7e50b3349 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml @@ -37,7 +37,32 @@ - + + + + @@ -94,7 +119,7 @@ - + @@ -102,7 +127,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml.cs index 9e76667dd..7a8f8309f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml.cs @@ -143,12 +143,6 @@ namespace Tango.MachineStudio.Technician.Editors MotorItem.RaiseAction(MotorActionType.BackwardReleased); } - private void OnHomingStarted(object sender, RoutedEventArgs e) - { - AnimateLeft(); - MotorItem.RaiseAction(MotorActionType.HomingStarted); - } - private void OnHomingStopped(object sender, RoutedEventArgs e) { StopAnimation(); @@ -187,5 +181,17 @@ namespace Tango.MachineStudio.Technician.Editors { } + + private void OnHomingBackwardStarted(object sender, RoutedEventArgs e) + { + AnimateLeft(); + MotorItem.RaiseAction(MotorActionType.HomingBackwardStarted); + } + + private void OnHomingForwardStarted(object sender, RoutedEventArgs e) + { + AnimateRight(); + MotorItem.RaiseAction(MotorActionType.HomingForwardStarted); + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorGroupElementEditor.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorGroupElementEditor.xaml.cs index 5d9954605..3ca4c19e0 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorGroupElementEditor.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorGroupElementEditor.xaml.cs @@ -146,7 +146,7 @@ namespace Tango.MachineStudio.Technician.Editors private void OnHomingStarted(object sender, RoutedEventArgs e) { - MotorGroupItem.RaiseAction(MotorActionType.HomingStarted); + MotorGroupItem.RaiseAction(MotorActionType.HomingForwardStarted); AnimateLeft(); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ThreadMotionElementEditor.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ThreadMotionElementEditor.xaml.cs index 6de37f3a2..76ff39d9c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ThreadMotionElementEditor.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ThreadMotionElementEditor.xaml.cs @@ -133,7 +133,7 @@ namespace Tango.MachineStudio.Technician.Editors private void OnHomingStarted(object sender, RoutedEventArgs e) { - ThreadMotionItem.RaiseAction(MotorActionType.HomingStarted); + ThreadMotionItem.RaiseAction(MotorActionType.HomingForwardStarted); AnimateLeft(); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorActionType.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorActionType.cs index 57dabbbb2..e42c87627 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorActionType.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorActionType.cs @@ -15,7 +15,8 @@ namespace Tango.MachineStudio.Technician.TechItems ForwardReleased, BackwardPressed, BackwardReleased, - HomingStarted, + HomingForwardStarted, + HomingBackwardStarted, HomingStopped, } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs index b0dac90f1..a02e09e9a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs @@ -1262,7 +1262,7 @@ namespace Tango.MachineStudio.Technician.ViewModels MotorType = (PMR.Hardware.HardwareMotorType)item.HardwareMotorType.Code, }); } - else if (action == MotorActionType.HomingStarted) + else if (action == MotorActionType.HomingForwardStarted || action == MotorActionType.HomingBackwardStarted) { item.HomingProgress = 0; item.IsHoming = true; @@ -1272,6 +1272,7 @@ namespace Tango.MachineStudio.Technician.ViewModels { MotorType = (PMR.Hardware.HardwareMotorType)item.HardwareMotorType.Code, Speed = item.Speed, + Direction = action == MotorActionType.HomingBackwardStarted ? MotorDirection.Backward : MotorDirection.Forward }) .Subscribe((response) => { @@ -1353,7 +1354,7 @@ namespace Tango.MachineStudio.Technician.ViewModels Index = item.TechDispenser.Code, }); } - else if (action == MotorActionType.HomingStarted) + else if (action == MotorActionType.HomingForwardStarted || action == MotorActionType.HomingBackwardStarted) { item.HomingProgress = 0; item.IsHoming = true; @@ -1363,6 +1364,7 @@ namespace Tango.MachineStudio.Technician.ViewModels { Index = item.TechDispenser.Code, Speed = item.Speed, + Direction = action == MotorActionType.HomingBackwardStarted ? MotorDirection.Backward : MotorDirection.Forward }) .Subscribe((response) => { -- cgit v1.3.1