Support new firmware and fix possible freeze. (#2261)

This commit is contained in:
Blacktempel
2026-03-09 12:52:11 +01:00
committed by GitHub
parent 273b47b462
commit 44d3263b27
7 changed files with 327 additions and 88 deletions
@@ -31,7 +31,7 @@ internal sealed class SharedSerialPort : SerialPort
public new void Open()
{
_hasMutex = Mutexes.WaitUsbSensors(MutexTimeout);
if (_hasMutex)
if (_hasMutex && !IsOpen)
{
base.Open();
}
@@ -39,14 +39,20 @@ internal sealed class SharedSerialPort : SerialPort
public new void Close()
{
if (_hasMutex)
if (!_hasMutex)
{
return;
}
try
{
if (IsOpen)
{
BaseStream.Flush();
BaseStream.Close();
base.Close();
}
}
finally
{
_hasMutex = false;
Mutexes.ReleaseUsbSensors();
}