File tree Expand file tree Collapse file tree 2 files changed +5
-7
lines changed
Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -122,22 +122,22 @@ export class DAPWrapper {
122122 // We wait on errors as immediately after flash the micro:bit won't be ready to respond
123123 this . _deviceId = await this . readMem32WaitOnError ( FICR . DEVICE_ID_1 ) ;
124124
125- this . _pageSize = await this . cortexM . readMem32 ( FICR . CODEPAGESIZE ) ;
126- this . _numPages = await this . cortexM . readMem32 ( FICR . CODESIZE ) ;
125+ this . _pageSize = await this . readMem32WaitOnError ( FICR . CODEPAGESIZE ) ;
126+ this . _numPages = await this . readMem32WaitOnError ( FICR . CODESIZE ) ;
127127 }
128128
129129 async readMem32WaitOnError ( register : number ) : Promise < number > {
130130 let retries = 0 ;
131131 let lastError : Error | undefined ;
132- while ( retries < 10 ) {
132+ while ( retries < 20 ) {
133133 try {
134134 return await this . cortexM . readMem32 ( register ) ;
135135 } catch ( e ) {
136136 if ( e instanceof Error ) {
137137 lastError = e ;
138138 if ( / ^ T r a n s f e r / . test ( e . message ) ) {
139139 retries ++ ;
140- await new Promise ( ( resolve ) => setTimeout ( resolve , 10 ) ) ;
140+ await new Promise ( ( resolve ) => setTimeout ( resolve , 20 ) ) ;
141141 } else {
142142 throw e ;
143143 }
Original file line number Diff line number Diff line change @@ -116,9 +116,7 @@ export class MicrobitRadioBridgeConnection
116116 message : "Serial connect start" ,
117117 } ) ;
118118
119- if ( this . delegate . status !== ConnectionStatus . CONNECTED ) {
120- await this . delegate . connect ( ) ;
121- }
119+ await this . delegate . connect ( ) ;
122120
123121 try {
124122 this . serialSession = new RadioBridgeSerialSession (
You can’t perform that action at this time.
0 commit comments