cleanup moonraker and snapmaker printer agents

This commit is contained in:
Ian Chua
2026-08-25 16:39:08 +08:00
parent c0563be36e
commit c729849843
8 changed files with 43 additions and 102 deletions
-13
View File
@@ -2315,9 +2315,6 @@ void StatusPanel::update_camera_state(MachineObject* obj)
const bool has_printer_webcam = !obj->webcam_stream_url.empty();
if (has_printer_webcam) {
if (m_printer_webcam_url != obj->webcam_stream_url) {
// why: start timing belongs to the loaded camera.
// carrying it across printers suppresses the new camera's initial start.
m_camera_start_sent = std::chrono::steady_clock::time_point{};
m_custom_camera_view->LoadURL(obj->webcam_stream_url);
m_custom_camera_view->Show();
m_media_ctrl->Hide();
@@ -2331,19 +2328,9 @@ void StatusPanel::update_camera_state(MachineObject* obj)
m_media_ctrl->Hide();
m_media_play_ctrl->Hide();
}
// why: printers like the U1 capture only while asked and retire the capture task ~362 s
// after each start, so the open camera view has to renew ahead of that. 300 s matches
// Snapmaker's own client. Agents that do not need it refuse the call silently.
const auto now = std::chrono::steady_clock::now();
if (m_camera_start_sent == std::chrono::steady_clock::time_point{} ||
now - m_camera_start_sent >= std::chrono::seconds(300)) {
obj->command_start_camera();
m_camera_start_sent = now;
}
} else if (!m_printer_webcam_url.empty()) {
handle_camera_source_change();
m_printer_webcam_url.clear();
m_camera_start_sent = std::chrono::steady_clock::time_point{};
}
//sdcard