4545
4646#if CIRCUITPY_WEB_WORKFLOW
4747#include "supervisor/shared/web_workflow/web_workflow.h"
48- #endif
4948static background_callback_t workflow_background_cb = {NULL , NULL };
49+ #endif
50+
5051
5152// Called during a VM reset. Doesn't actually reset things.
5253void supervisor_workflow_reset (void ) {
@@ -56,17 +57,23 @@ void supervisor_workflow_reset(void) {
5657
5758 #if CIRCUITPY_WEB_WORKFLOW
5859 if (workflow_background_cb .fun ) {
59- supervisor_start_web_workflow ();
60- supervisor_workflow_request_background ();
60+ if (supervisor_start_web_workflow ()) {
61+ supervisor_workflow_request_background ();
62+ }
6163 }
6264 #endif
6365}
6466
6567void supervisor_workflow_request_background (void ) {
68+ #if CIRCUITPY_WEB_WORKFLOW
6669 if (workflow_background_cb .fun ) {
6770 workflow_background_cb .data = NULL ;
6871 background_callback_add_core (& workflow_background_cb );
72+ } else {
73+ // Unblock polling thread if necessary
74+ socketpool_socket_poll_resume ();
6975 }
76+ #endif
7077}
7178
7279// Return true if host has completed connection to us (such as USB enumeration).
@@ -98,9 +105,11 @@ void supervisor_workflow_start(void) {
98105 #endif
99106
100107 #if CIRCUITPY_WEB_WORKFLOW
101- supervisor_start_web_workflow ();
102- memset (& workflow_background_cb , 0 , sizeof (workflow_background_cb ));
103- workflow_background_cb .fun = supervisor_web_workflow_background ;
108+ if (supervisor_start_web_workflow ()) {
109+ // Enable background callbacks if web_workflow startup successful
110+ memset (& workflow_background_cb , 0 , sizeof (workflow_background_cb ));
111+ workflow_background_cb .fun = supervisor_web_workflow_background ;
112+ }
104113 #endif
105114
106115}
0 commit comments