We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ff9f145 commit 9ea79f2Copy full SHA for 9ea79f2
src/gpdevboard/utils.cpp
@@ -82,13 +82,17 @@ hdevice OpenBoard(int nboard, bool test)
82
83
//Takes a while to switch and re-enumerate
84
switching = true;
85
- for(int i=0; i<10; i++)
86
- {
87
- usleep(1000 * 1000);
88
- hdev = OpenDevice(0x0f0f, 0x0006, nboard);
89
- if(hdev)
90
- break;
91
- }
+ }
+
+ //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);
92
+ if(hdev || !switching)
93
+ break;
94
95
+ usleep(1000 * 1000);
96
}
97
98
//By this point, it should be in "orange" mode
0 commit comments