UNPKG

tasmota-esp-web-tools

Version:
33 lines (32 loc) 1.94 kB
import { Logger } from "tasmota-webserial-esptool"; import { Build, FlashState, Manifest } from "./const"; /** * Parse flash size string (e.g., "4MB", "8MB", "16MB") to megabytes number */ export declare function parseFlashSizeToMB(flashSize: string): number | undefined; /** * Extract the most relevant firmware filename from a build's parts. * Prefers parts with "factory" in the name. * Ignores parts with "bootloader" or "partition" in the name. * Returns just the basename (no path prefix). */ export declare function getFirmwareFileName(build: Build): string | undefined; /** * Find the best matching build for a given chip configuration. * This is the single source of truth for build selection used by both * the flash routine and the install dialog UI. */ export declare function findMatchingBuild(manifest: Manifest, chipFamily: string, chipVariant: string | null, flashSizeMB: number | undefined, usbInterface: "UART" | "CDC" | undefined): Build | undefined; /** * Detect the matching build for the currently connected device. * Extracts chip info directly from the esploader instance. * * @param manifest - The loaded firmware manifest * @param esploader - ESPLoader instance (or stub) with chip info * @param flashSize - Detected flash size string (e.g. "4MB"), or undefined * @param isUsbJtagOrOtg - Whether the device uses native USB (CDC) instead of external serial * @param improvChipFamily - Optional chipFamily from Improv Serial info (takes precedence) */ export declare function detectMatchingBuild(manifest: Manifest, esploader: any, flashSize: string | undefined, isUsbJtagOrOtg: boolean, improvChipFamily?: string): Build | undefined; export declare const flash: (onEvent: (state: FlashState) => void, esploader: any, // ESPLoader instance from tasmota-webserial-esptool logger: Logger, manifestPath: string, eraseFirst: boolean, firmwareBuffer: Uint8Array, _baudRate?: number) => Promise<void>;