[wifi] Reject WiFi config on RP2040/RP2350 boards without CYW43 chip (#14990)
This commit is contained in:
1 parent
6e87f8eb4e
commit
02ada93ea5
5 files changed
+84
-5
No files matched your search
@@ -24,6 +24,7 @@ from esphome.const import (
|
||||
from esphome.core import CORE, CoroPriority, EsphomeError, coroutine_with_priority
|
||||
from esphome.helpers import copy_file_if_changed, read_file, write_file_if_changed
|
||||
|
||||
from . import boards
|
||||
from .const import KEY_BOARD, KEY_PIO_FILES, KEY_RP2040, rp2040_ns
|
||||
|
||||
# force import gpio to register pin schema
|
||||
@@ -35,6 +36,23 @@ AUTO_LOAD = ["preferences"]
|
||||
IS_TARGET_PLATFORM = True
|
||||
|
||||
|
||||
def get_board() -> str:
|
||||
"""Return the configured board name."""
|
||||
return CORE.data[KEY_RP2040][KEY_BOARD]
|
||||
|
||||
|
||||
def board_has_wifi() -> bool:
|
||||
"""Return True if the configured board has WiFi (CYW43 wireless chip).
|
||||
|
||||
Returns True for unknown/custom boards to avoid rejecting valid
|
||||
configurations for boards not in the generated list.
|
||||
"""
|
||||
board_info = boards.BOARDS.get(get_board())
|
||||
if board_info is None:
|
||||
return True
|
||||
return board_info.get("wifi", False)
|
||||
|
||||
|
||||
def set_core_data(config):
|
||||
CORE.data[KEY_RP2040] = {}
|
||||
CORE.data[KEY_CORE][KEY_TARGET_PLATFORM] = PLATFORM_RP2040
|
||||
|
||||
Reference in new issue
Block a user