Skip to content
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

Add device name environment variable for web workflow #7846

Merged
merged 3 commits into from
Apr 11, 2023

Conversation

isacben
Copy link

@isacben isacben commented Apr 7, 2023

Hi,

This PR tries to resolve #7511

  1. Please let me know if the implementation is aligned with the web workflow design.
  2. I tried to update the documentation.
  3. Not sure if there is a settings.toml template that would need to be updated.
  4. Tested cp/version.json with a adafruit_feather_esp32s3_nopsram
  5. Could not test cp/devices.json because I only have one board with WIFI. It would be great if someone could help testing!

Thanks in adnvance!

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! One comment on memory allocation.

@@ -329,7 +335,8 @@ void supervisor_start_web_workflow(void) {
mdns_server_construct(&mdns, true);
mdns.base.type = &mdns_server_type;
if (!common_hal_mdns_server_deinited(&mdns)) {
common_hal_mdns_server_set_instance_name(&mdns, MICROPY_HW_BOARD_NAME);
char *instance_name = strndup(web_instance_name, strlen(web_instance_name));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this will work right because we don't usually use malloc() directly. Instead, I'd just add a static variable to hold the data. Memory allocation is tricky because it can happen via the MP heap or via supervisor.

Copy link
Author

@isacben isacben Apr 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Scott!
Didn't think of the static variable.
Just updated the PR. I tested again with the ESP32-S3. Please let me know if this would work.
Thanks!

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me now. Thanks!

@tannewt tannewt merged commit dbfe1e7 into adafruit:main Apr 11, 2023
@isacben
Copy link
Author

isacben commented Apr 11, 2023

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow definition of device name in settings.toml for web workflow.
2 participants