Skip to content

Commit

Permalink
Fix set execution (#311)
Browse files Browse the repository at this point in the history
***NO_CI***
  • Loading branch information
josesimoes authored May 27, 2021
1 parent 09791df commit ec5b8ab
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ internal set

public bool IsIdle()
{
return (DateTime.UtcNow - _lastActivity).TotalMilliseconds > 100;
return (DateTime.UtcNow - _lastActivity).TotalMilliseconds > 50;
}

public bool Send(MessageRaw raw)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,10 +453,7 @@ public bool UpdateDebugFlags()
stateFlagsToSet |= Commands.DebuggingExecutionChangeConditions.State.DebuggerQuiet;
}

SetExecutionMode(stateFlagsToSet, 0);

// done here
return true;
return SetExecutionMode(stateFlagsToSet, 0);
}

// device isn't connected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,23 @@ public WireProtocolRequest(OutgoingMessage outgoingMessage, int millisecondsTime

internal bool PerformRequest(IController controller)
{
const int sleepTimeMs = 10;
int attemptsCount = 10000 / sleepTimeMs;

// wait for controller to be idle
while(!controller.IsIdle())
while (
!controller.IsIdle() &&
attemptsCount > 0)
{
Thread.Sleep(10);

attemptsCount--;
}

if(attemptsCount == 0)
{
// timeout waiting for idle controller
return false;
}

Debug.WriteLine($"Performing request");
Expand All @@ -67,6 +80,9 @@ internal bool PerformRequest(IController controller)
return true;
}

// store start time
RequestTimestamp = DateTime.Now;

return false;
}

Expand Down

0 comments on commit ec5b8ab

Please sign in to comment.