File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,10 @@ export class Board {
8282 * Defined during start().
8383 */
8484 private modulePromise : Promise < ModuleWrapper > | undefined ;
85+ /**
86+ * Flag to trigger a reset after start finishes.
87+ */
88+ private resetWhenDone : boolean = false ;
8589
8690 constructor (
8791 private notifications : Notifications ,
@@ -349,11 +353,17 @@ export class Board {
349353 if ( panicCode !== undefined ) {
350354 this . displayPanic ( panicCode ) ;
351355 } else {
352- this . displayStoppedState ( ) ;
356+ if ( this . resetWhenDone ) {
357+ this . resetWhenDone = false ;
358+ setTimeout ( ( ) => this . start ( ) , 0 ) ;
359+ } else {
360+ this . displayStoppedState ( ) ;
361+ }
353362 }
354363 }
355364
356- async stop ( ) : Promise < void > {
365+ async stop ( reset : boolean = false ) : Promise < void > {
366+ this . resetWhenDone = reset ;
357367 if ( this . panicTimeout ) {
358368 clearTimeout ( this . panicTimeout ) ;
359369 this . panicTimeout = null ;
@@ -370,8 +380,7 @@ export class Board {
370380 }
371381
372382 async reset ( ) : Promise < void > {
373- await this . stop ( ) ;
374- this . start ( ) ;
383+ this . stop ( true ) ;
375384 }
376385
377386 async flash ( filesystem : Record < string , Uint8Array > ) : Promise < void > {
You can’t perform that action at this time.
0 commit comments