Skip to content

Commit 05d2013

Browse files
authored
Merge pull request #6778 from tannewt/fix_s2_bootloop
Guard against workflow background happening early
2 parents 3e60ec3 + 704ecc3 commit 05d2013

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

supervisor/shared/web_workflow/websocket.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ void websocket_handoff(socketpool_socket_obj_t *socket) {
7878
}
7979

8080
bool websocket_connected(void) {
81-
return !cp_serial.closed && common_hal_socketpool_socket_get_connected(&cp_serial.socket);
81+
return _incoming_ringbuf.size > 0 && !cp_serial.closed && common_hal_socketpool_socket_get_connected(&cp_serial.socket);
8282
}
8383

8484
static bool _read_byte(uint8_t *c) {

supervisor/shared/workflow.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
#endif
4949
static background_callback_t workflow_background_cb;
5050

51+
static bool workflow_started = false;
52+
5153
static void workflow_background(void *data) {
5254
#if CIRCUITPY_WEB_WORKFLOW
5355
supervisor_web_workflow_background();
@@ -70,6 +72,9 @@ void supervisor_workflow_reset(void) {
7072
}
7173

7274
void supervisor_workflow_request_background(void) {
75+
if (!workflow_started) {
76+
return;
77+
}
7378
background_callback_add_core(&workflow_background_cb);
7479
}
7580

@@ -116,6 +121,8 @@ void supervisor_workflow_start(void) {
116121
#if CIRCUITPY_WEB_WORKFLOW
117122
supervisor_start_web_workflow();
118123
#endif
124+
125+
workflow_started = true;
119126
}
120127

121128
FRESULT supervisor_workflow_mkdir_parents(FATFS *fs, char *path) {

0 commit comments

Comments
 (0)