ENH: refine details of camera setting
Change-Id: Icb8365007f96b7dde372e7b121ec4f6e2ae96d7a
This commit is contained in:
parent
dd7dbd9936
commit
29e6f71402
6 changed files with 25 additions and 64 deletions
|
@ -1,4 +1,4 @@
|
|||
<svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M13.5699 18.8136C13.2001 18.8136 12.8521 18.6677 12.6159 18.4154C12.2586 18.0323 11.3947 17.3057 10.6987 17.3057C10.3786 17.3057 9.94978 17.4821 9.4961 17.8013C9.12011 18.0658 8.84666 18.3394 8.79383 18.3941C8.567 18.6343 8.19722 18.7832 7.83055 18.7832C7.67518 18.7832 7.52292 18.7559 7.39241 18.7042L7.36444 18.692L7.29608 18.6586L4.95 17.3635L4.89407 17.3179C4.50254 16.9835 4.36892 16.412 4.5709 15.9559C4.67345 15.7188 4.7791 15.3631 4.7791 15.0682C4.7791 13.7944 3.72259 12.7577 2.4206 12.7577H2.24969L2.17511 12.7425C1.81466 12.6665 1.52878 12.3169 1.42934 11.8275L1.42623 11.8184C1.40759 11.7119 1.23047 10.7513 1.23047 9.98821C1.23047 9.28594 1.37962 8.41647 1.42623 8.16718V8.1611C1.50392 7.75373 1.71833 7.42843 1.99488 7.29163L2.14404 7.21867H2.35845C3.01721 7.21867 3.63247 6.9785 4.08304 6.54376C4.53051 6.11207 4.77599 5.53141 4.77599 4.90211C4.77599 4.55857 4.63305 4.16336 4.57712 4.03871C4.35339 3.54318 4.50254 2.94732 4.93447 2.61898L4.96865 2.59466L5.04012 2.5521L7.51981 1.22053L7.58506 1.19925C7.70004 1.16277 7.82744 1.14453 7.95795 1.14453C8.32462 1.14453 8.68197 1.28742 8.91502 1.52758C9.19779 1.8164 10.0834 2.5673 10.7888 2.5673C11.4879 2.5673 12.386 1.81336 12.6439 1.54887L12.6501 1.54279C12.88 1.31174 13.2467 1.16885 13.6072 1.16885C13.7656 1.16885 13.9148 1.19621 14.0484 1.24789L14.0764 1.25702L14.1354 1.28742L16.525 2.59466L16.5809 2.6433C16.9818 2.98988 17.1185 3.5523 16.9134 4.01439C16.8171 4.23632 16.7052 4.59809 16.7052 4.89906C16.7052 6.17287 17.7617 7.20955 19.0637 7.20955C19.4118 7.20955 19.7163 7.39195 19.8965 7.70812C19.968 7.83277 20.0208 7.97565 20.0519 8.14286L20.055 8.15198C20.1513 8.66272 20.2539 9.41059 20.2539 9.97909C20.2601 10.5537 20.1575 11.2985 20.0612 11.8092C19.9524 12.3838 19.5827 12.7547 19.1134 12.7547C17.7648 12.7547 16.7114 13.7701 16.7114 15.0652C16.7114 15.354 16.814 15.7006 16.9103 15.9347C17.1403 16.4515 16.9662 17.0717 16.5064 17.3818L16.4691 17.4061L16.4318 17.4243L14.0049 18.7346L13.9397 18.7559C13.8247 18.7954 13.7004 18.8136 13.5699 18.8136Z" fill="#00AE42" fill-opacity="0.1" stroke="#00AE42" stroke-width="1.2" stroke-miterlimit="10"/>
|
||||
<path d="M10.7446 12.9742C9.05725 12.9742 7.68378 11.6335 7.68378 9.98272C7.68378 8.33194 9.05725 6.99125 10.7446 6.99125C12.4319 6.99125 13.8022 8.33194 13.8022 9.98272C13.8022 11.6305 12.4319 12.9742 10.7446 12.9742Z" fill="#00AE42" fill-opacity="0.1" stroke="#00AE42" stroke-width="1.2" stroke-miterlimit="10"/>
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M14.3694 1.92413L18.9283 9.82031L14.3694 17.7165L5.25168 17.7165L0.692819 9.82031L5.25168 1.92413L14.3694 1.92413Z" fill="#00AE42" fill-opacity="0.15" stroke="#00AE42" stroke-width="1.2"/>
|
||||
<circle cx="9.80791" cy="9.82119" r="2.92782" stroke="#00AE42" stroke-width="1.2"/>
|
||||
</svg>
|
||||
|
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 385 B |
|
@ -1,4 +1,4 @@
|
|||
<svg width="22" height="20" viewBox="0 0 22 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M13.5699 18.8136C13.2001 18.8136 12.8521 18.6677 12.6159 18.4154C12.2586 18.0323 11.3947 17.3057 10.6987 17.3057C10.3786 17.3057 9.94978 17.4821 9.4961 17.8013C9.12011 18.0658 8.84666 18.3394 8.79383 18.3941C8.567 18.6343 8.19722 18.7832 7.83055 18.7832C7.67518 18.7832 7.52292 18.7559 7.39241 18.7042L7.36444 18.692L7.29608 18.6586L4.95 17.3635L4.89407 17.3179C4.50254 16.9835 4.36892 16.412 4.5709 15.9559C4.67345 15.7188 4.7791 15.3631 4.7791 15.0682C4.7791 13.7944 3.72259 12.7577 2.4206 12.7577H2.24969L2.17511 12.7425C1.81466 12.6665 1.52878 12.3169 1.42934 11.8275L1.42623 11.8184C1.40759 11.7119 1.23047 10.7513 1.23047 9.98821C1.23047 9.28594 1.37962 8.41647 1.42623 8.16718V8.1611C1.50392 7.75373 1.71833 7.42843 1.99488 7.29163L2.14404 7.21867H2.35845C3.01721 7.21867 3.63247 6.9785 4.08304 6.54376C4.53051 6.11207 4.77599 5.53141 4.77599 4.90211C4.77599 4.55857 4.63305 4.16336 4.57712 4.03871C4.35339 3.54318 4.50254 2.94732 4.93447 2.61898L4.96865 2.59466L5.04012 2.5521L7.51981 1.22053L7.58506 1.19925C7.70004 1.16277 7.82744 1.14453 7.95795 1.14453C8.32462 1.14453 8.68197 1.28742 8.91502 1.52758C9.19779 1.8164 10.0834 2.5673 10.7888 2.5673C11.4879 2.5673 12.386 1.81336 12.6439 1.54887L12.6501 1.54279C12.88 1.31174 13.2467 1.16885 13.6072 1.16885C13.7656 1.16885 13.9148 1.19621 14.0484 1.24789L14.0764 1.25702L14.1354 1.28742L16.525 2.59466L16.5809 2.6433C16.9818 2.98988 17.1185 3.5523 16.9134 4.01439C16.8171 4.23632 16.7052 4.59809 16.7052 4.89906C16.7052 6.17287 17.7617 7.20955 19.0637 7.20955C19.4118 7.20955 19.7163 7.39195 19.8965 7.70812C19.968 7.83277 20.0208 7.97565 20.0519 8.14286L20.055 8.15198C20.1513 8.66272 20.2539 9.41059 20.2539 9.97909C20.2601 10.5537 20.1575 11.2985 20.0612 11.8092C19.9524 12.3838 19.5827 12.7547 19.1134 12.7547C17.7648 12.7547 16.7114 13.7701 16.7114 15.0652C16.7114 15.354 16.814 15.7006 16.9103 15.9347C17.1403 16.4515 16.9662 17.0717 16.5064 17.3818L16.4691 17.4061L16.4318 17.4243L14.0049 18.7346L13.9397 18.7559C13.8247 18.7954 13.7004 18.8136 13.5699 18.8136Z" fill="#00AE42" fill-opacity="0.1" stroke="#00AE42" stroke-width="1.5" stroke-miterlimit="10"/>
|
||||
<path d="M10.7446 12.9742C9.05725 12.9742 7.68378 11.6335 7.68378 9.98272C7.68378 8.33194 9.05725 6.99125 10.7446 6.99125C12.4319 6.99125 13.8022 8.33194 13.8022 9.98272C13.8022 11.6305 12.4319 12.9742 10.7446 12.9742Z" fill="#00AE42" fill-opacity="0.1" stroke="#00AE42" stroke-width="1.5" stroke-miterlimit="10"/>
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M14.2828 2.06436L18.7551 9.81055L14.2828 17.5567L5.33829 17.5567L0.866025 9.81055L5.33829 2.06436L14.2828 2.06436Z" fill="#00AE42" fill-opacity="0.15" stroke="#00AE42" stroke-width="1.5"/>
|
||||
<circle cx="9.80791" cy="9.81143" r="2.77782" stroke="#00AE42" stroke-width="1.5"/>
|
||||
</svg>
|
||||
|
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 385 B |
|
@ -43,17 +43,9 @@ CameraPopup::CameraPopup(wxWindow *parent, MachineObject* obj)
|
|||
top_sizer->AddGrowableCol(0);
|
||||
top_sizer->SetFlexibleDirection(wxBOTH);
|
||||
top_sizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
|
||||
//timelapse
|
||||
m_text_timelapse = new wxStaticText(m_panel, wxID_ANY, _L("Timelapse"));
|
||||
m_text_timelapse->Wrap(-1);
|
||||
m_text_timelapse->SetFont(Label::Head_14);
|
||||
m_text_timelapse->SetForegroundColour(TEXT_COL);
|
||||
m_switch_timelapse = new SwitchButton(m_panel);
|
||||
if (obj)
|
||||
m_switch_timelapse->SetValue(obj->camera_timelapse);
|
||||
|
||||
//recording
|
||||
m_text_recording = new wxStaticText(m_panel, wxID_ANY, _L("Video when printing"));
|
||||
m_text_recording = new wxStaticText(m_panel, wxID_ANY, _L("Auto-record Monitoring"));
|
||||
m_text_recording->Wrap(-1);
|
||||
m_text_recording->SetFont(Label::Head_14);
|
||||
m_text_recording->SetForegroundColour(TEXT_COL);
|
||||
|
@ -62,14 +54,12 @@ CameraPopup::CameraPopup(wxWindow *parent, MachineObject* obj)
|
|||
m_switch_recording->SetValue(obj->camera_recording_when_printing);
|
||||
|
||||
//vcamera
|
||||
m_text_vcamera = new wxStaticText(m_panel, wxID_ANY, _L("Virtual Camera"));
|
||||
m_text_vcamera = new wxStaticText(m_panel, wxID_ANY, _L("Go Live"));
|
||||
m_text_vcamera->Wrap(-1);
|
||||
m_text_vcamera->SetFont(Label::Head_14);
|
||||
m_text_vcamera->SetForegroundColour(TEXT_COL);
|
||||
m_switch_vcamera = new SwitchButton(m_panel);
|
||||
|
||||
top_sizer->Add(m_text_timelapse, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, FromDIP(5));
|
||||
top_sizer->Add(m_switch_timelapse, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, FromDIP(5));
|
||||
top_sizer->Add(m_text_recording, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, FromDIP(5));
|
||||
top_sizer->Add(m_switch_recording, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, FromDIP(5));
|
||||
top_sizer->Add(m_text_vcamera, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, FromDIP(5));
|
||||
|
@ -105,7 +95,6 @@ CameraPopup::CameraPopup(wxWindow *parent, MachineObject* obj)
|
|||
main_sizer->Fit(m_panel);
|
||||
|
||||
SetClientSize(m_panel->GetSize());
|
||||
m_switch_timelapse->Connect(wxEVT_LEFT_DOWN, wxCommandEventHandler(CameraPopup::on_switch_timelapse), NULL, this);
|
||||
m_switch_recording->Connect(wxEVT_LEFT_DOWN, wxCommandEventHandler(CameraPopup::on_switch_recording), NULL, this);
|
||||
m_switch_vcamera->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
||||
wxMouseEvent evt(EVT_VCAMERA_SWITCH);
|
||||
|
@ -127,18 +116,6 @@ void CameraPopup::sdcard_absent_hint()
|
|||
GetEventHandler()->ProcessEvent(evt);
|
||||
}
|
||||
|
||||
void CameraPopup::on_switch_timelapse(wxCommandEvent& event)
|
||||
{
|
||||
if (!m_obj) return;
|
||||
if (m_obj->sdcard_state != MachineObject::SdcardState::HAS_SDCARD_NORMAL) {
|
||||
sdcard_absent_hint();
|
||||
return;
|
||||
}
|
||||
bool value = m_switch_timelapse->GetValue();
|
||||
m_switch_timelapse->SetValue(!value);
|
||||
m_obj->command_ipcam_timelapse(!value);
|
||||
}
|
||||
|
||||
void CameraPopup::on_switch_recording(wxCommandEvent& event)
|
||||
{
|
||||
if (!m_obj) return;
|
||||
|
@ -178,7 +155,7 @@ wxWindow* CameraPopup::create_item_radiobox(wxString title, wxWindow* parent, wx
|
|||
int btn_idx = resolution_rbtns.size() - 1;
|
||||
radiobox->Bind(wxEVT_LEFT_DOWN, [this, btn_idx](wxMouseEvent &e) {
|
||||
if (m_obj && allow_alter_resolution) {
|
||||
select_curr_radiobox(btn_idx, false);
|
||||
select_curr_radiobox(btn_idx);
|
||||
on_set_resolution();
|
||||
}
|
||||
});
|
||||
|
@ -190,7 +167,7 @@ wxWindow* CameraPopup::create_item_radiobox(wxString title, wxWindow* parent, wx
|
|||
text->SetForegroundColour(0x6B6B6B);
|
||||
text->Bind(wxEVT_LEFT_DOWN, [this, btn_idx](wxMouseEvent &e) {
|
||||
if (m_obj && allow_alter_resolution) {
|
||||
select_curr_radiobox(btn_idx, false);
|
||||
select_curr_radiobox(btn_idx);
|
||||
on_set_resolution();
|
||||
}
|
||||
});
|
||||
|
@ -200,17 +177,17 @@ wxWindow* CameraPopup::create_item_radiobox(wxString title, wxWindow* parent, wx
|
|||
return item;
|
||||
}
|
||||
|
||||
void CameraPopup::select_curr_radiobox(int btn_idx, bool ui_change)
|
||||
void CameraPopup::select_curr_radiobox(int btn_idx)
|
||||
{
|
||||
if (!m_obj) return;
|
||||
|
||||
int len = resolution_rbtns.size();
|
||||
for (int i = 0; i < len; ++i) {
|
||||
if (i == btn_idx) {
|
||||
curr_sel_resolution = CameraResolution(i);
|
||||
if (ui_change)
|
||||
resolution_rbtns[i]->SetValue(true);
|
||||
}
|
||||
else {
|
||||
if (ui_change)
|
||||
resolution_rbtns[i]->SetValue(false);
|
||||
}
|
||||
}
|
||||
|
@ -229,7 +206,7 @@ void CameraPopup::sync_resolution_setting(std::string resolution)
|
|||
break;
|
||||
}
|
||||
}
|
||||
select_curr_radiobox(res, true);
|
||||
select_curr_radiobox(res);
|
||||
}
|
||||
|
||||
void CameraPopup::reset_resolution_setting()
|
||||
|
@ -259,14 +236,6 @@ void CameraPopup::sync_vcamera_state(bool show_vcamera)
|
|||
void CameraPopup::check_func_supported()
|
||||
{
|
||||
// function supported
|
||||
if (m_obj->is_function_supported(PrinterFunction::FUNC_TIMELAPSE) && m_obj->has_ipcam) {
|
||||
m_text_timelapse->Show();
|
||||
m_switch_timelapse->Show();
|
||||
} else {
|
||||
m_text_timelapse->Hide();
|
||||
m_switch_timelapse->Hide();
|
||||
}
|
||||
|
||||
if (m_obj->is_function_supported(PrinterFunction::FUNC_RECORDING) && m_obj->has_ipcam) {
|
||||
m_text_recording->Show();
|
||||
m_switch_recording->Show();
|
||||
|
@ -303,7 +272,6 @@ void CameraPopup::check_func_supported()
|
|||
void CameraPopup::update()
|
||||
{
|
||||
if (!m_obj) return;
|
||||
m_switch_timelapse->SetValue(m_obj->camera_timelapse);
|
||||
m_switch_recording->SetValue(m_obj->camera_recording_when_printing);
|
||||
sync_resolution_setting(m_obj->camera_resolution);
|
||||
|
||||
|
@ -348,13 +316,6 @@ void CameraPopup::OnLeftUp(wxMouseEvent &event)
|
|||
auto wxscroll_win_pos = m_panel->ClientToScreen(wxPoint(0, 0));
|
||||
|
||||
if (mouse_pos.x > wxscroll_win_pos.x && mouse_pos.y > wxscroll_win_pos.y && mouse_pos.x < (wxscroll_win_pos.x + m_panel->GetSize().x) && mouse_pos.y < (wxscroll_win_pos.y + m_panel->GetSize().y)) {
|
||||
//timelapse
|
||||
auto timelapse_rect = m_switch_timelapse->ClientToScreen(wxPoint(0, 0));
|
||||
if (mouse_pos.x > timelapse_rect.x && mouse_pos.y > timelapse_rect.y && mouse_pos.x < (timelapse_rect.x + m_switch_timelapse->GetSize().x) && mouse_pos.y < (timelapse_rect.y + m_switch_timelapse->GetSize().y)) {
|
||||
wxMouseEvent timelapse_evt(wxEVT_LEFT_DOWN);
|
||||
m_switch_timelapse->GetEventHandler()->ProcessEvent(timelapse_evt);
|
||||
return;
|
||||
}
|
||||
//recording
|
||||
auto recording_rect = m_switch_recording->ClientToScreen(wxPoint(0, 0));
|
||||
if (mouse_pos.x > recording_rect.x && mouse_pos.y > recording_rect.y && mouse_pos.x < (recording_rect.x + m_switch_recording->GetSize().x) && mouse_pos.y < (recording_rect.y + m_switch_recording->GetSize().y)) {
|
||||
|
|
|
@ -46,13 +46,12 @@ public:
|
|||
void rescale();
|
||||
|
||||
protected:
|
||||
void on_switch_timelapse(wxCommandEvent& event);
|
||||
void on_switch_recording(wxCommandEvent& event);
|
||||
void on_set_resolution();
|
||||
void sdcard_absent_hint();
|
||||
|
||||
wxWindow * create_item_radiobox(wxString title, wxWindow *parent, wxString tooltip, int padding_left);
|
||||
void select_curr_radiobox(int btn_idx, bool ui_change);
|
||||
void select_curr_radiobox(int btn_idx);
|
||||
void sync_resolution_setting(std::string resolution);
|
||||
void reset_resolution_setting();
|
||||
wxString to_resolution_label_string(CameraResolution resolution);
|
||||
|
@ -62,8 +61,6 @@ private:
|
|||
MachineObject* m_obj { nullptr };
|
||||
wxStaticText* m_text_recording;
|
||||
SwitchButton* m_switch_recording;
|
||||
wxStaticText* m_text_timelapse;
|
||||
SwitchButton* m_switch_timelapse;
|
||||
wxStaticText* m_text_vcamera;
|
||||
SwitchButton* m_switch_vcamera;
|
||||
wxStaticText* m_text_resolution;
|
||||
|
|
|
@ -1640,7 +1640,8 @@ int MachineObject::command_ipcam_record(bool on_off)
|
|||
j["camera"]["command"] = "ipcam_record_set";
|
||||
j["camera"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
j["camera"]["control"] = on_off ? "enable" : "disable";
|
||||
camera_recording_hold_count = HOLD_COUNT_MAX;
|
||||
camera_recording_hold_count = HOLD_COUNT_CAMERA;
|
||||
this->camera_recording_when_printing = on_off;
|
||||
return this->publish_json(j.dump());
|
||||
}
|
||||
|
||||
|
@ -1651,7 +1652,8 @@ int MachineObject::command_ipcam_timelapse(bool on_off)
|
|||
j["camera"]["command"] = "ipcam_timelapse";
|
||||
j["camera"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
j["camera"]["control"] = on_off ? "enable" : "disable";
|
||||
camera_timelapse_hold_count = HOLD_COUNT_MAX;
|
||||
camera_timelapse_hold_count = HOLD_COUNT_CAMERA;
|
||||
this->camera_timelapse = on_off;
|
||||
return this->publish_json(j.dump());
|
||||
}
|
||||
|
||||
|
@ -1662,8 +1664,9 @@ int MachineObject::command_ipcam_resolution_set(std::string resolution)
|
|||
j["camera"]["command"] = "ipcam_resolution_set";
|
||||
j["camera"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
j["camera"]["resolution"] = resolution;
|
||||
camera_resolution_hold_count = HOLD_COUNT_RESOLUTION;
|
||||
camera_recording_hold_count = HOLD_COUNT_RESOLUTION;
|
||||
camera_resolution_hold_count = HOLD_COUNT_CAMERA;
|
||||
camera_recording_hold_count = HOLD_COUNT_CAMERA;
|
||||
this->camera_resolution = resolution;
|
||||
return this->publish_json(j.dump());
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#define BED_TEMP_LIMIT 120
|
||||
|
||||
#define HOLD_COUNT_MAX 3
|
||||
#define HOLD_COUNT_RESOLUTION 6
|
||||
#define HOLD_COUNT_CAMERA 6
|
||||
#define GET_VERSION_RETRYS 10
|
||||
#define RETRY_INTERNAL 2000
|
||||
|
||||
|
|
Loading…
Reference in a new issue