esp32tool 1.6.5 → 1.6.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/js/improv.js CHANGED
@@ -6,7 +6,12 @@
6
6
 
7
7
  // Protocol constants
8
8
  const SERIAL_PACKET_HEADER = [
9
- 0x49, 0x4d, 0x50, 0x52, 0x4f, 0x56, // "IMPROV"
9
+ 0x49,
10
+ 0x4d,
11
+ 0x50,
12
+ 0x52,
13
+ 0x4f,
14
+ 0x56, // "IMPROV"
10
15
  1, // protocol version
11
16
  ];
12
17
 
@@ -88,7 +93,10 @@ class ImprovSerial extends EventTarget {
88
93
  let timer;
89
94
  const statePromise = this.requestCurrentState();
90
95
  const timeoutPromise = new Promise((_, reject) => {
91
- timer = setTimeout(() => reject(new Error("Improv Wi-Fi Serial not detected")), timeout);
96
+ timer = setTimeout(
97
+ () => reject(new Error("Improv Wi-Fi Serial not detected")),
98
+ timeout,
99
+ );
92
100
  });
93
101
  try {
94
102
  await Promise.race([statePromise, timeoutPromise]);
@@ -225,7 +233,9 @@ class ImprovSerial extends EventTarget {
225
233
 
226
234
  async _sendRPCWithResponse(command, data, timeout) {
227
235
  if (this._rpcFeedback) {
228
- throw new Error("Only 1 RPC command that requires feedback can be active");
236
+ throw new Error(
237
+ "Only 1 RPC command that requires feedback can be active",
238
+ );
229
239
  }
230
240
  return await this._awaitRPCResultWithTimeout(
231
241
  new Promise((resolve, reject) => {
@@ -238,7 +248,9 @@ class ImprovSerial extends EventTarget {
238
248
 
239
249
  async _sendRPCWithMultipleResponses(command, data, timeout) {
240
250
  if (this._rpcFeedback) {
241
- throw new Error("Only 1 RPC command that requires feedback can be active");
251
+ throw new Error(
252
+ "Only 1 RPC command that requires feedback can be active",
253
+ );
242
254
  }
243
255
  return await this._awaitRPCResultWithTimeout(
244
256
  new Promise((resolve, reject) => {
@@ -329,7 +341,12 @@ class ImprovSerial extends EventTarget {
329
341
  const packetLength = payload[2];
330
342
  const data = payload.slice(3, 3 + packetLength);
331
343
 
332
- this.logger.debug("IMPROV PACKET", { version, packetType, packetLength, data });
344
+ this.logger.debug("IMPROV PACKET", {
345
+ version,
346
+ packetType,
347
+ packetLength,
348
+ data,
349
+ });
333
350
 
334
351
  if (version !== 1) {
335
352
  this.logger.error("Received unsupported Improv version", version);
@@ -436,7 +453,9 @@ class ImprovSerial extends EventTarget {
436
453
  _setError(error) {
437
454
  this.error = error;
438
455
  if (error > 0 && this._rpcFeedback) {
439
- this._rpcFeedback.reject(new Error(ERROR_MSGS[error] || `UNKNOWN_ERROR (${error})`));
456
+ this._rpcFeedback.reject(
457
+ new Error(ERROR_MSGS[error] || `UNKNOWN_ERROR (${error})`),
458
+ );
440
459
  this._rpcFeedback = null;
441
460
  }
442
461
  this.dispatchEvent(
@@ -759,7 +778,8 @@ export class ImprovDialog {
759
778
  } catch (err) {
760
779
  console.error("[Improv] Init failed:", err);
761
780
  this._view = "error";
762
- this._errorMsg = "Improv not detected. Make sure the device firmware supports Improv Wi-Fi.";
781
+ this._errorMsg =
782
+ "Improv not detected. Make sure the device firmware supports Improv Wi-Fi.";
763
783
  this._render();
764
784
  }
765
785
 
@@ -844,7 +864,8 @@ export class ImprovDialog {
844
864
  `;
845
865
 
846
866
  // Bind close button
847
- this.overlay.querySelector(".improv-dialog-close")
867
+ this.overlay
868
+ .querySelector(".improv-dialog-close")
848
869
  .addEventListener("click", () => this.close());
849
870
 
850
871
  // Bind view-specific events
@@ -853,10 +874,14 @@ export class ImprovDialog {
853
874
 
854
875
  _getTitle() {
855
876
  switch (this._view) {
856
- case "loading": return "Improv Wi-Fi";
857
- case "dashboard": return this._esc(this.client?.info?.name || "Device");
858
- case "wifi": return "Wi-Fi Configuration";
859
- case "error": return "Improv Wi-Fi";
877
+ case "loading":
878
+ return "Improv Wi-Fi";
879
+ case "dashboard":
880
+ return this._esc(this.client?.info?.name || "Device");
881
+ case "wifi":
882
+ return "Wi-Fi Configuration";
883
+ case "error":
884
+ return "Improv Wi-Fi";
860
885
  }
861
886
  }
862
887
 
@@ -887,10 +912,14 @@ export class ImprovDialog {
887
912
  stateClass = "improv-state-provisioned";
888
913
  }
889
914
 
890
- const wifiLabel = state === ImprovSerialCurrentState.PROVISIONED
891
- ? "Change Wi-Fi" : "Connect to Wi-Fi";
892
- const wifiDesc = state === ImprovSerialCurrentState.PROVISIONED
893
- ? "Change the Wi-Fi network" : "Configure Wi-Fi credentials";
915
+ const wifiLabel =
916
+ state === ImprovSerialCurrentState.PROVISIONED
917
+ ? "Change Wi-Fi"
918
+ : "Connect to Wi-Fi";
919
+ const wifiDesc =
920
+ state === ImprovSerialCurrentState.PROVISIONED
921
+ ? "Change the Wi-Fi network"
922
+ : "Configure Wi-Fi credentials";
894
923
 
895
924
  let html = `
896
925
  <div class="improv-section-title">Device Info</div>
@@ -941,9 +970,10 @@ export class ImprovDialog {
941
970
 
942
971
  _renderWifi() {
943
972
  if (this._busy) {
944
- const busyMsg = this._ssids === undefined
945
- ? "Scanning for networks..."
946
- : "Connecting...";
973
+ const busyMsg =
974
+ this._ssids === undefined
975
+ ? "Scanning for networks..."
976
+ : "Connecting...";
947
977
  return `
948
978
  <div class="improv-status">
949
979
  <div class="improv-spinner"></div>
@@ -955,7 +985,14 @@ export class ImprovDialog {
955
985
  let ssidInput = "";
956
986
  if (this._ssids && this._ssids.length > 0) {
957
987
  const options = this._ssids.map((s) => {
958
- const signal = s.rssi > -50 ? "▂▄▆█" : s.rssi > -70 ? "▂▄▆" : s.rssi > -80 ? "▂▄" : "▂";
988
+ const signal =
989
+ s.rssi > -50
990
+ ? "▂▄▆█"
991
+ : s.rssi > -70
992
+ ? "▂▄▆"
993
+ : s.rssi > -80
994
+ ? "▂▄"
995
+ : "▂";
959
996
  const lock = s.secured ? "🔒" : "";
960
997
  const sel = s.name === this._selectedSsid ? " selected" : "";
961
998
  return `<option value="${this._esc(s.name)}"${sel}>${this._esc(s.name)} ${signal} ${lock}</option>`;
@@ -1112,7 +1149,8 @@ export class ImprovDialog {
1112
1149
  ssid = ssidInput.value.trim();
1113
1150
  }
1114
1151
 
1115
- const password = this.overlay?.querySelector("#improv-password-input")?.value || "";
1152
+ const password =
1153
+ this.overlay?.querySelector("#improv-password-input")?.value || "";
1116
1154
 
1117
1155
  if (!ssid) {
1118
1156
  this._errorMsg = "Please enter or select a network name.";