Retry slicer print time fetch

This commit is contained in:
suchmememanyskill
2024-02-20 23:20:33 +01:00
parent c9f8935310
commit b5ac6d045a
2 changed files with 10 additions and 5 deletions

View File

@@ -123,6 +123,8 @@ void move_printer(const char* axis, float amount, bool relative) {
} }
} }
int last_slicer_time_query = -15000;
void fetch_printer_data() void fetch_printer_data()
{ {
freeze_request_thread(); freeze_request_thread();
@@ -298,13 +300,16 @@ void fetch_printer_data()
if (printer.state != printer_state || emit_state_update) if (printer.state != printer_state || emit_state_update)
{ {
if (printer_state == PRINTER_STATE_PRINTING){
printer.slicer_estimated_print_time_s = get_slicer_time_estimate_s();
}
printer.state = printer_state; printer.state = printer_state;
lv_msg_send(DATA_PRINTER_STATE, &printer); lv_msg_send(DATA_PRINTER_STATE, &printer);
} }
if (printer.state == PRINTER_STATE_PRINTING && millis() - last_slicer_time_query > 30000 && printer.slicer_estimated_print_time_s <= 0)
{
delay(10);
last_slicer_time_query = millis();
printer.slicer_estimated_print_time_s = get_slicer_time_estimate_s();
}
unfreeze_render_thread(); unfreeze_render_thread();
} }

View File

@@ -48,7 +48,7 @@ connection_status_t verify_ip(){
client.addHeader("X-Api-Key", global_config.klipper_auth); client.addHeader("X-Api-Key", global_config.klipper_auth);
httpCode = client.GET(); httpCode = client.GET();
Serial.printf("%d %s", httpCode, url.c_str()); Serial.printf("%d %s\n", httpCode, url.c_str());
if (httpCode == 401) if (httpCode == 401)
return CONNECT_AUTH_REQUIRED; return CONNECT_AUTH_REQUIRED;