Skip to content

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianstevens committed Mar 6, 2024
1 parent e2833ac commit ea406a8
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,7 @@ protected override async ValueTask ExecuteCommand()

private async Task<IMeadowConnection?> WriteRuntime(IMeadowConnection? connection, DeviceInfo? deviceInfo, string runtimePath, string destinationFilename)
{
if (connection == null)
{
connection = await GetConnectionAndDisableRuntime();
}
connection ??= await GetConnectionAndDisableRuntime();

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

Expand Down Expand Up @@ -280,6 +277,8 @@ protected override async ValueTask ExecuteCommand()
throw CommandException.MeadowDeviceNotFound;
}

connection = await GetCurrentConnection(true);

Logger?.LogInformation($"Meadow found at {newPort}");

// configure the route to that port for the user
Expand Down Expand Up @@ -318,10 +317,7 @@ private async Task WriteEspFiles(IMeadowConnection? connection, DeviceInfo? devi
};
}

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

if (UseDfu || RequiresDfuForEspUpdates(deviceInfo))
{
Expand Down

0 comments on commit ea406a8

Please sign in to comment.