File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -1652,8 +1652,9 @@ export class ESPLoader {
16521652 * Execute this function to execute after operation reset functions.
16531653 * @param {After } mode After operation mode. Default is 'hard_reset'.
16541654 * @param { boolean } usingUsbOtg For 'hard_reset' to specify if using USB-OTG
1655+ * @param {string } sequenceString For 'custom_reset' to specify the custom reset sequence string
16551656 */
1656- async after ( mode : After = "hard_reset" , usingUsbOtg ?: boolean ) {
1657+ async after ( mode : After = "hard_reset" , usingUsbOtg ?: boolean , sequenceString ?: string ) {
16571658 switch ( mode ) {
16581659 case "hard_reset" :
16591660 if ( this . resetConstructors . hardReset ) {
@@ -1669,6 +1670,19 @@ export class ESPLoader {
16691670 case "no_reset_stub" :
16701671 this . info ( "Staying in flasher stub." ) ;
16711672 break ;
1673+ case "custom_reset" :
1674+ if ( ! sequenceString ) {
1675+ this . info ( "Custom reset sequence not provided, doing nothing." ) ;
1676+ }
1677+ if ( ! this . resetConstructors . customReset ) {
1678+ this . info ( "Custom reset constructor not available, doing nothing." ) ;
1679+ }
1680+ if ( this . resetConstructors . customReset && sequenceString ) {
1681+ this . info ( "Custom resetting using sequence " + sequenceString ) ;
1682+ const customReset = this . resetConstructors . customReset ( this . transport , sequenceString ) ;
1683+ await customReset . reset ( ) ;
1684+ }
1685+ break ;
16721686 default :
16731687 this . info ( "Staying in bootloader." ) ;
16741688 if ( this . IS_STUB ) {
Original file line number Diff line number Diff line change @@ -6,4 +6,4 @@ export type Before = "default_reset" | "usb_reset" | "no_reset" | "no_reset_no_s
66/**
77 * Reset modes that can be used after operation is finished.
88 */
9- export type After = "hard_reset" | "soft_reset" | "no_reset" | "no_reset_stub" ;
9+ export type After = "hard_reset" | "soft_reset" | "no_reset" | "no_reset_stub" | "custom_reset" ;
You can’t perform that action at this time.
0 commit comments