aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-08-27 00:39:49 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-08-27 00:39:49 +0300
commitddce0f3215746d6884acb94f3cedc613008aed5c (patch)
treef9338c5358064cad26c0c2cecb80647e3a4eac85 /Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
parent415e7387f7daef038430016b41d16bc5b8cfa0d8 (diff)
downloadTango-ddce0f3215746d6884acb94f3cedc613008aed5c.tar.gz
Tango-ddce0f3215746d6884acb94f3cedc613008aed5c.zip
Improved machine operator firmware upgrade on emulated devices.
added isEmulated flag. Dropped the need to modify the FirmwareUpgrade mode when emulated due to this new flag.
Diffstat (limited to 'Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs')
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs17
1 files changed, 14 insertions, 3 deletions
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
index de8e118e9..57ba6e727 100644
--- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
+++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
@@ -3371,8 +3371,10 @@ namespace Tango.Integration.Operation
/// Upgrades the firmware.
/// </summary>
/// <param name="tfpStream">The TFP stream (Tango Firmware Package File).</param>
+ /// <param name="isEmulated">Specify whether the connected machine is emulated and to skip the actual DFU interface.</param>
/// <returns></returns>
- public virtual async Task<FirmwareUpgradeHandler> UpgradeFirmware(Stream tfpStream)
+ /// <exception cref="InvalidOperationException"></exception>
+ public virtual async Task<FirmwareUpgradeHandler> UpgradeFirmware(Stream tfpStream, bool isEmulated = false)
{
bool cancel = false;
ZipFile zip = null;
@@ -3493,8 +3495,16 @@ namespace Tango.Integration.Operation
try
{
- LogManager.Log("Upgrading...");
- upgradeManager.PerformUpgrade(data).Wait();
+ if (!isEmulated)
+ {
+ LogManager.Log("Upgrading...");
+ upgradeManager.PerformUpgrade(data).Wait();
+ }
+ else
+ {
+ LogManager.Log("Upgrading (emulated)...");
+ Thread.Sleep(3000);
+ }
}
catch (Exception ex)
{
@@ -3512,6 +3522,7 @@ namespace Tango.Integration.Operation
LogManager.Log("Reconnecting adapter...");
upgradeHandler.RaiseProgress(100, FirmwareUpgradeStatus.Upgrading, "Connecting...");
Adapter.Connect().Wait();
+
Connect().Wait();
LogManager.Log("Connected...");