Skip to content

Commit

Permalink
Merge pull request #577 from WildernessLabs/local_OS_bin
Browse files Browse the repository at this point in the history
Add ability to specify path to OS binary when flashing + version bump…
  • Loading branch information
adrianstevens authored Jun 11, 2024
2 parents ecb899c + 32cfbba commit aaac4f6
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,22 @@ protected override async ValueTask ExecuteCommand()

if (FirmwareFileTypes.Contains(FirmwareType.OS))
{
var osFileWithBootloader = package.GetFullyQualifiedPath(package.OSWithBootloader);
var osFileWithoutBootloader = package.GetFullyQualifiedPath(package.OsWithoutBootloader);
string? osFileWithBootloader = null;
string? osFileWithoutBootloader = null;

if (osFileWithBootloader == null && osFileWithoutBootloader == null)
if (string.IsNullOrWhiteSpace(IndividualFile))
{
throw new CommandException(string.Format(Strings.OsFileNotFoundForSpecifiedVersion, package.Version));
osFileWithBootloader = package.GetFullyQualifiedPath(package.OSWithBootloader);
osFileWithoutBootloader = package.GetFullyQualifiedPath(package.OsWithoutBootloader);

if (osFileWithBootloader == null && osFileWithoutBootloader == null)
{
throw new CommandException(string.Format(Strings.OsFileNotFoundForSpecifiedVersion, package.Version));
}
}
else
{
osFileWithBootloader = IndividualFile;
}

// do we have a dfu device attached, or is DFU specified?
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.47.0</PackageVersion>
<PackageVersion>2.0.48.0</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,5 +6,5 @@ namespace Meadow.CLI;

public static class Constants
{
public const string CLI_VERSION = "2.0.47.0";
public const string CLI_VERSION = "2.0.48.0";
}
8 changes: 8 additions & 0 deletions Source/v2/Meadow.Cli/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@
"commandName": "Project",
"commandLineArgs": "firmware write runtime"
},
"Firmware Write runtime local file": {
"commandName": "Project",
"commandLineArgs": "firmware write runtime -f g:\\Meadow.OS.Runtime.bin"
},
"Firmware Write esp": {
"commandName": "Project",
"commandLineArgs": "firmware write esp"
Expand All @@ -171,6 +175,10 @@
"commandName": "Project",
"commandLineArgs": "firmware write os -v 1.2.0.1"
},
"Firmware Write OS local file": {
"commandName": "Project",
"commandLineArgs": "firmware write OS -f g:\\Meadow.OS.bin"
},
"Flash erase": {
"commandName": "Project",
"commandLineArgs": "flash erase"
Expand Down
6 changes: 3 additions & 3 deletions Source/v2/Meadow.Tooling.Core/App/AppManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public static async Task DeployApplication(
// delete those files
foreach (var file in removeFiles)
{
logger?.LogInformation($"Deleting file '{file}'...");
logger?.LogInformation($"Deleting '{file}'");
var folder = string.IsNullOrEmpty(file.Path) ? $"/{MeadowRootFolder}/" : $"{file.Path}";

await connection.DeleteFile($"{folder}{file.Name}", cancellationToken);
Expand Down Expand Up @@ -163,12 +163,12 @@ public static async Task DeployApplication(

if (crc == localFile.Value)
{ // exists and has a matching CRC, skip it
logger?.LogInformation($"Skipping '{localFile.Key}'");
logger?.LogInformation($"Skipping '{Path.GetFileName(localFile.Key)}'");
continue;
}
}

logger?.LogInformation($"Sending '{localFile.Key}'");
logger?.LogInformation($"Sending '{Path.GetFileName(localFile.Key)}'");
send_file:

if (!await connection.WriteFile(localFile.Key, meadowFilename, cancellationToken))
Expand Down

0 comments on commit aaac4f6

Please sign in to comment.