Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 086e33d5 authored by Manu Suresh's avatar Manu Suresh Committed by Jackeagle
Browse files

web-installer: npm run format

parent 93768fb3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -174,7 +174,7 @@ export class Controller {
          },
        );
        // Small delay between flash operations to prevent overwhelming the device
        await new Promise(resolve => setTimeout(resolve, FLASH_COOLDOWN_MS));
        await new Promise((resolve) => setTimeout(resolve, FLASH_COOLDOWN_MS));
        return result;
      }
      case Command.CMD_TYPE.unlock: {
+11 −5
Original line number Diff line number Diff line
@@ -82,7 +82,9 @@ export class Bootloader extends Device {
    }

    try {
      WDebug.log(`Flashing ${partition} (${(blob.size / 1024 / 1024).toFixed(1)} MB)...`);
      WDebug.log(
        `Flashing ${partition} (${(blob.size / 1024 / 1024).toFixed(1)} MB)...`,
      );
      await this.device.flashBlob(partition, blob, (progress) => {
        onProgress(progress * blob.size, blob.size, partition);
      });
@@ -90,22 +92,26 @@ export class Bootloader extends Device {
      return true;
    } catch (e) {
      if (e instanceof TimeoutError) {
        WDebug.log(`Timeout on flashblob > ${partition} (attempt ${attempt}/${MAX_ATTEMPTS})`);
        WDebug.log(
          `Timeout on flashblob > ${partition} (attempt ${attempt}/${MAX_ATTEMPTS})`,
        );
        if (attempt < MAX_ATTEMPTS) {
          // Wait before retry to allow device to recover
          WDebug.log(`Waiting ${RETRY_DELAY_MS}ms before retry...`);
          await new Promise(resolve => setTimeout(resolve, RETRY_DELAY_MS));
          await new Promise((resolve) => setTimeout(resolve, RETRY_DELAY_MS));

          // Check if device is still connected before retry
          if (!this.device.isConnected) {
            throw new Error(`Device disconnected during flash of ${partition}. Please reconnect and try again.`);
            throw new Error(
              `Device disconnected during flash of ${partition}. Please reconnect and try again.`,
            );
          }

          return await this.flashBlob(partition, blob, onProgress, attempt + 1);
        }
        throw new Error(
          `Bootloader timeout: flashing ${partition} failed after ${MAX_ATTEMPTS} attempts. ` +
          `Try using a different USB port or cable.`
            `Try using a different USB port or cable.`,
        );
      } else {
        console.log("flashBlob error", e);