Skip to content

Commit

Permalink
Merge pull request #29 from General-Fault/master
Browse files Browse the repository at this point in the history
Resend sync request with each retry.
  • Loading branch information
christophediericx committed Apr 5, 2018
2 parents a1e8b84 + 69a7653 commit 7781f94
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -15,12 +15,12 @@ internal Stk500V1BootloaderProgrammer(SerialPortConfig serialPortConfig, IMcu mc

public override void EstablishSync()
{
Send(new GetSyncRequest());

const int maxRetries = 256;
var retryCounter = 0;
while (retryCounter++ < maxRetries)
{
SerialPort.DiscardInBuffer();
Send(new GetSyncRequest());
var result = Receive<GetSyncResponse>();
if (result == null) continue;
if (result.IsInSync) break;
Expand Down

0 comments on commit 7781f94

Please sign in to comment.