mirror of
https://github.com/esphome/esp-web-tools.git
synced 2025-07-28 06:06:36 +00:00
Add support for ESP32-C3 (#60)
This commit is contained in:
parent
99b7ad81e8
commit
6a664ef67d
16
README.md
16
README.md
@ -24,6 +24,18 @@ Manifest definition:
|
||||
{ "path": "firmware.bin", "offset": 65536 }
|
||||
]
|
||||
},
|
||||
{
|
||||
"chipFamily": "ESP32-C3",
|
||||
"parts": [
|
||||
{ "path": "esp32-c3.bin", "offset": 0 },
|
||||
]
|
||||
},
|
||||
{
|
||||
"chipFamily": "ESP32-S2",
|
||||
"parts": [
|
||||
{ "path": "esp32-s2.bin", "offset": 0 },
|
||||
]
|
||||
},
|
||||
{
|
||||
"chipFamily": "ESP8266",
|
||||
"parts": [
|
||||
@ -97,8 +109,8 @@ Field | Description
|
||||
state | The current [state](https://github.com/esphome/esp-web-tools/blob/main/src/const.ts)
|
||||
message | A description of the current state
|
||||
manifest | The loaded manifest
|
||||
build | The manifest's build that was selected
|
||||
chipFamily | The chip that was detected; "ESP32" \| "ESP8266" \| "ESP32-S2" \| "Unknown Chip"
|
||||
build | The manifest's build that was selected
|
||||
chipFamily | The chip that was detected; "ESP32" \| "ESP8266" \| "ESP32-S2" \| "ESP32-C3" \| "Unknown Chip"
|
||||
details | An optional extra field that is different [per state](https://github.com/esphome/esp-web-tools/blob/main/src/const.ts)
|
||||
|
||||
## Development
|
||||
|
@ -1,5 +1,5 @@
|
||||
export interface Build {
|
||||
chipFamily: "ESP32" | "ESP8266";
|
||||
chipFamily: "ESP32" | "ESP8266" | "ESP32-S2" | "ESP32-C3";
|
||||
improv: boolean;
|
||||
parts: {
|
||||
path: string;
|
||||
@ -12,12 +12,12 @@ export interface Manifest {
|
||||
builds: Build[];
|
||||
}
|
||||
|
||||
interface BaseFlashState {
|
||||
export interface BaseFlashState {
|
||||
state: State;
|
||||
message: string;
|
||||
manifest?: Manifest;
|
||||
build?: Build;
|
||||
chipFamily?: "ESP32" | "ESP8266" | "ESP32-S2" | "Unknown Chip";
|
||||
chipFamily?: Build["chipFamily"] | "Unknown Chip";
|
||||
}
|
||||
|
||||
export interface InitializingState extends BaseFlashState {
|
||||
|
@ -10,7 +10,7 @@ export const flash = async (
|
||||
) => {
|
||||
let manifest: Manifest;
|
||||
let build: Build | undefined;
|
||||
let chipFamily: "ESP32" | "ESP8266" | "ESP32-S2" | "Unknown Chip";
|
||||
let chipFamily: ReturnType<typeof getChipFamilyName>;
|
||||
|
||||
const fireStateEvent = (stateUpdate: FlashState) => {
|
||||
fireEvent(eventTarget, "state-changed", {
|
||||
|
@ -2,10 +2,14 @@ import {
|
||||
CHIP_FAMILY_ESP32,
|
||||
CHIP_FAMILY_ESP32S2,
|
||||
CHIP_FAMILY_ESP8266,
|
||||
CHIP_FAMILY_ESP32C3,
|
||||
ESPLoader,
|
||||
} from "esp-web-flasher";
|
||||
import type { BaseFlashState } from "./const";
|
||||
|
||||
export const getChipFamilyName = (esploader: ESPLoader) => {
|
||||
export const getChipFamilyName = (
|
||||
esploader: ESPLoader
|
||||
): NonNullable<BaseFlashState["chipFamily"]> => {
|
||||
switch (esploader.chipFamily) {
|
||||
case CHIP_FAMILY_ESP32:
|
||||
return "ESP32";
|
||||
@ -13,6 +17,8 @@ export const getChipFamilyName = (esploader: ESPLoader) => {
|
||||
return "ESP8266";
|
||||
case CHIP_FAMILY_ESP32S2:
|
||||
return "ESP32-S2";
|
||||
case CHIP_FAMILY_ESP32C3:
|
||||
return "ESP32-C3";
|
||||
default:
|
||||
return "Unknown Chip";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user