NEW: select timelapse option when sending a print
Change-Id: I3a43d2ad038c397f45d1505d7eb7367746dd09ba Signed-off-by: Stone Li <stone.li@bambulab.com> (cherry picked from commit 7b26b69975746a6005fbc70728c1d16b1b120850)
This commit is contained in:
parent
d885052341
commit
12d0e0b7ea
|
@ -1739,6 +1739,12 @@ bool MachineObject::is_function_supported(PrinterFunction func)
|
|||
return DeviceManager::is_function_supported(printer_type, func_name);
|
||||
}
|
||||
|
||||
bool MachineObject::is_support_print_with_timelapse()
|
||||
{
|
||||
//TODO version check, set true by default
|
||||
return true;
|
||||
}
|
||||
|
||||
int MachineObject::publish_json(std::string json_str, int qos)
|
||||
{
|
||||
if (is_lan_mode_printer()) {
|
||||
|
|
|
@ -608,6 +608,7 @@ public:
|
|||
bool is_online() { return m_is_online; }
|
||||
bool is_info_ready();
|
||||
bool is_function_supported(PrinterFunction func);
|
||||
bool is_support_print_with_timelapse();
|
||||
|
||||
|
||||
/* Msg for display MsgFn */
|
||||
|
|
|
@ -88,6 +88,8 @@ std::string get_print_status_info(PrintDialogStatus status)
|
|||
return "PrintStatusLanModeNoSdcard";
|
||||
case PrintStatusNoSdcard:
|
||||
return "PrintStatusNoSdcard";
|
||||
case PrintStatusTimelapseNoSdcard:
|
||||
return "PrintStatusTimelapseNoSdcard";
|
||||
}
|
||||
return "unknown";
|
||||
}
|
||||
|
@ -1007,14 +1009,17 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
|
|||
m_sizer_select = new wxGridSizer(0, 2, 0, 0);
|
||||
select_bed = create_item_checkbox(_L("Bed Leveling"), this, _L("Bed Leveling"), "bed_leveling");
|
||||
select_flow = create_item_checkbox(_L("Flow Calibration"), this, _L("Flow Calibration"), "flow_cali");
|
||||
select_timelapse = create_item_checkbox(_L("Timelapse"), this, _L("Timelapse"), "timelapse");
|
||||
select_use_ams = create_ams_checkbox(_L("Enable AMS"), this, _L("Enable AMS"));
|
||||
|
||||
m_sizer_select->Add(select_bed);
|
||||
m_sizer_select->Add(select_flow);
|
||||
m_sizer_select->Add(select_timelapse);
|
||||
m_sizer_select->Add(select_use_ams);
|
||||
|
||||
select_bed->Show(true);
|
||||
select_flow->Show(true);
|
||||
select_timelapse->Show(false);
|
||||
select_use_ams->Show(true);
|
||||
|
||||
// line schedule
|
||||
|
@ -1229,6 +1234,13 @@ void SelectMachineDialog::update_select_layout(MachineObject *obj)
|
|||
select_bed->Hide();
|
||||
}
|
||||
|
||||
if (obj && obj->is_function_supported(PrinterFunction::FUNC_TIMELAPSE)
|
||||
&& obj->is_support_print_with_timelapse()) {
|
||||
select_timelapse->Show();
|
||||
} else {
|
||||
select_timelapse->Hide();
|
||||
}
|
||||
|
||||
Fit();
|
||||
}
|
||||
|
||||
|
@ -1508,6 +1520,22 @@ void SelectMachineDialog::update_print_status_msg(wxString msg, bool is_warning,
|
|||
}
|
||||
}
|
||||
|
||||
bool SelectMachineDialog::has_tips(MachineObject* obj)
|
||||
{
|
||||
if (!obj) return false;
|
||||
|
||||
// must set to a status if return true
|
||||
if (select_timelapse->IsShown() &&
|
||||
m_checkbox_list["timelapse"]->GetValue()) {
|
||||
if (!obj->has_sdcard()) {
|
||||
show_status(PrintDialogStatus::PrintStatusTimelapseNoSdcard);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxString> params)
|
||||
{
|
||||
if (m_print_status != status)
|
||||
|
@ -1637,6 +1665,11 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxSt
|
|||
update_print_status_msg(msg_text, true, true);
|
||||
Enable_Send_Button(true);
|
||||
Enable_Refresh_Button(true);
|
||||
} else if (status == PrintDialogStatus::PrintStatusTimelapseNoSdcard) {
|
||||
wxString msg_text = _L("An SD card needs to be inserted to recording timelapse");
|
||||
update_print_status_msg(msg_text, true, true);
|
||||
Enable_Send_Button(true);
|
||||
Enable_Refresh_Button(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1790,13 +1823,16 @@ void SelectMachineDialog::on_ok(wxCommandEvent &event)
|
|||
m_print_job->cloud_print_only = true;
|
||||
}
|
||||
|
||||
|
||||
bool timelapse_option = select_timelapse->IsShown() ? m_checkbox_list["timelapse"]->GetValue() : true;
|
||||
|
||||
m_print_job->set_print_config(
|
||||
MachineBedTypeString[0],
|
||||
m_checkbox_list["bed_leveling"]->GetValue(),
|
||||
m_checkbox_list["flow_cali"]->GetValue(),
|
||||
false,
|
||||
false,
|
||||
true);
|
||||
timelapse_option);
|
||||
|
||||
if (obj_->has_ams()) {
|
||||
m_print_job->task_use_ams = ams_check->GetValue();
|
||||
|
@ -1804,6 +1840,7 @@ void SelectMachineDialog::on_ok(wxCommandEvent &event)
|
|||
m_print_job->task_use_ams = false;
|
||||
}
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "print_job: timelapse_option = " << timelapse_option;
|
||||
BOOST_LOG_TRIVIAL(info) << "print_job: use_ams = " << m_print_job->task_use_ams;
|
||||
|
||||
m_print_job->on_success([this]() { finish_mode(); });
|
||||
|
@ -2138,8 +2175,6 @@ void SelectMachineDialog::update_show_status()
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// check sdcard when if lan mode printer
|
||||
if (obj_->is_lan_mode_printer()) {
|
||||
if (!obj_->has_sdcard()) {
|
||||
|
@ -2150,6 +2185,7 @@ void SelectMachineDialog::update_show_status()
|
|||
|
||||
// no ams
|
||||
if (!obj_->has_ams()) {
|
||||
if (!has_tips(obj_))
|
||||
show_status(PrintDialogStatus::PrintStatusReadingFinished);
|
||||
return;
|
||||
}
|
||||
|
@ -2202,10 +2238,13 @@ void SelectMachineDialog::update_show_status()
|
|||
}
|
||||
else {
|
||||
if (obj_->is_valid_mapping_result(m_ams_mapping_result)) {
|
||||
if (!has_tips(obj_))
|
||||
show_status(PrintDialogStatus::PrintStatusAmsMappingValid);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
show_status(PrintDialogStatus::PrintStatusAmsMappingInvalid);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2308,6 +2347,7 @@ void SelectMachineDialog::set_default()
|
|||
// checkbox default values
|
||||
m_checkbox_list["bed_leveling"]->SetValue(true);
|
||||
m_checkbox_list["flow_cali"]->SetValue(true);
|
||||
m_checkbox_list["timelapse"]->SetValue(true);
|
||||
ams_check->SetValue(true);
|
||||
|
||||
// thumbmail
|
||||
|
|
|
@ -252,7 +252,8 @@ enum PrintDialogStatus {
|
|||
PrintStatusSending,
|
||||
PrintStatusSendingCanceled,
|
||||
PrintStatusLanModeNoSdcard,
|
||||
PrintStatusNoSdcard
|
||||
PrintStatusNoSdcard,
|
||||
PrintStatusTimelapseNoSdcard
|
||||
};
|
||||
|
||||
std::string get_print_status_info(PrintDialogStatus status);
|
||||
|
@ -326,6 +327,7 @@ protected:
|
|||
|
||||
wxWindow *select_bed{nullptr};
|
||||
wxWindow *select_flow{nullptr};
|
||||
wxWindow *select_timelapse { nullptr };
|
||||
wxWindow *select_use_ams{nullptr};
|
||||
CheckBox *ams_check{nullptr};
|
||||
|
||||
|
@ -351,6 +353,7 @@ public:
|
|||
bool do_ams_mapping(MachineObject *obj_);
|
||||
bool get_ams_mapping_result(std::string &mapping_array_str, std::string &ams_mapping_info);
|
||||
void prepare(int print_plate_idx);
|
||||
bool has_tips(MachineObject* obj);
|
||||
void show_status(PrintDialogStatus status, std::vector<wxString> params = std::vector<wxString>());
|
||||
PrintDialogStatus get_status() { return m_print_status; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue