From 3c29f34e73faee57b85bf5bc8551a1f14fffb81f Mon Sep 17 00:00:00 2001 From: "liz.li" Date: Wed, 19 Jul 2023 16:15:42 +0800 Subject: [PATCH] ENH: show calibration result failed info Change-Id: I07b8d2d5065ea7e77084d6eae8988e5ab7008172 --- src/slic3r/GUI/DeviceManager.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index bc9712461..eef6300f6 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -3838,9 +3838,27 @@ int MachineObject::parse_json(std::string payload) } catch(...) { } - } else if (jj["command"].get() == "extrusion_cali") { - if (jj.contains("result") && jj["result"].get() == "success") { - // enter extrusion cali + } else if (jj["command"].get() == "extrusion_cali" || jj["command"].get() == "flowrate_cali") { + if (jj.contains("result")) { + if (jj["result"].get() == "success") { + ; + } + else if (jj["result"].get() == "fail") { + std::string cali_mode = jj["command"].get(); + std::string reason = jj["reason"].get(); + GUI::wxGetApp().CallAfter([cali_mode, reason] { + wxString info = ""; + if (reason == "invalid nozzle_diameter") { + info = _L("Invalid nozzle diameter"); + } + else { + info = reason; + } + GUI::MessageDialog msg_dlg(nullptr, info, _L("Calibration error"), wxICON_WARNING | wxOK); + msg_dlg.ShowModal(); + BOOST_LOG_TRIVIAL(trace) << cali_mode << " result fail, reason = " << reason; + }); + } } } else if (jj["command"].get() == "extrusion_cali_set") { #ifdef CALI_DEBUG