Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix set execution #311

Merged
merged 2 commits into from
May 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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