diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-05-13 14:24:00 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-05-13 14:24:00 +0300 |
| commit | 9aca4b69b22a08d01b12e358eb198f3fbe92ff2a (patch) | |
| tree | 1d02a8bbcf091f3e6514feb223e34a84983b4107 /Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs | |
| parent | 4cc4089f36b0a9b9d754e33acb49da930f846699 (diff) | |
| download | Tango-9aca4b69b22a08d01b12e358eb198f3fbe92ff2a.tar.gz Tango-9aca4b69b22a08d01b12e358eb198f3fbe92ff2a.zip | |
Added DFU reset to PPC.
Diffstat (limited to 'Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs')
| -rw-r--r-- | Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs | 25 |
1 files changed, 20 insertions, 5 deletions
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 { |
