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
-2
View File
@@ -1793,8 +1793,6 @@ int MachineObject::command_ams_refresh_rfid2(int ams_id, int slot_id)
int MachineObject::command_start_camera()
{
if (!m_agent) return -1;
// why: this fires from the camera view's renew timer, so a refusal must stay silent -
// show_unsupported_dlg() here would pop a dialog every ~5 min on every other printer.
return m_agent->command_start_camera(get_dev_id());
}
-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
-2
View File
@@ -666,8 +666,6 @@ protected:
int m_last_extrusion = -1;
int m_last_vcamera = -1;
std::string m_printer_webcam_url;
// note: zero = not started; see update_camera_state() for the renew interval.
std::chrono::steady_clock::time_point m_camera_start_sent{};
int m_model_mall_request_count = 0;
bool m_is_load_with_temp = false;
json m_rating_result;