Skip to content

Commit

Permalink
Lock UI thread when setting state to offline, fix #86
Browse files Browse the repository at this point in the history
  • Loading branch information
suchmememanyskill committed Apr 14, 2024
1 parent dce6f70 commit 356c78e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CYD-Klipper/src/core/data_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,16 +305,18 @@ void fetch_printer_data()
}
else
{
unfreeze_request_thread();
klipper_request_consecutive_fail_count++;

if (klipper_request_consecutive_fail_count == 5)
{
freeze_render_thread();
printer.state = PRINTER_STATE_OFFLINE;
lv_msg_send(DATA_PRINTER_STATE, &printer);
unfreeze_render_thread();
}

Serial.printf("Failed to fetch printer data: %d\n", httpCode);
unfreeze_request_thread();
}
}

Expand Down

0 comments on commit 356c78e

Please sign in to comment.