diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index 5f15b1aef..a0ec8e2a9 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -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()) { diff --git a/src/slic3r/GUI/DeviceManager.hpp b/src/slic3r/GUI/DeviceManager.hpp index ea3ed548b..e141fe181 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -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 */ diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index bf2f5360a..68d695614 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -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 params) { if (m_print_status != status) @@ -1637,6 +1665,11 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vectorcloud_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,7 +2185,8 @@ void SelectMachineDialog::update_show_status() // no ams if (!obj_->has_ams()) { - show_status(PrintDialogStatus::PrintStatusReadingFinished); + 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)) { - show_status(PrintDialogStatus::PrintStatusAmsMappingValid); + 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 diff --git a/src/slic3r/GUI/SelectMachine.hpp b/src/slic3r/GUI/SelectMachine.hpp index 8ec2c1f53..fbbb03a64 100644 --- a/src/slic3r/GUI/SelectMachine.hpp +++ b/src/slic3r/GUI/SelectMachine.hpp @@ -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 params = std::vector()); PrintDialogStatus get_status() { return m_print_status; }