@@ -484,7 +484,7 @@ public static async System.Threading.Tasks.Task<ExitCodes> UpdateFirmwareAsync(
484484 if ( verbosity >= VerbosityLevel . Normal )
485485 {
486486 Console . ForegroundColor = ConsoleColor . Green ;
487- Console . WriteLine ( "OK" ) ;
487+ Console . WriteLine ( "OK" . PadRight ( 110 ) ) ;
488488 }
489489 else
490490 {
@@ -495,13 +495,6 @@ public static async System.Threading.Tasks.Task<ExitCodes> UpdateFirmwareAsync(
495495
496496 if ( operationResult == ExitCodes . OK )
497497 {
498- Console . ForegroundColor = ConsoleColor . White ;
499-
500- if ( verbosity >= VerbosityLevel . Normal )
501- {
502- Console . Write ( $ "Flashing firmware...") ;
503- }
504-
505498 int configPartitionAddress = 0 ;
506499 int configPartitionSize = 0 ;
507500 string configPartitionBackup = Path . GetRandomFileName ( ) ;
@@ -512,9 +505,13 @@ public static async System.Threading.Tasks.Task<ExitCodes> UpdateFirmwareAsync(
512505 // check if the update file includes a partition table
513506 if ( File . Exists ( Path . Combine ( firmware . LocationPath , $ "partitions_nanoclr_{ Esp32DeviceInfo . GetFlashSizeAsString ( esp32Device . FlashSize ) . ToLowerInvariant ( ) } .csv") ) )
514507 {
515- // can't do this without a partition table
516-
508+ if ( verbosity >= VerbosityLevel . Normal )
509+ {
510+ Console . ForegroundColor = ConsoleColor . White ;
511+ Console . Write ( $ "Backup configuration...") ;
512+ }
517513
514+ // can't do this without a partition table
518515 // compose path to partition file
519516 string partitionCsvFile = Path . Combine ( firmware . LocationPath , $ "partitions_nanoclr_{ Esp32DeviceInfo . GetFlashSizeAsString ( esp32Device . FlashSize ) . ToLowerInvariant ( ) } .csv") ;
520517
@@ -538,18 +535,46 @@ public static async System.Threading.Tasks.Task<ExitCodes> UpdateFirmwareAsync(
538535 configPartitionBackup ,
539536 configPartitionAddress ,
540537 configPartitionSize ) ;
541-
538+
539+ if ( verbosity >= VerbosityLevel . Normal )
540+ {
541+ Console . ForegroundColor = ConsoleColor . White ;
542+ Console . Write ( $ "Backup configuration...") ;
543+ Console . ForegroundColor = ConsoleColor . Green ;
544+ Console . WriteLine ( "OK" . PadRight ( 110 ) ) ;
545+ }
546+
542547 firmware . FlashPartitions . Add ( configPartitionAddress , configPartitionBackup ) ;
543548 }
544549 }
545550
551+ Console . ForegroundColor = ConsoleColor . White ;
552+
553+ if ( verbosity < VerbosityLevel . Normal )
554+ {
555+ // output the start of operation message for verbosity lower than normal
556+ // otherwise the progress from esptool is shown
557+ Console . ForegroundColor = ConsoleColor . White ;
558+ Console . Write ( $ "Flashing firmware...") ;
559+ }
560+
546561 // write to flash
547562 operationResult = espTool . WriteFlash ( firmware . FlashPartitions ) ;
548563
549564 if ( operationResult == ExitCodes . OK )
550565 {
566+ if ( verbosity < VerbosityLevel . Normal )
567+ {
568+ // operation completed output
569+ Console . ForegroundColor = ConsoleColor . Green ;
570+ Console . WriteLine ( "OK" . PadRight ( 110 ) ) ;
571+ }
572+
551573 if ( verbosity >= VerbosityLevel . Normal )
552574 {
575+ // output the full message as usual after the progress from esptool
576+ Console . ForegroundColor = ConsoleColor . White ;
577+ Console . Write ( $ "Flashing firmware...") ;
553578 Console . ForegroundColor = ConsoleColor . Green ;
554579 Console . WriteLine ( "OK" . PadRight ( 110 ) ) ;
555580
0 commit comments