@@ -476,43 +476,42 @@ function checkReportProblem(problemName, problems) {
476476 return false ;
477477}
478478
479- function checkReportProblems ( ) {
480- const problemItemTemplate = $ ( "#dialogReportProblems-listItemTemplate" ) ;
479+ async function checkReportProblems ( ) {
480+ await MSP . promise ( MSPCodes . MSP_STATUS ) ;
481481
482- MSP . send_message ( MSPCodes . MSP_STATUS , false , false , function ( ) {
483- let needsProblemReportingDialog = false ;
484- const problemDialogList = $ ( "#dialogReportProblems-list" ) ;
485- problemDialogList . empty ( ) ;
482+ let needsProblemReportingDialog = false ;
483+ let problems = [ ] ;
486484
487- let problems = [ ] ;
485+ // only check for more problems if we are not already aborting
486+ needsProblemReportingDialog =
487+ checkReportProblem ( "MOTOR_PROTOCOL_DISABLED" , problems ) || needsProblemReportingDialog ;
488488
489- // only check for more problems if we are not already aborting
489+ if ( have_sensor ( FC . CONFIG . activeSensors , "acc" ) ) {
490490 needsProblemReportingDialog =
491- checkReportProblem ( "MOTOR_PROTOCOL_DISABLED" , problems ) || needsProblemReportingDialog ;
491+ checkReportProblem ( "ACC_NEEDS_CALIBRATION" , problems ) || needsProblemReportingDialog ;
492+ }
493+
494+ if ( needsProblemReportingDialog ) {
495+ const problemItemTemplate = $ ( "#dialogReportProblems-listItemTemplate" ) ;
496+ const problemDialogList = $ ( "#dialogReportProblems-list" ) ;
497+
498+ problemDialogList . empty ( ) ;
492499
493- if ( have_sensor ( FC . CONFIG . activeSensors , "acc" ) ) {
494- needsProblemReportingDialog =
495- checkReportProblem ( "ACC_NEEDS_CALIBRATION" , problems ) || needsProblemReportingDialog ;
500+ for ( const problem of problems ) {
501+ problemItemTemplate . clone ( ) . prop ( "id" , null ) . html ( problem . description ) . appendTo ( problemDialogList ) ;
496502 }
497503
498- if ( needsProblemReportingDialog ) {
499- for ( const problem of problems ) {
500- problemItemTemplate . clone ( ) . prop ( "id" , null ) . html ( problem . description ) . appendTo ( problemDialogList ) ;
501- }
504+ const problemDialog = $ ( "#dialogReportProblems" ) [ 0 ] ;
505+ $ ( "#dialogReportProblems-closebtn" )
506+ . off ( "click" )
507+ . one ( "click" , ( ) => problemDialog . close ( ) ) ;
502508
503- const problemDialog = $ ( "#dialogReportProblems" ) [ 0 ] ;
504- $ ( "#dialogReportProblems-closebtn" )
505- . off ( "click" )
506- . one ( "click" , ( ) => problemDialog . close ( ) ) ;
509+ problemDialog . showModal ( ) ;
510+ $ ( "#dialogReportProblems" ) . scrollTop ( 0 ) ;
511+ $ ( "#dialogReportProblems-closebtn" ) . focus ( ) ;
512+ }
507513
508- problemDialog . showModal ( ) ;
509- $ ( "#dialogReportProblems" ) . scrollTop ( 0 ) ;
510- $ ( "#dialogReportProblems-closebtn" ) . focus ( ) ;
511- } else {
512- // if we are not aborting, we can continue
513- processUid ( ) ;
514- }
515- } ) ;
514+ processUid ( ) ;
516515}
517516
518517async function processBuildConfiguration ( ) {
0 commit comments