aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2019-12-14 22:33:55 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2019-12-14 22:33:55 +0200
commit51151796efb23162ca0b3d6701d90dfb6d3baeb9 (patch)
tree4d159e48858f6e14fb7c689496e67feaa1a88fd5
parent76a028f95dc2bdb2aba4a58ca298268be32a5879 (diff)
downloadTango-51151796efb23162ca0b3d6701d90dfb6d3baeb9.tar.gz
Tango-51151796efb23162ca0b3d6701d90dfb6d3baeb9.zip
Enabled transparent color for catalogs.
Added machine last update check for quick db check PPC = >Service. Implemented AutoUpdateCheck vai PPC settings. Dropped use of AutoUpdateCheck from DB. Added skipping over TFP firmware upgrade upload if no other files other than mcu were found. Added more logs to firmware upgrade.
-rw-r--r--Software/DB/PPC/Tango.mdfbin75497472 -> 75497472 bytes
-rw-r--r--Software/DB/PPC/Tango_log.ldfbin53673984 -> 53673984 bytes
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml4
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs5
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml3
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs10
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml14
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/IMachineUpdateManager.cs2
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs19
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs6
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateRequest.cs1
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs2
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs2
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs60
-rw-r--r--Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs7
15 files changed, 116 insertions, 19 deletions
diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf
index a204a2664..a4ca7dd67 100644
--- a/Software/DB/PPC/Tango.mdf
+++ b/Software/DB/PPC/Tango.mdf
Binary files differ
diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf
index 38b8da37b..13145f312 100644
--- a/Software/DB/PPC/Tango_log.ldf
+++ b/Software/DB/PPC/Tango_log.ldf
Binary files differ
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml
index 0a0c1ecef..4631ac068 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineSettingsView.xaml
@@ -62,8 +62,8 @@
<TextBlock FontWeight="SemiBold">Auto Login</TextBlock>
<ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.AutoLogin}"></ToggleButton>
- <TextBlock FontWeight="SemiBold">Auto Check For Updates</TextBlock>
- <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.AutoCheckForUpdates}"></ToggleButton>
+ <!--<TextBlock FontWeight="SemiBold">Auto Check For Updates</TextBlock>
+ <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.AutoCheckForUpdates}"></ToggleButton>-->
<TextBlock FontWeight="SemiBold">Setup Activation</TextBlock>
<ToggleButton HorizontalAlignment="Left" IsChecked="{Binding ActiveMachine.SetupActivation}"></ToggleButton>
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs
index 798b333e7..785472d0d 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs
@@ -414,6 +414,11 @@ namespace Tango.PPC.Jobs.ViewModels
Settings.SupportedColorSpaces.Count > 0 ? Settings.SupportedColorSpaces : Enum.GetValues(typeof(ColorSpaces)).Cast<ColorSpaces>().Where(x => x.IsUserSpace() || (ApplicationManager.IsInTechnicianMode && x == ColorSpaces.Volume)).ToList()
);
+ if (_catalogs.Count == 0)
+ {
+ vm.SupportedColorSpaces.Remove(ColorSpaces.Catalog);
+ }
+
CatalogSelectionViewVM catalogVM = new CatalogSelectionViewVM(_catalogs.ToList(), _catalogs.ToList().SingleOrDefault(x => x.Guid == settings.LastSelectedCatalogGuid));
if (settings.LastJobType != null)
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml
index 9b28d7709..97756ffd5 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml
@@ -412,7 +412,6 @@
<Condition Binding="{Binding ElementName=toggleEdit,Path=IsChecked,IsAsync=True}" Value="False" />
<Condition Binding="{Binding ElementName=toggle_large_list,Path=IsChecked,IsAsync=True}" Value="True" />
<Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="False" />
- <Condition Binding="{Binding BrushStops[0].ColorSpace,Converter={StaticResource ColorSpaceToVisibilityConverter},IsAsync=True}" Value="Visible" />
</MultiDataTrigger.Conditions>
<Setter Property="Visibility" Value="Visible"></Setter>
</MultiDataTrigger>
@@ -422,7 +421,7 @@
<touch:TouchToggleIconButton Padding="15" Width="60" Height="60" CornerRadius="30" Icon="EyeOutline" CheckedIcon="EyeOffOutline" Foreground="{StaticResource TangoGrayBrush}" CheckedForeground="{StaticResource TangoWarningBrush}" IsChecked="{Binding BrushStops[0].IsTransparent,IsAsync=True}"></touch:TouchToggleIconButton>
- <touch:TouchImageButton Command="{Binding ElementName=view,Path=DataContext.ReplaceBrushStopCommand}" CommandParameter="{Binding BrushStops[0]}" Width="50" Height="50" Padding="10" Image="{StaticResource Image_Replace_Color}" CornerRadius="30"></touch:TouchImageButton>
+ <touch:TouchImageButton Visibility="{Binding BrushStops[0].ColorSpace,Converter={StaticResource ColorSpaceToVisibilityConverter},IsAsync=True}" Command="{Binding ElementName=view,Path=DataContext.ReplaceBrushStopCommand}" CommandParameter="{Binding BrushStops[0]}" Width="50" Height="50" Padding="10" Image="{StaticResource Image_Replace_Color}" CornerRadius="30"></touch:TouchImageButton>
</StackPanel>
<StackPanel Visibility="{Binding ElementName=toggleEdit,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter},IsAsync=True}" Orientation="Horizontal">
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs
index d12617264..5077fd884 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs
@@ -144,6 +144,13 @@ namespace Tango.PPC.MachineSettings.ViewModels
set { _synchronizeDiagnostics = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); }
}
+ private bool _autoCheckForUpdates;
+ public bool AutoCheckForUpdates
+ {
+ get { return _autoCheckForUpdates; }
+ set { _autoCheckForUpdates = value; RaisePropertyChangedAuto(); }
+ }
+
#endregion
#region Commands
@@ -196,6 +203,7 @@ namespace Tango.PPC.MachineSettings.ViewModels
Settings.DefaultSpoolTypeGuid = DefaultSpoolType?.Guid;
Settings.SynchronizeJobs = SynchronizeJobs;
Settings.SynchronizeDiagnostics = SynchronizeDiagnostics;
+ Settings.AutoCheckForUpdates = AutoCheckForUpdates;
MachineDataSynchronizer.IsEnabled = SynchronizeJobs || SynchronizeDiagnostics;
@@ -264,6 +272,8 @@ namespace Tango.PPC.MachineSettings.ViewModels
SynchronizeJobs = Settings.SynchronizeJobs;
SynchronizeDiagnostics = Settings.SynchronizeDiagnostics;
+
+ AutoCheckForUpdates = Settings.AutoCheckForUpdates;
}
private async void OnEnableRemoteAssistanceChanged()
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml
index 017649f8e..4a2f1e253 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml
@@ -199,8 +199,22 @@
<!--SYNCHRONIZATION-->
<touch:TouchExpander Margin="0 20 0 0" Header="Cloud Synchronization" IsExpanded="True" FontSize="{StaticResource TangoExpanderHeaderFontSize}">
<StackPanel Margin="10 30 10 10">
+
<DockPanel TextElement.FontSize="{StaticResource TangoDefaultFontSize}">
<StackPanel>
+ <TextBlock VerticalAlignment="Center">Auto Update Check</TextBlock>
+ <DockPanel Margin="0 5 0 0">
+ <touch:TouchIcon VerticalAlignment="Top" Icon="InformationOutline" Foreground="{StaticResource TangoGrayTextBrush}"></touch:TouchIcon>
+ <TextBlock Margin="10 0 0 0" VerticalAlignment="Top" TextWrapping="Wrap" FontSize="{StaticResource TangoSmallFontSize}" Foreground="{StaticResource TangoGrayTextBrush}">
+ Automatically check for software and database updates.
+ </TextBlock>
+ </DockPanel>
+ </StackPanel>
+ <touch:TouchToggleSlider Margin="0 0 100 0" DockPanel.Dock="Right" Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Width="90" IsChecked="{Binding AutoCheckForUpdates}"></touch:TouchToggleSlider>
+ </DockPanel>
+
+ <DockPanel Margin="0 40 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}">
+ <StackPanel>
<TextBlock VerticalAlignment="Center">Synchronize Jobs</TextBlock>
<DockPanel Margin="0 5 0 0">
<touch:TouchIcon VerticalAlignment="Top" Icon="InformationOutline" Foreground="{StaticResource TangoGrayTextBrush}"></touch:TouchIcon>
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/IMachineUpdateManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/IMachineUpdateManager.cs
index e11eab3a5..421b4ee54 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/IMachineUpdateManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/IMachineUpdateManager.cs
@@ -20,7 +20,7 @@ namespace Tango.PPC.Common.MachineUpdate
/// <summary>
/// Gets or sets a value indicating whether to automatically check for new application updates.
/// </summary>
- bool AutoCheckForUpdates { get; set; }
+ bool EnableAutoCheckForUpdates { get; set; }
/// <summary>
/// Gets the current machine update progress status.
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs
index 4c71c2a1a..088e80f61 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs
@@ -41,6 +41,7 @@ namespace Tango.PPC.Common.MachineUpdate
private List<LogItemBase> _logs;
private System.Timers.Timer _checkForUpdateTimer;
private bool _isUpdating;
+ private PPCSettings _settings;
#region Events
@@ -77,7 +78,7 @@ namespace Tango.PPC.Common.MachineUpdate
/// <summary>
/// Gets or sets a value indicating whether to automatically check for new application updates.
/// </summary>
- public bool AutoCheckForUpdates
+ public bool EnableAutoCheckForUpdates
{
get { return _autoCheckForUpdates; }
set { _autoCheckForUpdates = value; RaisePropertyChangedAuto(); }
@@ -105,6 +106,8 @@ namespace Tango.PPC.Common.MachineUpdate
_checkForUpdateTimer = new System.Timers.Timer(TimeSpan.FromMinutes(1).TotalMilliseconds);
_checkForUpdateTimer.Elapsed += _checkForUpdateTimer_Elapsed;
_checkForUpdateTimer.Start();
+
+ _settings = SettingsManager.Default.GetOrCreate<PPCSettings>();
}
#endregion
@@ -421,7 +424,7 @@ namespace Tango.PPC.Common.MachineUpdate
{
_isUpdating = true;
- var machineServiceAddress = SettingsManager.Default.GetOrCreate<PPCSettings>().GetMachineServiceAddress();
+ var machineServiceAddress = _settings.GetMachineServiceAddress();
LogManager.Log($"Starting machine update for serial number {serialNumber}...");
@@ -688,7 +691,7 @@ namespace Tango.PPC.Common.MachineUpdate
{
_isUpdating = true;
- var machineServiceAddress = SettingsManager.Default.GetOrCreate<PPCSettings>().GetMachineServiceAddress();
+ var machineServiceAddress = _settings.GetMachineServiceAddress();
LogManager.Log($"Connecting to machine service on {machineServiceAddress}...");
@@ -702,6 +705,8 @@ namespace Tango.PPC.Common.MachineUpdate
try
{
+ request.MachineLastUpdated = _machineProvider.Machine.LastUpdated;
+
using (ObservablesContext db = ObservablesContext.CreateDefault())
{
request.Rmls = db.Rmls.ToList().Select(x => new UpdatedEntity(x)).ToList();
@@ -861,7 +866,7 @@ namespace Tango.PPC.Common.MachineUpdate
{
return Task.Factory.StartNew<DbCompareResult>(() =>
{
- var machineServiceAddress = SettingsManager.Default.GetOrCreate<PPCSettings>().GetMachineServiceAddress();
+ var machineServiceAddress = _settings.GetMachineServiceAddress();
LogManager.Log($"Checking if database update is required for serial number {serialNumber}...");
@@ -1042,7 +1047,7 @@ namespace Tango.PPC.Common.MachineUpdate
throw new InvalidOperationException("The specified tup file is invalid. The package was generated for a different machine.");
}
- if (publishInfo.MachineDeploymentSlot != SettingsManager.Default.GetOrCreate<PPCSettings>().DeploymentSlot)
+ if (publishInfo.MachineDeploymentSlot != _settings.DeploymentSlot)
{
throw new InvalidOperationException("The specified tup file is invalid. The package was generated on a different environment.");
}
@@ -1292,7 +1297,7 @@ namespace Tango.PPC.Common.MachineUpdate
String packagesFolder = Path.Combine(AssemblyHelper.GetCurrentAssemblyFolder(), "packages");
Version previousVersion = null;
- String str = SettingsManager.Default.GetOrCreate<PPCSettings>().PreviousApplicationVersion;
+ String str = _settings.PreviousApplicationVersion;
if (Version.TryParse(str, out previousVersion))
{
@@ -1333,7 +1338,7 @@ namespace Tango.PPC.Common.MachineUpdate
private async void _checkForUpdateTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
- if (AutoCheckForUpdates && !_isUpdating)
+ if (EnableAutoCheckForUpdates && _settings.AutoCheckForUpdates && !_isUpdating)
{
_checkForUpdateTimer.Stop();
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs
index acdfb6a8a..cb17f5be3 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs
@@ -215,6 +215,11 @@ namespace Tango.PPC.Common
public TimeSpan PowerUpScreenTimeout { get; set; }
/// <summary>
+ /// Gets or sets a value indicating whether to automatically check for software and database (quick) updates.
+ /// </summary>
+ public bool AutoCheckForUpdates { get; set; }
+
+ /// <summary>
/// Gets the machine service address.
/// </summary>
/// <returns></returns>
@@ -255,6 +260,7 @@ namespace Tango.PPC.Common
FirmwareVersion = "1.0.0.0";
DisplayPowerUpScreen = true;
PowerUpScreenTimeout = TimeSpan.FromSeconds(20);
+ AutoCheckForUpdates = true;
}
}
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateRequest.cs
index 0feb32aaf..3d606b918 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateRequest.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/CheckForUpdateRequest.cs
@@ -15,6 +15,7 @@ namespace Tango.PPC.Common.Web
public List<UpdatedEntity> Rmls { get; set; }
public List<UpdatedEntity> HardwareVersions { get; set; }
public List<UpdatedEntity> Catalogs { get; set; }
+ public DateTime MachineLastUpdated { get; set; }
public CheckForUpdateRequest()
{
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs
index 56ec2fa7e..4c5a87ab4 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs
@@ -259,7 +259,7 @@ namespace Tango.PPC.UI.Printing
{
throw new InvalidOperationException("Error starting job. Color is out of range.");
}
- if (job.Segments.SelectMany(x => x.BrushStops).Any(x => x.BrushColorSpace == ColorSpaces.Catalog && x.ColorCatalogsItem == null))
+ if (job.Segments.SelectMany(x => x.BrushStops).Any(x => x.BrushColorSpace == ColorSpaces.Catalog && x.ColorCatalogsItem == null && !x.IsTransparent))
{
throw new InvalidOperationException("Error starting job. Please select a catalog color.");
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs
index c0654f643..49b2aef89 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs
@@ -297,7 +297,7 @@ namespace Tango.PPC.UI.ViewModels
}
else
{
- MachineUpdateManager.AutoCheckForUpdates = MachineProvider.Machine.AutoCheckForUpdates;
+ MachineUpdateManager.EnableAutoCheckForUpdates = true;
}
}
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
index a96693bdf..bae0ec55e 100644
--- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
+++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
@@ -1753,10 +1753,14 @@ namespace Tango.Integration.Operation
liquidVolume.Volume = stop.ColorCatalogsItem.Black;
}
}
- else
+ else if (!stop.IsTransparent)
{
throw new InvalidOperationException($"No catalog item specified for segment color.");
}
+ else
+ {
+ stop.SetLiquidVolumes(job.Machine.Configuration, job.Rml, processParameters);
+ }
}
else if (stop.BrushColorSpace == ColorSpaces.Volume)
{
@@ -2911,33 +2915,46 @@ namespace Tango.Integration.Operation
try
{
+ LogManager.Log("Starting firmware upgrade...");
+ LogManager.Log($"Firmware upgrade flags: {String.Join(", ", FirmwareUpgradeMode.GetFlags<FirmwareUpgradeModes>().Select(x => x.ToString()))}");
+
if (Status != MachineStatuses.ReadyToDye)
{
throw LogManager.Log(new InvalidOperationException($"Could not perform firmware upgrade while operator status is '{Status}'."));
}
+ LogManager.Log("Extracting tfp package...");
var package_info = await GetFirmwarePackageInfo(tfpStream);
tfpStream.Position = 0;
+ LogManager.Log("Reading zip stream...");
zip = ZipFile.Read(tfpStream);
+ LogManager.Log("Creating storage manager...");
var storage = CreateStorageManager();
+ LogManager.Log("Getting storage drive information...");
var drive = await storage.GetStorageDrive();
+ LogManager.Log($"Storage drive info:\n{drive.ToJsonString()}");
+ LogManager.Log("Getting root folder...");
var root = await storage.GetRootFolder();
+ LogManager.Log($"Root folder: '{root.Path}'");
var existing_folder = root.Items.SingleOrDefault(x => x.Name == FIRMWARE_UPGRADE_FOLDER_NAME);
if (existing_folder != null)
{
+ LogManager.Log("Root folder exists. Deleting...");
await storage.DeleteItem(existing_folder);
}
String package_folder = Path.Combine(drive.Root, FIRMWARE_UPGRADE_FOLDER_NAME);
+ LogManager.Log($"Creating new folder: '{package_folder}'.");
await storage.CreateFolder(package_folder);
List<StorageFileHandler> handlers = new List<StorageFileHandler>();
List<ZipEntry> entries = zip.Entries.ToList();
List<Stream> streams = new List<Stream>();
+ LogManager.Log("Disabling keep alive...");
var keepAlive = UseKeepAlive;
UseKeepAlive = false;
@@ -2960,7 +2977,19 @@ namespace Tango.Integration.Operation
{
if (FirmwareUpgradeMode.HasFlag(FirmwareUpgradeModes.DFU))
{
- var mcuEntry = zip.Entries.Single(x => x.FileName == package_info.FileDescriptors.Single(y => y.Destination == VersionFileDestination.Mcu).FileName);
+ LogManager.Log("DFU enabled. Starting upgrade via DFU...");
+ LogManager.Log("Extracting MCU file...");
+ ZipEntry mcuEntry = null;
+ try
+ {
+ mcuEntry = zip.Entries.Single(x => x.FileName == package_info.FileDescriptors.Single(y => y.Destination == VersionFileDestination.Mcu).FileName);
+ }
+ catch (Exception ex)
+ {
+ upgradeHandler.RaiseFailed(new IOException("Firmware upgrade via DFU is enabled but no MCU file was found in the package.", ex));
+ return;
+ }
+
MemoryStream ms = new MemoryStream();
mcuEntry.Extract(ms);
ms.Position = 0;
@@ -2974,35 +3003,52 @@ namespace Tango.Integration.Operation
upgradeHandler.RaiseProgress((long)e.Progress, FirmwareUpgradeStatus.Upgrading, e.State.ToDescription());
};
+ LogManager.Log("Disconnecting adapter...");
Adapter.Disconnect().Wait();
if (MachineEventsStateProvider != null)
{
+ LogManager.Log("Resetting active events...");
MachineEventsStateProvider.Reset();
}
+ LogManager.Log("Upgrading...");
upgradeManager.PerformUpgrade(data).Wait();
+ LogManager.Log("Waiting for the device...");
upgradeHandler.RaiseProgress(100, FirmwareUpgradeStatus.Upgrading, "Waiting for the device...");
Thread.Sleep(5000);
+ LogManager.Log("Reconnecting adapter...");
upgradeHandler.RaiseProgress(100, FirmwareUpgradeStatus.Upgrading, "Connecting...");
Adapter.Connect().Wait();
Connect().Wait();
+ LogManager.Log("Connected...");
upgradeHandler.RaiseProgress(100, FirmwareUpgradeStatus.Upgrading, "Connected.");
Thread.Sleep(2000);
+ LogManager.Log("Waiting...");
upgradeHandler.RaiseProgress(100, FirmwareUpgradeStatus.Upgrading, "Waiting...");
Thread.Sleep(2000);
Status = MachineStatuses.Upgrading;
}
+ //Upload tfp package only if specified in flag && package info contains more files other than the mcu bin file.
if (FirmwareUpgradeMode.HasFlag(FirmwareUpgradeModes.TFP_PACKAGE))
{
- upgradeHandler.Total = zip.Entries.Sum(x => x.UncompressedSize);
- uploadNext();
+ if (package_info.FileDescriptors.Where(x => x.Destination != VersionFileDestination.Mcu).Count() > 0)
+ {
+ LogManager.Log("TFP package is enabled. Starting upload...");
+ upgradeHandler.Total = zip.Entries.Sum(x => x.UncompressedSize);
+ uploadNext();
+ }
+ else
+ {
+ LogManager.Log("TFP package is enabled but no other files other than the MCU file were found on the package. Skipping...");
+ postActivation();
+ }
}
else
{
@@ -3026,6 +3072,8 @@ namespace Tango.Integration.Operation
var entry = entries.First();
entries.Remove(entry);
+ LogManager.Log($"Uploading file '{entry.FileName}'...");
+
var reader = entry.OpenReader();
streams.Add(reader);
@@ -3061,6 +3109,7 @@ namespace Tango.Integration.Operation
{
try
{
+ LogManager.Log("Validating version...");
streams.ForEach(x => x.Dispose());
upgradeHandler.RaiseProgress(upgradeHandler.Total, FirmwareUpgradeStatus.Validating, "Validating version...");
var validateRequest = new ValidateVersionRequest();
@@ -3078,6 +3127,7 @@ namespace Tango.Integration.Operation
{
try
{
+ LogManager.Log("Activating version...");
upgradeHandler.RaiseProgress(upgradeHandler.Total, FirmwareUpgradeStatus.Activating, "Activating version...");
var activateRequest = new ActivateVersionRequest();
activateRequest.Path = package_folder;
@@ -3092,8 +3142,10 @@ namespace Tango.Integration.Operation
postActivation = new Action(() =>
{
+ LogManager.Log("Firmware upgrade completed.");
upgradeHandler.RaiseCompleted();
Status = MachineStatuses.ReadyToDye;
+ LogManager.Log("Enabling keep alive...");
UseKeepAlive = keepAlive;
});
diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs
index b2a1da980..77b3a180f 100644
--- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs
+++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs
@@ -322,7 +322,12 @@ namespace Tango.MachineService.Controllers
bool hasDatabaseUpdates = false;
- hasDatabaseUpdates = rmls.Exists(x => request.Rmls.Exists(y => x.Guid == y.Guid && x.LastUpdated > y.LastUpdated) || !request.Rmls.Exists(y => x.Guid == y.Guid));
+ hasDatabaseUpdates = machine.LastUpdated > request.MachineLastUpdated;
+
+ if (!hasDatabaseUpdates)
+ {
+ hasDatabaseUpdates = rmls.Exists(x => request.Rmls.Exists(y => x.Guid == y.Guid && x.LastUpdated > y.LastUpdated) || !request.Rmls.Exists(y => x.Guid == y.Guid));
+ }
if (!hasDatabaseUpdates)
{