@@ -487,20 +487,6 @@ internal ExitCodes WriteFlash(
487487 throw new WriteEsp32FlashException ( messages ) ;
488488 }
489489
490- var match = Regex . Match ( messages , regexPattern . ToString ( ) ) ;
491- if ( ! match . Success )
492- {
493- throw new WriteEsp32FlashException ( messages ) ;
494- }
495-
496- if ( Verbosity >= VerbosityLevel . Detailed )
497- {
498- foreach ( string groupName in regexGroupNames )
499- {
500- Console . WriteLine ( match . Groups [ groupName ] . ToString ( ) . Trim ( ) ) ;
501- }
502- }
503-
504490 // check if there is any mention of not being able to run the app
505491 CouldntResetTarget = messages . Contains ( "To run the app, reset the chip manually" ) ;
506492
@@ -621,6 +607,7 @@ private bool RunEspTool(
621607 connectPromptShown = false ;
622608 connectPatternFound = false ;
623609 connectTimeStamp = DateTime . UtcNow ;
610+ var progressStarted = false ;
624611
625612 // showing progress is a little bit tricky
626613 if ( Verbosity > VerbosityLevel . Quiet )
@@ -643,9 +630,17 @@ private bool RunEspTool(
643630
644631 // try to find a progress message
645632 string progress = FindProgress ( messageBuilder , progressTestChar . Value ) ;
646- if ( progress != null && Verbosity > VerbosityLevel . Quiet )
633+ if ( progress != null && Verbosity >= VerbosityLevel . Detailed )
647634 {
648- // print progress and set the cursor to the beginning of the line (\r)
635+ if ( ! progressStarted )
636+ {
637+ // need to print the first line of the progress message
638+ Console . Write ( "\r " ) ;
639+
640+ progressStarted = true ;
641+ }
642+
643+ // print progress... and set the cursor to the beginning of the line (\r)
649644 Console . Write ( progress ) ;
650645 Console . Write ( "\r " ) ;
651646 }
@@ -654,6 +649,15 @@ private bool RunEspTool(
654649 }
655650 else
656651 {
652+ if ( Verbosity >= VerbosityLevel . Detailed )
653+ {
654+ // need to clear all progress lines
655+ for ( int i = 0 ; i < messageBuilder . Length ; i ++ )
656+ {
657+ Console . Write ( "\b " ) ;
658+ }
659+ }
660+
657661 break ;
658662 }
659663 }
@@ -788,10 +792,17 @@ private string FindProgress(
788792 {
789793 // trim the test char and convert \r\n into \r
790794 string progress = messageBuilder . ToString ( ) . Trim ( progressTestChar ) . Replace ( "\r \n " , "\r " ) ;
795+
796+ // trim initial message with device features
797+ int startIndex = progress . LastIndexOf ( "MAC:" ) ;
798+
791799 // another test char in the message?
792- int delimiter = progress . LastIndexOf ( progressTestChar ) ;
793- if ( delimiter > 0 )
800+ int delimiter = progress . LastIndexOf ( progressTestChar , progress . Length - 1 ) ;
801+ if ( startIndex > 0
802+ && delimiter > 0
803+ && delimiter > startIndex )
794804 {
805+ //var nextDelimiter = progress.LastIndexOf(progressTestChar, delimiter);
795806 // then we found a progress message; pad the message to 110 chars because no message is longer than 110 chars
796807 return progress . Substring ( delimiter + 1 ) . PadRight ( 110 ) ;
797808 }
0 commit comments