mirror of
https://github.com/esphome/esp-web-tools.git
synced 2025-07-28 06:06:36 +00:00
Wait longer for Improv to respond after erase + install (#125)
This commit is contained in:
parent
0a12525fb4
commit
a8b75c89eb
14
package-lock.json
generated
14
package-lock.json
generated
@ -17,7 +17,7 @@
|
|||||||
"@material/mwc-linear-progress": "^0.25.1",
|
"@material/mwc-linear-progress": "^0.25.1",
|
||||||
"@material/mwc-textfield": "^0.25.3",
|
"@material/mwc-textfield": "^0.25.3",
|
||||||
"esp-web-flasher": "^4.0.0",
|
"esp-web-flasher": "^4.0.0",
|
||||||
"improv-wifi-serial-sdk": "^2.0.0",
|
"improv-wifi-serial-sdk": "^2.1.0",
|
||||||
"lit": "^2.0.0",
|
"lit": "^2.0.0",
|
||||||
"tslib": "^2.3.1"
|
"tslib": "^2.3.1"
|
||||||
},
|
},
|
||||||
@ -1109,9 +1109,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/improv-wifi-serial-sdk": {
|
"node_modules/improv-wifi-serial-sdk": {
|
||||||
"version": "2.0.0",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/improv-wifi-serial-sdk/-/improv-wifi-serial-sdk-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/improv-wifi-serial-sdk/-/improv-wifi-serial-sdk-2.1.0.tgz",
|
||||||
"integrity": "sha512-VHKTm6O3aENOCtEwZZqItJ/dKf0nWJv41iamAUjcKCbQC1PrmZU/91PaWDKQip7WvRlxdKf2PLMKRpnFSeeJYA==",
|
"integrity": "sha512-Y+dJGd5MPayWJM810Ni1hrSIunP/htTZgjF39NDVQ/ntWZAvNct3i4oR4jTo1BEb7TDgcHoiLfH5Do6oY4oD1Q==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@material/mwc-button": "^0.25.3",
|
"@material/mwc-button": "^0.25.3",
|
||||||
"@material/mwc-circular-progress": "^0.25.3",
|
"@material/mwc-circular-progress": "^0.25.3",
|
||||||
@ -2870,9 +2870,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"improv-wifi-serial-sdk": {
|
"improv-wifi-serial-sdk": {
|
||||||
"version": "2.0.0",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/improv-wifi-serial-sdk/-/improv-wifi-serial-sdk-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/improv-wifi-serial-sdk/-/improv-wifi-serial-sdk-2.1.0.tgz",
|
||||||
"integrity": "sha512-VHKTm6O3aENOCtEwZZqItJ/dKf0nWJv41iamAUjcKCbQC1PrmZU/91PaWDKQip7WvRlxdKf2PLMKRpnFSeeJYA==",
|
"integrity": "sha512-Y+dJGd5MPayWJM810Ni1hrSIunP/htTZgjF39NDVQ/ntWZAvNct3i4oR4jTo1BEb7TDgcHoiLfH5Do6oY4oD1Q==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@material/mwc-button": "^0.25.3",
|
"@material/mwc-button": "^0.25.3",
|
||||||
"@material/mwc-circular-progress": "^0.25.3",
|
"@material/mwc-circular-progress": "^0.25.3",
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
"@material/mwc-linear-progress": "^0.25.1",
|
"@material/mwc-linear-progress": "^0.25.1",
|
||||||
"@material/mwc-textfield": "^0.25.3",
|
"@material/mwc-textfield": "^0.25.3",
|
||||||
"esp-web-flasher": "^4.0.0",
|
"esp-web-flasher": "^4.0.0",
|
||||||
"improv-wifi-serial-sdk": "^2.0.0",
|
"improv-wifi-serial-sdk": "^2.1.0",
|
||||||
"lit": "^2.0.0",
|
"lit": "^2.0.0",
|
||||||
"tslib": "^2.3.1"
|
"tslib": "^2.3.1"
|
||||||
}
|
}
|
||||||
|
@ -481,12 +481,28 @@ class EwtInstallDialog extends LitElement {
|
|||||||
} else if (this._installState.state === FlashStateType.ERASING) {
|
} else if (this._installState.state === FlashStateType.ERASING) {
|
||||||
content = this._renderProgress("Erasing");
|
content = this._renderProgress("Erasing");
|
||||||
hideActions = true;
|
hideActions = true;
|
||||||
} else if (this._installState.state === FlashStateType.WRITING) {
|
} else if (
|
||||||
|
this._installState.state === FlashStateType.WRITING ||
|
||||||
|
// When we're finished, keep showing this screen with 100% written
|
||||||
|
// until Improv is initialized / not detected.
|
||||||
|
(this._installState.state === FlashStateType.FINISHED &&
|
||||||
|
this._client === undefined)
|
||||||
|
) {
|
||||||
|
let percentage: number | undefined;
|
||||||
|
let undeterminateLabel: string | undefined;
|
||||||
|
if (this._installState.state === FlashStateType.FINISHED) {
|
||||||
|
// We're done writing and detecting improv, show spinner
|
||||||
|
undeterminateLabel = "Wrapping up";
|
||||||
|
} else if (this._installState.details.percentage < 4) {
|
||||||
|
// We're writing the firmware under 4%, show spinner or else we don't show any pixels
|
||||||
|
undeterminateLabel = "Installing";
|
||||||
|
} else {
|
||||||
|
// We're writing the firmware over 4%, show progress bar
|
||||||
|
percentage = this._installState.details.percentage;
|
||||||
|
}
|
||||||
content = this._renderProgress(
|
content = this._renderProgress(
|
||||||
html`
|
html`
|
||||||
${this._installState.details.percentage > 3
|
${undeterminateLabel ? html`${undeterminateLabel}<br />` : ""}
|
||||||
? ""
|
|
||||||
: html`Installing<br />`}
|
|
||||||
<br />
|
<br />
|
||||||
This will take
|
This will take
|
||||||
${this._installState.chipFamily === "ESP8266"
|
${this._installState.chipFamily === "ESP8266"
|
||||||
@ -494,10 +510,7 @@ class EwtInstallDialog extends LitElement {
|
|||||||
: "2 minutes"}.<br />
|
: "2 minutes"}.<br />
|
||||||
Keep this page visible to prevent slow down
|
Keep this page visible to prevent slow down
|
||||||
`,
|
`,
|
||||||
// Show as undeterminate under 3% or else we don't show any pixels
|
percentage
|
||||||
this._installState.details.percentage > 3
|
|
||||||
? this._installState.details.percentage
|
|
||||||
: undefined
|
|
||||||
);
|
);
|
||||||
hideActions = true;
|
hideActions = true;
|
||||||
} else if (this._installState.state === FlashStateType.FINISHED) {
|
} else if (this._installState.state === FlashStateType.FINISHED) {
|
||||||
@ -508,7 +521,6 @@ class EwtInstallDialog extends LitElement {
|
|||||||
<ewt-button
|
<ewt-button
|
||||||
slot="primaryAction"
|
slot="primaryAction"
|
||||||
label="Next"
|
label="Next"
|
||||||
.disabled=${this._client === undefined}
|
|
||||||
@click=${() => {
|
@click=${() => {
|
||||||
this._state =
|
this._state =
|
||||||
supportsImprov && this._installErase ? "PROVISION" : "DASHBOARD";
|
supportsImprov && this._installErase ? "PROVISION" : "DASHBOARD";
|
||||||
@ -613,7 +625,7 @@ class EwtInstallDialog extends LitElement {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _initialize() {
|
private async _initialize(justErased = false) {
|
||||||
if (this.port.readable === null || this.port.writable === null) {
|
if (this.port.readable === null || this.port.writable === null) {
|
||||||
this._state = "ERROR";
|
this._state = "ERROR";
|
||||||
this._error =
|
this._error =
|
||||||
@ -628,7 +640,10 @@ class EwtInstallDialog extends LitElement {
|
|||||||
});
|
});
|
||||||
client.addEventListener("error-changed", () => this.requestUpdate());
|
client.addEventListener("error-changed", () => this.requestUpdate());
|
||||||
try {
|
try {
|
||||||
this._info = await client.initialize();
|
// If a device was just erased, the new firmware might need some time to
|
||||||
|
// format the rest of the flash.
|
||||||
|
const timeout = justErased ? 10000 : 1000;
|
||||||
|
this._info = await client.initialize(timeout);
|
||||||
this._client = client;
|
this._client = client;
|
||||||
client.addEventListener("disconnect", this._handleDisconnect);
|
client.addEventListener("disconnect", this._handleDisconnect);
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
@ -672,7 +687,7 @@ class EwtInstallDialog extends LitElement {
|
|||||||
|
|
||||||
if (state.state === FlashStateType.FINISHED) {
|
if (state.state === FlashStateType.FINISHED) {
|
||||||
sleep(100)
|
sleep(100)
|
||||||
.then(() => this._initialize())
|
.then(() => this._initialize(this._installErase))
|
||||||
.then(() => this.requestUpdate());
|
.then(() => this.requestUpdate());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user