Skip to content

Allow web_workflow to startup after deep sleep alarm wakeup #7814

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 1 commit into from
Mar 30, 2023

Conversation

thess
Copy link

@thess thess commented Mar 29, 2023

On ESP32 based systems, web_workflow does not restart after deep-sleep. Simple patch to allow it attached.

Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

Makes sense -- thanks!

@dhalbert dhalbert merged commit 55c3e9f into adafruit:main Mar 30, 2023
@tannewt
Copy link
Member

tannewt commented Apr 3, 2023

I did this deliberately because starting up the web workflow is slow. We don't start USB for the same reason. I'd prefer to make this a setting rather than changing the behavior for everyone.

@thess
Copy link
Author

thess commented Apr 3, 2023

I guess the slow part is due to wifi setup. In principle I could agree with you except when you already have a app that connects to wifi at startup anyway. In order to guarantee that you can reach your device for maintenance upgrades (not OS), a reliable and robust web-workflow is required. There are a couple of other issues in this area I am working on. It seems the RPi variant is somewhat more solid than the ESP32. Perhaps due to the different "threading" models - callbacks vs polling.

It may also be desirable to be able to turn it on and off from within a CP applet. I guess if after you wake from a deep-sleep, you could then do a reset to have the power-on reason change - but why jump thru hoops?

@thess thess deleted the deep-sleep-wakeup branch April 3, 2023 18:16
@tannewt
Copy link
Member

tannewt commented Apr 4, 2023

I've added this to our In the Weeds section of next week's community meeting to discuss it.

@dhalbert
Copy link
Collaborator

dhalbert commented Apr 4, 2023

I was thinking that for an app in "production", you wouldn't want the web workflow running, to reduce power draw or startup time, or to prevent it interfering with the app in some way. But during development, you want to test it with real sleep, and would want it to start up.

@thess
Copy link
Author

thess commented Apr 4, 2023

Ideally, one would probably want web_workflow operational whenever an app wasn't running. When an app starts, workflow should shut down. The part about not allowing it to startup after a deep-sleep is a separate issue. Perhaps not trying to start workflow every time a script is launched (including safeboot.py & boot.py) but waiting until you find nothing to run automatically would suffice. However, using the remote serial console can have its uses during script execution. Not having a cool feature like web_workflow available when you need it makes the feature less desirable.

I would like to point out here that the system load the current implementation causes is due to looping background processes (workflow and socket select threads) which can happen. It also consumes an unnecessary extra socket while accepting an inbound request. I you would like, I can post my web_workflow work as a PR for further testing and review. It has some substantial changes to socket handling and thread control.

@dhalbert
Copy link
Collaborator

dhalbert commented Apr 4, 2023

@thess We would welcome a PR for your web workflow improvements!

@Neradoc
Copy link

Neradoc commented Apr 4, 2023

Ideally, one would probably want web_workflow operational whenever an app wasn't running. When an app starts, workflow should shut down.

That would completely defeat the purpose. There is always "an app running", it's code.py, and the workflow is to edit the code, save, and auto-reload. You don't want to block the access to the workflow when the code is running. You might want to manually turn it off "in production" when you are happy with your code.

@thess
Copy link
Author

thess commented Apr 5, 2023

@Neradoc - agree with your use case. I was being a bit too facetious 😉

@thess
Copy link
Author

thess commented Apr 5, 2023

@dhalbert - you got it #7836

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.

4 participants