Skip to content

Correctly use earlephilhower.varant if variant not given, ensure USB… #444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions tools/platformio-build.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,13 @@ def configure_usb_flags(cpp_defines):
("USB_PID", usb_pid),
("USB_MANUFACTURER", '\\"%s\\"' % usb_manufacturer),
("USB_PRODUCT", '\\"%s\\"' % usb_product),
("SERIALUSB_PID", usb_pid),
("USBD_MAX_POWER_MA", 250)
("SERIALUSB_PID", usb_pid)
])

if "USBD_MAX_POWER_MA" not in env.Flatten(env.get("CPPDEFINES", [])):
env.Append(CPPDEFINES=[("USBD_MAX_POWER_MA", 500)])
print("Warning: Undefined USBD_MAX_OWER_MA, assuming 500mA")

# use vidtouse and pidtouse
# for USB PID/VID autodetection
hw_ids = board.get("build.hwids", [["0x2E8A", "0x00C0"]])
Expand Down Expand Up @@ -195,9 +198,9 @@ def configure_usb_flags(cpp_defines):

libs = []

variant = board.get("build.arduino.earlephilhower.variant", board.get("build.variant", None))
variant = board.get("build.arduino.earlephilhower.variant", board.get("build.variant", ""))

if variant is not None:
if variant != "":
env.Append(CPPPATH=[
os.path.join(FRAMEWORK_DIR, "variants", variant)
])
Expand Down