Skip to content

Commit

Permalink
Add some delay within data loop to give other processes on the core t…
Browse files Browse the repository at this point in the history
…ime to process
  • Loading branch information
suchmememanyskill committed Jan 8, 2024
1 parent e0ab861 commit ae55ae0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions CYD-Klipper/src/core/data_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Printer printer = {0};
int klipper_request_consecutive_fail_count = 0;
char filename_buff[512] = {0};
SemaphoreHandle_t freezeRenderThreadSemaphore, freezeRequestThreadSemaphore;
const long data_update_interval = 800;
const long data_update_interval = 780;

void semaphore_init(){
freezeRenderThreadSemaphore = xSemaphoreCreateMutex();
Expand Down Expand Up @@ -72,6 +72,7 @@ void fetch_printer_data()
client.useHTTP10(true);
client.begin(buff);
int httpCode = client.GET();
delay(10);
if (httpCode == 200)
{
klipper_request_consecutive_fail_count = 0;
Expand All @@ -80,7 +81,7 @@ void fetch_printer_data()
auto status = doc["result"]["status"];
bool emit_state_update = false;
int printer_state = printer.state;

delay(10);
unfreeze_request_thread();
frozen = false;
freeze_render_thread();
Expand Down

0 comments on commit ae55ae0

Please sign in to comment.