Skip to content

Commit

Permalink
gpdevboard: Fixed bug in last commit causing board to not initialize …
Browse files Browse the repository at this point in the history
…correctly unless it's in bootloader mode
azonenberg committed Feb 26, 2017
1 parent ff9f145 commit 9ea79f2
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/gpdevboard/utils.cpp
Original file line number Diff line number Diff line change
@@ -82,13 +82,17 @@ hdevice OpenBoard(int nboard, bool test)

//Takes a while to switch and re-enumerate
switching = true;
for(int i=0; i<10; i++)
{
usleep(1000 * 1000);
hdev = OpenDevice(0x0f0f, 0x0006, nboard);
if(hdev)
break;
}
}

//Try up to ten times to open the board if we're switching mode.
//Stop after the first failure if we're not switching b/c there's no point.
for(int i=0; i<10; i++)
{
hdev = OpenDevice(0x0f0f, 0x0006, nboard);
if(hdev || !switching)
break;

usleep(1000 * 1000);
}

//By this point, it should be in "orange" mode

0 comments on commit 9ea79f2

Please sign in to comment.