From 09ab775667cdf0c52aa956e92acd7b7688a4aa3f Mon Sep 17 00:00:00 2001 From: tao wang Date: Thu, 1 Dec 2022 20:27:05 +0800 Subject: [PATCH] ENH:blocking send/send all on p1p printers Change-Id: If6ed8056790211d6ffa8237136318768e1a7f5d7 --- resources/config.json | 3 ++- src/slic3r/GUI/DeviceManager.cpp | 3 +++ src/slic3r/GUI/DeviceManager.hpp | 1 + src/slic3r/GUI/SelectMachine.hpp | 3 ++- src/slic3r/GUI/SendToPrinter.cpp | 13 ++++++++++++- src/slic3r/GUI/UpgradePanel.cpp | 16 ++++++++++------ 6 files changed, 30 insertions(+), 9 deletions(-) diff --git a/resources/config.json b/resources/config.json index 660cbfca3..8f72f43dc 100644 --- a/resources/config.json +++ b/resources/config.json @@ -18,7 +18,8 @@ "FUNC_REMOTE_TUNNEL": false, "FUNC_LOCAL_TUNNEL": true, "FUNC_PRINT_WITHOUT_SD": false, - "FUNC_ALTER_RESOLUTION": false + "FUNC_ALTER_RESOLUTION": false, + "FUNC_SEND_TO_SDCARD": false }, "camera_resolution":["720p"], "bed_temperature_limit": 100, diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index 59b35e37d..412c2e99c 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -1951,6 +1951,9 @@ bool MachineObject::is_function_supported(PrinterFunction func) case FUNC_ALTER_RESOLUTION: func_name = "FUNC_ALTER_RESOLUTION"; break; + case FUNC_SEND_TO_SDCARD: + func_name = "FUNC_SEND_TO_SDCARD"; + break; default: return true; } diff --git a/src/slic3r/GUI/DeviceManager.hpp b/src/slic3r/GUI/DeviceManager.hpp index 835d78f53..b4d9aa5fd 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -79,6 +79,7 @@ enum PrinterFunction { FUNC_VIRTUAL_CAMERA, FUNC_USE_AMS, FUNC_ALTER_RESOLUTION, + FUNC_SEND_TO_SDCARD, FUNC_MAX }; diff --git a/src/slic3r/GUI/SelectMachine.hpp b/src/slic3r/GUI/SelectMachine.hpp index c58ca5057..5ca62b942 100644 --- a/src/slic3r/GUI/SelectMachine.hpp +++ b/src/slic3r/GUI/SelectMachine.hpp @@ -258,7 +258,8 @@ enum PrintDialogStatus { PrintStatusTimelapseNoSdcard, PrintStatusNotOnTheSameLAN, PrintStatusNeedForceUpgrading, - PrintStatusNeedConsistencyUpgrading + PrintStatusNeedConsistencyUpgrading, + PrintStatusNotSupportedSendToSDCard }; std::string get_print_status_info(PrintDialogStatus status); diff --git a/src/slic3r/GUI/SendToPrinter.cpp b/src/slic3r/GUI/SendToPrinter.cpp index 77512b168..92f439571 100644 --- a/src/slic3r/GUI/SendToPrinter.cpp +++ b/src/slic3r/GUI/SendToPrinter.cpp @@ -915,7 +915,12 @@ void SendToPrinterDialog::update_show_status() return; } - + bool is_suppt = obj_->is_function_supported(PrinterFunction::FUNC_SEND_TO_SDCARD); + if (!is_suppt) { + show_status(PrintDialogStatus::PrintStatusNotSupportedSendToSDCard); + return; + } + show_status(PrintDialogStatus::PrintStatusReadingFinished); } @@ -1024,6 +1029,12 @@ void SendToPrinterDialog::show_status(PrintDialogStatus status, std::vectornew_ver_list.find("ota"); if (ota_it == obj->new_ver_list.end()) { - wxString ver_text = wxString::Format("%s(%s)", it->second.sw_ver, _L("Latest version")); - m_staticText_ver_val->SetLabelText(ver_text); - m_ota_new_version_img->Hide(); + if (it != obj->module_vers.end()) { + wxString ver_text = wxString::Format("%s(%s)", it->second.sw_ver, _L("Latest version")); + m_staticText_ver_val->SetLabelText(ver_text); + m_ota_new_version_img->Hide(); + } } else { if (ota_it->second.sw_new_ver != ota_it->second.sw_ver) { m_ota_new_version_img->Show(); wxString ver_text = wxString::Format("%s->%s", ota_it->second.sw_ver, ota_it->second.sw_new_ver); m_staticText_ver_val->SetLabelText(ver_text); } else { - m_ota_new_version_img->Hide(); - wxString ver_text = wxString::Format("%s(%s)", it->second.sw_ver, _L("Latest version")); - m_staticText_ver_val->SetLabelText(ver_text); + if (it != obj->module_vers.end()) { + m_ota_new_version_img->Hide(); + wxString ver_text = wxString::Format("%s(%s)", it->second.sw_ver, _L("Latest version")); + m_staticText_ver_val->SetLabelText(ver_text); + } } } }