From 9aca4b69b22a08d01b12e358eb198f3fbe92ff2a Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 13 May 2019 14:24:00 +0300 Subject: Added DFU reset to PPC. --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 53673984 -> 53673984 bytes .../ViewModels/SystemViewVM.cs | 2 +- .../Tango.PPC.Technician/Views/SystemView.xaml | 8 ++++++- .../Tango.Integration/Operation/MachineOperator.cs | 25 ++++++++++++++++----- 5 files changed, 28 insertions(+), 7 deletions(-) diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index 6751ca940..53b2eff86 100644 Binary files a/Software/DB/PPC/Tango.mdf and b/Software/DB/PPC/Tango.mdf differ diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf index 0f6384349..c3aa83372 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs index b2f93c29d..c368e77e2 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs @@ -138,7 +138,7 @@ namespace Tango.PPC.Technician.ViewModels { CPU = GetAppCPU(); RAM = GetAppRam(); - Temperature = GetTemperature(); + //Temperature = GetTemperature(); } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml index d96da4f93..f6e6370c1 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml @@ -50,7 +50,13 @@ - Reset Machine + + + + + Restart Device Shutdown Device Factory Reset diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index 1f01c8873..f8e632fa5 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -2277,6 +2277,10 @@ namespace Tango.Integration.Operation { LogManager.Log("Performing device reset through DFU..."); + //LogManager.Log("Disconnecting Operator..."); + //Disconnect().Wait(); + //LogManager.Log("Operator disconnected."); + FirmwareUpdateManager updateManager = new FirmwareUpdateManager(); LogManager.Log("Initializing DFU API..."); @@ -2289,11 +2293,22 @@ namespace Tango.Integration.Operation LogManager.Log($"DFU device found: '{device.DeviceName}'."); LogManager.Log("Switching to DFU mode..."); device.SwitchToDFUMode(); - Thread.Sleep(3000); - LogManager.Log("Resetting device..."); - device.Reset(); - Thread.Sleep(1000); - LogManager.Log("Reset completed."); + Thread.Sleep(6000); + + LogManager.Log("Reattaching to DFU device..."); + device = updateManager.GetAvailableDevices(false).Where(x => !x.DeviceName.Contains("In-Circuit Debug Interface")).FirstOrDefault(); + + if (device != null) + { + LogManager.Log("Resetting device..."); + device.Reset(); + Thread.Sleep(1000); + LogManager.Log("Reset completed."); + } + else + { + throw LogManager.Log(new Exception("DFU device not found.")); + } } else { -- cgit v1.3.1