mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-16 21:42:43 +00:00
Show Snapmaker U1 camera in Device tab
The U1 exposes no /server/webcams/list entry; its camera only captures after an explicit camera.start_monitor RPC, which the Moonraker websocket executes unauthenticated but only answers over MQTT - so the call is fire and forget. Start the camera when the camera view is shown and renew every 300 s: the printer retires the capture task at ~362 s and stop_monitor is accepted but ineffective, so teardown is simply to stop renewing. Frames land in monitor.jpg as still JPEGs (~2 fps at interval 0), so the webview loads a local HTML wrapper that repolls with a cache buster.
This commit is contained in:
@@ -2328,9 +2328,19 @@ 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
|
||||
|
||||
Reference in New Issue
Block a user