Skip to content

Commit

Permalink
Merge pull request #589 from WildernessLabs/aggressive_reconnect
Browse files Browse the repository at this point in the history
Aggressively poll for serial port connections when attaching
  • Loading branch information
ctacke authored Aug 8, 2024
2 parents 20cbb9c + d4a46b4 commit f743031
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
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.55.0</PackageVersion>
<PackageVersion>2.0.56.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.55.0";
public const string CLI_VERSION = "2.0.56.0";
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public partial class SerialConnection

public override async Task WaitForMeadowAttach(CancellationToken? cancellationToken)
{
var timeout = 20;
var timeout = 500;

while (timeout-- > 0)
{
Expand All @@ -26,7 +26,7 @@ public override async Task WaitForMeadowAttach(CancellationToken? cancellationTo
return;
}

await Task.Delay(500);
await Task.Delay(20);

if (!_port.IsOpen)
{
Expand Down
6 changes: 2 additions & 4 deletions Source/v2/Meadow.Hcom/Connections/SerialConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public override void Detach()
_port.DiscardInBuffer();

// wait for a response
var timeout = timeoutSeconds * 2;
var timeout = timeoutSeconds * 50;
var dataReceived = false;

// local function so we can unsubscribe
Expand All @@ -222,7 +222,7 @@ public override void Detach()
break;
}

await Task.Delay(500);
await Task.Delay(20);
}

// if HCOM fails, check for DFU/bootloader mode? only if we're doing an OS thing, so maybe no
Expand Down Expand Up @@ -1259,8 +1259,6 @@ public override async Task<DebuggingServer> StartDebuggingSession(int port, ILog
logger?.LogDebug($"Start Debugging on port: {port}");
await Device.StartDebugging(port, logger, cancellationToken);

await WaitForMeadowAttach(cancellationToken);

return debuggingServer;
}

Expand Down

0 comments on commit f743031

Please sign in to comment.