Skip to content

Commit

Permalink
Improvements related with connection (#314)
Browse files Browse the repository at this point in the history
  • Loading branch information
josesimoes authored Jul 1, 2021
1 parent 33dd559 commit b1e6271
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions nanoFramework.Tools.DebugLibrary.Shared/WireProtocol/Engine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ public BinaryFormatter CreateBinaryFormatter()
public ConnectionSource ConnectionSource { get => _connectionSource; set => _connectionSource = value; }
#pragma warning restore S2292 // Trivial properties should be auto-implemented

public bool IsConnectedTonanoCLR => _connectionSource == ConnectionSource.nanoCLR;
public bool IsConnectedTonanoCLR => IsConnected && _connectionSource == ConnectionSource.nanoCLR;

public bool IsConnectedTonanoBooter => _connectionSource == ConnectionSource.nanoBooter;
public bool IsConnectedTonanoBooter => IsConnected && _connectionSource == ConnectionSource.nanoBooter;

public bool IsTargetBigEndian { get; internal set; }

Expand Down Expand Up @@ -445,6 +445,8 @@ public bool UpdateDebugFlags()
return false;
}

Thread.Sleep(10);

// get state flags to set
Commands.DebuggingExecutionChangeConditions.State stateFlagsToSet = Commands.DebuggingExecutionChangeConditions.State.SourceLevelDebugging;

Expand Down Expand Up @@ -960,6 +962,9 @@ public void Stop(bool force = false)
{
StopProcessing();

// need to reset flag
_connectionSource = ConnectionSource.Unknown;

IsConnected = false;

Device.Disconnect(force);
Expand Down Expand Up @@ -1804,6 +1809,8 @@ public bool RebootDevice(
log?.Report($"ERROR: No activity detected from device after reboot...");

rebootSuccessful = false;

ConnectionSource = ConnectionSource.Unknown;
}
}
#if DEBUG
Expand Down

0 comments on commit b1e6271

Please sign in to comment.