add rp2040 support to the wizard (#6239)

This commit is contained in:
fodfodfod 2024-05-19 20:42:30 -04:00 committed by GitHub
parent 91e7a44c31
commit b9bb3cd4be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -277,6 +277,7 @@ def wizard(path):
from esphome.components.esp32 import boards as esp32_boards from esphome.components.esp32 import boards as esp32_boards
from esphome.components.esp8266 import boards as esp8266_boards from esphome.components.esp8266 import boards as esp8266_boards
from esphome.components.rtl87xx import boards as rtl87xx_boards from esphome.components.rtl87xx import boards as rtl87xx_boards
from esphome.components.rp2040 import boards as rp2040_boards
if not path.endswith(".yaml") and not path.endswith(".yml"): if not path.endswith(".yaml") and not path.endswith(".yml"):
safe_print( safe_print(
@ -343,7 +344,7 @@ def wizard(path):
"firmwares for it." "firmwares for it."
) )
wizard_platforms = ["ESP32", "ESP8266", "BK72XX", "RTL87XX"] wizard_platforms = ["ESP32", "ESP8266", "BK72XX", "RTL87XX", "RP2040"]
safe_print( safe_print(
"Please choose one of the supported microcontrollers " "Please choose one of the supported microcontrollers "
"(Use ESP8266 for Sonoff devices)." "(Use ESP8266 for Sonoff devices)."
@ -373,6 +374,10 @@ def wizard(path):
board_link = ( board_link = (
"http://docs.platformio.org/en/latest/platforms/espressif8266.html#boards" "http://docs.platformio.org/en/latest/platforms/espressif8266.html#boards"
) )
elif platform == "RP2040":
board_link = (
"https://www.raspberrypi.com/documentation/microcontrollers/rp2040.html"
)
elif platform in ["BK72XX", "RTL87XX"]: elif platform in ["BK72XX", "RTL87XX"]:
board_link = "https://docs.libretiny.eu/docs/status/supported/" board_link = "https://docs.libretiny.eu/docs/status/supported/"
else: else:
@ -397,6 +402,10 @@ def wizard(path):
elif platform == "RTL87XX": elif platform == "RTL87XX":
safe_print(f"For example \"{color(Fore.BOLD_WHITE, 'wr3')}\".") safe_print(f"For example \"{color(Fore.BOLD_WHITE, 'wr3')}\".")
boards_list = rtl87xx_boards.BOARDS.items() boards_list = rtl87xx_boards.BOARDS.items()
elif platform == "RP2040":
safe_print(f"For example \"{color(Fore.BOLD_WHITE, 'rpipicow')}\".")
boards_list = rp2040_boards.BOARDS.items()
else: else:
raise NotImplementedError("Unknown platform!") raise NotImplementedError("Unknown platform!")
@ -423,6 +432,8 @@ def wizard(path):
safe_print() safe_print()
sleep(1) sleep(1)
# Do not create wifi if the board does not support it
if board not in ["rpipico"]:
safe_print_step(3, WIFI_BIG) safe_print_step(3, WIFI_BIG)
safe_print("In this step, I'm going to create the configuration for WiFi.") safe_print("In this step, I'm going to create the configuration for WiFi.")
safe_print() safe_print()
@ -477,6 +488,8 @@ def wizard(path):
sleep(0.25) sleep(0.25)
safe_print("Press ENTER for no password") safe_print("Press ENTER for no password")
password = safe_input(color(Fore.BOLD_WHITE, "(password): ")) password = safe_input(color(Fore.BOLD_WHITE, "(password): "))
else:
ssid, password, psk = "", "", ""
if not wizard_write( if not wizard_write(
path=path, path=path,