File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed
nanoFirmwareFlasher.Library Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -466,6 +466,7 @@ internal ExitCodes WriteFlash(
466466 var regexPattern = new StringBuilder ( ) ;
467467 int counter = 1 ;
468468 var regexGroupNames = new List < string > ( ) ;
469+ string flashFreqParam ;
469470
470471 foreach ( var part in partsToWrite )
471472 {
@@ -485,9 +486,22 @@ internal ExitCodes WriteFlash(
485486 _ => "detect" ,
486487 } ;
487488
489+ // process flash frequency
490+ if ( _flashFrequency == - 1 )
491+ {
492+ // no flash frequency was requested on the CLI options
493+ // defaulting to 'keep' to make this work with image files with checksum
494+ flashFreqParam = "keep" ;
495+ }
496+ else
497+ {
498+ // compose option for flash freq para
499+ flashFreqParam = $ "{ _flashFrequency } m";
500+ }
501+
488502 // execute write_flash command and parse the result; progress message can be found be searching for linefeed
489503 if ( ! RunEspTool (
490- $ "write_flash --flash_mode { _flashMode } --flash_freq { _flashFrequency } m --flash_size { flashSize } { partsArguments . ToString ( ) . Trim ( ) } ",
504+ $ "write_flash --flash_mode { _flashMode } --flash_freq { flashFreqParam } --flash_size { flashSize } { partsArguments . ToString ( ) . Trim ( ) } ",
491505 false ,
492506 useStandardBaudrate ,
493507 true ,
@@ -623,7 +637,7 @@ private bool RunEspTool(
623637 if ( ! espTool . Start ( ) )
624638 {
625639 throw new EspToolExecutionException ( "Error starting esptool!" ) ;
626- }
640+ }
627641
628642 var messageBuilder = new StringBuilder ( ) ;
629643
Original file line number Diff line number Diff line change @@ -108,14 +108,14 @@ public class Options
108108 [ Option (
109109 "flashmode" ,
110110 Required = false ,
111- Default = "dio " ,
111+ Default = "keep " ,
112112 HelpText = "Flash mode to use." ) ]
113113 public string Esp32FlashMode { get ; set ; }
114114
115115 [ Option (
116116 "flashfreq" ,
117117 Required = false ,
118- Default = 40 ,
118+ Default = - 1 ,
119119 HelpText = "Flash frequency to use [MHz]." ) ]
120120 public int Esp32FlashFrequency { get ; set ; }
121121
You can’t perform that action at this time.
0 commit comments