From 5eab4d6180e3daff467b476672d882cafc5e84c9 Mon Sep 17 00:00:00 2001 From: Adrian Stevens Date: Wed, 7 Aug 2024 21:09:59 -0700 Subject: [PATCH 1/5] Aggressively poll for serial port connections when attaching --- .../Meadow.Hcom/Connections/SerialConnection.ListenerProc.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/v2/Meadow.Hcom/Connections/SerialConnection.ListenerProc.cs b/Source/v2/Meadow.Hcom/Connections/SerialConnection.ListenerProc.cs index 128bfddd..1b449d9c 100644 --- a/Source/v2/Meadow.Hcom/Connections/SerialConnection.ListenerProc.cs +++ b/Source/v2/Meadow.Hcom/Connections/SerialConnection.ListenerProc.cs @@ -8,7 +8,7 @@ public partial class SerialConnection public override async Task WaitForMeadowAttach(CancellationToken? cancellationToken) { - var timeout = 20; + var timeout = 500; while (timeout-- > 0) { @@ -26,7 +26,7 @@ public override async Task WaitForMeadowAttach(CancellationToken? cancellationTo return; } - await Task.Delay(500); + await Task.Delay(20); if (!_port.IsOpen) { From da2cfe0e037d3ef182b8a0ff1862c8c665384a6b Mon Sep 17 00:00:00 2001 From: Adrian Stevens Date: Wed, 7 Aug 2024 21:15:16 -0700 Subject: [PATCH 2/5] Aggressive Attach --- Source/v2/Meadow.Hcom/Connections/SerialConnection.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/v2/Meadow.Hcom/Connections/SerialConnection.cs b/Source/v2/Meadow.Hcom/Connections/SerialConnection.cs index 1d175e75..4c81737c 100755 --- a/Source/v2/Meadow.Hcom/Connections/SerialConnection.cs +++ b/Source/v2/Meadow.Hcom/Connections/SerialConnection.cs @@ -202,7 +202,7 @@ public override void Detach() _port.DiscardInBuffer(); // wait for a response - var timeout = timeoutSeconds * 2; + var timeout = timeoutSeconds * 20; var dataReceived = false; // local function so we can unsubscribe @@ -222,7 +222,7 @@ public override void Detach() break; } - await Task.Delay(500); + await Task.Delay(50); } // if HCOM fails, check for DFU/bootloader mode? only if we're doing an OS thing, so maybe no From 032931178b60b865a973a91d0d4ba9ed80c40325 Mon Sep 17 00:00:00 2001 From: Adrian Stevens Date: Wed, 7 Aug 2024 21:19:10 -0700 Subject: [PATCH 3/5] More aggressive serial port attach --- Source/v2/Meadow.Hcom/Connections/SerialConnection.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/v2/Meadow.Hcom/Connections/SerialConnection.cs b/Source/v2/Meadow.Hcom/Connections/SerialConnection.cs index 4c81737c..67a71286 100755 --- a/Source/v2/Meadow.Hcom/Connections/SerialConnection.cs +++ b/Source/v2/Meadow.Hcom/Connections/SerialConnection.cs @@ -202,7 +202,7 @@ public override void Detach() _port.DiscardInBuffer(); // wait for a response - var timeout = timeoutSeconds * 20; + var timeout = timeoutSeconds * 50; var dataReceived = false; // local function so we can unsubscribe @@ -222,7 +222,7 @@ public override void Detach() break; } - await Task.Delay(50); + await Task.Delay(20); } // if HCOM fails, check for DFU/bootloader mode? only if we're doing an OS thing, so maybe no From dece7dc4db526994212024296e09d3fee5a4fae0 Mon Sep 17 00:00:00 2001 From: Adrian Stevens Date: Wed, 7 Aug 2024 21:39:24 -0700 Subject: [PATCH 4/5] Remove unneeded WaitForAttach --- Source/v2/Meadow.Hcom/Connections/SerialConnection.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/Source/v2/Meadow.Hcom/Connections/SerialConnection.cs b/Source/v2/Meadow.Hcom/Connections/SerialConnection.cs index 67a71286..452d93eb 100755 --- a/Source/v2/Meadow.Hcom/Connections/SerialConnection.cs +++ b/Source/v2/Meadow.Hcom/Connections/SerialConnection.cs @@ -1259,8 +1259,6 @@ public override async Task StartDebuggingSession(int port, ILog logger?.LogDebug($"Start Debugging on port: {port}"); await Device.StartDebugging(port, logger, cancellationToken); - await WaitForMeadowAttach(cancellationToken); - return debuggingServer; } From d4a46b4901b4a6c834bde71472e13436a9ffa082 Mon Sep 17 00:00:00 2001 From: Adrian Stevens Date: Wed, 7 Aug 2024 23:27:05 -0700 Subject: [PATCH 5/5] Version bump --- Source/v2/Meadow.Cli/Meadow.CLI.csproj | 2 +- Source/v2/Meadow.Cli/Properties/AssemblyInfo.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/v2/Meadow.Cli/Meadow.CLI.csproj b/Source/v2/Meadow.Cli/Meadow.CLI.csproj index ce3c5ca7..47f3eeea 100644 --- a/Source/v2/Meadow.Cli/Meadow.CLI.csproj +++ b/Source/v2/Meadow.Cli/Meadow.CLI.csproj @@ -10,7 +10,7 @@ Wilderness Labs, Inc Wilderness Labs, Inc true - 2.0.55.0 + 2.0.56.0 AnyCPU http://developer.wildernesslabs.co/Meadow/Meadow.CLI/ https://github.com/WildernessLabs/Meadow.CLI diff --git a/Source/v2/Meadow.Cli/Properties/AssemblyInfo.cs b/Source/v2/Meadow.Cli/Properties/AssemblyInfo.cs index be708e11..99e2d9e7 100644 --- a/Source/v2/Meadow.Cli/Properties/AssemblyInfo.cs +++ b/Source/v2/Meadow.Cli/Properties/AssemblyInfo.cs @@ -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"; } \ No newline at end of file