Skip to content

Commit

Permalink
Merge pull request #477 from WildernessLabs/marks_build
Browse files Browse the repository at this point in the history
Marks build
  • Loading branch information
ctacke committed Feb 15, 2024
2 parents d1c2d14 + e7fcbee commit 11fbe4e
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ protected override async ValueTask ExecuteCommand()
{
await FileManager.Refresh();

//show the firmware path
Logger?.LogInformation($"Firmware location: {F7FirmwarePackageCollection.DefaultF7FirmwareStoreRoot}");

if (Verbose)
{
await DisplayVerboseResults(FileManager);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,14 @@ protected override async ValueTask ExecuteCommand()

if (FirmwareFileTypes.Contains(FirmwareType.Runtime) || Path.GetFileName(IndividualFile) == F7FirmwarePackageCollection.F7FirmwareFiles.RuntimeFile)
{
connection = await WriteFirmware(connection, deviceInfo, package);
if (string.IsNullOrEmpty(IndividualFile))
{
connection = await WriteRuntime(connection, deviceInfo, package);
}
else
{
connection = await WriteRuntime(connection, deviceInfo, IndividualFile, Path.GetFileName(IndividualFile));
}

if (connection == null)
{
Expand Down Expand Up @@ -252,7 +259,17 @@ protected override async ValueTask ExecuteCommand()
}
}

private async Task<IMeadowConnection?> WriteFirmware(IMeadowConnection? connection, DeviceInfo? deviceInfo, FirmwarePackage package)
private async Task<IMeadowConnection?> WriteRuntime(IMeadowConnection? connection, DeviceInfo? deviceInfo, FirmwarePackage package)
{
Logger?.LogInformation($"{Environment.NewLine}Getting runtime for {package.Version}...");

// get the path to the runtime file
var rtpath = package.GetFullyQualifiedPath(package.Runtime);

return await WriteRuntime(connection, deviceInfo, rtpath, package.Runtime);
}

private async Task<IMeadowConnection?> WriteRuntime(IMeadowConnection? connection, DeviceInfo? deviceInfo, string runtimePath, string destinationFilename)
{
if (connection == null)
{
Expand All @@ -261,21 +278,15 @@ protected override async ValueTask ExecuteCommand()
if (connection == null) { return null; } // couldn't find a connected device
}

Logger?.LogInformation($"{Environment.NewLine}Writing Runtime {package.Version}...");

// get the path to the runtime file
var rtpath = package.GetFullyQualifiedPath(package.Runtime);
Logger?.LogInformation($"{Environment.NewLine}Writing Runtime ...");

if (deviceInfo == null)
{
deviceInfo = await connection.GetDeviceInfo(CancellationToken);
}
deviceInfo ??= await connection.GetDeviceInfo(CancellationToken);

if (UseDfu || RequiresDfuForRuntimeUpdates(deviceInfo))
{

write_runtime:
if (!await connection.Device!.WriteRuntime(rtpath, CancellationToken))
if (!await connection.Device!.WriteRuntime(runtimePath, CancellationToken))
{
// TODO: implement a retry timeout
Logger?.LogInformation($"Error writing runtime - retrying");
Expand All @@ -284,7 +295,7 @@ protected override async ValueTask ExecuteCommand()
}
else
{
await connection.Device!.WriteFile(rtpath, $"/meadow0/update/os/{package.Runtime}");
await connection.Device!.WriteFile(runtimePath, $"/meadow0/update/os/{destinationFilename}");
}

return connection;
Expand Down
2 changes: 1 addition & 1 deletion Source/v2/Meadow.Cli/Meadow.CLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Authors>Wilderness Labs, Inc</Authors>
<Company>Wilderness Labs, Inc</Company>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageVersion>2.0.5</PackageVersion>
<PackageVersion>2.0.6</PackageVersion>
<Platforms>AnyCPU</Platforms>
<PackageProjectUrl>http://developer.wildernesslabs.co/Meadow/Meadow.CLI/</PackageProjectUrl>
<RepositoryUrl>https://github.com/WildernessLabs/Meadow.CLI</RepositoryUrl>
Expand Down
2 changes: 1 addition & 1 deletion Source/v2/Meadow.Cli/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ namespace Meadow.CLI
{
public static class Constants
{
public const string CLI_VERSION = "2.0.5.0";
public const string CLI_VERSION = "2.0.6.0";
}
}
2 changes: 2 additions & 0 deletions Source/v2/Meadow.SoftwareManager/F7FirmwareDownloadManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public async Task<bool> DownloadRelease(string destinationRoot, string version,
}
catch
{
Directory.Delete(local_path, true);
throw new Exception($"Unable to download OS files for {version}");
}

Expand All @@ -81,6 +82,7 @@ public async Task<bool> DownloadRelease(string destinationRoot, string version,
}
catch
{
Directory.Delete(local_path, true);
throw new Exception($"Unable to download Coprocessor files for {version}");
}

Expand Down

0 comments on commit 11fbe4e

Please sign in to comment.