forked from viewit/OrcaSlicer-KX
* FIX: linux: fix the building issue on Linux Mint 21.3 Virginia github: https://github.com/bambulab/BambuStudio/issues/3874 author: https://github.com/lucianoloder Change-Id: Ia3db6923d5dd68dba532d7bdba6f93f73cc51d59 * FIX: auto-arranging incorrect with rotation enabled auto-arranging incorrect with rotation enabled and the objects already have been rotated. jira: STUDIO-6022 Change-Id: I349d663efb1fc71367c8a77aa8ed5047a0bf2017 (cherry picked from commit 75fe40257a274ed83886e1ee20ce8dedd0de48f6) * ENH: update X1C & X1E start gcode 1.Fix fan problem jira:NEW Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: I68ee5be78e142e8a2a210a1a70f5663893390610 * ENH: update A series gcode 1. Update A1 series start gcode and change filament gcode 2. Add G2814 command 3. Add multi-filament extrusion compensation and vibration suppression jira:NEW Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: I57d2bc8e98d3e547881dc1369c1fb31413c6205d * FIX: fix some cali problem of P series jira: none Change-Id: Id57ea8d65da22ab653cca49509cb923ff065e43f * FIX: fix can't enter ',' in multiplicator github: #3805 Change-Id: I6dd70822d1c2e79d66c70514d6dd580ab029c7ea * calib wizard * NEW: FlipLines infill jira:6701 New infill pattern that combine block lines infill and switching layers for smooth transition. Change-Id: I2608a2d39b14efcdfe9d39a9437280da350b94c0 (cherry picked from commit 8d0a09c8b763dfc924cbba9913c241e6afadbc7f) * ENH: add nozzle blob detection and air printing detection jira: new Change-Id: Ie4a19a7ad7d0b10a021c516cbc3a84b4ae734302 * FIX: Top surface bridging fail on 3DHC & FL infill Add 45 degree angle offset when processing the bridge. Need to raise infill_direction to invalidate posPrepareInfill jira: 6774 Change-Id: I5e6bef3aa814b01c5f30398ac745937a67e3ef4c (cherry picked from commit 7b12cab10b88f432a11414f8caa1c6427777a1ba) * FIX: the error display when reset virtual slot jira: none Change-Id: I5ae5899baf1bfc2aaadb832083b277855a669fd5 * FIX: Error "Voronoi cell doesn't contain a sourcepoint" github: 3859 Change-Id: Idca84992bcba5380bfe05e63ac9a5e40419dcfdf * fix build error * FIX: CLI: fix the crash issue caused by get_min_flush_volumes JIRA: no jira Change-Id: I0d5bfd605e51ebddac8fddc4d83dab5055b0fbf2 * FIX: can't use support filament in gcode.3mf 1. Add total_filament_volumes, directly access it to get used filaments github:#3865 Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: I4fae4f1947b4ebd16e394e0f3cf5fb0e9f979717 * ENH: p series support long retraction 1. P series support long retraction in filament 2. Add long retraction params in common.json jira:NEW Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: Ib94184fa1f0b5ab151360f1f053d8c8ff92e7e18 * ENH::modify some logs level jira:[for log] Change-Id: I6a46b8fcd3a030b4b630e800fe9a9ac5c387f117 * NEW: support multi device JIRA: STUDIO-6072 Change-Id: Ic514c4097767b0a728368c9ea48ee103c031fbb0 Signed-off-by: Stone Li <stone.li@bambulab.com> * ENH: update A1 series gcode 1.Update filament change gcode and machine start gcode for A1 and A1 mini jira:NEW Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: I2f3be3fd89fef21e717a32f2b89985fc046f7f6e * FIX: always have 0th filament in ams mapping 1. Only set the filament id in map when flush length is not 0 jira:NEW Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: I6e0aeaf010f6e6dcbdc3bca5c0034aa60750bb67 * ENH: add filament id in slice info jira:NEW Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: Ic5fe4632bca8acacc9ffd072ee2ed207c1da37aa * ENH: refine ui for multi machine JIRA: STUDIO-6819 STUDIO-6824 1. Shrink the Send Print dialog box 2. add input box for flipping panel Change-Id: I4174c79ecd239c374ee11478951e12be399c57ce * FIX: fix Issues with sending multiple devices JIRA: STUDIO-6876 Signed-off-by: Kunlong Ma <kunlong.ma@bambulab.com> Change-Id: I33c6a932863fc715c3f0eb5dfd4b299f980a4918 * NEW: support hms error code Change-Id: Ic256a83cf501fb05bb9d3203f3d24cb1d1290fa4 * FIX:fixed some multi job issue Change-Id: I338078ad8fcf809888db9d8daeb470a9bf4eab46 * NEW:support pin code binding Change-Id: Ida5d47881fbd83f3ffedc80369cfe377114d7f13 * ENH:add printable check for devices Change-Id: I672988fa9cfa986d924bfc64331752f4aef68067 (cherry picked from commit 69de9e5b8334ec94eec7fcee31038b8ff42d1d3b) * FIX: add more fonts jira: none Change-Id: I6bafed3563083858f29e92a3d84906a2e53dcb5c (cherry picked from commit afbea693e807dcc1c406a59aa5376b9ea2a5d606) * ENH: load more fonts this feature is according to Prusa by Filip Sykala<filip.sykala@prusa3d.cz>, thanks to Filip Sykala jira: none Change-Id: I55e92f184f750c0b93b679d4382aaa5b164ec5c3 (cherry picked from commit d05522c4cc5d7ee4cac42de398b88d347a55f74b) * ENH: add ProfileDescription for translate 1.Add ProfileDescription.hpp simply for translating jira:NEW Signed-off-by: XunZhangBambu <xun.zhang@bambulab.com> Change-Id: Iaa3ced1edccf67eaeebde35c1e8b36442d2e9a6f * ENH: Improve CrossHatch transation layers jira: 6701 Change name from Flippingline to CrossHatch. Reduce noise, improve speed by 6.5%. Improve transation layers by gradually increasing rotation angle and overshoot the transation layer while direction changed. Change-Id: I17fcc45b409074d121bf5bb5702e15553d925b51 * UP * ENH: modify the default config for multi-device JIRA: STUDIO-6072 Change-Id: If6e7582a8274eb5e685b8b8545f6eab5d17de3f5 Signed-off-by: Stone Li <stone.li@bambulab.com> * ENH: add long retraction for P series jira:NEW Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: I6890695b67e674fc5cdc2a208e89bd9e41404213 * FIX: all plates stats data missing issue jira: new Change-Id: I137a2b6d69ad08791f5a9a9788653621960dc63f * ENH:update pre print options jira:[for multi] Change-Id: I2e9bb8a09436a71749af98a0bad94e9922f95c81 * FIX:fixed can't popup pinbind win on macos jira:[STUDIO-6895] Change-Id: I664bba78cf27420d736b586df19e3c09c6f8ed21 * FIX:fixed the task of padding cannot be cancelled Change-Id: I401a22118c14ca7601be7a925cfd8e4796dfc1e9 * ENH:Play video after redirecting to device page jira:[STUDIO-6884] Change-Id: Ia5e2ac84e3d71baacfcf941b782dab2325f35d54 * FIX: fix ui bug in send multi machine page for mac JIRA: STUDIO-6882 Incorrect background color when renaming during multi machine printing Change-Id: I6c551f5023ffe747e7a7e2f5703b0707c9505922 * FIX: Fix some bugs in maintaining the selected status of local tasks JIRA: STUDIO-6824 Change-Id: I12c4da3fc56ac5077b3ccd7e89a4b57c3675eaf5 * ENH: local task sort by send time by default JIRA: STUDIO-6885 Change-Id: I03b5881a39ab2e90c5b9cf46052ba465ee707ccc * FIX: Clicking to continue printing does not take effect in error code JIRA: STUDIO-6830 Detected an incomplete printing task error pop-up when power outage occurred. Clicking to continue printing did not take effect Change-Id: Ie85a1602093dabac861cd1f41ea21e1c312c83e9 * ENH: use designTitle when designId > 0 JIRA: STUDIO-6072 Change-Id: I8342df053edeab16f930522e099e2eef91e5c5a4 Signed-off-by: Stone Li <stone.li@bambulab.com> * NEW:import vertex and mtl color from obj file Jira: STUDIO-6805 Change-Id: Iaacb13ee2451effdb83e5aba4b7fe1637b7fc95f * FIX:change the strategy of merge_ka_kd Upgrade ui, users can directly ok to proceed to the next step jira: STUDIO-6805 Change-Id: Ia81019c2eacb503666680c0b8583d026baa0134c (cherry picked from commit 38a2434753c8e3b422267283b16c75f6ad195b14) * FIX:use default_strategy after modifed cluster number jira: STUDIO-6915 Change-Id: I4e0c3d62f5a766f73d48d1e06c4364fc6babe1ac * FIX: the bug of incorrect button without restarting JIRA: STUDIO-6824 The bug can cause the user to not restart when opening the multi-device option, but the button of send multi-devices appears Change-Id: I0837fa79ecc1d8ab5ce98273ad134fa2f830421e * FIX: wrong default value for long retraction jira:NEW Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: Ifc2ec57a320fdb14e7ca746e5795501ed146ff32 * FIX: error code pop-up window without retry button in some code JIRA: STUDIO-6922 Change-Id: I67464bebaba4558618301592c455db8824bbfe30 * FIX: air printing and nozzle blob detection issue jira: STUDIO-6897 Change-Id: I008ddb24b74119d7e4124ae26310b4b86c42a799 * FIX:fix bugs of algo and read quad in obj file Jira: STUDIO-6805 Change-Id: I6c33e8197225f27dccdfa0681e64d76d1df14f61 * dd * ENH:Set the default nozzle diameter to 0.4 jira:[for nozzle] Change-Id: I74a5c9b0460046496b897eae3d9f917ac1b99052 * FIX:fixed backspace error on macos Change-Id: I76066391783c04857c1a60a6f8438111501b6d7c * ENH:Subscription list deduplication jira:[for mulit] Change-Id: I10e9d849986c9661b587c7b1a509180c2451816e * ENH:update wiki url for Pin Code jira:[pin code] Change-Id: I95faaa396a839b5b159119ef235b650c76706a84 * NEW:add OpenCV.cmake in deps jira: none Change-Id: I1ae4a2bd5618e9e620b08a937904d6af5d00bc41 * FIX:cancel obj import restrictions jira: none Change-Id: Iaf3e799ca982ad6aeb3ec76e9a416c4c8e4d100c * NEW:add multiple printer restrictions jira:[for multiple] Change-Id: I0bb5a0c1062a543c42f8d67a9347efa358b0864a * ENH:Added two entrances for adding devices jira:[multi device] Change-Id: Ieb6197e067d422979606f93b22b337a2399aec74 * slic3r: Fix wxFont being undefined [427/494] Building CXX object src/slic3r/CMakeFiles/libslic3r_gui.dir/Utils/FontUtils.cpp.o FAILED: src/slic3r/CMakeFiles/libslic3r_gui.dir/Utils/FontUtils.cpp.o /usr/bin/c++ -DBOOST_ATOMIC_NO_LIB -DBOOST_CHRONO_NO_LIB -DBOOST_DATE_TIME_NO_LIB -DBOOST_FILESYSTEM_NO_LIB -DBOOST_IOSTREAMS_NO_LIB -DBOOST_LOCALE_NO_LIB -DBOOST_LOG_NO_LIB -DBOOST_REGEX_NO_LIB -DBOOST_SYSTEM_NO_LIB -DBOOST_THREAD_NO_LIB -DCURL_STATICLIB -DGLEW_STATIC -DLIBNEST2D_GEOMETRIES_libslic3r -DLIBNEST2D_OPTIMIZER_nlopt -DLIBNEST2D_STATIC -DLIBNEST2D_THREADING_tbb -DOPENSSL_CERT_OVERRIDE -DOPENVDB_OPENEXR_STATICLIB -DOPENVDB_STATICLIB -DSLIC3R_CURRENTLY_COMPILING_GUI_MODULE -DSLIC3R_GUI -DTBB_USE_CAPTURED_EXCEPTION=0 -DUNICODE -DUSE_TBB -DWXINTL_NO_GETTEXT_MACRO -D_UNICODE -D__WXGTK3__ -D__WXGTK__ -DwxDEBUG_LEVEL=0 -DwxNO_UNSAFE_WXSTRING_CONV -DwxUSE_UNICODE -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/run/build/BambuStudio/src -I/run/build/BambuStudio/build/src/platform -I/run/build/BambuStudio/src/hidapi/include -I/run/build/BambuStudio/src/slic3r/Utils -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/webp -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/atk-1.0 -I/usr/include/fribidi -I/usr/include/pixman-1 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gio-unix-2.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/sysprof-6 -I/usr/include/gstreamer-1.0 -I/run/build/BambuStudio/build/src/libslic3r -I/run/build/BambuStudio/deps/build/destdir/usr/local/include/opencascade -I/run/build/BambuStudio/src/libnest2d/include -I/run/build/BambuStudio/src/miniz -I/run/build/BambuStudio/src/glu-libtess/include -I/run/build/BambuStudio/src/clipper2/Clipper2Lib/include -I/run/build/BambuStudio/src/minilzo -isystem /run/build/BambuStudio/src/eigen -isystem /run/build/BambuStudio/src/libigl -isystem /app/lib/wx/include/gtk3-unicode-static-3.1 -isystem /app/include/wx-3.1 -isystem /run/build/BambuStudio/deps/build/destdir/usr/local/include -isystem /run/build/BambuStudio/deps/build/destdir/usr/local/include/opencv4 -isystem /run/build/BambuStudio/deps/build/destdir/usr/local/include/OpenEXR -std=gnu++20 -fext-numeric-literals -Wall -Wno-reorder -pthread -O3 -DNDEBUG -std=gnu++17 -fPIC -fsigned-char -Werror=return-type -Wno-ignored-attributes -Wno-unknown-pragmas -DOPENVDB_ABI_VERSION_NUMBER=8 -MD -MT src/slic3r/CMakeFiles/libslic3r_gui.dir/Utils/FontUtils.cpp.o -MF src/slic3r/CMakeFiles/libslic3r_gui.dir/Utils/FontUtils.cpp.o.d -o src/slic3r/CMakeFiles/libslic3r_gui.dir/Utils/FontUtils.cpp.o -c /run/build/BambuStudio/src/slic3r/Utils/FontUtils.cpp In file included from /run/build/BambuStudio/src/slic3r/Utils/FontUtils.cpp:1: /run/build/BambuStudio/src/slic3r/Utils/FontUtils.hpp:51:21: error: ‘wxFont’ does not name a type 51 | bool can_load(const wxFont &font); | ^~~~~~ * slic3r: Fix missing BOOST_LOG_TRIVIAL declaration [427/494] Building CXX object src/slic3r/CMakeFiles/libslic3r_gui.dir/Utils/FontUtils.cpp.o FAILED: src/slic3r/CMakeFiles/libslic3r_gui.dir/Utils/FontUtils.cpp.o /usr/bin/c++ -DBOOST_ATOMIC_NO_LIB -DBOOST_CHRONO_NO_LIB -DBOOST_DATE_TIME_NO_LIB -DBOOST_FILESYSTEM_NO_LIB -DBOOST_IOSTREAMS_NO_LIB -DBOOST_LOCALE_NO_LIB -DBOOST_LOG_NO_LIB -DBOOST_REGEX_NO_LIB -DBOOST_SYSTEM_NO_LIB -DBOOST_THREAD_NO_LIB -DCURL_STATICLIB -DGLEW_STATIC -DLIBNEST2D_GEOMETRIES_libslic3r -DLIBNEST2D_OPTIMIZER_nlopt -DLIBNEST2D_STATIC -DLIBNEST2D_THREADING_tbb -DOPENSSL_CERT_OVERRIDE -DOPENVDB_OPENEXR_STATICLIB -DOPENVDB_STATICLIB -DSLIC3R_CURRENTLY_COMPILING_GUI_MODULE -DSLIC3R_GUI -DTBB_USE_CAPTURED_EXCEPTION=0 -DUNICODE -DUSE_TBB -DWXINTL_NO_GETTEXT_MACRO -D_UNICODE -D__WXGTK3__ -D__WXGTK__ -DwxDEBUG_LEVEL=0 -DwxNO_UNSAFE_WXSTRING_CONV -DwxUSE_UNICODE -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/run/build/BambuStudio/src -I/run/build/BambuStudio/build/src/platform -I/run/build/BambuStudio/src/hidapi/include -I/run/build/BambuStudio/src/slic3r/Utils -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/webp -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/atk-1.0 -I/usr/include/fribidi -I/usr/include/pixman-1 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gio-unix-2.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/sysprof-6 -I/usr/include/gstreamer-1.0 -I/run/build/BambuStudio/build/src/libslic3r -I/run/build/BambuStudio/deps/build/destdir/usr/local/include/opencascade -I/run/build/BambuStudio/src/libnest2d/include -I/run/build/BambuStudio/src/miniz -I/run/build/BambuStudio/src/glu-libtess/include -I/run/build/BambuStudio/src/clipper2/Clipper2Lib/include -I/run/build/BambuStudio/src/minilzo -isystem /run/build/BambuStudio/src/eigen -isystem /run/build/BambuStudio/src/libigl -isystem /app/lib/wx/include/gtk3-unicode-static-3.1 -isystem /app/include/wx-3.1 -isystem /run/build/BambuStudio/deps/build/destdir/usr/local/include -isystem /run/build/BambuStudio/deps/build/destdir/usr/local/include/opencv4 -isystem /run/build/BambuStudio/deps/build/destdir/usr/local/include/OpenEXR -std=gnu++20 -fext-numeric-literals -Wall -Wno-reorder -pthread -O3 -DNDEBUG -std=gnu++17 -fPIC -fsigned-char -Werror=return-type -Wno-ignored-attributes -Wno-unknown-pragmas -DOPENVDB_ABI_VERSION_NUMBER=8 -MD -MT src/slic3r/CMakeFiles/libslic3r_gui.dir/Utils/FontUtils.cpp.o -MF src/slic3r/CMakeFiles/libslic3r_gui.dir/Utils/FontUtils.cpp.o.d -o src/slic3r/CMakeFiles/libslic3r_gui.dir/Utils/FontUtils.cpp.o -c /run/build/BambuStudio/src/slic3r/Utils/FontUtils.cpp /run/build/BambuStudio/src/slic3r/Utils/FontUtils.cpp: In function ‘std::unique_ptr<Slic3r::FontFile> Slic3r::create_font_file(const char*)’: /run/build/BambuStudio/src/slic3r/Utils/FontUtils.cpp:127:27: error: ‘error’ was not declared in this scope; did you mean ‘perror’? 127 | BOOST_LOG_TRIVIAL(error) << "Couldn't open " << file_path << " for reading."; | ^~~~~ | perror [447/494] Building CXX object src/slic3r/CMakeFiles/libslic3r_gui.dir/GUI/TaskManager.cpp.o FAILED: src/slic3r/CMakeFiles/libslic3r_gui.dir/GUI/TaskManager.cpp.o /usr/bin/c++ -DBOOST_ATOMIC_NO_LIB -DBOOST_CHRONO_NO_LIB -DBOOST_DATE_TIME_NO_LIB -DBOOST_FILESYSTEM_NO_LIB -DBOOST_IOSTREAMS_NO_LIB -DBOOST_LOCALE_NO_LIB -DBOOST_LOG_NO_LIB -DBOOST_REGEX_NO_LIB -DBOOST_SYSTEM_NO_LIB -DBOOST_THREAD_NO_LIB -DCURL_STATICLIB -DGLEW_STATIC -DLIBNEST2D_GEOMETRIES_libslic3r -DLIBNEST2D_OPTIMIZER_nlopt -DLIBNEST2D_STATIC -DLIBNEST2D_THREADING_tbb -DOPENSSL_CERT_OVERRIDE -DOPENVDB_OPENEXR_STATICLIB -DOPENVDB_STATICLIB -DSLIC3R_CURRENTLY_COMPILING_GUI_MODULE -DSLIC3R_GUI -DTBB_USE_CAPTURED_EXCEPTION=0 -DUNICODE -DUSE_TBB -DWXINTL_NO_GETTEXT_MACRO -D_UNICODE -D__WXGTK3__ -D__WXGTK__ -DwxDEBUG_LEVEL=0 -DwxNO_UNSAFE_WXSTRING_CONV -DwxUSE_UNICODE -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/run/build/BambuStudio/src -I/run/build/BambuStudio/build/src/platform -I/run/build/BambuStudio/src/hidapi/include -I/run/build/BambuStudio/src/slic3r/Utils -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/webp -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/atk-1.0 -I/usr/include/fribidi -I/usr/include/pixman-1 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gio-unix-2.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/sysprof-6 -I/usr/include/gstreamer-1.0 -I/run/build/BambuStudio/build/src/libslic3r -I/run/build/BambuStudio/deps/build/destdir/usr/local/include/opencascade -I/run/build/BambuStudio/src/libnest2d/include -I/run/build/BambuStudio/src/miniz -I/run/build/BambuStudio/src/glu-libtess/include -I/run/build/BambuStudio/src/clipper2/Clipper2Lib/include -I/run/build/BambuStudio/src/minilzo -isystem /run/build/BambuStudio/src/eigen -isystem /run/build/BambuStudio/src/libigl -isystem /app/lib/wx/include/gtk3-unicode-static-3.1 -isystem /app/include/wx-3.1 -isystem /run/build/BambuStudio/deps/build/destdir/usr/local/include -isystem /run/build/BambuStudio/deps/build/destdir/usr/local/include/opencv4 -isystem /run/build/BambuStudio/deps/build/destdir/usr/local/include/OpenEXR -std=gnu++20 -fext-numeric-literals -Wall -Wno-reorder -pthread -O3 -DNDEBUG -std=gnu++17 -fPIC -fsigned-char -Werror=return-type -Wno-ignored-attributes -Wno-unknown-pragmas -DOPENVDB_ABI_VERSION_NUMBER=8 -MD -MT src/slic3r/CMakeFiles/libslic3r_gui.dir/GUI/TaskManager.cpp.o -MF src/slic3r/CMakeFiles/libslic3r_gui.dir/GUI/TaskManager.cpp.o.d -o src/slic3r/CMakeFiles/libslic3r_gui.dir/GUI/TaskManager.cpp.o -c /run/build/BambuStudio/src/slic3r/GUI/TaskManager.cpp In file included from /run/build/BambuStudio/src/slic3r/GUI/TaskManager.cpp:1: /run/build/BambuStudio/src/slic3r/GUI/TaskManager.hpp: In member function ‘void Slic3r::TaskStateInfo::set_state(Slic3r::TaskState)’: /run/build/BambuStudio/src/slic3r/GUI/TaskManager.hpp:40:9: error: ‘BOOST_LOG_TRIVIAL’ was not declared in this scope 40 | BOOST_LOG_TRIVIAL(trace) << "TaskStateInfo set state = " << get_task_state_enum_str(ts); | ^~~~~~~~~~~~~~~~~ * fix OpenCV * wip - build break * fix build error wip * ENH: support preset description(tooltip) Change-Id: Iff005baac4974c538d1109fb0ba1df20b04a8f69 Jira: STUDIO-5754 * fix more build errors * Revert "ENH: load more fonts" This reverts commit 32b6fd199ac50e21db1f72089e5b3287a1776e04. * change colors * misc fixes * restore export gcode btn --------- Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Signed-off-by: Stone Li <stone.li@bambulab.com> Signed-off-by: Kunlong Ma <kunlong.ma@bambulab.com> Signed-off-by: XunZhangBambu <xun.zhang@bambulab.com> Co-authored-by: lane.wei <lane.wei@bambulab.com> Co-authored-by: Arthur <arthur.tang@bambulab.com> Co-authored-by: xun.zhang <xun.zhang@bambulab.com> Co-authored-by: zhimin.zeng <zhimin.zeng@bambulab.com> Co-authored-by: Kunlong Ma <kunlong.ma@bambulab.com> Co-authored-by: jianjia.ma <jianjia.ma@bambulab.com> Co-authored-by: liz.li <liz.li@bambulab.com> Co-authored-by: tao wang <tao.wang@bambulab.com> Co-authored-by: Stone Li <stone.li@bambulab.com> Co-authored-by: zhou.xu <zhou.xu@bambulab.com> Co-authored-by: Bastien Nocera <hadess@hadess.net> Co-authored-by: chunmao.guo <chunmao.guo@bambulab.com>
1921 lines
67 KiB
C++
1921 lines
67 KiB
C++
#include <regex>
|
|
#include "CalibrationWizardPresetPage.hpp"
|
|
#include "I18N.hpp"
|
|
#include "Widgets/Label.hpp"
|
|
#include "MsgDialog.hpp"
|
|
#include "libslic3r/Print.hpp"
|
|
|
|
namespace Slic3r { namespace GUI {
|
|
static int PA_LINE = 0;
|
|
static int PA_PATTERN = 1;
|
|
|
|
CaliPresetCaliStagePanel::CaliPresetCaliStagePanel(
|
|
wxWindow* parent,
|
|
wxWindowID id,
|
|
const wxPoint& pos,
|
|
const wxSize& size,
|
|
long style)
|
|
: wxPanel(parent, id, pos, size, style)
|
|
{
|
|
SetBackgroundColour(*wxWHITE);
|
|
|
|
m_top_sizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
create_panel(this);
|
|
|
|
this->SetSizer(m_top_sizer);
|
|
m_top_sizer->Fit(this);
|
|
}
|
|
|
|
void CaliPresetCaliStagePanel::create_panel(wxWindow* parent)
|
|
{
|
|
auto title = new Label(parent, _L("Calibration Type"));
|
|
title->SetFont(Label::Head_14);
|
|
m_top_sizer->Add(title);
|
|
m_top_sizer->AddSpacer(FromDIP(15));
|
|
|
|
m_complete_radioBox = new wxRadioButton(parent, wxID_ANY, _L("Complete Calibration"));
|
|
m_complete_radioBox->SetForegroundColour(*wxBLACK);
|
|
|
|
m_complete_radioBox->SetValue(true);
|
|
m_stage = CALI_MANUAL_STAGE_1;
|
|
m_top_sizer->Add(m_complete_radioBox);
|
|
m_top_sizer->AddSpacer(FromDIP(10));
|
|
m_fine_radioBox = new wxRadioButton(parent, wxID_ANY, _L("Fine Calibration based on flow ratio"));
|
|
m_fine_radioBox->SetForegroundColour(*wxBLACK);
|
|
m_top_sizer->Add(m_fine_radioBox);
|
|
|
|
input_panel = new wxPanel(parent);
|
|
input_panel->Hide();
|
|
auto input_sizer = new wxBoxSizer(wxHORIZONTAL);
|
|
input_panel->SetSizer(input_sizer);
|
|
flow_ratio_input = new TextInput(input_panel, wxEmptyString, "", "", wxDefaultPosition, CALIBRATION_FROM_TO_INPUT_SIZE);
|
|
flow_ratio_input->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
|
|
float default_flow_ratio = 1.0f;
|
|
auto flow_ratio_str = wxString::Format("%.2f", default_flow_ratio);
|
|
flow_ratio_input->GetTextCtrl()->SetValue(flow_ratio_str);
|
|
input_sizer->AddSpacer(FromDIP(18));
|
|
input_sizer->Add(flow_ratio_input, 0, wxTOP, FromDIP(10));
|
|
m_top_sizer->Add(input_panel);
|
|
|
|
m_top_sizer->AddSpacer(PRESET_GAP);
|
|
// events
|
|
m_complete_radioBox->Bind(wxEVT_RADIOBUTTON, [this](auto& e) {
|
|
m_stage_panel_parent->get_current_object()->flow_ratio_calibration_type = COMPLETE_CALIBRATION;
|
|
input_panel->Show(false);
|
|
m_stage = CALI_MANUAL_STAGE_1;
|
|
GetParent()->Layout();
|
|
GetParent()->Fit();
|
|
});
|
|
m_fine_radioBox->Bind(wxEVT_RADIOBUTTON, [this](auto& e) {
|
|
m_stage_panel_parent->get_current_object()->flow_ratio_calibration_type = FINE_CALIBRATION;
|
|
input_panel->Show();
|
|
m_stage = CALI_MANUAL_STAGE_2;
|
|
GetParent()->Layout();
|
|
GetParent()->Fit();
|
|
});
|
|
flow_ratio_input->GetTextCtrl()->Bind(wxEVT_TEXT_ENTER, [this](auto& e) {
|
|
float flow_ratio = 0.0f;
|
|
if (!CalibUtils::validate_input_flow_ratio(flow_ratio_input->GetTextCtrl()->GetValue(), &flow_ratio)) {
|
|
MessageDialog msg_dlg(nullptr, _L("Please input a valid value (0.0 < flow ratio < 2.0)"), wxEmptyString, wxICON_WARNING | wxOK);
|
|
msg_dlg.ShowModal();
|
|
}
|
|
auto flow_ratio_str = wxString::Format("%.3f", flow_ratio);
|
|
flow_ratio_input->GetTextCtrl()->SetValue(flow_ratio_str);
|
|
m_flow_ratio_value = flow_ratio;
|
|
});
|
|
flow_ratio_input->GetTextCtrl()->Bind(wxEVT_KILL_FOCUS, [this](auto& e) {
|
|
float flow_ratio = 0.0f;
|
|
if (!CalibUtils::validate_input_flow_ratio(flow_ratio_input->GetTextCtrl()->GetValue(), &flow_ratio)) {
|
|
MessageDialog msg_dlg(nullptr, _L("Please input a valid value (0.0 < flow ratio < 2.0)"), wxEmptyString, wxICON_WARNING | wxOK);
|
|
msg_dlg.ShowModal();
|
|
}
|
|
auto flow_ratio_str = wxString::Format("%.3f", flow_ratio);
|
|
flow_ratio_input->GetTextCtrl()->SetValue(flow_ratio_str);
|
|
m_flow_ratio_value = flow_ratio;
|
|
e.Skip();
|
|
});
|
|
Bind(wxEVT_LEFT_DOWN, [this](auto& e) {
|
|
SetFocusIgnoringChildren();
|
|
});
|
|
}
|
|
|
|
void CaliPresetCaliStagePanel::set_cali_stage(CaliPresetStage stage, float value)
|
|
{
|
|
if (stage == CaliPresetStage::CALI_MANUAL_STAGE_1) {
|
|
wxCommandEvent radioBox_evt(wxEVT_RADIOBUTTON);
|
|
radioBox_evt.SetEventObject(m_complete_radioBox);
|
|
wxPostEvent(m_complete_radioBox, radioBox_evt);
|
|
m_stage = stage;
|
|
}
|
|
else if(stage == CaliPresetStage::CALI_MANUAL_STAGE_2){
|
|
wxCommandEvent radioBox_evt(wxEVT_RADIOBUTTON);
|
|
radioBox_evt.SetEventObject(m_fine_radioBox);
|
|
wxPostEvent(m_fine_radioBox, radioBox_evt);
|
|
m_stage = stage;
|
|
m_flow_ratio_value = value;
|
|
}
|
|
}
|
|
|
|
void CaliPresetCaliStagePanel::get_cali_stage(CaliPresetStage& stage, float& value)
|
|
{
|
|
stage = m_stage;
|
|
value = (m_stage == CALI_MANUAL_STAGE_2) ? m_flow_ratio_value : value;
|
|
}
|
|
|
|
void CaliPresetCaliStagePanel::set_flow_ratio_value(float flow_ratio)
|
|
{
|
|
flow_ratio_input->GetTextCtrl()->SetValue(wxString::Format("%.2f", flow_ratio));
|
|
m_flow_ratio_value = flow_ratio;
|
|
}
|
|
|
|
void CaliPresetCaliStagePanel::set_flow_ratio_calibration_type(FlowRatioCalibrationType type) {
|
|
if (type == COMPLETE_CALIBRATION) {
|
|
m_complete_radioBox->SetValue(true);
|
|
m_stage = CaliPresetStage::CALI_MANUAL_STAGE_1;
|
|
input_panel->Hide();
|
|
}
|
|
else if (type == FINE_CALIBRATION) {
|
|
m_fine_radioBox->SetValue(true);
|
|
m_stage = CaliPresetStage::CALI_MANUAL_STAGE_2;
|
|
input_panel->Show();
|
|
}
|
|
GetParent()->Layout();
|
|
GetParent()->Fit();
|
|
}
|
|
|
|
CaliComboBox::CaliComboBox(wxWindow* parent,
|
|
wxString title,
|
|
wxArrayString values,
|
|
int default_index, // default delected id
|
|
std::function<void(wxCommandEvent&)> on_value_change,
|
|
wxWindowID id,
|
|
const wxPoint& pos,
|
|
const wxSize& size,
|
|
long style)
|
|
: wxPanel(parent, id, pos, size, style)
|
|
, m_title(title)
|
|
, m_on_value_change_call_back(on_value_change)
|
|
{
|
|
SetBackgroundColour(*wxWHITE);
|
|
m_top_sizer = new wxBoxSizer(wxVERTICAL);
|
|
m_top_sizer->AddSpacer(PRESET_GAP);
|
|
auto combo_title = new Label(this, title);
|
|
combo_title->SetFont(Label::Head_14);
|
|
combo_title->Wrap(-1);
|
|
m_top_sizer->Add(combo_title, 0, wxALL, 0);
|
|
m_top_sizer->AddSpacer(FromDIP(10));
|
|
m_combo_box = new ComboBox(this, wxID_ANY, "", wxDefaultPosition, CALIBRATION_COMBOX_SIZE, 0, nullptr, wxCB_READONLY);
|
|
m_top_sizer->Add(m_combo_box, 0, wxALL, 0);
|
|
m_top_sizer->AddSpacer(PRESET_GAP);
|
|
|
|
this->SetSizer(m_top_sizer);
|
|
m_top_sizer->Fit(this);
|
|
|
|
// set values
|
|
for (int i = 0; i < values.size(); ++i) {
|
|
m_combo_box->AppendString(values[i]);
|
|
}
|
|
m_combo_box->SetSelection(default_index);
|
|
|
|
// bind call back function
|
|
if (m_on_value_change_call_back)
|
|
m_combo_box->Bind(wxEVT_COMBOBOX, m_on_value_change_call_back);
|
|
}
|
|
|
|
int CaliComboBox::get_selection() const
|
|
{
|
|
if (m_combo_box)
|
|
return m_combo_box->GetSelection();
|
|
|
|
return 0;
|
|
}
|
|
|
|
wxString CaliComboBox::get_value() const
|
|
{
|
|
if (m_combo_box)
|
|
return m_combo_box->GetValue();
|
|
|
|
return wxString();
|
|
}
|
|
|
|
void CaliComboBox::set_values(const wxArrayString &values)
|
|
{
|
|
if (m_combo_box) {
|
|
for (int i = 0; i < values.size(); ++i) {
|
|
m_combo_box->AppendString(values[i]);
|
|
}
|
|
m_combo_box->SetSelection(0);
|
|
}
|
|
}
|
|
|
|
CaliPresetWarningPanel::CaliPresetWarningPanel(
|
|
wxWindow* parent,
|
|
wxWindowID id,
|
|
const wxPoint& pos,
|
|
const wxSize& size,
|
|
long style)
|
|
: wxPanel(parent, id, pos, size, style)
|
|
{
|
|
SetBackgroundColour(*wxWHITE);
|
|
|
|
m_top_sizer = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
create_panel(this);
|
|
|
|
this->SetSizer(m_top_sizer);
|
|
m_top_sizer->Fit(this);
|
|
}
|
|
|
|
void CaliPresetWarningPanel::create_panel(wxWindow* parent)
|
|
{
|
|
m_warning_text = new Label(parent, wxEmptyString);
|
|
m_warning_text->SetFont(Label::Body_13);
|
|
m_warning_text->SetForegroundColour(wxColour(230, 92, 92));
|
|
m_warning_text->Wrap(CALIBRATION_TEXT_MAX_LENGTH);
|
|
m_top_sizer->Add(m_warning_text, 0, wxEXPAND | wxTOP | wxBOTTOM, FromDIP(5));
|
|
}
|
|
|
|
void CaliPresetWarningPanel::set_warning(wxString text)
|
|
{
|
|
m_warning_text->SetLabel(text);
|
|
}
|
|
|
|
CaliPresetCustomRangePanel::CaliPresetCustomRangePanel(
|
|
wxWindow* parent,
|
|
int input_value_nums,
|
|
wxWindowID id,
|
|
const wxPoint& pos,
|
|
const wxSize& size,
|
|
long style)
|
|
: wxPanel(parent, id, pos, size, style)
|
|
, m_input_value_nums(input_value_nums)
|
|
{
|
|
SetBackgroundColour(*wxWHITE);
|
|
|
|
m_title_texts.resize(input_value_nums);
|
|
m_value_inputs.resize(input_value_nums);
|
|
|
|
m_top_sizer = new wxBoxSizer(wxHORIZONTAL);
|
|
create_panel(this);
|
|
|
|
this->SetSizer(m_top_sizer);
|
|
m_top_sizer->Fit(this);
|
|
}
|
|
|
|
void CaliPresetCustomRangePanel::set_unit(wxString unit)
|
|
{
|
|
for (size_t i = 0; i < m_input_value_nums; ++i) {
|
|
m_value_inputs[i]->SetLabel(unit);
|
|
}
|
|
}
|
|
|
|
void CaliPresetCustomRangePanel::set_titles(wxArrayString titles)
|
|
{
|
|
if (titles.size() != m_input_value_nums)
|
|
return;
|
|
|
|
for (size_t i = 0; i < m_input_value_nums; ++i) {
|
|
m_title_texts[i]->SetLabel(titles[i]);
|
|
}
|
|
}
|
|
|
|
void CaliPresetCustomRangePanel::set_values(wxArrayString values) {
|
|
if (values.size() != m_input_value_nums)
|
|
return;
|
|
|
|
for (size_t i = 0; i < m_input_value_nums; ++i) {
|
|
m_value_inputs[i]->GetTextCtrl()->SetValue(values[i]);
|
|
}
|
|
}
|
|
|
|
wxArrayString CaliPresetCustomRangePanel::get_values()
|
|
{
|
|
wxArrayString result;
|
|
for (size_t i = 0; i < m_input_value_nums; ++i) {
|
|
result.push_back(m_value_inputs[i]->GetTextCtrl()->GetValue());
|
|
}
|
|
return result;
|
|
}
|
|
|
|
void CaliPresetCustomRangePanel::create_panel(wxWindow* parent)
|
|
{
|
|
wxBoxSizer* horiz_sizer;
|
|
horiz_sizer = new wxBoxSizer(wxHORIZONTAL);
|
|
for (size_t i = 0; i < m_input_value_nums; ++i) {
|
|
if (i > 0) {
|
|
horiz_sizer->Add(FromDIP(10), 0, 0, wxEXPAND, 0);
|
|
}
|
|
|
|
wxBoxSizer *item_sizer;
|
|
item_sizer = new wxBoxSizer(wxVERTICAL);
|
|
m_title_texts[i] = new Label(parent, _L("Title"));
|
|
m_title_texts[i]->Wrap(-1);
|
|
m_title_texts[i]->SetFont(::Label::Body_14);
|
|
item_sizer->Add(m_title_texts[i], 0, wxALL, 0);
|
|
m_value_inputs[i] = new TextInput(parent, wxEmptyString, wxString::FromUTF8("°C"), "", wxDefaultPosition, CALIBRATION_FROM_TO_INPUT_SIZE, 0);
|
|
m_value_inputs[i]->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
|
|
m_value_inputs[i]->GetTextCtrl()->Bind(wxEVT_TEXT, [this, i](wxCommandEvent& event) {
|
|
std::string number = m_value_inputs[i]->GetTextCtrl()->GetValue().ToStdString();
|
|
std::string decimal_point;
|
|
std::string expression = "^[-+]?[0-9]+([,.][0-9]+)?$";
|
|
std::regex decimalRegex(expression);
|
|
int decimal_number;
|
|
if (std::regex_match(number, decimalRegex)) {
|
|
std::smatch match;
|
|
if (std::regex_search(number, match, decimalRegex)) {
|
|
std::string decimalPart = match[1].str();
|
|
if (decimalPart != "")
|
|
decimal_number = decimalPart.length() - 1;
|
|
else
|
|
decimal_number = 0;
|
|
}
|
|
int max_decimal_length;
|
|
if (i <= 1)
|
|
max_decimal_length = 3;
|
|
else if (i >= 2)
|
|
max_decimal_length = 4;
|
|
if (decimal_number > max_decimal_length) {
|
|
int allowed_length = number.length() - decimal_number + max_decimal_length;
|
|
number = number.substr(0, allowed_length);
|
|
m_value_inputs[i]->GetTextCtrl()->SetValue(number);
|
|
m_value_inputs[i]->GetTextCtrl()->SetInsertionPointEnd();
|
|
}
|
|
}
|
|
// input is not a number, invalid.
|
|
else
|
|
BOOST_LOG_TRIVIAL(trace) << "The K input string is not a valid number when calibrating. ";
|
|
|
|
});
|
|
item_sizer->Add(m_value_inputs[i], 0, wxALL, 0);
|
|
horiz_sizer->Add(item_sizer, 0, wxEXPAND, 0);
|
|
}
|
|
|
|
m_top_sizer->Add(horiz_sizer, 0, wxEXPAND, 0);
|
|
}
|
|
|
|
|
|
CaliPresetTipsPanel::CaliPresetTipsPanel(
|
|
wxWindow* parent,
|
|
wxWindowID id,
|
|
const wxPoint& pos,
|
|
const wxSize& size,
|
|
long style)
|
|
: wxPanel(parent, id, pos, size, style)
|
|
{
|
|
this->SetBackgroundColour(wxColour(238, 238, 238));
|
|
this->SetMinSize(wxSize(MIN_CALIBRATION_PAGE_WIDTH, -1));
|
|
|
|
m_top_sizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
create_panel(this);
|
|
|
|
this->SetSizer(m_top_sizer);
|
|
m_top_sizer->Fit(this);
|
|
}
|
|
|
|
void CaliPresetTipsPanel::create_panel(wxWindow* parent)
|
|
{
|
|
m_top_sizer->AddSpacer(FromDIP(10));
|
|
|
|
auto preset_panel_tips = new Label(parent, _L("A test model will be printed. Please clear the build plate and place it back to the hot bed before calibration."));
|
|
preset_panel_tips->SetFont(Label::Body_14);
|
|
preset_panel_tips->Wrap(CALIBRATION_TEXT_MAX_LENGTH * 1.5f);
|
|
m_top_sizer->Add(preset_panel_tips, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(20));
|
|
|
|
m_top_sizer->AddSpacer(FromDIP(10));
|
|
|
|
auto info_sizer = new wxFlexGridSizer(0, 3, 0, FromDIP(10));
|
|
info_sizer->SetFlexibleDirection(wxBOTH);
|
|
info_sizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
|
|
|
|
auto nozzle_temp_sizer = new wxBoxSizer(wxVERTICAL);
|
|
auto nozzle_temp_text = new Label(parent, _L("Nozzle temperature"));
|
|
nozzle_temp_text->SetFont(Label::Body_12);
|
|
m_nozzle_temp = new TextInput(parent, wxEmptyString, wxString::FromUTF8("°C"), "", wxDefaultPosition, CALIBRATION_FROM_TO_INPUT_SIZE, wxTE_READONLY);
|
|
m_nozzle_temp->SetBorderWidth(0);
|
|
nozzle_temp_sizer->Add(nozzle_temp_text, 0, wxALIGN_LEFT);
|
|
nozzle_temp_sizer->Add(m_nozzle_temp, 0, wxEXPAND);
|
|
nozzle_temp_text->Hide();
|
|
m_nozzle_temp->Hide();
|
|
|
|
auto bed_temp_sizer = new wxBoxSizer(wxHORIZONTAL);
|
|
auto printing_param_text = new Label(parent, _L("Printing Parameters"));
|
|
printing_param_text->SetFont(Label::Head_12);
|
|
printing_param_text->Wrap(CALIBRATION_TEXT_MAX_LENGTH);
|
|
bed_temp_sizer->Add(printing_param_text, 0, wxALIGN_CENTER | wxRIGHT, FromDIP(20));
|
|
auto bed_temp_text = new Label(parent, _L("Bed temperature"));
|
|
bed_temp_text->SetFont(Label::Body_12);
|
|
|
|
m_bed_temp = new Label(parent, wxString::FromUTF8("- °C"));
|
|
m_bed_temp->SetFont(Label::Body_12);
|
|
bed_temp_sizer->Add(bed_temp_text, 0, wxALIGN_CENTER | wxRIGHT, FromDIP(10));
|
|
bed_temp_sizer->Add(m_bed_temp, 0, wxALIGN_CENTER);
|
|
|
|
auto max_flow_sizer = new wxBoxSizer(wxVERTICAL);
|
|
auto max_flow_text = new Label(parent, _L("Max volumetric speed"));
|
|
max_flow_text->SetFont(Label::Body_12);
|
|
m_max_volumetric_speed = new TextInput(parent, wxEmptyString, wxString::FromUTF8("mm³"), "", wxDefaultPosition, CALIBRATION_FROM_TO_INPUT_SIZE, wxTE_READONLY);
|
|
m_max_volumetric_speed->SetBorderWidth(0);
|
|
max_flow_sizer->Add(max_flow_text, 0, wxALIGN_LEFT);
|
|
max_flow_sizer->Add(m_max_volumetric_speed, 0, wxEXPAND);
|
|
max_flow_text->Hide();
|
|
m_max_volumetric_speed->Hide();
|
|
|
|
m_nozzle_temp->GetTextCtrl()->Bind(wxEVT_SET_FOCUS, [](auto&) {});
|
|
m_max_volumetric_speed->GetTextCtrl()->Bind(wxEVT_SET_FOCUS, [](auto&) {});
|
|
|
|
info_sizer->Add(nozzle_temp_sizer);
|
|
info_sizer->Add(bed_temp_sizer);
|
|
info_sizer->Add(max_flow_sizer);
|
|
m_top_sizer->Add(info_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(20));
|
|
|
|
m_top_sizer->AddSpacer(FromDIP(10));
|
|
}
|
|
|
|
void CaliPresetTipsPanel::set_params(int nozzle_temp, int bed_temp, float max_volumetric)
|
|
{
|
|
wxString text_nozzle_temp = wxString::Format("%d", nozzle_temp);
|
|
m_nozzle_temp->GetTextCtrl()->SetValue(text_nozzle_temp);
|
|
|
|
std::string bed_temp_text = bed_temp==0 ? "-": std::to_string(bed_temp);
|
|
m_bed_temp->SetLabel(wxString::FromUTF8(bed_temp_text + "°C"));
|
|
|
|
wxString flow_val_text = wxString::Format("%0.2f", max_volumetric);
|
|
m_max_volumetric_speed->GetTextCtrl()->SetValue(flow_val_text);
|
|
}
|
|
|
|
void CaliPresetTipsPanel::get_params(int& nozzle_temp, int& bed_temp, float& max_volumetric)
|
|
{
|
|
try {
|
|
nozzle_temp = stoi(m_nozzle_temp->GetTextCtrl()->GetValue().ToStdString());
|
|
}
|
|
catch (...) {
|
|
nozzle_temp = 0;
|
|
}
|
|
try {
|
|
bed_temp = stoi(m_bed_temp->GetLabel().ToStdString());
|
|
}
|
|
catch (...) {
|
|
bed_temp = 0;
|
|
}
|
|
try {
|
|
max_volumetric = stof(m_max_volumetric_speed->GetTextCtrl()->GetValue().ToStdString());
|
|
}
|
|
catch (...) {
|
|
max_volumetric = 0.0f;
|
|
}
|
|
}
|
|
|
|
CalibrationPresetPage::CalibrationPresetPage(
|
|
wxWindow* parent,
|
|
CalibMode cali_mode,
|
|
bool custom_range,
|
|
wxWindowID id,
|
|
const wxPoint& pos,
|
|
const wxSize& size,
|
|
long style)
|
|
: CalibrationWizardPage(parent, id, pos, size, style)
|
|
, m_show_custom_range(custom_range)
|
|
{
|
|
SetBackgroundColour(*wxWHITE);
|
|
|
|
m_cali_mode = cali_mode;
|
|
m_page_type = CaliPageType::CALI_PAGE_PRESET;
|
|
m_cali_filament_mode = CalibrationFilamentMode::CALI_MODEL_SINGLE;
|
|
m_top_sizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
create_page(this);
|
|
|
|
this->SetSizer(m_top_sizer);
|
|
m_top_sizer->Fit(this);
|
|
}
|
|
|
|
void CalibrationPresetPage::msw_rescale()
|
|
{
|
|
CalibrationWizardPage::msw_rescale();
|
|
m_ams_sync_button->msw_rescale();
|
|
m_virtual_tray_comboBox->msw_rescale();
|
|
for (auto& comboBox : m_filament_comboBox_list) {
|
|
comboBox->msw_rescale();
|
|
}
|
|
}
|
|
|
|
void CalibrationPresetPage::on_sys_color_changed()
|
|
{
|
|
CalibrationWizardPage::on_sys_color_changed();
|
|
m_ams_sync_button->msw_rescale();
|
|
}
|
|
|
|
void CalibrationPresetPage::create_selection_panel(wxWindow* parent)
|
|
{
|
|
auto panel_sizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
auto nozzle_combo_text = new Label(parent, _L("Nozzle Diameter"));
|
|
nozzle_combo_text->SetFont(Label::Head_14);
|
|
nozzle_combo_text->Wrap(-1);
|
|
panel_sizer->Add(nozzle_combo_text, 0, wxALL, 0);
|
|
panel_sizer->AddSpacer(FromDIP(10));
|
|
m_comboBox_nozzle_dia = new ComboBox(parent, wxID_ANY, "", wxDefaultPosition, CALIBRATION_COMBOX_SIZE, 0, nullptr, wxCB_READONLY);
|
|
panel_sizer->Add(m_comboBox_nozzle_dia, 0, wxALL, 0);
|
|
|
|
panel_sizer->AddSpacer(PRESET_GAP);
|
|
|
|
auto plate_type_combo_text = new Label(parent, _L("Plate Type"));
|
|
plate_type_combo_text->SetFont(Label::Head_14);
|
|
plate_type_combo_text->Wrap(-1);
|
|
panel_sizer->Add(plate_type_combo_text, 0, wxALL, 0);
|
|
panel_sizer->AddSpacer(FromDIP(10));
|
|
m_comboBox_bed_type = new ComboBox(parent, wxID_ANY, "", wxDefaultPosition, CALIBRATION_COMBOX_SIZE, 0, nullptr, wxCB_READONLY);
|
|
panel_sizer->Add(m_comboBox_bed_type, 0, wxALL, 0);
|
|
|
|
panel_sizer->AddSpacer(PRESET_GAP);
|
|
|
|
m_filament_from_panel = new wxPanel(parent);
|
|
m_filament_from_panel->Hide();
|
|
auto filament_from_sizer = new wxBoxSizer(wxVERTICAL);
|
|
auto filament_from_text = new Label(m_filament_from_panel, _L("filament position"));
|
|
filament_from_text->SetFont(Label::Head_14);
|
|
filament_from_sizer->Add(filament_from_text, 0);
|
|
auto raioBox_sizer = new wxFlexGridSizer(2, 1, 0, FromDIP(10));
|
|
m_ams_radiobox = new wxRadioButton(m_filament_from_panel, wxID_ANY, _L("AMS"));
|
|
m_ams_radiobox->SetValue(true);
|
|
|
|
raioBox_sizer->Add(m_ams_radiobox, 0);
|
|
m_ext_spool_radiobox = new wxRadioButton(m_filament_from_panel, wxID_ANY, _L("External Spool"));
|
|
raioBox_sizer->Add(m_ext_spool_radiobox, 0);
|
|
filament_from_sizer->Add(raioBox_sizer, 0);
|
|
m_filament_from_panel->SetSizer(filament_from_sizer);
|
|
panel_sizer->Add(m_filament_from_panel, 0, wxBOTTOM, PRESET_GAP);
|
|
|
|
auto filament_for_title_sizer = new wxBoxSizer(wxHORIZONTAL);
|
|
auto filament_for_text = new Label(parent, _L("Filament For Calibration"));
|
|
filament_for_text->SetFont(Label::Head_14);
|
|
filament_for_title_sizer->Add(filament_for_text, 0, wxALIGN_CENTER);
|
|
filament_for_title_sizer->AddSpacer(FromDIP(25));
|
|
m_ams_sync_button = new ScalableButton(parent, wxID_ANY, "ams_fila_sync", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, false, 18);
|
|
m_ams_sync_button->SetBackgroundColour(*wxWHITE);
|
|
m_ams_sync_button->SetToolTip(_L("Synchronize filament list from AMS"));
|
|
filament_for_title_sizer->Add(m_ams_sync_button, 0, wxALIGN_CENTER);
|
|
panel_sizer->Add(filament_for_title_sizer);
|
|
panel_sizer->AddSpacer(FromDIP(6));
|
|
|
|
parent->SetSizer(panel_sizer);
|
|
panel_sizer->Fit(parent);
|
|
|
|
m_ams_radiobox->Bind(wxEVT_RADIOBUTTON, &CalibrationPresetPage::on_choose_ams, this);
|
|
m_ext_spool_radiobox->Bind(wxEVT_RADIOBUTTON, &CalibrationPresetPage::on_choose_ext_spool, this);
|
|
m_ams_sync_button->Bind(wxEVT_BUTTON, [this](wxCommandEvent& e) {
|
|
sync_ams_info(curr_obj);
|
|
});
|
|
|
|
m_comboBox_nozzle_dia->Bind(wxEVT_COMBOBOX, &CalibrationPresetPage::on_select_nozzle, this);
|
|
|
|
m_comboBox_bed_type->Bind(wxEVT_COMBOBOX, &CalibrationPresetPage::on_select_plate_type, this);
|
|
}
|
|
|
|
#define NOZZLE_LIST_COUNT 4
|
|
#define NOZZLE_LIST_DEFAULT 1
|
|
float nozzle_diameter_list[NOZZLE_LIST_COUNT] = {0.2, 0.4, 0.6, 0.8 };
|
|
|
|
void CalibrationPresetPage::init_selection_values()
|
|
{
|
|
// init nozzle diameter
|
|
for (int i = 0; i < NOZZLE_LIST_COUNT; i++) {
|
|
m_comboBox_nozzle_dia->AppendString(wxString::Format("%1.1f mm", nozzle_diameter_list[i]));
|
|
}
|
|
m_comboBox_nozzle_dia->SetSelection(NOZZLE_LIST_DEFAULT);
|
|
|
|
// init plate type
|
|
int curr_selection = 0;
|
|
const ConfigOptionDef* bed_type_def = print_config_def.get("curr_bed_type");
|
|
if (bed_type_def && bed_type_def->enum_keys_map) {
|
|
for (auto item : bed_type_def->enum_labels) {
|
|
m_comboBox_bed_type->AppendString(_L(item));
|
|
}
|
|
m_comboBox_bed_type->SetSelection(curr_selection);
|
|
}
|
|
}
|
|
|
|
void CalibrationPresetPage::create_filament_list_panel(wxWindow* parent)
|
|
{
|
|
auto panel_sizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
m_filament_list_tips = new Label(parent, _L("Tips for calibration material: \n- Materials that can share same hot bed temperature\n- Different filament brand and family(Brand = Bambu, Family = Basic, Matte)"));
|
|
m_filament_list_tips->Hide();
|
|
m_filament_list_tips->SetFont(Label::Body_13);
|
|
m_filament_list_tips->SetForegroundColour(wxColour(145, 145, 145));
|
|
m_filament_list_tips->Wrap(CALIBRATION_TEXT_MAX_LENGTH);
|
|
panel_sizer->Add(m_filament_list_tips, 0, wxBOTTOM, FromDIP(10));
|
|
|
|
// ams panel
|
|
m_multi_ams_panel = new wxPanel(parent);
|
|
auto multi_ams_sizer = new wxBoxSizer(wxVERTICAL);
|
|
auto ams_items_sizer = new wxBoxSizer(wxHORIZONTAL);
|
|
for (int i = 0; i < 4; i++) {
|
|
AMSinfo temp_info = AMSinfo{ std::to_string(i), std::vector<Caninfo>{} };
|
|
auto amsitem = new AMSItem(m_multi_ams_panel, wxID_ANY, temp_info);
|
|
amsitem->Bind(wxEVT_LEFT_DOWN, [this, amsitem](wxMouseEvent& e) {
|
|
on_switch_ams(amsitem->m_amsinfo.ams_id);
|
|
e.Skip();
|
|
});
|
|
m_ams_item_list.push_back(amsitem);
|
|
ams_items_sizer->Add(amsitem, 0, wxALIGN_CENTER | wxRIGHT, FromDIP(6));
|
|
}
|
|
multi_ams_sizer->Add(ams_items_sizer, 0);
|
|
multi_ams_sizer->AddSpacer(FromDIP(10));
|
|
m_multi_ams_panel->SetSizer(multi_ams_sizer);
|
|
|
|
panel_sizer->Add(m_multi_ams_panel);
|
|
m_multi_ams_panel->Hide();
|
|
|
|
auto filament_fgSizer = new wxFlexGridSizer(2, 2, FromDIP(10), CALIBRATION_FGSIZER_HGAP);
|
|
for (int i = 0; i < 4; i++) {
|
|
auto filament_comboBox_sizer = new wxBoxSizer(wxHORIZONTAL);
|
|
wxRadioButton* radio_btn = new wxRadioButton(m_filament_list_panel, wxID_ANY, "");
|
|
CheckBox* check_box = new CheckBox(m_filament_list_panel);
|
|
check_box->SetBackgroundColour(*wxWHITE);
|
|
FilamentComboBox* fcb = new FilamentComboBox(m_filament_list_panel);
|
|
fcb->SetRadioBox(radio_btn);
|
|
fcb->SetCheckBox(check_box);
|
|
fcb->set_select_mode(CalibrationFilamentMode::CALI_MODEL_SINGLE);
|
|
filament_comboBox_sizer->Add(radio_btn, 0, wxALIGN_CENTER);
|
|
filament_comboBox_sizer->Add(check_box, 0, wxALIGN_CENTER | wxRIGHT, FromDIP(8));
|
|
filament_comboBox_sizer->Add(fcb, 0, wxALIGN_CENTER);
|
|
filament_fgSizer->Add(filament_comboBox_sizer, 0);
|
|
|
|
fcb->Bind(EVT_CALI_TRAY_CHANGED, &CalibrationPresetPage::on_select_tray, this);
|
|
|
|
radio_btn->Bind(wxEVT_RADIOBUTTON, [this](wxCommandEvent& evt) {
|
|
wxCommandEvent event(EVT_CALI_TRAY_CHANGED);
|
|
event.SetEventObject(this);
|
|
wxPostEvent(this, event);
|
|
});
|
|
check_box->Bind(wxEVT_TOGGLEBUTTON, [this](wxCommandEvent& evt) {
|
|
wxCommandEvent event(EVT_CALI_TRAY_CHANGED);
|
|
event.SetEventObject(this);
|
|
wxPostEvent(this, event);
|
|
evt.Skip();
|
|
});
|
|
m_filament_comboBox_list.push_back(fcb);
|
|
|
|
if (i == 0)
|
|
radio_btn->SetValue(true);
|
|
}
|
|
panel_sizer->Add(filament_fgSizer, 0);
|
|
|
|
parent->SetSizer(panel_sizer);
|
|
panel_sizer->Fit(parent);
|
|
}
|
|
|
|
void CalibrationPresetPage::create_ext_spool_panel(wxWindow* parent)
|
|
{
|
|
auto panel_sizer = new wxBoxSizer(wxHORIZONTAL);
|
|
panel_sizer->AddSpacer(FromDIP(10));
|
|
wxRadioButton* radio_btn = new wxRadioButton(parent, wxID_ANY, "");
|
|
CheckBox* check_box = new CheckBox(parent);
|
|
m_virtual_tray_comboBox = new FilamentComboBox(parent);
|
|
m_virtual_tray_comboBox->SetRadioBox(radio_btn);
|
|
m_virtual_tray_comboBox->SetCheckBox(check_box);
|
|
m_virtual_tray_comboBox->set_select_mode(CalibrationFilamentMode::CALI_MODEL_SINGLE);
|
|
radio_btn->SetValue(true);
|
|
|
|
m_virtual_tray_comboBox->Bind(EVT_CALI_TRAY_CHANGED, &CalibrationPresetPage::on_select_tray, this);
|
|
|
|
panel_sizer->Add(radio_btn, 0, wxALIGN_CENTER | wxTOP, FromDIP(4));
|
|
panel_sizer->Add(check_box, 0, wxALIGN_CENTER | wxTOP, FromDIP(4));
|
|
panel_sizer->Add(m_virtual_tray_comboBox, 0, wxALIGN_CENTER | wxTOP, FromDIP(4));
|
|
parent->SetSizer(panel_sizer);
|
|
panel_sizer->Fit(parent);
|
|
|
|
radio_btn->Bind(wxEVT_RADIOBUTTON, [this](wxCommandEvent& evt) {
|
|
wxCommandEvent event(EVT_CALI_TRAY_CHANGED);
|
|
event.SetEventObject(this);
|
|
wxPostEvent(this, event);
|
|
});
|
|
}
|
|
|
|
void CalibrationPresetPage::create_page(wxWindow* parent)
|
|
{
|
|
m_page_caption = new CaliPageCaption(parent, m_cali_mode);
|
|
m_page_caption->show_prev_btn(true);
|
|
m_top_sizer->Add(m_page_caption, 0, wxEXPAND, 0);
|
|
|
|
if (m_cali_mode == CalibMode::Calib_Flow_Rate) {
|
|
wxArrayString steps;
|
|
steps.Add(_L("Preset"));
|
|
steps.Add(_L("Calibration1"));
|
|
steps.Add(_L("Calibration2"));
|
|
steps.Add(_L("Record Factor"));
|
|
m_step_panel = new CaliPageStepGuide(parent, steps);
|
|
m_step_panel->set_steps(0);
|
|
}
|
|
else {
|
|
wxArrayString steps;
|
|
steps.Add(_L("Preset"));
|
|
steps.Add(_L("Calibration"));
|
|
steps.Add(_L("Record Factor"));
|
|
m_step_panel = new CaliPageStepGuide(parent, steps);
|
|
m_step_panel->set_steps(0);
|
|
}
|
|
|
|
m_top_sizer->Add(m_step_panel, 0, wxEXPAND, 0);
|
|
|
|
m_cali_stage_panel = new CaliPresetCaliStagePanel(parent);
|
|
m_cali_stage_panel->set_parent(this);
|
|
m_top_sizer->Add(m_cali_stage_panel, 0);
|
|
|
|
m_selection_panel = new wxPanel(parent);
|
|
m_selection_panel->SetBackgroundColour(*wxWHITE);
|
|
create_selection_panel(m_selection_panel);
|
|
init_selection_values();
|
|
|
|
m_filament_list_panel = new wxPanel(parent);
|
|
m_filament_list_panel->SetBackgroundColour(*wxWHITE);
|
|
create_filament_list_panel(m_filament_list_panel);
|
|
|
|
if (m_cali_mode == CalibMode::Calib_PA_Line || m_cali_mode == CalibMode::Calib_PA_Pattern) {
|
|
wxArrayString pa_cali_modes;
|
|
pa_cali_modes.push_back(_L("Line"));
|
|
pa_cali_modes.push_back(_L("Pattern"));
|
|
m_pa_cali_method_combox = new CaliComboBox(parent, _L("Method"), pa_cali_modes);
|
|
}
|
|
|
|
m_ext_spool_panel = new wxPanel(parent);
|
|
create_ext_spool_panel(m_ext_spool_panel);
|
|
m_ext_spool_panel->Hide();
|
|
|
|
m_warning_panel = new CaliPresetWarningPanel(parent);
|
|
|
|
m_tips_panel = new CaliPresetTipsPanel(parent);
|
|
|
|
m_sending_panel = new CaliPageSendingPanel(parent);
|
|
m_sending_panel->get_sending_progress_bar()->set_cancel_callback_fina([this]() {
|
|
on_cali_cancel_job();
|
|
});
|
|
m_sending_panel->Hide();
|
|
|
|
m_custom_range_panel = new CaliPresetCustomRangePanel(parent);
|
|
|
|
m_action_panel = new CaliPageActionPanel(parent, m_cali_mode, CaliPageType::CALI_PAGE_PRESET);
|
|
|
|
m_statictext_printer_msg = new Label(this, wxEmptyString, wxALIGN_CENTER_HORIZONTAL);
|
|
m_statictext_printer_msg->SetFont(::Label::Body_13);
|
|
m_statictext_printer_msg->Hide();
|
|
|
|
m_top_sizer->Add(m_selection_panel, 0);
|
|
m_top_sizer->Add(m_filament_list_panel, 0);
|
|
m_top_sizer->Add(m_ext_spool_panel, 0);
|
|
m_top_sizer->Add(m_pa_cali_method_combox, 0);
|
|
m_top_sizer->Add(m_custom_range_panel, 0);
|
|
m_top_sizer->AddSpacer(FromDIP(15));
|
|
m_top_sizer->Add(m_warning_panel, 0);
|
|
m_top_sizer->Add(m_tips_panel, 0);
|
|
m_top_sizer->AddSpacer(PRESET_GAP);
|
|
m_top_sizer->Add(m_sending_panel, 0, wxALIGN_CENTER);
|
|
m_top_sizer->Add(m_statictext_printer_msg, 0, wxALIGN_CENTER_HORIZONTAL, 0);
|
|
m_top_sizer->Add(m_action_panel, 0, wxEXPAND, 0);
|
|
|
|
Bind(EVT_CALI_TRAY_CHANGED, &CalibrationPresetPage::on_select_tray, this);
|
|
}
|
|
|
|
void CalibrationPresetPage::update_print_status_msg(wxString msg, bool is_warning)
|
|
{
|
|
update_priner_status_msg(msg, is_warning);
|
|
}
|
|
|
|
wxString CalibrationPresetPage::format_text(wxString& m_msg)
|
|
{
|
|
if (wxGetApp().app_config->get("language") != "zh_CN") { return m_msg; }
|
|
|
|
wxString out_txt = m_msg;
|
|
wxString count_txt = "";
|
|
int new_line_pos = 0;
|
|
|
|
for (int i = 0; i < m_msg.length(); i++) {
|
|
auto text_size = m_statictext_printer_msg->GetTextExtent(count_txt);
|
|
if (text_size.x < (FromDIP(600))) {
|
|
count_txt += m_msg[i];
|
|
}
|
|
else {
|
|
out_txt.insert(i - 1, '\n');
|
|
count_txt = "";
|
|
}
|
|
}
|
|
return out_txt;
|
|
}
|
|
|
|
void CalibrationPresetPage::stripWhiteSpace(std::string& str)
|
|
{
|
|
if (str == "") { return; }
|
|
|
|
string::iterator cur_it;
|
|
cur_it = str.begin();
|
|
|
|
while (cur_it != str.end()) {
|
|
if ((*cur_it) == '\n' || (*cur_it) == ' ') {
|
|
cur_it = str.erase(cur_it);
|
|
}
|
|
else {
|
|
cur_it++;
|
|
}
|
|
}
|
|
}
|
|
|
|
void CalibrationPresetPage::update_priner_status_msg(wxString msg, bool is_warning)
|
|
{
|
|
auto colour = is_warning ? wxColour(0xFF, 0x6F, 0x00) : wxColour(0x6B, 0x6B, 0x6B);
|
|
m_statictext_printer_msg->SetForegroundColour(colour);
|
|
|
|
if (msg.empty()) {
|
|
if (!m_statictext_printer_msg->GetLabel().empty()) {
|
|
m_statictext_printer_msg->SetLabel(wxEmptyString);
|
|
m_statictext_printer_msg->Hide();
|
|
Layout();
|
|
Fit();
|
|
}
|
|
}
|
|
else {
|
|
msg = format_text(msg);
|
|
|
|
auto str_new = msg.ToStdString();
|
|
stripWhiteSpace(str_new);
|
|
|
|
auto str_old = m_statictext_printer_msg->GetLabel().ToStdString();
|
|
stripWhiteSpace(str_old);
|
|
|
|
if (str_new != str_old) {
|
|
if (m_statictext_printer_msg->GetLabel() != msg) {
|
|
m_statictext_printer_msg->SetLabel(msg);
|
|
m_statictext_printer_msg->SetMinSize(wxSize(FromDIP(600), -1));
|
|
m_statictext_printer_msg->SetMaxSize(wxSize(FromDIP(600), -1));
|
|
m_statictext_printer_msg->Wrap(FromDIP(600));
|
|
m_statictext_printer_msg->Show();
|
|
Layout();
|
|
Fit();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void CalibrationPresetPage::on_select_nozzle(wxCommandEvent& evt)
|
|
{
|
|
update_combobox_filaments(curr_obj);
|
|
}
|
|
|
|
void CalibrationPresetPage::on_select_plate_type(wxCommandEvent& evt)
|
|
{
|
|
select_default_compatible_filament();
|
|
check_filament_compatible();
|
|
}
|
|
|
|
void CalibrationPresetPage::on_choose_ams(wxCommandEvent& event)
|
|
{
|
|
select_default_compatible_filament();
|
|
|
|
m_filament_list_panel->Show();
|
|
m_ams_sync_button->Show();
|
|
m_ext_spool_panel->Hide();
|
|
Layout();
|
|
}
|
|
|
|
void CalibrationPresetPage::on_choose_ext_spool(wxCommandEvent& event)
|
|
{
|
|
m_filament_list_panel->Hide();
|
|
m_ams_sync_button->Hide();
|
|
m_ext_spool_panel->Show();
|
|
Layout();
|
|
}
|
|
|
|
void CalibrationPresetPage::on_select_tray(wxCommandEvent& event)
|
|
{
|
|
check_filament_compatible();
|
|
|
|
on_recommend_input_value();
|
|
}
|
|
|
|
void CalibrationPresetPage::on_switch_ams(std::string ams_id)
|
|
{
|
|
for (auto i = 0; i < m_ams_item_list.size(); i++) {
|
|
AMSItem* item = m_ams_item_list[i];
|
|
if (item->m_amsinfo.ams_id == ams_id) {
|
|
item->OnSelected();
|
|
}
|
|
else {
|
|
item->UnSelected();
|
|
}
|
|
}
|
|
|
|
update_filament_combobox(ams_id);
|
|
|
|
select_default_compatible_filament();
|
|
|
|
Layout();
|
|
}
|
|
|
|
void CalibrationPresetPage::on_recommend_input_value()
|
|
{
|
|
//TODO fix this
|
|
std::map<int, Preset *> selected_filaments = get_selected_filaments();
|
|
if (selected_filaments.empty())
|
|
return;
|
|
|
|
if (m_cali_mode == CalibMode::Calib_PA_Line) {
|
|
|
|
}
|
|
else if (m_cali_mode == CalibMode::Calib_Flow_Rate && m_cali_stage_panel) {
|
|
Preset *selected_filament_preset = selected_filaments.begin()->second;
|
|
if (selected_filament_preset) {
|
|
const ConfigOptionFloats* flow_ratio_opt = selected_filament_preset->config.option<ConfigOptionFloats>("filament_flow_ratio");
|
|
if (flow_ratio_opt) {
|
|
m_cali_stage_panel->set_flow_ratio_value(flow_ratio_opt->get_at(0));
|
|
}
|
|
}
|
|
}
|
|
else if (m_cali_mode == CalibMode::Calib_Vol_speed_Tower) {
|
|
Preset* selected_filament_preset = selected_filaments.begin()->second;
|
|
if (selected_filament_preset) {
|
|
if (m_custom_range_panel) {
|
|
const ConfigOptionFloats* speed_opt = selected_filament_preset->config.option<ConfigOptionFloats>("filament_max_volumetric_speed");
|
|
if (speed_opt) {
|
|
double max_volumetric_speed = speed_opt->get_at(0);
|
|
wxArrayString values;
|
|
values.push_back(wxString::Format("%.2f", max_volumetric_speed - 5));
|
|
values.push_back(wxString::Format("%.2f", max_volumetric_speed + 5));
|
|
values.push_back(wxString::Format("%.2f", 0.5f));
|
|
m_custom_range_panel->set_values(values);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void CalibrationPresetPage::check_filament_compatible()
|
|
{
|
|
std::map<int, Preset*> selected_filaments = get_selected_filaments();
|
|
std::string incompatiable_filament_name;
|
|
std::string error_tips;
|
|
int bed_temp = 0;
|
|
|
|
std::vector<Preset*> selected_filaments_list;
|
|
for (auto& item: selected_filaments)
|
|
selected_filaments_list.push_back(item.second);
|
|
|
|
if (!is_filaments_compatiable(selected_filaments_list, bed_temp, incompatiable_filament_name, error_tips)) {
|
|
m_tips_panel->set_params(0, 0, 0.0f);
|
|
if (!error_tips.empty()) {
|
|
wxString tips = from_u8(error_tips);
|
|
m_warning_panel->set_warning(tips);
|
|
} else {
|
|
wxString tips = wxString::Format(_L("%s is not compatible with %s"), m_comboBox_bed_type->GetValue(), incompatiable_filament_name);
|
|
m_warning_panel->set_warning(tips);
|
|
}
|
|
m_has_filament_incompatible = true;
|
|
update_show_status();
|
|
} else {
|
|
m_tips_panel->set_params(0, bed_temp, 0);
|
|
m_warning_panel->set_warning("");
|
|
m_has_filament_incompatible = false;
|
|
update_show_status();
|
|
}
|
|
|
|
Layout();
|
|
}
|
|
|
|
bool CalibrationPresetPage::is_filaments_compatiable(const std::vector<Preset*>& prests)
|
|
{
|
|
std::string incompatiable_filament_name;
|
|
std::string error_tips;
|
|
int bed_temp = 0;
|
|
return is_filaments_compatiable(prests, bed_temp, incompatiable_filament_name, error_tips);
|
|
}
|
|
|
|
bool CalibrationPresetPage::is_filament_in_blacklist(Preset* preset, std::string& error_tips)
|
|
{
|
|
if (m_ams_radiobox->GetValue() && wxGetApp().app_config->get("skip_ams_blacklist_check") != "true") {
|
|
bool in_blacklist = false;
|
|
std::string action;
|
|
std::string info;
|
|
std::string filamnt_type;
|
|
preset->get_filament_type(filamnt_type);
|
|
|
|
auto vendor = dynamic_cast<ConfigOptionStrings*> (preset->config.option("filament_vendor"));
|
|
if (vendor && (vendor->values.size() > 0)) {
|
|
std::string vendor_name = vendor->values[0];
|
|
DeviceManager::check_filaments_in_blacklist(vendor_name, filamnt_type, in_blacklist, action, info);
|
|
}
|
|
|
|
if (in_blacklist) {
|
|
error_tips = info;
|
|
if (action == "prohibition") {
|
|
return false;
|
|
}
|
|
else if (action == "warning") {
|
|
return true;
|
|
}
|
|
}
|
|
else {
|
|
error_tips = "";
|
|
return true;
|
|
}
|
|
}
|
|
if (m_ext_spool_radiobox->GetValue()) {
|
|
if (m_cali_mode == CalibMode::Calib_PA_Line && m_cali_method == CalibrationMethod::CALI_METHOD_AUTO) {
|
|
std::string filamnt_type;
|
|
preset->get_filament_type(filamnt_type);
|
|
if (filamnt_type == "TPU") {
|
|
error_tips = _u8L("TPU is not supported for Flow Dynamics Auto-Calibration.");
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
bool CalibrationPresetPage::is_filaments_compatiable(const std::vector<Preset*> &prests,
|
|
int& bed_temp,
|
|
std::string& incompatiable_filament_name,
|
|
std::string& error_tips)
|
|
{
|
|
if (prests.empty()) return true;
|
|
|
|
bed_temp = 0;
|
|
std::vector<std::string> filament_types;
|
|
for (auto &item : prests) {
|
|
if (!item)
|
|
continue;
|
|
|
|
// update bed temperature
|
|
BedType curr_bed_type = BedType(m_comboBox_bed_type->GetSelection() + btDefault + 1);
|
|
const ConfigOptionInts *opt_bed_temp_ints = item->config.option<ConfigOptionInts>(get_bed_temp_key(curr_bed_type));
|
|
int bed_temp_int = 0;
|
|
if (opt_bed_temp_ints) {
|
|
bed_temp_int = opt_bed_temp_ints->get_at(0);
|
|
}
|
|
|
|
if (bed_temp_int <= 0) {
|
|
if (!item->alias.empty())
|
|
incompatiable_filament_name = item->alias;
|
|
else
|
|
incompatiable_filament_name = item->name;
|
|
|
|
return false;
|
|
} else {
|
|
// set for first preset
|
|
if (bed_temp == 0)
|
|
bed_temp = bed_temp_int;
|
|
}
|
|
std::string display_filament_type;
|
|
filament_types.push_back(item->config.get_filament_type(display_filament_type, 0));
|
|
|
|
// check is it in the filament blacklist
|
|
if (!is_filament_in_blacklist(item, error_tips))
|
|
return false;
|
|
}
|
|
|
|
if (!Print::check_multi_filaments_compatibility(filament_types)) {
|
|
error_tips = _u8L("Can not print multiple filaments which have large difference of temperature together. Otherwise, the extruder and nozzle may be blocked or damaged during printing");
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
void CalibrationPresetPage::update_plate_type_collection(CalibrationMethod method)
|
|
{
|
|
m_comboBox_bed_type->Clear();
|
|
const ConfigOptionDef* bed_type_def = print_config_def.get("curr_bed_type");
|
|
if (bed_type_def && bed_type_def->enum_keys_map) {
|
|
for (int i = 0; i < bed_type_def->enum_labels.size(); i++) {
|
|
m_comboBox_bed_type->AppendString(_L(bed_type_def->enum_labels[i]));
|
|
}
|
|
m_comboBox_bed_type->SetSelection(0);
|
|
}
|
|
}
|
|
|
|
void CalibrationPresetPage::update_combobox_filaments(MachineObject* obj)
|
|
{
|
|
if (!obj) return;
|
|
|
|
if (!obj->is_info_ready())
|
|
return;
|
|
|
|
//step 1: update combobox filament list
|
|
float nozzle_value = get_nozzle_value();
|
|
obj->cali_selected_nozzle_dia = nozzle_value;
|
|
if (nozzle_value < 1e-3) {
|
|
return;
|
|
}
|
|
|
|
Preset* printer_preset = get_printer_preset(obj, nozzle_value);
|
|
|
|
// sync ams filaments list info
|
|
PresetBundle* preset_bundle = wxGetApp().preset_bundle;
|
|
if (preset_bundle && printer_preset) {
|
|
preset_bundle->set_calibrate_printer(printer_preset->name);
|
|
}
|
|
|
|
//step 2: sync ams info from object by default
|
|
sync_ams_info(obj);
|
|
|
|
//step 3: select the default compatible filament to calibration
|
|
select_default_compatible_filament();
|
|
}
|
|
|
|
bool CalibrationPresetPage::is_blocking_printing()
|
|
{
|
|
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
|
if (!dev) return true;
|
|
|
|
MachineObject* obj_ = dev->get_selected_machine();
|
|
if (obj_ == nullptr) return true;
|
|
|
|
PresetBundle* preset_bundle = wxGetApp().preset_bundle;
|
|
auto source_model = preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle);
|
|
auto target_model = obj_->printer_type;
|
|
|
|
if (source_model != target_model) {
|
|
std::vector<std::string> compatible_machine = dev->get_compatible_machine(target_model);
|
|
vector<std::string>::iterator it = find(compatible_machine.begin(), compatible_machine.end(), source_model);
|
|
if (it == compatible_machine.end()) {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
void CalibrationPresetPage::update_show_status()
|
|
{
|
|
NetworkAgent* agent = Slic3r::GUI::wxGetApp().getAgent();
|
|
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
|
if (!agent) {return;}
|
|
if (!dev) return;
|
|
dev->check_pushing();
|
|
|
|
MachineObject* obj_ = dev->get_selected_machine();
|
|
if (!obj_) {
|
|
if (agent->is_user_login()) {
|
|
show_status(CaliPresetPageStatus::CaliPresetStatusInvalidPrinter);
|
|
}
|
|
else {
|
|
show_status(CaliPresetPageStatus::CaliPresetStatusNoUserLogin);
|
|
}
|
|
return;
|
|
}
|
|
|
|
if (!obj_->is_lan_mode_printer()) {
|
|
if (!agent->is_server_connected()) {
|
|
agent->refresh_connection();
|
|
show_status(CaliPresetPageStatus::CaliPresetStatusConnectingServer);
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (wxGetApp().app_config && wxGetApp().app_config->get("internal_debug").empty()) {
|
|
if (obj_->upgrade_force_upgrade) {
|
|
show_status(CaliPresetPageStatus::CaliPresetStatusNeedForceUpgrading);
|
|
return;
|
|
}
|
|
|
|
if (obj_->upgrade_consistency_request) {
|
|
show_status(CaliPresetStatusNeedConsistencyUpgrading);
|
|
return;
|
|
}
|
|
}
|
|
|
|
//if (is_blocking_printing()) {
|
|
// show_status(CaliPresetPageStatus::CaliPresetStatusUnsupportedPrinter);
|
|
// return;
|
|
//}
|
|
//else
|
|
if (obj_->is_connecting() || !obj_->is_connected()) {
|
|
show_status(CaliPresetPageStatus::CaliPresetStatusInConnecting);
|
|
return;
|
|
}
|
|
else if (obj_->is_in_upgrading()) {
|
|
show_status(CaliPresetPageStatus::CaliPresetStatusInUpgrading);
|
|
return;
|
|
}
|
|
else if (obj_->is_system_printing()) {
|
|
show_status(CaliPresetPageStatus::CaliPresetStatusInSystemPrinting);
|
|
return;
|
|
}
|
|
else if (obj_->is_in_printing()) {
|
|
show_status(CaliPresetPageStatus::CaliPresetStatusInPrinting);
|
|
return;
|
|
}
|
|
else if (!obj_->is_support_print_without_sd && (obj_->get_sdcard_state() == MachineObject::SdcardState::NO_SDCARD)) {
|
|
show_status(CaliPresetPageStatus::CaliPresetStatusNoSdcard);
|
|
return;
|
|
}
|
|
|
|
// check sdcard when if lan mode printer
|
|
if (obj_->is_lan_mode_printer()) {
|
|
if (obj_->get_sdcard_state() == MachineObject::SdcardState::NO_SDCARD) {
|
|
show_status(CaliPresetPageStatus::CaliPresetStatusLanModeNoSdcard);
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (m_has_filament_incompatible) {
|
|
show_status(CaliPresetPageStatus::CaliPresetStatusFilamentIncompatible);
|
|
return;
|
|
}
|
|
|
|
show_status(CaliPresetPageStatus::CaliPresetStatusNormal);
|
|
}
|
|
|
|
|
|
bool CalibrationPresetPage::need_check_sdcard(MachineObject* obj)
|
|
{
|
|
if (!obj) return false;
|
|
|
|
bool need_check = false;
|
|
if (obj->get_printer_series() == PrinterSeries::SERIES_X1) {
|
|
if (m_cali_mode == CalibMode::Calib_Flow_Rate && m_cali_method == CalibrationMethod::CALI_METHOD_MANUAL) {
|
|
need_check = true;
|
|
}
|
|
else if (m_cali_mode == CalibMode::Calib_Vol_speed_Tower && m_cali_method == CalibrationMethod::CALI_METHOD_MANUAL)
|
|
{
|
|
need_check = true;
|
|
}
|
|
}
|
|
else if (obj->get_printer_series() == PrinterSeries::SERIES_P1P) {
|
|
if (m_cali_mode == CalibMode::Calib_Flow_Rate && m_cali_method == CalibrationMethod::CALI_METHOD_MANUAL) {
|
|
need_check = true;
|
|
}
|
|
else if (m_cali_mode == CalibMode::Calib_Vol_speed_Tower && m_cali_method == CalibrationMethod::CALI_METHOD_MANUAL) {
|
|
need_check = true;
|
|
}
|
|
}
|
|
else {
|
|
assert(false);
|
|
return false;
|
|
}
|
|
|
|
return need_check;
|
|
}
|
|
|
|
void CalibrationPresetPage::show_status(CaliPresetPageStatus status)
|
|
{
|
|
if (m_stop_update_page_status)
|
|
return;
|
|
|
|
if (m_page_status != status)
|
|
//BOOST_LOG_TRIVIAL(info) << "CalibrationPresetPage: show_status = " << status << "(" << get_print_status_info(status) << ")";
|
|
m_page_status = status;
|
|
|
|
// other
|
|
if (status == CaliPresetPageStatus::CaliPresetStatusInit) {
|
|
update_print_status_msg(wxEmptyString, false);
|
|
Enable_Send_Button(false);
|
|
}
|
|
else if (status == CaliPresetPageStatus::CaliPresetStatusNormal) {
|
|
update_print_status_msg(wxEmptyString, false);
|
|
Enable_Send_Button(true);
|
|
Layout();
|
|
Fit();
|
|
}
|
|
else if (status == CaliPresetPageStatus::CaliPresetStatusNoUserLogin) {
|
|
wxString msg_text = _L("No login account, only printers in LAN mode are displayed");
|
|
update_print_status_msg(msg_text, false);
|
|
Enable_Send_Button(false);
|
|
}
|
|
else if (status == CaliPresetPageStatus::CaliPresetStatusInvalidPrinter) {
|
|
update_print_status_msg(wxEmptyString, true);
|
|
Enable_Send_Button(false);
|
|
}
|
|
else if (status == CaliPresetPageStatus::CaliPresetStatusConnectingServer) {
|
|
wxString msg_text = _L("Connecting to server");
|
|
update_print_status_msg(msg_text, true);
|
|
Enable_Send_Button(false);
|
|
}
|
|
else if (status == CaliPresetPageStatus::CaliPresetStatusInUpgrading) {
|
|
wxString msg_text = _L("Cannot send the print job when the printer is updating firmware");
|
|
update_print_status_msg(msg_text, true);
|
|
Enable_Send_Button(false);
|
|
}
|
|
else if (status == CaliPresetPageStatus::CaliPresetStatusInSystemPrinting) {
|
|
wxString msg_text = _L("The printer is executing instructions. Please restart printing after it ends");
|
|
update_print_status_msg(msg_text, true);
|
|
Enable_Send_Button(false);
|
|
}
|
|
else if (status == CaliPresetPageStatus::CaliPresetStatusInPrinting) {
|
|
wxString msg_text = _L("The printer is busy on other print job");
|
|
update_print_status_msg(msg_text, true);
|
|
Enable_Send_Button(false);
|
|
}
|
|
else if (status == CaliPresetPageStatus::CaliPresetStatusLanModeNoSdcard) {
|
|
wxString msg_text = _L("An SD card needs to be inserted before printing via LAN.");
|
|
update_print_status_msg(msg_text, true);
|
|
Enable_Send_Button(true);
|
|
}
|
|
else if (status == CaliPresetPageStatus::CaliPresetStatusNoSdcard) {
|
|
wxString msg_text = _L("An SD card needs to be inserted before printing.");
|
|
update_print_status_msg(msg_text, true);
|
|
Enable_Send_Button(false);
|
|
}
|
|
else if (status == CaliPresetPageStatus::CaliPresetStatusNeedForceUpgrading) {
|
|
wxString msg_text = _L("Cannot send the print job to a printer whose firmware is required to get updated.");
|
|
update_print_status_msg(msg_text, true);
|
|
Enable_Send_Button(false);
|
|
}
|
|
else if (status == CaliPresetPageStatus::CaliPresetStatusNeedConsistencyUpgrading) {
|
|
wxString msg_text = _L("Cannot send the print job to a printer whose firmware is required to get updated.");
|
|
update_print_status_msg(msg_text, true);
|
|
Enable_Send_Button(false);
|
|
}
|
|
else if (status == CaliPresetPageStatus::CaliPresetStatusFilamentIncompatible) {
|
|
update_print_status_msg(wxEmptyString, false);
|
|
Enable_Send_Button(false);
|
|
}
|
|
else if (status == CaliPresetPageStatus::CaliPresetStatusInConnecting) {
|
|
wxString msg_text = _L("Connecting to printer");
|
|
update_print_status_msg(msg_text, true);
|
|
Enable_Send_Button(false);
|
|
}
|
|
|
|
Layout();
|
|
}
|
|
|
|
void CalibrationPresetPage::Enable_Send_Button(bool enable)
|
|
{
|
|
m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_CALI, enable);
|
|
}
|
|
|
|
float CalibrationPresetPage::get_nozzle_value()
|
|
{
|
|
double nozzle_value = 0.0;
|
|
wxString nozzle_value_str = m_comboBox_nozzle_dia->GetValue();
|
|
try {
|
|
nozzle_value_str.ToDouble(&nozzle_value);
|
|
}
|
|
catch (...) {
|
|
;
|
|
}
|
|
|
|
return nozzle_value;
|
|
}
|
|
|
|
void CalibrationPresetPage::update(MachineObject* obj)
|
|
{
|
|
curr_obj = obj;
|
|
|
|
//update printer status
|
|
update_show_status();
|
|
|
|
}
|
|
|
|
void CalibrationPresetPage::on_device_connected(MachineObject* obj)
|
|
{
|
|
init_with_machine(obj);
|
|
update_combobox_filaments(obj);
|
|
}
|
|
|
|
void CalibrationPresetPage::set_cali_filament_mode(CalibrationFilamentMode mode)
|
|
{
|
|
CalibrationWizardPage::set_cali_filament_mode(mode);
|
|
|
|
for (int i = 0; i < m_filament_comboBox_list.size(); i++) {
|
|
m_filament_comboBox_list[i]->set_select_mode(mode);
|
|
}
|
|
|
|
if (mode == CALI_MODEL_MULITI) {
|
|
m_filament_list_tips->Show();
|
|
}
|
|
else {
|
|
m_filament_list_tips->Hide();
|
|
}
|
|
}
|
|
|
|
void CalibrationPresetPage::set_cali_method(CalibrationMethod method)
|
|
{
|
|
CalibrationWizardPage::set_cali_method(method);
|
|
if (method == CalibrationMethod::CALI_METHOD_MANUAL) {
|
|
if (m_cali_mode == CalibMode::Calib_Flow_Rate) {
|
|
wxArrayString steps;
|
|
steps.Add(_L("Preset"));
|
|
steps.Add(_L("Calibration1"));
|
|
steps.Add(_L("Calibration2"));
|
|
steps.Add(_L("Record Factor"));
|
|
m_step_panel->set_steps_string(steps);
|
|
m_step_panel->set_steps(0);
|
|
if (m_cali_stage_panel)
|
|
m_cali_stage_panel->Show();
|
|
|
|
if (m_pa_cali_method_combox)
|
|
m_pa_cali_method_combox->Show(false);
|
|
|
|
if (m_custom_range_panel)
|
|
m_custom_range_panel->Show(false);
|
|
}
|
|
else if (m_cali_mode == CalibMode::Calib_PA_Line || m_cali_mode == CalibMode::Calib_PA_Pattern) {
|
|
if (m_cali_stage_panel)
|
|
m_cali_stage_panel->Show(false);
|
|
|
|
if (m_pa_cali_method_combox)
|
|
m_pa_cali_method_combox->Show();
|
|
|
|
if (m_custom_range_panel) {
|
|
wxArrayString titles;
|
|
titles.push_back(_L("From k Value"));
|
|
titles.push_back(_L("To k Value"));
|
|
titles.push_back(_L("Step value"));
|
|
m_custom_range_panel->set_titles(titles);
|
|
|
|
wxArrayString values;
|
|
values.push_back(wxString::Format(wxT("%.0f"), 0));
|
|
values.push_back(wxString::Format(wxT("%.2f"), 0.05));
|
|
values.push_back(wxString::Format(wxT("%.3f"), 0.005));
|
|
m_custom_range_panel->set_values(values);
|
|
|
|
m_custom_range_panel->set_unit("");
|
|
m_custom_range_panel->Show();
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
wxArrayString steps;
|
|
steps.Add(_L("Preset"));
|
|
steps.Add(_L("Calibration"));
|
|
steps.Add(_L("Record Factor"));
|
|
m_step_panel->set_steps_string(steps);
|
|
m_step_panel->set_steps(0);
|
|
if (m_cali_stage_panel)
|
|
m_cali_stage_panel->Show(false);
|
|
if (m_custom_range_panel)
|
|
m_custom_range_panel->Show(false);
|
|
if (m_pa_cali_method_combox)
|
|
m_pa_cali_method_combox->Show(false);
|
|
}
|
|
}
|
|
|
|
void CalibrationPresetPage::on_cali_start_job()
|
|
{
|
|
m_sending_panel->reset();
|
|
m_sending_panel->Show();
|
|
Enable_Send_Button(false);
|
|
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_CALI, false);
|
|
Layout();
|
|
Fit();
|
|
|
|
m_stop_update_page_status = true;
|
|
}
|
|
|
|
void CalibrationPresetPage::on_cali_finished_job()
|
|
{
|
|
m_sending_panel->reset();
|
|
m_sending_panel->Show(false);
|
|
update_print_status_msg(wxEmptyString, false);
|
|
Enable_Send_Button(true);
|
|
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_CALI, true);
|
|
Layout();
|
|
Fit();
|
|
|
|
m_stop_update_page_status = false;
|
|
}
|
|
|
|
void CalibrationPresetPage::on_cali_cancel_job()
|
|
{
|
|
BOOST_LOG_TRIVIAL(info) << "CalibrationWizard::print_job: enter canceled";
|
|
if (CalibUtils::print_worker) {
|
|
BOOST_LOG_TRIVIAL(info) << "calibration_print_job: canceled";
|
|
CalibUtils::print_worker->cancel_all();
|
|
CalibUtils::print_worker->wait_for_idle();
|
|
}
|
|
|
|
m_sending_panel->reset();
|
|
m_sending_panel->Show(false);
|
|
update_print_status_msg(wxEmptyString, false);
|
|
Enable_Send_Button(true);
|
|
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_CALI, true);
|
|
Layout();
|
|
Fit();
|
|
|
|
m_stop_update_page_status = false;
|
|
}
|
|
|
|
void CalibrationPresetPage::init_with_machine(MachineObject* obj)
|
|
{
|
|
if (!obj) return;
|
|
|
|
//set flow ratio calibration type
|
|
m_cali_stage_panel->set_flow_ratio_calibration_type(obj->flow_ratio_calibration_type);
|
|
// set nozzle value from machine
|
|
bool nozzle_is_set = false;
|
|
for (int i = 0; i < NOZZLE_LIST_COUNT; i++) {
|
|
if (abs(obj->nozzle_diameter - nozzle_diameter_list[i]) < 1e-3) {
|
|
if (m_comboBox_nozzle_dia->GetCount() > i) {
|
|
m_comboBox_nozzle_dia->SetSelection(i);
|
|
nozzle_is_set = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (nozzle_is_set) {
|
|
wxCommandEvent event(wxEVT_COMBOBOX);
|
|
event.SetEventObject(this);
|
|
wxPostEvent(m_comboBox_nozzle_dia, event);
|
|
m_comboBox_nozzle_dia->SetToolTip(_L("The nozzle diameter has been synchronized from the printer Settings"));
|
|
} else {
|
|
m_comboBox_nozzle_dia->SetToolTip(wxEmptyString);
|
|
// set default to 0.4
|
|
if (m_comboBox_nozzle_dia->GetCount() > NOZZLE_LIST_DEFAULT)
|
|
m_comboBox_nozzle_dia->SetSelection(NOZZLE_LIST_DEFAULT);
|
|
}
|
|
|
|
// set bed type collection from machine
|
|
//if (m_cali_mode == CalibMode::Calib_PA_Line)
|
|
// update_plate_type_collection(m_cali_method);
|
|
|
|
// init default for filament source
|
|
// TODO if user change ams/ext, need to update
|
|
if ( !obj->has_ams() || (obj->m_tray_now == std::to_string(VIRTUAL_TRAY_ID)) )
|
|
{
|
|
m_ext_spool_radiobox->SetValue(true);
|
|
m_ams_radiobox->SetValue(false);
|
|
wxCommandEvent event(wxEVT_RADIOBUTTON);
|
|
event.SetEventObject(this);
|
|
wxPostEvent(this->m_ext_spool_radiobox, event);
|
|
}
|
|
else {
|
|
m_ams_radiobox->SetValue(true);
|
|
m_ext_spool_radiobox->SetValue(false);
|
|
wxCommandEvent event(wxEVT_RADIOBUTTON);
|
|
event.SetEventObject(this);
|
|
wxPostEvent(this->m_ams_radiobox, event);
|
|
}
|
|
Layout();
|
|
|
|
// init filaments for calibration
|
|
sync_ams_info(obj);
|
|
}
|
|
|
|
void CalibrationPresetPage::sync_ams_info(MachineObject* obj)
|
|
{
|
|
if (!obj) return;
|
|
|
|
std::map<int, DynamicPrintConfig> full_filament_ams_list = wxGetApp().sidebar().build_filament_ams_list(obj);
|
|
|
|
// sync filament_ams_list from obj ams list
|
|
filament_ams_list.clear();
|
|
for (auto& ams_item : obj->amsList) {
|
|
for (auto& tray_item: ams_item.second->trayList) {
|
|
int tray_id = -1;
|
|
if (!tray_item.second->id.empty()) {
|
|
try {
|
|
tray_id = stoi(tray_item.second->id) + stoi(ams_item.second->id) * 4;
|
|
}
|
|
catch (...) {
|
|
;
|
|
}
|
|
}
|
|
auto filament_ams = full_filament_ams_list.find(tray_id);
|
|
if (filament_ams != full_filament_ams_list.end()) {
|
|
filament_ams_list[tray_id] = filament_ams->second;
|
|
}
|
|
}
|
|
}
|
|
|
|
// init virtual tray info
|
|
if (full_filament_ams_list.find(VIRTUAL_TRAY_ID) != full_filament_ams_list.end()) {
|
|
filament_ams_list[VIRTUAL_TRAY_ID] = full_filament_ams_list[VIRTUAL_TRAY_ID];
|
|
}
|
|
|
|
|
|
// update filament from panel, display only obj has ams
|
|
// update multi ams panel, display only obj has multi ams
|
|
if (obj->has_ams()) {
|
|
if (obj->amsList.size() > 1) {
|
|
m_multi_ams_panel->Show();
|
|
on_switch_ams(obj->amsList.begin()->first);
|
|
} else {
|
|
m_multi_ams_panel->Hide();
|
|
if (!obj->amsList.empty())
|
|
update_filament_combobox(obj->amsList.begin()->first);
|
|
}
|
|
}
|
|
else {
|
|
update_filament_combobox();
|
|
m_multi_ams_panel->Hide();
|
|
}
|
|
|
|
std::vector<AMSinfo> ams_info;
|
|
for (auto ams = obj->amsList.begin(); ams != obj->amsList.end(); ams++) {
|
|
AMSinfo info;
|
|
info.ams_id = ams->first;
|
|
if (ams->second->is_exists
|
|
&& info.parse_ams_info(obj, ams->second, obj->ams_calibrate_remain_flag, obj->is_support_ams_humidity)) {
|
|
ams_info.push_back(info);
|
|
}
|
|
}
|
|
|
|
for (auto i = 0; i < m_ams_item_list.size(); i++) {
|
|
AMSItem* item = m_ams_item_list[i];
|
|
if (ams_info.size() > 1) {
|
|
if (i < ams_info.size()) {
|
|
item->Update(ams_info[i]);
|
|
item->Open();
|
|
} else {
|
|
item->Close();
|
|
}
|
|
} else {
|
|
item->Close();
|
|
}
|
|
}
|
|
|
|
Layout();
|
|
}
|
|
|
|
void CalibrationPresetPage::select_default_compatible_filament()
|
|
{
|
|
if (!curr_obj)
|
|
return;
|
|
|
|
if (m_ams_radiobox->GetValue()) {
|
|
std::vector<Preset*> multi_select_filaments;
|
|
for (auto &fcb : m_filament_comboBox_list) {
|
|
if (!fcb->GetRadioBox()->IsEnabled())
|
|
continue;
|
|
|
|
Preset* preset = const_cast<Preset *>(fcb->GetComboBox()->get_selected_preset());
|
|
if (m_cali_filament_mode == CalibrationFilamentMode::CALI_MODEL_SINGLE) {
|
|
if (preset && is_filaments_compatiable({preset})) {
|
|
fcb->GetRadioBox()->SetValue(true);
|
|
wxCommandEvent event(wxEVT_RADIOBUTTON);
|
|
event.SetEventObject(this);
|
|
wxPostEvent(fcb->GetRadioBox(), event);
|
|
Layout();
|
|
break;
|
|
} else
|
|
fcb->GetRadioBox()->SetValue(false);
|
|
} else if (m_cali_filament_mode == CalibrationFilamentMode::CALI_MODEL_MULITI) {
|
|
if (!preset) {
|
|
fcb->GetCheckBox()->SetValue(false);
|
|
continue;
|
|
}
|
|
multi_select_filaments.push_back(preset);
|
|
if (!is_filaments_compatiable(multi_select_filaments)) {
|
|
multi_select_filaments.pop_back();
|
|
fcb->GetCheckBox()->SetValue(false);
|
|
}
|
|
else
|
|
fcb->GetCheckBox()->SetValue(true);
|
|
|
|
wxCommandEvent event(wxEVT_CHECKBOX);
|
|
event.SetEventObject(this);
|
|
wxPostEvent(fcb->GetCheckBox(), event);
|
|
Layout();
|
|
}
|
|
}
|
|
}
|
|
else if (m_ext_spool_radiobox->GetValue()){
|
|
Preset *preset = const_cast<Preset *>(m_virtual_tray_comboBox->GetComboBox()->get_selected_preset());
|
|
if (preset && is_filaments_compatiable({preset})) {
|
|
m_virtual_tray_comboBox->GetRadioBox()->SetValue(true);
|
|
} else
|
|
m_virtual_tray_comboBox->GetRadioBox()->SetValue(false);
|
|
|
|
wxCommandEvent event(wxEVT_RADIOBUTTON);
|
|
event.SetEventObject(this);
|
|
wxPostEvent(m_virtual_tray_comboBox->GetRadioBox(), event);
|
|
Layout();
|
|
}
|
|
else {
|
|
assert(false);
|
|
}
|
|
|
|
check_filament_compatible();
|
|
}
|
|
|
|
std::vector<FilamentComboBox*> CalibrationPresetPage::get_selected_filament_combobox()
|
|
{
|
|
std::vector<FilamentComboBox*> fcb_list;
|
|
|
|
if (m_ext_spool_radiobox->GetValue()) {
|
|
if (m_ext_spool_panel) {
|
|
if (m_virtual_tray_comboBox->GetRadioBox()->GetValue())
|
|
fcb_list.push_back(m_virtual_tray_comboBox);
|
|
}
|
|
} else if (m_ams_radiobox->GetValue()) {
|
|
if (m_cali_filament_mode == CalibrationFilamentMode::CALI_MODEL_MULITI) {
|
|
for (auto& fcb : m_filament_comboBox_list) {
|
|
if (fcb->GetCheckBox()->GetValue()) {
|
|
fcb_list.push_back(fcb);
|
|
}
|
|
}
|
|
}
|
|
else if (m_cali_filament_mode == CalibrationFilamentMode::CALI_MODEL_SINGLE) {
|
|
for (auto& fcb : m_filament_comboBox_list) {
|
|
if (fcb->GetRadioBox()->GetValue()) {
|
|
fcb_list.push_back(fcb);
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
assert(false);
|
|
}
|
|
|
|
return fcb_list;
|
|
}
|
|
|
|
std::map<int, Preset*> CalibrationPresetPage::get_selected_filaments()
|
|
{
|
|
std::map<int, Preset*> out;
|
|
std::vector<FilamentComboBox*> fcb_list = get_selected_filament_combobox();
|
|
|
|
for (int i = 0; i < fcb_list.size(); i++) {
|
|
Preset* preset = const_cast<Preset*>(fcb_list[i]->GetComboBox()->get_selected_preset());
|
|
// valid tray id
|
|
if (fcb_list[i]->get_tray_id() >= 0) {
|
|
out.emplace(std::make_pair(fcb_list[i]->get_tray_id(), preset));
|
|
}
|
|
}
|
|
|
|
|
|
return out;
|
|
}
|
|
|
|
void CalibrationPresetPage::get_preset_info(float& nozzle_dia, BedType& plate_type)
|
|
{
|
|
if (m_comboBox_nozzle_dia->GetSelection() >=0 && m_comboBox_nozzle_dia->GetSelection() < NOZZLE_LIST_COUNT) {
|
|
nozzle_dia = nozzle_diameter_list[m_comboBox_nozzle_dia->GetSelection()];
|
|
} else {
|
|
nozzle_dia = -1.0f;
|
|
}
|
|
|
|
if (m_comboBox_bed_type->GetSelection() >= 0)
|
|
plate_type = static_cast<BedType>(m_comboBox_bed_type->GetSelection() + 1);
|
|
}
|
|
|
|
void CalibrationPresetPage::get_cali_stage(CaliPresetStage& stage, float& value)
|
|
{
|
|
m_cali_stage_panel->get_cali_stage(stage, value);
|
|
|
|
if (stage != CaliPresetStage::CALI_MANUAL_STAGE_2) {
|
|
std::map<int, Preset*> selected_filaments = get_selected_filaments();
|
|
if (!selected_filaments.empty()) {
|
|
const ConfigOptionFloats* flow_ratio_opt = selected_filaments.begin()->second->config.option<ConfigOptionFloats>("filament_flow_ratio");
|
|
if (flow_ratio_opt) {
|
|
m_cali_stage_panel->set_flow_ratio_value(flow_ratio_opt->get_at(0));
|
|
value = flow_ratio_opt->get_at(0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void CalibrationPresetPage::update_filament_combobox(std::string ams_id)
|
|
{
|
|
for (auto& fcb : m_filament_comboBox_list) {
|
|
fcb->update_from_preset();
|
|
fcb->set_select_mode(m_cali_filament_mode);
|
|
}
|
|
|
|
DynamicPrintConfig empty_config;
|
|
empty_config.set_key_value("filament_id", new ConfigOptionStrings{ "" });
|
|
empty_config.set_key_value("tag_uid", new ConfigOptionStrings{ "" });
|
|
empty_config.set_key_value("filament_type", new ConfigOptionStrings{ "" });
|
|
empty_config.set_key_value("tray_name", new ConfigOptionStrings{ "" });
|
|
empty_config.set_key_value("filament_colour", new ConfigOptionStrings{ "" });
|
|
empty_config.set_key_value("filament_exist", new ConfigOptionBools{ false });
|
|
|
|
/* update virtual tray combo box*/
|
|
m_virtual_tray_comboBox->update_from_preset();
|
|
auto it = std::find_if(filament_ams_list.begin(), filament_ams_list.end(), [](auto& entry) {
|
|
return entry.first == VIRTUAL_TRAY_ID;
|
|
});
|
|
|
|
if (it != filament_ams_list.end()) {
|
|
m_virtual_tray_comboBox->load_tray_from_ams(VIRTUAL_TRAY_ID, it->second);
|
|
}
|
|
else {
|
|
m_virtual_tray_comboBox->load_tray_from_ams(VIRTUAL_TRAY_ID, empty_config);
|
|
}
|
|
|
|
if (filament_ams_list.empty())
|
|
return;
|
|
|
|
int ams_id_int = 0;
|
|
try {
|
|
if (!ams_id.empty())
|
|
ams_id_int = stoi(ams_id.c_str());
|
|
|
|
} catch (...) {}
|
|
|
|
for (int i = 0; i < 4; i++) {
|
|
int tray_index = ams_id_int * 4 + i;
|
|
|
|
auto it = std::find_if(filament_ams_list.begin(), filament_ams_list.end(), [tray_index](auto& entry) {
|
|
return entry.first == tray_index;
|
|
});
|
|
|
|
if (it != filament_ams_list.end()) {
|
|
m_filament_comboBox_list[i]->load_tray_from_ams(tray_index, it->second);
|
|
}
|
|
else {
|
|
m_filament_comboBox_list[i]->load_tray_from_ams(tray_index, empty_config);
|
|
}
|
|
}
|
|
}
|
|
|
|
Preset* CalibrationPresetPage::get_printer_preset(MachineObject* obj, float nozzle_value)
|
|
{
|
|
if (!obj) return nullptr;
|
|
|
|
Preset* printer_preset = nullptr;
|
|
PresetBundle* preset_bundle = wxGetApp().preset_bundle;
|
|
for (auto printer_it = preset_bundle->printers.begin(); printer_it != preset_bundle->printers.end(); printer_it++) {
|
|
// only use system printer preset
|
|
if (!printer_it->is_system) continue;
|
|
|
|
ConfigOption* printer_nozzle_opt = printer_it->config.option("nozzle_diameter");
|
|
ConfigOptionFloats* printer_nozzle_vals = nullptr;
|
|
if (printer_nozzle_opt)
|
|
printer_nozzle_vals = dynamic_cast<ConfigOptionFloats*>(printer_nozzle_opt);
|
|
std::string model_id = printer_it->get_current_printer_type(preset_bundle);
|
|
|
|
std::string printer_type = obj->printer_type;
|
|
if (obj->is_support_p1s_plus) { printer_type = "C12"; }
|
|
if (model_id.compare(printer_type) == 0
|
|
&& printer_nozzle_vals
|
|
&& abs(printer_nozzle_vals->get_at(0) - nozzle_value) < 1e-3) {
|
|
printer_preset = &(*printer_it);
|
|
}
|
|
}
|
|
|
|
return printer_preset;
|
|
}
|
|
|
|
Preset* CalibrationPresetPage::get_print_preset()
|
|
{
|
|
Preset* printer_preset = get_printer_preset(curr_obj, get_nozzle_value());
|
|
|
|
Preset* print_preset = nullptr;
|
|
wxArrayString print_items;
|
|
|
|
// get default print profile
|
|
std::string default_print_profile_name;
|
|
if (printer_preset && printer_preset->config.has("default_print_profile")) {
|
|
default_print_profile_name = printer_preset->config.opt_string("default_print_profile");
|
|
}
|
|
|
|
PresetBundle* preset_bundle = wxGetApp().preset_bundle;
|
|
if (preset_bundle) {
|
|
for (auto print_it = preset_bundle->prints.begin(); print_it != preset_bundle->prints.end(); print_it++) {
|
|
if (print_it->name == default_print_profile_name) {
|
|
print_preset = &(*print_it);
|
|
BOOST_LOG_TRIVIAL(trace) << "CaliPresetPage: get_print_preset = " << print_preset->name;
|
|
}
|
|
}
|
|
}
|
|
|
|
return print_preset;
|
|
}
|
|
|
|
std::string CalibrationPresetPage::get_print_preset_name()
|
|
{
|
|
Preset* print_preset = get_print_preset();
|
|
if (print_preset)
|
|
return print_preset->name;
|
|
return "";
|
|
}
|
|
|
|
wxArrayString CalibrationPresetPage::get_custom_range_values()
|
|
{
|
|
if (m_custom_range_panel) {
|
|
return m_custom_range_panel->get_values();
|
|
}
|
|
return wxArrayString();
|
|
}
|
|
|
|
CalibMode CalibrationPresetPage::get_pa_cali_method()
|
|
{
|
|
if (m_pa_cali_method_combox) {
|
|
int selected_mode = m_pa_cali_method_combox->get_selection();
|
|
if (selected_mode == PA_LINE) {
|
|
return CalibMode::Calib_PA_Line;
|
|
}
|
|
else if (selected_mode == PA_PATTERN) {
|
|
return CalibMode::Calib_PA_Pattern;
|
|
}
|
|
}
|
|
return CalibMode::Calib_PA_Line;
|
|
}
|
|
|
|
MaxVolumetricSpeedPresetPage::MaxVolumetricSpeedPresetPage(
|
|
wxWindow *parent, CalibMode cali_mode, bool custom_range, wxWindowID id, const wxPoint &pos, const wxSize &size, long style)
|
|
: CalibrationPresetPage(parent, cali_mode, custom_range, id, pos, size, style)
|
|
{
|
|
if (custom_range && m_custom_range_panel) {
|
|
wxArrayString titles;
|
|
titles.push_back(_L("From Volumetric Speed"));
|
|
titles.push_back(_L("To Volumetric Speed"));
|
|
titles.push_back(_L("Step"));
|
|
m_custom_range_panel->set_titles(titles);
|
|
|
|
m_custom_range_panel->set_unit("mm³/s");
|
|
}
|
|
}
|
|
}}
|