Merge pull request #29 from pkendall64/mode-passing
Allow passing of mode to main function
This commit is contained in:
commit
49c3278f2f
14
ESPLoader.js
14
ESPLoader.js
@ -214,7 +214,7 @@ class ESPLoader {
|
||||
}
|
||||
|
||||
_connect_attempt = async ({mode='default_reset', esp32r0_delay=false} = {}) => {
|
||||
console.log("_connect_attempt " + esp32r0_delay);
|
||||
console.log("_connect_attempt " + mode + " " + esp32r0_delay);
|
||||
if (mode !== 'no_reset') {
|
||||
await this.transport.setDTR(false);
|
||||
await this.transport.setRTS(true);
|
||||
@ -273,11 +273,11 @@ class ESPLoader {
|
||||
this.write_char('Connecting...');
|
||||
await this.transport.connect();
|
||||
for (i = 0 ; i < attempts; i++) {
|
||||
resp = await this._connect_attempt({esp32r0_delay:false});
|
||||
resp = await this._connect_attempt({mode:mode, esp32r0_delay:false});
|
||||
if (resp === "success") {
|
||||
break;
|
||||
}
|
||||
resp = await this._connect_attempt({esp32r0_delay:true});
|
||||
resp = await this._connect_attempt({mode:mode, esp32r0_delay:true});
|
||||
if (resp === "success") {
|
||||
break;
|
||||
}
|
||||
@ -303,8 +303,8 @@ class ESPLoader {
|
||||
}
|
||||
|
||||
|
||||
detect_chip = async () => {
|
||||
await this.connect();
|
||||
detect_chip = async ({mode='default_reset'} = {}) => {
|
||||
await this.connect({mode:mode});
|
||||
this.write_char("Detecting chip type... ");
|
||||
if (this.chip != null) {
|
||||
this.log(this.chip.CHIP_NAME);
|
||||
@ -657,8 +657,8 @@ class ESPLoader {
|
||||
}
|
||||
}
|
||||
|
||||
main_fn = async () => {
|
||||
await this.detect_chip();
|
||||
main_fn = async ({mode='default_reset'} = {}) => {
|
||||
await this.detect_chip({mode:mode});
|
||||
if (this.chip == null) {
|
||||
this.log("Error in connecting to board");
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user