[core] Allow specifying custom UF2 firmware name and version

This commit is contained in:
Kuba Szczodrzyński
2022-06-03 12:11:12 +02:00
parent 4c27aa57b1
commit 17dc1dcf8c
3 changed files with 34 additions and 5 deletions

View File

@@ -77,6 +77,7 @@ def find_pkg_root(self, path: str, spec: PackageSpec):
class LibretuyaPlatform(PlatformBase):
boards_base: Dict[str, dict] = {}
custom_opts: Dict[str, object] = {}
def configure_default_packages(self, options, targets):
framework = options.get("pioframework")[0]
@@ -141,8 +142,18 @@ class LibretuyaPlatform(PlatformBase):
global libretuya_packages
libretuya_packages = self.packages
# save custom options from env
self.custom_opts = {}
for key, value in options.items():
if not key.startswith("custom_"):
continue
self.custom_opts[key[7:]] = value
return super().configure_default_packages(options, targets)
def custom(self, key: str) -> object:
return self.custom_opts.get(key, None)
def get_boards(self, id_=None):
result = PlatformBase.get_boards(self, id_)
if not result: