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 {
122
122
// We wait on errors as immediately after flash the micro:bit won't be ready to respond
123
123
this . _deviceId = await this . readMem32WaitOnError ( FICR . DEVICE_ID_1 ) ;
124
124
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 ) ;
127
127
}
128
128
129
129
async readMem32WaitOnError ( register : number ) : Promise < number > {
130
130
let retries = 0 ;
131
131
let lastError : Error | undefined ;
132
- while ( retries < 10 ) {
132
+ while ( retries < 20 ) {
133
133
try {
134
134
return await this . cortexM . readMem32 ( register ) ;
135
135
} catch ( e ) {
136
136
if ( e instanceof Error ) {
137
137
lastError = e ;
138
138
if ( / ^ T r a n s f e r / . test ( e . message ) ) {
139
139
retries ++ ;
140
- await new Promise ( ( resolve ) => setTimeout ( resolve , 10 ) ) ;
140
+ await new Promise ( ( resolve ) => setTimeout ( resolve , 20 ) ) ;
141
141
} else {
142
142
throw e ;
143
143
}
Original file line number Diff line number Diff line change @@ -116,9 +116,7 @@ export class MicrobitRadioBridgeConnection
116
116
message : "Serial connect start" ,
117
117
} ) ;
118
118
119
- if ( this . delegate . status !== ConnectionStatus . CONNECTED ) {
120
- await this . delegate . connect ( ) ;
121
- }
119
+ await this . delegate . connect ( ) ;
122
120
123
121
try {
124
122
this . serialSession = new RadioBridgeSerialSession (
You can’t perform that action at this time.
0 commit comments