Skip to content

Commit

Permalink
fix: solves a connection issue where writing a PING to the serial por…
Browse files Browse the repository at this point in the history
…t on a non-standard Bluetooth COM port causes operation and UI to hang indefinitely.
  • Loading branch information
MetalHexx committed Aug 31, 2024
1 parent 5267a2c commit 80f841d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,21 @@ public void EnsureConnection()
_log.InternalSuccess($"ObservableSerialPort.EnsureConnection: Successfully connected to {_serialPort.PortName}");

_log.Internal($"ObservableSerialPort.EnsureConnection: Pinging {_serialPort.PortName} to verify connection to TeensyROM");
Write(TeensyByteToken.Ping_Bytes.ToArray(), 0, 2);

try
{
_serialPort.WriteTimeout = 2000;
Write(TeensyByteToken.Ping_Bytes.ToArray(), 0, 2);
}
catch (Exception)
{
_log.InternalError($"ObservableSerialPort.EnsureConnection: Timed out connecting to {_serialPort.PortName}");
continue;
}
finally
{
_serialPort.WriteTimeout = SerialPort.InfiniteTimeout;
}

var ms = 4000;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<UseWPF>true</UseWPF>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
<Version>1.0.0-alpha.58</Version>
<Version>1.0.0-alpha.59</Version>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 80f841d

Please sign in to comment.