From 753ae874682fd9af81c75061415ea3a22ee81abe Mon Sep 17 00:00:00 2001 From: Ivan Ivanov Date: Sat, 4 Feb 2023 12:45:30 +0200 Subject: [PATCH] Squashed commit of the following: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit 6b17d4a583e10b9c9762dfb673b203a68c70a8f6 Merge: 73fa199782 218ca05304 Author: uBaHoFF <85784399+uBaHoFF@users.noreply.github.com> Date: Sat Feb 4 12:40:50 2023 +0200 Merge branch 'bugfix-2.1.x' into HEVO-BTT-SKR-1.3 commit 218ca0530432d6b1194ccac5fc32a72bbc9a7c96 Author: Victor Oliveira Date: Sat Feb 4 05:10:26 2023 -0300 🧑‍💻 General 'MediaFile' type alias (#24424) commit 08d9cbb9306a032d706a6ded0bf576fd0c58ca8d Author: vyacheslav-shubin Date: Sat Feb 4 10:36:07 2023 +0300 🧑‍💻 Add SD Card 'hide' method for dev usage (#22425) commit 7c0b4657546d62a740651d3fee802cae62bd99da Author: thinkyhead Date: Fri Feb 3 06:06:11 2023 +0000 [cron] Bump distribution date (2023-02-03) commit cea176ab3658cfbf68b73aff79b2e52eef4b5948 Author: Martin Turski Date: Fri Feb 3 04:01:22 2023 +0100 🔨 Fix test build path with spaces (#25329) commit cb7af50bafcd377a77aa4965e3fa85caa5e6bdcb Author: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Thu Feb 2 17:41:46 2023 -0800 📝 Fix Z*_ENDSTOP_ADJUSTMENT comments (#25295) commit a80036e3ca867ffdd4a4ffb9607eaeeb33cd581a Author: thinkyhead Date: Thu Feb 2 00:23:18 2023 +0000 [cron] Bump distribution date (2023-02-02) commit 8f11428db11e83f92c4810c6e27108912b01d8b7 Author: kg333 Date: Wed Feb 1 19:02:26 2023 -0500 📺 Melzi v4 with BTT SKR Mini E3 (#25321) commit 3be967bcb4f2e66500756163ebd036b7d235af1f Author: Scott Lahteine Date: Wed Feb 1 02:19:47 2023 -0600 🩹 PID / MPC heating followup Followup to #25314 commit 57a7e28145de06d58be25d5d873586970e6db3d0 Author: Bob Kuhn Date: Wed Feb 1 02:43:06 2023 -0600 🩹 Fix progress DOGM compile error (#25319) commit 64338dfccb8416a16951d3bd4dcf6aab96bf2e4f Author: Bob Kuhn Date: Wed Feb 1 01:51:11 2023 -0600 🔧 Fix SD sorting sanity checks (#25318) commit fbe9237a6c934b8c16e39b879b04973063c3988c Author: alexgrach Date: Wed Feb 1 10:40:13 2023 +0300 🐛 Fix TFT touch buttons, button colors (#25300) commit d6f4f24658cd6d307d395077020be85ecb0d2210 Author: tombrazier <68918209+tombrazier@users.noreply.github.com> Date: Wed Feb 1 07:25:13 2023 +0000 🩹 Fix PID / MPC heating flags (#25314) Co-authored-by: Scott Lahteine commit aae103e3592eceefe46320882cc96320b995a245 Author: thinkyhead Date: Wed Feb 1 00:25:54 2023 +0000 [cron] Bump distribution date (2023-02-01) commit 738f0a10f532881204d567a6c07240ec8c3c3052 Author: Dan Royer Date: Mon Jan 30 22:12:03 2023 -0800 ✨ POLARGRAPH / PEN_UP_DOWN_MENU (#25303) Co-authored-by: Dan Royer <1464454+i-make-robots@users.noreply.github.com> commit 5446968a5885ff0fef6cc66516db72b123511200 Author: thinkyhead Date: Tue Jan 31 06:05:55 2023 +0000 [cron] Bump distribution date (2023-01-31) commit 2dda0c0da2528c88b4a5660c60883d95896999b8 Author: Giuliano Zaro <3684609+GMagician@users.noreply.github.com> Date: Tue Jan 31 06:07:51 2023 +0100 🌐 Update Italian language (#25309) commit 7ad3586f822f3a3f5c79ab4a6b067660799b1de9 Author: Roman Moravčík Date: Tue Jan 31 06:07:03 2023 +0100 🌐 Update Slovak language (#25305) commit 087e19a0ed4b769224d42cca83c8caccefce63c9 Author: Scott Lahteine Date: Mon Jan 30 22:11:50 2023 -0600 🔧 Fix build with no Y axis (#25311) commit d0a965a1df3cab6522704c4a9b2e85b53b3c5c40 Author: Darren Garnier Date: Mon Jan 30 23:00:49 2023 -0500 🔨 Fix config.ini URL fetch (#25313) commit 0c181fc9d3ebd77d613cff63ccb82f2e4d4c39ec Author: Bob Kuhn Date: Mon Jan 30 21:57:36 2023 -0600 🩹 Fix G61 axis parameters with no offset (#25312) commit 67bc855000345921281a2c8c210e4363542f6a81 Author: thinkyhead Date: Fri Jan 27 00:27:06 2023 +0000 [cron] Bump distribution date (2023-01-27) commit ab767a4586a5c0c9ca1c7afeb43d0ee226a1e38d Author: alexgrach Date: Fri Jan 27 03:20:09 2023 +0300 🐛 Fix TFT Color UI LCD_HEIGHT (#25281) commit 0e748da7d39f6d2193257478e6f997cb4a4fc1a5 Author: xBiohazardx <36756950+xBiohazardx@users.noreply.github.com> Date: Fri Jan 27 01:05:04 2023 +0100 ✏️ Fix probe invert flag (#25282) commit 2637153575a6ee695a6edb0ac561ee7899fba2f2 Author: thinkyhead Date: Thu Jan 26 06:05:55 2023 +0000 [cron] Bump distribution date (2023-01-26) commit a2c93c24a69ab5342bd92c92426628e45b790d8f Author: avionix-g <63542699+avionix-g@users.noreply.github.com> Date: Wed Jan 25 23:14:52 2023 -0500 🐛 Fix MKS board Ultipanel support (#25278) commit 4f902ac950e02d1d4e4b13afdec46937364ec22d Author: Alexander Gavrilenko Date: Thu Jan 26 07:05:43 2023 +0300 🐛 Fix Simulator TFT compile (#25279) commit cf02107e6a8f9a122f15b38ed6b699215ee7cf16 Author: Scott Lahteine Date: Wed Jan 25 21:37:10 2023 -0600 🔧 Refine Input Shaping check (#25280) commit 7a49fab16d9fd3df238cbd341f90b067e401b17c Author: thinkyhead Date: Tue Jan 24 12:07:25 2023 +0000 [cron] Bump distribution date (2023-01-24) commit 73932855609aa949fa13e3570659ce26c43b0ab8 Author: Scott Lahteine Date: Fri Jan 20 21:17:13 2023 -0600 SDIO retry, hsd clock, etc. commit e0ae072f5a7094af02704fd7ccc4f3894f076d7a Author: Scott Lahteine Date: Tue Jan 24 02:21:02 2023 -0600 🔧 Overridable Stepper EN init commit 4099763cfc06cc6b2d71a1fce76d73422183fac0 Author: thinkyhead Date: Mon Jan 23 12:07:26 2023 +0000 [cron] Bump distribution date (2023-01-23) commit 32688979a166d334bb20d696f521bdffeaf92357 Author: Bob Kuhn Date: Mon Jan 23 01:37:35 2023 -0600 🐛 Fix Ender-2 Stock Display with Melzi (#25258) commit fffc96661f53735691b6287c8bb90d0229dbfaae Author: Scott Lahteine Date: Mon Jan 23 01:22:03 2023 -0600 🐛 Fix homing_needed_error bits commit e656f108c8161de94427dfb65ca74153cd231a31 Author: thinkyhead Date: Sun Jan 22 06:05:45 2023 +0000 [cron] Bump distribution date (2023-01-22) commit 7e72981b8cbaa7a6276f6833527e97cb10e060e7 Author: Scott Lahteine Date: Sat Jan 21 22:57:56 2023 -0600 🚸 Fix homing_needed_error language commit b7c23631c5840e2338cae531b171459e9e9c5301 Author: ellensp <530024+ellensp@users.noreply.github.com> Date: Sun Jan 22 15:08:37 2023 +1300 🐛 Fix misc. UI issues (#25252) Co-authored-by: Scott Lahteine commit f2b8942adc6ff85fe99c0bd5ebae83acdf4e1b75 Author: thinkyhead Date: Wed Jan 18 00:22:56 2023 +0000 [cron] Bump distribution date (2023-01-18) commit f81c468f1e4fab9df0741011d34852886a6ab8cc Author: John Robertson Date: Tue Jan 17 23:53:39 2023 +0000 🐛 Fix potential I2S buffer overwrite (#25113) commit b3f65b674f23db5c32e4d7e96ad2dff97c77c717 Author: Miguel Risco-Castillo Date: Tue Jan 17 18:41:36 2023 -0500 🚸 ProUI MPC menu (#25232) Co-authored-by: Scott Lahteine commit 99d1b04a1f1d66aef78994fd98189a9ba9acbcb1 Author: alexgrach Date: Wed Jan 18 02:37:19 2023 +0300 ✨ TFT 320x240 portrait (#25207) Co-authored-by: Scott Lahteine commit 58f64eaeba35107cff15ed225577c553b23a6627 Author: thinkyhead Date: Tue Jan 17 06:05:52 2023 +0000 [cron] Bump distribution date (2023-01-17) commit c4482083ac901b1691662ed01ec89f8a2cba6874 Author: Scott Lahteine Date: Mon Jan 16 22:11:49 2023 -0600 🎨 Heading cleanup commit 938d7b5e14fadf7c0f63bfaf4726f7ce5045e27b Author: thinkyhead Date: Mon Jan 16 00:22:07 2023 +0000 [cron] Bump distribution date (2023-01-16) commit 6fe387b6f0722033e6cca96fd5e8215ea7b162eb Author: Scott Lahteine Date: Sun Jan 15 06:48:17 2023 -0600 🧑‍💻 Adjust PID / MPC / ProUI Changes to simplify #25232 WIP commit d94defc545ad477c82a8bc77e949aa91cdd3e0f2 Author: Scott Lahteine Date: Sun Jan 15 06:48:17 2023 -0600 🎨 Language / menu cleanup commit 212167b140f7a1b6f24ff69cf367860b78812c05 Author: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Sun Jan 15 05:25:36 2023 -0800 📝 No longer experimental (#25238) commit d753781dc0c4853e8aac1cd997a5f105fbb8fa3a Author: thinkyhead Date: Sun Jan 15 12:06:24 2023 +0000 [cron] Bump distribution date (2023-01-15) commit da87c203c1e70bf719b90f7bfdce6027861bef90 Author: Scott Lahteine Date: Sun Jan 15 01:19:45 2023 -0600 🔖 Config version 02010300 commit 5acf73868876da8baf823e7b95f49265935c249b Author: Scott Lahteine Date: Sun Jan 15 01:11:49 2023 -0600 🔧 Added MOTHERBOARD error text commit 80a25550128b05a7761e4a3bd365b853891b48d4 Author: thinkyhead Date: Sat Jan 14 18:05:38 2023 +0000 [cron] Bump distribution date (2023-01-14) commit 5fd5cb02f6b26f32fd9b49fb37e53a93531da98c Author: Scott Lahteine Date: Sat Jan 14 07:44:57 2023 -0600 ✏️ ProUI followup commit 7503ac3c67b1521f8d2c822f51b46c97a884a21e Author: thinkyhead Date: Fri Jan 13 00:22:51 2023 +0000 [cron] Bump distribution date (2023-01-13) commit 80dc7b290b38f042eb994b8c306b18c602f410aa Author: Scott Lahteine Date: Wed Jan 11 20:31:46 2023 -0600 🔧 Input Shaping sanity checks commit 3d0b11a373746f8a08dc6d84d38e7c747990f143 Author: thinkyhead Date: Thu Jan 12 01:39:45 2023 +0000 [cron] Bump distribution date (2023-01-12) commit 73fa19978267c07bca28ef201e89a681a7c7d520 Merge: 64447619c6 0838f70b25 Author: uBaHoFF <85784399+uBaHoFF@users.noreply.github.com> Date: Thu Jan 12 01:20:10 2023 +0200 Merge branch 'bugfix-2.1.x' into HEVO-BTT-SKR-1.3 commit 0838f70b25316fa8a06d019e5ed5d446b5c207e2 Author: Scott Lahteine Date: Wed Jan 11 01:19:54 2023 -0600 🩹 Fix Sim with USE_WATCHDOG disabled commit 5af5c2a35c2bfa6c3128fd69f4c57a5eccc82147 Author: Scott Lahteine Date: Wed Jan 11 01:19:45 2023 -0600 🔨 Improve config.ini parser commit fe62c8006ab4884c73aa4cc2d58a1d8a13265d11 Author: thinkyhead Date: Wed Jan 11 06:24:37 2023 +0000 [cron] Bump distribution date (2023-01-11) commit 64167dfe79df4ef5f69b2632e3c0cc162fb22914 Author: Powerlated Date: Wed Jan 11 00:40:15 2023 -0500 ✨ PREHEAT_TIME_BED_MS (#25146) commit 250fd60920142467c4c44370abf6446744b557ef Author: Alex Z Date: Wed Jan 11 15:22:28 2023 +1000 🐛 Fix Chitu V6 Z_STOP_PIN (#25227) commit 01e58de31a804731d21c491952afd2347fda3753 Author: Scott Lahteine Date: Tue Jan 10 22:38:08 2023 -0600 🩹 ProUI - Remove ManualZOffset commit 7717beb79362522b8239d5af62b32ff3d0e2d748 Author: kadir ilkimen Date: Wed Jan 11 06:29:38 2023 +0200 ✨ Polar Kinematics (#25214) commit 33e5aad364e914be2d84d4f82da6321161a07cf0 Author: thinkyhead Date: Tue Jan 10 01:41:43 2023 +0000 [cron] Bump distribution date (2023-01-10) --- Marlin/Configuration.h | 286 ++++++++++- Marlin/Configuration_adv.h | 292 ++++++++++- Marlin/Version.h | 2 +- Marlin/src/HAL/AVR/fastio.h | 6 +- Marlin/src/HAL/ESP32/i2s.cpp | 32 +- Marlin/src/HAL/NATIVE_SIM/HAL.h | 4 +- Marlin/src/HAL/NATIVE_SIM/tft/tft_spi.h | 11 +- Marlin/src/HAL/STM32/eeprom_sdcard.cpp | 4 +- Marlin/src/HAL/STM32/sdio.cpp | 8 +- Marlin/src/HAL/STM32F1/eeprom_sdcard.cpp | 4 +- Marlin/src/HAL/STM32F1/onboard_sd.h | 28 +- Marlin/src/MarlinCore.cpp | 2 + Marlin/src/core/language.h | 1 + Marlin/src/core/serial.h | 4 +- Marlin/src/core/types.h | 117 +++-- .../src/feature/bedlevel/ubl/ubl_motion.cpp | 32 +- Marlin/src/feature/powerloss.cpp | 2 +- Marlin/src/feature/powerloss.h | 2 +- Marlin/src/feature/stepper_driver_safety.cpp | 2 +- Marlin/src/gcode/calibrate/G28.cpp | 19 +- Marlin/src/gcode/calibrate/G33.cpp | 4 +- Marlin/src/gcode/calibrate/M48.cpp | 4 +- Marlin/src/gcode/calibrate/M665.cpp | 19 + Marlin/src/gcode/config/M220.cpp | 15 +- Marlin/src/gcode/feature/pause/G61.cpp | 23 +- Marlin/src/gcode/gcode.h | 2 +- Marlin/src/gcode/geometry/M206_M428.cpp | 2 +- Marlin/src/gcode/host/M114.cpp | 2 +- Marlin/src/gcode/host/M115.cpp | 4 +- Marlin/src/gcode/host/M360.cpp | 1 + Marlin/src/gcode/motion/G0_G1.cpp | 2 +- Marlin/src/gcode/motion/G2_G3.cpp | 2 +- Marlin/src/gcode/temp/M303.cpp | 19 +- Marlin/src/gcode/temp/M306.cpp | 28 +- Marlin/src/inc/Conditionals_LCD.h | 130 ++--- Marlin/src/inc/Conditionals_adv.h | 58 ++- Marlin/src/inc/Conditionals_post.h | 27 +- Marlin/src/inc/SanityCheck.h | 150 ++++-- Marlin/src/inc/Version.h | 4 +- Marlin/src/inc/Warnings.cpp | 14 + Marlin/src/lcd/dogm/status_screen_DOGM.cpp | 8 +- .../lcd/dogm/status_screen_lite_ST7920.cpp | 6 +- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 2 +- Marlin/src/lcd/e3v2/proui/dwin.cpp | 398 +++++++++------ Marlin/src/lcd/e3v2/proui/dwin.h | 85 ++-- Marlin/src/lcd/e3v2/proui/dwin_defines.h | 4 +- Marlin/src/lcd/e3v2/proui/dwinui.cpp | 4 +- Marlin/src/lcd/e3v2/proui/dwinui.h | 16 +- Marlin/src/lcd/e3v2/proui/gcode_preview.cpp | 17 +- Marlin/src/lcd/e3v2/proui/gcode_preview.h | 24 +- Marlin/src/lcd/e3v2/proui/menus.cpp | 16 +- Marlin/src/lcd/e3v2/proui/menus.h | 18 +- Marlin/src/lcd/e3v2/proui/plot.cpp | 29 +- Marlin/src/lcd/e3v2/proui/plot.h | 23 +- .../src/lcd/extui/dgus/DGUSScreenHandler.cpp | 4 +- .../lcd/extui/dgus/DGUSScreenHandlerBase.h | 1 + Marlin/src/lcd/extui/dgus/dgus_extui.cpp | 12 +- .../extui/dgus_reloaded/DGUSScreenHandler.cpp | 4 +- .../extui/dgus_reloaded/DGUSScreenHandler.h | 8 +- Marlin/src/lcd/extui/example/example.cpp | 10 +- .../archim2-flash/media_file_reader.h | 2 +- .../ftdi_eve_touch_ui/ftdi_eve_extui.cpp | 4 +- .../generic/move_axis_screen.cpp | 66 +-- Marlin/src/lcd/extui/malyan/malyan_extui.cpp | 4 +- Marlin/src/lcd/extui/mks_ui/draw_dialog.cpp | 2 +- Marlin/src/lcd/extui/mks_ui/draw_ui.cpp | 4 +- Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp | 2 +- Marlin/src/lcd/extui/mks_ui/pic_manager.cpp | 6 +- Marlin/src/lcd/extui/mks_ui/wifi_module.cpp | 10 +- Marlin/src/lcd/extui/mks_ui/wifi_upload.cpp | 2 +- Marlin/src/lcd/extui/ui_api.cpp | 2 +- Marlin/src/lcd/extui/ui_api.h | 2 +- Marlin/src/lcd/language/language_an.h | 1 - Marlin/src/lcd/language/language_ca.h | 2 +- Marlin/src/lcd/language/language_cz.h | 3 +- Marlin/src/lcd/language/language_da.h | 3 +- Marlin/src/lcd/language/language_de.h | 7 +- Marlin/src/lcd/language/language_en.h | 31 +- Marlin/src/lcd/language/language_es.h | 3 +- Marlin/src/lcd/language/language_eu.h | 3 +- Marlin/src/lcd/language/language_fr.h | 5 +- Marlin/src/lcd/language/language_gl.h | 5 +- Marlin/src/lcd/language/language_hr.h | 1 - Marlin/src/lcd/language/language_hu.h | 5 +- Marlin/src/lcd/language/language_it.h | 39 +- Marlin/src/lcd/language/language_jp_kana.h | 3 +- Marlin/src/lcd/language/language_nl.h | 3 +- Marlin/src/lcd/language/language_pl.h | 3 +- Marlin/src/lcd/language/language_pt_br.h | 3 +- Marlin/src/lcd/language/language_ro.h | 5 +- Marlin/src/lcd/language/language_ru.h | 5 +- Marlin/src/lcd/language/language_sk.h | 89 +++- Marlin/src/lcd/language/language_sv.h | 5 +- Marlin/src/lcd/language/language_tr.h | 3 +- Marlin/src/lcd/language/language_uk.h | 5 +- Marlin/src/lcd/language/language_vi.h | 3 +- Marlin/src/lcd/language/language_zh_CN.h | 5 +- Marlin/src/lcd/language/language_zh_TW.h | 3 +- Marlin/src/lcd/marlinui.cpp | 11 +- Marlin/src/lcd/marlinui.h | 4 +- Marlin/src/lcd/menu/menu_advanced.cpp | 22 +- Marlin/src/lcd/menu/menu_bed_leveling.cpp | 10 +- Marlin/src/lcd/menu/menu_delta_calibrate.cpp | 2 +- Marlin/src/lcd/menu/menu_motion.cpp | 27 +- Marlin/src/lcd/tft/tft.h | 16 - Marlin/src/lcd/tft/tft_color.h | 13 + Marlin/src/lcd/tft/tft_font.h | 1 - Marlin/src/lcd/tft/ui_1024x600.cpp | 37 +- Marlin/src/lcd/tft/ui_1024x600.h | 6 +- Marlin/src/lcd/tft/ui_320x240.cpp | 473 +++++++++++++----- Marlin/src/lcd/tft/ui_320x240.h | 2 + Marlin/src/lcd/tft/ui_480x320.cpp | 25 +- Marlin/src/lcd/tft_io/tft_io.h | 59 +-- Marlin/src/lcd/tft_io/tft_orientation.h | 85 ++++ Marlin/src/module/delta.cpp | 2 +- Marlin/src/module/motion.cpp | 65 ++- Marlin/src/module/motion.h | 2 + Marlin/src/module/planner.cpp | 61 ++- Marlin/src/module/planner.h | 10 +- Marlin/src/module/polar.cpp | 102 ++++ Marlin/src/module/polar.h | 36 ++ Marlin/src/module/probe.h | 16 +- Marlin/src/module/settings.cpp | 20 +- Marlin/src/module/stepper.cpp | 78 ++- Marlin/src/module/stepper.h | 27 +- Marlin/src/module/temperature.cpp | 179 ++++--- Marlin/src/module/temperature.h | 76 ++- Marlin/src/module/tool_change.cpp | 12 +- Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h | 2 +- Marlin/src/pins/ramps/pins_K8400.h | 2 +- .../src/pins/sanguino/pins_MELZI_CREALITY.h | 19 +- .../stm32f1/pins_BTT_SKR_MINI_E3_common.h | 35 +- Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h | 2 + Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h | 27 +- .../pins/stm32f4/pins_MKS_MONSTER8_common.h | 2 +- .../stm32f4/pins_MKS_ROBIN_NANO_V3_common.h | 3 +- .../src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h | 2 +- Marlin/src/sd/SdBaseFile.cpp | 22 + Marlin/src/sd/SdBaseFile.h | 5 + Marlin/src/sd/SdFile.h | 2 + Marlin/src/sd/SdVolume.h | 2 + Marlin/src/sd/cardreader.cpp | 44 +- Marlin/src/sd/cardreader.h | 23 +- Marlin/src/sd/disk_io_driver.h | 1 + Marlin/src/sd/storage.h | 74 +++ .../src/sd/usb_flashdrive/lib-uhs2/settings.h | 10 +- buildroot/bin/run_tests | 2 +- .../share/PlatformIO/scripts/configuration.py | 22 +- .../sublime/MarlinFirmware.sublime-project | 2 +- buildroot/tests/LPC1768 | 2 +- buildroot/tests/LPC1769 | 2 +- buildroot/tests/SAMD21_minitronics20 | 2 +- buildroot/tests/SAMD51_grandcentral_m4 | 2 +- buildroot/tests/STM32F103RE_creality | 6 +- buildroot/tests/mks_robin_nano_v1v2_maple | 9 +- docs/Serial.md | 4 +- 156 files changed, 2854 insertions(+), 1361 deletions(-) create mode 100644 Marlin/src/lcd/tft_io/tft_orientation.h create mode 100644 Marlin/src/module/polar.cpp create mode 100644 Marlin/src/module/polar.h create mode 100644 Marlin/src/sd/storage.h diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 584335be2482..2cd5302551df 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -35,9 +35,7 @@ * Advanced settings can be found in Configuration_adv.h * */ -#ifndef CONFIGURATION_H -#define CONFIGURATION_H -#define CONFIGURATION_H_VERSION 010109 +#define CONFIGURATION_H_VERSION 02010300 //=========================================================================== //============================= Getting Started ============================= @@ -498,6 +496,211 @@ //#define COREZX //#define COREZY +// Enable for a belt style printer with endless "Z" motion +//#define BELTPRINTER + +// Enable for Polargraph Kinematics +//#define POLARGRAPH +#if ENABLED(POLARGRAPH) + #define POLARGRAPH_MAX_BELT_LEN 1035.0 // (mm) Belt length at full extension. Override with M665 H. + #define DEFAULT_SEGMENTS_PER_SECOND 5 // Move segmentation based on duration + #define PEN_UP_DOWN_MENU // Add "Pen Up" and "Pen Down" to the MarlinUI menu +#endif + +// @section delta + +// Enable for DELTA kinematics and configure below +//#define DELTA +#if ENABLED(DELTA) + + // Make delta curves from many straight lines (linear interpolation). + // This is a trade-off between visible corners (not enough segments) + // and processor overload (too many expensive sqrt calls). + #define DEFAULT_SEGMENTS_PER_SECOND 200 + + // After homing move down to a height where XY movement is unconstrained + //#define DELTA_HOME_TO_SAFE_ZONE + + // Delta calibration menu + // Add three-point calibration to the MarlinUI menu. + // See http://minow.blogspot.com/index.html#4918805519571907051 + //#define DELTA_CALIBRATION_MENU + + // G33 Delta Auto-Calibration. Enable EEPROM_SETTINGS to store results. + //#define DELTA_AUTO_CALIBRATION + + #if ENABLED(DELTA_AUTO_CALIBRATION) + // Default number of probe points : n*n (1 -> 7) + #define DELTA_CALIBRATION_DEFAULT_POINTS 4 + #endif + + #if EITHER(DELTA_AUTO_CALIBRATION, DELTA_CALIBRATION_MENU) + // Step size for paper-test probing + #define PROBE_MANUALLY_STEP 0.05 // (mm) + #endif + + // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). + #define PRINTABLE_RADIUS 140.0 // (mm) + + // Maximum reachable area + #define DELTA_MAX_RADIUS 140.0 // (mm) + + // Center-to-center distance of the holes in the diagonal push rods. + #define DELTA_DIAGONAL_ROD 250.0 // (mm) + + // Distance between bed and nozzle Z home position + #define DELTA_HEIGHT 250.00 // (mm) Get this value from G33 auto calibrate + + #define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } // Get these values from G33 auto calibrate + + // Horizontal distance bridged by diagonal push rods when effector is centered. + #define DELTA_RADIUS 124.0 // (mm) Get this value from G33 auto calibrate + + // Trim adjustments for individual towers + // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 + // measured in degrees anticlockwise looking from above the printer + #define DELTA_TOWER_ANGLE_TRIM { 0.0, 0.0, 0.0 } // Get these values from G33 auto calibrate + + // Delta radius and diagonal rod adjustments (mm) + //#define DELTA_RADIUS_TRIM_TOWER { 0.0, 0.0, 0.0 } + //#define DELTA_DIAGONAL_ROD_TRIM_TOWER { 0.0, 0.0, 0.0 } +#endif + +// @section scara + +/** + * MORGAN_SCARA was developed by QHARLEY in South Africa in 2012-2013. + * Implemented and slightly reworked by JCERNY in June, 2014. + * + * Mostly Printed SCARA is an open source design by Tyler Williams. See: + * https://www.thingiverse.com/thing:2487048 + * https://www.thingiverse.com/thing:1241491 + */ +//#define MORGAN_SCARA +//#define MP_SCARA +#if EITHER(MORGAN_SCARA, MP_SCARA) + // If movement is choppy try lowering this value + #define DEFAULT_SEGMENTS_PER_SECOND 200 + + // Length of inner and outer support arms. Measure arm lengths precisely. + #define SCARA_LINKAGE_1 150 // (mm) + #define SCARA_LINKAGE_2 150 // (mm) + + // SCARA tower offset (position of Tower relative to bed zero position) + // This needs to be reasonably accurate as it defines the printbed position in the SCARA space. + #define SCARA_OFFSET_X 100 // (mm) + #define SCARA_OFFSET_Y -56 // (mm) + + #if ENABLED(MORGAN_SCARA) + + //#define DEBUG_SCARA_KINEMATICS + #define FEEDRATE_SCALING // Convert XY feedrate from mm/s to degrees/s on the fly + + // Radius around the center where the arm cannot reach + #define MIDDLE_DEAD_ZONE_R 0 // (mm) + + #define THETA_HOMING_OFFSET 0 // Calculated from Calibration Guide and M360 / M114. See http://reprap.harleystudio.co.za/?page_id=1073 + #define PSI_HOMING_OFFSET 0 // Calculated from Calibration Guide and M364 / M114. See http://reprap.harleystudio.co.za/?page_id=1073 + + #elif ENABLED(MP_SCARA) + + #define SCARA_OFFSET_THETA1 12 // degrees + #define SCARA_OFFSET_THETA2 131 // degrees + + #endif + +#endif + +// @section tpara + +// Enable for TPARA kinematics and configure below +//#define AXEL_TPARA +#if ENABLED(AXEL_TPARA) + #define DEBUG_TPARA_KINEMATICS + #define DEFAULT_SEGMENTS_PER_SECOND 200 + + // Length of inner and outer support arms. Measure arm lengths precisely. + #define TPARA_LINKAGE_1 120 // (mm) + #define TPARA_LINKAGE_2 120 // (mm) + + // SCARA tower offset (position of Tower relative to bed zero position) + // This needs to be reasonably accurate as it defines the printbed position in the SCARA space. + #define TPARA_OFFSET_X 0 // (mm) + #define TPARA_OFFSET_Y 0 // (mm) + #define TPARA_OFFSET_Z 0 // (mm) + + #define FEEDRATE_SCALING // Convert XY feedrate from mm/s to degrees/s on the fly + + // Radius around the center where the arm cannot reach + #define MIDDLE_DEAD_ZONE_R 0 // (mm) + + // Calculated from Calibration Guide and M360 / M114. See http://reprap.harleystudio.co.za/?page_id=1073 + #define THETA_HOMING_OFFSET 0 + #define PSI_HOMING_OFFSET 0 +#endif + +// @section polar + +/** + * POLAR Kinematics + * developed by Kadir ilkimen for PolarBear CNC and babyBear + * https://github.com/kadirilkimen/Polar-Bear-Cnc-Machine + * https://github.com/kadirilkimen/babyBear-3D-printer + * + * A polar machine can have different configurations. + * This kinematics is only compatible with the following configuration: + * X : Independent linear + * Y or B : Polar + * Z : Independent linear + * + * For example, PolarBear has CoreXZ plus Polar Y or B. + * + * Motion problem for Polar axis near center / origin: + * + * 3D printing: + * Movements very close to the center of the polar axis take more time than others. + * This brief delay results in more material deposition due to the pressure in the nozzle. + * + * Current Kinematics and feedrate scaling deals with this by making the movement as fast + * as possible. It works for slow movements but doesn't work well with fast ones. A more + * complicated extrusion compensation must be implemented. + * + * Ideally, it should estimate that a long rotation near the center is ahead and will cause + * unwanted deposition. Therefore it can compensate the extrusion beforehand. + * + * Laser cutting: + * Same thing would be a problem for laser engraving too. As it spends time rotating at the + * center point, more likely it will burn more material than it should. Therefore similar + * compensation would be implemented for laser-cutting operations. + * + * Milling: + * This shouldn't be a problem for cutting/milling operations. + */ +//#define POLAR +#if ENABLED(POLAR) + #define DEFAULT_SEGMENTS_PER_SECOND 180 // If movement is choppy try lowering this value + #define PRINTABLE_RADIUS 82.0f // (mm) Maximum travel of X axis + + // Movements fall inside POLAR_FAST_RADIUS are assigned the highest possible feedrate + // to compensate unwanted deposition related to the near-origin motion problem. + #define POLAR_FAST_RADIUS 3.0f // (mm) + + // Radius which is unreachable by the tool. + // Needed if the tool is not perfectly aligned to the center of the polar axis. + #define POLAR_CENTER_OFFSET 0.0f // (mm) + + #define FEEDRATE_SCALING // Convert XY feedrate from mm/s to degrees/s on the fly +#endif + +// @section machine + +// Articulated robot (arm). Joints are directly mapped to axes with no kinematics. +//#define ARTICULATED_ROBOT_ARM + +// For a hot wire cutter with parallel horizontal axes (X, I) where the heights of the two wire +// ends are controlled by parallel axes (Y, J). Joints are directly mapped to axes (no kinematics). +//#define FOAMCUTTER_XYUV + //=========================================================================== //============================== Endstop Settings =========================== //=========================================================================== @@ -755,8 +958,75 @@ // /** - * Z Probe to nozzle (X,Y) offset, relative to (0, 0). - * X and Y offsets must be integers. + * Magnetically Mounted Probe + * For probes such as Euclid, Klicky, Klackender, etc. + */ +//#define MAG_MOUNTED_PROBE +#if ENABLED(MAG_MOUNTED_PROBE) + #define PROBE_DEPLOY_FEEDRATE (133*60) // (mm/min) Probe deploy speed + #define PROBE_STOW_FEEDRATE (133*60) // (mm/min) Probe stow speed + + #define MAG_MOUNTED_DEPLOY_1 { PROBE_DEPLOY_FEEDRATE, { 245, 114, 30 } } // Move to side Dock & Attach probe + #define MAG_MOUNTED_DEPLOY_2 { PROBE_DEPLOY_FEEDRATE, { 210, 114, 30 } } // Move probe off dock + #define MAG_MOUNTED_DEPLOY_3 { PROBE_DEPLOY_FEEDRATE, { 0, 0, 0 } } // Extra move if needed + #define MAG_MOUNTED_DEPLOY_4 { PROBE_DEPLOY_FEEDRATE, { 0, 0, 0 } } // Extra move if needed + #define MAG_MOUNTED_DEPLOY_5 { PROBE_DEPLOY_FEEDRATE, { 0, 0, 0 } } // Extra move if needed + #define MAG_MOUNTED_STOW_1 { PROBE_STOW_FEEDRATE, { 245, 114, 20 } } // Move to dock + #define MAG_MOUNTED_STOW_2 { PROBE_STOW_FEEDRATE, { 245, 114, 0 } } // Place probe beside remover + #define MAG_MOUNTED_STOW_3 { PROBE_STOW_FEEDRATE, { 230, 114, 0 } } // Side move to remove probe + #define MAG_MOUNTED_STOW_4 { PROBE_STOW_FEEDRATE, { 210, 114, 20 } } // Side move to remove probe + #define MAG_MOUNTED_STOW_5 { PROBE_STOW_FEEDRATE, { 0, 0, 0 } } // Extra move if needed +#endif + +// Duet Smart Effector (for delta printers) - https://bit.ly/2ul5U7J +// When the pin is defined you can use M672 to set/reset the probe sensitivity. +//#define DUET_SMART_EFFECTOR +#if ENABLED(DUET_SMART_EFFECTOR) + #define SMART_EFFECTOR_MOD_PIN -1 // Connect a GPIO pin to the Smart Effector MOD pin +#endif + +/** + * Use StallGuard2 to probe the bed with the nozzle. + * Requires stallGuard-capable Trinamic stepper drivers. + * CAUTION: This can damage machines with Z lead screws. + * Take extreme care when setting up this feature. + */ +//#define SENSORLESS_PROBING + +/** + * Allen key retractable z-probe as seen on many Kossel delta printers - https://reprap.org/wiki/Kossel#Automatic_bed_leveling_probe + * Deploys by touching z-axis belt. Retracts by pushing the probe down. + */ +//#define Z_PROBE_ALLEN_KEY +#if ENABLED(Z_PROBE_ALLEN_KEY) + // 2 or 3 sets of coordinates for deploying and retracting the spring loaded touch probe on G29, + // if servo actuated touch probe is not defined. Uncomment as appropriate for your printer/probe. + + #define Z_PROBE_ALLEN_KEY_DEPLOY_1 { 30.0, PRINTABLE_RADIUS, 100.0 } + #define Z_PROBE_ALLEN_KEY_DEPLOY_1_FEEDRATE XY_PROBE_FEEDRATE + + #define Z_PROBE_ALLEN_KEY_DEPLOY_2 { 0.0, PRINTABLE_RADIUS, 100.0 } + #define Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE (XY_PROBE_FEEDRATE)/10 + + #define Z_PROBE_ALLEN_KEY_DEPLOY_3 { 0.0, (PRINTABLE_RADIUS) * 0.75, 100.0 } + #define Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE XY_PROBE_FEEDRATE + + #define Z_PROBE_ALLEN_KEY_STOW_1 { -64.0, 56.0, 23.0 } // Move the probe into position + #define Z_PROBE_ALLEN_KEY_STOW_1_FEEDRATE XY_PROBE_FEEDRATE + + #define Z_PROBE_ALLEN_KEY_STOW_2 { -64.0, 56.0, 3.0 } // Push it down + #define Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE (XY_PROBE_FEEDRATE)/10 + + #define Z_PROBE_ALLEN_KEY_STOW_3 { -64.0, 56.0, 50.0 } // Move it up to clear + #define Z_PROBE_ALLEN_KEY_STOW_3_FEEDRATE XY_PROBE_FEEDRATE + + #define Z_PROBE_ALLEN_KEY_STOW_4 { 0.0, 0.0, 50.0 } + #define Z_PROBE_ALLEN_KEY_STOW_4_FEEDRATE XY_PROBE_FEEDRATE + +#endif // Z_PROBE_ALLEN_KEY + +/** + * Nozzle-to-Probe offsets { X, Y, Z } * * In the following example the X and Y offsets are both positive: * #define X_PROBE_OFFSET_FROM_EXTRUDER 10 @@ -1036,7 +1306,7 @@ //#define EXTRAPOLATE_BEYOND_GRID // - // Experimental Subdivision of the grid by Catmull-Rom method. + // Subdivision of the grid by Catmull-Rom method. // Synthesizes intermediate points to produce a more detailed mesh. // //#define ABL_BILINEAR_SUBDIVISION @@ -1282,7 +1552,7 @@ #endif /** - * Clean Nozzle Feature -- EXPERIMENTAL + * Clean Nozzle Feature * * Adds the G12 command to perform a nozzle cleaning process. * @@ -1316,8 +1586,6 @@ * Before starting, the nozzle moves to NOZZLE_CLEAN_START_POINT. * * Caveats: The ending Z should be the same as starting Z. - * Attention: EXPERIMENTAL. G-code arguments may change. - * */ //#define NOZZLE_CLEAN_FEATURE diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index bf14a38ac99a..e73cc46a023d 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -30,9 +30,7 @@ * Basic settings can be found in Configuration.h * */ -#ifndef CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H -#define CONFIGURATION_ADV_H_VERSION 010109 +#define CONFIGURATION_ADV_H_VERSION 02010300 // @section temperature @@ -78,6 +76,11 @@ #define THERMAL_PROTECTION_PERIOD 40 // Seconds #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius + //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops + #if ENABLED(ADAPTIVE_FAN_SLOWING) && EITHER(MPCTEMP, PIDTEMP) + //#define TEMP_TUNING_MAINTAIN_FAN // Don't slow fan speed during M303 or M306 T + #endif + /** * Whenever an M104, M109, or M303 increases the target temperature, the * firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature @@ -109,13 +112,63 @@ #endif #if ENABLED(PIDTEMP) - // this adds an experimental additional term to the heating power, proportional to the extrusion speed. - // if Kc is chosen well, the additional required power due to increased melting should be compensated. + // Add an additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) #define LPQ_MAX_LEN 50 #endif + + /** + * Add an additional term to the heater power, proportional to the fan speed. + * A well-chosen Kf value should add just enough power to compensate for power-loss from the cooling fan. + * You can either just add a constant compensation with the DEFAULT_Kf value + * or follow the instruction below to get speed-dependent compensation. + * + * Constant compensation (use only with fanspeeds of 0% and 100%) + * --------------------------------------------------------------------- + * A good starting point for the Kf-value comes from the calculation: + * kf = (power_fan * eff_fan) / power_heater * 255 + * where eff_fan is between 0.0 and 1.0, based on fan-efficiency and airflow to the nozzle / heater. + * + * Example: + * Heater: 40W, Fan: 0.1A * 24V = 2.4W, eff_fan = 0.8 + * Kf = (2.4W * 0.8) / 40W * 255 = 12.24 + * + * Fan-speed dependent compensation + * -------------------------------- + * 1. To find a good Kf value, set the hotend temperature, wait for it to settle, and enable the fan (100%). + * Make sure PID_FAN_SCALING_LIN_FACTOR is 0 and PID_FAN_SCALING_ALTERNATIVE_DEFINITION is not enabled. + * If you see the temperature drop repeat the test, increasing the Kf value slowly, until the temperature + * drop goes away. If the temperature overshoots after enabling the fan, the Kf value is too big. + * 2. Note the Kf-value for fan-speed at 100% + * 3. Determine a good value for PID_FAN_SCALING_MIN_SPEED, which is around the speed, where the fan starts moving. + * 4. Repeat step 1. and 2. for this fan speed. + * 5. Enable PID_FAN_SCALING_ALTERNATIVE_DEFINITION and enter the two identified Kf-values in + * PID_FAN_SCALING_AT_FULL_SPEED and PID_FAN_SCALING_AT_MIN_SPEED. Enter the minimum speed in PID_FAN_SCALING_MIN_SPEED + */ + //#define PID_FAN_SCALING + #if ENABLED(PID_FAN_SCALING) + //#define PID_FAN_SCALING_ALTERNATIVE_DEFINITION + #if ENABLED(PID_FAN_SCALING_ALTERNATIVE_DEFINITION) + // The alternative definition is used for an easier configuration. + // Just figure out Kf at fullspeed (255) and PID_FAN_SCALING_MIN_SPEED. + // DEFAULT_Kf and PID_FAN_SCALING_LIN_FACTOR are calculated accordingly. + + #define PID_FAN_SCALING_AT_FULL_SPEED 13.0 //=PID_FAN_SCALING_LIN_FACTOR*255+DEFAULT_Kf + #define PID_FAN_SCALING_AT_MIN_SPEED 6.0 //=PID_FAN_SCALING_LIN_FACTOR*PID_FAN_SCALING_MIN_SPEED+DEFAULT_Kf + #define PID_FAN_SCALING_MIN_SPEED 10.0 // Minimum fan speed at which to enable PID_FAN_SCALING + + #define DEFAULT_Kf (255.0*PID_FAN_SCALING_AT_MIN_SPEED-PID_FAN_SCALING_AT_FULL_SPEED*PID_FAN_SCALING_MIN_SPEED)/(255.0-PID_FAN_SCALING_MIN_SPEED) + #define PID_FAN_SCALING_LIN_FACTOR (PID_FAN_SCALING_AT_FULL_SPEED-DEFAULT_Kf)/255.0 + + #else + #define PID_FAN_SCALING_LIN_FACTOR (0) // Power loss due to cooling = Kf * (fan_speed) + #define DEFAULT_Kf 10 // A constant value added to the PID-tuner + #define PID_FAN_SCALING_MIN_SPEED 10 // Minimum fan speed at which to enable PID_FAN_SCALING + #endif + #endif #endif /** @@ -160,12 +213,15 @@ // before a MINTEMP error is triggered. (Shouldn't be more than 10.) //#define MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED 0 -// The number of milliseconds a hotend will preheat before starting to check -// the temperature. This value should NOT be set to the time it takes the -// hot end to reach the target temperature, but the time it takes to reach -// the minimum temperature your thermistor can read. The lower the better/safer. -// This shouldn't need to be more than 30 seconds (30000) -//#define MILLISECONDS_PREHEAT_TIME 0 +/** + * The number of milliseconds a hotend will preheat before starting to check + * the temperature. This value should NOT be set to the time it takes the + * hot end to reach the target temperature, but the time it takes to reach + * the minimum temperature your thermistor can read. The lower the better/safer. + * This shouldn't need to be more than 30 seconds (30000) + */ +//#define PREHEAT_TIME_HOTEND_MS 0 +//#define PREHEAT_TIME_BED_MS 0 // @section extruder @@ -373,7 +429,80 @@ // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 -#endif // DUAL_X_CARRIAGE + // Default action to execute following M605 mode change commands. Typically G28X to apply new mode. + //#define EVENT_GCODE_IDEX_AFTER_MODECHANGE "G28X" +#endif + +/** + * Multi-Stepper / Multi-Endstop + * + * When X2_DRIVER_TYPE is defined, this indicates that the X and X2 motors work in tandem. + * The following explanations for X also apply to Y and Z multi-stepper setups. + * Endstop offsets may be changed by 'M666 X Y Z' and stored to EEPROM. + * + * - Enable INVERT_X2_VS_X_DIR if the X2 motor requires an opposite DIR signal from X. + * + * - Enable X_DUAL_ENDSTOPS if the second motor has its own endstop, with adjustable offset. + * + * - Extra endstops are included in the output of 'M119'. + * + * - Set X_DUAL_ENDSTOP_ADJUSTMENT to the known error in the X2 endstop. + * Applied to the X2 motor on 'G28' / 'G28 X'. + * Get the offset by homing X and measuring the error. + * Also set with 'M666 X' and stored to EEPROM with 'M500'. + * + * - Use X2_USE_ENDSTOP to set the endstop plug by name. (_XMIN_, _XMAX_, _YMIN_, _YMAX_, _ZMIN_, _ZMAX_) + */ +#if HAS_X2_STEPPER && DISABLED(DUAL_X_CARRIAGE) + //#define INVERT_X2_VS_X_DIR // X2 direction signal is the opposite of X + //#define X_DUAL_ENDSTOPS // X2 has its own endstop + #if ENABLED(X_DUAL_ENDSTOPS) + #define X2_USE_ENDSTOP _XMAX_ // X2 endstop board plug. Don't forget to enable USE_*_PLUG. + #define X2_ENDSTOP_ADJUSTMENT 0 // X2 offset relative to X endstop + #endif +#endif + +#if HAS_DUAL_Y_STEPPERS + //#define INVERT_Y2_VS_Y_DIR // Y2 direction signal is the opposite of Y + //#define Y_DUAL_ENDSTOPS // Y2 has its own endstop + #if ENABLED(Y_DUAL_ENDSTOPS) + #define Y2_USE_ENDSTOP _YMAX_ // Y2 endstop board plug. Don't forget to enable USE_*_PLUG. + #define Y2_ENDSTOP_ADJUSTMENT 0 // Y2 offset relative to Y endstop + #endif +#endif + +// +// Multi-Z steppers +// +#ifdef Z2_DRIVER_TYPE + //#define INVERT_Z2_VS_Z_DIR // Z2 direction signal is the opposite of Z + + //#define Z_MULTI_ENDSTOPS // Other Z axes have their own endstops + #if ENABLED(Z_MULTI_ENDSTOPS) + #define Z2_USE_ENDSTOP _XMAX_ // Z2 endstop board plug. Don't forget to enable USE_*_PLUG. + #define Z2_ENDSTOP_ADJUSTMENT 0 // Z2 offset relative to Z endstop + #endif + #ifdef Z3_DRIVER_TYPE + //#define INVERT_Z3_VS_Z_DIR // Z3 direction signal is the opposite of Z + #if ENABLED(Z_MULTI_ENDSTOPS) + #define Z3_USE_ENDSTOP _YMAX_ // Z3 endstop board plug. Don't forget to enable USE_*_PLUG. + #define Z3_ENDSTOP_ADJUSTMENT 0 // Z3 offset relative to Z endstop + #endif + #endif + #ifdef Z4_DRIVER_TYPE + //#define INVERT_Z4_VS_Z_DIR // Z4 direction signal is the opposite of Z + #if ENABLED(Z_MULTI_ENDSTOPS) + #define Z4_USE_ENDSTOP _ZMAX_ // Z4 endstop board plug. Don't forget to enable USE_*_PLUG. + #define Z4_ENDSTOP_ADJUSTMENT 0 // Z4 offset relative to Z endstop + #endif + #endif +#endif + +// Drive the E axis with two synchronized steppers +//#define E_DUAL_STEPPER_DRIVERS +#if ENABLED(E_DUAL_STEPPER_DRIVERS) + //#define INVERT_E1_VS_E0_DIR // E direction signals are opposites +#endif // Activate a solenoid on the active extruder with M380. Disable all with M381. // Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. @@ -623,7 +752,133 @@ #define LED_USER_PRESET_BRIGHTNESS 255 // User defined intensity //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup #endif -#endif // LED_CONTROL_MENU +#endif + +#if HAS_MARLINUI_MENU + + #if HAS_BED_PROBE + // Add calibration in the Probe Offsets menu to compensate for X-axis twist. + //#define X_AXIS_TWIST_COMPENSATION + #if ENABLED(X_AXIS_TWIST_COMPENSATION) + /** + * Enable to init the Probe Z-Offset when starting the Wizard. + * Use a height slightly above the estimated nozzle-to-probe Z offset. + * For example, with an offset of -5, consider a starting height of -4. + */ + #define XATC_START_Z 0.0 + #define XATC_MAX_POINTS 3 // Number of points to probe in the wizard + #define XATC_Y_POSITION Y_CENTER // (mm) Y position to probe + #define XATC_Z_OFFSETS { 0, 0, 0 } // Z offsets for X axis sample points + #endif + + // Show Deploy / Stow Probe options in the Motion menu. + #define PROBE_DEPLOY_STOW_MENU + #endif + + // Include a page of printer information in the LCD Main Menu + //#define LCD_INFO_MENU + #if ENABLED(LCD_INFO_MENU) + //#define LCD_PRINTER_INFO_IS_BOOTSCREEN // Show bootscreen(s) instead of Printer Info pages + #endif + + // Add 50/100mm moves to MarlinUI even with a smaller bed + //#define LARGE_MOVE_ITEMS + + // BACK menu items keep the highlight at the top + //#define TURBO_BACK_MENU_ITEM + + // Insert a menu for preheating at the top level to allow for quick access + //#define PREHEAT_SHORTCUT_MENU_ITEM + +#endif // HAS_MARLINUI_MENU + +#if HAS_DISPLAY + //#define SOUND_MENU_ITEM // Add a mute option to the LCD menu + #define SOUND_ON_DEFAULT // Buzzer/speaker default enabled state + + // The timeout to return to the status screen from sub-menus + //#define LCD_TIMEOUT_TO_STATUS 15000 // (ms) + + #if ENABLED(SHOW_BOOTSCREEN) + #define BOOTSCREEN_TIMEOUT 4000 // (ms) Total Duration to display the boot screen(s) + #if EITHER(HAS_MARLINUI_U8GLIB, TFT_COLOR_UI) + #define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving lots of flash) + #endif + #endif + + // Scroll a longer status message into view + //#define STATUS_MESSAGE_SCROLLING + + // Apply a timeout to low-priority status messages + //#define STATUS_MESSAGE_TIMEOUT_SEC 30 // (seconds) + + // On the Info Screen, display XY with one decimal place when possible + //#define LCD_DECIMAL_SMALL_XY + + // Show the E position (filament used) during printing + //#define LCD_SHOW_E_TOTAL + + /** + * LED Control Menu + * Add LED Control to the LCD menu + */ + //#define LED_CONTROL_MENU + #if ENABLED(LED_CONTROL_MENU) + #define LED_COLOR_PRESETS // Enable the Preset Color menu option + //#define NEO2_COLOR_PRESETS // Enable a second NeoPixel Preset Color menu option + #if ENABLED(LED_COLOR_PRESETS) + #define LED_USER_PRESET_RED 255 // User defined RED value + #define LED_USER_PRESET_GREEN 128 // User defined GREEN value + #define LED_USER_PRESET_BLUE 0 // User defined BLUE value + #define LED_USER_PRESET_WHITE 255 // User defined WHITE value + #define LED_USER_PRESET_BRIGHTNESS 255 // User defined intensity + //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup + #endif + #if ENABLED(NEO2_COLOR_PRESETS) + #define NEO2_USER_PRESET_RED 255 // User defined RED value + #define NEO2_USER_PRESET_GREEN 128 // User defined GREEN value + #define NEO2_USER_PRESET_BLUE 0 // User defined BLUE value + #define NEO2_USER_PRESET_WHITE 255 // User defined WHITE value + #define NEO2_USER_PRESET_BRIGHTNESS 255 // User defined intensity + //#define NEO2_USER_PRESET_STARTUP // Have the printer display the user preset color on startup for the second strip + #endif + #endif + +#endif // HAS_DISPLAY + +// Add 'M73' to set print job progress, overrides Marlin's built-in estimate +//#define SET_PROGRESS_MANUALLY +#if ENABLED(SET_PROGRESS_MANUALLY) + #define SET_PROGRESS_PERCENT // Add 'P' parameter to set percentage done + #define SET_REMAINING_TIME // Add 'R' parameter to set remaining time + //#define SET_INTERACTION_TIME // Add 'C' parameter to set time until next filament change or other user interaction + //#define M73_REPORT // Report M73 values to host + #if BOTH(M73_REPORT, SDSUPPORT) + #define M73_REPORT_SD_ONLY // Report only when printing from SD + #endif +#endif + +// LCD Print Progress options. Multiple times may be displayed in turn. +#if HAS_DISPLAY && EITHER(SDSUPPORT, SET_PROGRESS_MANUALLY) + #define SHOW_PROGRESS_PERCENT // Show print progress percentage (doesn't affect progress bar) + #define SHOW_ELAPSED_TIME // Display elapsed printing time (prefix 'E') + //#define SHOW_REMAINING_TIME // Display estimated time to completion (prefix 'R') + #if ENABLED(SET_INTERACTION_TIME) + #define SHOW_INTERACTION_TIME // Display time until next user interaction ('C' = filament change) + #endif + //#define PRINT_PROGRESS_SHOW_DECIMALS // Show/report progress with decimal digits, not all UIs support this + + #if EITHER(HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL) + //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing + #if ENABLED(LCD_PROGRESS_BAR) + #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar + #define PROGRESS_BAR_MSG_TIME 3000 // (ms) Amount of time to show the status message + #define PROGRESS_MSG_EXPIRE 0 // (ms) Amount of time to retain the status message (0=forever) + //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it + //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar + #endif + #endif +#endif #if ENABLED(SDSUPPORT) @@ -835,8 +1090,15 @@ */ //#define LIN_ADVANCE #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed - //#define LA_DEBUG // If enabled, this will generate debug information output over USB. + #if ENABLED(DISTINCT_E_FACTORS) + #define ADVANCE_K { 0.22 } // (mm) Compression length per 1mm/s extruder speed, per extruder + #else + #define ADVANCE_K 0.22 // (mm) Compression length applying to all extruders + #endif + //#define ADVANCE_K_EXTRA // Add a second linear advance constant, configurable with M900 L. + //#define LA_DEBUG // Print debug information to serial during operation. Disable for production use. + //#define ALLOW_LOW_EJERK // Allow a DEFAULT_EJERK value of <10. Recommended for direct drive hotends. + //#define EXPERIMENTAL_I2S_LA // Allow I2S_STEPPER_STREAM to be used with LA. Performance degrades as the LA step rate reaches ~20kHz. #endif // @section leveling diff --git a/Marlin/Version.h b/Marlin/Version.h index e5e097683ca2..3aca533cead0 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2023-01-09" +//#define STRING_DISTRIBUTION_DATE "2023-02-03" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/HAL/AVR/fastio.h b/Marlin/src/HAL/AVR/fastio.h index 612ab902e36f..8a5e4650f4c6 100644 --- a/Marlin/src/HAL/AVR/fastio.h +++ b/Marlin/src/HAL/AVR/fastio.h @@ -293,11 +293,11 @@ enum ClockSource2 : uint8_t { #if HAS_MOTOR_CURRENT_PWM #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) - #define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E || P == MOTOR_CURRENT_PWM_E0 || P == MOTOR_CURRENT_PWM_E1 || P == MOTOR_CURRENT_PWM_Z || P == MOTOR_CURRENT_PWM_XY) + #define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E_PIN || P == MOTOR_CURRENT_PWM_E0_PIN || P == MOTOR_CURRENT_PWM_E1_PIN || P == MOTOR_CURRENT_PWM_Z_PIN || P == MOTOR_CURRENT_PWM_XY_PIN) #elif PIN_EXISTS(MOTOR_CURRENT_PWM_Z) - #define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E || P == MOTOR_CURRENT_PWM_E0 || P == MOTOR_CURRENT_PWM_E1 || P == MOTOR_CURRENT_PWM_Z) + #define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E_PIN || P == MOTOR_CURRENT_PWM_E0_PIN || P == MOTOR_CURRENT_PWM_E1_PIN || P == MOTOR_CURRENT_PWM_Z_PIN) #else - #define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E || P == MOTOR_CURRENT_PWM_E0 || P == MOTOR_CURRENT_PWM_E1) + #define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E_PIN || P == MOTOR_CURRENT_PWM_E0_PIN || P == MOTOR_CURRENT_PWM_E1_PIN) #endif #else #define PWM_CHK_MOTOR_CURRENT(P) false diff --git a/Marlin/src/HAL/ESP32/i2s.cpp b/Marlin/src/HAL/ESP32/i2s.cpp index d9bad4ec2d12..63ceed4c9dcd 100644 --- a/Marlin/src/HAL/ESP32/i2s.cpp +++ b/Marlin/src/HAL/ESP32/i2s.cpp @@ -149,30 +149,28 @@ void stepperTask(void *parameter) { dma.rw_pos = 0; while (dma.rw_pos < DMA_SAMPLE_COUNT) { - // Fill with the port data post pulse_phase until the next step - if (nextMainISR && TERN1(LIN_ADVANCE, nextAdvanceISR)) - i2s_push_sample(); - - // i2s_push_sample() is also called from Stepper::pulse_phase_isr() and Stepper::advance_isr() - // in a rare case where both are called, we need to double decrement the counters - const uint8_t push_count = 1 + (!nextMainISR && TERN0(LIN_ADVANCE, !nextAdvanceISR)); - + if (!nextMainISR) { + Stepper::pulse_phase_isr(); + nextMainISR = Stepper::block_phase_isr(); + } #if ENABLED(LIN_ADVANCE) - if (!nextAdvanceISR) { + else if (!nextAdvanceISR) { Stepper::advance_isr(); nextAdvanceISR = Stepper::la_interval; } - else if (nextAdvanceISR == Stepper::LA_ADV_NEVER) - nextAdvanceISR = Stepper::la_interval; #endif + else + i2s_push_sample(); - if (!nextMainISR) { - Stepper::pulse_phase_isr(); - nextMainISR = Stepper::block_phase_isr(); - } + nextMainISR--; - nextMainISR -= push_count; - TERN_(LIN_ADVANCE, nextAdvanceISR -= push_count); + #if ENABLED(LIN_ADVANCE) + if (nextAdvanceISR == Stepper::LA_ADV_NEVER) + nextAdvanceISR = Stepper::la_interval; + + if (nextAdvanceISR && nextAdvanceISR != Stepper::LA_ADV_NEVER) + nextAdvanceISR--; + #endif } } } diff --git a/Marlin/src/HAL/NATIVE_SIM/HAL.h b/Marlin/src/HAL/NATIVE_SIM/HAL.h index 66203611447f..52e5eb4f3997 100644 --- a/Marlin/src/HAL/NATIVE_SIM/HAL.h +++ b/Marlin/src/HAL/NATIVE_SIM/HAL.h @@ -208,8 +208,8 @@ class MarlinHAL { MarlinHAL() {} // Watchdog - static void watchdog_init() IF_DISABLED(USE_WATCHDOG, {}); - static void watchdog_refresh() IF_DISABLED(USE_WATCHDOG, {}); + static void watchdog_init(); + static void watchdog_refresh(); static void init() {} // Called early in setup() static void init_board() {} // Called less early in setup() diff --git a/Marlin/src/HAL/NATIVE_SIM/tft/tft_spi.h b/Marlin/src/HAL/NATIVE_SIM/tft/tft_spi.h index b3e622f19ac4..f412e09e1102 100644 --- a/Marlin/src/HAL/NATIVE_SIM/tft/tft_spi.h +++ b/Marlin/src/HAL/NATIVE_SIM/tft/tft_spi.h @@ -31,10 +31,11 @@ #endif #define DATASIZE_8BIT 8 -#define DATASIZE_16BIT 16 -#define TFT_IO_DRIVER TFT_SPI +#define DATASIZE_16BIT 16 +#define TFT_IO_DRIVER TFT_SPI +#define DMA_MAX_SIZE 0xFFFF -#define DMA_MINC_ENABLE 1 +#define DMA_MINC_ENABLE 1 #define DMA_MINC_DISABLE 0 class TFT_SPI { @@ -58,7 +59,9 @@ class TFT_SPI { static void WriteData(uint16_t Data); static void WriteReg(uint16_t Reg); + static void WriteSequence_DMA(uint16_t *Data, uint16_t Count) { WriteSequence(Data, Count); } + static void WriteMultiple_DMA(uint16_t Color, uint16_t Count) { WriteMultiple(Color, Count); } + static void WriteSequence(uint16_t *Data, uint16_t Count); - // static void WriteMultiple(uint16_t Color, uint16_t Count); static void WriteMultiple(uint16_t Color, uint32_t Count); }; diff --git a/Marlin/src/HAL/STM32/eeprom_sdcard.cpp b/Marlin/src/HAL/STM32/eeprom_sdcard.cpp index 473b656f9a3c..1b5c0ae5b2c0 100644 --- a/Marlin/src/HAL/STM32/eeprom_sdcard.cpp +++ b/Marlin/src/HAL/STM32/eeprom_sdcard.cpp @@ -48,7 +48,7 @@ static char _ALIGN(4) HAL_eeprom_data[MARLIN_EEPROM_SIZE]; bool PersistentStore::access_start() { if (!card.isMounted()) return false; - SdFile file, root = card.getroot(); + MediaFile file, root = card.getroot(); if (!file.open(&root, EEPROM_FILENAME, O_RDONLY)) return true; @@ -63,7 +63,7 @@ bool PersistentStore::access_start() { bool PersistentStore::access_finish() { if (!card.isMounted()) return false; - SdFile file, root = card.getroot(); + MediaFile file, root = card.getroot(); int bytes_written = 0; if (file.open(&root, EEPROM_FILENAME, O_CREAT | O_WRITE | O_TRUNC)) { bytes_written = file.write(HAL_eeprom_data, MARLIN_EEPROM_SIZE); diff --git a/Marlin/src/HAL/STM32/sdio.cpp b/Marlin/src/HAL/STM32/sdio.cpp index 41fe90b82540..72518ef1cc87 100644 --- a/Marlin/src/HAL/STM32/sdio.cpp +++ b/Marlin/src/HAL/STM32/sdio.cpp @@ -286,6 +286,9 @@ void HAL_SD_MspInit(SD_HandleTypeDef *hsd) { go_to_transfer_speed(); + hsd.Init.ClockPowerSave = SDIO_CLOCK_POWER_SAVE_ENABLE; + hsd.Init.ClockDiv = 8; + #if PINS_EXIST(SDIO_D1, SDIO_D2, SDIO_D3) // go to 4 bit wide mode if pins are defined retry_Cnt = retryCnt; for (;;) { @@ -433,7 +436,10 @@ bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) { #else uint8_t retries = SDIO_READ_RETRIES; - while (retries--) if (SDIO_ReadWriteBlock_DMA(block, src, nullptr)) return true; + while (retries--) { + if (SDIO_ReadWriteBlock_DMA(block, src, nullptr)) return true; + delay(10); + } return false; #endif diff --git a/Marlin/src/HAL/STM32F1/eeprom_sdcard.cpp b/Marlin/src/HAL/STM32F1/eeprom_sdcard.cpp index d608ccee1441..9cfa97c1ab6e 100644 --- a/Marlin/src/HAL/STM32F1/eeprom_sdcard.cpp +++ b/Marlin/src/HAL/STM32F1/eeprom_sdcard.cpp @@ -47,7 +47,7 @@ static char _ALIGN(4) HAL_eeprom_data[MARLIN_EEPROM_SIZE]; bool PersistentStore::access_start() { if (!card.isMounted()) return false; - SdFile file, root = card.getroot(); + MediaFile file, root = card.getroot(); if (!file.open(&root, EEPROM_FILENAME, O_RDONLY)) return true; // false aborts the save @@ -62,7 +62,7 @@ bool PersistentStore::access_start() { bool PersistentStore::access_finish() { if (!card.isMounted()) return false; - SdFile file, root = card.getroot(); + MediaFile file, root = card.getroot(); int bytes_written = 0; if (file.open(&root, EEPROM_FILENAME, O_CREAT | O_WRITE | O_TRUNC)) { bytes_written = file.write(HAL_eeprom_data, MARLIN_EEPROM_SIZE); diff --git a/Marlin/src/HAL/STM32F1/onboard_sd.h b/Marlin/src/HAL/STM32F1/onboard_sd.h index f228d068c9db..f8846e95bcaa 100644 --- a/Marlin/src/HAL/STM32F1/onboard_sd.h +++ b/Marlin/src/HAL/STM32F1/onboard_sd.h @@ -1,11 +1,31 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + /*----------------------------------------------------------------------- -/ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] / * Copyright (c) 2019 BigTreeTech [https://github.com/bigtreetech] -/ * Low level disk interface module include file (C)ChaN, 2015 +/ * Low level disk interface module include file (c) ChaN, 2015 /-----------------------------------------------------------------------*/ -#pragma once - #define _DISKIO_WRITE 1 /* 1: Enable disk_write function */ #define _DISKIO_IOCTL 1 /* 1: Enable disk_ioctl function */ #define _DISKIO_ISDIO 0 /* 1: Enable iSDIO control function */ diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 676d230d35ea..ed892ac8132a 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -168,6 +168,8 @@ #include "module/polargraph.h" #elif IS_SCARA #include "module/scara.h" +#elif ENABLED(POLAR) + #include "module/polar.h" #endif #if HAS_LEVELING diff --git a/Marlin/src/core/language.h b/Marlin/src/core/language.h index 545f9df6410b..2d0b23a52998 100644 --- a/Marlin/src/core/language.h +++ b/Marlin/src/core/language.h @@ -279,6 +279,7 @@ #define STR_S_SEG_PER_SEC "S" #define STR_DELTA_SETTINGS "Delta (L R H S XYZ ABC)" #define STR_SCARA_SETTINGS "SCARA" +#define STR_POLAR_SETTINGS "Polar" #define STR_POLARGRAPH_SETTINGS "Polargraph" #define STR_SCARA_P_T_Z "P T Z" #define STR_ENDSTOP_ADJUSTMENT "Endstop adjustment" diff --git a/Marlin/src/core/serial.h b/Marlin/src/core/serial.h index c19bc087833d..a1126d74615c 100644 --- a/Marlin/src/core/serial.h +++ b/Marlin/src/core/serial.h @@ -337,8 +337,8 @@ void serial_offset(const_float_t v, const uint8_t sp=0); // For v==0 draw space void print_bin(const uint16_t val); void print_pos(NUM_AXIS_ARGS(const_float_t), FSTR_P const prefix=nullptr, FSTR_P const suffix=nullptr); -inline void print_pos(const xyz_pos_t &xyz, FSTR_P const prefix=nullptr, FSTR_P const suffix=nullptr) { - print_pos(NUM_AXIS_ELEM(xyz), prefix, suffix); +inline void print_pos(const xyze_pos_t &xyze, FSTR_P const prefix=nullptr, FSTR_P const suffix=nullptr) { + print_pos(NUM_AXIS_ELEM(xyze), prefix, suffix); } #define SERIAL_POS(SUFFIX,VAR) do { print_pos(VAR, F(" " STRINGIFY(VAR) "="), F(" : " SUFFIX "\n")); }while(0) diff --git a/Marlin/src/core/types.h b/Marlin/src/core/types.h index 61c182448e45..f1fae85b5ca4 100644 --- a/Marlin/src/core/types.h +++ b/Marlin/src/core/types.h @@ -430,21 +430,24 @@ struct XYval { FI XYval& operator+=(const XYval &rs) { x += rs.x; y += rs.y; return *this; } FI XYval& operator-=(const XYval &rs) { x -= rs.x; y -= rs.y; return *this; } FI XYval& operator*=(const XYval &rs) { x *= rs.x; y *= rs.y; return *this; } - FI XYval& operator+=(const XYZval &rs) { x += rs.x; y += rs.y; return *this; } - FI XYval& operator-=(const XYZval &rs) { x -= rs.x; y -= rs.y; return *this; } - FI XYval& operator*=(const XYZval &rs) { x *= rs.x; y *= rs.y; return *this; } - FI XYval& operator+=(const XYZEval &rs) { x += rs.x; y += rs.y; return *this; } - FI XYval& operator-=(const XYZEval &rs) { x -= rs.x; y -= rs.y; return *this; } - FI XYval& operator*=(const XYZEval &rs) { x *= rs.x; y *= rs.y; return *this; } + FI XYval& operator/=(const XYval &rs) { x /= rs.x; y /= rs.y; return *this; } + FI XYval& operator+=(const XYZval &rs) { NUM_AXIS_CODE(x += rs.x, y += rs.y,,,,,,, ); return *this; } + FI XYval& operator-=(const XYZval &rs) { NUM_AXIS_CODE(x -= rs.x, y -= rs.y,,,,,,, ); return *this; } + FI XYval& operator*=(const XYZval &rs) { NUM_AXIS_CODE(x *= rs.x, y *= rs.y,,,,,,, ); return *this; } + FI XYval& operator/=(const XYZval &rs) { NUM_AXIS_CODE(x /= rs.x, y /= rs.y,,,,,,, ); return *this; } + FI XYval& operator+=(const XYZEval &rs) { NUM_AXIS_CODE(x += rs.x, y += rs.y,,,,,,, ); return *this; } + FI XYval& operator-=(const XYZEval &rs) { NUM_AXIS_CODE(x -= rs.x, y -= rs.y,,,,,,, ); return *this; } + FI XYval& operator*=(const XYZEval &rs) { NUM_AXIS_CODE(x *= rs.x, y *= rs.y,,,,,,, ); return *this; } + FI XYval& operator/=(const XYZEval &rs) { NUM_AXIS_CODE(x /= rs.x, y /= rs.y,,,,,,, ); return *this; } FI XYval& operator*=(const float &p) { x *= p; y *= p; return *this; } FI XYval& operator*=(const int &p) { x *= p; y *= p; return *this; } FI XYval& operator>>=(const int &p) { _RS(x); _RS(y); return *this; } FI XYval& operator<<=(const int &p) { _LS(x); _LS(y); return *this; } // Exact comparisons. For floats a "NEAR" operation may be better. - FI bool operator==(const XYval &rs) const { return x == rs.x && y == rs.y; } - FI bool operator==(const XYZval &rs) const { return x == rs.x && y == rs.y; } - FI bool operator==(const XYZEval &rs) const { return x == rs.x && y == rs.y; } + FI bool operator==(const XYval &rs) const { return NUM_AXIS_GANG(x == rs.x, && y == rs.y,,,,,,, ); } + FI bool operator==(const XYZval &rs) const { return NUM_AXIS_GANG(x == rs.x, && y == rs.y,,,,,,, ); } + FI bool operator==(const XYZEval &rs) const { return NUM_AXIS_GANG(x == rs.x, && y == rs.y,,,,,,, ); } FI bool operator!=(const XYval &rs) const { return !operator==(rs); } FI bool operator!=(const XYZval &rs) const { return !operator==(rs); } FI bool operator!=(const XYZEval &rs) const { return !operator==(rs); } @@ -465,15 +468,9 @@ struct XYZval { FI void reset() { NUM_AXIS_GANG(x =, y =, z =, i =, j =, k =, u =, v =, w =) 0; } // Setters taking struct types and arrays - FI void set(const T px) { x = px; } - FI void set(const T px, const T py) { x = px; y = py; } - FI void set(const XYval pxy) { x = pxy.x; y = pxy.y; } - FI void set(const XYval pxy, const T pz) { NUM_AXIS_CODE(x = pxy.x, y = pxy.y, z = pz, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP); } - FI void set(const T (&arr)[XY]) { x = arr[0]; y = arr[1]; } - #if HAS_Z_AXIS - FI void set(const T (&arr)[NUM_AXES]) { NUM_AXIS_CODE(x = arr[0], y = arr[1], z = arr[2], i = arr[3], j = arr[4], k = arr[5], u = arr[6], v = arr[7], w = arr[8]); } - FI void set(NUM_AXIS_ARGS(const T)) { NUM_AXIS_CODE(a = x, b = y, c = z, _i = i, _j = j, _k = k, _u = u, _v = v, _w = w ); } - #endif + FI void set(const XYval pxy) { NUM_AXIS_CODE(x = pxy.x, y = pxy.y,,,,,,,); } + FI void set(const XYval pxy, const T pz) { NUM_AXIS_CODE(x = pxy.x, y = pxy.y, z = pz,,,,,,); } + FI void set(const T (&arr)[NUM_AXES]) { NUM_AXIS_CODE(x = arr[0], y = arr[1], z = arr[2], i = arr[3], j = arr[4], k = arr[5], u = arr[6], v = arr[7], w = arr[8]); } #if LOGICAL_AXES > NUM_AXES FI void set(const T (&arr)[LOGICAL_AXES]) { NUM_AXIS_CODE(x = arr[0], y = arr[1], z = arr[2], i = arr[3], j = arr[4], k = arr[5], u = arr[6], v = arr[7], w = arr[8]); } FI void set(LOGICAL_AXIS_ARGS(const T)) { NUM_AXIS_CODE(a = x, b = y, c = z, _i = i, _j = j, _k = k, _u = u, _v = v, _w = w ); } @@ -481,6 +478,17 @@ struct XYZval { FI void set(const T (&arr)[DISTINCT_AXES]) { NUM_AXIS_CODE(x = arr[0], y = arr[1], z = arr[2], i = arr[3], j = arr[4], k = arr[5], u = arr[6], v = arr[7], w = arr[8]); } #endif #endif + + // Setter for all individual args + FI void set(NUM_AXIS_ARGS(const T)) { NUM_AXIS_CODE(a = x, b = y, c = z, _i = i, _j = j, _k = k, _u = u, _v = v, _w = w); } + + // Setters with fewer elements leave the rest untouched + #if HAS_Y_AXIS + FI void set(const T px) { x = px; } + #endif + #if HAS_Z_AXIS + FI void set(const T px, const T py) { x = px; y = py; } + #endif #if HAS_I_AXIS FI void set(const T px, const T py, const T pz) { x = px; y = py; z = pz; } #endif @@ -545,14 +553,14 @@ struct XYZval { FI XYZval& operator= (const XYZEval &rs) { set(NUM_AXIS_ELEM(rs)); return *this; } // Override other operators to get intuitive behaviors - FI XYZval operator+ (const XYval &rs) const { XYZval ls = *this; NUM_AXIS_CODE(ls.x += rs.x, ls.y += rs.y, NOOP , NOOP , NOOP , NOOP , NOOP , NOOP , NOOP ); return ls; } - FI XYZval operator+ (const XYval &rs) { XYZval ls = *this; NUM_AXIS_CODE(ls.x += rs.x, ls.y += rs.y, NOOP , NOOP , NOOP , NOOP , NOOP , NOOP , NOOP ); return ls; } - FI XYZval operator- (const XYval &rs) const { XYZval ls = *this; NUM_AXIS_CODE(ls.x -= rs.x, ls.y -= rs.y, NOOP , NOOP , NOOP , NOOP , NOOP , NOOP , NOOP ); return ls; } - FI XYZval operator- (const XYval &rs) { XYZval ls = *this; NUM_AXIS_CODE(ls.x -= rs.x, ls.y -= rs.y, NOOP , NOOP , NOOP , NOOP , NOOP , NOOP , NOOP ); return ls; } - FI XYZval operator* (const XYval &rs) const { XYZval ls = *this; NUM_AXIS_CODE(ls.x *= rs.x, ls.y *= rs.y, NOOP , NOOP , NOOP , NOOP , NOOP , NOOP , NOOP ); return ls; } - FI XYZval operator* (const XYval &rs) { XYZval ls = *this; NUM_AXIS_CODE(ls.x *= rs.x, ls.y *= rs.y, NOOP , NOOP , NOOP , NOOP , NOOP , NOOP , NOOP ); return ls; } - FI XYZval operator/ (const XYval &rs) const { XYZval ls = *this; NUM_AXIS_CODE(ls.x /= rs.x, ls.y /= rs.y, NOOP , NOOP , NOOP , NOOP , NOOP , NOOP , NOOP ); return ls; } - FI XYZval operator/ (const XYval &rs) { XYZval ls = *this; NUM_AXIS_CODE(ls.x /= rs.x, ls.y /= rs.y, NOOP , NOOP , NOOP , NOOP , NOOP , NOOP , NOOP ); return ls; } + FI XYZval operator+ (const XYval &rs) const { XYZval ls = *this; NUM_AXIS_CODE(ls.x += rs.x, ls.y += rs.y,,,,,,, ); return ls; } + FI XYZval operator+ (const XYval &rs) { XYZval ls = *this; NUM_AXIS_CODE(ls.x += rs.x, ls.y += rs.y,,,,,,, ); return ls; } + FI XYZval operator- (const XYval &rs) const { XYZval ls = *this; NUM_AXIS_CODE(ls.x -= rs.x, ls.y -= rs.y,,,,,,, ); return ls; } + FI XYZval operator- (const XYval &rs) { XYZval ls = *this; NUM_AXIS_CODE(ls.x -= rs.x, ls.y -= rs.y,,,,,,, ); return ls; } + FI XYZval operator* (const XYval &rs) const { XYZval ls = *this; NUM_AXIS_CODE(ls.x *= rs.x, ls.y *= rs.y,,,,,,, ); return ls; } + FI XYZval operator* (const XYval &rs) { XYZval ls = *this; NUM_AXIS_CODE(ls.x *= rs.x, ls.y *= rs.y,,,,,,, ); return ls; } + FI XYZval operator/ (const XYval &rs) const { XYZval ls = *this; NUM_AXIS_CODE(ls.x /= rs.x, ls.y /= rs.y,,,,,,, ); return ls; } + FI XYZval operator/ (const XYval &rs) { XYZval ls = *this; NUM_AXIS_CODE(ls.x /= rs.x, ls.y /= rs.y,,,,,,, ); return ls; } FI XYZval operator+ (const XYZval &rs) const { XYZval ls = *this; NUM_AXIS_CODE(ls.x += rs.x, ls.y += rs.y, ls.z += rs.z, ls.i += rs.i, ls.j += rs.j, ls.k += rs.k, ls.u += rs.u, ls.v += rs.v, ls.w += rs.w); return ls; } FI XYZval operator+ (const XYZval &rs) { XYZval ls = *this; NUM_AXIS_CODE(ls.x += rs.x, ls.y += rs.y, ls.z += rs.z, ls.i += rs.i, ls.j += rs.j, ls.k += rs.k, ls.u += rs.u, ls.v += rs.v, ls.w += rs.w); return ls; } FI XYZval operator- (const XYZval &rs) const { XYZval ls = *this; NUM_AXIS_CODE(ls.x -= rs.x, ls.y -= rs.y, ls.z -= rs.z, ls.i -= rs.i, ls.j -= rs.j, ls.k -= rs.k, ls.u -= rs.u, ls.v -= rs.v, ls.w -= rs.w); return ls; } @@ -585,10 +593,10 @@ struct XYZval { FI XYZval operator-() { XYZval o = *this; NUM_AXIS_CODE(o.x = -x, o.y = -y, o.z = -z, o.i = -i, o.j = -j, o.k = -k, o.u = -u, o.v = -v, o.w = -w); return o; } // Modifier operators - FI XYZval& operator+=(const XYval &rs) { NUM_AXIS_CODE(x += rs.x, y += rs.y, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP ); return *this; } - FI XYZval& operator-=(const XYval &rs) { NUM_AXIS_CODE(x -= rs.x, y -= rs.y, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP ); return *this; } - FI XYZval& operator*=(const XYval &rs) { NUM_AXIS_CODE(x *= rs.x, y *= rs.y, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP ); return *this; } - FI XYZval& operator/=(const XYval &rs) { NUM_AXIS_CODE(x /= rs.x, y /= rs.y, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, NOOP ); return *this; } + FI XYZval& operator+=(const XYval &rs) { NUM_AXIS_CODE(x += rs.x, y += rs.y,,,,,,, ); return *this; } + FI XYZval& operator-=(const XYval &rs) { NUM_AXIS_CODE(x -= rs.x, y -= rs.y,,,,,,, ); return *this; } + FI XYZval& operator*=(const XYval &rs) { NUM_AXIS_CODE(x *= rs.x, y *= rs.y,,,,,,, ); return *this; } + FI XYZval& operator/=(const XYval &rs) { NUM_AXIS_CODE(x /= rs.x, y /= rs.y,,,,,,, ); return *this; } FI XYZval& operator+=(const XYZval &rs) { NUM_AXIS_CODE(x += rs.x, y += rs.y, z += rs.z, i += rs.i, j += rs.j, k += rs.k, u += rs.u, v += rs.v, w += rs.w); return *this; } FI XYZval& operator-=(const XYZval &rs) { NUM_AXIS_CODE(x -= rs.x, y -= rs.y, z -= rs.z, i -= rs.i, j -= rs.j, k -= rs.k, u -= rs.u, v -= rs.v, w -= rs.w); return *this; } FI XYZval& operator*=(const XYZval &rs) { NUM_AXIS_CODE(x *= rs.x, y *= rs.y, z *= rs.z, i *= rs.i, j *= rs.j, k *= rs.k, u *= rs.u, v *= rs.v, w *= rs.w); return *this; } @@ -620,9 +628,31 @@ struct XYZEval { // Reset all to 0 FI void reset() { LOGICAL_AXIS_GANG(e =, x =, y =, z =, i =, j =, k =, u =, v =, w =) 0; } - // Setters for some number of linear axes, not all - FI void set(const T px) { x = px; } - FI void set(const T px, const T py) { x = px; y = py; } + // Setters taking struct types and arrays + FI void set(const XYval pxy) { x = pxy.x; OPTCODE(HAS_Y_AXIS, y = pxy.y) } + FI void set(const XYZval pxyz) { set(NUM_AXIS_ELEM(pxyz)); } + FI void set(const XYval pxy, const T pz) { set(pxy); TERN_(HAS_Z_AXIS, z = pz); } + FI void set(const T (&arr)[NUM_AXES]) { NUM_AXIS_CODE(x = arr[0], y = arr[1], z = arr[2], i = arr[3], j = arr[4], k = arr[5], u = arr[6], v = arr[7], w = arr[8]); } + #if LOGICAL_AXES > NUM_AXES + FI void set(const T (&arr)[LOGICAL_AXES]) { LOGICAL_AXIS_CODE(e = arr[LOGICAL_AXES-1], x = arr[0], y = arr[1], z = arr[2], i = arr[3], j = arr[4], k = arr[5], u = arr[6], v = arr[7], w = arr[8]); } + FI void set(const XYval pxy, const T pz, const T pe) { set(pxy, pz); e = pe; } + FI void set(const XYZval pxyz, const T pe) { set(pxyz); e = pe; } + FI void set(LOGICAL_AXIS_ARGS(const T)) { LOGICAL_AXIS_CODE(_e = e, a = x, b = y, c = z, _i = i, _j = j, _k = k, _u = u, _v = v, _w = w); } + #if DISTINCT_AXES > LOGICAL_AXES + FI void set(const T (&arr)[DISTINCT_AXES]) { LOGICAL_AXIS_CODE(e = arr[LOGICAL_AXES-1], x = arr[0], y = arr[1], z = arr[2], i = arr[3], j = arr[4], k = arr[5], u = arr[6], v = arr[7], w = arr[8]); } + #endif + #endif + + // Setter for all individual args + FI void set(NUM_AXIS_ARGS(const T)) { NUM_AXIS_CODE(a = x, b = y, c = z, _i = i, _j = j, _k = k, _u = u, _v = v, _w = w); } + + // Setters with fewer elements leave the rest untouched + #if HAS_Y_AXIS + FI void set(const T px) { x = px; } + #endif + #if HAS_Z_AXIS + FI void set(const T px, const T py) { x = px; y = py; } + #endif #if HAS_I_AXIS FI void set(const T px, const T py, const T pz) { x = px; y = py; z = pz; } #endif @@ -642,19 +672,6 @@ struct XYZEval { FI void set(const T px, const T py, const T pz, const T pi, const T pj, const T pk, const T pu, const T pv) { x = px; y = py; z = pz; i = pi; j = pj; k = pk; u = pu; v = pv; } #endif - // Setters taking struct types and arrays - FI void set(const XYval pxy) { x = pxy.x; y = pxy.y; } - FI void set(const XYZval pxyz) { set(NUM_AXIS_ELEM(pxyz)); } - #if HAS_Z_AXIS - FI void set(NUM_AXIS_ARGS(const T)) { NUM_AXIS_CODE(a = x, b = y, c = z, _i = i, _j = j, _k = k, _u = u, _v = v, _w = w); } - #endif - FI void set(const XYval pxy, const T pz) { set(pxy); TERN_(HAS_Z_AXIS, z = pz); } - #if LOGICAL_AXES > NUM_AXES - FI void set(const XYval pxy, const T pz, const T pe) { set(pxy, pz); e = pe; } - FI void set(const XYZval pxyz, const T pe) { set(pxyz); e = pe; } - FI void set(LOGICAL_AXIS_ARGS(const T)) { LOGICAL_AXIS_CODE(_e = e, a = x, b = y, c = z, _i = i, _j = j, _k = k, _u = u, _v = v, _w = w); } - #endif - // Length reduced to one dimension FI T magnitude() const { return (T)sqrtf(LOGICAL_AXIS_GANG(+ e*e, + x*x, + y*y, + z*z, + i*i, + j*j, + k*k, + u*u, + v*v, + w*w)); } // Pointer to the data as a simple array @@ -739,10 +756,10 @@ struct XYZEval { FI XYZEval operator-() { return LOGICAL_AXIS_ARRAY(-e, -x, -y, -z, -i, -j, -k, -u, -v, -w); } // Modifier operators - FI XYZEval& operator+=(const XYval &rs) { x += rs.x; y += rs.y; return *this; } - FI XYZEval& operator-=(const XYval &rs) { x -= rs.x; y -= rs.y; return *this; } - FI XYZEval& operator*=(const XYval &rs) { x *= rs.x; y *= rs.y; return *this; } - FI XYZEval& operator/=(const XYval &rs) { x /= rs.x; y /= rs.y; return *this; } + FI XYZEval& operator+=(const XYval &rs) { NUM_AXIS_CODE(x += rs.x, y += rs.y,,,,,,, ); return *this; } + FI XYZEval& operator-=(const XYval &rs) { NUM_AXIS_CODE(x -= rs.x, y -= rs.y,,,,,,, ); return *this; } + FI XYZEval& operator*=(const XYval &rs) { NUM_AXIS_CODE(x *= rs.x, y *= rs.y,,,,,,, ); return *this; } + FI XYZEval& operator/=(const XYval &rs) { NUM_AXIS_CODE(x /= rs.x, y /= rs.y,,,,,,, ); return *this; } FI XYZEval& operator+=(const XYZval &rs) { NUM_AXIS_CODE(x += rs.x, y += rs.y, z += rs.z, i += rs.i, j += rs.j, k += rs.k, u += rs.u, v += rs.v, w += rs.w); return *this; } FI XYZEval& operator-=(const XYZval &rs) { NUM_AXIS_CODE(x -= rs.x, y -= rs.y, z -= rs.z, i -= rs.i, j -= rs.j, k -= rs.k, u -= rs.u, v -= rs.v, w -= rs.w); return *this; } FI XYZEval& operator*=(const XYZval &rs) { NUM_AXIS_CODE(x *= rs.x, y *= rs.y, z *= rs.z, i *= rs.i, j *= rs.j, k *= rs.k, u *= rs.u, v *= rs.v, w *= rs.w); return *this; } diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp index 96c30a0efd89..1a2b6eb23abd 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp @@ -334,16 +334,14 @@ #else // UBL_SEGMENTED #if IS_SCARA - #define DELTA_SEGMENT_MIN_LENGTH 0.25 // SCARA minimum segment size is 0.25mm - #elif ENABLED(DELTA) - #define DELTA_SEGMENT_MIN_LENGTH 0.10 // mm (still subject to DEFAULT_SEGMENTS_PER_SECOND) - #elif ENABLED(POLARGRAPH) - #define DELTA_SEGMENT_MIN_LENGTH 0.10 // mm (still subject to DEFAULT_SEGMENTS_PER_SECOND) + #define SEGMENT_MIN_LENGTH 0.25 // SCARA minimum segment size is 0.25mm + #elif IS_KINEMATIC + #define SEGMENT_MIN_LENGTH 0.10 // (mm) Still subject to DEFAULT_SEGMENTS_PER_SECOND #else // CARTESIAN #ifdef LEVELED_SEGMENT_LENGTH - #define DELTA_SEGMENT_MIN_LENGTH LEVELED_SEGMENT_LENGTH + #define SEGMENT_MIN_LENGTH LEVELED_SEGMENT_LENGTH #else - #define DELTA_SEGMENT_MIN_LENGTH 1.00 // mm (similar to G2/G3 arc segmentation) + #define SEGMENT_MIN_LENGTH 1.00 // (mm) Similar to G2/G3 arc segmentation #endif #endif @@ -361,23 +359,23 @@ const xyze_pos_t total = destination - current_position; const float cart_xy_mm_2 = HYPOT2(total.x, total.y), - cart_xy_mm = SQRT(cart_xy_mm_2); // Total XY distance + cart_xy_mm = SQRT(cart_xy_mm_2); // Total XY distance #if IS_KINEMATIC - const float seconds = cart_xy_mm / scaled_fr_mm_s; // Duration of XY move at requested rate - uint16_t segments = LROUND(segments_per_second * seconds), // Preferred number of segments for distance @ feedrate - seglimit = LROUND(cart_xy_mm * RECIPROCAL(DELTA_SEGMENT_MIN_LENGTH)); // Number of segments at minimum segment length - NOMORE(segments, seglimit); // Limit to minimum segment length (fewer segments) + const float seconds = cart_xy_mm / scaled_fr_mm_s; // Duration of XY move at requested rate + uint16_t segments = LROUND(segments_per_second * seconds), // Preferred number of segments for distance @ feedrate + seglimit = LROUND(cart_xy_mm * RECIPROCAL(SEGMENT_MIN_LENGTH)); // Number of segments at minimum segment length + NOMORE(segments, seglimit); // Limit to minimum segment length (fewer segments) #else - uint16_t segments = LROUND(cart_xy_mm * RECIPROCAL(DELTA_SEGMENT_MIN_LENGTH)); // Cartesian fixed segment length + uint16_t segments = LROUND(cart_xy_mm * RECIPROCAL(SEGMENT_MIN_LENGTH)); // Cartesian fixed segment length #endif - NOLESS(segments, 1U); // Must have at least one segment - const float inv_segments = 1.0f / segments; // Reciprocal to save calculation + NOLESS(segments, 1U); // Must have at least one segment + const float inv_segments = 1.0f / segments; // Reciprocal to save calculation // Add hints to help optimize the move - PlannerHints hints(SQRT(cart_xy_mm_2 + sq(total.z)) * inv_segments); // Length of each segment - #if ENABLED(SCARA_FEEDRATE_SCALING) + PlannerHints hints(SQRT(cart_xy_mm_2 + sq(total.z)) * inv_segments); // Length of each segment + #if ENABLED(FEEDRATE_SCALING) hints.inv_duration = scaled_fr_mm_s / hints.millimeters; #endif diff --git a/Marlin/src/feature/powerloss.cpp b/Marlin/src/feature/powerloss.cpp index d4450adcd853..2825f4d4f219 100644 --- a/Marlin/src/feature/powerloss.cpp +++ b/Marlin/src/feature/powerloss.cpp @@ -33,7 +33,7 @@ bool PrintJobRecovery::enabled; // Initialized by settings.load() -SdFile PrintJobRecovery::file; +MediaFile PrintJobRecovery::file; job_recovery_info_t PrintJobRecovery::info; const char PrintJobRecovery::filename[5] = "/PLR"; uint8_t PrintJobRecovery::queue_index_r; diff --git a/Marlin/src/feature/powerloss.h b/Marlin/src/feature/powerloss.h index 4bf0c06e2d7e..d241fdb74c8e 100644 --- a/Marlin/src/feature/powerloss.h +++ b/Marlin/src/feature/powerloss.h @@ -138,7 +138,7 @@ class PrintJobRecovery { public: static const char filename[5]; - static SdFile file; + static MediaFile file; static job_recovery_info_t info; static uint8_t queue_index_r; //!< Queue index of the active command diff --git a/Marlin/src/feature/stepper_driver_safety.cpp b/Marlin/src/feature/stepper_driver_safety.cpp index b8762da9b0c0..d3fc1614861e 100644 --- a/Marlin/src/feature/stepper_driver_safety.cpp +++ b/Marlin/src/feature/stepper_driver_safety.cpp @@ -43,7 +43,7 @@ void stepper_driver_backward_check() { SET_INPUT(AXIS##_ENABLE_PIN); \ OUT_WRITE(AXIS##_STEP_PIN, false); \ delay(20); \ - if (READ(AXIS##_ENABLE_PIN) == false) { \ + if (READ(AXIS##_ENABLE_PIN) == LOW) { \ SBI(axis_plug_backward, BIT); \ stepper_driver_backward_error(F(STRINGIFY(AXIS))); \ } \ diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index a6dff2d75a41..0b6548a3e3fa 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -403,6 +403,9 @@ void GcodeSuite::G28() { UNUSED(needZ); UNUSED(homeZZ); #else constexpr bool doZ = false; + #if !HAS_Y_AXIS + constexpr bool doY = false; + #endif #endif TERN_(HOME_Z_FIRST, if (doZ) homeaxis(Z_AXIS)); @@ -420,9 +423,11 @@ void GcodeSuite::G28() { // Diagonal move first if both are homing TERN_(QUICK_HOME, if (doX && doY) quick_home_xy()); - // Home Y (before X) - if (ENABLED(HOME_Y_BEFORE_X) && (doY || TERN0(CODEPENDENT_XY_HOMING, doX))) - homeaxis(Y_AXIS); + #if HAS_Y_AXIS + // Home Y (before X) + if (ENABLED(HOME_Y_BEFORE_X) && (doY || TERN0(CODEPENDENT_XY_HOMING, doX))) + homeaxis(Y_AXIS); + #endif // Home X if (doX || (doY && ENABLED(CODEPENDENT_XY_HOMING) && DISABLED(HOME_Y_BEFORE_X))) { @@ -455,9 +460,11 @@ void GcodeSuite::G28() { if (doI) homeaxis(I_AXIS); #endif - // Home Y (after X) - if (DISABLED(HOME_Y_BEFORE_X) && doY) - homeaxis(Y_AXIS); + #if HAS_Y_AXIS + // Home Y (after X) + if (DISABLED(HOME_Y_BEFORE_X) && doY) + homeaxis(Y_AXIS); + #endif #if BOTH(FOAMCUTTER_XYUV, HAS_J_AXIS) // Home J (after Y) diff --git a/Marlin/src/gcode/calibrate/G33.cpp b/Marlin/src/gcode/calibrate/G33.cpp index 656c23cb78ff..836d5c867b6b 100644 --- a/Marlin/src/gcode/calibrate/G33.cpp +++ b/Marlin/src/gcode/calibrate/G33.cpp @@ -407,12 +407,12 @@ void GcodeSuite::G33() { towers_set = !parser.seen_test('T'); // The calibration radius is set to a calculated value - float dcr = probe_at_offset ? DELTA_PRINTABLE_RADIUS : DELTA_PRINTABLE_RADIUS - PROBING_MARGIN; + float dcr = probe_at_offset ? PRINTABLE_RADIUS : PRINTABLE_RADIUS - PROBING_MARGIN; #if HAS_PROBE_XY_OFFSET const float total_offset = HYPOT(probe.offset_xy.x, probe.offset_xy.y); dcr -= probe_at_offset ? _MAX(total_offset, PROBING_MARGIN) : total_offset; #endif - NOMORE(dcr, DELTA_PRINTABLE_RADIUS); + NOMORE(dcr, PRINTABLE_RADIUS); if (parser.seenval('R')) dcr -= _MAX(parser.value_float(), 0.0f); TERN_(HAS_DELTA_SENSORLESS_PROBING, dcr *= sensorless_radius_factor); diff --git a/Marlin/src/gcode/calibrate/M48.cpp b/Marlin/src/gcode/calibrate/M48.cpp index bfb3b640078b..ff14175c71d7 100644 --- a/Marlin/src/gcode/calibrate/M48.cpp +++ b/Marlin/src/gcode/calibrate/M48.cpp @@ -162,8 +162,8 @@ void GcodeSuite::M48() { float angle = random(0, 360); const float radius = random( #if ENABLED(DELTA) - int(0.1250000000 * (DELTA_PRINTABLE_RADIUS)), - int(0.3333333333 * (DELTA_PRINTABLE_RADIUS)) + int(0.1250000000 * (PRINTABLE_RADIUS)), + int(0.3333333333 * (PRINTABLE_RADIUS)) #else int(5), int(0.125 * _MIN(X_BED_SIZE, Y_BED_SIZE)) #endif diff --git a/Marlin/src/gcode/calibrate/M665.cpp b/Marlin/src/gcode/calibrate/M665.cpp index a8e02831e2a8..22ad80425ac7 100644 --- a/Marlin/src/gcode/calibrate/M665.cpp +++ b/Marlin/src/gcode/calibrate/M665.cpp @@ -181,6 +181,25 @@ ); } +#elif ENABLED(POLAR) + + #include "../../module/polar.h" + + /** + * M665: Set POLAR settings + * Parameters: + * S[segments] - Segments-per-second + */ + void GcodeSuite::M665() { + if (!parser.seen_any()) return M665_report(); + if (parser.seenval('S')) segments_per_second = parser.value_float(); + } + + void GcodeSuite::M665_report(const bool forReplay/*=true*/) { + report_heading_etc(forReplay, F(STR_POLAR_SETTINGS)); + SERIAL_ECHOLNPGM_P(PSTR(" M665 S"), segments_per_second); + } + #endif #endif // IS_KINEMATIC diff --git a/Marlin/src/gcode/config/M220.cpp b/Marlin/src/gcode/config/M220.cpp index c9070df803b8..6797df25d562 100644 --- a/Marlin/src/gcode/config/M220.cpp +++ b/Marlin/src/gcode/config/M220.cpp @@ -36,16 +36,15 @@ * R : Flag to restore the last-saved factor */ void GcodeSuite::M220() { + if (!parser.seen_any()) { + SERIAL_ECHOLNPGM("FR:", feedrate_percentage, "%"); + return; + } static int16_t backup_feedrate_percentage = 100; - if (parser.seen('B')) backup_feedrate_percentage = feedrate_percentage; - if (parser.seen('R')) feedrate_percentage = backup_feedrate_percentage; - + const int16_t now_feedrate_perc = feedrate_percentage; + if (parser.seen_test('R')) feedrate_percentage = backup_feedrate_percentage; + if (parser.seen_test('B')) backup_feedrate_percentage = now_feedrate_perc; if (parser.seenval('S')) feedrate_percentage = parser.value_int(); - if (!parser.seen_any()) { - SERIAL_ECHOPGM("FR:", feedrate_percentage); - SERIAL_CHAR('%'); - SERIAL_EOL(); - } } diff --git a/Marlin/src/gcode/feature/pause/G61.cpp b/Marlin/src/gcode/feature/pause/G61.cpp index b85487af45c2..889709c04531 100644 --- a/Marlin/src/gcode/feature/pause/G61.cpp +++ b/Marlin/src/gcode/feature/pause/G61.cpp @@ -35,11 +35,24 @@ /** * G61: Return to saved position * - * F - Feedrate (optional) for the move back. - * S - Slot # (0-based) to restore from (default 0). - * X Y Z E - Axes to restore. At least one is required. + * F - Feedrate (optional) for the move back. + * S - Slot # (0-based) to restore from (default 0). + * X - Restore X axis, applying the given offset (default 0) + * Y - Restore Y axis, applying the given offset (default 0) + * Z - Restore Z axis, applying the given offset (default 0) * - * If XYZE are not given, default restore uses the smart blocking move. + * If there is an Extruder: + * E - Restore E axis, applying the given offset (default 0) + * + * With extra axes using default names: + * A - Restore 4th axis, applying the given offset (default 0) + * B - Restore 5th axis, applying the given offset (default 0) + * C - Restore 6th axis, applying the given offset (default 0) + * U - Restore 7th axis, applying the given offset (default 0) + * V - Restore 8th axis, applying the given offset (default 0) + * W - Restore 9th axis, applying the given offset (default 0) + * + * If no axes are specified then all axes are restored. */ void GcodeSuite::G61() { @@ -71,7 +84,7 @@ void GcodeSuite::G61() { if (parser.seen(STR_AXES_MAIN)) { DEBUG_ECHOPGM(STR_RESTORING_POS " S", slot); LOOP_NUM_AXES(i) { - destination[i] = parser.seenval(AXIS_CHAR(i)) + destination[i] = parser.seen(AXIS_CHAR(i)) ? stored_position[slot][i] + parser.value_axis_units((AxisEnum)i) : current_position[i]; DEBUG_CHAR(' ', AXIS_CHAR(i)); diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index b50d8363a4cf..9d5621f0c3dd 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -335,7 +335,7 @@ #include "../feature/encoder_i2c.h" #endif -#if IS_SCARA || defined(G0_FEEDRATE) +#if EITHER(IS_SCARA, POLAR) || defined(G0_FEEDRATE) #define HAS_FAST_MOVES 1 #endif diff --git a/Marlin/src/gcode/geometry/M206_M428.cpp b/Marlin/src/gcode/geometry/M206_M428.cpp index 494b2115b826..b12e68060537 100644 --- a/Marlin/src/gcode/geometry/M206_M428.cpp +++ b/Marlin/src/gcode/geometry/M206_M428.cpp @@ -91,7 +91,7 @@ void GcodeSuite::M428() { diff[i] = -current_position[i]; if (!WITHIN(diff[i], -20, 20)) { SERIAL_ERROR_MSG(STR_ERR_M428_TOO_FAR); - LCD_ALERTMESSAGE_F("Err: Too far!"); + LCD_ALERTMESSAGE(MSG_ERR_M428_TOO_FAR); ERR_BUZZ(); return; } diff --git a/Marlin/src/gcode/host/M114.cpp b/Marlin/src/gcode/host/M114.cpp index 60359eeecfae..e6e83ba6e598 100644 --- a/Marlin/src/gcode/host/M114.cpp +++ b/Marlin/src/gcode/host/M114.cpp @@ -71,7 +71,7 @@ #if IS_KINEMATIC // Kinematics applied to the leveled position - SERIAL_ECHOPGM(TERN(IS_SCARA, "ScaraK: ", "DeltaK: ")); + SERIAL_ECHOPGM(TERN(POLAR, "Polar", TERN(IS_SCARA, "Scara", "Delta")) "K: " ); inverse_kinematics(leveled); // writes delta[] report_linear_axis_pos(delta); #endif diff --git a/Marlin/src/gcode/host/M115.cpp b/Marlin/src/gcode/host/M115.cpp index 6e8c406adc1a..d28d53eeddba 100644 --- a/Marlin/src/gcode/host/M115.cpp +++ b/Marlin/src/gcode/host/M115.cpp @@ -232,7 +232,7 @@ void GcodeSuite::M115() { const xyz_pos_t lmin = dmin.asLogical(), lmax = dmax.asLogical(), wmin = cmin.asLogical(), wmax = cmax.asLogical(); - SERIAL_ECHOLNPGM( + SERIAL_ECHOPGM( "area:{" "full:{" "min:{" @@ -249,6 +249,8 @@ void GcodeSuite::M115() { ), "}" // max "}," // full + ); + SERIAL_ECHOLNPGM( "work:{" "min:{" LIST_N(DOUBLE(NUM_AXES), diff --git a/Marlin/src/gcode/host/M360.cpp b/Marlin/src/gcode/host/M360.cpp index b3a95a35aaec..d8e166dad8e0 100644 --- a/Marlin/src/gcode/host/M360.cpp +++ b/Marlin/src/gcode/host/M360.cpp @@ -161,6 +161,7 @@ void GcodeSuite::M360() { SERIAL_ECHOLNPGM( TERN_(DELTA, "Delta") TERN_(IS_SCARA, "SCARA") + TERN_(POLAR, "Polar") TERN_(IS_CORE, "Core") TERN_(MARKFORGED_XY, "MarkForgedXY") TERN_(MARKFORGED_YX, "MarkForgedYX") diff --git a/Marlin/src/gcode/motion/G0_G1.cpp b/Marlin/src/gcode/motion/G0_G1.cpp index cee2f050807e..b10f1ac920d6 100644 --- a/Marlin/src/gcode/motion/G0_G1.cpp +++ b/Marlin/src/gcode/motion/G0_G1.cpp @@ -106,7 +106,7 @@ void GcodeSuite::G0_G1(TERN_(HAS_FAST_MOVES, const bool fast_move/*=false*/)) { #endif // FWRETRACT - #if IS_SCARA + #if EITHER(IS_SCARA, POLAR) fast_move ? prepare_fast_move_to_destination() : prepare_line_to_destination(); #else prepare_line_to_destination(); diff --git a/Marlin/src/gcode/motion/G2_G3.cpp b/Marlin/src/gcode/motion/G2_G3.cpp index 1a0a9c8cccf2..2634117cd9c0 100644 --- a/Marlin/src/gcode/motion/G2_G3.cpp +++ b/Marlin/src/gcode/motion/G2_G3.cpp @@ -218,7 +218,7 @@ void plan_arc( // Add hints to help optimize the move PlannerHints hints; - #if ENABLED(SCARA_FEEDRATE_SCALING) + #if ENABLED(FEEDRATE_SCALING) hints.inv_duration = (scaled_fr_mm_s / flat_mm) * segments; #endif diff --git a/Marlin/src/gcode/temp/M303.cpp b/Marlin/src/gcode/temp/M303.cpp index 820b1556d611..e0ad26027e60 100644 --- a/Marlin/src/gcode/temp/M303.cpp +++ b/Marlin/src/gcode/temp/M303.cpp @@ -67,8 +67,8 @@ void GcodeSuite::M303() { default: SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_BAD_HEATER_ID); - TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_BAD_EXTRUDER_NUM)); - TERN_(DWIN_LCD_PROUI, DWIN_PidTuning(PID_BAD_EXTRUDER_NUM)); + TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_BAD_HEATER_ID)); + TERN_(DWIN_PID_TUNE, DWIN_PidTuning(PID_BAD_HEATER_ID)); return; } @@ -78,20 +78,9 @@ void GcodeSuite::M303() { const celsius_t temp = seenS ? parser.value_celsius() : default_temp; const bool u = parser.boolval('U'); - #if ENABLED(DWIN_LCD_PROUI) && EITHER(PIDTEMP, PIDTEMPBED) - if (seenC) HMI_data.PidCycles = c; - if (seenS) { - switch (hid) { - OPTCODE(PIDTEMP, case 0 ... HOTENDS - 1: HMI_data.HotendPidT = temp; break) - OPTCODE(PIDTEMPBED, case H_BED: HMI_data.BedPidT = temp; break) - default: break; - } - } - #endif + TERN_(DWIN_PID_TUNE, DWIN_StartM303(seenC, c, seenS, hid, temp)); - #if DISABLED(BUSY_WHILE_HEATING) - KEEPALIVE_STATE(NOT_BUSY); - #endif + IF_DISABLED(BUSY_WHILE_HEATING, KEEPALIVE_STATE(NOT_BUSY)); LCD_MESSAGE(MSG_PID_AUTOTUNE); thermalManager.PID_autotune(temp, hid, c, u); diff --git a/Marlin/src/gcode/temp/M306.cpp b/Marlin/src/gcode/temp/M306.cpp index c6b700eac3b6..582eb13f81f7 100644 --- a/Marlin/src/gcode/temp/M306.cpp +++ b/Marlin/src/gcode/temp/M306.cpp @@ -52,15 +52,15 @@ void GcodeSuite::M306() { if (parser.seen("ACFPRH")) { const heater_id_t hid = (heater_id_t)parser.intval('E', 0); - MPC_t &constants = thermalManager.temp_hotend[hid].constants; - if (parser.seenval('P')) constants.heater_power = parser.value_float(); - if (parser.seenval('C')) constants.block_heat_capacity = parser.value_float(); - if (parser.seenval('R')) constants.sensor_responsiveness = parser.value_float(); - if (parser.seenval('A')) constants.ambient_xfer_coeff_fan0 = parser.value_float(); + MPC_t &mpc = thermalManager.temp_hotend[hid].mpc; + if (parser.seenval('P')) mpc.heater_power = parser.value_float(); + if (parser.seenval('C')) mpc.block_heat_capacity = parser.value_float(); + if (parser.seenval('R')) mpc.sensor_responsiveness = parser.value_float(); + if (parser.seenval('A')) mpc.ambient_xfer_coeff_fan0 = parser.value_float(); #if ENABLED(MPC_INCLUDE_FAN) - if (parser.seenval('F')) constants.fan255_adjustment = parser.value_float() - constants.ambient_xfer_coeff_fan0; + if (parser.seenval('F')) mpc.applyFanAdjustment(parser.value_float()); #endif - if (parser.seenval('H')) constants.filament_heat_capacity_permm = parser.value_float(); + if (parser.seenval('H')) mpc.filament_heat_capacity_permm = parser.value_float(); return; } @@ -71,16 +71,16 @@ void GcodeSuite::M306_report(const bool forReplay/*=true*/) { report_heading(forReplay, F("Model predictive control")); HOTEND_LOOP() { report_echo_start(forReplay); - MPC_t& constants = thermalManager.temp_hotend[e].constants; + MPC_t &mpc = thermalManager.temp_hotend[e].mpc; SERIAL_ECHOPGM(" M306 E", e); - SERIAL_ECHOPAIR_F(" P", constants.heater_power, 2); - SERIAL_ECHOPAIR_F(" C", constants.block_heat_capacity, 2); - SERIAL_ECHOPAIR_F(" R", constants.sensor_responsiveness, 4); - SERIAL_ECHOPAIR_F(" A", constants.ambient_xfer_coeff_fan0, 4); + SERIAL_ECHOPAIR_F(" P", mpc.heater_power, 2); + SERIAL_ECHOPAIR_F(" C", mpc.block_heat_capacity, 2); + SERIAL_ECHOPAIR_F(" R", mpc.sensor_responsiveness, 4); + SERIAL_ECHOPAIR_F(" A", mpc.ambient_xfer_coeff_fan0, 4); #if ENABLED(MPC_INCLUDE_FAN) - SERIAL_ECHOPAIR_F(" F", constants.ambient_xfer_coeff_fan0 + constants.fan255_adjustment, 4); + SERIAL_ECHOPAIR_F(" F", mpc.fanCoefficient(), 4); #endif - SERIAL_ECHOPAIR_F(" H", constants.filament_heat_capacity_permm, 4); + SERIAL_ECHOPAIR_F(" H", mpc.filament_heat_capacity_permm, 4); SERIAL_EOL(); } } diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 0a66284df6d2..920ad15c6cc6 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -324,7 +324,7 @@ #define IS_ULTIPANEL 1 #endif -// TFT Compatibility +// TFT Legacy Compatibility #if ANY(FSMC_GRAPHICAL_TFT, SPI_GRAPHICAL_TFT, TFT_320x240, TFT_480x320, TFT_320x240_SPI, TFT_480x320_SPI, TFT_LVGL_UI_FSMC, TFT_LVGL_UI_SPI) #define IS_LEGACY_TFT 1 #define TFT_GENERIC @@ -603,12 +603,26 @@ #else #undef EXTRUDERS #define EXTRUDERS 0 + #undef TEMP_SENSOR_0 + #undef TEMP_SENSOR_1 + #undef TEMP_SENSOR_2 + #undef TEMP_SENSOR_3 + #undef TEMP_SENSOR_4 + #undef TEMP_SENSOR_5 + #undef TEMP_SENSOR_6 + #undef TEMP_SENSOR_7 #undef SINGLENOZZLE #undef SWITCHING_EXTRUDER #undef SWITCHING_NOZZLE #undef MIXING_EXTRUDER #undef HOTEND_IDLE_TIMEOUT #undef DISABLE_E + #undef THERMAL_PROTECTION_HOTENDS + #undef PREVENT_COLD_EXTRUSION + #undef PREVENT_LENGTHY_EXTRUDE + #undef FILAMENT_RUNOUT_SENSOR + #undef FILAMENT_RUNOUT_DISTANCE_MM + #undef DISABLE_INACTIVE_EXTRUDER #endif #define E_OPTARG(N) OPTARG(HAS_MULTI_EXTRUDER, N) @@ -682,20 +696,28 @@ #if E_STEPPERS <= 7 #undef INVERT_E7_DIR + #undef E7_DRIVER_TYPE #if E_STEPPERS <= 6 #undef INVERT_E6_DIR + #undef E6_DRIVER_TYPE #if E_STEPPERS <= 5 #undef INVERT_E5_DIR + #undef E5_DRIVER_TYPE #if E_STEPPERS <= 4 #undef INVERT_E4_DIR + #undef E4_DRIVER_TYPE #if E_STEPPERS <= 3 #undef INVERT_E3_DIR + #undef E3_DRIVER_TYPE #if E_STEPPERS <= 2 #undef INVERT_E2_DIR + #undef E2_DRIVER_TYPE #if E_STEPPERS <= 1 #undef INVERT_E1_DIR + #undef E1_DRIVER_TYPE #if E_STEPPERS == 0 #undef INVERT_E0_DIR + #undef E0_DRIVER_TYPE #endif #endif #endif @@ -733,6 +755,7 @@ #else #define NUM_AXES 1 #endif +#define HAS_X_AXIS 1 #if NUM_AXES >= XY #define HAS_Y_AXIS 1 #if NUM_AXES >= XYZ @@ -767,31 +790,6 @@ #endif #endif -#if E_STEPPERS <= 0 - #undef E0_DRIVER_TYPE -#endif -#if E_STEPPERS <= 1 - #undef E1_DRIVER_TYPE -#endif -#if E_STEPPERS <= 2 - #undef E2_DRIVER_TYPE -#endif -#if E_STEPPERS <= 3 - #undef E3_DRIVER_TYPE -#endif -#if E_STEPPERS <= 4 - #undef E4_DRIVER_TYPE -#endif -#if E_STEPPERS <= 5 - #undef E5_DRIVER_TYPE -#endif -#if E_STEPPERS <= 6 - #undef E6_DRIVER_TYPE -#endif -#if E_STEPPERS <= 7 - #undef E7_DRIVER_TYPE -#endif - #if !HAS_Y_AXIS #undef ENDSTOPPULLUP_YMIN #undef ENDSTOPPULLUP_YMAX @@ -807,7 +805,6 @@ #undef MANUAL_Y_HOME_POS #undef MIN_SOFTWARE_ENDSTOP_Y #undef MAX_SOFTWARE_ENDSTOP_Y - #undef SAFE_BED_LEVELING_START_Y #endif #if !HAS_Z_AXIS @@ -827,7 +824,6 @@ #undef MANUAL_Z_HOME_POS #undef MIN_SOFTWARE_ENDSTOP_Z #undef MAX_SOFTWARE_ENDSTOP_Z - #undef SAFE_BED_LEVELING_START_Z #endif #if !HAS_I_AXIS @@ -844,7 +840,6 @@ #undef MANUAL_I_HOME_POS #undef MIN_SOFTWARE_ENDSTOP_I #undef MAX_SOFTWARE_ENDSTOP_I - #undef SAFE_BED_LEVELING_START_I #endif #if !HAS_J_AXIS @@ -861,7 +856,6 @@ #undef MANUAL_J_HOME_POS #undef MIN_SOFTWARE_ENDSTOP_J #undef MAX_SOFTWARE_ENDSTOP_J - #undef SAFE_BED_LEVELING_START_J #endif #if !HAS_K_AXIS @@ -878,7 +872,6 @@ #undef MANUAL_K_HOME_POS #undef MIN_SOFTWARE_ENDSTOP_K #undef MAX_SOFTWARE_ENDSTOP_K - #undef SAFE_BED_LEVELING_START_K #endif #if !HAS_U_AXIS @@ -895,7 +888,6 @@ #undef MANUAL_U_HOME_POS #undef MIN_SOFTWARE_ENDSTOP_U #undef MAX_SOFTWARE_ENDSTOP_U - #undef SAFE_BED_LEVELING_START_U #endif #if !HAS_V_AXIS @@ -912,7 +904,6 @@ #undef MANUAL_V_HOME_POS #undef MIN_SOFTWARE_ENDSTOP_V #undef MAX_SOFTWARE_ENDSTOP_V - #undef SAFE_BED_LEVELING_START_V #endif #if !HAS_W_AXIS @@ -929,7 +920,6 @@ #undef MANUAL_W_HOME_POS #undef MIN_SOFTWARE_ENDSTOP_W #undef MAX_SOFTWARE_ENDSTOP_W - #undef SAFE_BED_LEVELING_START_W #endif #ifdef X2_DRIVER_TYPE @@ -1298,6 +1288,7 @@ // Clear probe pin settings when no probe is selected #undef Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN #undef USE_PROBE_FOR_Z_HOMING + #undef Z_MIN_PROBE_REPEATABILITY_TEST #endif #if ENABLED(BELTPRINTER) && !defined(HOME_Y_BEFORE_X) @@ -1406,7 +1397,7 @@ #if ANY(MORGAN_SCARA, MP_SCARA, AXEL_TPARA) #define IS_SCARA 1 #define IS_KINEMATIC 1 -#elif EITHER(DELTA, POLARGRAPH) +#elif ANY(DELTA, POLARGRAPH, POLAR) #define IS_KINEMATIC 1 #else #define IS_CARTESIAN 1 @@ -1524,30 +1515,6 @@ #endif #endif -#if ENABLED(TFT_RES_320x240) - #define TFT_WIDTH 320 - #define TFT_HEIGHT 240 - #define GRAPHICAL_TFT_UPSCALE 2 -#elif ENABLED(TFT_RES_480x272) - #define TFT_WIDTH 480 - #define TFT_HEIGHT 272 - #define GRAPHICAL_TFT_UPSCALE 2 -#elif ENABLED(TFT_RES_480x320) - #define TFT_WIDTH 480 - #define TFT_HEIGHT 320 - #define GRAPHICAL_TFT_UPSCALE 3 -#elif ENABLED(TFT_RES_1024x600) - #define TFT_WIDTH 1024 - #define TFT_HEIGHT 600 - #if ENABLED(TOUCH_SCREEN) - #define GRAPHICAL_TFT_UPSCALE 6 - #define TFT_PIXEL_OFFSET_X 120 - #else - #define GRAPHICAL_TFT_UPSCALE 8 - #define TFT_PIXEL_OFFSET_X 0 - #endif -#endif - // FSMC/SPI TFT Panels using standard HAL/tft/tft_(fsmc|spi|ltdc).h #if ENABLED(TFT_INTERFACE_FSMC) #define HAS_FSMC_TFT 1 @@ -1572,8 +1539,41 @@ #endif #endif +#if ANY(HAS_SPI_TFT, HAS_FSMC_TFT, HAS_LTDC_TFT) + #include "../lcd/tft_io/tft_orientation.h" +#endif + +#if ENABLED(TFT_RES_320x240) + #if ENABLED(TFT_COLOR_UI_PORTRAIT) + #define TFT_WIDTH 240 + #define TFT_HEIGHT 320 + #else + #define TFT_WIDTH 320 + #define TFT_HEIGHT 240 + #endif + #define GRAPHICAL_TFT_UPSCALE 2 +#elif ENABLED(TFT_RES_480x272) + #define TFT_WIDTH 480 + #define TFT_HEIGHT 272 + #define GRAPHICAL_TFT_UPSCALE 2 +#elif ENABLED(TFT_RES_480x320) + #define TFT_WIDTH 480 + #define TFT_HEIGHT 320 + #define GRAPHICAL_TFT_UPSCALE 3 +#elif ENABLED(TFT_RES_1024x600) + #define TFT_WIDTH 1024 + #define TFT_HEIGHT 600 + #if ENABLED(TOUCH_SCREEN) + #define GRAPHICAL_TFT_UPSCALE 6 + #define TFT_PIXEL_OFFSET_X 120 + #else + #define GRAPHICAL_TFT_UPSCALE 8 + #define TFT_PIXEL_OFFSET_X 0 + #endif +#endif + #if ENABLED(TFT_COLOR_UI) - #if TFT_HEIGHT == 240 + #if (TFT_WIDTH == 320 && TFT_HEIGHT == 240) || (TFT_WIDTH == 240 && TFT_HEIGHT == 320) #if ENABLED(TFT_INTERFACE_SPI) #define TFT_320x240_SPI #elif ENABLED(TFT_INTERFACE_FSMC) @@ -1610,7 +1610,11 @@ #define HAS_UI_1024x600 1 #endif #if ANY(HAS_UI_320x240, HAS_UI_480x320, HAS_UI_480x272) - #define LCD_HEIGHT TERN(TOUCH_SCREEN, 6, 7) // Fewer lines with touch buttons onscreen + #if ENABLED(TFT_COLOR_UI_PORTRAIT) + #define LCD_HEIGHT TERN(TOUCH_SCREEN, 8, 9) // Fewer lines with touch buttons onscreen + #else + #define LCD_HEIGHT TERN(TOUCH_SCREEN, 6, 7) // Fewer lines with touch buttons onscreen + #endif #elif HAS_UI_1024x600 #define LCD_HEIGHT TERN(TOUCH_SCREEN, 12, 13) // Fewer lines with touch buttons onscreen #endif @@ -1651,7 +1655,9 @@ #endif #endif -#if X_HOME_DIR || (HAS_Y_AXIS && Y_HOME_DIR) || (HAS_Z_AXIS && Z_HOME_DIR) || (HAS_I_AXIS && I_HOME_DIR) || (HAS_J_AXIS && J_HOME_DIR) || (HAS_K_AXIS && K_HOME_DIR) +#if X_HOME_DIR || (HAS_Y_AXIS && Y_HOME_DIR) || (HAS_Z_AXIS && Z_HOME_DIR) \ + || (HAS_I_AXIS && I_HOME_DIR) || (HAS_J_AXIS && J_HOME_DIR) || (HAS_K_AXIS && K_HOME_DIR) \ + || (HAS_U_AXIS && U_HOME_DIR) || (HAS_V_AXIS && V_HOME_DIR) || (HAS_W_AXIS && W_HOME_DIR) #define HAS_ENDSTOPS 1 #define COORDINATE_OKAY(N,L,H) WITHIN(N,L,H) #else diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index bf1088afc898..bfd8caf3dd84 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -79,35 +79,54 @@ #define SERVO_DELAY { 50 } #endif +#if !HAS_BED_PROBE + #undef BABYSTEP_ZPROBE_OFFSET +#endif #if !HAS_STOWABLE_PROBE #undef PROBE_DEPLOY_STOW_MENU #endif +// Some options are disallowed without required axes +#if !HAS_Y_AXIS + #undef SAFE_BED_LEVELING_START_Y + #undef ARC_SUPPORT + #undef INPUT_SHAPING_Y + #undef SHAPING_FREQ_Y + #undef SHAPING_BUFFER_Y +#endif +#if !HAS_Z_AXIS + #undef SAFE_BED_LEVELING_START_Z +#endif +#if !HAS_I_AXIS + #undef SAFE_BED_LEVELING_START_I +#endif +#if !HAS_J_AXIS + #undef SAFE_BED_LEVELING_START_J +#endif +#if !HAS_K_AXIS + #undef SAFE_BED_LEVELING_START_K +#endif +#if !HAS_U_AXIS + #undef SAFE_BED_LEVELING_START_U +#endif +#if !HAS_V_AXIS + #undef SAFE_BED_LEVELING_START_V +#endif +#if !HAS_W_AXIS + #undef SAFE_BED_LEVELING_START_W +#endif + +// Disallowed with no extruders #if !HAS_EXTRUDERS #define NO_VOLUMETRICS - #undef TEMP_SENSOR_0 - #undef TEMP_SENSOR_1 - #undef TEMP_SENSOR_2 - #undef TEMP_SENSOR_3 - #undef TEMP_SENSOR_4 - #undef TEMP_SENSOR_5 - #undef TEMP_SENSOR_6 - #undef TEMP_SENSOR_7 #undef FWRETRACT #undef PIDTEMP #undef AUTOTEMP #undef PID_EXTRUSION_SCALING #undef LIN_ADVANCE - #undef FILAMENT_RUNOUT_SENSOR #undef ADVANCED_PAUSE_FEATURE - #undef FILAMENT_RUNOUT_DISTANCE_MM - #undef FILAMENT_LOAD_UNLOAD_GCODES - #undef DISABLE_INACTIVE_EXTRUDER #undef FILAMENT_LOAD_UNLOAD_GCODES #undef EXTRUDER_RUNOUT_PREVENT - #undef PREVENT_COLD_EXTRUSION - #undef PREVENT_LENGTHY_EXTRUDE - #undef THERMAL_PROTECTION_HOTENDS #undef THERMAL_PROTECTION_PERIOD #undef WATCH_TEMP_PERIOD #undef SHOW_TEMP_ADC_VALUES @@ -653,6 +672,10 @@ #define HAS_MEDIA_SUBCALLS 1 #endif +#if ANY(SHOW_PROGRESS_PERCENT, SHOW_ELAPSED_TIME, SHOW_REMAINING_TIME, SHOW_INTERACTION_TIME) + #define HAS_EXTRA_PROGRESS 1 +#endif + #if HAS_PRINT_PROGRESS && EITHER(PRINT_PROGRESS_SHOW_DECIMALS, SHOW_REMAINING_TIME) #define HAS_PRINT_PROGRESS_PERMYRIAD 1 #endif @@ -1120,11 +1143,6 @@ #endif // Input shaping -#if !HAS_Y_AXIS - #undef INPUT_SHAPING_Y - #undef SHAPING_FREQ_Y - #undef SHAPING_BUFFER_Y -#endif #if EITHER(INPUT_SHAPING_X, INPUT_SHAPING_Y) #define HAS_SHAPING 1 #endif diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index b9bcb4d0d286..cf6c560b5cc7 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -267,6 +267,7 @@ */ #if IS_KINEMATIC #undef LCD_BED_TRAMMING + #undef SLOWDOWN #endif /** @@ -274,12 +275,11 @@ * Printable radius assumes joints can fully extend */ #if IS_SCARA - #undef SLOWDOWN #if ENABLED(AXEL_TPARA) - #define SCARA_PRINTABLE_RADIUS (TPARA_LINKAGE_1 + TPARA_LINKAGE_2) + #define PRINTABLE_RADIUS (TPARA_LINKAGE_1 + TPARA_LINKAGE_2) #else #define QUICK_HOME - #define SCARA_PRINTABLE_RADIUS (SCARA_LINKAGE_1 + SCARA_LINKAGE_2) + #define PRINTABLE_RADIUS (SCARA_LINKAGE_1 + SCARA_LINKAGE_2) #endif #endif @@ -378,7 +378,6 @@ */ #if ENABLED(DELTA) #undef Z_SAFE_HOMING - #undef SLOWDOWN #endif #ifndef MESH_INSET @@ -2251,7 +2250,7 @@ #define IS_Z3_ENDSTOP(A,M) (ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPERS >= 3 && Z3_USE_ENDSTOP == _##A##M##_) #define IS_Z4_ENDSTOP(A,M) (ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPERS >= 4 && Z4_USE_ENDSTOP == _##A##M##_) -#define _HAS_STOP(A,M) (PIN_EXISTS(A##_##M) && !IS_PROBE_PIN(A,M) && !IS_X2_ENDSTOP(A,M) && !IS_Y2_ENDSTOP(A,M) && !IS_Z2_ENDSTOP(A,M) && !IS_Z3_ENDSTOP(A,M) && !IS_Z4_ENDSTOP(A,M)) +#define _HAS_STOP(A,M) (HAS_##A##_AXIS && PIN_EXISTS(A##_##M) && !IS_PROBE_PIN(A,M) && !IS_X2_ENDSTOP(A,M) && !IS_Y2_ENDSTOP(A,M) && !IS_Z2_ENDSTOP(A,M) && !IS_Z3_ENDSTOP(A,M) && !IS_Z4_ENDSTOP(A,M)) #if _HAS_STOP(X,MIN) #define HAS_X_MIN 1 #endif @@ -2507,6 +2506,15 @@ #define HAS_PID_HEATING 1 #endif +#if ENABLED(DWIN_LCD_PROUI) + #if EITHER(PIDTEMP, PIDTEMPBED) + #define DWIN_PID_TUNE 1 + #endif + #if EITHER(DWIN_PID_TUNE, MPCTEMP) && DISABLED(DISABLE_TUNING_GRAPH) + #define SHOW_TUNING_GRAPH 1 + #endif +#endif + // Thermal protection #if !HAS_HEATED_BED #undef THERMAL_PROTECTION_BED @@ -3046,7 +3054,7 @@ */ #if !HAS_FAN #undef ADAPTIVE_FAN_SLOWING - #undef NO_FAN_SLOWING_IN_PID_TUNING + #undef TEMP_TUNING_MAINTAIN_FAN #endif #if !BOTH(HAS_BED_PROBE, HAS_FAN) #undef PROBING_FANS_OFF @@ -3083,7 +3091,10 @@ /** * Only constrain Z on DELTA / SCARA machines */ -#if IS_KINEMATIC +#if ENABLED(POLAR) + #undef MIN_SOFTWARE_ENDSTOP_Y + #undef MAX_SOFTWARE_ENDSTOP_Y +#elif IS_KINEMATIC #undef MIN_SOFTWARE_ENDSTOP_X #undef MIN_SOFTWARE_ENDSTOP_Y #undef MAX_SOFTWARE_ENDSTOP_X @@ -3154,7 +3165,7 @@ #if EITHER(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL) #if IS_KINEMATIC // Probing points may be verified at compile time within the radius - // using static_assert(HYPOT2(X2-X1,Y2-Y1)<=sq(DELTA_PRINTABLE_RADIUS),"bad probe point!") + // using static_assert(HYPOT2(X2-X1,Y2-Y1)<=sq(PRINTABLE_RADIUS),"bad probe point!") // so that may be added to SanityCheck.h in the future. #define _MESH_MIN_X (X_MIN_BED + MESH_INSET) #define _MESH_MIN_Y (Y_MIN_BED + MESH_INSET) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 2ef6fd33567d..dc8c8a22cc36 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -88,7 +88,7 @@ * Warnings for old configurations */ #ifndef MOTHERBOARD - #error "MOTHERBOARD is required." + #error "MOTHERBOARD is required. You must '#define MOTHERBOARD BOARD_MYNAME' (not just '#define BOARD_MYNAME')." #elif !defined(X_BED_SIZE) || !defined(Y_BED_SIZE) #error "X_BED_SIZE and Y_BED_SIZE are now required!" #elif WATCH_TEMP_PERIOD > 500 @@ -97,6 +97,8 @@ #error "Thermal Runaway Protection for hotends is now enabled with THERMAL_PROTECTION_HOTENDS." #elif DISABLED(THERMAL_PROTECTION_BED) && defined(THERMAL_PROTECTION_BED_PERIOD) #error "Thermal Runaway Protection for the bed is now enabled with THERMAL_PROTECTION_BED." +#elif defined(NO_FAN_SLOWING_IN_PID_TUNING) + #error "NO_FAN_SLOWING_IN_PID_TUNING is now TEMP_TUNING_MAINTAIN_FAN." #elif (CORE_IS_XZ || CORE_IS_YZ) && ENABLED(Z_LATE_ENABLE) #error "Z_LATE_ENABLE can't be used with COREXZ, COREZX, COREYZ, or COREZY." #elif defined(X_HOME_RETRACT_MM) @@ -658,6 +660,16 @@ #error "(POLAR|DELTA|SCARA|TPARA)_SEGMENTS_PER_SECOND is now DEFAULT_SEGMENTS_PER_SECOND." #elif ANY(DGUS_LCD_UI_ORIGIN, DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY, DGUS_LCD_UI_MKS, DGUS_LCD_UI_RELOADED) && !defined(DGUS_LCD_UI) #error "DGUS_LCD_UI_[TYPE] is now set using DGUS_LCD_UI TYPE." +#elif defined(DELTA_PRINTABLE_RADIUS) + #error "DELTA_PRINTABLE_RADIUS is now PRINTABLE_RADIUS." +#elif defined(SCARA_PRINTABLE_RADIUS) + #error "SCARA_PRINTABLE_RADIUS is now PRINTABLE_RADIUS." +#elif defined(SCARA_FEEDRATE_SCALING) + #error "SCARA_FEEDRATE_SCALING is now FEEDRATE_SCALING." +#elif defined(MILLISECONDS_PREHEAT_TIME) + #error "MILLISECONDS_PREHEAT_TIME is now PREHEAT_TIME_HOTEND_MS." +#elif defined(EXPERIMENTAL_SCURVE) + #error "EXPERIMENTAL_SCURVE is no longer needed and should be removed." #endif // L64xx stepper drivers have been removed @@ -839,7 +851,9 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L * Validate that the bed size fits */ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS) are too narrow to contain X_BED_SIZE."); -static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS) are too narrow to contain Y_BED_SIZE."); +#if HAS_Y_AXIS + static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS) are too narrow to contain Y_BED_SIZE."); +#endif /** * Granular software endstops (Marlin >= 1.1.7) @@ -934,7 +948,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "SET_PROGRESS_MANUALLY requires at least one of SET_PROGRESS_PERCENT, SET_REMAINING_TIME, SET_INTERACTION_TIME to be enabled." #endif -#if HAS_LCDPRINT && LCD_HEIGHT < 4 && ANY(SHOW_PROGRESS_PERCENT, SHOW_ELAPSED_TIME, SHOW_REMAINING_TIME, SHOW_INTERACTION_TIME) +#if HAS_LCDPRINT && HAS_EXTRA_PROGRESS && LCD_HEIGHT < 4 #error "Displays with fewer than 4 rows of text can't show progress values." #endif @@ -980,12 +994,12 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "SDSORT_LIMIT must be 256 or smaller." #elif SDSORT_LIMIT < 10 #error "SDSORT_LIMIT should be greater than 9 to be useful." - #elif DISABLED(SDSORT_USES_RAM) - #if ENABLED(SDSORT_DYNAMIC_RAM) - #error "SDSORT_DYNAMIC_RAM requires SDSORT_USES_RAM (which reads the directory into RAM)." - #elif ENABLED(SDSORT_CACHE_NAMES) - #error "SDSORT_CACHE_NAMES requires SDSORT_USES_RAM (which reads the directory into RAM)." - #endif + #elif ENABLED(SDSORT_DYNAMIC_RAM) && DISABLED(SDSORT_USES_RAM) + #error "SDSORT_DYNAMIC_RAM requires SDSORT_USES_RAM (which reads the directory into RAM)." + #elif ENABLED(SDSORT_CACHE_NAMES) && DISABLED(SDSORT_USES_RAM) + #error "SDSORT_CACHE_NAMES requires SDSORT_USES_RAM (which reads the directory into RAM)." + #elif ENABLED(SDSORT_DYNAMIC_RAM) && DISABLED(SDSORT_CACHE_NAMES) + #error "SDSORT_DYNAMIC_RAM requires SDSORT_CACHE_NAMES." #endif #if ENABLED(SDSORT_CACHE_NAMES) && DISABLED(SDSORT_DYNAMIC_RAM) @@ -1362,10 +1376,9 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #else static_assert(WITHIN(ADVANCE_K, 0, 10), "ADVANCE_K must be from 0 to 10 (Changed in LIN_ADVANCE v1.5, Marlin 1.1.9)."); #endif - #if ENABLED(S_CURVE_ACCELERATION) && DISABLED(EXPERIMENTAL_SCURVE) - #error "LIN_ADVANCE and S_CURVE_ACCELERATION may not play well together! Enable EXPERIMENTAL_SCURVE to continue." - #elif ENABLED(DIRECT_STEPPING) - #error "DIRECT_STEPPING is incompatible with LIN_ADVANCE. Enable in external planner if possible." + + #if ENABLED(DIRECT_STEPPING) + #error "DIRECT_STEPPING is incompatible with LIN_ADVANCE. (Extrusion is controlled externally by the Step Daemon.)" #elif NONE(HAS_JUNCTION_DEVIATION, ALLOW_LOW_EJERK) && defined(DEFAULT_EJERK) static_assert(DEFAULT_EJERK >= 10, "It is strongly recommended to set DEFAULT_EJERK >= 10 when using LIN_ADVANCE. Enable ALLOW_LOW_EJERK to bypass this alert (e.g., for direct drive)."); #endif @@ -1666,8 +1679,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS /** * Allow only one kinematic type to be defined */ -#if MANY(DELTA, MORGAN_SCARA, MP_SCARA, AXEL_TPARA, COREXY, COREXZ, COREYZ, COREYX, COREZX, COREZY, MARKFORGED_XY, MARKFORGED_YX, ARTICULATED_ROBOT_ARM, FOAMCUTTER_XYUV) - #error "Please enable only one of DELTA, MORGAN_SCARA, MP_SCARA, AXEL_TPARA, COREXY, COREXZ, COREYZ, COREYX, COREZX, COREZY, MARKFORGED_XY, MARKFORGED_YX, ARTICULATED_ROBOT_ARM, or FOAMCUTTER_XYUV." +#if MANY(DELTA, MORGAN_SCARA, MP_SCARA, AXEL_TPARA, COREXY, COREXZ, COREYZ, COREYX, COREZX, COREZY, MARKFORGED_XY, MARKFORGED_YX, ARTICULATED_ROBOT_ARM, FOAMCUTTER_XYUV, POLAR) + #error "Please enable only one of DELTA, MORGAN_SCARA, MP_SCARA, AXEL_TPARA, COREXY, COREXZ, COREYZ, COREYX, COREZX, COREZY, MARKFORGED_XY, MARKFORGED_YX, ARTICULATED_ROBOT_ARM, FOAMCUTTER_XYUV, or POLAR." #endif /** @@ -1695,7 +1708,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS * Junction deviation is incompatible with kinematic systems. */ #if HAS_JUNCTION_DEVIATION && IS_KINEMATIC - #error "CLASSIC_JERK is required for DELTA and SCARA." + #error "CLASSIC_JERK is required for DELTA, SCARA, and POLAR." #endif /** @@ -1799,7 +1812,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "BLTOUCH requires DEACTIVATE_SERVOS_AFTER_MOVE to be to disabled. Please update your Configuration.h file." #endif - #if HAS_INVERTED_PROBE + #if ENABLED(INVERTED_PROBE_STATE) #if !Z_MIN_PROBE_ENDSTOP_INVERTING #error "BLTOUCH requires Z_MIN_PROBE_ENDSTOP_INVERTING set to true." #endif @@ -1807,7 +1820,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "BLTOUCH requires Z_MIN_PROBE_ENDSTOP_INVERTING set to false." #endif #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) - #if HAS_INVERTED_PROBE + #if ENABLED(INVERTED_PROBE_STATE) #if !Z_MIN_ENDSTOP_INVERTING #error "BLTOUCH requires Z_MIN_ENDSTOP_INVERTING set to true." #endif @@ -1839,7 +1852,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #elif !HAS_RESUME_CONTINUE #error "TOUCH_MI_PROBE currently requires an LCD controller or EMERGENCY_PARSER." #endif - #if HAS_INVERTED_PROBE + #if ENABLED(INVERTED_PROBE_STATE) #if !Z_MIN_PROBE_ENDSTOP_INVERTING #error "TOUCH_MI_PROBE requires Z_MIN_PROBE_ENDSTOP_INVERTING set to true." #endif @@ -1847,7 +1860,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "TOUCH_MI_PROBE requires Z_MIN_PROBE_ENDSTOP_INVERTING set to false." #endif #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) - #if HAS_INVERTED_PROBE + #if ENABLED(INVERTED_PROBE_STATE) #if !Z_MIN_ENDSTOP_INVERTING #error "TOUCH_MI_PROBE requires Z_MIN_ENDSTOP_INVERTING set to true." #endif @@ -1913,7 +1926,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS static_assert(PROBING_MARGIN_RIGHT >= 0, "PROBING_MARGIN_RIGHT must be >= 0."); #endif - #define _MARGIN(A) TERN(IS_SCARA, SCARA_PRINTABLE_RADIUS, TERN(DELTA, DELTA_PRINTABLE_RADIUS, ((A##_BED_SIZE) / 2))) + #define _MARGIN(A) TERN(IS_KINEMATIC, PRINTABLE_RADIUS, ((A##_BED_SIZE) / 2)) static_assert(PROBING_MARGIN < _MARGIN(X), "PROBING_MARGIN is too large."); static_assert(PROBING_MARGIN_BACK < _MARGIN(Y), "PROBING_MARGIN_BACK is too large."); static_assert(PROBING_MARGIN_FRONT < _MARGIN(Y), "PROBING_MARGIN_FRONT is too large."); @@ -1925,15 +1938,17 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS * Make sure Z raise values are set */ #ifndef Z_CLEARANCE_DEPLOY_PROBE - #error "You must define Z_CLEARANCE_DEPLOY_PROBE in your configuration." - #elif !defined(Z_CLEARANCE_BETWEEN_PROBES) - #error "You must define Z_CLEARANCE_BETWEEN_PROBES in your configuration." - #elif Z_CLEARANCE_DEPLOY_PROBE < 0 - #error "Probes need Z_CLEARANCE_DEPLOY_PROBE >= 0." - #elif Z_CLEARANCE_BETWEEN_PROBES < 0 - #error "Probes need Z_CLEARANCE_BETWEEN_PROBES >= 0." - #elif Z_AFTER_PROBING < 0 - #error "Probes need Z_AFTER_PROBING >= 0." + #error "Z_CLEARANCE_DEPLOY_PROBE is required for bed probes." + #else + static_assert(Z_CLEARANCE_DEPLOY_PROBE >= 0, "Probes require Z_CLEARANCE_DEPLOY_PROBE >= 0."); + #endif + #ifndef Z_CLEARANCE_BETWEEN_PROBES + #error "Z_CLEARANCE_BETWEEN_PROBES is required for bed probes." + #else + static_assert(Z_CLEARANCE_BETWEEN_PROBES >= 0, "Probes require Z_CLEARANCE_BETWEEN_PROBES >= 0."); + #endif + #ifdef Z_AFTER_PROBING + static_assert(Z_AFTER_PROBING >= 0, "Probes require Z_AFTER_PROBING >= 0."); #endif #if MULTIPLE_PROBING > 0 || EXTRA_PROBING > 0 @@ -2004,6 +2019,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #if IS_SCARA #error "AUTO_BED_LEVELING_UBL does not yet support SCARA printers." + #elif ENABLED(POLAR) + #error "AUTO_BED_LEVELING_UBL does not yet support POLAR printers." #elif DISABLED(EEPROM_SETTINGS) #error "AUTO_BED_LEVELING_UBL requires EEPROM_SETTINGS." #elif !WITHIN(GRID_MAX_POINTS_X, 3, 15) || !WITHIN(GRID_MAX_POINTS_Y, 3, 15) @@ -2383,12 +2400,16 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #endif #if MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED < 5 #error "Thermistor 66 requires MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED ≥ 5." - #elif MILLISECONDS_PREHEAT_TIME < 15000 - #error "Thermistor 66 requires MILLISECONDS_PREHEAT_TIME ≥ 15000, but 30000 or higher is recommended." + #elif PREHEAT_TIME_HOTEND_MS < 15000 + #error "Thermistor 66 requires PREHEAT_TIME_HOTEND_MS ≥ 15000, but 30000 or higher is recommended." #endif #undef _BAD_MINTEMP #endif +#if TEMP_SENSOR_BED == 66 && PREHEAT_TIME_BED_MS < 15000 + #error "Thermistor 66 requires PREHEAT_TIME_BED_MS ≥ 15000, but 30000 or higher is recommended." +#endif + /** * Required MAX31865 settings */ @@ -4346,34 +4367,59 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive."); #error "BINARY_FILE_TRANSFER and CUSTOM_FIRMWARE_UPLOAD are required for custom upload." #endif -// Check requirements for Input Shaping -#if HAS_SHAPING && defined(__AVR__) - #ifdef SHAPING_MIN_FREQ - static_assert((SHAPING_MIN_FREQ) > 0, "SHAPING_MIN_FREQ must be > 0."); - #else - TERN_(INPUT_SHAPING_X, static_assert((SHAPING_FREQ_X) > 0, "SHAPING_FREQ_X must be > 0 or SHAPING_MIN_FREQ must be set.")); - TERN_(INPUT_SHAPING_Y, static_assert((SHAPING_FREQ_Y) > 0, "SHAPING_FREQ_Y must be > 0 or SHAPING_MIN_FREQ must be set.")); - #endif - #if ENABLED(INPUT_SHAPING_X) - #if F_CPU > 16000000 - static_assert((SHAPING_FREQ_X) == 0 || (SHAPING_FREQ_X) * 2 * 0x10000 >= (STEPPER_TIMER_RATE), "SHAPING_FREQ_X is below the minimum (20) for AVR 20MHz."); +/** + * Input Shaping requirements + */ +#if HAS_SHAPING + #if ENABLED(DELTA) + #error "Input Shaping is not compatible with DELTA kinematics." + #elif ENABLED(SCARA) + #error "Input Shaping is not compatible with SCARA kinematics." + #elif ENABLED(TPARA) + #error "Input Shaping is not compatible with TPARA kinematics." + #elif ENABLED(POLAR) + #error "Input Shaping is not compatible with POLAR kinematics." + #elif ENABLED(POLARGRAPH) + #error "Input Shaping is not compatible with POLARGRAPH kinematics." + #elif ENABLED(DIRECT_STEPPING) + #error "Input Shaping is not compatible with DIRECT_STEPPING." + #elif BOTH(INPUT_SHAPING_X, CORE_IS_XZ) + #error "INPUT_SHAPING_X is not supported with COREXZ." + #elif BOTH(INPUT_SHAPING_Y, CORE_IS_YZ) + #error "INPUT_SHAPING_Y is not supported with COREYZ." + #elif ANY(CORE_IS_XY, MARKFORGED_XY, MARKFORGED_YX) + #if !BOTH(INPUT_SHAPING_X, INPUT_SHAPING_Y) + #error "INPUT_SHAPING_X and INPUT_SHAPING_Y must both be enabled for COREXY, COREYX, or MARKFORGED_*." #else - static_assert((SHAPING_FREQ_X) == 0 || (SHAPING_FREQ_X) * 2 * 0x10000 >= (STEPPER_TIMER_RATE), "SHAPING_FREQ_X is below the minimum (16) for AVR 16MHz."); + static_assert(SHAPING_FREQ_X == SHAPING_FREQ_Y, "SHAPING_FREQ_X and SHAPING_FREQ_Y must be the same for COREXY / COREYX / MARKFORGED_*."); + static_assert(SHAPING_ZETA_X == SHAPING_ZETA_Y, "SHAPING_ZETA_X and SHAPING_ZETA_Y must be the same for COREXY / COREYX / MARKFORGED_*."); #endif #endif - #if ENABLED(INPUT_SHAPING_Y) - #if F_CPU > 16000000 - static_assert((SHAPING_FREQ_Y) == 0 || (SHAPING_FREQ_Y) * 2 * 0x10000 >= (STEPPER_TIMER_RATE), "SHAPING_FREQ_Y is below the minimum (20) for AVR 20MHz."); + + #ifdef __AVR__ + #ifdef SHAPING_MIN_FREQ + static_assert((SHAPING_MIN_FREQ) > 0, "SHAPING_MIN_FREQ must be > 0."); #else - static_assert((SHAPING_FREQ_Y) == 0 || (SHAPING_FREQ_Y) * 2 * 0x10000 >= (STEPPER_TIMER_RATE), "SHAPING_FREQ_Y is below the minimum (16) for AVR 16MHz."); + TERN_(INPUT_SHAPING_X, static_assert((SHAPING_FREQ_X) > 0, "SHAPING_FREQ_X must be > 0 or SHAPING_MIN_FREQ must be set.")); + TERN_(INPUT_SHAPING_Y, static_assert((SHAPING_FREQ_Y) > 0, "SHAPING_FREQ_Y must be > 0 or SHAPING_MIN_FREQ must be set.")); + #endif + #if ENABLED(INPUT_SHAPING_X) + #if F_CPU > 16000000 + static_assert((SHAPING_FREQ_X) == 0 || (SHAPING_FREQ_X) * 2 * 0x10000 >= (STEPPER_TIMER_RATE), "SHAPING_FREQ_X is below the minimum (20) for AVR 20MHz."); + #else + static_assert((SHAPING_FREQ_X) == 0 || (SHAPING_FREQ_X) * 2 * 0x10000 >= (STEPPER_TIMER_RATE), "SHAPING_FREQ_X is below the minimum (16) for AVR 16MHz."); + #endif + #endif + #if ENABLED(INPUT_SHAPING_Y) + #if F_CPU > 16000000 + static_assert((SHAPING_FREQ_Y) == 0 || (SHAPING_FREQ_Y) * 2 * 0x10000 >= (STEPPER_TIMER_RATE), "SHAPING_FREQ_Y is below the minimum (20) for AVR 20MHz."); + #else + static_assert((SHAPING_FREQ_Y) == 0 || (SHAPING_FREQ_Y) * 2 * 0x10000 >= (STEPPER_TIMER_RATE), "SHAPING_FREQ_Y is below the minimum (16) for AVR 16MHz."); + #endif #endif #endif #endif -#if BOTH(HAS_SHAPING, DIRECT_STEPPING) - #error "INPUT_SHAPING_[XY] cannot currently be used with DIRECT_STEPPING." -#endif - // Misc. Cleanup #undef _TEST_PWM #undef _NUM_AXES_STR diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 97b10122d655..83b051753439 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2023-01-09" + #define STRING_DISTRIBUTION_DATE "2023-02-03" #endif /** @@ -52,7 +52,7 @@ * to alert users to major changes. */ -#define MARLIN_HEX_VERSION 02010200 +#define MARLIN_HEX_VERSION 02010300 #ifndef REQUIRED_CONFIGURATION_H_VERSION #define REQUIRED_CONFIGURATION_H_VERSION MARLIN_HEX_VERSION #endif diff --git a/Marlin/src/inc/Warnings.cpp b/Marlin/src/inc/Warnings.cpp index 24f4d7fbe9f3..1d1426936f95 100644 --- a/Marlin/src/inc/Warnings.cpp +++ b/Marlin/src/inc/Warnings.cpp @@ -783,3 +783,17 @@ #if ENABLED(BD_SENSOR) && DISABLED(BABYSTEPPING) #warning "BABYSTEPPING is recommended with BD_SENSOR." #endif + +/** + * POLAR warnings + */ +#if BOTH(POLAR, S_CURVE_ACCELERATION) + #warning "POLAR kinematics may not work well with S_CURVE_ACCELERATION." +#endif + +/** + * Input Shaping + */ +#if HAS_SHAPING && ANY(CORE_IS_XY, MARKFORGED_XY, MARKFORGED_YX) + #warning "Input Shaping for CORE / MARKFORGED kinematic axes is still experimental." +#endif diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp index cba58f5c02f9..8bdba4234282 100644 --- a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp +++ b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp @@ -444,9 +444,12 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const } // Prepare strings for progress display -#if HAS_PRINT_PROGRESS +#if EITHER(HAS_EXTRA_PROGRESS, HAS_PRINT_PROGRESS) static MarlinUI::progress_t progress = 0; static char bufferc[13]; +#endif + +#if HAS_EXTRA_PROGRESS static void prepare_time_string(const duration_t &time, char prefix) { char str[13]; @@ -484,7 +487,8 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const if (printJobOngoing()) prepare_time_string(print_job_timer.duration(), 'E'); } #endif -#endif // HAS_PRINT_PROGRESS + +#endif // HAS_EXTRA_PROGRESS /** * Draw the Status Screen for a 128x64 DOGM (U8glib) display. diff --git a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp index 9ed0d8a9d674..3d1594aca2c0 100644 --- a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp +++ b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp @@ -705,7 +705,7 @@ bool ST7920_Lite_Status_Screen::indicators_changed() { void ST7920_Lite_Status_Screen::drawRemain() { const duration_t remaint = TERN0(SET_REMAINING_TIME, ui.get_remaining_time()); if (printJobOngoing() && remaint.value) { - draw_progress_string( PPOS, prepare_time_string(remaint, 'R')); + draw_progress_string(PPOS, prepare_time_string(remaint, 'R')); } } #endif @@ -714,7 +714,7 @@ bool ST7920_Lite_Status_Screen::indicators_changed() { void ST7920_Lite_Status_Screen::drawInter() { const duration_t interactt = ui.interaction_time; if (printingIsActive() && interactt.value) { - draw_progress_string( PPOS, prepare_time_string(interactt, 'C')); + draw_progress_string(PPOS, prepare_time_string(interactt, 'C')); } } #endif @@ -723,7 +723,7 @@ bool ST7920_Lite_Status_Screen::indicators_changed() { void ST7920_Lite_Status_Screen::drawElapsed() { if (printJobOngoing()) { const duration_t elapsedt = print_job_timer.duration(); - draw_progress_string( PPOS, prepare_time_string(elapsedt, 'E')); + draw_progress_string(PPOS, prepare_time_string(elapsedt, 'E')); } } #endif diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 0f78e58ef5d7..8894150c9885 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -4663,7 +4663,7 @@ void CrealityDWINClass::Start_Print(bool sd) { if (sd) { #if ENABLED(POWER_LOSS_RECOVERY) if (recovery.valid()) { - SdFile *diveDir = nullptr; + MediaFile *diveDir = nullptr; const char * const fname = card.diveToFile(true, diveDir, recovery.info.sd_filename); card.selectFileByName(fname); } diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index deefbf25734b..c45aae6044de 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -31,37 +31,6 @@ #if ENABLED(DWIN_LCD_PROUI) -#if DISABLED(LIMITED_MAX_FR_EDITING) - #warning "LIMITED_MAX_FR_EDITING is recommended with ProUI." -#endif -#if DISABLED(LIMITED_MAX_ACCEL_EDITING) - #warning "LIMITED_MAX_ACCEL_EDITING is recommended with ProUI." -#endif -#if ENABLED(CLASSIC_JERK) && DISABLED(LIMITED_JERK_EDITING) - #warning "LIMITED_JERK_EDITING is recommended with ProUI." -#endif -#if DISABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU) - #warning "INDIVIDUAL_AXIS_HOMING_SUBMENU is recommended with ProUI." -#endif -#if DISABLED(SET_PROGRESS_MANUALLY) - #warning "SET_PROGRESS_MANUALLY is recommended with ProUI." -#endif -#if DISABLED(STATUS_MESSAGE_SCROLLING) - #warning "STATUS_MESSAGE_SCROLLING is recommended with ProUI." -#endif -#if DISABLED(BAUD_RATE_GCODE) - #warning "BAUD_RATE_GCODE is recommended with ProUI." -#endif -#if DISABLED(SOUND_MENU_ITEM) - #warning "SOUND_MENU_ITEM is recommended with ProUI." -#endif -#if DISABLED(PRINTCOUNTER) - #warning "PRINTCOUNTER is recommended with ProUI." -#endif -#if HAS_MESH && DISABLED(MESH_EDIT_MENU) - #warning "MESH_EDIT_MENU is recommended with ProUI." -#endif - #include "../../fontutils.h" #include "../../marlinui.h" @@ -109,14 +78,8 @@ #include "../../../feature/bltouch.h" #endif -#if EITHER(BABYSTEPPING, HAS_BED_PROBE) - #define HAS_ZOFFSET_ITEM 1 - #if ENABLED(BABYSTEPPING) - #include "../../../feature/babystep.h" - #if !HAS_BED_PROBE - #define JUST_BABYSTEP 1 - #endif - #endif +#if ENABLED(BABYSTEPPING) + #include "../../../feature/babystep.h" #endif #if ENABLED(POWER_LOSS_RECOVERY) @@ -148,7 +111,7 @@ #include "endstop_diag.h" #endif -#if HAS_PIDPLOT +#if SHOW_TUNING_GRAPH #include "plot.h" #endif @@ -197,8 +160,8 @@ #define DWIN_UPDATE_INTERVAL 1024 #define DWIN_REMAIN_TIME_UPDATE_INTERVAL SEC_TO_MS(20) -#if HAS_MESH - #define BABY_Z_VAR TERN(HAS_BED_PROBE, probe.offset.z, HMI_data.ManualZOffset) +#if HAS_MESH && HAS_BED_PROBE + #define BABY_Z_VAR probe.offset.z #else float z_offset = 0; #define BABY_Z_VAR z_offset @@ -303,6 +266,9 @@ MenuClass *MaxAccelMenu = nullptr; MenuClass *MaxJerkMenu = nullptr; #endif MenuClass *StepsMenu = nullptr; +#if ENABLED(MPCTEMP) + MenuClass *HotendMPCMenu = nullptr; +#endif #if ENABLED(PIDTEMP) MenuClass *HotendPIDMenu = nullptr; #endif @@ -556,10 +522,10 @@ void DWIN_DrawStatusMessage() { // If the string fits the status line do not scroll it if (slen <= LCD_WIDTH) { - if (hash_changed) { - DWIN_DrawStatusLine(ui.status_message); - hash_changed = false; - } + if (hash_changed) { + DWIN_DrawStatusLine(ui.status_message); + hash_changed = false; + } } else { // String is larger than the available line space @@ -682,14 +648,18 @@ void Draw_PrintDone() { Title.ShowCaption(GET_TEXT_F(MSG_PRINT_DONE)); DWINUI::ClearMainArea(); DWIN_Print_Header(nullptr); + #if HAS_GCODE_PREVIEW - if (Preview_Valid()) { + const bool isvalid = Preview_Valid(); + if (isvalid) { DWIN_ICON_Show(0, 0, 1, 21, 100, 0x00); DWINUI::Draw_Button(BTN_Continue, 86, 300); } - else + #else + constexpr bool isvalid = false; #endif - { + + if (!isvalid) { Draw_Print_ProgressBar(); Draw_Print_Labels(); DWINUI::Draw_Icon(ICON_PrintTime, 15, 173); @@ -737,11 +707,7 @@ void _update_axis_value(const AxisEnum axis, const uint16_t x, const uint16_t y, // Check for a position change static xyz_pos_t oldpos = { -1, -1, -1 }; - #if ENABLED(SHOW_REAL_POS) - const float p = stepper.position(axis) / planner.settings.axis_steps_per_mm[axis]; - #else - const float p = current_position[axis]; - #endif + const float p = TERN(SHOW_REAL_POS, stepper.position(axis) / planner.settings.axis_steps_per_mm[axis], current_position[axis]); const bool changed = oldpos[axis] != p; if (changed) oldpos[axis] = p; @@ -817,15 +783,9 @@ void update_variable() { if (IsMenu(TuneMenu) || IsMenu(TemperatureMenu)) { // Tune page temperature update - #if HAS_HOTEND - if (_new_hotend_target) HotendTargetItem->redraw(); - #endif - #if HAS_HEATED_BED - if (_new_bed_target) BedTargetItem->redraw(); - #endif - #if HAS_FAN - if (_new_fanspeed) FanSpeedItem->redraw(); - #endif + TERN_(HAS_HOTEND, if (_new_hotend_target) HotendTargetItem->redraw()); + TERN_(HAS_HEATED_BED, if (_new_bed_target) BedTargetItem->redraw()); + TERN_(HAS_FAN, if (_new_fanspeed) FanSpeedItem->redraw()); } // Bottom temperature update @@ -880,7 +840,7 @@ void update_variable() { bool DWIN_lcd_sd_status = false; void SetMediaAutoMount() { - Toogle_Chkb_Line(HMI_data.MediaAutoMount); + Toggle_Chkb_Line(HMI_data.MediaAutoMount); } inline uint16_t nr_sd_menu_items() { @@ -962,8 +922,7 @@ void onClickSDItem() { void FileMenuIdle(bool reset=false) { static bool hasUpDir = false; static uint8_t last_itemselected = 0; - static int8_t shift_amt = 0; - static int8_t shift_len = 0; + static int8_t shift_amt = 0, shift_len = 0; if (reset) { last_itemselected = 0; hasUpDir = !card.flag.workDirIsRoot; // is a SubDir @@ -1288,8 +1247,8 @@ void EachMomentUpdate() { #if HAS_ESDIAG if (checkkey == ESDiagProcess) ESDiag.Update(); #endif - #if HAS_PIDPLOT - if (checkkey == PidProcess) Plot.Update((HMI_value.pidresult == PIDTEMP_START) ? thermalManager.wholeDegHotend(0) : thermalManager.wholeDegBed()); + #if SHOW_TUNING_GRAPH + if (checkkey == PidProcess) plot.Update((HMI_value.pidresult == PIDTEMP_START) ? thermalManager.wholeDegHotend(0) : thermalManager.wholeDegBed()); #endif } @@ -1388,7 +1347,7 @@ void EachMomentUpdate() { DWINUI::Draw_Button(BTN_Cancel, 26, 280); DWINUI::Draw_Button(BTN_Continue, 146, 280); } - SdFile *dir = nullptr; + MediaFile *dir = nullptr; const char * const filename = card.diveToFile(true, dir, recovery.info.sd_filename); card.selectFileByName(filename); DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 207, card.longest_filename()); @@ -1473,10 +1432,6 @@ void DWIN_HomingStart() { void DWIN_HomingDone() { HMI_flag.home_flag = false; - #if DISABLED(HAS_BED_PROBE) && EITHER(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP) - planner.synchronize(); - babystep.add_mm(Z_AXIS, HMI_data.ManualZOffset); - #endif HMI_ReturnScreen(); } @@ -1515,81 +1470,161 @@ void DWIN_LevelingDone() { } #endif -// PID process +// PID/MPC process -#if HAS_PIDPLOT - void DWIN_Draw_PIDPopup() { - frame_rect_t gfrm = {40, 180, DWIN_WIDTH - 80, 120}; +#if SHOW_TUNING_GRAPH + + #include "plot.h" + + celsius_t _maxtemp, _target; + void DWIN_Draw_PID_MPC_Popup() { + constexpr frame_rect_t gfrm = { 40, 180, DWIN_WIDTH - 80, 120 }; DWINUI::ClearMainArea(); Draw_Popup_Bkgd(); - DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 100, GET_TEXT_F(MSG_PID_AUTOTUNE)); - DWINUI::Draw_String(HMI_data.PopupTxt_Color, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("PID target: Celsius")); - switch (HMI_value.pidresult) { - #if ENABLED(PIDTEMP) + + #if ENABLED(MPCTEMP) + + switch (HMI_value.pidresult) { + case MPCTEMP_START: + _maxtemp = thermalManager.hotend_maxtemp[0]; + _target = 200; + DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 100, GET_TEXT_F(MSG_MPC_AUTOTUNE)); + DWINUI::Draw_String(HMI_data.PopupTxt_Color, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("MPC target: Celsius")); + DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 120, F("for Nozzle is running.")); + break; + case PIDTEMPBED_START: + _maxtemp = BED_MAXTEMP; + _target = HMI_data.BedPidT; + DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 100, GET_TEXT_F(MSG_PID_AUTOTUNE)); + DWINUI::Draw_String(HMI_data.PopupTxt_Color, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("PID target: Celsius")); + DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 120, F("for BED is running.")); + break; + default: return; + } + + #else // PID + + DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 100, GET_TEXT_F(MSG_PID_AUTOTUNE)); + DWINUI::Draw_String(HMI_data.PopupTxt_Color, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("PID target: Celsius")); + + switch (HMI_value.pidresult) { case PIDTEMP_START: + _maxtemp = thermalManager.hotend_maxtemp[0]; + _target = HMI_data.HotendPidT; DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 120, F("for Nozzle is running.")); - Plot.Draw(gfrm, thermalManager.hotend_maxtemp[0], HMI_data.HotendPidT); - DWINUI::Draw_Int(HMI_data.PopupTxt_Color, 3, gfrm.x + 90, gfrm.y - DWINUI::fontHeight() - 4, HMI_data.HotendPidT); break; - #endif - #if ENABLED(PIDTEMPBED) case PIDTEMPBED_START: + _maxtemp = BED_MAXTEMP; + _target = HMI_data.BedPidT; DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 120, F("for BED is running.")); - Plot.Draw(gfrm, BED_MAXTEMP, HMI_data.BedPidT); - DWINUI::Draw_Int(HMI_data.PopupTxt_Color, 3, gfrm.x + 90, gfrm.y - DWINUI::fontHeight() - 4, HMI_data.BedPidT); break; - #endif - default: break; - } + default: return; + } + + #endif // PID + + plot.Draw(gfrm, _maxtemp, _target); + DWINUI::Draw_Int(HMI_data.PopupTxt_Color, 3, gfrm.x + 90, gfrm.y - DWINUI::fontHeight() - 4, _target); } -#endif -#if EITHER(PIDTEMP, PIDTEMPBED) +#endif // SHOW_TUNING_GRAPH + +#if DWIN_PID_TUNE + + void DWIN_StartM303(const bool seenC, const int c, const bool seenS, const heater_id_t hid, const celsius_t temp) { + if (seenC) HMI_data.PidCycles = c; + if (seenS) { + switch (hid) { + OPTCODE(PIDTEMP, case 0 ... HOTENDS - 1: HMI_data.HotendPidT = temp; break) + OPTCODE(PIDTEMPBED, case H_BED: HMI_data.BedPidT = temp; break) + default: break; + } + } + } - void DWIN_PidTuning(pidresult_t result) { + void DWIN_PidTuning(tempcontrol_t result) { HMI_value.pidresult = result; switch (result) { #if ENABLED(PIDTEMP) case PIDTEMP_START: HMI_SaveProcessID(PidProcess); - #if HAS_PIDPLOT - DWIN_Draw_PIDPopup(); + #if SHOW_TUNING_GRAPH + DWIN_Draw_PID_MPC_Popup(); #else DWIN_Draw_Popup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), F("for Nozzle is running.")); #endif break; - case PID_BAD_EXTRUDER_NUM: + case PID_TEMP_TOO_HIGH: checkkey = last_checkkey; - DWIN_Popup_Confirm(ICON_TempTooLow, GET_TEXT_F(MSG_PID_AUTOTUNE_FAILED), GET_TEXT_F(MSG_BAD_EXTRUDER_NUM)); + DWIN_Popup_Confirm(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE_FAILED), GET_TEXT_F(MSG_TEMP_TOO_HIGH)); break; #endif #if ENABLED(PIDTEMPBED) case PIDTEMPBED_START: HMI_SaveProcessID(PidProcess); - #if HAS_PIDPLOT - DWIN_Draw_PIDPopup(); + #if SHOW_TUNING_GRAPH + DWIN_Draw_PID_MPC_Popup(); #else DWIN_Draw_Popup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), F("for BED is running.")); #endif break; #endif - case PID_TUNING_TIMEOUT: + case PID_BAD_HEATER_ID: checkkey = last_checkkey; - DWIN_Popup_Confirm(ICON_TempTooHigh, GET_TEXT_F(MSG_ERROR), GET_TEXT_F(MSG_PID_TIMEOUT)); + DWIN_Popup_Confirm(ICON_TempTooLow, GET_TEXT_F(MSG_PID_AUTOTUNE_FAILED), GET_TEXT_F(MSG_PID_BAD_HEATER_ID)); break; - case PID_TEMP_TOO_HIGH: + case PID_TUNING_TIMEOUT: checkkey = last_checkkey; - DWIN_Popup_Confirm(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE_FAILED), GET_TEXT_F(MSG_TEMP_TOO_HIGH)); + DWIN_Popup_Confirm(ICON_TempTooHigh, GET_TEXT_F(MSG_ERROR), GET_TEXT_F(MSG_PID_TIMEOUT)); break; case PID_DONE: checkkey = last_checkkey; DWIN_Popup_Confirm(ICON_TempTooLow, GET_TEXT_F(MSG_PID_AUTOTUNE), GET_TEXT_F(MSG_BUTTON_DONE)); break; - default: checkkey = last_checkkey; break; + default: + checkkey = last_checkkey; + break; } } -#endif // PIDTEMP || PIDTEMPBED +#endif // DWIN_PID_TUNE + +#if ENABLED(MPCTEMP) + + void DWIN_MPCTuning(tempcontrol_t result) { + HMI_value.pidresult = result; + switch (result) { + case MPCTEMP_START: + HMI_SaveProcessID(MPCProcess); + #if SHOW_TUNING_GRAPH + DWIN_Draw_PID_MPC_Popup(); + #else + DWIN_Draw_Popup(ICON_TempTooHigh, GET_TEXT_F(MSG_MPC_AUTOTUNE), F("for Nozzle is running.")); + #endif + break; + case MPC_TEMP_ERROR: + checkkey = last_checkkey; + DWIN_Popup_Confirm(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE_FAILED), F(STR_MPC_TEMPERATURE_ERROR)); + ui.reset_alert_level(); + break; + case MPC_INTERRUPTED: + checkkey = last_checkkey; + DWIN_Popup_Confirm(ICON_TempTooHigh, GET_TEXT_F(MSG_ERROR), F(STR_MPC_AUTOTUNE STR_MPC_AUTOTUNE_INTERRUPTED)); + ui.reset_alert_level(); + break; + case MPC_DONE: + checkkey = last_checkkey; + DWIN_Popup_Confirm(ICON_TempTooLow, GET_TEXT_F(MSG_MPC_AUTOTUNE), GET_TEXT_F(MSG_BUTTON_DONE)); + ui.reset_alert_level(); + break; + default: + checkkey = last_checkkey; + ui.reset_alert_level(); + break; + } + } + +#endif // MPCTEMP // Started a Print Job void DWIN_Print_Started() { @@ -1684,7 +1719,7 @@ void DWIN_SetDataDefaults() { DWINUI::SetColors(HMI_data.Text_Color, HMI_data.Background_Color, HMI_data.StatusBg_Color); TERN_(PIDTEMP, HMI_data.HotendPidT = DEF_HOTENDPIDT); TERN_(PIDTEMPBED, HMI_data.BedPidT = DEF_BEDPIDT); - TERN_(HAS_PID_HEATING, HMI_data.PidCycles = DEF_PIDCYCLES); + TERN_(DWIN_PID_TUNE, HMI_data.PidCycles = DEF_PIDCYCLES); #if ENABLED(PREVENT_COLD_EXTRUSION) HMI_data.ExtMinT = EXTRUDE_MINTEMP; ApplyExtMinT(); @@ -1696,7 +1731,6 @@ void DWIN_SetDataDefaults() { #if BOTH(INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) HMI_data.z_after_homing = DEF_Z_AFTER_HOMING; #endif - IF_DISABLED(HAS_BED_PROBE, HMI_data.ManualZOffset = 0); #if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS) TERN_(LED_COLOR_PRESETS, leds.set_default()); ApplyLEDColor(); @@ -1726,7 +1760,6 @@ void DWIN_CopySettingsFrom(const char * const buff) { ); leds.update(); #endif - } // Initialize or re-initialize the LCD @@ -1850,6 +1883,7 @@ void DWIN_RedrawScreen() { #endif // ADVANCED_PAUSE_FEATURE #if HAS_MESH + void DWIN_MeshViewer() { if (!leveling_is_valid()) DWIN_Popup_Continue(ICON_BLTouch, GET_TEXT_F(MSG_MESH_VIEWER), GET_TEXT_F(MSG_NO_VALID_MESH)); @@ -1858,8 +1892,8 @@ void DWIN_RedrawScreen() { MeshViewer.Draw(); } } -#endif // HAS_MESH +#endif // HAS_MESH #if HAS_LOCKSCREEN @@ -1885,7 +1919,7 @@ void DWIN_RedrawScreen() { if (lockScreen.isUnlocked()) DWIN_UnLockScreen(); } -#endif // HAS_LOCKSCREEN +#endif // HAS_LOCKSCREEN #if HAS_GCODE_PREVIEW @@ -1897,20 +1931,21 @@ void DWIN_RedrawScreen() { Goto_Main_Menu(); return card.openAndPrintFile(card.filename); } - else HMI_ReturnScreen(); + else + HMI_ReturnScreen(); } - void Goto_ConfirmToPrint() { - Goto_Popup(Preview_DrawFromSD, onClick_ConfirmToPrint); - } +#endif -#else - void Goto_ConfirmToPrint() { +void Goto_ConfirmToPrint() { + #if HAS_GCODE_PREVIEW + Goto_Popup(Preview_DrawFromSD, onClick_ConfirmToPrint); + #else // Print SD file HMI_flag.heat_flag = true; card.openAndPrintFile(card.filename); - } -#endif + #endif +} #if HAS_ESDIAG void Draw_EndStopDiag() { @@ -1926,6 +1961,7 @@ void DWIN_RedrawScreen() { // Tool functions #if ENABLED(EEPROM_SETTINGS) + void WriteEeprom() { DWIN_DrawStatusLine(GET_TEXT_F(MSG_STORE_EEPROM)); DWIN_UpdateLCD(); @@ -1945,8 +1981,9 @@ void DWIN_RedrawScreen() { } #if HAS_MESH - void SaveMesh() { TERN(AUTO_BED_LEVELING_UBL, UBLSaveMesh(), WriteEeprom()); } + void SaveMesh() { TERN(AUTO_BED_LEVELING_UBL, UBLMeshSave(), WriteEeprom()); } #endif + #endif // Reset Printer @@ -2047,7 +2084,7 @@ void SetLanguage() { } bool EnableLiveMove = false; -void SetLiveMove() { Toogle_Chkb_Line(EnableLiveMove); } +void SetLiveMove() { Toggle_Chkb_Line(EnableLiveMove); } void LiveMove() { planner.synchronize(); if (!EnableLiveMove) return; @@ -2072,7 +2109,7 @@ void SetMoveZ() { HMI_value.axis = Z_AXIS; SetPFloatOnClick(Z_MIN_POS, Z_MAX_POS } #endif -#if EITHER(PIDTEMP, PIDTEMPBED) +#if DWIN_PID_TUNE void SetPID(celsius_t t, heater_id_t h) { char cmd[53] = ""; char str_1[5] = "", str_2[5] = ""; @@ -2093,7 +2130,7 @@ void SetMoveZ() { HMI_value.axis = Z_AXIS; SetPFloatOnClick(Z_MIN_POS, Z_MAX_POS #if ENABLED(POWER_LOSS_RECOVERY) void SetPwrLossr() { - Toogle_Chkb_Line(recovery.enabled); + Toggle_Chkb_Line(recovery.enabled); recovery.changed(); } #endif @@ -2119,7 +2156,7 @@ void SetMoveZ() { HMI_value.axis = Z_AXIS; SetPFloatOnClick(Z_MIN_POS, Z_MAX_POS #if ENABLED(CASE_LIGHT_MENU) void SetCaseLight() { - Toogle_Chkb_Line(caselight.on); + Toggle_Chkb_Line(caselight.on); caselight.update_enabled(); } #if ENABLED(CASELIGHT_USES_BRIGHTNESS) @@ -2155,7 +2192,7 @@ void SetMoveZ() { HMI_value.axis = Z_AXIS; SetPFloatOnClick(Z_MIN_POS, Z_MAX_POS #if ENABLED(SOUND_MENU_ITEM) void SetEnableSound() { - Toogle_Chkb_Line(ui.sound_on); + Toggle_Chkb_Line(ui.sound_on); } #endif @@ -2179,7 +2216,7 @@ void SetMoveZ() { HMI_value.axis = Z_AXIS; SetPFloatOnClick(Z_MIN_POS, Z_MAX_POS #if ENABLED(BLTOUCH_HS_MODE) void SetHSMode() { - Toogle_Chkb_Line(bltouch.high_speed_mode); + Toggle_Chkb_Line(bltouch.high_speed_mode); } #endif @@ -2188,7 +2225,7 @@ void SetMoveZ() { HMI_value.axis = Z_AXIS; SetPFloatOnClick(Z_MIN_POS, Z_MAX_POS #if HAS_FILAMENT_SENSOR void SetRunoutEnable() { runout.reset(); - Toogle_Chkb_Line(runout.enabled); + Toggle_Chkb_Line(runout.enabled); } #if HAS_FILAMENT_RUNOUT_DISTANCE void ApplyRunoutDistance() { runout.set_runout_distance(MenuData.Value / MINUNITMULT); } @@ -2415,9 +2452,9 @@ void TramC () { Tram(4); } MeshViewer.DrawMesh(zval, 2, 2); ui.reset_status(); - if (ABS(MeshViewer.max - MeshViewer.min) < 0.05) { - DWINUI::Draw_CenteredString(140,F("Corners leveled")); - DWINUI::Draw_CenteredString(160,F("Tolerance achieved!")); + if (ABS(MeshViewer.max - MeshViewer.min) < 0.05f) { + DWINUI::Draw_CenteredString(140, F("Corners leveled")); + DWINUI::Draw_CenteredString(160, F("Tolerance achieved!")); } else { uint8_t p = 0; @@ -2450,7 +2487,7 @@ void TramC () { Tram(4); } } void SetManualTramming() { - Toogle_Chkb_Line(HMI_data.FullManualTramming); + Toggle_Chkb_Line(HMI_data.FullManualTramming); } #endif // HAS_BED_PROBE && HAS_MESH @@ -2538,7 +2575,7 @@ void SetStepsZ() { HMI_value.axis = Z_AXIS, SetPFloatOnClick( MIN_STEP, MAX_STEP void SetBedPidT() { SetPIntOnClick(MIN_BEDTEMP, MAX_BEDTEMP); } #endif -#if EITHER(PIDTEMP, PIDTEMPBED) +#if DWIN_PID_TUNE void SetPidCycles() { SetPIntOnClick(3, 50); } void SetKp() { SetPFloatOnClick(0, 1000, 2); } void ApplyPIDi() { @@ -2709,8 +2746,7 @@ void onDrawGetColorItem(MenuItemClass* menuitem, int8_t line) { DWIN_Draw_HLine(HMI_data.SplitLine_Color, 16, MYPOS(line + 1), 240); } - -#if EITHER(PIDTEMP, PIDTEMPBED) +#if DWIN_PID_TUNE void onDrawPIDi(MenuItemClass* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, unscalePID_i(*(float*)static_cast(menuitem)->value)); } void onDrawPIDd(MenuItemClass* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, unscalePID_d(*(float*)static_cast(menuitem)->value)); } #endif @@ -2902,6 +2938,7 @@ void onDrawMaxAccelZ(MenuItemClass* menuitem, int8_t line) { } #if HAS_HOTEND + void onDrawMaxJerkE(MenuItemClass* menuitem, int8_t line) { if (HMI_IsChinese()) { menuitem->SetFrame(1, 173, 133, 200, 147); @@ -2911,6 +2948,7 @@ void onDrawMaxAccelZ(MenuItemClass* menuitem, int8_t line) { } onDrawPFloatMenu(menuitem, line); } + #endif #endif // HAS_CLASSIC_JERK @@ -2940,6 +2978,7 @@ void onDrawStepsZ(MenuItemClass* menuitem, int8_t line) { } #if HAS_HOTEND + void onDrawStepsE(MenuItemClass* menuitem, int8_t line) { if (HMI_IsChinese()) { menuitem->SetFrame(1, 153, 148, 194, 161); @@ -2947,6 +2986,7 @@ void onDrawStepsZ(MenuItemClass* menuitem, int8_t line) { } onDrawPFloatMenu(menuitem, line); } + #endif #if HAS_ONESTEP_LEVELING @@ -3051,7 +3091,7 @@ void Draw_Control_Menu() { void Draw_AdvancedSettings_Menu() { checkkey = Menu; - if (SET_MENU(AdvancedSettings, MSG_ADVANCED_SETTINGS, 18)) { + if (SET_MENU(AdvancedSettings, MSG_ADVANCED_SETTINGS, 19)) { BACK_ITEM(Goto_Main_Menu); #if ENABLED(EEPROM_SETTINGS) MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawMenuItem, WriteEeprom); @@ -3066,6 +3106,9 @@ void Draw_AdvancedSettings_Menu() { #if ENABLED(PIDTEMP) MENU_ITEM_F(ICON_PIDNozzle, STR_HOTEND_PID " Settings", onDrawSubMenu, Draw_HotendPID_Menu); #endif + #if ENABLED(MPCTEMP) + MENU_ITEM_F(ICON_MPCNozzle, STR_MPC_AUTOTUNE " Settings", onDrawSubMenu, Draw_HotendMPC_Menu); + #endif #if ENABLED(PIDTEMPBED) MENU_ITEM_F(ICON_PIDBed, STR_BED_PID " Settings", onDrawSubMenu, Draw_BedPID_Menu); #endif @@ -3117,6 +3160,7 @@ void Draw_Move_Menu() { } #if HAS_HOME_OFFSET + void Draw_HomeOffset_Menu() { checkkey = Menu; if (SET_MENU(HomeOffMenu, MSG_SET_HOME_OFFSETS, 4)) { @@ -3127,9 +3171,11 @@ void Draw_Move_Menu() { } UpdateMenu(HomeOffMenu); } + #endif #if HAS_BED_PROBE + void Draw_ProbeSet_Menu() { checkkey = Menu; if (SET_MENU(ProbeSetMenu, MSG_ZPROBE_SETTINGS, 9)) { @@ -3149,6 +3195,7 @@ void Draw_Move_Menu() { } UpdateMenu(ProbeSetMenu); } + #endif void Draw_FilSet_Menu() { @@ -3216,6 +3263,7 @@ void Draw_GetColor_Menu() { } #if BOTH(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS) + void Draw_CaseLight_Menu() { checkkey = Menu; if (SET_MENU(CaseLightMenu, MSG_CASE_LIGHT, 3)) { @@ -3225,9 +3273,11 @@ void Draw_GetColor_Menu() { } UpdateMenu(CaseLightMenu); } + #endif #if ENABLED(LED_CONTROL_MENU) + void Draw_LedControl_Menu() { checkkey = Menu; if (SET_MENU(LedControlMenu, MSG_LED_CONTROL, 10)) { @@ -3257,7 +3307,8 @@ void Draw_GetColor_Menu() { } UpdateMenu(LedControlMenu); } -#endif + +#endif // LED_CONTROL_MENU void Draw_Tune_Menu() { checkkey = Menu; @@ -3320,6 +3371,7 @@ void Draw_Motion_Menu() { } #if ENABLED(ADVANCED_PAUSE_FEATURE) + void Draw_FilamentMan_Menu() { checkkey = Menu; if (SET_MENU(FilamentMenu, MSG_FILAMENT_MAN, 5)) { @@ -3335,9 +3387,11 @@ void Draw_Motion_Menu() { } UpdateMenu(FilamentMenu); } + #endif #if ENABLED(MESH_BED_LEVELING) + void Draw_ManualMesh_Menu() { checkkey = Menu; if (SET_MENU(ManualMesh, MSG_UBL_MANUAL_MESH, 6)) { @@ -3350,7 +3404,8 @@ void Draw_Motion_Menu() { } UpdateMenu(ManualMesh); } -#endif + +#endif // MESH_BED_LEVELING #if HAS_PREHEAT @@ -3433,6 +3488,7 @@ void Draw_MaxAccel_Menu() { } #if HAS_CLASSIC_JERK + void Draw_MaxJerk_Menu() { checkkey = Menu; if (SET_MENU_R(MaxJerkMenu, selrect({1, 16, 28, 13}), MSG_JERK, 5)) { @@ -3446,7 +3502,8 @@ void Draw_MaxAccel_Menu() { } UpdateMenu(MaxJerkMenu); } -#endif + +#endif // HAS_CLASSIC_JERK void Draw_Steps_Menu() { checkkey = Menu; @@ -3463,6 +3520,7 @@ void Draw_Steps_Menu() { } #if ENABLED(PIDTEMP) + void Draw_HotendPID_Menu() { checkkey = Menu; if (SET_MENU_F(HotendPIDMenu, STR_HOTEND_PID " Settings", 8)) { @@ -3479,9 +3537,43 @@ void Draw_Steps_Menu() { } UpdateMenu(HotendPIDMenu); } + #endif +#if ENABLED(MPCTEMP) + + void HotendMPC() { thermalManager.MPC_autotune(); } + void SetHeaterPower() { SetPFloatOnClick(1, 200, 1); } + void SetBlkHeatCapacity() { SetPFloatOnClick(0, 40, 2); } + void SetSensorRespons() { SetPFloatOnClick(0, 1, 4); } + void SetAmbientXfer() { SetPFloatOnClick(0, 1, 4); } + #if ENABLED(MPC_INCLUDE_FAN) + void onDrawFanAdj(MenuItemClass* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 4, thermalManager.temp_hotend[0].fanCoefficient()); } + void ApplyFanAdj() { thermalManager.temp_hotend[0].applyFanAdjustment(MenuData.Value / POW(10, 4)); } + void SetFanAdj() { SetFloatOnClick(0, 1, 4, thermalManager.temp_hotend[0].fanCoefficient(), ApplyFanAdj); } + #endif + + void Draw_HotendMPC_Menu() { + checkkey = Menu; + if (SET_MENU_F(HotendMPCMenu, STR_MPC_AUTOTUNE " Settings", 7)) { + MPC_t &mpc = thermalManager.temp_hotend[0].mpc; + BACK_ITEM(Draw_AdvancedSettings_Menu); + MENU_ITEM(ICON_MPCNozzle, MSG_MPC_AUTOTUNE, onDrawMenuItem, HotendMPC); + EDIT_ITEM(ICON_MPCHeater, MSG_MPC_POWER, onDrawPFloatMenu, SetHeaterPower, &mpc.heater_power); + EDIT_ITEM(ICON_MPCHeatCap, MSG_MPC_BLOCK_HEAT_CAPACITY, onDrawPFloat2Menu, SetBlkHeatCapacity, &mpc.block_heat_capacity); + EDIT_ITEM(ICON_MPCValue, MSG_SENSOR_RESPONSIVENESS, onDrawPFloat4Menu, SetSensorRespons, &mpc.sensor_responsiveness); + EDIT_ITEM(ICON_MPCValue, MSG_MPC_AMBIENT_XFER_COEFF, onDrawPFloat4Menu, SetAmbientXfer, &mpc.ambient_xfer_coeff_fan0); + #if ENABLED(MPC_INCLUDE_FAN) + EDIT_ITEM(ICON_MPCFan, MSG_MPC_AMBIENT_XFER_COEFF_FAN, onDrawFanAdj, SetFanAdj, &mpc.fan255_adjustment); + #endif + } + UpdateMenu(HotendMPCMenu); + } + +#endif // MPCTEMP + #if ENABLED(PIDTEMPBED) + void Draw_BedPID_Menu() { checkkey = Menu; if (SET_MENU_F(BedPIDMenu, STR_BED_PID " Settings", 8)) { @@ -3498,9 +3590,11 @@ void Draw_Steps_Menu() { } UpdateMenu(BedPIDMenu); } -#endif + +#endif // PIDTEMPBED #if HAS_BED_PROBE + void Draw_ZOffsetWiz_Menu() { checkkey = Menu; if (SET_MENU(ZOffsetWizMenu, MSG_PROBE_WIZARD, 4)) { @@ -3512,9 +3606,11 @@ void Draw_Steps_Menu() { UpdateMenu(ZOffsetWizMenu); if (!axis_is_trusted(Z_AXIS)) LCD_MESSAGE_F("WARNING: Z position unknown, move Z to home"); } + #endif #if ENABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU) + void Draw_Homing_Menu() { checkkey = Menu; if (SET_MENU(HomingMenu, MSG_HOMING, 6)) { @@ -3529,9 +3625,11 @@ void Draw_Steps_Menu() { } UpdateMenu(HomingMenu); } + #endif #if ENABLED(FWRETRACT) + void Draw_FWRetract_Menu() { checkkey = Menu; if (SET_MENU(FWRetractMenu, MSG_FWRETRACT, 6)) { @@ -3544,6 +3642,7 @@ void Draw_Steps_Menu() { } UpdateMenu(FWRetractMenu); } + #endif //============================================================================= @@ -3576,22 +3675,23 @@ void Draw_Steps_Menu() { void SetEditMeshY() { HMI_value.Select = 1; SetIntOnClick(0, GRID_MAX_POINTS_Y - 1, bedLevelTools.mesh_y, ApplyEditMeshY, LiveEditMesh); } void SetEditZValue() { SetPFloatOnClick(Z_OFFSET_MIN, Z_OFFSET_MAX, 3); } #endif -#endif + +#endif // HAS_MESH #if ENABLED(AUTO_BED_LEVELING_UBL) void ApplyUBLSlot() { bedlevel.storage_slot = MenuData.Value; } void SetUBLSlot() { SetIntOnClick(0, settings.calc_num_meshes() - 1, bedlevel.storage_slot, ApplyUBLSlot); } void onDrawUBLSlot(MenuItemClass* menuitem, int8_t line) { - if (bedlevel.storage_slot < 0) bedlevel.storage_slot = 0; + NOLESS(bedlevel.storage_slot, 0); onDrawIntMenu(menuitem, line, bedlevel.storage_slot); } void ApplyUBLTiltGrid() { bedLevelTools.tilt_grid = MenuData.Value; } void SetUBLTiltGrid() { SetIntOnClick(1, 3, bedLevelTools.tilt_grid, ApplyUBLTiltGrid); } - void UBLTiltMesh() { - if (bedlevel.storage_slot < 0) bedlevel.storage_slot = 0; + void UBLMeshTilt() { + NOLESS(bedlevel.storage_slot, 0); char buf[15]; if (bedLevelTools.tilt_grid > 1) { sprintf_P(buf, PSTR("G28O\nG29 J%i"), bedLevelTools.tilt_grid); @@ -3607,15 +3707,15 @@ void Draw_Steps_Menu() { LCD_MESSAGE(MSG_UBL_MESH_FILLED); } - void UBLSaveMesh() { - if (bedlevel.storage_slot < 0) bedlevel.storage_slot = 0; + void UBLMeshSave() { + NOLESS(bedlevel.storage_slot, 0); settings.store_mesh(bedlevel.storage_slot); ui.status_printf(0, GET_TEXT_F(MSG_MESH_SAVED), bedlevel.storage_slot); DONE_BUZZ(true); } - void UBLLoadMesh() { - if (bedlevel.storage_slot < 0) bedlevel.storage_slot = 0; + void UBLMeshLoad() { + NOLESS(bedlevel.storage_slot, 0); settings.load_mesh(bedlevel.storage_slot); } @@ -3637,10 +3737,10 @@ void Draw_Steps_Menu() { #endif #if ENABLED(AUTO_BED_LEVELING_UBL) EDIT_ITEM(ICON_UBLSlot, MSG_UBL_STORAGE_SLOT, onDrawUBLSlot, SetUBLSlot, &bedlevel.storage_slot); - MENU_ITEM(ICON_UBLSaveMesh, MSG_UBL_SAVE_MESH, onDrawMenuItem, UBLSaveMesh); - MENU_ITEM(ICON_UBLLoadMesh, MSG_UBL_LOAD_MESH, onDrawMenuItem, UBLLoadMesh); + MENU_ITEM(ICON_UBLMeshSave, MSG_UBL_SAVE_MESH, onDrawMenuItem, UBLMeshSave); + MENU_ITEM(ICON_UBLMeshLoad, MSG_UBL_LOAD_MESH, onDrawMenuItem, UBLMeshLoad); EDIT_ITEM(ICON_UBLTiltGrid, MSG_UBL_TILTING_GRID, onDrawPInt8Menu, SetUBLTiltGrid, &bedLevelTools.tilt_grid); - MENU_ITEM(ICON_UBLTiltGrid, MSG_UBL_TILT_MESH, onDrawMenuItem, UBLTiltMesh); + MENU_ITEM(ICON_UBLTiltGrid, MSG_UBL_TILT_MESH, onDrawMenuItem, UBLMeshTilt); MENU_ITEM(ICON_UBLSmartFill, MSG_UBL_SMART_FILLIN, onDrawMenuItem, UBLSmartFillMesh); #endif #if ENABLED(MESH_EDIT_MENU) diff --git a/Marlin/src/lcd/e3v2/proui/dwin.h b/Marlin/src/lcd/e3v2/proui/dwin.h index 50be4a8ba5a2..112df5cae144 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.h +++ b/Marlin/src/lcd/e3v2/proui/dwin.h @@ -35,6 +35,13 @@ #include "../common/encoder.h" #include "../../../libs/BL24CXX.h" +#if EITHER(BABYSTEPPING, HAS_BED_PROBE) + #define HAS_ZOFFSET_ITEM 1 + #if !HAS_BED_PROBE + #define JUST_BABYSTEP 1 + #endif +#endif + namespace GET_LANG(LCD_LANGUAGE) { #define _MSG_PREHEAT(N) \ LSTR MSG_PREHEAT_##N = _UxGT("Preheat ") PREHEAT_## N ##_LABEL; \ @@ -63,17 +70,30 @@ enum processID : uint8_t { WaitResponse, Homing, PidProcess, + MPCProcess, NothingToDo }; -enum pidresult_t : uint8_t { - PIDTEMP_START = 0, - PIDTEMPBED_START, - PID_BAD_EXTRUDER_NUM, - PID_TEMP_TOO_HIGH, - PID_TUNING_TIMEOUT, - PID_DONE, -}; +#if EITHER(DWIN_PID_TUNE, MPCTEMP) + + enum tempcontrol_t : uint8_t { + #if DWIN_PID_TUNE + PID_DONE, + PIDTEMP_START, + PIDTEMPBED_START, + PID_BAD_HEATER_ID, + PID_TEMP_TOO_HIGH, + PID_TUNING_TIMEOUT, + #endif + #if ENABLED(MPCTEMP) + MPC_DONE, + MPCTEMP_START, + MPC_TEMP_ERROR, + MPC_INTERRUPTED + #endif + }; + +#endif #define DWIN_CHINESE 123 #define DWIN_ENGLISH 0 @@ -100,14 +120,14 @@ typedef struct { uint16_t Coordinate_Color; // Temperatures - #if ENABLED(PIDTEMP) - int16_t HotendPidT = DEF_HOTENDPIDT; - #endif - #if ENABLED(PIDTEMPBED) - int16_t BedPidT = DEF_BEDPIDT; - #endif - #if (HAS_HOTEND || HAS_HEATED_BED) && HAS_PID_HEATING + #if DWIN_PID_TUNE int16_t PidCycles = DEF_PIDCYCLES; + #if ENABLED(PIDTEMP) + int16_t HotendPidT = DEF_HOTENDPIDT; + #endif + #if ENABLED(PIDTEMPBED) + int16_t BedPidT = DEF_BEDPIDT; + #endif #endif #if ENABLED(PREVENT_COLD_EXTRUSION) int16_t ExtMinT = EXTRUDE_MINTEMP; @@ -118,15 +138,12 @@ typedef struct { #if ENABLED(BAUD_RATE_GCODE) bool Baud115K = false; #endif + bool FullManualTramming = false; bool MediaAutoMount = ENABLED(HAS_SD_EXTENDER); #if BOTH(INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) uint8_t z_after_homing = DEF_Z_AFTER_HOMING; #endif - #if ENABLED(MESH_BED_LEVELING) - float ManualZOffset = 0; - #endif - // Led #if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS) LEDColor Led_Color = Def_Leds_Color; #endif @@ -137,7 +154,9 @@ static constexpr size_t eeprom_data_size = sizeof(HMI_data_t); typedef struct { int8_t Color[3]; // Color components - TERN_(HAS_PID_HEATING, pidresult_t pidresult = PID_DONE); + #if DWIN_PID_TUNE + tempcontrol_t pidresult = PID_DONE; + #endif uint8_t Select = 0; // Auxiliary selector variable AxisEnum axis = X_AXIS; // Axis Select } HMI_value_t; @@ -209,10 +228,10 @@ void ParkHead(); void ApplyLEDColor(); #endif #if ENABLED(AUTO_BED_LEVELING_UBL) - void UBLTiltMesh(); + void UBLMeshTilt(); bool UBLValidMesh(); - void UBLSaveMesh(); - void UBLLoadMesh(); + void UBLMeshSave(); + void UBLMeshLoad(); #endif #if ENABLED(HOST_SHUTDOWN_MENU_ITEM) && defined(SHUTDOWN_ACTION) void HostShutDown(); @@ -352,10 +371,20 @@ void Draw_Steps_Menu(); #endif // PID -void DWIN_PidTuning(pidresult_t result); -#if ENABLED(PIDTEMP) - void Draw_HotendPID_Menu(); +#if DWIN_PID_TUNE + #include "../../../module/temperature.h" + void DWIN_StartM303(const bool seenC, const int c, const bool seenS, const heater_id_t hid, const celsius_t temp); + void DWIN_PidTuning(tempcontrol_t result); + #if ENABLED(PIDTEMP) + void Draw_HotendPID_Menu(); + #endif + #if ENABLED(PIDTEMPBED) + void Draw_BedPID_Menu(); + #endif #endif -#if ENABLED(PIDTEMPBED) - void Draw_BedPID_Menu(); + +// MPC +#if ENABLED(MPCTEMP) + void DWIN_MPCTuning(tempcontrol_t result); + void Draw_HotendMPC_Menu(); #endif diff --git a/Marlin/src/lcd/e3v2/proui/dwin_defines.h b/Marlin/src/lcd/e3v2/proui/dwin_defines.h index de3f40e2814b..e87aedf31179 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_defines.h +++ b/Marlin/src/lcd/e3v2/proui/dwin_defines.h @@ -19,6 +19,8 @@ * along with this program. If not, see . * */ +#pragma once + /** * DWIN general defines and data structs for PRO UI * Author: Miguel A. Risco-Castillo (MRISCOC) @@ -26,8 +28,6 @@ * Date: 2022/08/08 */ -#pragma once - //#define DEBUG_DWIN 1 //#define NEED_HEX_PRINT 1 diff --git a/Marlin/src/lcd/e3v2/proui/dwinui.cpp b/Marlin/src/lcd/e3v2/proui/dwinui.cpp index afb18f24dbc9..f950d7451c45 100644 --- a/Marlin/src/lcd/e3v2/proui/dwinui.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwinui.cpp @@ -281,7 +281,7 @@ void DWINUI::Draw_FillCircle(uint16_t bcolor, uint16_t x,uint16_t y,uint8_t r) { // color2 : End color uint16_t DWINUI::ColorInt(int16_t val, int16_t minv, int16_t maxv, uint16_t color1, uint16_t color2) { uint8_t B, G, R; - const float n = (float)(val - minv) / (maxv - minv); + const float n = float(val - minv) / (maxv - minv); R = (1 - n) * GetRColor(color1) + n * GetRColor(color2); G = (1 - n) * GetGColor(color1) + n * GetGColor(color2); B = (1 - n) * GetBColor(color1) + n * GetBColor(color2); @@ -296,7 +296,7 @@ uint16_t DWINUI::RainbowInt(int16_t val, int16_t minv, int16_t maxv) { uint8_t B, G, R; const uint8_t maxB = 28, maxR = 28, maxG = 38; const int16_t limv = _MAX(abs(minv), abs(maxv)); - float n = minv >= 0 ? (float)(val - minv) / (maxv - minv) : (float)val / limv; + float n = minv >= 0 ? float(val - minv) / (maxv - minv) : (float)val / limv; LIMIT(n, -1, 1); if (n < 0) { R = 0; diff --git a/Marlin/src/lcd/e3v2/proui/dwinui.h b/Marlin/src/lcd/e3v2/proui/dwinui.h index 3dd37f30dfe6..85d969043f02 100644 --- a/Marlin/src/lcd/e3v2/proui/dwinui.h +++ b/Marlin/src/lcd/e3v2/proui/dwinui.h @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ +#pragma once /** * DWIN Enhanced implementation for PRO UI @@ -27,8 +28,6 @@ * Date: 2022/07/05 */ -#pragma once - #include "../../../inc/MarlinConfigPre.h" #include "../common/dwin_set.h" @@ -138,17 +137,22 @@ #define ICON_UBLActive ICON_HotendTemp #define ICON_UBLActive ICON_HotendTemp #define ICON_UBLSlot ICON_ResumeEEPROM -#define ICON_UBLSaveMesh ICON_WriteEEPROM -#define ICON_UBLLoadMesh ICON_ReadEEPROM +#define ICON_UBLMeshSave ICON_WriteEEPROM +#define ICON_UBLMeshLoad ICON_ReadEEPROM #define ICON_UBLTiltGrid ICON_PrintSize #define ICON_UBLSmartFill ICON_StockConfiguration #define ICON_ZAfterHome ICON_SetEndTemp - - #define ICON_CaseLight ICON_Motion #define ICON_LedControl ICON_Motion +// MPC +#define ICON_MPCNozzle ICON_SetEndTemp +#define ICON_MPCValue ICON_Contact +#define ICON_MPCHeater ICON_Temperature +#define ICON_MPCHeatCap ICON_SetBedTemp +#define ICON_MPCFan ICON_FanSpeed + // Buttons #define BTN_Continue 85 #define BTN_Cancel 87 diff --git a/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp b/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp index 6411b669bbc8..bc489dd1fa8f 100644 --- a/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp +++ b/Marlin/src/lcd/e3v2/proui/gcode_preview.cpp @@ -21,25 +21,10 @@ */ /** - * DWIN g-code thumbnail preview + * DWIN G-code thumbnail preview * Author: Miguel A. Risco-Castillo * version: 3.1.2 * Date: 2022/09/03 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - * For commercial applications additional licenses can be requested */ #include "../../../inc/MarlinConfigPre.h" diff --git a/Marlin/src/lcd/e3v2/proui/gcode_preview.h b/Marlin/src/lcd/e3v2/proui/gcode_preview.h index c1949c5abc12..2452797d0c62 100644 --- a/Marlin/src/lcd/e3v2/proui/gcode_preview.h +++ b/Marlin/src/lcd/e3v2/proui/gcode_preview.h @@ -1,12 +1,13 @@ /** - * DWIN g-code thumbnail preview - * Author: Miguel A. Risco-Castillo - * version: 3.1.2 - * Date: 2022/09/03 + * Marlin 3D Printer Firmware + * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the License, or + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, @@ -14,14 +15,19 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public License + * You should have received a copy of the GNU General Public License * along with this program. If not, see . * - * For commercial applications additional licenses can be requested */ - #pragma once +/** + * DWIN G-code thumbnail preview + * Author: Miguel A. Risco-Castillo + * version: 3.1.2 + * Date: 2022/09/03 + */ + void Preview_DrawFromSD(); void Preview_Invalidate(); bool Preview_Valid(); diff --git a/Marlin/src/lcd/e3v2/proui/menus.cpp b/Marlin/src/lcd/e3v2/proui/menus.cpp index 3267eec60d33..dfcfaa7bbc19 100644 --- a/Marlin/src/lcd/e3v2/proui/menus.cpp +++ b/Marlin/src/lcd/e3v2/proui/menus.cpp @@ -25,20 +25,6 @@ * Author: Miguel A. Risco-Castillo * Version: 1.9.1 * Date: 2022/12/02 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * */ #include "../../../inc/MarlinConfigPre.h" @@ -115,7 +101,7 @@ void Show_Chkb_Line(const bool checked) { DWIN_UpdateLCD(); } -void Toogle_Chkb_Line(bool &checked) { +void Toggle_Chkb_Line(bool &checked) { checked = !checked; Show_Chkb_Line(checked); } diff --git a/Marlin/src/lcd/e3v2/proui/menus.h b/Marlin/src/lcd/e3v2/proui/menus.h index 9bc9d702bd30..072bf7584d90 100644 --- a/Marlin/src/lcd/e3v2/proui/menus.h +++ b/Marlin/src/lcd/e3v2/proui/menus.h @@ -19,28 +19,14 @@ * along with this program. If not, see . * */ +#pragma once /** * Menu functions for ProUI * Author: Miguel A. Risco-Castillo * Version: 1.9.1 * Date: 2022/12/02 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * */ -#pragma once #include "dwinui.h" @@ -145,7 +131,7 @@ void Draw_Menu_Line(const uint8_t line, const uint8_t icon=0, const char * const void Draw_Menu_Line(const uint8_t line, const uint8_t icon=0, FSTR_P label=nullptr, bool more=false, bool selected=false); void Draw_Chkb_Line(const uint8_t line, const bool checked); void Show_Chkb_Line(const bool checked); -void Toogle_Chkb_Line(bool &checked); +void Toggle_Chkb_Line(bool &checked); void Draw_Menu_IntValue(uint16_t bcolor, const uint8_t line, uint8_t iNum, const int32_t value=0); void onDrawMenuItem(MenuItemClass* menuitem, int8_t line); void onDrawSubMenu(MenuItemClass* menuitem, int8_t line); diff --git a/Marlin/src/lcd/e3v2/proui/plot.cpp b/Marlin/src/lcd/e3v2/proui/plot.cpp index 75917320a45f..fddaf3963ae1 100644 --- a/Marlin/src/lcd/e3v2/proui/plot.cpp +++ b/Marlin/src/lcd/e3v2/proui/plot.cpp @@ -25,26 +25,11 @@ * Author: Miguel A. Risco-Castillo * Version: 2.1.2 * Date: 2022/11/20 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - * For commercial applications additional licenses can be requested */ -#include "../../../inc/MarlinConfigPre.h" +#include "../../../inc/MarlinConfig.h" -#if BOTH(DWIN_LCD_PROUI, HAS_PIDPLOT) +#if BOTH(DWIN_LCD_PROUI, SHOW_TUNING_GRAPH) #include "plot.h" #include "../../../core/types.h" @@ -55,13 +40,13 @@ #define Plot_Bg_Color RGB( 1, 12, 8) -PlotClass Plot; +PlotClass plot; uint16_t grphpoints, r, x2, y2 = 0; frame_rect_t grphframe = {0}; float scale = 0; -void PlotClass::Draw(const frame_rect_t frame, const float max, const float ref) { +void PlotClass::Draw(const frame_rect_t &frame, const celsius_t max, const_float_t ref/*=0*/) { grphframe = frame; grphpoints = 0; scale = frame.h / max; @@ -74,9 +59,9 @@ void PlotClass::Draw(const frame_rect_t frame, const float max, const float ref) DWIN_Draw_HLine(Color_Red, frame.x, r, frame.w); } -void PlotClass::Update(const float value) { +void PlotClass::Update(const_float_t value) { if (!scale) return; - uint16_t y = round((y2) - value * scale); + const uint16_t y = round((y2) - value * scale); if (grphpoints < grphframe.w) { DWIN_Draw_Point(Color_Yellow, 1, 1, grphpoints + grphframe.x, y); } @@ -89,4 +74,4 @@ void PlotClass::Update(const float value) { grphpoints++; } -#endif // DWIN_LCD_PROUI && HAS_PIDPLOT +#endif // DWIN_LCD_PROUI && SHOW_TUNING_GRAPH diff --git a/Marlin/src/lcd/e3v2/proui/plot.h b/Marlin/src/lcd/e3v2/proui/plot.h index ea15255fe53a..14e7058b0171 100644 --- a/Marlin/src/lcd/e3v2/proui/plot.h +++ b/Marlin/src/lcd/e3v2/proui/plot.h @@ -19,36 +19,21 @@ * along with this program. If not, see . * */ +#pragma once /** * DWIN Single var plot * Author: Miguel A. Risco-Castillo * Version: 2.1.2 * Date: 2022/11/20 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - * - * For commercial applications additional licenses can be requested */ -#pragma once #include "dwinui.h" class PlotClass { public: - void Draw(frame_rect_t frame, float max, float ref = 0); - void Update(float value); + static void Draw(const frame_rect_t &frame, const celsius_t max, const_float_t ref=0); + static void Update(const_float_t value); }; -extern PlotClass Plot; +extern PlotClass plot; diff --git a/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp index 37543a237c0b..82dbeee4112b 100644 --- a/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp @@ -295,11 +295,11 @@ void DGUSScreenHandler::DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var) // Don't let the user in the dark why there is no reaction. if (!ExtUI::isMediaInserted()) { - setstatusmessagePGM(GET_TEXT(MSG_NO_MEDIA)); + setstatusmessage(GET_TEXT_F(MSG_NO_MEDIA)); return; } if (card.flag.abort_sd_printing) { - setstatusmessagePGM(GET_TEXT(MSG_MEDIA_ABORTING)); + setstatusmessage(GET_TEXT_F(MSG_MEDIA_ABORTING)); return; } } diff --git a/Marlin/src/lcd/extui/dgus/DGUSScreenHandlerBase.h b/Marlin/src/lcd/extui/dgus/DGUSScreenHandlerBase.h index 07a108e84663..340938c9790d 100644 --- a/Marlin/src/lcd/extui/dgus/DGUSScreenHandlerBase.h +++ b/Marlin/src/lcd/extui/dgus/DGUSScreenHandlerBase.h @@ -51,6 +51,7 @@ class DGUSScreenHandler { static void setstatusmessage(const char *msg); // The same for messages from Flash static void setstatusmessagePGM(PGM_P const msg); + static void setstatusmessage(FSTR_P const fmsg) { setstatusmessagePGM(FTOP(fmsg)); } // Callback for VP "Display wants to change screen on idle printer" static void ScreenChangeHookIfIdle(DGUS_VP_Variable &var, void *val_ptr); // Callback for VP "Screen has been changed" diff --git a/Marlin/src/lcd/extui/dgus/dgus_extui.cpp b/Marlin/src/lcd/extui/dgus/dgus_extui.cpp index b041687a14fa..382c5eb1befa 100644 --- a/Marlin/src/lcd/extui/dgus/dgus_extui.cpp +++ b/Marlin/src/lcd/extui/dgus/dgus_extui.cpp @@ -137,19 +137,19 @@ namespace ExtUI { // Called for temperature PID tuning result switch (rst) { case PID_STARTED: - ScreenHandler.setstatusmessagePGM(GET_TEXT(MSG_PID_AUTOTUNE)); + ScreenHandler.setstatusmessage(GET_TEXT_F(MSG_PID_AUTOTUNE)); break; - case PID_BAD_EXTRUDER_NUM: - ScreenHandler.setstatusmessagePGM(GET_TEXT(MSG_PID_BAD_EXTRUDER_NUM)); + case PID_BAD_HEATER_ID: + ScreenHandler.setstatusmessage(GET_TEXT_F(MSG_PID_BAD_HEATER_ID)); break; case PID_TEMP_TOO_HIGH: - ScreenHandler.setstatusmessagePGM(GET_TEXT(MSG_PID_TEMP_TOO_HIGH)); + ScreenHandler.setstatusmessage(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH)); break; case PID_TUNING_TIMEOUT: - ScreenHandler.setstatusmessagePGM(GET_TEXT(MSG_PID_TIMEOUT)); + ScreenHandler.setstatusmessage(GET_TEXT_F(MSG_PID_TIMEOUT)); break; case PID_DONE: - ScreenHandler.setstatusmessagePGM(GET_TEXT(MSG_PID_AUTOTUNE_DONE)); + ScreenHandler.setstatusmessage(GET_TEXT_F(MSG_PID_AUTOTUNE_DONE)); break; } ScreenHandler.GotoScreen(DGUSLCD_SCREEN_MAIN); diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp index 4d758ae5ef74..3d0896a67cf6 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp @@ -325,8 +325,8 @@ void DGUSScreenHandler::FilamentRunout(const ExtUI::extruder_t extruder) { case ExtUI::PID_STARTED: SetStatusMessage(GET_TEXT_F(MSG_PID_AUTOTUNE)); break; - case ExtUI::PID_BAD_EXTRUDER_NUM: - SetStatusMessage(GET_TEXT_F(MSG_PID_BAD_EXTRUDER_NUM)); + case ExtUI::PID_BAD_HEATER_ID: + SetStatusMessage(GET_TEXT_F(MSG_PID_BAD_HEATER_ID)); break; case ExtUI::PID_TEMP_TOO_HIGH: SetStatusMessage(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH)); diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h index cc59bda6d7fa..6a00a4f72aff 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h @@ -72,10 +72,10 @@ class DGUSScreenHandler { static void SetMessageLine(const char* msg, uint8_t line); static void SetMessageLinePGM(PGM_P msg, uint8_t line); - static void SetStatusMessage(const char* msg, const millis_t duration = DGUS_STATUS_EXPIRATION_MS); - static void SetStatusMessage(FSTR_P const msg, const millis_t duration = DGUS_STATUS_EXPIRATION_MS); + static void SetStatusMessage(const char* msg, const millis_t duration=DGUS_STATUS_EXPIRATION_MS); + static void SetStatusMessage(FSTR_P const msg, const millis_t duration=DGUS_STATUS_EXPIRATION_MS); - static void ShowWaitScreen(DGUS_Screen return_screen, bool has_continue = false); + static void ShowWaitScreen(DGUS_Screen return_screen, bool has_continue=false); static DGUS_Screen GetCurrentScreen(); static void TriggerScreenChange(DGUS_Screen screen); @@ -115,7 +115,7 @@ class DGUSScreenHandler { static const DGUS_Addr* FindScreenAddrList(DGUS_Screen screen); static bool CallScreenSetup(DGUS_Screen screen); - static void MoveToScreen(DGUS_Screen screen, bool abort_wait = false); + static void MoveToScreen(DGUS_Screen screen, bool abort_wait=false); static bool SendScreenVPData(DGUS_Screen screen, bool complete_update); static bool settings_ready; diff --git a/Marlin/src/lcd/extui/example/example.cpp b/Marlin/src/lcd/extui/example/example.cpp index 6ef20cf5f0f3..27269a9bee7b 100644 --- a/Marlin/src/lcd/extui/example/example.cpp +++ b/Marlin/src/lcd/extui/example/example.cpp @@ -121,11 +121,11 @@ namespace ExtUI { void onPidTuning(const result_t rst) { // Called for temperature PID tuning result switch (rst) { - case PID_STARTED: break; - case PID_BAD_EXTRUDER_NUM: break; - case PID_TEMP_TOO_HIGH: break; - case PID_TUNING_TIMEOUT: break; - case PID_DONE: break; + case PID_STARTED: break; + case PID_BAD_HEATER_ID: break; + case PID_TEMP_TOO_HIGH: break; + case PID_TUNING_TIMEOUT: break; + case PID_DONE: break; } } #endif diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/archim2-flash/media_file_reader.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/archim2-flash/media_file_reader.h index eb76bb9b2b2c..9a20c2a038d7 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/archim2-flash/media_file_reader.h +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/archim2-flash/media_file_reader.h @@ -32,7 +32,7 @@ class MediaFileReader { private: #if ENABLED(SDSUPPORT) - SdFile root, file; + MediaFile root, file; #endif public: diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp index 2ce9ed027e86..84de2c587128 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp @@ -136,8 +136,8 @@ namespace ExtUI { case PID_STARTED: StatusScreen::setStatusMessage(GET_TEXT_F(MSG_PID_AUTOTUNE)); break; - case PID_BAD_EXTRUDER_NUM: - StatusScreen::setStatusMessage(GET_TEXT_F(MSG_PID_BAD_EXTRUDER_NUM)); + case PID_BAD_HEATER_ID: + StatusScreen::setStatusMessage(GET_TEXT_F(MSG_PID_BAD_HEATER_ID)); break; case PID_TEMP_TOO_HIGH: StatusScreen::setStatusMessage(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH)); diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/move_axis_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/move_axis_screen.cpp index e077eb371ac0..c3927c21a7dd 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/move_axis_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/move_axis_screen.cpp @@ -61,9 +61,9 @@ void MoveAxisScreen::onRedraw(draw_mode_t what) { w.adjuster( 10, GET_TEXT_F(MSG_AXIS_E2), mydata.e_rel[1], canMove(E1)); #if EXTRUDERS > 2 w.adjuster( 12, GET_TEXT_F(MSG_AXIS_E3), mydata.e_rel[2], canMove(E2)); - #endif - #if EXTRUDERS > 3 - w.adjuster( 14, GET_TEXT_F(MSG_AXIS_E4), mydata.e_rel[3], canMove(E3)); + #if EXTRUDERS > 3 + w.adjuster( 14, GET_TEXT_F(MSG_AXIS_E4), mydata.e_rel[3], canMove(E3)); + #endif #endif #endif #if Z_HOME_TO_MIN @@ -79,40 +79,44 @@ bool BaseMoveAxisScreen::onTouchHeld(uint8_t tag) { switch (tag) { case 2: UI_DECREMENT_AXIS(X); break; case 3: UI_INCREMENT_AXIS(X); break; - case 4: UI_DECREMENT_AXIS(Y); break; - case 5: UI_INCREMENT_AXIS(Y); break; - case 6: UI_DECREMENT_AXIS(Z); break; - case 7: UI_INCREMENT_AXIS(Z); break; - // For extruders, also update relative distances. - case 8: UI_DECREMENT_AXIS(E0); mydata.e_rel[0] -= increment; break; - case 9: UI_INCREMENT_AXIS(E0); mydata.e_rel[0] += increment; break; - #if HAS_MULTI_EXTRUDER - case 10: UI_DECREMENT_AXIS(E1); mydata.e_rel[1] -= increment; break; - case 11: UI_INCREMENT_AXIS(E1); mydata.e_rel[1] += increment; break; - #endif - #if EXTRUDERS > 2 - case 12: UI_DECREMENT_AXIS(E2); mydata.e_rel[2] -= increment; break; - case 13: UI_INCREMENT_AXIS(E2); mydata.e_rel[2] += increment; break; + #if HAS_EXTRUDERS + // For extruders, also update relative distances. + case 8: UI_DECREMENT_AXIS(E0); mydata.e_rel[0] -= increment; break; + case 9: UI_INCREMENT_AXIS(E0); mydata.e_rel[0] += increment; break; + #if HAS_MULTI_EXTRUDER + case 10: UI_DECREMENT_AXIS(E1); mydata.e_rel[1] -= increment; break; + case 11: UI_INCREMENT_AXIS(E1); mydata.e_rel[1] += increment; break; + #if EXTRUDERS > 2 + case 12: UI_DECREMENT_AXIS(E2); mydata.e_rel[2] -= increment; break; + case 13: UI_INCREMENT_AXIS(E2); mydata.e_rel[2] += increment; break; + #if EXTRUDERS > 3 + case 14: UI_DECREMENT_AXIS(E3); mydata.e_rel[3] -= increment; break; + case 15: UI_INCREMENT_AXIS(E3); mydata.e_rel[3] += increment; break; + #endif + #endif + #endif #endif - #if EXTRUDERS > 3 - case 14: UI_DECREMENT_AXIS(E3); mydata.e_rel[3] -= increment; break; - case 15: UI_INCREMENT_AXIS(E3); mydata.e_rel[3] += increment; break; + #if HAS_Y_AXIS + case 4: UI_DECREMENT_AXIS(Y); break; + case 5: UI_INCREMENT_AXIS(Y); break; + case 20: SpinnerDialogBox::enqueueAndWait(F("G28X")); break; + case 21: SpinnerDialogBox::enqueueAndWait(F("G28Y")); break; + #if HAS_Z_AXIS + case 6: UI_DECREMENT_AXIS(Z); break; + case 7: UI_INCREMENT_AXIS(Z); break; + case 22: SpinnerDialogBox::enqueueAndWait(F("G28Z")); break; + case 24: raiseZtoTop(); break; + #endif #endif - case 20: SpinnerDialogBox::enqueueAndWait(F("G28X")); break; - case 21: SpinnerDialogBox::enqueueAndWait(F("G28Y")); break; - case 22: SpinnerDialogBox::enqueueAndWait(F("G28Z")); break; case 23: SpinnerDialogBox::enqueueAndWait(F("G28")); break; - case 24: raiseZtoTop(); break; default: return false; } - #undef UI_DECREMENT_AXIS - #undef UI_INCREMENT_AXIS return true; } void BaseMoveAxisScreen::raiseZtoTop() { - constexpr xyze_feedrate_t homing_feedrate = HOMING_FEEDRATE_MM_M; + constexpr xyz_feedrate_t homing_feedrate = HOMING_FEEDRATE_MM_M; setAxisPosition_mm(Z_MAX_POS - 5, Z, homing_feedrate.z); } @@ -128,9 +132,11 @@ void BaseMoveAxisScreen::setManualFeedrate(ExtUI::axis_t axis, float increment_m ExtUI::setFeedrate_mm_s(getManualFeedrate(X_AXIS + (axis - ExtUI::X), increment_mm)); } -void BaseMoveAxisScreen::setManualFeedrate(ExtUI::extruder_t, float increment_mm) { - ExtUI::setFeedrate_mm_s(getManualFeedrate(E_AXIS, increment_mm)); -} +#if HAS_EXTRUDERS + void BaseMoveAxisScreen::setManualFeedrate(ExtUI::extruder_t, float increment_mm) { + ExtUI::setFeedrate_mm_s(getManualFeedrate(E_AXIS, increment_mm)); + } +#endif void MoveAxisScreen::onIdle() { if (refresh_timer.elapsed(STATUS_UPDATE_INTERVAL)) { diff --git a/Marlin/src/lcd/extui/malyan/malyan_extui.cpp b/Marlin/src/lcd/extui/malyan/malyan_extui.cpp index 945ff472e1a1..8ed319e35c8a 100644 --- a/Marlin/src/lcd/extui/malyan/malyan_extui.cpp +++ b/Marlin/src/lcd/extui/malyan/malyan_extui.cpp @@ -111,8 +111,8 @@ namespace ExtUI { case PID_STARTED: set_lcd_error(GET_TEXT_F(MSG_PID_AUTOTUNE)); break; - case PID_BAD_EXTRUDER_NUM: - set_lcd_error(GET_TEXT_F(MSG_PID_BAD_EXTRUDER_NUM)); + case PID_BAD_HEATER_ID: + set_lcd_error(GET_TEXT_F(MSG_PID_BAD_HEATER_ID)); break; case PID_TEMP_TOO_HIGH: set_lcd_error(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH)); diff --git a/Marlin/src/lcd/extui/mks_ui/draw_dialog.cpp b/Marlin/src/lcd/extui/mks_ui/draw_dialog.cpp index a69c54bcff63..a214e7d1e0e7 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_dialog.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_dialog.cpp @@ -90,7 +90,7 @@ static void btn_ok_event_cb(lv_obj_t *btn, lv_event_t event) { char *cur_name; cur_name = strrchr(list_file.file_name[sel_id], '/'); - SdFile file, *curDir; + MediaFile file, *curDir; card.abortFilePrintNow(); const char * const fname = card.diveToFile(false, curDir, cur_name); if (!fname) return; diff --git a/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp b/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp index 6a8333fd66df..b510e3c0c6f3 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp @@ -647,8 +647,8 @@ char *creat_title_text() { char *cur_name = strrchr(list_file.file_name[sel_id], '/'); - SdFile file; - SdFile *curDir; + MediaFile file; + MediaFile *curDir; const char * const fname = card.diveToFile(false, curDir, cur_name); if (!fname) return; if (file.open(curDir, fname, O_READ)) { diff --git a/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp b/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp index 00bb9833fc72..0c6315d43870 100644 --- a/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp +++ b/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp @@ -727,7 +727,7 @@ void disp_assets_update_progress(FSTR_P const fmsg) { uint8_t mks_test_flag = 0; const char *MKSTestPath = "MKS_TEST"; void mks_test_get() { - SdFile dir, root = card.getroot(); + MediaFile dir, root = card.getroot(); if (dir.open(&root, MKSTestPath, O_RDONLY)) mks_test_flag = 0x1E; } diff --git a/Marlin/src/lcd/extui/mks_ui/pic_manager.cpp b/Marlin/src/lcd/extui/mks_ui/pic_manager.cpp index c618127980bb..d642d81f6baa 100644 --- a/Marlin/src/lcd/extui/mks_ui/pic_manager.cpp +++ b/Marlin/src/lcd/extui/mks_ui/pic_manager.cpp @@ -403,8 +403,8 @@ uint32_t Pic_Info_Write(uint8_t *P_name, uint32_t P_size) { #define ASSET_TYPE_TITLE_LOGO 2 #define ASSET_TYPE_G_PREVIEW 3 #define ASSET_TYPE_FONT 4 - static void loadAsset(SdFile &dir, dir_t& entry, FSTR_P const fn, int8_t assetType) { - SdFile file; + static void loadAsset(MediaFile &dir, dir_t& entry, FSTR_P const fn, int8_t assetType) { + MediaFile file; char dosFilename[FILENAME_LENGTH]; createFilename(dosFilename, entry); if (!file.open(&dir, dosFilename, O_READ)) { @@ -488,7 +488,7 @@ uint32_t Pic_Info_Write(uint8_t *P_name, uint32_t P_size) { void UpdateAssets() { if (!card.isMounted()) return; - SdFile dir, root = card.getroot(); + MediaFile dir, root = card.getroot(); if (dir.open(&root, assetsPath, O_RDONLY)) { disp_assets_update(); diff --git a/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp b/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp index 23a39aabc469..a8d30b442a9b 100644 --- a/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp +++ b/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp @@ -736,7 +736,7 @@ int32_t lastFragment = 0; char saveFilePath[50]; -static SdFile upload_file, *upload_curDir; +static MediaFile upload_file, *upload_curDir; static filepos_t pos; int write_to_file(char *buf, int len) { @@ -974,8 +974,8 @@ static void wifi_gcode_exec(uint8_t *cmd_line) { if (!gcode_preview_over) { char *cur_name = strrchr(list_file.file_name[sel_id], '/'); - SdFile file; - SdFile *curDir; + MediaFile file; + MediaFile *curDir; card.abortFilePrintNow(); const char * const fname = card.diveToFile(false, curDir, cur_name); if (!fname) return; @@ -1595,7 +1595,7 @@ static void file_fragment_msg_handle(uint8_t * msg, uint16_t msgLen) { } } upload_file.close(); - SdFile file, *curDir; + MediaFile file, *curDir; const char * const fname = card.diveToFile(false, curDir, saveFilePath); if (file.open(curDir, fname, O_RDWR)) { gCfgItems.curFilesize = file.fileSize(); @@ -1969,7 +1969,7 @@ void mks_wifi_firmware_update() { if (wifi_upload(0) >= 0) { card.removeFile((char *)ESP_FIRMWARE_FILE_RENAME); - SdFile file, *curDir; + MediaFile file, *curDir; const char * const fname = card.diveToFile(false, curDir, ESP_FIRMWARE_FILE); if (file.open(curDir, fname, O_READ)) { file.rename(curDir, (char *)ESP_FIRMWARE_FILE_RENAME); diff --git a/Marlin/src/lcd/extui/mks_ui/wifi_upload.cpp b/Marlin/src/lcd/extui/mks_ui/wifi_upload.cpp index c07cc47a3689..18a311303ccf 100644 --- a/Marlin/src/lcd/extui/mks_ui/wifi_upload.cpp +++ b/Marlin/src/lcd/extui/mks_ui/wifi_upload.cpp @@ -86,7 +86,7 @@ static const uint32_t defaultTimeout = 500; static const uint32_t eraseTimeout = 15000; static const uint32_t blockWriteTimeout = 200; static const uint32_t blockWriteInterval = 15; // 15ms is long enough, 10ms is mostly too short -static SdFile update_file, *update_curDir; +static MediaFile update_file, *update_curDir; // Messages corresponding to result codes, should make sense when followed by " error" const char *resultMessages[] = { diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index 4422e8115d8a..da04c9bc8b5f 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -333,7 +333,7 @@ namespace ExtUI { // This assumes the center is 0,0 #if ENABLED(DELTA) if (axis != Z) { - max = SQRT(sq(float(DELTA_PRINTABLE_RADIUS)) - sq(current_position[Y - axis])); // (Y - axis) == the other axis + max = SQRT(sq(float(PRINTABLE_RADIUS)) - sq(current_position[Y - axis])); // (Y - axis) == the other axis min = -max; } #endif diff --git a/Marlin/src/lcd/extui/ui_api.h b/Marlin/src/lcd/extui/ui_api.h index c2ce52ba4c1e..b48dc94f8fef 100644 --- a/Marlin/src/lcd/extui/ui_api.h +++ b/Marlin/src/lcd/extui/ui_api.h @@ -61,7 +61,7 @@ namespace ExtUI { enum extruder_t : uint8_t { E0, E1, E2, E3, E4, E5, E6, E7 }; enum heater_t : uint8_t { H0, H1, H2, H3, H4, H5, BED, CHAMBER, COOLER }; enum fan_t : uint8_t { FAN0, FAN1, FAN2, FAN3, FAN4, FAN5, FAN6, FAN7 }; - enum result_t : uint8_t { PID_STARTED, PID_BAD_EXTRUDER_NUM, PID_TEMP_TOO_HIGH, PID_TUNING_TIMEOUT, PID_DONE }; + enum result_t : uint8_t { PID_STARTED, PID_BAD_HEATER_ID, PID_TEMP_TOO_HIGH, PID_TUNING_TIMEOUT, PID_DONE }; constexpr uint8_t extruderCount = EXTRUDERS; constexpr uint8_t hotendCount = HOTENDS; diff --git a/Marlin/src/lcd/language/language_an.h b/Marlin/src/lcd/language/language_an.h index 8e65f3801285..1d4801278ce2 100644 --- a/Marlin/src/lcd/language/language_an.h +++ b/Marlin/src/lcd/language/language_an.h @@ -103,7 +103,6 @@ namespace Language_an { LSTR MSG_FLOW_N = _UxGT("Fluxo ~"); LSTR MSG_CONTROL = _UxGT("Control"); LSTR MSG_AUTOTEMP = _UxGT("Temperatura Auto."); - LSTR MSG_SELECT = _UxGT("Trigar"); LSTR MSG_SELECT_E = _UxGT("Trigar *"); LSTR MSG_ACC = _UxGT("Aceleracion"); LSTR MSG_VTRAV_MIN = _UxGT("Vel. viache min"); diff --git a/Marlin/src/lcd/language/language_ca.h b/Marlin/src/lcd/language/language_ca.h index d3a1c2eac1bb..13b5d70837ad 100644 --- a/Marlin/src/lcd/language/language_ca.h +++ b/Marlin/src/lcd/language/language_ca.h @@ -151,7 +151,7 @@ namespace Language_ca { LSTR MSG_CHANGE_MEDIA = _UxGT("Canvia SD"); LSTR MSG_ZPROBE_OUT = _UxGT("Sonda Z fora"); LSTR MSG_BLTOUCH_RESET = _UxGT("Reinicia BLTouch"); - LSTR MSG_HOME_FIRST = _UxGT("Home %s%s%s primer"); + LSTR MSG_HOME_FIRST = _UxGT("Home %s primer"); LSTR MSG_ZPROBE_ZOFFSET = _UxGT("Decalatge Z"); LSTR MSG_BABYSTEP_X = _UxGT("Micropas X"); LSTR MSG_BABYSTEP_Y = _UxGT("Micropas Y"); diff --git a/Marlin/src/lcd/language/language_cz.h b/Marlin/src/lcd/language/language_cz.h index 50d490a6c2eb..bb930eb7846c 100644 --- a/Marlin/src/lcd/language/language_cz.h +++ b/Marlin/src/lcd/language/language_cz.h @@ -264,7 +264,6 @@ namespace Language_cz { LSTR MSG_LCD_OFF = _UxGT("Vyp"); LSTR MSG_PID_AUTOTUNE = _UxGT("PID automatika"); LSTR MSG_PID_AUTOTUNE_E = _UxGT("PID automatika *"); - LSTR MSG_SELECT = _UxGT("Vybrat"); LSTR MSG_SELECT_E = _UxGT("Vybrat *"); LSTR MSG_ACC = _UxGT("Zrychl"); LSTR MSG_JERK = _UxGT("Jerk"); @@ -396,7 +395,7 @@ namespace Language_cz { LSTR MSG_MANUAL_DEPLOY_TOUCHMI = _UxGT("vysunout TouchMI"); LSTR MSG_MANUAL_DEPLOY = _UxGT("Vysunout Z-sondu"); LSTR MSG_MANUAL_STOW = _UxGT("Zasunout Z-sondu"); - LSTR MSG_HOME_FIRST = _UxGT("Domů %s%s%s první"); + LSTR MSG_HOME_FIRST = _UxGT("Domů %s první"); LSTR MSG_ZPROBE_ZOFFSET = _UxGT("Z ofset"); LSTR MSG_BABYSTEP_X = _UxGT("Babystep X"); LSTR MSG_BABYSTEP_Y = _UxGT("Babystep Y"); diff --git a/Marlin/src/lcd/language/language_da.h b/Marlin/src/lcd/language/language_da.h index 4078c413d110..56c53b84fd51 100644 --- a/Marlin/src/lcd/language/language_da.h +++ b/Marlin/src/lcd/language/language_da.h @@ -98,7 +98,6 @@ namespace Language_da { LSTR MSG_AUTOTEMP = _UxGT("Autotemp"); LSTR MSG_LCD_ON = _UxGT("Til"); LSTR MSG_LCD_OFF = _UxGT("Fra"); - LSTR MSG_SELECT = _UxGT("Vælg"); LSTR MSG_SELECT_E = _UxGT("Vælg *"); LSTR MSG_A_RETRACT = _UxGT("A-retract"); LSTR MSG_A_TRAVEL = _UxGT("A-rejse"); @@ -139,7 +138,7 @@ namespace Language_da { LSTR MSG_CHANGE_MEDIA = _UxGT("Skift SD kort"); LSTR MSG_ZPROBE_OUT = _UxGT("Probe udenfor plade"); LSTR MSG_BLTOUCH_SELFTEST = _UxGT("BLTouch Selv-Test"); - LSTR MSG_HOME_FIRST = _UxGT("Home %s%s%s først"); + LSTR MSG_HOME_FIRST = _UxGT("Home %s først"); LSTR MSG_HEATING_FAILED_LCD = _UxGT("Opvarmning fejlet"); LSTR MSG_ERR_REDUNDANT_TEMP = _UxGT("Fejl: reserve temp"); LSTR MSG_THERMAL_RUNAWAY = _UxGT("Temp løber løbsk"); diff --git a/Marlin/src/lcd/language/language_de.h b/Marlin/src/lcd/language/language_de.h index c2af37fc7777..1cbddf860e25 100644 --- a/Marlin/src/lcd/language/language_de.h +++ b/Marlin/src/lcd/language/language_de.h @@ -343,10 +343,10 @@ namespace Language_de { LSTR MSG_PID_CYCLE = _UxGT("PID Zyklus"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("PID Tuning fertig"); LSTR MSG_PID_AUTOTUNE_FAILED = _UxGT("PID Autotune fehlge.!"); - LSTR MSG_BAD_EXTRUDER_NUM = _UxGT("ungültiger Extruder."); + LSTR MSG_BAD_HEATER_ID = _UxGT("ungültiger Extruder."); LSTR MSG_TEMP_TOO_HIGH = _UxGT("Temperatur zu hoch."); LSTR MSG_TIMEOUT = _UxGT("Timeout."); - LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Autotune fehlge.! Ungültiger Extruder"); + LSTR MSG_PID_BAD_HEATER_ID = _UxGT("Autotune fehlge.! Ungültiger Extruder"); LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Autotune fehlge.! Temperatur zu hoch."); LSTR MSG_PID_TIMEOUT = _UxGT("Autotune fehlge.! Timeout."); LSTR MSG_MPC_MEASURING_AMBIENT = _UxGT("teste Wärmeverlust"); @@ -357,7 +357,6 @@ namespace Language_de { LSTR MSG_SENSOR_RESPONSIVENESS_E = _UxGT("Sensor res *"); LSTR MSG_MPC_AMBIENT_XFER_COEFF_E = _UxGT("Ambient h *"); LSTR MSG_MPC_AMBIENT_XFER_COEFF_FAN_E = _UxGT("Amb. h fan *"); - LSTR MSG_SELECT = _UxGT("Auswählen"); LSTR MSG_SELECT_E = _UxGT("Auswählen *"); LSTR MSG_ACC = _UxGT("Beschleunigung"); LSTR MSG_JERK = _UxGT("Jerk"); @@ -540,7 +539,7 @@ namespace Language_de { LSTR MSG_MANUAL_DEPLOY_TOUCHMI = _UxGT("TouchMI ausfahren"); LSTR MSG_MANUAL_DEPLOY = _UxGT("Z-Sonde ausfahren"); LSTR MSG_MANUAL_STOW = _UxGT("Z-Sonde einfahren"); - LSTR MSG_HOME_FIRST = _UxGT("Vorher %s%s%s homen"); + LSTR MSG_HOME_FIRST = _UxGT("Vorher %s homen"); LSTR MSG_ZPROBE_SETTINGS = _UxGT("Sondeneinstellungen"); LSTR MSG_ZPROBE_OFFSETS = _UxGT("Sondenversatz"); LSTR MSG_ZPROBE_XOFFSET = _UxGT("Sondenversatz X"); diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 3ce7a5aa2b3a..5adc5275fc6e 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -107,6 +107,7 @@ namespace Language_en { LSTR MSG_HOME_OFFSET_Y = _UxGT("Home Offset Y"); LSTR MSG_HOME_OFFSET_Z = _UxGT("Home Offset Z"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Offsets Applied"); + LSTR MSG_ERR_M428_TOO_FAR = _UxGT("Err: Too far!"); LSTR MSG_TRAMMING_WIZARD = _UxGT("Tramming Wizard"); LSTR MSG_SELECT_ORIGIN = _UxGT("Select Origin"); LSTR MSG_LAST_VALUE_SP = _UxGT("Last value "); @@ -364,21 +365,27 @@ namespace Language_en { LSTR MSG_PID_CYCLE = _UxGT("PID Cycles"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("PID tuning done"); LSTR MSG_PID_AUTOTUNE_FAILED = _UxGT("PID Autotune failed!"); - LSTR MSG_BAD_EXTRUDER_NUM = _UxGT("Bad extruder."); + LSTR MSG_BAD_HEATER_ID = _UxGT("Bad extruder."); LSTR MSG_TEMP_TOO_HIGH = _UxGT("Temperature too high."); LSTR MSG_TIMEOUT = _UxGT("Timeout."); - LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Autotune failed! Bad extruder."); + LSTR MSG_PID_BAD_HEATER_ID = _UxGT("Autotune failed! Bad extruder."); LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Autotune failed! Temperature too high."); LSTR MSG_PID_TIMEOUT = _UxGT("Autotune failed! Timeout."); LSTR MSG_MPC_MEASURING_AMBIENT = _UxGT("Testing heat loss"); + LSTR MSG_MPC_HEATING_PAST_200 = _UxGT("Heating to >200C"); + LSTR MSG_MPC_COOLING_TO_AMBIENT = _UxGT("Cooling to ambient"); LSTR MSG_MPC_AUTOTUNE = _UxGT("MPC Autotune"); LSTR MSG_MPC_EDIT = _UxGT("Edit * MPC"); + LSTR MSG_MPC_POWER = _UxGT("Heater Power"); LSTR MSG_MPC_POWER_E = _UxGT("Power *"); - LSTR MSG_MPC_BLOCK_HEAT_CAPACITY_E = _UxGT("Block C *"); - LSTR MSG_SENSOR_RESPONSIVENESS_E = _UxGT("Sensor res *"); - LSTR MSG_MPC_AMBIENT_XFER_COEFF_E = _UxGT("Ambient h *"); - LSTR MSG_MPC_AMBIENT_XFER_COEFF_FAN_E = _UxGT("Amb. h fan *"); - LSTR MSG_SELECT = _UxGT("Select"); + LSTR MSG_MPC_BLOCK_HEAT_CAPACITY = _UxGT("Heat Capacity"); + LSTR MSG_MPC_BLOCK_HEAT_CAPACITY_E = _UxGT("Heat Cap. *"); + LSTR MSG_SENSOR_RESPONSIVENESS = _UxGT("Sensor Resp."); + LSTR MSG_SENSOR_RESPONSIVENESS_E = _UxGT("Sensor Resp. *"); + LSTR MSG_MPC_AMBIENT_XFER_COEFF = _UxGT("Ambient Coeff."); + LSTR MSG_MPC_AMBIENT_XFER_COEFF_E = _UxGT("Ambient Co. *"); + LSTR MSG_MPC_AMBIENT_XFER_COEFF_FAN = _UxGT("Fan coeff."); + LSTR MSG_MPC_AMBIENT_XFER_COEFF_FAN_E = _UxGT("Fan coeff. *"); LSTR MSG_SELECT_E = _UxGT("Select *"); LSTR MSG_ACC = _UxGT("Accel"); LSTR MSG_JERK = _UxGT("Jerk"); @@ -553,11 +560,11 @@ namespace Language_en { LSTR MSG_TOOL_MIGRATION_END = _UxGT("Last Extruder"); LSTR MSG_TOOL_MIGRATION_SWAP = _UxGT("Migrate to *"); LSTR MSG_FILAMENTCHANGE = _UxGT("Change Filament"); - LSTR MSG_FILAMENTCHANGE_E = _UxGT("Change Filament *"); + LSTR MSG_FILAMENTCHANGE_E = _UxGT("Change * Filament"); LSTR MSG_FILAMENTLOAD = _UxGT("Load Filament"); - LSTR MSG_FILAMENTLOAD_E = _UxGT("Load *"); + LSTR MSG_FILAMENTLOAD_E = _UxGT("Load * Filament"); LSTR MSG_FILAMENTUNLOAD = _UxGT("Unload Filament"); - LSTR MSG_FILAMENTUNLOAD_E = _UxGT("Unload *"); + LSTR MSG_FILAMENTUNLOAD_E = _UxGT("Unload * Filament"); LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("Unload All"); #if ENABLED(MULTI_VOLUME) LSTR MSG_ATTACH_MEDIA = _UxGT("Attach SD Card"); @@ -589,8 +596,10 @@ namespace Language_en { LSTR MSG_TOUCHMI_SAVE = _UxGT("Save"); LSTR MSG_MANUAL_DEPLOY_TOUCHMI = _UxGT("Deploy TouchMI"); LSTR MSG_MANUAL_DEPLOY = _UxGT("Deploy Z-Probe"); + LSTR MSG_MANUAL_PENUP = _UxGT("Pen up"); + LSTR MSG_MANUAL_PENDOWN = _UxGT("Pen down"); LSTR MSG_MANUAL_STOW = _UxGT("Stow Z-Probe"); - LSTR MSG_HOME_FIRST = _UxGT("Home %s%s%s First"); + LSTR MSG_HOME_FIRST = _UxGT("Home %s First"); LSTR MSG_ZPROBE_SETTINGS = _UxGT("Probe Settings"); LSTR MSG_ZPROBE_OFFSETS = _UxGT("Probe Offsets"); LSTR MSG_ZPROBE_XOFFSET = _UxGT("Probe X Offset"); diff --git a/Marlin/src/lcd/language/language_es.h b/Marlin/src/lcd/language/language_es.h index 5422a8117ba1..d95275c317ac 100644 --- a/Marlin/src/lcd/language/language_es.h +++ b/Marlin/src/lcd/language/language_es.h @@ -265,7 +265,6 @@ namespace Language_es { LSTR MSG_LCD_OFF = _UxGT("Apg"); LSTR MSG_PID_AUTOTUNE = _UxGT("PID Auto-ajuste"); LSTR MSG_PID_AUTOTUNE_E = _UxGT("PID Auto-ajuste *"); - LSTR MSG_SELECT = _UxGT("Seleccionar"); LSTR MSG_SELECT_E = _UxGT("Seleccionar *"); LSTR MSG_ACC = _UxGT("Aceleración"); LSTR MSG_JERK = _UxGT("Jerk"); @@ -399,7 +398,7 @@ namespace Language_es { LSTR MSG_MANUAL_DEPLOY_TOUCHMI = _UxGT("Subir TouchMI"); LSTR MSG_MANUAL_DEPLOY = _UxGT("Subir Sonda Z"); LSTR MSG_MANUAL_STOW = _UxGT("Bajar Sonda Z"); - LSTR MSG_HOME_FIRST = _UxGT("Origen %s%s%s Prim."); + LSTR MSG_HOME_FIRST = _UxGT("Origen %s Prim."); LSTR MSG_ZPROBE_OFFSETS = _UxGT("Desf. Sonda"); LSTR MSG_ZPROBE_XOFFSET = _UxGT("Desf. Sonda X"); LSTR MSG_ZPROBE_YOFFSET = _UxGT("Desf. Sonda Y"); diff --git a/Marlin/src/lcd/language/language_eu.h b/Marlin/src/lcd/language/language_eu.h index 77c8dbe2d870..0c29cdd2aaba 100644 --- a/Marlin/src/lcd/language/language_eu.h +++ b/Marlin/src/lcd/language/language_eu.h @@ -161,7 +161,6 @@ namespace Language_eu { LSTR MSG_MAX = " " LCD_STR_THERMOMETER _UxGT(" Max"); LSTR MSG_FACTOR = " " LCD_STR_THERMOMETER _UxGT(" Fakt"); LSTR MSG_AUTOTEMP = _UxGT("Auto tenperatura"); - LSTR MSG_SELECT = _UxGT("Aukeratu"); LSTR MSG_SELECT_E = _UxGT("Aukeratu *"); LSTR MSG_ACC = _UxGT("Azelerazioa"); LSTR MSG_JERK = _UxGT("Astindua"); @@ -236,7 +235,7 @@ namespace Language_eu { LSTR MSG_BLTOUCH_RESET = _UxGT("BLTouch berrabia."); LSTR MSG_BLTOUCH_DEPLOY = _UxGT("BLTouch jaitsi/luzatu"); LSTR MSG_BLTOUCH_STOW = _UxGT("BLTouch igo/jaso"); - LSTR MSG_HOME_FIRST = _UxGT("Etxera %s%s%s lehenengo"); + LSTR MSG_HOME_FIRST = _UxGT("Etxera %s lehenengo"); LSTR MSG_ZPROBE_ZOFFSET = _UxGT("Z Konpentsatu"); LSTR MSG_BABYSTEP_X = _UxGT("Mikro-urratsa X"); LSTR MSG_BABYSTEP_Y = _UxGT("Mikro-urratsa Y"); diff --git a/Marlin/src/lcd/language/language_fr.h b/Marlin/src/lcd/language/language_fr.h index ed4c7ca9af50..d9d43427c27a 100644 --- a/Marlin/src/lcd/language/language_fr.h +++ b/Marlin/src/lcd/language/language_fr.h @@ -269,10 +269,9 @@ namespace Language_fr { LSTR MSG_PID_AUTOTUNE = _UxGT("PID Autotune"); LSTR MSG_PID_AUTOTUNE_E = _UxGT("PID Autotune *"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("Tuning PID terminé"); - LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Echec Autotune! E incorrect"); + LSTR MSG_PID_BAD_HEATER_ID = _UxGT("Echec Autotune! E incorrect"); LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Echec Autotune! Temp. trop haute"); LSTR MSG_PID_TIMEOUT = _UxGT("Echec Autotune! Opér. expirée"); - LSTR MSG_SELECT = _UxGT("Sélectionner"); LSTR MSG_SELECT_E = _UxGT("Sélectionner *"); LSTR MSG_ACC = _UxGT("Accélération"); LSTR MSG_JERK = _UxGT("Jerk"); @@ -425,7 +424,7 @@ namespace Language_fr { LSTR MSG_MANUAL_DEPLOY_TOUCHMI = _UxGT("Déployer TouchMI"); LSTR MSG_MANUAL_DEPLOY = _UxGT("Déployer Sonde Z"); LSTR MSG_MANUAL_STOW = _UxGT("Ranger Sonde Z"); - LSTR MSG_HOME_FIRST = _UxGT("Origine %s%s%s Premier"); + LSTR MSG_HOME_FIRST = _UxGT("Origine %s Premier"); LSTR MSG_ZPROBE_OFFSETS = _UxGT("Position sonde Z"); LSTR MSG_ZPROBE_XOFFSET = _UxGT("Décalage X"); LSTR MSG_ZPROBE_YOFFSET = _UxGT("Décalage Y"); diff --git a/Marlin/src/lcd/language/language_gl.h b/Marlin/src/lcd/language/language_gl.h index 005c6cc5d025..28917bad35bf 100644 --- a/Marlin/src/lcd/language/language_gl.h +++ b/Marlin/src/lcd/language/language_gl.h @@ -263,10 +263,9 @@ namespace Language_gl { LSTR MSG_PID_AUTOTUNE = _UxGT("Auto-Sint. PID"); LSTR MSG_PID_AUTOTUNE_E = _UxGT("Auto-Sint. PID *"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("Fin Auto-Sint PID"); - LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Auto-Sint. fallida! Extrusor danado."); + LSTR MSG_PID_BAD_HEATER_ID = _UxGT("Auto-Sint. fallida! Extrusor danado."); LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Auto-Sint. fallida! Temperatura moi alta."); LSTR MSG_PID_TIMEOUT = _UxGT("Auto-Sint. fallida! Tempo excedido."); - LSTR MSG_SELECT = _UxGT("Escolla"); LSTR MSG_SELECT_E = _UxGT("Escolla *"); LSTR MSG_ACC = _UxGT("Acel"); LSTR MSG_JERK = _UxGT("Jerk"); @@ -414,7 +413,7 @@ namespace Language_gl { LSTR MSG_MANUAL_DEPLOY_TOUCHMI = _UxGT("Estender TouchMI"); LSTR MSG_MANUAL_DEPLOY = _UxGT("Estender Sonda Z"); LSTR MSG_MANUAL_STOW = _UxGT("Recoller Sonda Z"); - LSTR MSG_HOME_FIRST = _UxGT("Orixe %s%s%s Primeiro"); + LSTR MSG_HOME_FIRST = _UxGT("Orixe %s Primeiro"); LSTR MSG_ZPROBE_OFFSETS = _UxGT("Desfases Sonda"); LSTR MSG_ZPROBE_XOFFSET = _UxGT("Desfase Sonda X"); LSTR MSG_ZPROBE_YOFFSET = _UxGT("Desfase Sonda Y"); diff --git a/Marlin/src/lcd/language/language_hr.h b/Marlin/src/lcd/language/language_hr.h index 7ca0f5405af1..36eaf78acb1a 100644 --- a/Marlin/src/lcd/language/language_hr.h +++ b/Marlin/src/lcd/language/language_hr.h @@ -95,7 +95,6 @@ namespace Language_hr { LSTR MSG_BED = _UxGT("Bed"); LSTR MSG_FAN_SPEED = _UxGT("Brzina ventilatora"); LSTR MSG_FAN_SPEED_N = _UxGT("Brzina ventilatora ~"); - LSTR MSG_SELECT = _UxGT("Odaberi"); LSTR MSG_SELECT_E = _UxGT("Odaberi *"); LSTR MSG_TEMPERATURE = _UxGT("Temperature"); LSTR MSG_MOTION = _UxGT("Gibanje"); diff --git a/Marlin/src/lcd/language/language_hu.h b/Marlin/src/lcd/language/language_hu.h index 09fb71876f3f..61c7d9f9c4e4 100644 --- a/Marlin/src/lcd/language/language_hu.h +++ b/Marlin/src/lcd/language/language_hu.h @@ -306,10 +306,9 @@ namespace Language_hu { LSTR MSG_PID_AUTOTUNE_E = _UxGT("PID hangolás *"); LSTR MSG_PID_CYCLE = _UxGT("PID ciklus"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("PID hangolás kész"); - LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Hangolási hiba! Rossz adagoló."); + LSTR MSG_PID_BAD_HEATER_ID = _UxGT("Hangolási hiba! Rossz adagoló."); LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Hangolási hiba! Magas hömérséklet."); LSTR MSG_PID_TIMEOUT = _UxGT("Hangolási hiba! Idötúllépés."); - LSTR MSG_SELECT = _UxGT("Kiválaszt"); LSTR MSG_SELECT_E = _UxGT("Kiválaszt *"); LSTR MSG_ACC = _UxGT("Gyorsítás"); LSTR MSG_JERK = _UxGT("Rántás"); @@ -468,7 +467,7 @@ namespace Language_hu { LSTR MSG_MANUAL_DEPLOY_TOUCHMI = _UxGT("TouchMI használ"); LSTR MSG_MANUAL_DEPLOY = _UxGT("Z-Szonda telepítés"); LSTR MSG_MANUAL_STOW = _UxGT("Z-Szonda elhelyezés"); - LSTR MSG_HOME_FIRST = _UxGT("Elöször %s%s%s kell"); + LSTR MSG_HOME_FIRST = _UxGT("Elöször %s kell"); LSTR MSG_ZPROBE_OFFSETS = _UxGT("Szonda eltolások"); LSTR MSG_ZPROBE_XOFFSET = _UxGT("X szonda eltolás"); LSTR MSG_ZPROBE_YOFFSET = _UxGT("Y szonda eltolás"); diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index def1b9834317..ee8d51203c09 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -77,6 +77,7 @@ namespace Language_it { LSTR MSG_AUTO_HOME_X = _UxGT("Home X"); LSTR MSG_AUTO_HOME_Y = _UxGT("Home Y"); LSTR MSG_AUTO_HOME_Z = _UxGT("Home Z"); + LSTR MSG_Z_AFTER_HOME = _UxGT("Z dopo homing"); LSTR MSG_FILAMENT_SET = _UxGT("Impostaz.filamento"); LSTR MSG_FILAMENT_MAN = _UxGT("Gestione filamento"); LSTR MSG_MANUAL_LEVELING = _UxGT("Livel.manuale"); @@ -101,6 +102,7 @@ namespace Language_it { LSTR MSG_HOME_OFFSET_Y = _UxGT("Offset home Y"); LSTR MSG_HOME_OFFSET_Z = _UxGT("Offset home Z"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Offset applicato"); + LSTR MSG_ERR_M428_TOO_FAR = _UxGT("Err: Troppo lontano!"); LSTR MSG_TRAMMING_WIZARD = _UxGT("Wizard Tramming"); LSTR MSG_SELECT_ORIGIN = _UxGT("Selez. origine"); LSTR MSG_LAST_VALUE_SP = _UxGT("Ultimo valore "); @@ -128,6 +130,7 @@ namespace Language_it { LSTR MSG_PREHEAT_M_BEDONLY = _UxGT("Preris.$ Piatto"); LSTR MSG_PREHEAT_M_SETTINGS = _UxGT("Preris.$ conf"); #endif + LSTR MSG_PREHEAT_HOTEND = _UxGT("Prerisc.Hotend"); LSTR MSG_PREHEAT_CUSTOM = _UxGT("Prerisc.personal."); LSTR MSG_COOLDOWN = _UxGT("Raffredda"); @@ -263,6 +266,7 @@ namespace Language_it { LSTR MSG_UBL_INVALID_SLOT = _UxGT("Prima selez. uno slot Mesh"); LSTR MSG_MESH_LOADED = _UxGT("Mesh %i caricata"); LSTR MSG_MESH_SAVED = _UxGT("Mesh %i salvata"); + LSTR MSG_MESH_ACTIVE = _UxGT("Mesh %i attiva"); LSTR MSG_UBL_NO_STORAGE = _UxGT("Nessuna memoria"); LSTR MSG_UBL_SAVE_ERROR = _UxGT("Err: Salvataggio UBL"); LSTR MSG_UBL_RESTORE_ERROR = _UxGT("Err: Ripristino UBL"); @@ -320,6 +324,7 @@ namespace Language_it { LSTR MSG_MOVE_01IN = _UxGT("Muovi di 0.1\""); LSTR MSG_MOVE_05IN = _UxGT("Muovi di 0.5\""); LSTR MSG_MOVE_1IN = _UxGT("Muovi di 1\""); + LSTR MSG_LIVE_MOVE = _UxGT("Modalità Live"); LSTR MSG_SPEED = _UxGT("Velocità"); LSTR MSG_BED_Z = _UxGT("Piatto Z"); LSTR MSG_NOZZLE = _UxGT("Ugello"); @@ -331,6 +336,7 @@ namespace Language_it { LSTR MSG_COOLER = _UxGT("Raffreddam. laser"); LSTR MSG_COOLER_TOGGLE = _UxGT("Alterna raffreddam."); LSTR MSG_FLOWMETER_SAFETY = _UxGT("Sicurezza flusso"); + LSTR MSG_CUTTER = _UxGT("Taglio"); LSTR MSG_LASER = _UxGT("Laser"); LSTR MSG_FAN_SPEED = _UxGT("Vel. ventola"); // Max 15 characters LSTR MSG_FAN_SPEED_N = _UxGT("Vel. ventola ~"); // Max 15 characters @@ -356,21 +362,27 @@ namespace Language_it { LSTR MSG_PID_CYCLE = _UxGT("Ciclo PID"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("Calibr.PID eseguita"); LSTR MSG_PID_AUTOTUNE_FAILED = _UxGT("Calibr.PID fallito!"); - LSTR MSG_BAD_EXTRUDER_NUM = _UxGT("Estrusore invalido."); + LSTR MSG_BAD_HEATER_ID = _UxGT("Estrusore invalido."); LSTR MSG_TEMP_TOO_HIGH = _UxGT("Temp.troppo alta."); LSTR MSG_TIMEOUT = _UxGT("Tempo scaduto."); - LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Calibrazione fallita! Estrusore errato."); + LSTR MSG_PID_BAD_HEATER_ID = _UxGT("Calibrazione fallita! Estrusore errato."); LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Calibrazione fallita! Temperatura troppo alta."); LSTR MSG_PID_TIMEOUT = _UxGT("Calibrazione fallita! Tempo scaduto."); - LSTR MSG_MPC_MEASURING_AMBIENT = _UxGT("Testing heat loss"); + LSTR MSG_MPC_MEASURING_AMBIENT = _UxGT("Verif.perdita calore"); + LSTR MSG_MPC_HEATING_PAST_200 = _UxGT("Riscalda a >200C"); + LSTR MSG_MPC_COOLING_TO_AMBIENT = _UxGT("Raffredda a amb."); LSTR MSG_MPC_AUTOTUNE = _UxGT("MPC Autotune"); LSTR MSG_MPC_EDIT = _UxGT("Modif.MPC *"); + LSTR MSG_MPC_POWER = _UxGT("Potenza riscald."); LSTR MSG_MPC_POWER_E = _UxGT("Potenza *"); - LSTR MSG_MPC_BLOCK_HEAT_CAPACITY_E = _UxGT("C blocco *"); + LSTR MSG_MPC_BLOCK_HEAT_CAPACITY = _UxGT("Capacità riscald."); + LSTR MSG_MPC_BLOCK_HEAT_CAPACITY_E = _UxGT("Capac.riscald. *"); + LSTR MSG_SENSOR_RESPONSIVENESS = _UxGT("Reattiv.Sens."); LSTR MSG_SENSOR_RESPONSIVENESS_E = _UxGT("Reattiv.Sens. *"); - LSTR MSG_MPC_AMBIENT_XFER_COEFF_E = _UxGT("H ambiente *"); - LSTR MSG_MPC_AMBIENT_XFER_COEFF_FAN_E = _UxGT("H Amb. vent. *"); - LSTR MSG_SELECT = _UxGT("Seleziona"); + LSTR MSG_MPC_AMBIENT_XFER_COEFF = _UxGT("Coeff.ambiente"); + LSTR MSG_MPC_AMBIENT_XFER_COEFF_E = _UxGT("Coeff.amb. *"); + LSTR MSG_MPC_AMBIENT_XFER_COEFF_FAN = _UxGT("Coeff.ventola"); + LSTR MSG_MPC_AMBIENT_XFER_COEFF_FAN_E = _UxGT("Coeff.ventola *"); LSTR MSG_SELECT_E = _UxGT("Seleziona *"); LSTR MSG_ACC = _UxGT("Accel"); LSTR MSG_JERK = _UxGT("Jerk"); @@ -399,10 +411,10 @@ namespace Language_it { LSTR MSG_A_RETRACT = _UxGT("A-Ritrazione"); LSTR MSG_A_TRAVEL = _UxGT("A-Spostamento"); LSTR MSG_INPUT_SHAPING = _UxGT("Input Shaping"); - LSTR MSG_SHAPING_X_FREQ = _UxGT("Frequenza ") STR_X; - LSTR MSG_SHAPING_Y_FREQ = _UxGT("Frequenza ") STR_Y; - LSTR MSG_SHAPING_X_ZETA = _UxGT("Smorzamento ") STR_X; - LSTR MSG_SHAPING_Y_ZETA = _UxGT("Smorzamento ") STR_Y; + LSTR MSG_SHAPING_ENABLE = _UxGT("Abilita shaping @"); + LSTR MSG_SHAPING_DISABLE = _UxGT("Disabil. shaping @"); + LSTR MSG_SHAPING_FREQ = _UxGT("Frequenza @"); + LSTR MSG_SHAPING_ZETA = _UxGT("Smorzamento @"); LSTR MSG_XY_FREQUENCY_LIMIT = _UxGT("Frequenza max"); LSTR MSG_XY_FREQUENCY_FEEDRATE = _UxGT("Feed min"); LSTR MSG_STEPS_PER_MM = _UxGT("Passi/mm"); @@ -523,6 +535,7 @@ namespace Language_it { LSTR MSG_SINGLENOZZLE_WIPE_RETRACT = _UxGT("Ritrazione pulizia"); LSTR MSG_SINGLENOZZLE_RETRACT_SPEED = _UxGT("Velocità ritrazione"); LSTR MSG_FILAMENT_PARK_ENABLED = _UxGT("Parcheggia testa"); + LSTR MSG_PARK_FAILED = _UxGT("Parcheggio fallito"); LSTR MSG_SINGLENOZZLE_UNRETRACT_SPEED = _UxGT("Veloc. di recupero"); LSTR MSG_SINGLENOZZLE_FAN_SPEED = _UxGT("Velocità ventola"); LSTR MSG_SINGLENOZZLE_FAN_TIME = _UxGT("Tempo ventola"); @@ -540,6 +553,7 @@ namespace Language_it { LSTR MSG_FILAMENTUNLOAD_E = _UxGT("Rimuovi filam. *"); LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("Rimuovi tutto"); LSTR MSG_ATTACH_MEDIA = _UxGT("Collega media"); + LSTR MSG_ATTACH_USB_MEDIA = _UxGT("Collega penna USB"); LSTR MSG_CHANGE_MEDIA = _UxGT("Cambia media"); LSTR MSG_RELEASE_MEDIA = _UxGT("Rilascia media"); LSTR MSG_ZPROBE_OUT = _UxGT("Z probe fuori piatto"); @@ -565,7 +579,7 @@ namespace Language_it { LSTR MSG_MANUAL_DEPLOY = _UxGT("Estendi Sonda-Z"); LSTR MSG_BLTOUCH_STOW = _UxGT("Ritrai BLTouch"); LSTR MSG_MANUAL_STOW = _UxGT("Ritrai Sonda-Z"); - LSTR MSG_HOME_FIRST = _UxGT("Home %s%s%s prima"); + LSTR MSG_HOME_FIRST = _UxGT("Home %s prima"); LSTR MSG_ZPROBE_SETTINGS = _UxGT("Impostazioni sonda"); LSTR MSG_ZPROBE_OFFSETS = _UxGT("Offsets sonda"); LSTR MSG_ZPROBE_XOFFSET = _UxGT("Offset X sonda"); @@ -623,6 +637,7 @@ namespace Language_it { LSTR MSG_MESH_LEVELING = _UxGT("Livel. Mesh"); LSTR MSG_MESH_DONE = _UxGT("Sond.mesh eseguito"); LSTR MSG_INFO_STATS_MENU = _UxGT("Statistiche"); + LSTR MSG_RESET_STATS = _UxGT("Reset stat.stampa?"); LSTR MSG_INFO_BOARD_MENU = _UxGT("Info. scheda"); LSTR MSG_INFO_THERMISTOR_MENU = _UxGT("Termistori"); LSTR MSG_INFO_EXTRUDERS = _UxGT("Estrusori"); diff --git a/Marlin/src/lcd/language/language_jp_kana.h b/Marlin/src/lcd/language/language_jp_kana.h index 2f75b887590e..335d4533daa6 100644 --- a/Marlin/src/lcd/language/language_jp_kana.h +++ b/Marlin/src/lcd/language/language_jp_kana.h @@ -114,7 +114,6 @@ namespace Language_jp_kana { LSTR MSG_AUTOTEMP = _UxGT("ジドウオンドセイギョ"); // "Autotemp" LSTR MSG_LCD_ON = _UxGT("オン"); // "On" LSTR MSG_LCD_OFF = _UxGT("オフ"); // "Off" - LSTR MSG_SELECT = _UxGT("センタク"); // "Select" LSTR MSG_SELECT_E = _UxGT("センタク *"); LSTR MSG_ACC = _UxGT("カソクド mm/s") SUPERSCRIPT_TWO; // "Accel" LSTR MSG_JERK = _UxGT("ヤクドウ mm/s"); // "Jerk" @@ -176,7 +175,7 @@ namespace Language_jp_kana { LSTR MSG_ZPROBE_OUT = _UxGT("Zプローブ ベッドガイ"); // "Z probe out. bed" LSTR MSG_BLTOUCH_SELFTEST = _UxGT("BLTouch ジコシンダン"); // "BLTouch Self-Test" LSTR MSG_BLTOUCH_RESET = _UxGT("BLTouch リセット"); // "Reset BLTouch" - LSTR MSG_HOME_FIRST = _UxGT("サキニ %s%s%s ヲフッキサセテクダサイ"); // "Home ... first" + LSTR MSG_HOME_FIRST = _UxGT("サキニ %s ヲフッキサセテクダサイ"); // "Home ... first" LSTR MSG_ZPROBE_ZOFFSET = _UxGT("Zオフセット"); // "Z Offset" LSTR MSG_BABYSTEP_X = _UxGT("Xジク ビドウ"); // "Babystep X" LSTR MSG_BABYSTEP_Y = _UxGT("Yジク ビドウ"); // "Babystep Y" diff --git a/Marlin/src/lcd/language/language_nl.h b/Marlin/src/lcd/language/language_nl.h index 8aa74d7e9fdc..9ad16bcd8c14 100644 --- a/Marlin/src/lcd/language/language_nl.h +++ b/Marlin/src/lcd/language/language_nl.h @@ -108,7 +108,6 @@ namespace Language_nl { LSTR MSG_AUTOTEMP = _UxGT("Autotemp"); LSTR MSG_LCD_ON = _UxGT("Aan"); LSTR MSG_LCD_OFF = _UxGT("Uit"); - LSTR MSG_SELECT = _UxGT("Selecteer"); LSTR MSG_SELECT_E = _UxGT("Selecteer *"); LSTR MSG_ACC = _UxGT("Versn"); LSTR MSG_TEMPERATURE = _UxGT("Temperatuur"); @@ -153,7 +152,7 @@ namespace Language_nl { LSTR MSG_ZPROBE_OUT = _UxGT("Z probe uit. bed"); LSTR MSG_BLTOUCH_SELFTEST = _UxGT("BLTouch Zelf-Test"); LSTR MSG_BLTOUCH_RESET = _UxGT("Reset BLTouch"); - LSTR MSG_HOME_FIRST = _UxGT("Home %s%s%s Eerst"); + LSTR MSG_HOME_FIRST = _UxGT("Home %s Eerst"); LSTR MSG_ZPROBE_ZOFFSET = _UxGT("Z Offset"); // accepted English term in Dutch LSTR MSG_BABYSTEP_X = _UxGT("Babystap X"); LSTR MSG_BABYSTEP_Y = _UxGT("Babystap Y"); diff --git a/Marlin/src/lcd/language/language_pl.h b/Marlin/src/lcd/language/language_pl.h index 635866baf106..b39c084ec89a 100644 --- a/Marlin/src/lcd/language/language_pl.h +++ b/Marlin/src/lcd/language/language_pl.h @@ -269,7 +269,6 @@ namespace Language_pl { LSTR MSG_PID_AUTOTUNE = _UxGT("PID Autostrojenie"); LSTR MSG_PID_AUTOTUNE_E = _UxGT("PID Autostrojenie *"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("Strojenie PID zakończone"); - LSTR MSG_SELECT = _UxGT("Wybierz"); LSTR MSG_SELECT_E = _UxGT("Wybierz *"); LSTR MSG_ACC = _UxGT("Przyspieszenie"); LSTR MSG_JERK = _UxGT("Zryw"); @@ -373,7 +372,7 @@ namespace Language_pl { LSTR MSG_BLTOUCH_SELFTEST = _UxGT("BLTouch Self-Test"); LSTR MSG_BLTOUCH_RESET = _UxGT("Reset BLTouch"); LSTR MSG_BLTOUCH_MODE_CHANGE = _UxGT("UWAGA: Złe ustawienia mogą uszkodzić drukarkę. Kontynuować?"); - LSTR MSG_HOME_FIRST = _UxGT("Najpierw Home %s%s%s"); + LSTR MSG_HOME_FIRST = _UxGT("Najpierw Home %s"); LSTR MSG_ZPROBE_ZOFFSET = _UxGT("Offset Z"); LSTR MSG_MOVE_NOZZLE_TO_BED = _UxGT("Przesuń dyszę do stołu"); LSTR MSG_BABYSTEP_TOTAL = _UxGT("Łącznie"); diff --git a/Marlin/src/lcd/language/language_pt_br.h b/Marlin/src/lcd/language/language_pt_br.h index 1d07b2b94f22..d52728d10726 100644 --- a/Marlin/src/lcd/language/language_pt_br.h +++ b/Marlin/src/lcd/language/language_pt_br.h @@ -236,7 +236,6 @@ namespace Language_pt_br { LSTR MSG_AUTOTEMP = _UxGT("Temp. Automática"); LSTR MSG_LCD_ON = _UxGT("Ligado"); LSTR MSG_LCD_OFF = _UxGT("Desligado"); - LSTR MSG_SELECT = _UxGT("Selecionar"); LSTR MSG_SELECT_E = _UxGT("Selecionar *"); LSTR MSG_ACC = _UxGT("Acel."); LSTR MSG_JERK = _UxGT("Arrancada"); @@ -341,7 +340,7 @@ namespace Language_pt_br { LSTR MSG_BLTOUCH_DEPLOY = _UxGT("Estender BLTouch"); LSTR MSG_MANUAL_DEPLOY = _UxGT("Estender Sonda-Z"); LSTR MSG_MANUAL_STOW = _UxGT("Recolher Sonda-Z"); - LSTR MSG_HOME_FIRST = _UxGT("Home %s%s%s Primeiro"); + LSTR MSG_HOME_FIRST = _UxGT("Home %s Primeiro"); LSTR MSG_ZPROBE_OFFSETS = _UxGT("Compensar Sonda"); LSTR MSG_ZPROBE_XOFFSET = _UxGT("Compensar Sonda em X"); LSTR MSG_ZPROBE_YOFFSET = _UxGT("Compensar Sonda em Y"); diff --git a/Marlin/src/lcd/language/language_ro.h b/Marlin/src/lcd/language/language_ro.h index 2cf6fff263cc..c5fdcc786f68 100644 --- a/Marlin/src/lcd/language/language_ro.h +++ b/Marlin/src/lcd/language/language_ro.h @@ -261,10 +261,9 @@ namespace Language_ro { LSTR MSG_PID_AUTOTUNE = _UxGT("PID Autotune"); LSTR MSG_PID_AUTOTUNE_E = _UxGT("PID Autotune *"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("PID tuning done"); - LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Autotune failed! Bad extruder."); + LSTR MSG_PID_BAD_HEATER_ID = _UxGT("Autotune failed! Bad extruder."); LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Autotune failed! Temperature too high."); LSTR MSG_PID_TIMEOUT = _UxGT("Autotune failed! Timeout."); - LSTR MSG_SELECT = _UxGT("Select"); LSTR MSG_SELECT_E = _UxGT("Select *"); LSTR MSG_ACC = _UxGT("Accel"); LSTR MSG_JERK = _UxGT("Jerk"); @@ -420,7 +419,7 @@ namespace Language_ro { LSTR MSG_MANUAL_DEPLOY_TOUCHMI = _UxGT("Deploy TouchMI"); LSTR MSG_MANUAL_DEPLOY = _UxGT("Deploy Z-Probe"); LSTR MSG_MANUAL_STOW = _UxGT("Stow Z-Probe"); - LSTR MSG_HOME_FIRST = _UxGT("Home %s%s%s First"); + LSTR MSG_HOME_FIRST = _UxGT("Home %s First"); LSTR MSG_ZPROBE_OFFSETS = _UxGT("Probe Offsets"); LSTR MSG_ZPROBE_XOFFSET = _UxGT("Probe X Offset"); LSTR MSG_ZPROBE_YOFFSET = _UxGT("Probe Y Offset"); diff --git a/Marlin/src/lcd/language/language_ru.h b/Marlin/src/lcd/language/language_ru.h index ec9ddfa7f63c..b8a08afc2294 100644 --- a/Marlin/src/lcd/language/language_ru.h +++ b/Marlin/src/lcd/language/language_ru.h @@ -382,11 +382,10 @@ namespace Language_ru { LSTR MSG_PID_AUTOTUNE = _UxGT("Автоподбор PID"); LSTR MSG_PID_AUTOTUNE_E = _UxGT("Автоподбор PID *"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("Подбор PID выполнен"); - LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Сбой автоподбора! Плохой экструдер."); + LSTR MSG_PID_BAD_HEATER_ID = _UxGT("Сбой автоподбора! Плохой экструдер."); LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Сбой автоподбора! Температура повышена."); LSTR MSG_PID_TIMEOUT = _UxGT("Сбой автоподбора! Завершение времени."); - LSTR MSG_SELECT = _UxGT("Выбор"); LSTR MSG_SELECT_E = _UxGT("Выбор *"); LSTR MSG_ACC = _UxGT("Ускорение"); LSTR MSG_JERK = _UxGT("Рывок"); @@ -582,7 +581,7 @@ namespace Language_ru { LSTR MSG_MANUAL_DEPLOY_TOUCHMI = _UxGT("Установить TouchMI"); LSTR MSG_MANUAL_DEPLOY = _UxGT("Установить зонд"); LSTR MSG_MANUAL_STOW = _UxGT("Загрузить зонд"); - LSTR MSG_HOME_FIRST = _UxGT("Сначала паркуй %s%s%s"); + LSTR MSG_HOME_FIRST = _UxGT("Сначала паркуй %s"); LSTR MSG_ZPROBE_OFFSETS = _UxGT("Смещения Z-зонда"); LSTR MSG_ZPROBE_XOFFSET = _UxGT("Смещение X"); LSTR MSG_ZPROBE_YOFFSET = _UxGT("Смещение Y"); diff --git a/Marlin/src/lcd/language/language_sk.h b/Marlin/src/lcd/language/language_sk.h index bb332f4b1ff2..4167fc802ab9 100644 --- a/Marlin/src/lcd/language/language_sk.h +++ b/Marlin/src/lcd/language/language_sk.h @@ -58,7 +58,7 @@ namespace Language_sk { LSTR MSG_MEDIA_INSERTED = _UxGT("Karta vložená"); LSTR MSG_MEDIA_REMOVED = _UxGT("Karta vybraná"); LSTR MSG_MEDIA_WAITING = _UxGT("Čakám na kartu"); - LSTR MSG_MEDIA_INIT_FAIL = _UxGT("Inicial. SD zlyhala"); + LSTR MSG_MEDIA_INIT_FAIL = _UxGT("Inicial.karty zlyhala"); LSTR MSG_MEDIA_READ_ERROR = _UxGT("Chyba čítania karty"); LSTR MSG_MEDIA_USB_REMOVED = _UxGT("USB zaria. odstrán."); LSTR MSG_MEDIA_USB_FAILED = _UxGT("Chyba spúšťania USB"); @@ -80,6 +80,7 @@ namespace Language_sk { LSTR MSG_AUTO_HOME_X = _UxGT("Domov os X"); LSTR MSG_AUTO_HOME_Y = _UxGT("Domov os Y"); LSTR MSG_AUTO_HOME_Z = _UxGT("Domov os Z"); + LSTR MSG_Z_AFTER_HOME = _UxGT("Os Z po domov.poz."); LSTR MSG_FILAMENT_SET = _UxGT("Nastav. filamentu"); LSTR MSG_FILAMENT_MAN = _UxGT("Správa filamentu"); LSTR MSG_MANUAL_LEVELING = _UxGT("Ručné rovnanie"); @@ -104,6 +105,7 @@ namespace Language_sk { LSTR MSG_HOME_OFFSET_Y = _UxGT("Y Ofset"); LSTR MSG_HOME_OFFSET_Z = _UxGT("Z Ofset"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Ofsety nastavené"); + LSTR MSG_ERR_M428_TOO_FAR = _UxGT("Chyba: Príliš ďaleko!"); LSTR MSG_TRAMMING_WIZARD = _UxGT("Spriev. vyrovn."); LSTR MSG_SELECT_ORIGIN = _UxGT("Vyberte začiatok"); LSTR MSG_LAST_VALUE_SP = _UxGT("Posl. hodnota "); @@ -131,6 +133,7 @@ namespace Language_sk { LSTR MSG_PREHEAT_M_BEDONLY = _UxGT("Zahriať $ podlož"); LSTR MSG_PREHEAT_M_SETTINGS = _UxGT("Zahriať $ nast."); #endif + LSTR MSG_PREHEAT_HOTEND = _UxGT("Zahriať hotend"); LSTR MSG_PREHEAT_CUSTOM = _UxGT("Vlastná teplota"); LSTR MSG_COOLDOWN = _UxGT("Schladiť"); @@ -252,6 +255,7 @@ namespace Language_sk { LSTR MSG_UBL_SMART_FILLIN = _UxGT("Chytré vyplnenie"); LSTR MSG_UBL_FILLIN_MESH = _UxGT("Vyplniť mriežku"); LSTR MSG_UBL_MESH_FILLED = _UxGT("Doplnené chýb. body"); + LSTR MSG_UBL_MESH_INVALID = _UxGT("Neplatná sieť"); LSTR MSG_UBL_INVALIDATE_ALL = _UxGT("Zrušiť všetko"); LSTR MSG_UBL_INVALIDATE_CLOSEST = _UxGT("Zrušiť najbližší"); LSTR MSG_UBL_FINE_TUNE_ALL = _UxGT("Upraviť všetky"); @@ -263,6 +267,7 @@ namespace Language_sk { LSTR MSG_UBL_INVALID_SLOT = _UxGT("Najskôr zvol. slot siete"); LSTR MSG_MESH_LOADED = _UxGT("Sieť %i načítaná"); LSTR MSG_MESH_SAVED = _UxGT("Sieť %i uložená"); + LSTR MSG_MESH_ACTIVE = _UxGT("Sieť %i aktívna"); LSTR MSG_UBL_NO_STORAGE = _UxGT("Nedostatok miesta"); LSTR MSG_UBL_SAVE_ERROR = _UxGT("Chyba: Ukladanie UBL"); LSTR MSG_UBL_RESTORE_ERROR = _UxGT("Chyba: Obnovenie UBL"); @@ -313,11 +318,14 @@ namespace Language_sk { LSTR MSG_MOVE_01MM = _UxGT("Posunúť o 0,1mm"); LSTR MSG_MOVE_1MM = _UxGT("Posunúť o 1mm"); LSTR MSG_MOVE_10MM = _UxGT("Posunúť o 10mm"); + LSTR MSG_MOVE_50MM = _UxGT("Posunúť o 50mm"); LSTR MSG_MOVE_100MM = _UxGT("Posunúť o 100mm"); LSTR MSG_MOVE_0001IN = _UxGT("Posunúť o 0,001in"); LSTR MSG_MOVE_001IN = _UxGT("Posunúť o 0,01in"); LSTR MSG_MOVE_01IN = _UxGT("Posunúť o 0,1in"); + LSTR MSG_MOVE_05IN = _UxGT("Posunúť o 0,5in"); LSTR MSG_MOVE_1IN = _UxGT("Posunúť o 1,0in"); + LSTR MSG_LIVE_MOVE = _UxGT("Živý pohyb"); LSTR MSG_SPEED = _UxGT("Rýchlosť"); LSTR MSG_BED_Z = _UxGT("Výška podl."); LSTR MSG_NOZZLE = _UxGT("Tryska"); @@ -329,6 +337,7 @@ namespace Language_sk { LSTR MSG_COOLER = _UxGT("Chladen. lasera"); LSTR MSG_COOLER_TOGGLE = _UxGT("Prepnúť chladenie"); LSTR MSG_FLOWMETER_SAFETY = _UxGT("Bezpeč. prietok"); + LSTR MSG_CUTTER = _UxGT("Rezačka"); LSTR MSG_LASER = _UxGT("Laser"); LSTR MSG_FAN_SPEED = _UxGT("Rýchlosť vent."); LSTR MSG_FAN_SPEED_N = _UxGT("Rýchlosť vent. ~"); @@ -354,21 +363,27 @@ namespace Language_sk { LSTR MSG_PID_CYCLE = _UxGT("Cykly PID"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("Kal. PID dokončená"); LSTR MSG_PID_AUTOTUNE_FAILED = _UxGT("Kal. PID zlyhala!"); - LSTR MSG_BAD_EXTRUDER_NUM = _UxGT("Zlý extrudér"); + LSTR MSG_BAD_HEATER_ID = _UxGT("Zlý extrudér"); LSTR MSG_TEMP_TOO_HIGH = _UxGT("Príliš vysoká tepl."); LSTR MSG_TIMEOUT = _UxGT("Čas vypršal."); - LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Auto-kal. zlyhala! Zlý extrúder."); + LSTR MSG_PID_BAD_HEATER_ID = _UxGT("Auto-kal. zlyhala! Zlý extrúder."); LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Auto-kal. zlyhala! Príliš vysoká tepl."); LSTR MSG_PID_TIMEOUT = _UxGT("Auto-kal. zlyhala! Čas vypršal."); LSTR MSG_MPC_MEASURING_AMBIENT = _UxGT("Test. tepl. straty"); + LSTR MSG_MPC_HEATING_PAST_200 = _UxGT("Zahriať na >200C"); + LSTR MSG_MPC_COOLING_TO_AMBIENT = _UxGT("Schladiť na okolie"); LSTR MSG_MPC_AUTOTUNE = _UxGT("Auto-kal. MPC"); LSTR MSG_MPC_EDIT = _UxGT("Upraviť * MPC"); + LSTR MSG_MPC_POWER = _UxGT("Výkon ohrievača"); LSTR MSG_MPC_POWER_E = _UxGT("Výkon *"); - LSTR MSG_MPC_BLOCK_HEAT_CAPACITY_E = _UxGT("Blokovať C *"); - LSTR MSG_SENSOR_RESPONSIVENESS_E = _UxGT("Rozliš. senz. *"); - LSTR MSG_MPC_AMBIENT_XFER_COEFF_E = _UxGT("H okolia *"); - LSTR MSG_MPC_AMBIENT_XFER_COEFF_FAN_E = _UxGT("H vent. okolia *"); - LSTR MSG_SELECT = _UxGT("Vybrať"); + LSTR MSG_MPC_BLOCK_HEAT_CAPACITY = _UxGT("Tepelná kapacita"); + LSTR MSG_MPC_BLOCK_HEAT_CAPACITY_E = _UxGT("Tepelná kap. *"); + LSTR MSG_SENSOR_RESPONSIVENESS = _UxGT("Reakcia senzoru"); + LSTR MSG_SENSOR_RESPONSIVENESS_E = _UxGT("Reakcia senz. *"); + LSTR MSG_MPC_AMBIENT_XFER_COEFF = _UxGT("Koef. okolia"); + LSTR MSG_MPC_AMBIENT_XFER_COEFF_E = _UxGT("Koef. okolia *"); + LSTR MSG_MPC_AMBIENT_XFER_COEFF_FAN = _UxGT("Koef. vent."); + LSTR MSG_MPC_AMBIENT_XFER_COEFF_FAN_E = _UxGT("Koef. vent. *"); LSTR MSG_SELECT_E = _UxGT("Vybrať *"); LSTR MSG_ACC = _UxGT("Zrýchlenie"); LSTR MSG_JERK = _UxGT("Skok"); @@ -396,6 +411,11 @@ namespace Language_sk { LSTR MSG_AMAX_EN = _UxGT("Amax *"); LSTR MSG_A_RETRACT = _UxGT("A-retrakt"); LSTR MSG_A_TRAVEL = _UxGT("A-prejazd"); + LSTR MSG_INPUT_SHAPING = _UxGT("Tvarov. vstupu"); + LSTR MSG_SHAPING_ENABLE = _UxGT("Povol. tvarov. @"); + LSTR MSG_SHAPING_DISABLE = _UxGT("Zakáz. tvarov. @"); + LSTR MSG_SHAPING_FREQ = _UxGT("Frekvencia @"); + LSTR MSG_SHAPING_ZETA = _UxGT("Tlmenie @"); LSTR MSG_XY_FREQUENCY_LIMIT = _UxGT("Max. frekvencia"); LSTR MSG_XY_FREQUENCY_FEEDRATE = _UxGT("Min. posun"); LSTR MSG_STEPS_PER_MM = _UxGT("Kroky/mm"); @@ -415,6 +435,12 @@ namespace Language_sk { LSTR MSG_FILAMENT_DIAM_E = _UxGT("Priem. fil. *"); LSTR MSG_FILAMENT_UNLOAD = _UxGT("Vysunúť mm"); LSTR MSG_FILAMENT_LOAD = _UxGT("Zaviesť mm"); + LSTR MSG_SEGMENTS_PER_SECOND = _UxGT("Segmentov/sek"); + LSTR MSG_DRAW_MIN_X = _UxGT("Min. X kresby"); + LSTR MSG_DRAW_MAX_X = _UxGT("Max. X kresby"); + LSTR MSG_DRAW_MIN_Y = _UxGT("Min. Y kresby"); + LSTR MSG_DRAW_MAX_Y = _UxGT("Max. Y kresby"); + LSTR MSG_MAX_BELT_LEN = _UxGT("Max. dĺžka pásu"); LSTR MSG_ADVANCE_K = _UxGT("K pre posun"); LSTR MSG_ADVANCE_K_E = _UxGT("K pre posun *"); LSTR MSG_CONTRAST = _UxGT("Kontrast LCD"); @@ -429,7 +455,7 @@ namespace Language_sk { LSTR MSG_ERR_EEPROM_INDEX = _UxGT("Chyba: EEPROM Index"); LSTR MSG_ERR_EEPROM_VERSION = _UxGT("Chyba: Verzia EEPROM"); LSTR MSG_SETTINGS_STORED = _UxGT("Nastavenie uložené"); - LSTR MSG_MEDIA_UPDATE = _UxGT("Aktualizovať z SD"); + LSTR MSG_MEDIA_UPDATE = _UxGT("Aktualiz. z karty"); LSTR MSG_RESET_PRINTER = _UxGT("Reštart. tlačiar."); LSTR MSG_REFRESH = LCD_STR_REFRESH _UxGT("Obnoviť"); LSTR MSG_INFO_SCREEN = _UxGT("Info. obrazovka"); @@ -468,16 +494,28 @@ namespace Language_sk { LSTR MSG_PAUSE_PRINT = _UxGT("Pozastaviť tlač"); LSTR MSG_ADVANCED_PAUSE = _UxGT("Pokročil. pauza"); LSTR MSG_RESUME_PRINT = _UxGT("Obnoviť tlač"); - LSTR MSG_HOST_START_PRINT = _UxGT("Spustiť z hosta"); LSTR MSG_STOP_PRINT = _UxGT("Zastaviť tlač"); - LSTR MSG_END_LOOPS = _UxGT("Koniec opak. sluč."); - LSTR MSG_PRINTING_OBJECT = _UxGT("Tlačím objekt"); - LSTR MSG_CANCEL_OBJECT = _UxGT("Zrušiť objekt"); - LSTR MSG_CANCEL_OBJECT_N = _UxGT("Zrušiť objekt ="); LSTR MSG_OUTAGE_RECOVERY = _UxGT("Obnova po výp. nap."); - LSTR MSG_CONTINUE_PRINT_JOB = _UxGT("Pokračovať v úlohe"); - LSTR MSG_MEDIA_MENU = _UxGT("Tlačiť z SD"); - LSTR MSG_NO_MEDIA = _UxGT("Žiadna SD karta"); + #if LCD_WIDTH >= 20 || HAS_DWIN_E3V2 + LSTR MSG_HOST_START_PRINT = _UxGT("Spustiť z hosta"); + LSTR MSG_PRINTING_OBJECT = _UxGT("Tlačím objekt"); + LSTR MSG_CANCEL_OBJECT = _UxGT("Zrušiť objekt"); + LSTR MSG_CANCEL_OBJECT_N = _UxGT("Zrušiť objekt ="); + LSTR MSG_CONTINUE_PRINT_JOB = _UxGT("Pokračovať v úlohe"); + LSTR MSG_MEDIA_MENU = _UxGT("Vytlačiť z karty"); + LSTR MSG_TURN_OFF = _UxGT("Vypnite tlačiareň"); + LSTR MSG_END_LOOPS = _UxGT("Ukončiť opak. sluč."); + #else + LSTR MSG_HOST_START_PRINT = _UxGT("Spustiť z hosta"); + LSTR MSG_PRINTING_OBJECT = _UxGT("Tlačím obj."); + LSTR MSG_CANCEL_OBJECT = _UxGT("Zrušiť obj."); + LSTR MSG_CANCEL_OBJECT_N = _UxGT("Zrušiť obj. ="); + LSTR MSG_CONTINUE_PRINT_JOB = _UxGT("Pokrač. v úlohe"); + LSTR MSG_MEDIA_MENU = _UxGT("Tlač z karty"); + LSTR MSG_TURN_OFF = _UxGT("Vypnit. teraz"); + LSTR MSG_END_LOOPS = _UxGT("Ukončiť sluč."); + #endif + LSTR MSG_NO_MEDIA = _UxGT("Žiadna karta"); LSTR MSG_DWELL = _UxGT("Spím..."); LSTR MSG_USERWAIT = _UxGT("Pokrač. kliknutím..."); LSTR MSG_PRINT_PAUSED = _UxGT("Tlač pozastavená"); @@ -487,7 +525,6 @@ namespace Language_sk { LSTR MSG_PRINT_ABORTED = _UxGT("Tlač zrušená"); LSTR MSG_PRINT_DONE = _UxGT("Tlač dokončená"); LSTR MSG_PRINTER_KILLED = _UxGT("Tlačiareň zastavená!"); - LSTR MSG_TURN_OFF = _UxGT("Vypnite tlačiareň"); LSTR MSG_NO_MOVE = _UxGT("Žiadny pohyb."); LSTR MSG_KILLED = _UxGT("PRERUŠENÉ. "); LSTR MSG_STOPPED = _UxGT("ZASTAVENÉ. "); @@ -507,8 +544,10 @@ namespace Language_sk { LSTR MSG_TOOL_CHANGE = _UxGT("Výmena nástroja"); LSTR MSG_TOOL_CHANGE_ZLIFT = _UxGT("Zdvihnúť Z"); LSTR MSG_SINGLENOZZLE_PRIME_SPEED = _UxGT("Primárna rýchl."); + LSTR MSG_SINGLENOZZLE_WIPE_RETRACT = _UxGT("Očist. retrakciou"); LSTR MSG_SINGLENOZZLE_RETRACT_SPEED = _UxGT("Rýchl. retrakcie"); LSTR MSG_FILAMENT_PARK_ENABLED = _UxGT("Parkovať hlavu"); + LSTR MSG_PARK_FAILED = _UxGT("Hlava sa nedá zapark."); LSTR MSG_SINGLENOZZLE_UNRETRACT_SPEED = _UxGT("Rýchl. obnovenia"); LSTR MSG_SINGLENOZZLE_FAN_SPEED = _UxGT("Rýchlosť vent."); LSTR MSG_SINGLENOZZLE_FAN_TIME = _UxGT("Doba fúkania"); @@ -525,9 +564,14 @@ namespace Language_sk { LSTR MSG_FILAMENTUNLOAD = _UxGT("Vysunúť filament"); LSTR MSG_FILAMENTUNLOAD_E = _UxGT("Vysunúť filament *"); LSTR MSG_FILAMENTUNLOAD_ALL = _UxGT("Vysunúť všetko"); - LSTR MSG_ATTACH_MEDIA = _UxGT("Načítať SD kartu"); - LSTR MSG_CHANGE_MEDIA = _UxGT("Vymeniť SD kartu"); - LSTR MSG_RELEASE_MEDIA = _UxGT("Odpojiť SD kartu"); + #if ENABLED(MULTI_VOLUME) + LSTR MSG_ATTACH_MEDIA = _UxGT("Načítať SD kartu"); + LSTR MSG_ATTACH_USB_MEDIA = _UxGT("Načítať USB disk"); + #else + LSTR MSG_ATTACH_MEDIA = _UxGT("Načítať kartu"); + #endif + LSTR MSG_CHANGE_MEDIA = _UxGT("Vymeniť kartu"); + LSTR MSG_RELEASE_MEDIA = _UxGT("Odpojiť kartu"); LSTR MSG_ZPROBE_OUT = _UxGT("Sonda Z mimo podl."); LSTR MSG_SKEW_FACTOR = _UxGT("Faktor skosenia"); LSTR MSG_BLTOUCH = _UxGT("BLTouch"); @@ -551,7 +595,7 @@ namespace Language_sk { LSTR MSG_MANUAL_DEPLOY_TOUCHMI = _UxGT("Zasunúť TouchMI"); LSTR MSG_MANUAL_DEPLOY = _UxGT("Zasunúť sondu Z"); LSTR MSG_MANUAL_STOW = _UxGT("Vysunúť sondu Z"); - LSTR MSG_HOME_FIRST = _UxGT("Najskôr os %s%s%s domov"); + LSTR MSG_HOME_FIRST = _UxGT("Najskôr os %s domov"); LSTR MSG_ZPROBE_SETTINGS = _UxGT("Nastav. sondy"); LSTR MSG_ZPROBE_OFFSETS = _UxGT("Ofsety sondy Z"); LSTR MSG_ZPROBE_XOFFSET = _UxGT("X ofset"); @@ -609,6 +653,7 @@ namespace Language_sk { LSTR MSG_MESH_LEVELING = _UxGT("Mriežkové rovnanie"); LSTR MSG_MESH_DONE = _UxGT("Mriežka dokončená"); LSTR MSG_INFO_STATS_MENU = _UxGT("Štatistika"); + LSTR MSG_RESET_STATS = _UxGT("Vynulovať štatis.?"); LSTR MSG_INFO_BOARD_MENU = _UxGT("Info. o doske"); LSTR MSG_INFO_THERMISTOR_MENU = _UxGT("Termistory"); LSTR MSG_INFO_EXTRUDERS = _UxGT("Extrudéry"); diff --git a/Marlin/src/lcd/language/language_sv.h b/Marlin/src/lcd/language/language_sv.h index 1342ccaad764..e550e877a1b3 100644 --- a/Marlin/src/lcd/language/language_sv.h +++ b/Marlin/src/lcd/language/language_sv.h @@ -291,10 +291,9 @@ namespace Language_sv { LSTR MSG_PID_AUTOTUNE = _UxGT("PID Autojustera"); LSTR MSG_PID_AUTOTUNE_E = _UxGT("PID Autojustera *"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("PID tuning done"); - LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Autojustera misslyckad! Dålig extruder."); + LSTR MSG_PID_BAD_HEATER_ID = _UxGT("Autojustera misslyckad! Dålig extruder."); LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Autojustera misslyckad! Temperatur för hög."); LSTR MSG_PID_TIMEOUT = _UxGT("Autojustera misslyckad! Tidsgräns."); - LSTR MSG_SELECT = _UxGT("Välj"); LSTR MSG_SELECT_E = _UxGT("Välj *"); LSTR MSG_ACC = _UxGT("Accel"); LSTR MSG_JERK = _UxGT("Ryck"); @@ -453,7 +452,7 @@ namespace Language_sv { LSTR MSG_MANUAL_DEPLOY_TOUCHMI = _UxGT("Fällut TouchMI"); LSTR MSG_MANUAL_DEPLOY = _UxGT("Fällut Z-Sond"); LSTR MSG_MANUAL_STOW = _UxGT("Stuva undan Z-Sond"); - LSTR MSG_HOME_FIRST = _UxGT("Hem %s%s%s Först"); + LSTR MSG_HOME_FIRST = _UxGT("Hem %s Först"); LSTR MSG_ZPROBE_OFFSETS = _UxGT("Sond Offsets"); LSTR MSG_ZPROBE_XOFFSET = _UxGT("Sond X Offset"); LSTR MSG_ZPROBE_YOFFSET = _UxGT("Sond Y Offset"); diff --git a/Marlin/src/lcd/language/language_tr.h b/Marlin/src/lcd/language/language_tr.h index cb2766306c8e..5ff8ab7b4882 100644 --- a/Marlin/src/lcd/language/language_tr.h +++ b/Marlin/src/lcd/language/language_tr.h @@ -256,7 +256,6 @@ namespace Language_tr { LSTR MSG_LCD_OFF = _UxGT("Kapalı"); LSTR MSG_PID_AUTOTUNE = _UxGT("PID Kalibrasyon"); LSTR MSG_PID_AUTOTUNE_E = _UxGT("PID Kalibrasyon *"); - LSTR MSG_SELECT = _UxGT("Seç"); LSTR MSG_SELECT_E = _UxGT("Seç *"); LSTR MSG_ACC = _UxGT("İvme"); @@ -391,7 +390,7 @@ namespace Language_tr { LSTR MSG_MANUAL_DEPLOY_TOUCHMI = _UxGT("TouchMI Aç"); LSTR MSG_MANUAL_DEPLOY = _UxGT("Z-Probe Aç"); LSTR MSG_MANUAL_STOW = _UxGT("Z-Probe Kapat"); - LSTR MSG_HOME_FIRST = _UxGT("Önce %s%s%s Sıfırla"); + LSTR MSG_HOME_FIRST = _UxGT("Önce %s Sıfırla"); LSTR MSG_ZPROBE_OFFSETS = _UxGT("Prob Ofsetleri"); LSTR MSG_ZPROBE_XOFFSET = _UxGT("X Prob Ofset"); LSTR MSG_ZPROBE_YOFFSET = _UxGT("Y Prob Ofset"); diff --git a/Marlin/src/lcd/language/language_uk.h b/Marlin/src/lcd/language/language_uk.h index 6b4ebc79cd1e..16f3c9527866 100644 --- a/Marlin/src/lcd/language/language_uk.h +++ b/Marlin/src/lcd/language/language_uk.h @@ -387,11 +387,10 @@ namespace Language_uk { LSTR MSG_PID_AUTOTUNE = _UxGT("Автопідбір PID"); LSTR MSG_PID_AUTOTUNE_E = _UxGT("Автопідбір PID *"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("Підбір PID виконано"); - LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Збій автопідбору! Поганий екструдер."); + LSTR MSG_PID_BAD_HEATER_ID = _UxGT("Збій автопідбору! Поганий екструдер."); LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Збій автопідбору! Температура завищена."); LSTR MSG_PID_TIMEOUT = _UxGT("Збій автопідбору! Вичерпан час."); - LSTR MSG_SELECT = _UxGT("Вибрати"); LSTR MSG_SELECT_E = _UxGT("Вибрати *"); LSTR MSG_ACC = _UxGT("Прискорорення"); LSTR MSG_JERK = _UxGT("Ривок"); @@ -599,7 +598,7 @@ namespace Language_uk { LSTR MSG_MANUAL_DEPLOY_TOUCHMI = _UxGT("Установити TouchMI"); LSTR MSG_MANUAL_DEPLOY = _UxGT("Установити Z-зонд"); LSTR MSG_MANUAL_STOW = _UxGT("Завантажити Z-зонд"); - LSTR MSG_HOME_FIRST = _UxGT("Спочатку дім %s%s%s"); + LSTR MSG_HOME_FIRST = _UxGT("Спочатку дім %s"); LSTR MSG_ZPROBE_OFFSETS = _UxGT("Зміщення зонду"); LSTR MSG_ZPROBE_XOFFSET = _UxGT("Зміщення по X"); LSTR MSG_ZPROBE_YOFFSET = _UxGT("Зміщення по Y"); diff --git a/Marlin/src/lcd/language/language_vi.h b/Marlin/src/lcd/language/language_vi.h index 27c6ee11812f..575191f50b28 100644 --- a/Marlin/src/lcd/language/language_vi.h +++ b/Marlin/src/lcd/language/language_vi.h @@ -224,7 +224,6 @@ namespace Language_vi { LSTR MSG_AUTOTEMP = _UxGT("Nhiệt độ tự động"); // Autotemp LSTR MSG_LCD_ON = _UxGT("Bật"); // on LSTR MSG_LCD_OFF = _UxGT("Tắt"); // off - LSTR MSG_SELECT = _UxGT("Lựa"); // Select LSTR MSG_SELECT_E = _UxGT("Lựa *"); LSTR MSG_ACC = _UxGT("Tăng Tốc"); LSTR MSG_JERK = _UxGT("Giật"); @@ -327,7 +326,7 @@ namespace Language_vi { LSTR MSG_BLTOUCH_STOW = _UxGT("Cất BLTouch"); // Stow BLTouch LSTR MSG_MANUAL_DEPLOY = _UxGT("Đem Đầu Dò-Z"); // Deploy Z-Probe LSTR MSG_MANUAL_STOW = _UxGT("Cất Đầu Dò-Z"); // Stow Z-Probe - LSTR MSG_HOME_FIRST = _UxGT("Về nhà %s%s%s Trước"); + LSTR MSG_HOME_FIRST = _UxGT("Về nhà %s Trước"); LSTR MSG_ZPROBE_ZOFFSET = _UxGT("Đầu Dò Bù Đắp Z"); // Probe Z Offset LSTR MSG_BABYSTEP_X = _UxGT("Nhít X"); // Babystep X LSTR MSG_BABYSTEP_Y = _UxGT("Nhít Y"); diff --git a/Marlin/src/lcd/language/language_zh_CN.h b/Marlin/src/lcd/language/language_zh_CN.h index 4c5a94edcdc8..6e2864ce6f78 100644 --- a/Marlin/src/lcd/language/language_zh_CN.h +++ b/Marlin/src/lcd/language/language_zh_CN.h @@ -261,10 +261,9 @@ namespace Language_zh_CN { LSTR MSG_PID_AUTOTUNE = _UxGT("自动PID"); LSTR MSG_PID_AUTOTUNE_E = _UxGT("自动PID *"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("PID调整完成"); - LSTR MSG_PID_BAD_EXTRUDER_NUM = _UxGT("自动调失败! 坏的挤出机"); + LSTR MSG_PID_BAD_HEATER_ID = _UxGT("自动调失败! 坏的挤出机"); LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("自动调失败! 温度太高"); LSTR MSG_PID_TIMEOUT = _UxGT("自动调失败! 超时"); - LSTR MSG_SELECT = _UxGT("选择"); // "Select" LSTR MSG_SELECT_E = _UxGT("选择 *"); LSTR MSG_ACC = _UxGT("加速度"); // "Accel" acceleration LSTR MSG_JERK = _UxGT("抖动速率"); // "Jerk" @@ -420,7 +419,7 @@ namespace Language_zh_CN { LSTR MSG_MANUAL_DEPLOY_TOUCHMI = _UxGT("部署TouchMI"); LSTR MSG_MANUAL_DEPLOY = _UxGT("部署Z探针"); LSTR MSG_MANUAL_STOW = _UxGT("收好Z探针"); - LSTR MSG_HOME_FIRST = _UxGT("归位 %s%s%s 先"); // "Home ... first" + LSTR MSG_HOME_FIRST = _UxGT("归位 %s 先"); // "Home ... first" LSTR MSG_ZPROBE_OFFSETS = _UxGT("探针偏移量"); LSTR MSG_ZPROBE_XOFFSET = _UxGT("探针X偏移"); LSTR MSG_ZPROBE_YOFFSET = _UxGT("探针Y偏移"); diff --git a/Marlin/src/lcd/language/language_zh_TW.h b/Marlin/src/lcd/language/language_zh_TW.h index 2aa3554fe80f..79d4ba75a7ba 100644 --- a/Marlin/src/lcd/language/language_zh_TW.h +++ b/Marlin/src/lcd/language/language_zh_TW.h @@ -249,7 +249,6 @@ namespace Language_zh_TW { LSTR MSG_LCD_ON = _UxGT("開 "); // "On" LSTR MSG_LCD_OFF = _UxGT("關 "); // "Off" - LSTR MSG_SELECT = _UxGT("選擇"); // "Select" LSTR MSG_SELECT_E = _UxGT("選擇 *"); LSTR MSG_ACC = _UxGT("加速度"); // "Accel" acceleration LSTR MSG_JERK = _UxGT("抖動速率"); // "Jerk" @@ -370,7 +369,7 @@ namespace Language_zh_TW { LSTR MSG_BLTOUCH_STOW = _UxGT("裝載BLTouch"); // "Stow BLTouch" LSTR MSG_BLTOUCH_DEPLOY = _UxGT("部署BLTouch"); // "Deploy BLTouch" - LSTR MSG_HOME_FIRST = _UxGT("歸位 %s%s%s 先"); // "Home ... first" + LSTR MSG_HOME_FIRST = _UxGT("歸位 %s 先"); // "Home ... first" LSTR MSG_ZPROBE_OFFSETS = _UxGT("探針偏移"); //Probe Offsets LSTR MSG_ZPROBE_XOFFSET = _UxGT("探針X偏移量"); //Probe X Offset LSTR MSG_ZPROBE_YOFFSET = _UxGT("探針Y偏移量"); //Probe Y Offset diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index ff12703ca94c..91982b54801e 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -1743,9 +1743,11 @@ void MarlinUI::init() { ); } - #if LCD_WITH_BLINK && DISABLED(HAS_GRAPHICAL_TFT) - typedef void (*PrintProgress_t)(); - void MarlinUI::rotate_progress() { // Renew and redraw all enabled progress strings + #if LCD_WITH_BLINK && HAS_EXTRA_PROGRESS + + // Renew and redraw all enabled progress strings + void MarlinUI::rotate_progress() { + typedef void (*PrintProgress_t)(); const PrintProgress_t progFunc[] = { OPTITEM(SHOW_PROGRESS_PERCENT, drawPercent) OPTITEM(SHOW_ELAPSED_TIME, drawElapsed) @@ -1760,7 +1762,8 @@ void MarlinUI::init() { (*progFunc[i])(); } } - #endif + + #endif // LCD_WITH_BLINK && HAS_EXTRA_PROGRESS #endif // HAS_PRINT_PROGRESS diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index ec19f8bd34ba..827a71a29dc3 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -334,7 +334,7 @@ class MarlinUI { FORCE_INLINE static uint16_t get_progress_permyriad() { return _get_progress(); } #endif static uint8_t get_progress_percent() { return uint8_t(_get_progress() / (PROGRESS_SCALE)); } - #if LCD_WITH_BLINK + #if LCD_WITH_BLINK && HAS_EXTRA_PROGRESS #if ENABLED(SHOW_PROGRESS_PERCENT) static void drawPercent(); #endif @@ -348,6 +348,8 @@ class MarlinUI { static void drawInter(); #endif static void rotate_progress(); + #else + static void rotate_progress() {} #endif #else static constexpr uint8_t get_progress_percent() { return 0; } diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 8e1963afe593..0e24d0ed8087 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -41,7 +41,7 @@ #include "../../module/probe.h" #endif -#if ANY(PIDTEMP, PIDTEMPBED, PIDTEMPCHAMBER) +#if HAS_PID_HEATING #include "../../module/temperature.h" #endif @@ -277,10 +277,10 @@ void menu_backlash(); // #if SHOW_MENU_ADVANCED_TEMPERATURE - #if ENABLED(MPC_EDIT_MENU) - #define MPC_EDIT_DEFS(N) \ - MPC_t &c = thermalManager.temp_hotend[N].constants; \ - TERN_(MPC_INCLUDE_FAN, editable.decimal = c.ambient_xfer_coeff_fan0 + c.fan255_adjustment) + #if BOTH(MPC_EDIT_MENU, MPC_INCLUDE_FAN) + #define MPC_EDIT_DEFS(N) editable.decimal = thermalManager.temp_hotend[N].fanCoefficient() + #else + #define MPC_EDIT_DEFS(...) #endif void menu_advanced_temperature() { @@ -370,17 +370,17 @@ void menu_backlash(); #if ENABLED(MPC_EDIT_MENU) #define _MPC_EDIT_ITEMS(N) \ - EDIT_ITEM_FAST_N(float31sign, N, MSG_MPC_POWER_E, &c.heater_power, 1, 200); \ - EDIT_ITEM_FAST_N(float31sign, N, MSG_MPC_BLOCK_HEAT_CAPACITY_E, &c.block_heat_capacity, 0, 40); \ - EDIT_ITEM_FAST_N(float43, N, MSG_SENSOR_RESPONSIVENESS_E, &c.sensor_responsiveness, 0, 1); \ - EDIT_ITEM_FAST_N(float43, N, MSG_MPC_AMBIENT_XFER_COEFF_E, &c.ambient_xfer_coeff_fan0, 0, 1) + EDIT_ITEM_FAST_N(float31sign, N, MSG_MPC_POWER_E, &mpc.heater_power, 1, 200); \ + EDIT_ITEM_FAST_N(float31sign, N, MSG_MPC_BLOCK_HEAT_CAPACITY_E, &mpc.block_heat_capacity, 0, 40); \ + EDIT_ITEM_FAST_N(float43, N, MSG_SENSOR_RESPONSIVENESS_E, &mpc.sensor_responsiveness, 0, 1); \ + EDIT_ITEM_FAST_N(float43, N, MSG_MPC_AMBIENT_XFER_COEFF_E, &mpc.ambient_xfer_coeff_fan0, 0, 1) #if ENABLED(MPC_INCLUDE_FAN) #define MPC_EDIT_ITEMS(N) \ + MPC_t &mpc = thermalManager.temp_hotend[MenuItemBase::itemIndex].mpc; \ _MPC_EDIT_ITEMS(N); \ EDIT_ITEM_FAST_N(float43, N, MSG_MPC_AMBIENT_XFER_COEFF_FAN_E, &editable.decimal, 0, 1, []{ \ - MPC_t &c = thermalManager.temp_hotend[MenuItemBase::itemIndex].constants; \ - c.fan255_adjustment = editable.decimal - c.ambient_xfer_coeff_fan0; \ + thermalManager.temp_hotend[MenuItemBase::itemIndex].applyFanAdjustment(editable.decimal); \ }) #else #define MPC_EDIT_ITEMS _MPC_EDIT_ITEMS diff --git a/Marlin/src/lcd/menu/menu_bed_leveling.cpp b/Marlin/src/lcd/menu/menu_bed_leveling.cpp index 294666e35621..9505a82dd77c 100644 --- a/Marlin/src/lcd/menu/menu_bed_leveling.cpp +++ b/Marlin/src/lcd/menu/menu_bed_leveling.cpp @@ -68,10 +68,12 @@ // void _lcd_level_bed_done() { if (!ui.wait_for_move) { - #if Z_AFTER_PROBING > 0 && DISABLED(MESH_BED_LEVELING) - // Display "Done" screen and wait for moves to complete - line_to_z(Z_AFTER_PROBING); - ui.synchronize(GET_TEXT_F(MSG_LEVEL_BED_DONE)); + #if DISABLED(MESH_BED_LEVELING) && defined(Z_AFTER_PROBING) + if (Z_AFTER_PROBING) { + // Display "Done" screen and wait for moves to complete + line_to_z(Z_AFTER_PROBING); + ui.synchronize(GET_TEXT_F(MSG_LEVEL_BED_DONE)); + } #endif ui.goto_previous_screen_no_defer(); ui.completion_feedback(); diff --git a/Marlin/src/lcd/menu/menu_delta_calibrate.cpp b/Marlin/src/lcd/menu/menu_delta_calibrate.cpp index ae935e53c446..94663744ea23 100644 --- a/Marlin/src/lcd/menu/menu_delta_calibrate.cpp +++ b/Marlin/src/lcd/menu/menu_delta_calibrate.cpp @@ -92,7 +92,7 @@ void _man_probe_pt(const xy_pos_t &xy) { } void _goto_tower_a(const_float_t a) { - float dcr = DELTA_PRINTABLE_RADIUS - PROBING_MARGIN; + float dcr = PRINTABLE_RADIUS - PROBING_MARGIN; TERN_(HAS_PROBE_XY_OFFSET, dcr -= HYPOT(probe.offset_xy.x, probe.offset_xy.y)); TERN_(HAS_DELTA_SENSORLESS_PROBING, dcr *= sensorless_radius_factor); xy_pos_t tower_vec = { cos(RADIANS(a)), sin(RADIANS(a)) }; diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index b25dd73f26e7..6ce75d59aeb3 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -68,7 +68,7 @@ void lcd_move_axis(const AxisEnum axis) { // This assumes the center is 0,0 #if ENABLED(DELTA) if (axis != Z_AXIS) { - max = SQRT(sq((float)(DELTA_PRINTABLE_RADIUS)) - sq(current_position[Y_AXIS - axis])); // (Y_AXIS - axis) == the other axis + max = SQRT(sq(float(PRINTABLE_RADIUS)) - sq(current_position[Y_AXIS - axis])); // (Y_AXIS - axis) == the other axis min = -max; } #endif @@ -246,25 +246,15 @@ void menu_move() { #endif } #elif EXTRUDERS == 3 - if (active_extruder < 2) { - if (active_extruder) - GCODES_ITEM_N(0, MSG_SELECT_E, F("T0")); - else - GCODES_ITEM_N(1, MSG_SELECT_E, F("T1")); - } + if (active_extruder < 2) + GCODES_ITEM_N(1 - active_extruder, MSG_SELECT_E, active_extruder ? F("T0") : F("T1")); #else - if (active_extruder) - GCODES_ITEM_N(0, MSG_SELECT_E, F("T0")); - else - GCODES_ITEM_N(1, MSG_SELECT_E, F("T1")); + GCODES_ITEM_N(1 - active_extruder, MSG_SELECT_E, active_extruder ? F("T0") : F("T1")); #endif #elif ENABLED(DUAL_X_CARRIAGE) - if (active_extruder) - GCODES_ITEM_N(0, MSG_SELECT_E, F("T0")); - else - GCODES_ITEM_N(1, MSG_SELECT_E, F("T1")); + GCODES_ITEM_N(1 - active_extruder, MSG_SELECT_E, active_extruder ? F("T0") : F("T1")); #endif @@ -370,6 +360,13 @@ void menu_motion() { #endif // + // Pen up/down menu + // + #if ENABLED(PEN_UP_DOWN_MENU) + GCODES_ITEM(MSG_MANUAL_PENUP, F("M280 P0 S90")); + GCODES_ITEM(MSG_MANUAL_PENDOWN, F("M280 P0 S50")); + #endif + // Probe Offset Wizard // #if ENABLED(PROBE_OFFSET_WIZARD) diff --git a/Marlin/src/lcd/tft/tft.h b/Marlin/src/lcd/tft/tft.h index 6df4c22d5191..7dc3996148ab 100644 --- a/Marlin/src/lcd/tft/tft.h +++ b/Marlin/src/lcd/tft/tft.h @@ -37,22 +37,6 @@ #define ENDIAN_COLOR(C) (C) #endif -#if HAS_UI_320x240 - #define TFT_WIDTH 320 - #define TFT_HEIGHT 240 -#elif HAS_UI_480x320 - #define TFT_WIDTH 480 - #define TFT_HEIGHT 320 -#elif HAS_UI_480x272 - #define TFT_WIDTH 480 - #define TFT_HEIGHT 272 -#elif HAS_UI_1024x600 - #define TFT_WIDTH 1024 - #define TFT_HEIGHT 600 -#else - #error "Unsupported display resolution!" -#endif - #ifndef TFT_BUFFER_SIZE #ifdef STM32F103xB #define TFT_BUFFER_SIZE 1024 diff --git a/Marlin/src/lcd/tft/tft_color.h b/Marlin/src/lcd/tft/tft_color.h index a8668179e579..07518028aa80 100644 --- a/Marlin/src/lcd/tft/tft_color.h +++ b/Marlin/src/lcd/tft/tft_color.h @@ -178,3 +178,16 @@ #ifndef COLOR_KILL_SCREEN_TEXT #define COLOR_KILL_SCREEN_TEXT COLOR_WHITE #endif + +#ifndef E_BTN_COLOR + #define E_BTN_COLOR COLOR_YELLOW +#endif +#ifndef X_BTN_COLOR + #define X_BTN_COLOR COLOR_CORAL_RED +#endif +#ifndef Y_BTN_COLOR + #define Y_BTN_COLOR COLOR_VIVID_GREEN +#endif +#ifndef Z_BTN_COLOR + #define Z_BTN_COLOR COLOR_LIGHT_BLUE +#endif diff --git a/Marlin/src/lcd/tft/tft_font.h b/Marlin/src/lcd/tft/tft_font.h index 5ed5f8380cc5..6c8838ed7c48 100644 --- a/Marlin/src/lcd/tft/tft_font.h +++ b/Marlin/src/lcd/tft/tft_font.h @@ -37,5 +37,4 @@ extern const uint8_t SYMBOLS_FONT_NAME[]; extern const uint8_t EXTRA_FONT_NAME[]; #endif - #endif // HAS_GRAPHICAL_TFT diff --git a/Marlin/src/lcd/tft/ui_1024x600.cpp b/Marlin/src/lcd/tft/ui_1024x600.cpp index 585aef05694e..771f12d89897 100644 --- a/Marlin/src/lcd/tft/ui_1024x600.cpp +++ b/Marlin/src/lcd/tft/ui_1024x600.cpp @@ -592,11 +592,6 @@ struct MotionAxisState { MotionAxisState motionAxisState; -#define E_BTN_COLOR COLOR_YELLOW -#define X_BTN_COLOR COLOR_CORAL_RED -#define Y_BTN_COLOR COLOR_VIVID_GREEN -#define Z_BTN_COLOR COLOR_LIGHT_BLUE - #define BTN_WIDTH 64 #define BTN_HEIGHT 52 #define X_MARGIN 20 @@ -675,12 +670,10 @@ static void drawAxisValue(const AxisEnum axis) { static void moveAxis(const AxisEnum axis, const int8_t direction) { quick_feedback(); - #if ENABLED(PREVENT_COLD_EXTRUSION) - if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) { - drawMessage(F("Too cold")); - return; - } - #endif + if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) { + drawMessage(F("Too cold")); + return; + } const float diff = motionAxisState.currentStepSize * direction; @@ -700,12 +693,12 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { probe.offset.z = new_offs; else TERN(BABYSTEP_HOTEND_Z_OFFSET, hotend_offset[active_extruder].z = new_offs, NOOP); - drawMessage(""); // clear the error + drawMessage(F("")); // clear the error drawAxisValue(axis); } - else { + else drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS)); - } + #elif HAS_BED_PROBE // only change probe.offset.z probe.offset.z += diff; @@ -717,9 +710,9 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { current_position[axis] = Z_PROBE_OFFSET_RANGE_MAX; drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS)); } - else { - drawMessage(""); // clear the error - } + else + drawMessage(F("")); // clear the error + drawAxisValue(axis); #endif return; @@ -734,7 +727,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { // This assumes the center is 0,0 #if ENABLED(DELTA) if (axis != Z_AXIS && axis != E_AXIS) { - max = SQRT(sq((float)(DELTA_PRINTABLE_RADIUS)) - sq(current_position[Y_AXIS - axis])); // (Y_AXIS - axis) == the other axis + max = SQRT(sq(float(PRINTABLE_RADIUS)) - sq(current_position[Y_AXIS - axis])); // (Y_AXIS - axis) == the other axis min = -max; } #endif @@ -765,10 +758,8 @@ static void z_minus() { moveAxis(Z_AXIS, -1); } #if ENABLED(TOUCH_SCREEN) static void e_select() { - motionAxisState.e_selection++; - if (motionAxisState.e_selection >= EXTRUDERS) { + if (++motionAxisState.e_selection >= EXTRUDERS) motionAxisState.e_selection = 0; - } quick_feedback(); drawCurESelection(); @@ -810,8 +801,8 @@ static void disable_steppers() { } static void drawBtn(int x, int y, const char *label, intptr_t data, MarlinImage img, uint16_t bgColor, bool enabled = true) { - uint16_t width = Images[imgBtn52Rounded].width; - uint16_t height = Images[imgBtn52Rounded].height; + uint16_t width = Images[imgBtn52Rounded].width, + height = Images[imgBtn52Rounded].height; if (!enabled) bgColor = COLOR_CONTROL_DISABLED; diff --git a/Marlin/src/lcd/tft/ui_1024x600.h b/Marlin/src/lcd/tft/ui_1024x600.h index 855b0db865f9..c6b5d9f85ec1 100644 --- a/Marlin/src/lcd/tft/ui_1024x600.h +++ b/Marlin/src/lcd/tft/ui_1024x600.h @@ -35,15 +35,15 @@ #define MENU_ITEM_ICON_Y 5 #define MENU_ITEM_ICON_SPACE 42 +#define MENU_ITEM_HEIGHT 43 +#define MENU_LINE_HEIGHT (MENU_ITEM_HEIGHT + 2) + #if (TFT_FONT == NOTOSANS) || (TFT_FONT == HELVETICA) #define FONT_SIZE 19 #elif TFT_FONT == UNIFONT #define FONT_SIZE 20 #endif -#define MENU_ITEM_HEIGHT 43 #define FONT_LINE_HEIGHT 34 -#define MENU_LINE_HEIGHT (MENU_ITEM_HEIGHT + 2) - #include "tft_font.h" diff --git a/Marlin/src/lcd/tft/ui_320x240.cpp b/Marlin/src/lcd/tft/ui_320x240.cpp index a7c49241b473..76cce4dad14e 100644 --- a/Marlin/src/lcd/tft/ui_320x240.cpp +++ b/Marlin/src/lcd/tft/ui_320x240.cpp @@ -49,9 +49,11 @@ void MarlinUI::tft_idle() { #if ENABLED(TOUCH_SCREEN) if (TERN0(HAS_TOUCH_SLEEP, lcd_sleep_task())) return; if (draw_menu_navigation) { - add_control(48, 206, PAGE_UP, imgPageUp, encoderTopLine > 0); - add_control(240, 206, PAGE_DOWN, imgPageDown, encoderTopLine + LCD_HEIGHT < screen_items); - add_control(144, 206, BACK, imgBack); + constexpr uint16_t cx = TERN(TFT_COLOR_UI_PORTRAIT, 16, 48), + cy = TERN(TFT_COLOR_UI_PORTRAIT, 286, 206); + add_control(cx, cy, PAGE_UP, imgPageUp, encoderTopLine > 0); + add_control(cx + 192, cy, PAGE_DOWN, imgPageDown, encoderTopLine + LCD_HEIGHT < screen_items); + add_control(cx + 96, cy, BACK, imgBack); draw_menu_navigation = false; } #endif @@ -97,19 +99,19 @@ void MarlinUI::draw_kill_screen() { tft.queue.reset(); tft.fill(0, 0, TFT_WIDTH, TFT_HEIGHT, COLOR_KILL_SCREEN_BG); - tft.canvas(0, 60, TFT_WIDTH, 24); + tft.canvas(0, 60, TFT_WIDTH, FONT_LINE_HEIGHT); tft.set_background(COLOR_KILL_SCREEN_BG); tft_string.set(status_message); tft_string.trim(); tft.add_text(tft_string.center(TFT_WIDTH), 0, COLOR_KILL_SCREEN_TEXT, tft_string); - tft.canvas(0, 120, TFT_WIDTH, 24); + tft.canvas(0, 120, TFT_WIDTH, FONT_LINE_HEIGHT); tft.set_background(COLOR_KILL_SCREEN_BG); tft_string.set(GET_TEXT(MSG_HALTED)); tft_string.trim(); tft.add_text(tft_string.center(TFT_WIDTH), 0, COLOR_KILL_SCREEN_TEXT, tft_string); - tft.canvas(0, 160, TFT_WIDTH, 24); + tft.canvas(0, 160, TFT_WIDTH, FONT_LINE_HEIGHT); tft.set_background(COLOR_KILL_SCREEN_BG); tft_string.set(GET_TEXT(MSG_PLEASE_RESET)); tft_string.trim(); @@ -185,13 +187,13 @@ void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) { tft_string.set(i16tostr3rj(currentTemperature)); tft_string.add(LCD_STR_DEGREE); tft_string.trim(); - tft.add_text(tft_string.center(64) + 2, 69 + tft_string.vcenter(24), Color, tft_string); + tft.add_text(tft_string.center(64) + 2, 69 + tft_string.vcenter(FONT_LINE_HEIGHT), Color, tft_string); if (targetTemperature >= 0) { tft_string.set(i16tostr3rj(targetTemperature)); tft_string.add(LCD_STR_DEGREE); tft_string.trim(); - tft.add_text(tft_string.center(64) + 2, 5 + tft_string.vcenter(24), Color, tft_string); + tft.add_text(tft_string.center(64) + 2, 5 + tft_string.vcenter(FONT_LINE_HEIGHT), Color, tft_string); } } @@ -214,7 +216,7 @@ void draw_fan_status(uint16_t x, uint16_t y, const bool blink) { tft_string.set(ui8tostr4pctrj(thermalManager.fan_speed[0])); tft_string.trim(); - tft.add_text(tft_string.center(64) + 6, 69 + tft_string.vcenter(24), COLOR_FAN, tft_string); + tft.add_text(tft_string.center(64) + 6, 69 + tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_FAN, tft_string); } void MarlinUI::draw_status_screen() { @@ -226,7 +228,7 @@ void MarlinUI::draw_status_screen() { uint16_t i, x, y = TFT_STATUS_TOP_Y; for (i = 0 ; i < ITEMS_COUNT; i++) { - x = (320 / ITEMS_COUNT - 64) / 2 + (320 * i / ITEMS_COUNT); + x = (TFT_WIDTH / ITEMS_COUNT - 64) / 2 + (TFT_WIDTH * i / ITEMS_COUNT); switch (i) { #ifdef ITEM_E0 case ITEM_E0: draw_heater_status(x, y, H_E0); break; @@ -253,33 +255,60 @@ void MarlinUI::draw_status_screen() { } // coordinates - tft.canvas(4, 103, 312, 24); + tft.canvas(4, 103, + #if ENABLED(TFT_COLOR_UI_PORTRAIT) + 232, FONT_LINE_HEIGHT * 2 + #else + 312, FONT_LINE_HEIGHT + #endif + ); tft.set_background(COLOR_BACKGROUND); - tft.add_rectangle(0, 0, 312, 24, COLOR_AXIS_HOMED); + tft.add_rectangle(0, 0, + #if ENABLED(TFT_COLOR_UI_PORTRAIT) + 232, FONT_LINE_HEIGHT * 2 + #else + 312, FONT_LINE_HEIGHT + #endif + , COLOR_AXIS_HOMED + ); if (TERN0(LCD_SHOW_E_TOTAL, printingIsActive())) { #if ENABLED(LCD_SHOW_E_TOTAL) - tft.add_text( 10, tft_string.vcenter(24), COLOR_AXIS_HOMED , "E"); + tft.add_text( 10, tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED , "E"); const uint8_t escale = e_move_accumulator >= 100000.0f ? 10 : 1; // After 100m switch to cm tft_string.set(ftostr4sign(e_move_accumulator / escale)); tft_string.add(escale == 10 ? 'c' : 'm'); tft_string.add('m'); - tft.add_text(127 - tft_string.width(), tft_string.vcenter(24), COLOR_AXIS_HOMED, tft_string); + tft.add_text(127 - tft_string.width(), tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED, tft_string); #endif } else { - tft.add_text( 10, tft_string.vcenter(24), COLOR_AXIS_HOMED , "X"); + tft.add_text(TERN(TFT_COLOR_UI_PORTRAIT, 32, 10), tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED , "X"); const bool nhx = axis_should_home(X_AXIS); tft_string.set(blink && nhx ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x))); - tft.add_text( 68 - tft_string.width(), tft_string.vcenter(24), nhx ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string); + tft.add_text( + #if ENABLED(TFT_COLOR_UI_PORTRAIT) + 32 - tft_string.width() / 2, FONT_LINE_HEIGHT + tft_string.vcenter(FONT_LINE_HEIGHT), + #else + 68 - tft_string.width(), tft_string.vcenter(FONT_LINE_HEIGHT), + #endif + nhx ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string + ); - tft.add_text(127, tft_string.vcenter(24), COLOR_AXIS_HOMED , "Y"); + tft.add_text(TERN(TFT_COLOR_UI_PORTRAIT, 110, 127), tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED , "Y"); const bool nhy = axis_should_home(Y_AXIS); tft_string.set(blink && nhy ? "?" : ftostr4sign(LOGICAL_Y_POSITION(current_position.y))); - tft.add_text(185 - tft_string.width(), tft_string.vcenter(24), nhy ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string); + tft.add_text( + #if ENABLED(TFT_COLOR_UI_PORTRAIT) + 110 - tft_string.width() / 2, FONT_LINE_HEIGHT + tft_string.vcenter(FONT_LINE_HEIGHT), + #else + 185 - tft_string.width(), tft_string.vcenter(FONT_LINE_HEIGHT), + #endif + nhy ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string + ); } - tft.add_text(219, tft_string.vcenter(24), COLOR_AXIS_HOMED , "Z"); + tft.add_text(TERN(TFT_COLOR_UI_PORTRAIT, 192, 219), tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED , "Z"); const bool nhz = axis_should_home(Z_AXIS); uint16_t offset = 25; if (blink && nhz) @@ -293,61 +322,138 @@ void MarlinUI::draw_status_screen() { tft_string.set(ftostr52sp(z)); offset -= tft_string.width(); } - tft.add_text(301 - tft_string.width() - offset, tft_string.vcenter(24), nhz ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string); - TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 0, 103, 312, 24)); + tft.add_text( + #if ENABLED(TFT_COLOR_UI_PORTRAIT) + 192 - tft_string.width() / 2, FONT_LINE_HEIGHT + tft_string.vcenter(FONT_LINE_HEIGHT), + #else + 301 - tft_string.width() - offset, tft_string.vcenter(FONT_LINE_HEIGHT), + #endif + nhz ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string); + TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 0, 103, + #if ENABLED(TFT_COLOR_UI_PORTRAIT) + 232, FONT_LINE_HEIGHT * 2 + #else + 312, FONT_LINE_HEIGHT + #endif + )); // feed rate - tft.canvas(70, 136, 84, 32); + tft.canvas( + #if ENABLED(TFT_COLOR_UI_PORTRAIT) + 30, 172, 80 + #else + 70, 136, 84 + #endif + , 32 + ); tft.set_background(COLOR_BACKGROUND); uint16_t color = feedrate_percentage == 100 ? COLOR_RATE_100 : COLOR_RATE_ALTERED; tft.add_image(0, 0, imgFeedRate, color); tft_string.set(i16tostr3rj(feedrate_percentage)); tft_string.add('%'); tft.add_text(32, tft_string.vcenter(30), color , tft_string); - TERN_(TOUCH_SCREEN, touch.add_control(FEEDRATE, 70, 136, 84, 32)); + TERN_(TOUCH_SCREEN, touch.add_control(FEEDRATE, + #if ENABLED(TFT_COLOR_UI_PORTRAIT) + 30, 172, 80 + #else + 70, 136, 84 + #endif + , 32 + )); // flow rate - tft.canvas(170, 136, 84, 32); + tft.canvas( + #if ENABLED(TFT_COLOR_UI_PORTRAIT) + 140, 172, 80 + #else + 170, 136, 84 + #endif + , 32 + ); tft.set_background(COLOR_BACKGROUND); color = planner.flow_percentage[0] == 100 ? COLOR_RATE_100 : COLOR_RATE_ALTERED; tft.add_image(0, 0, imgFlowRate, color); tft_string.set(i16tostr3rj(planner.flow_percentage[active_extruder])); tft_string.add('%'); tft.add_text(32, tft_string.vcenter(30), color , tft_string); - TERN_(TOUCH_SCREEN, touch.add_control(FLOWRATE, 170, 136, 84, 32, active_extruder)); + TERN_(TOUCH_SCREEN, touch.add_control(FLOWRATE, + #if ENABLED(TFT_COLOR_UI_PORTRAIT) + 140, 172, 80 + #else + 170, 136, 84 + #endif + , 32, active_extruder + )); // print duration char buffer[14]; duration_t elapsed = print_job_timer.duration(); elapsed.toDigital(buffer); - tft.canvas(96, 173, 128, 24); + tft.canvas( + #if ENABLED(TFT_COLOR_UI_PORTRAIT) + 56, 256, 128 + #else + 96, 173, 128 + #endif + , FONT_LINE_HEIGHT + ); tft.set_background(COLOR_BACKGROUND); tft_string.set(buffer); - tft.add_text(tft_string.center(128), tft_string.vcenter(24), COLOR_PRINT_TIME, tft_string); + tft.add_text(tft_string.center(128), tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_PRINT_TIME, tft_string); // progress bar const uint8_t progress = ui.get_progress_percent(); - tft.canvas(4, 198, 312, 9); + tft.canvas( + #if ENABLED(TFT_COLOR_UI_PORTRAIT) + 4, 278, 232 + #else + 4, 198, 312 + #endif + , 9 + ); tft.set_background(COLOR_PROGRESS_BG); - tft.add_rectangle(0, 0, 312, 9, COLOR_PROGRESS_FRAME); + tft.add_rectangle(0, 0, + #if ENABLED(TFT_COLOR_UI_PORTRAIT) + 232, 9 + #else + 312, 9 + #endif + , COLOR_PROGRESS_FRAME + ); if (progress) - tft.add_bar(1, 1, (310 * progress) / 100, 7, COLOR_PROGRESS_BAR); + tft.add_bar(1, 1, ((TFT_WIDTH - 10) * progress) / 100, 7, COLOR_PROGRESS_BAR); // status message - tft.canvas(0, 212, 320, 24); + tft.canvas( + #if ENABLED(TFT_COLOR_UI_PORTRAIT) + 0, 296, 240 + #else + 0, 212, 320 + #endif + , FONT_LINE_HEIGHT + ); tft.set_background(COLOR_BACKGROUND); tft_string.set(status_message); tft_string.trim(); - tft.add_text(tft_string.center(TFT_WIDTH), tft_string.vcenter(24), COLOR_STATUS_MESSAGE, tft_string); + tft.add_text(tft_string.center(TFT_WIDTH), tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_STATUS_MESSAGE, tft_string); #if ENABLED(TOUCH_SCREEN) - add_control(256, 130, menu_main, imgSettings); + { + add_control( + #if ENABLED(TFT_COLOR_UI_PORTRAIT) + 176, 210 + #else + 256, 130 + #endif + , menu_main, imgSettings + ); #if ENABLED(SDSUPPORT) const bool cm = card.isMounted(), pa = printingIsActive(); - add_control(0, 130, menu_media, imgSD, cm && !pa, COLOR_CONTROL_ENABLED, cm && pa ? COLOR_BUSY : COLOR_CONTROL_DISABLED); + add_control(0, TERN(TFT_COLOR_UI_PORTRAIT, 210, 130), menu_media, imgSD, cm && !pa, COLOR_CONTROL_ENABLED, cm && pa ? COLOR_BUSY : COLOR_CONTROL_DISABLED); #endif - #endif + } // (sublime) + #endif // TOUCH_SCREEN } // Low-level draw_edit_screen can be used to draw an edit screen from anyplace @@ -412,9 +518,9 @@ void MenuEditItemBase::draw_edit_screen(FSTR_P const fstr, const char * const va void TFT::draw_edit_screen_buttons() { #if ENABLED(TOUCH_SCREEN) - add_control(32, TFT_HEIGHT - 64, DECREASE, imgDecrease); - add_control(224, TFT_HEIGHT - 64, INCREASE, imgIncrease); - add_control(128, TFT_HEIGHT - 64, CLICK, imgConfirm); + add_control(TERN(TFT_COLOR_UI_PORTRAIT, 16, 32), TFT_HEIGHT - 64, DECREASE, imgDecrease); + add_control(TERN(TFT_COLOR_UI_PORTRAIT, 172, 224), TFT_HEIGHT - 64, INCREASE, imgIncrease); + add_control(TERN(TFT_COLOR_UI_PORTRAIT, 96, 128), TFT_HEIGHT - 64, CLICK, imgConfirm); #endif } @@ -443,8 +549,8 @@ void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, con tft.add_text(tft_string.center(TFT_WIDTH), MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string); } #if ENABLED(TOUCH_SCREEN) - if (no) add_control( 48, TFT_HEIGHT - 64, CANCEL, imgCancel, true, yesno ? HALF(COLOR_CONTROL_CANCEL) : COLOR_CONTROL_CANCEL); - if (yes) add_control(208, TFT_HEIGHT - 64, CONFIRM, imgConfirm, true, yesno ? COLOR_CONTROL_CONFIRM : HALF(COLOR_CONTROL_CONFIRM)); + if (no) add_control(TERN(TFT_COLOR_UI_PORTRAIT, 32, 48), TFT_HEIGHT - 64, CANCEL, imgCancel, true, yesno ? HALF(COLOR_CONTROL_CANCEL) : COLOR_CONTROL_CANCEL); + if (yes) add_control(TERN(TFT_COLOR_UI_PORTRAIT, 172, 208), TFT_HEIGHT - 64, CONFIRM, imgConfirm, true, yesno ? COLOR_CONTROL_CONFIRM : HALF(COLOR_CONTROL_CONFIRM)); #endif } @@ -568,11 +674,6 @@ struct MotionAxisState { MotionAxisState motionAxisState; -#define E_BTN_COLOR COLOR_YELLOW -#define X_BTN_COLOR COLOR_CORAL_RED -#define Y_BTN_COLOR COLOR_VIVID_GREEN -#define Z_BTN_COLOR COLOR_LIGHT_BLUE - #define BTN_WIDTH 48 #define BTN_HEIGHT 39 #define X_MARGIN 15 @@ -625,9 +726,16 @@ static void drawCurESelection() { } static void drawMessage(PGM_P const msg) { - tft.canvas(X_MARGIN, TFT_HEIGHT - Y_MARGIN - 29, (TFT_WIDTH / 2) - (BTN_WIDTH / 2) - X_MARGIN, 20); + tft.canvas(X_MARGIN, + #if ENABLED(TFT_COLOR_UI_PORTRAIT) + TFT_HEIGHT - 2 * BTN_HEIGHT, TFT_WIDTH - X_MARGIN + #else + TFT_HEIGHT - Y_MARGIN - 29, (TFT_WIDTH / 2) - (BTN_WIDTH / 2) - X_MARGIN + #endif + , FONT_LINE_HEIGHT + ); tft.set_background(COLOR_BACKGROUND); - tft.add_text(0, 0, COLOR_YELLOW, msg); + tft.add_text(0, 0, COLOR_STATUS_MESSAGE, msg); } static void drawMessage(FSTR_P const fmsg) { drawMessage(FTOP(fmsg)); } @@ -646,7 +754,7 @@ static void drawAxisValue(const AxisEnum axis) { case E_AXIS: pos = motionAxisState.eValuePos; color = E_BTN_COLOR; break; default: return; } - tft.canvas(pos.x, pos.y, BTN_WIDTH + X_MARGIN, 20); + tft.canvas(pos.x, pos.y, BTN_WIDTH + X_MARGIN, FONT_LINE_HEIGHT); tft.set_background(COLOR_BACKGROUND); tft_string.set(ftostr52sp(value)); tft.add_text(0, 0, color, tft_string); @@ -655,12 +763,10 @@ static void drawAxisValue(const AxisEnum axis) { static void moveAxis(const AxisEnum axis, const int8_t direction) { quick_feedback(); - #if ENABLED(PREVENT_COLD_EXTRUSION) - if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) { - drawMessage(F("Too cold")); - return; - } - #endif + if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) { + drawMessage(F("Too cold")); + return; + } const float diff = motionAxisState.currentStepSize * direction; @@ -714,7 +820,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { // This assumes the center is 0,0 #if ENABLED(DELTA) if (axis != Z_AXIS && axis != E_AXIS) { - max = SQRT(sq((float)(DELTA_PRINTABLE_RADIUS)) - sq(current_position[Y_AXIS - axis])); // (Y_AXIS - axis) == the other axis + max = SQRT(sq(float(PRINTABLE_RADIUS)) - sq(current_position[Y_AXIS - axis])); // (Y_AXIS - axis) == the other axis min = -max; } #endif @@ -745,10 +851,8 @@ static void z_minus() { moveAxis(Z_AXIS, -1); } #if ENABLED(TOUCH_SCREEN) static void e_select() { - motionAxisState.e_selection++; - if (motionAxisState.e_selection >= EXTRUDERS) { + if (++motionAxisState.e_selection >= EXTRUDERS) motionAxisState.e_selection = 0; - } quick_feedback(); drawCurESelection(); @@ -773,16 +877,17 @@ static void z_minus() { moveAxis(Z_AXIS, -1); } quick_feedback(); drawCurStepValue(); } -#endif -#if BOTH(HAS_BED_PROBE, TOUCH_SCREEN) - static void z_select() { - motionAxisState.z_selection *= -1; - quick_feedback(); - drawCurZSelection(); - drawAxisValue(Z_AXIS); - } -#endif + #if HAS_BED_PROBE + static void z_select() { + motionAxisState.z_selection *= -1; + quick_feedback(); + drawCurZSelection(); + drawAxisValue(Z_AXIS); + } + #endif + +#endif // TOUCH_SCREEN static void disable_steppers() { quick_feedback(); @@ -805,12 +910,12 @@ static void drawBtn(int x, int y, const char *label, intptr_t data, MarlinImage tft_string.trim(); tft.add_text(tft_string.center(width), height / 2 - tft_string.font_height() / 2, bgColor, tft_string); } - else { + else tft.add_image(0, 0, img, bgColor, COLOR_BACKGROUND, COLOR_DARKGREY); - } TERN_(HAS_TFT_XPT2046, if (enabled) touch.add_control(BUTTON, x, y, width, height, data)); } + void MarlinUI::move_axis_screen() { // Reset defer_status_screen(true); @@ -827,93 +932,187 @@ void MarlinUI::move_axis_screen() { if (busy && ENABLED(BABYSTEP_ZPROBE_OFFSET)) motionAxisState.z_selection = Z_SELECTION_Z_PROBE; - // ROW 1 -> E- Y- CurY Z+ - int x = X_MARGIN, y = Y_MARGIN, spacing = 0; + #if ENABLED(TFT_COLOR_UI_PORTRAIT) - drawBtn(x, y, "E+", (intptr_t)e_plus, imgUp, E_BTN_COLOR, !busy); + // ROW 1 -> E+ Y+ Z+ + int x = X_MARGIN, y = Y_MARGIN, spacing = 0; - spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2; - x += BTN_WIDTH + spacing; - uint16_t yplus_x = x; - drawBtn(x, y, "Y+", (intptr_t)y_plus, imgUp, Y_BTN_COLOR, !busy); + drawBtn(x, y, "E+", (intptr_t)e_plus, imgUp, E_BTN_COLOR, !busy); - // Cur Y - x += BTN_WIDTH; - motionAxisState.yValuePos.x = x + 2; - motionAxisState.yValuePos.y = y; - drawAxisValue(Y_AXIS); + spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2; + x += BTN_WIDTH + spacing; + uint16_t yplus_x = x; + drawBtn(x, y, "Y+", (intptr_t)y_plus, imgUp, Y_BTN_COLOR, !busy); - x += spacing; - drawBtn(x, y, "Z+", (intptr_t)z_plus, imgUp, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step + x += BTN_WIDTH + spacing; + uint16_t zplus_x = x; + drawBtn(x, y, "Z+", (intptr_t)z_plus, imgUp, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step - // ROW 2 -> "Ex" X- HOME X+ "Z" - y += BTN_HEIGHT + (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3; - x = X_MARGIN; - spacing = (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4; + // ROW 2 -> "Ex" CurY "Z" + x = X_MARGIN; + y += BTN_HEIGHT + 2; - motionAxisState.eNamePos.x = x; - motionAxisState.eNamePos.y = y; - drawCurESelection(); - TERN_(HAS_TFT_XPT2046, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select)); + motionAxisState.eNamePos.x = x; + motionAxisState.eNamePos.y = y; + drawCurESelection(); + TERN_(HAS_TFT_XPT2046, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select)); - x += BTN_WIDTH + spacing; - drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy); + motionAxisState.yValuePos.x = yplus_x; + motionAxisState.yValuePos.y = y; + drawAxisValue(Y_AXIS); - x += BTN_WIDTH + spacing; //imgHome is 64x64 - TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy)); + motionAxisState.zTypePos.x = zplus_x; + motionAxisState.zTypePos.y = y; + drawCurZSelection(); - x += BTN_WIDTH + spacing; - uint16_t xplus_x = x; - drawBtn(x, y, "X+", (intptr_t)x_plus, imgRight, X_BTN_COLOR, !busy); + // ROW 3 -> X- HOME X+ + y += (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3 - 2; + x = X_MARGIN; - x += BTN_WIDTH + spacing; - motionAxisState.zTypePos.x = x; - motionAxisState.zTypePos.y = y; - drawCurZSelection(); - #if BOTH(HAS_BED_PROBE, TOUCH_SCREEN) - if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (intptr_t)z_select); - #endif + drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy); - // ROW 3 -> E- CurX Y- Z- - y += BTN_HEIGHT + (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3; - x = X_MARGIN; - spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2; + TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy)); - drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy); + drawBtn(zplus_x, y, "X+", (intptr_t)x_plus, imgRight, X_BTN_COLOR, !busy); - // Cur E - motionAxisState.eValuePos.x = x; - motionAxisState.eValuePos.y = y + BTN_HEIGHT + 2; - drawAxisValue(E_AXIS); + #if BOTH(HAS_BED_PROBE, TOUCH_SCREEN) + if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (intptr_t)z_select); + #endif - // Cur X - motionAxisState.xValuePos.x = BTN_WIDTH + (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4; //X- pos - motionAxisState.xValuePos.y = y - 10; - drawAxisValue(X_AXIS); + // ROW 4 -> Cur X + y += BTN_HEIGHT + 2; - x += BTN_WIDTH + spacing; - drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy); + motionAxisState.xValuePos.x = x; + motionAxisState.xValuePos.y = y; + drawAxisValue(X_AXIS); - x += BTN_WIDTH + spacing; - drawBtn(x, y, "Z-", (intptr_t)z_minus, imgDown, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step + // ROW 5 -> E- CurX Y- Z- + y += (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3 - 2; + x = X_MARGIN; - // Cur Z - motionAxisState.zValuePos.x = x; - motionAxisState.zValuePos.y = y + BTN_HEIGHT + 2; - drawAxisValue(Z_AXIS); + drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy); - // ROW 4 -> step_size disable steppers back - y = TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT; // - x = xplus_x - CUR_STEP_VALUE_WIDTH - 10; - motionAxisState.stepValuePos.x = yplus_x + BTN_WIDTH - CUR_STEP_VALUE_WIDTH; - motionAxisState.stepValuePos.y = TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT; - if (!busy) { - drawCurStepValue(); - TERN_(HAS_TFT_XPT2046, touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (intptr_t)step_size)); - } + // Cur E + motionAxisState.eValuePos.x = x; + motionAxisState.eValuePos.y = y + BTN_HEIGHT + 2; + drawAxisValue(E_AXIS); + + x += BTN_WIDTH + spacing; + drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy); + + x += BTN_WIDTH + spacing; + drawBtn(x, y, "Z-", (intptr_t)z_minus, imgDown, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step + + // Cur Z + motionAxisState.zValuePos.x = x; + motionAxisState.zValuePos.y = y + BTN_HEIGHT + 2; + drawAxisValue(Z_AXIS); + + // ROW 6 -> step_size disable steppers back + y = TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT; // + x = zplus_x - CUR_STEP_VALUE_WIDTH - 10; + motionAxisState.stepValuePos.x = X_MARGIN + BTN_WIDTH - CUR_STEP_VALUE_WIDTH; + motionAxisState.stepValuePos.y = TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT; + + if (!busy) { + drawCurStepValue(); + TERN_(HAS_TFT_XPT2046, touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (intptr_t)step_size)); + } + + // aligned with x+ + drawBtn(yplus_x, y, "off", (intptr_t)disable_steppers, imgCancel, COLOR_WHITE, !busy); + + #else // !TFT_COLOR_UI_PORTRAIT + + // ROW 1 -> E+ Y+ CurY Z+ + int x = X_MARGIN, y = Y_MARGIN, spacing = 0; + + drawBtn(x, y, "E+", (intptr_t)e_plus, imgUp, E_BTN_COLOR, !busy); + + spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2; + x += BTN_WIDTH + spacing; + uint16_t yplus_x = x; + drawBtn(x, y, "Y+", (intptr_t)y_plus, imgUp, Y_BTN_COLOR, !busy); + + // Cur Y + x += BTN_WIDTH; + motionAxisState.yValuePos.x = x + 2; + motionAxisState.yValuePos.y = y; + drawAxisValue(Y_AXIS); + + x += spacing; + drawBtn(x, y, "Z+", (intptr_t)z_plus, imgUp, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step + + // ROW 2 -> "Ex" X- HOME X+ "Z" + y += BTN_HEIGHT + (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3; + x = X_MARGIN; + spacing = (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4; + + motionAxisState.eNamePos.x = x; + motionAxisState.eNamePos.y = y; + drawCurESelection(); + TERN_(HAS_TFT_XPT2046, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select)); + + x += BTN_WIDTH + spacing; + drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy); + + x += BTN_WIDTH + spacing; //imgHome is 64x64 + TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy)); + + x += BTN_WIDTH + spacing; + uint16_t xplus_x = x; + drawBtn(x, y, "X+", (intptr_t)x_plus, imgRight, X_BTN_COLOR, !busy); + + x += BTN_WIDTH + spacing; + motionAxisState.zTypePos.x = x; + motionAxisState.zTypePos.y = y; + drawCurZSelection(); + #if BOTH(HAS_BED_PROBE, TOUCH_SCREEN) + if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (intptr_t)z_select); + #endif + + // ROW 3 -> E- CurX Y- Z- + y += BTN_HEIGHT + (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3; + x = X_MARGIN; + spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2; + + drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy); + + // Cur E + motionAxisState.eValuePos.x = x; + motionAxisState.eValuePos.y = y + BTN_HEIGHT + 2; + drawAxisValue(E_AXIS); + + // Cur X + motionAxisState.xValuePos.x = BTN_WIDTH + (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4; //X- pos + motionAxisState.xValuePos.y = y - 10; + drawAxisValue(X_AXIS); + + x += BTN_WIDTH + spacing; + drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy); + + x += BTN_WIDTH + spacing; + drawBtn(x, y, "Z-", (intptr_t)z_minus, imgDown, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step + + // Cur Z + motionAxisState.zValuePos.x = x; + motionAxisState.zValuePos.y = y + BTN_HEIGHT + 2; + drawAxisValue(Z_AXIS); + + // ROW 4 -> step_size disable steppers back + y = TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT; // + x = xplus_x - CUR_STEP_VALUE_WIDTH - 10; + motionAxisState.stepValuePos.x = yplus_x + BTN_WIDTH - CUR_STEP_VALUE_WIDTH; + motionAxisState.stepValuePos.y = TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT; + if (!busy) { + drawCurStepValue(); + TERN_(HAS_TFT_XPT2046, touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (intptr_t)step_size)); + } + + // aligned with x+ + drawBtn(xplus_x, y, "off", (intptr_t)disable_steppers, imgCancel, COLOR_WHITE, !busy); - // aligned with x+ - drawBtn(xplus_x, y, "off", (intptr_t)disable_steppers, imgCancel, COLOR_WHITE, !busy); + #endif // !TFT_COLOR_UI_PORTRAIT TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH - X_MARGIN - BTN_WIDTH, y, BACK, imgBack)); } diff --git a/Marlin/src/lcd/tft/ui_320x240.h b/Marlin/src/lcd/tft/ui_320x240.h index 72aafbf245c0..555ca3616a09 100644 --- a/Marlin/src/lcd/tft/ui_320x240.h +++ b/Marlin/src/lcd/tft/ui_320x240.h @@ -44,4 +44,6 @@ #define FONT_SIZE 10 #endif +#define FONT_LINE_HEIGHT 24 + #include "tft_font.h" diff --git a/Marlin/src/lcd/tft/ui_480x320.cpp b/Marlin/src/lcd/tft/ui_480x320.cpp index c5e03566a9b1..c4395460d569 100644 --- a/Marlin/src/lcd/tft/ui_480x320.cpp +++ b/Marlin/src/lcd/tft/ui_480x320.cpp @@ -573,11 +573,6 @@ struct MotionAxisState { MotionAxisState motionAxisState; -#define E_BTN_COLOR COLOR_YELLOW -#define X_BTN_COLOR COLOR_CORAL_RED -#define Y_BTN_COLOR COLOR_VIVID_GREEN -#define Z_BTN_COLOR COLOR_LIGHT_BLUE - #define BTN_WIDTH 64 #define BTN_HEIGHT 52 #define X_MARGIN 20 @@ -656,12 +651,10 @@ static void drawAxisValue(const AxisEnum axis) { static void moveAxis(const AxisEnum axis, const int8_t direction) { quick_feedback(); - #if ENABLED(PREVENT_COLD_EXTRUSION) - if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) { - drawMessage(F("Too cold")); - return; - } - #endif + if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) { + drawMessage(F("Too cold")); + return; + } const float diff = motionAxisState.currentStepSize * direction; @@ -715,7 +708,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { // This assumes the center is 0,0 #if ENABLED(DELTA) if (axis != Z_AXIS && axis != E_AXIS) { - max = SQRT(sq((float)(DELTA_PRINTABLE_RADIUS)) - sq(current_position[Y_AXIS - axis])); // (Y_AXIS - axis) == the other axis + max = SQRT(sq(float(PRINTABLE_RADIUS)) - sq(current_position[Y_AXIS - axis])); // (Y_AXIS - axis) == the other axis min = -max; } #endif @@ -746,10 +739,8 @@ static void z_minus() { moveAxis(Z_AXIS, -1); } #if ENABLED(TOUCH_SCREEN) static void e_select() { - motionAxisState.e_selection++; - if (motionAxisState.e_selection >= EXTRUDERS) { + if (++motionAxisState.e_selection >= EXTRUDERS) motionAxisState.e_selection = 0; - } quick_feedback(); drawCurESelection(); @@ -791,8 +782,8 @@ static void disable_steppers() { } static void drawBtn(int x, int y, const char *label, intptr_t data, MarlinImage img, uint16_t bgColor, bool enabled = true) { - uint16_t width = Images[imgBtn52Rounded].width; - uint16_t height = Images[imgBtn52Rounded].height; + uint16_t width = Images[imgBtn52Rounded].width, + height = Images[imgBtn52Rounded].height; if (!enabled) bgColor = COLOR_CONTROL_DISABLED; diff --git a/Marlin/src/lcd/tft_io/tft_io.h b/Marlin/src/lcd/tft_io/tft_io.h index c1c4a8e3b192..9cfb2137df5e 100644 --- a/Marlin/src/lcd/tft_io/tft_io.h +++ b/Marlin/src/lcd/tft_io/tft_io.h @@ -34,65 +34,10 @@ #endif #ifndef DMA_MAX_SIZE - #error "MAX_DMA_SIZE is not configured for this platform." + #error "DMA_MAX_SIZE is not configured for this platform." #endif -#define TFT_EXCHANGE_XY _BV32(1) -#define TFT_INVERT_X _BV32(2) -#define TFT_INVERT_Y _BV32(3) - -#define TFT_NO_ROTATION (0x00) -#define TFT_ROTATE_90 (TFT_EXCHANGE_XY | TFT_INVERT_X) -#define TFT_ROTATE_180 (TFT_INVERT_X | TFT_INVERT_Y) -#define TFT_ROTATE_270 (TFT_EXCHANGE_XY | TFT_INVERT_Y) - -#define TFT_MIRROR_X (TFT_INVERT_Y) -#define TFT_MIRROR_Y (TFT_INVERT_X) - -#define TFT_ROTATE_90_MIRROR_X (TFT_ROTATE_90 ^ TFT_INVERT_Y) -#define TFT_ROTATE_90_MIRROR_Y (TFT_ROTATE_90 ^ TFT_INVERT_X) - -#define TFT_ROTATE_180_MIRROR_X (TFT_ROTATE_180 ^ TFT_INVERT_Y) -#define TFT_ROTATE_180_MIRROR_Y (TFT_ROTATE_180 ^ TFT_INVERT_X) - -#define TFT_ROTATE_270_MIRROR_X (TFT_ROTATE_270 ^ TFT_INVERT_Y) -#define TFT_ROTATE_270_MIRROR_Y (TFT_ROTATE_270 ^ TFT_INVERT_X) - -// TFT_ROTATION is user configurable -#ifndef TFT_ROTATION - #define TFT_ROTATION TFT_NO_ROTATION -#endif - -// TFT_ORIENTATION is the "sum" of TFT_DEFAULT_ORIENTATION plus user TFT_ROTATION -#define TFT_ORIENTATION ((TFT_DEFAULT_ORIENTATION) ^ (TFT_ROTATION)) - -#define TFT_COLOR_RGB _BV32(3) -#define TFT_COLOR_BGR _BV32(4) - -// Each TFT Driver is responsible for its default color mode. -// #ifndef TFT_COLOR -// #define TFT_COLOR TFT_COLOR_RGB -// #endif - -#define TOUCH_ORIENTATION_NONE 0 -#define TOUCH_LANDSCAPE 1 -#define TOUCH_PORTRAIT 2 - -#ifndef TOUCH_CALIBRATION_X - #define TOUCH_CALIBRATION_X 0 -#endif -#ifndef TOUCH_CALIBRATION_Y - #define TOUCH_CALIBRATION_Y 0 -#endif -#ifndef TOUCH_OFFSET_X - #define TOUCH_OFFSET_X 0 -#endif -#ifndef TOUCH_OFFSET_Y - #define TOUCH_OFFSET_Y 0 -#endif -#ifndef TOUCH_ORIENTATION - #define TOUCH_ORIENTATION TOUCH_LANDSCAPE -#endif +#include "tft_orientation.h" #ifndef TFT_DRIVER #define TFT_DRIVER AUTO diff --git a/Marlin/src/lcd/tft_io/tft_orientation.h b/Marlin/src/lcd/tft_io/tft_orientation.h new file mode 100644 index 000000000000..7822fc6b04f2 --- /dev/null +++ b/Marlin/src/lcd/tft_io/tft_orientation.h @@ -0,0 +1,85 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +#define TFT_EXCHANGE_XY _BV32(1) +#define TFT_INVERT_X _BV32(2) +#define TFT_INVERT_Y _BV32(3) + +#define TFT_NO_ROTATION (0x00) +#define TFT_ROTATE_90 (TFT_EXCHANGE_XY | TFT_INVERT_X) +#define TFT_ROTATE_180 (TFT_INVERT_X | TFT_INVERT_Y) +#define TFT_ROTATE_270 (TFT_EXCHANGE_XY | TFT_INVERT_Y) + +#define TFT_MIRROR_X (TFT_INVERT_Y) +#define TFT_MIRROR_Y (TFT_INVERT_X) + +#define TFT_ROTATE_90_MIRROR_X (TFT_ROTATE_90 ^ TFT_MIRROR_X) +#define TFT_ROTATE_90_MIRROR_Y (TFT_ROTATE_90 ^ TFT_MIRROR_Y) + +#define TFT_ROTATE_180_MIRROR_X (TFT_ROTATE_180 ^ TFT_MIRROR_X) +#define TFT_ROTATE_180_MIRROR_Y (TFT_ROTATE_180 ^ TFT_MIRROR_Y) + +#define TFT_ROTATE_270_MIRROR_X (TFT_ROTATE_270 ^ TFT_MIRROR_X) +#define TFT_ROTATE_270_MIRROR_Y (TFT_ROTATE_270 ^ TFT_MIRROR_Y) + +// TFT_ROTATION is user configurable +#ifndef TFT_ROTATION + #define TFT_ROTATION TFT_NO_ROTATION +#endif + +// TFT_ORIENTATION is the "sum" of TFT_DEFAULT_ORIENTATION plus user TFT_ROTATION +#define TFT_ORIENTATION ((TFT_DEFAULT_ORIENTATION) ^ (TFT_ROTATION)) + +// Set TFT_COLOR_UI_PORTRAIT flag, if needed +#if ((TFT_ORIENTATION) & TFT_EXCHANGE_XY) == 0 + #define TFT_COLOR_UI_PORTRAIT 1 +#endif + +#define TFT_COLOR_RGB _BV32(3) +#define TFT_COLOR_BGR _BV32(4) + +// Each TFT Driver is responsible for its default color mode. +// #ifndef TFT_COLOR +// #define TFT_COLOR TFT_COLOR_RGB +// #endif + +#define TOUCH_ORIENTATION_NONE 0 +#define TOUCH_LANDSCAPE 1 +#define TOUCH_PORTRAIT 2 + +#ifndef TOUCH_CALIBRATION_X + #define TOUCH_CALIBRATION_X 0 +#endif +#ifndef TOUCH_CALIBRATION_Y + #define TOUCH_CALIBRATION_Y 0 +#endif +#ifndef TOUCH_OFFSET_X + #define TOUCH_OFFSET_X 0 +#endif +#ifndef TOUCH_OFFSET_Y + #define TOUCH_OFFSET_Y 0 +#endif +#ifndef TOUCH_ORIENTATION + #define TOUCH_ORIENTATION TOUCH_LANDSCAPE +#endif + diff --git a/Marlin/src/module/delta.cpp b/Marlin/src/module/delta.cpp index ce2a6f4adad0..58dc13972cb2 100644 --- a/Marlin/src/module/delta.cpp +++ b/Marlin/src/module/delta.cpp @@ -132,7 +132,7 @@ float delta_safe_distance_from_top() { xyz_pos_t cartesian{0}; inverse_kinematics(cartesian); const float centered_extent = delta.a; - cartesian.y = DELTA_PRINTABLE_RADIUS; + cartesian.y = PRINTABLE_RADIUS; inverse_kinematics(cartesian); return ABS(centered_extent - delta.a); } diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index dadbfab29724..7c90ae715986 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -38,6 +38,10 @@ #include "../lcd/marlinui.h" #endif +#if ENABLED(POLAR) + #include "polar.h" +#endif + #if HAS_BED_PROBE #include "probe.h" #endif @@ -145,11 +149,14 @@ xyz_pos_t cartes; #if HAS_SOFTWARE_ENDSTOPS float delta_max_radius, delta_max_radius_2; #elif IS_SCARA - constexpr float delta_max_radius = SCARA_PRINTABLE_RADIUS, - delta_max_radius_2 = sq(SCARA_PRINTABLE_RADIUS); + constexpr float delta_max_radius = PRINTABLE_RADIUS, + delta_max_radius_2 = sq(PRINTABLE_RADIUS); + #elif ENABLED(POLAR) + constexpr float delta_max_radius = PRINTABLE_RADIUS, + delta_max_radius_2 = sq(PRINTABLE_RADIUS); #else // DELTA - constexpr float delta_max_radius = DELTA_PRINTABLE_RADIUS, - delta_max_radius_2 = sq(DELTA_PRINTABLE_RADIUS); + constexpr float delta_max_radius = PRINTABLE_RADIUS, + delta_max_radius_2 = sq(PRINTABLE_RADIUS); #endif #endif @@ -183,6 +190,7 @@ xyz_pos_t cartes; inline void report_more_positions() { stepper.report_positions(); TERN_(IS_SCARA, scara_report_positions()); + TERN_(POLAR, polar_report_positions()); } // Report the logical position for a given machine position @@ -277,8 +285,7 @@ void report_current_position_projected() { #endif ); - stepper.report_positions(); - TERN_(IS_SCARA, scara_report_positions()); + report_more_positions(); report_current_grblstate_moving(); } @@ -308,7 +315,7 @@ void report_current_position_projected() { #if ENABLED(DELTA) - can_reach = HYPOT2(rx, ry) <= sq(DELTA_PRINTABLE_RADIUS - inset + fslop); + can_reach = HYPOT2(rx, ry) <= sq(PRINTABLE_RADIUS - inset + fslop); #elif ENABLED(AXEL_TPARA) @@ -343,6 +350,8 @@ void report_current_position_projected() { && b < polargraph_max_belt_len + 1 ); + #elif ENABLED(POLAR) + can_reach = HYPOT(rx, ry) <= PRINTABLE_RADIUS; #endif return can_reach; @@ -352,7 +361,7 @@ void report_current_position_projected() { // Return true if the given position is within the machine bounds. bool position_is_reachable(const_float_t rx, const_float_t ry) { - if (!COORDINATE_OKAY(ry, Y_MIN_POS - fslop, Y_MAX_POS + fslop)) return false; + if (TERN0(HAS_Y_AXIS, !COORDINATE_OKAY(ry, Y_MIN_POS - fslop, Y_MAX_POS + fslop))) return false; #if ENABLED(DUAL_X_CARRIAGE) if (active_extruder) return COORDINATE_OKAY(rx, X2_MIN_POS - fslop, X2_MAX_POS + fslop); @@ -426,6 +435,9 @@ void get_cartesian_from_steppers() { OPTARG(AXEL_TPARA, planner.get_axis_position_degrees(C_AXIS)) ); cartes.z = planner.get_axis_position_mm(Z_AXIS); + #elif ENABLED(POLAR) + forward_kinematics(planner.get_axis_position_mm(X_AXIS), planner.get_axis_position_degrees(B_AXIS)); + cartes.z = planner.get_axis_position_mm(Z_AXIS); #else NUM_AXIS_CODE( cartes.x = planner.get_axis_position_mm(X_AXIS), @@ -618,7 +630,7 @@ void do_blocking_move_to(NUM_AXIS_ARGS(const float), const_feedRate_t fr_mm_s/*= if (current_position.z < z) { current_position.z = z; line_to_current_position(z_feedrate); } #endif - current_position.set(x, y); line_to_current_position(xy_feedrate); + current_position.set(x OPTARG(HAS_Y_AXIS, y)); line_to_current_position(xy_feedrate); #if HAS_I_AXIS current_position.i = i; line_to_current_position(i_feedrate); @@ -914,6 +926,10 @@ void restore_feedrate_and_scaling() { #if BOTH(HAS_HOTEND_OFFSET, DELTA) // The effector center position will be the target minus the hotend offset. const xy_pos_t offs = hotend_offset[active_extruder]; + #elif ENABLED(POLARGRAPH) + // POLARGRAPH uses draw_area_* below... + #elif ENABLED(POLAR) + // For now, we don't limit POLAR #else // SCARA needs to consider the angle of the arm through the entire move, so for now use no tool offset. constexpr xy_pos_t offs{0}; @@ -922,6 +938,8 @@ void restore_feedrate_and_scaling() { #if ENABLED(POLARGRAPH) LIMIT(target.x, draw_area_min.x, draw_area_max.x); LIMIT(target.y, draw_area_min.y, draw_area_max.y); + #elif ENABLED(POLAR) + // Motion limits are as same as cartesian limits. #else if (TERN1(IS_SCARA, axis_was_homed(X_AXIS) && axis_was_homed(Y_AXIS))) { const float dist_2 = HYPOT2(target.x - offs.x, target.y - offs.y); @@ -1055,6 +1073,8 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) { * and compare the difference. */ #define SCARA_MIN_SEGMENT_LENGTH 0.5f + #elif ENABLED(POLAR) + #define POLAR_MIN_SEGMENT_LENGTH 0.5f #endif /** @@ -1107,6 +1127,8 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) { // For SCARA enforce a minimum segment size #if IS_SCARA NOMORE(segments, cartesian_mm * RECIPROCAL(SCARA_MIN_SEGMENT_LENGTH)); + #elif ENABLED(POLAR) + NOMORE(segments, cartesian_mm * RECIPROCAL(POLAR_MIN_SEGMENT_LENGTH)); #endif // At least one segment is required @@ -1118,7 +1140,7 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) { // Add hints to help optimize the move PlannerHints hints(cartesian_mm * inv_segments); - TERN_(SCARA_FEEDRATE_SCALING, hints.inv_duration = scaled_fr_mm_s / hints.millimeters); + TERN_(FEEDRATE_SCALING, hints.inv_duration = scaled_fr_mm_s / hints.millimeters); /* SERIAL_ECHOPGM("mm=", cartesian_mm); @@ -1185,7 +1207,7 @@ FORCE_INLINE void segment_idle(millis_t &next_idle_ms) { // Add hints to help optimize the move PlannerHints hints(cartesian_mm * inv_segments); - TERN_(SCARA_FEEDRATE_SCALING, hints.inv_duration = scaled_fr_mm_s / hints.millimeters); + TERN_(FEEDRATE_SCALING, hints.inv_duration = scaled_fr_mm_s / hints.millimeters); //SERIAL_ECHOPGM("mm=", cartesian_mm); //SERIAL_ECHOLNPGM(" segments=", segments); @@ -1398,12 +1420,8 @@ void prepare_line_to_destination() { #if EITHER(PREVENT_COLD_EXTRUSION, PREVENT_LENGTHY_EXTRUDE) if (!DEBUGGING(DRYRUN) && destination.e != current_position.e) { - bool ignore_e = false; - - #if ENABLED(PREVENT_COLD_EXTRUSION) - ignore_e = thermalManager.tooColdToExtrude(active_extruder); - if (ignore_e) SERIAL_ECHO_MSG(STR_ERR_COLD_EXTRUDE_STOP); - #endif + bool ignore_e = thermalManager.tooColdToExtrude(active_extruder); + if (ignore_e) SERIAL_ECHO_MSG(STR_ERR_COLD_EXTRUDE_STOP); #if ENABLED(PREVENT_LENGTHY_EXTRUDE) const float e_delta = ABS(destination.e - current_position.e) * planner.e_factor[active_extruder]; @@ -1471,13 +1489,18 @@ void prepare_line_to_destination() { } bool homing_needed_error(main_axes_bits_t axis_bits/*=main_axes_mask*/) { - if ((axis_bits = axes_should_home(axis_bits))) { - PGM_P home_first = GET_TEXT(MSG_HOME_FIRST); + if ((axis_bits &= axes_should_home(axis_bits))) { + char all_axes[] = STR_AXES_MAIN, need[NUM_AXES + 1]; + uint8_t n = 0; + LOOP_NUM_AXES(i) if (TEST(axis_bits, i)) need[n++] = all_axes[i]; + need[n] = '\0'; + char msg[30]; - #define _AXIS_CHAR(N) TEST(axis_bits, _AXIS(N)) ? STR_##N : "" - sprintf_P(msg, home_first, MAPLIST(_AXIS_CHAR, MAIN_AXIS_NAMES)); + sprintf_P(msg, GET_EN_TEXT(MSG_HOME_FIRST), need); SERIAL_ECHO_START(); SERIAL_ECHOLN(msg); + + sprintf_P(msg, GET_TEXT(MSG_HOME_FIRST), need); ui.set_status(msg); return true; } diff --git a/Marlin/src/module/motion.h b/Marlin/src/module/motion.h index ce9094765765..8950cf6f228d 100644 --- a/Marlin/src/module/motion.h +++ b/Marlin/src/module/motion.h @@ -32,6 +32,8 @@ #if IS_SCARA #include "scara.h" +#elif ENABLED(POLAR) + #include "polar.h" #endif // Error margin to work around float imprecision diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 867b6a98a876..aceaf8a253a5 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -3161,24 +3161,75 @@ bool Planner::buffer_line(const xyze_pos_t &cart, const_feedRate_t fr_mm_s ? xyz_pos_t(cart_dist_mm).magnitude() : TERN0(HAS_Z_AXIS, ABS(cart_dist_mm.z)); - #if ENABLED(SCARA_FEEDRATE_SCALING) + #if DISABLED(FEEDRATE_SCALING) + + const feedRate_t feedrate = fr_mm_s; + + #elif IS_SCARA + // For SCARA scale the feedrate from mm/s to degrees/s // i.e., Complete the angular vector in the given time. const float duration_recip = hints.inv_duration ?: fr_mm_s / ph.millimeters; const xyz_pos_t diff = delta - position_float; const feedRate_t feedrate = diff.magnitude() * duration_recip; - #else - const feedRate_t feedrate = fr_mm_s; - #endif + + #elif ENABLED(POLAR) + + /** + * Motion problem for Polar axis near center / origin: + * + * 3D printing: + * Movements very close to the center of the polar axis take more time than others. + * This brief delay results in more material deposition due to the pressure in the nozzle. + * + * Current Kinematics and feedrate scaling deals with this by making the movement as fast + * as possible. It works for slow movements but doesn't work well with fast ones. A more + * complicated extrusion compensation must be implemented. + * + * Ideally, it should estimate that a long rotation near the center is ahead and will cause + * unwanted deposition. Therefore it can compensate the extrusion beforehand. + * + * Laser cutting: + * Same thing would be a problem for laser engraving too. As it spends time rotating at the + * center point, more likely it will burn more material than it should. Therefore similar + * compensation would be implemented for laser-cutting operations. + * + * Milling: + * This shouldn't be a problem for cutting/milling operations. + */ + feedRate_t calculated_feedrate = fr_mm_s; + const xyz_pos_t diff = delta - position_float; + if (!NEAR_ZERO(diff.b)) { + if (delta.a <= POLAR_FAST_RADIUS ) + calculated_feedrate = settings.max_feedrate_mm_s[Y_AXIS]; + else { + // Normalized vector of movement + const float diffBLength = ABS((2.0f * PI * diff.a) * (diff.b / 360.0f)), + diffTheta = DEGREES(ATAN2(diff.a, diffBLength)), + normalizedTheta = 1.0f - (ABS(diffTheta > 90.0f ? 180.0f - diffTheta : diffTheta) / 90.0f); + + // Normalized position along the radius + const float radiusRatio = PRINTABLE_RADIUS/delta.a; + calculated_feedrate += (fr_mm_s * radiusRatio * normalizedTheta); + } + } + const feedRate_t feedrate = calculated_feedrate; + + #endif // POLAR && FEEDRATE_SCALING + TERN_(HAS_EXTRUDERS, delta.e = machine.e); if (buffer_segment(delta OPTARG(HAS_DIST_MM_ARG, cart_dist_mm), feedrate, extruder, ph)) { position_cart = cart; return true; } return false; - #else + + #else // !IS_KINEMATIC + return buffer_segment(machine, fr_mm_s, extruder, hints); + #endif + } // buffer_line() #if ENABLED(DIRECT_STEPPING) diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index 04cde2381da2..7cc8bc08e4eb 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -50,6 +50,8 @@ #include "delta.h" #elif ENABLED(POLARGRAPH) #include "polargraph.h" +#elif ENABLED(POLAR) + #include "polar.h" #endif #if ABL_PLANAR @@ -291,7 +293,7 @@ typedef struct PlannerBlock { } block_t; -#if ANY(LIN_ADVANCE, SCARA_FEEDRATE_SCALING, GRADIENT_MIX, LCD_SHOW_E_TOTAL, POWER_LOSS_RECOVERY) +#if ANY(LIN_ADVANCE, FEEDRATE_SCALING, GRADIENT_MIX, LCD_SHOW_E_TOTAL, POWER_LOSS_RECOVERY) #define HAS_POSITION_FLOAT 1 #endif @@ -361,7 +363,7 @@ typedef struct { struct PlannerHints { float millimeters = 0.0; // Move Length, if known, else 0. - #if ENABLED(SCARA_FEEDRATE_SCALING) + #if ENABLED(FEEDRATE_SCALING) float inv_duration = 0.0; // Reciprocal of the move duration, if known #endif #if ENABLED(HINTS_CURVE_RADIUS) @@ -913,8 +915,8 @@ class Planner { return out; } - // SCARA AB axes are in degrees, not mm - #if IS_SCARA + // SCARA AB and Polar YB axes are in degrees, not mm + #if EITHER(IS_SCARA, POLAR) FORCE_INLINE static float get_axis_position_degrees(const AxisEnum axis) { return get_axis_position_mm(axis); } #endif diff --git a/Marlin/src/module/polar.cpp b/Marlin/src/module/polar.cpp new file mode 100644 index 000000000000..4fbd33cccf53 --- /dev/null +++ b/Marlin/src/module/polar.cpp @@ -0,0 +1,102 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * POLAR Kinematics + * developed by Kadir ilkimen for PolarBear CNC and babyBear + * https://github.com/kadirilkimen/Polar-Bear-Cnc-Machine + * https://github.com/kadirilkimen/babyBear-3D-printer + * + * A polar machine can have different configurations. + * This kinematics is only compatible with the following configuration: + * X : Independent linear + * Y or B : Polar + * Z : Independent linear + * + * For example, PolarBear has CoreXZ plus Polar Y or B. + */ + +#include "../inc/MarlinConfigPre.h" + +#if ENABLED(POLAR) + +#include "polar.h" +#include "motion.h" +#include "planner.h" + +#include "../inc/MarlinConfig.h" + +float segments_per_second = DEFAULT_SEGMENTS_PER_SECOND, + polar_center_offset = POLAR_CENTER_OFFSET; + +float absoluteAngle(float a) { + if (a < 0.0) while (a < 0.0) a += 360.0; + else if (a > 360.0) while (a > 360.0) a -= 360.0; + return a; +} + +void forward_kinematics(const_float_t r, const_float_t theta) { + const float absTheta = absoluteAngle(theta); + float radius = r; + if (polar_center_offset > 0.0) radius = SQRT( ABS( sq(r) - sq(-polar_center_offset) ) ); + cartes.x = cos(RADIANS(absTheta))*radius; + cartes.y = sin(RADIANS(absTheta))*radius; +} + +void inverse_kinematics(const xyz_pos_t &raw) { + const float x = raw.x, y = raw.y, + rawRadius = HYPOT(x,y), + posTheta = DEGREES(ATAN2(y, x)); + + static float current_polar_theta = 0; + + float r = rawRadius, + theta = absoluteAngle(posTheta), + currentAbsTheta = absoluteAngle(current_polar_theta); + + if (polar_center_offset > 0.0) { + const float offsetRadius = SQRT(ABS(sq(r) - sq(polar_center_offset))); + float offsetTheta = absoluteAngle(DEGREES(ATAN2(polar_center_offset, offsetRadius))); + theta = absoluteAngle(offsetTheta + theta); + } + + const float deltaTheta = theta - currentAbsTheta; + if (ABS(deltaTheta) <= 180) + theta = current_polar_theta + deltaTheta; + else { + if (currentAbsTheta > 180) theta = current_polar_theta + 360 + deltaTheta; + else theta = current_polar_theta - (360 - deltaTheta); + } + + current_polar_theta = theta; + + delta.set(r, theta, raw.z); +} + +void polar_report_positions() { + SERIAL_ECHOLNPGM("X: ", planner.get_axis_position_mm(X_AXIS), + " POLAR Theta:", planner.get_axis_position_degrees(B_AXIS), + " Z: ", planner.get_axis_position_mm(Z_AXIS) + ); +} + +#endif diff --git a/Marlin/src/module/polar.h b/Marlin/src/module/polar.h new file mode 100644 index 000000000000..79fbd4194d53 --- /dev/null +++ b/Marlin/src/module/polar.h @@ -0,0 +1,36 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +/** + * polar.h - POLAR-specific functions + */ + +#include "../core/types.h" + +extern float segments_per_second; + +float absoluteAngle(float a); +void forward_kinematics(const_float_t r, const_float_t theta); + +void inverse_kinematics(const xyz_pos_t &raw); +void polar_report_positions(); diff --git a/Marlin/src/module/probe.h b/Marlin/src/module/probe.h index 96d22fdd389c..961ba411440e 100644 --- a/Marlin/src/module/probe.h +++ b/Marlin/src/module/probe.h @@ -50,7 +50,7 @@ #endif #if ALL(DWIN_LCD_PROUI, INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) - #define Z_POST_CLEARANCE HMI_data.z_after_homing; + #define Z_POST_CLEARANCE HMI_data.z_after_homing #elif defined(Z_AFTER_HOMING) #define Z_POST_CLEARANCE Z_AFTER_HOMING #elif defined(Z_HOMING_HEIGHT) @@ -161,11 +161,9 @@ class Probe { #endif static void move_z_after_homing() { - #if ALL(DWIN_LCD_PROUI, INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) - do_z_clearance(HMI_data.z_after_homing, true); - #elif defined(Z_AFTER_HOMING) - do_z_clearance(Z_AFTER_HOMING, true); - #elif BOTH(Z_AFTER_PROBING, HAS_BED_PROBE) + #if ALL(DWIN_LCD_PROUI, INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) || defined(Z_AFTER_HOMING) + do_z_clearance(Z_POST_CLEARANCE, true); + #elif HAS_BED_PROBE move_z_after_probing(); #endif } @@ -195,12 +193,8 @@ class Probe { #if HAS_BED_PROBE || HAS_LEVELING #if IS_KINEMATIC - static constexpr float printable_radius = ( - TERN_(DELTA, DELTA_PRINTABLE_RADIUS) - TERN_(IS_SCARA, SCARA_PRINTABLE_RADIUS) - ); static constexpr float probe_radius(const xy_pos_t &probe_offset_xy=offset_xy) { - return printable_radius - _MAX(PROBING_MARGIN, HYPOT(probe_offset_xy.x, probe_offset_xy.y)); + return float(PRINTABLE_RADIUS) - _MAX(PROBING_MARGIN, HYPOT(probe_offset_xy.x, probe_offset_xy.y)); } #endif diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index afdbf3d10342..8b615f2faf14 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -1632,8 +1632,7 @@ void MarlinSettings::postprocess() { // Model predictive control // #if ENABLED(MPCTEMP) - HOTEND_LOOP() - EEPROM_WRITE(thermalManager.temp_hotend[e].constants); + HOTEND_LOOP() EEPROM_WRITE(thermalManager.temp_hotend[e].mpc); #endif // @@ -2627,8 +2626,7 @@ void MarlinSettings::postprocess() { // #if ENABLED(MPCTEMP) { - HOTEND_LOOP() - EEPROM_READ(thermalManager.temp_hotend[e].constants); + HOTEND_LOOP() EEPROM_READ(thermalManager.temp_hotend[e].mpc); } #endif @@ -3416,15 +3414,15 @@ void MarlinSettings::reset() { static_assert(COUNT(_filament_heat_capacity_permm) == HOTENDS, "FILAMENT_HEAT_CAPACITY_PERMM must have HOTENDS items."); HOTEND_LOOP() { - MPC_t &constants = thermalManager.temp_hotend[e].constants; - constants.heater_power = _mpc_heater_power[e]; - constants.block_heat_capacity = _mpc_block_heat_capacity[e]; - constants.sensor_responsiveness = _mpc_sensor_responsiveness[e]; - constants.ambient_xfer_coeff_fan0 = _mpc_ambient_xfer_coeff[e]; + MPC_t &mpc = thermalManager.temp_hotend[e].mpc; + mpc.heater_power = _mpc_heater_power[e]; + mpc.block_heat_capacity = _mpc_block_heat_capacity[e]; + mpc.sensor_responsiveness = _mpc_sensor_responsiveness[e]; + mpc.ambient_xfer_coeff_fan0 = _mpc_ambient_xfer_coeff[e]; #if ENABLED(MPC_INCLUDE_FAN) - constants.fan255_adjustment = _mpc_ambient_xfer_coeff_fan255[e] - _mpc_ambient_xfer_coeff[e]; + mpc.fan255_adjustment = _mpc_ambient_xfer_coeff_fan255[e] - _mpc_ambient_xfer_coeff[e]; #endif - constants.filament_heat_capacity_permm = _filament_heat_capacity_permm[e]; + mpc.filament_heat_capacity_permm = _filament_heat_capacity_permm[e]; } #endif diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 70a1e25ceca3..54b52cd16e0a 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -2776,35 +2776,44 @@ void Stepper::init() { // Init Enable Pins - steppers default to disabled. #if HAS_X_ENABLE + #ifndef X_ENABLE_INIT_STATE + #define X_ENABLE_INIT_STATE !X_ENABLE_ON + #endif X_ENABLE_INIT(); - if (!X_ENABLE_ON) X_ENABLE_WRITE(HIGH); + if (X_ENABLE_INIT_STATE) X_ENABLE_WRITE(X_ENABLE_INIT_STATE); #if BOTH(HAS_X2_STEPPER, HAS_X2_ENABLE) X2_ENABLE_INIT(); - if (!X_ENABLE_ON) X2_ENABLE_WRITE(HIGH); + if (X_ENABLE_INIT_STATE) X2_ENABLE_WRITE(X_ENABLE_INIT_STATE); #endif #endif #if HAS_Y_ENABLE + #ifndef Y_ENABLE_INIT_STATE + #define Y_ENABLE_INIT_STATE !Y_ENABLE_ON + #endif Y_ENABLE_INIT(); - if (!Y_ENABLE_ON) Y_ENABLE_WRITE(HIGH); + if (Y_ENABLE_INIT_STATE) Y_ENABLE_WRITE(Y_ENABLE_INIT_STATE); #if BOTH(HAS_DUAL_Y_STEPPERS, HAS_Y2_ENABLE) Y2_ENABLE_INIT(); - if (!Y_ENABLE_ON) Y2_ENABLE_WRITE(HIGH); + if (Y_ENABLE_INIT_STATE) Y2_ENABLE_WRITE(Y_ENABLE_INIT_STATE); #endif #endif #if HAS_Z_ENABLE + #ifndef Z_ENABLE_INIT_STATE + #define Z_ENABLE_INIT_STATE !Z_ENABLE_ON + #endif Z_ENABLE_INIT(); - if (!Z_ENABLE_ON) Z_ENABLE_WRITE(HIGH); + if (Z_ENABLE_INIT_STATE) Z_ENABLE_WRITE(Z_ENABLE_INIT_STATE); #if NUM_Z_STEPPERS >= 2 && HAS_Z2_ENABLE Z2_ENABLE_INIT(); - if (!Z_ENABLE_ON) Z2_ENABLE_WRITE(HIGH); + if (Z_ENABLE_INIT_STATE) Z2_ENABLE_WRITE(Z_ENABLE_INIT_STATE); #endif #if NUM_Z_STEPPERS >= 3 && HAS_Z3_ENABLE Z3_ENABLE_INIT(); - if (!Z_ENABLE_ON) Z3_ENABLE_WRITE(HIGH); + if (Z_ENABLE_INIT_STATE) Z3_ENABLE_WRITE(Z_ENABLE_INIT_STATE); #endif #if NUM_Z_STEPPERS >= 4 && HAS_Z4_ENABLE Z4_ENABLE_INIT(); - if (!Z_ENABLE_ON) Z4_ENABLE_WRITE(HIGH); + if (Z_ENABLE_INIT_STATE) Z4_ENABLE_WRITE(Z_ENABLE_INIT_STATE); #endif #endif #if HAS_I_ENABLE @@ -2832,36 +2841,63 @@ void Stepper::init() { if (!W_ENABLE_ON) W_ENABLE_WRITE(HIGH); #endif #if HAS_E0_ENABLE + #ifndef E_ENABLE_INIT_STATE + #define E_ENABLE_INIT_STATE !E_ENABLE_ON + #endif + #ifndef E0_ENABLE_INIT_STATE + #define E0_ENABLE_INIT_STATE E_ENABLE_INIT_STATE + #endif E0_ENABLE_INIT(); - if (!E_ENABLE_ON) E0_ENABLE_WRITE(HIGH); + if (E0_ENABLE_INIT_STATE) E0_ENABLE_WRITE(E0_ENABLE_INIT_STATE); #endif #if HAS_E1_ENABLE + #ifndef E1_ENABLE_INIT_STATE + #define E1_ENABLE_INIT_STATE E_ENABLE_INIT_STATE + #endif E1_ENABLE_INIT(); - if (!E_ENABLE_ON) E1_ENABLE_WRITE(HIGH); + if (E1_ENABLE_INIT_STATE) E1_ENABLE_WRITE(E1_ENABLE_INIT_STATE); #endif #if HAS_E2_ENABLE + #ifndef E2_ENABLE_INIT_STATE + #define E2_ENABLE_INIT_STATE E_ENABLE_INIT_STATE + #endif E2_ENABLE_INIT(); - if (!E_ENABLE_ON) E2_ENABLE_WRITE(HIGH); + if (E2_ENABLE_INIT_STATE) E2_ENABLE_WRITE(E2_ENABLE_INIT_STATE); #endif #if HAS_E3_ENABLE + #ifndef E3_ENABLE_INIT_STATE + #define E3_ENABLE_INIT_STATE E_ENABLE_INIT_STATE + #endif E3_ENABLE_INIT(); - if (!E_ENABLE_ON) E3_ENABLE_WRITE(HIGH); + if (E3_ENABLE_INIT_STATE) E3_ENABLE_WRITE(E3_ENABLE_INIT_STATE); #endif #if HAS_E4_ENABLE + #ifndef E4_ENABLE_INIT_STATE + #define E4_ENABLE_INIT_STATE E_ENABLE_INIT_STATE + #endif E4_ENABLE_INIT(); - if (!E_ENABLE_ON) E4_ENABLE_WRITE(HIGH); + if (E4_ENABLE_INIT_STATE) E4_ENABLE_WRITE(E4_ENABLE_INIT_STATE); #endif #if HAS_E5_ENABLE + #ifndef E5_ENABLE_INIT_STATE + #define E5_ENABLE_INIT_STATE E_ENABLE_INIT_STATE + #endif E5_ENABLE_INIT(); - if (!E_ENABLE_ON) E5_ENABLE_WRITE(HIGH); + if (E5_ENABLE_INIT_STATE) E5_ENABLE_WRITE(E5_ENABLE_INIT_STATE); #endif #if HAS_E6_ENABLE + #ifndef E6_ENABLE_INIT_STATE + #define E6_ENABLE_INIT_STATE E_ENABLE_INIT_STATE + #endif E6_ENABLE_INIT(); - if (!E_ENABLE_ON) E6_ENABLE_WRITE(HIGH); + if (E6_ENABLE_INIT_STATE) E6_ENABLE_WRITE(E6_ENABLE_INIT_STATE); #endif #if HAS_E7_ENABLE + #ifndef E7_ENABLE_INIT_STATE + #define E7_ENABLE_INIT_STATE E_ENABLE_INIT_STATE + #endif E7_ENABLE_INIT(); - if (!E_ENABLE_ON) E7_ENABLE_WRITE(HIGH); + if (E7_ENABLE_INIT_STATE) E7_ENABLE_WRITE(E7_ENABLE_INIT_STATE); #endif #define _STEP_INIT(AXIS) AXIS ##_STEP_INIT() @@ -2984,7 +3020,7 @@ void Stepper::init() { * Calculate a fixed point factor to apply to the signal and its echo * when shaping an axis. */ - void Stepper::set_shaping_damping_ratio(const AxisEnum axis, const float zeta) { + void Stepper::set_shaping_damping_ratio(const AxisEnum axis, const_float_t zeta) { // from the damping ratio, get a factor that can be applied to advance_dividend for fixed point maths // for ZV, we use amplitudes 1/(1+K) and K/(1+K) where K = exp(-zeta * M_PI / sqrt(1.0f - zeta * zeta)) // which can be converted to 1:7 fixed point with an excellent fit with a 3rd order polynomial @@ -2993,9 +3029,9 @@ void Stepper::init() { else if (zeta >= 1.0f) factor2 = 0.0f; else { factor2 = 64.44056192 + -99.02008832 * zeta; - const float zeta2 = zeta * zeta; + const_float_t zeta2 = zeta * zeta; factor2 += -7.58095488 * zeta2; - const float zeta3 = zeta2 * zeta; + const_float_t zeta3 = zeta2 * zeta; factor2 += 43.073216 * zeta3; factor2 = floor(factor2); } @@ -3013,7 +3049,7 @@ void Stepper::init() { return -1; } - void Stepper::set_shaping_frequency(const AxisEnum axis, const float freq) { + void Stepper::set_shaping_frequency(const AxisEnum axis, const_float_t freq) { // enabling or disabling shaping whilst moving can result in lost steps planner.synchronize(); @@ -3212,7 +3248,7 @@ int32_t Stepper::triggered_position(const AxisEnum axis) { #if ANY(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY, MARKFORGED_YX, IS_SCARA, DELTA) #define SAYS_A 1 #endif -#if ANY(CORE_IS_XY, CORE_IS_YZ, MARKFORGED_XY, MARKFORGED_YX, IS_SCARA, DELTA) +#if ANY(CORE_IS_XY, CORE_IS_YZ, MARKFORGED_XY, MARKFORGED_YX, IS_SCARA, DELTA, POLAR) #define SAYS_B 1 #endif #if ANY(CORE_IS_XZ, CORE_IS_YZ, DELTA) diff --git a/Marlin/src/module/stepper.h b/Marlin/src/module/stepper.h index e86498e841da..3bbfeac9cab8 100644 --- a/Marlin/src/module/stepper.h +++ b/Marlin/src/module/stepper.h @@ -154,38 +154,39 @@ // Add time for each stepper #if HAS_X_STEP - #define ISR_X_STEPPER_CYCLES ISR_STEPPER_CYCLES + #define ISR_X_STEPPER_CYCLES ISR_STEPPER_CYCLES #endif #if HAS_Y_STEP - #define ISR_Y_STEPPER_CYCLES ISR_STEPPER_CYCLES + #define ISR_Y_STEPPER_CYCLES ISR_STEPPER_CYCLES #endif #if HAS_Z_STEP - #define ISR_Z_STEPPER_CYCLES ISR_STEPPER_CYCLES + #define ISR_Z_STEPPER_CYCLES ISR_STEPPER_CYCLES #endif #if HAS_I_STEP - #define ISR_I_STEPPER_CYCLES ISR_STEPPER_CYCLES + #define ISR_I_STEPPER_CYCLES ISR_STEPPER_CYCLES #endif #if HAS_J_STEP - #define ISR_J_STEPPER_CYCLES ISR_STEPPER_CYCLES + #define ISR_J_STEPPER_CYCLES ISR_STEPPER_CYCLES #endif #if HAS_K_STEP - #define ISR_K_STEPPER_CYCLES ISR_STEPPER_CYCLES + #define ISR_K_STEPPER_CYCLES ISR_STEPPER_CYCLES #endif #if HAS_U_STEP - #define ISR_U_STEPPER_CYCLES ISR_STEPPER_CYCLES + #define ISR_U_STEPPER_CYCLES ISR_STEPPER_CYCLES #endif #if HAS_V_STEP - #define ISR_V_STEPPER_CYCLES ISR_STEPPER_CYCLES + #define ISR_V_STEPPER_CYCLES ISR_STEPPER_CYCLES #endif #if HAS_W_STEP - #define ISR_W_STEPPER_CYCLES ISR_STEPPER_CYCLES + #define ISR_W_STEPPER_CYCLES ISR_STEPPER_CYCLES #endif #if HAS_EXTRUDERS - #define ISR_E_STEPPER_CYCLES ISR_STEPPER_CYCLES // E is always interpolated, even for mixing extruders + #define ISR_E_STEPPER_CYCLES ISR_STEPPER_CYCLES // E is always interpolated, even for mixing extruders #endif // And the total minimum loop time, not including the base -#define MIN_ISR_LOOP_CYCLES (ISR_MIXING_STEPPER_CYCLES LOGICAL_AXIS_GANG(+ ISR_E_STEPPER_CYCLES, + ISR_X_STEPPER_CYCLES, + ISR_Y_STEPPER_CYCLES, + ISR_Z_STEPPER_CYCLES, + ISR_I_STEPPER_CYCLES, + ISR_J_STEPPER_CYCLES, + ISR_K_STEPPER_CYCLES, + ISR_U_STEPPER_CYCLES, + ISR_V_STEPPER_CYCLES, + ISR_W_STEPPER_CYCLES)) +#define _PLUS_AXIS_CYCLES(A) + (ISR_##A##_STEPPER_CYCLES) +#define MIN_ISR_LOOP_CYCLES (ISR_MIXING_STEPPER_CYCLES LOGICAL_AXIS_MAP(_PLUS_AXIS_CYCLES)) // Calculate the minimum MPU cycles needed per pulse to enforce, limited to the max stepper rate #define _MIN_STEPPER_PULSE_CYCLES(N) _MAX(uint32_t((F_CPU) / (MAXIMUM_STEPPER_RATE)), ((F_CPU) / 500000UL) * (N)) @@ -802,9 +803,9 @@ class Stepper { } #if HAS_SHAPING - static void set_shaping_damping_ratio(const AxisEnum axis, const float zeta); + static void set_shaping_damping_ratio(const AxisEnum axis, const_float_t zeta); static float get_shaping_damping_ratio(const AxisEnum axis); - static void set_shaping_frequency(const AxisEnum axis, const float freq); + static void set_shaping_frequency(const AxisEnum axis, const_float_t freq); static float get_shaping_frequency(const AxisEnum axis); #endif diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index d01b4bc14237..4b0ee355d4cf 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -311,7 +311,7 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED); * public: */ -#if ENABLED(NO_FAN_SLOWING_IN_PID_TUNING) +#if ENABLED(TEMP_TUNING_MAINTAIN_FAN) bool Temperature::adaptive_fan_slowing = true; #endif @@ -517,6 +517,9 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED); #if ENABLED(PREVENT_COLD_EXTRUSION) bool Temperature::allow_cold_extrude = false; celsius_t Temperature::extrude_min_temp = EXTRUDE_MINTEMP; +#else + constexpr bool Temperature::allow_cold_extrude; + constexpr celsius_t Temperature::extrude_min_temp; #endif #if HAS_ADC_BUTTONS @@ -561,8 +564,11 @@ volatile bool Temperature::raw_temps_ready = false; uint8_t Temperature::consecutive_low_temperature_error[HOTENDS] = { 0 }; #endif -#if MILLISECONDS_PREHEAT_TIME > 0 - millis_t Temperature::preheat_end_time[HOTENDS] = { 0 }; +#if PREHEAT_TIME_HOTEND_MS > 0 + millis_t Temperature::preheat_end_ms_hotend[HOTENDS] { 0 }; +#endif +#if HAS_HEATED_BED && PREHEAT_TIME_BED_MS > 0 + millis_t Temperature::preheat_end_ms_bed = 0; #endif #if HAS_FAN_LOGIC @@ -657,13 +663,13 @@ volatile bool Temperature::raw_temps_ready = false; TERN_(HAS_FAN_LOGIC, fan_update_ms = next_temp_ms + fan_update_interval_ms); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_STARTED)); - TERN_(DWIN_LCD_PROUI, DWIN_PidTuning(isbed ? PIDTEMPBED_START : PIDTEMP_START)); + TERN_(DWIN_PID_TUNE, DWIN_PidTuning(isbed ? PIDTEMPBED_START : PIDTEMP_START)); if (target > GHV(CHAMBER_MAX_TARGET, BED_MAX_TARGET, temp_range[heater_id].maxtemp - (HOTEND_OVERSHOOT))) { SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH)); - TERN_(DWIN_LCD_PROUI, DWIN_PidTuning(PID_TEMP_TOO_HIGH)); + TERN_(DWIN_PID_TUNE, DWIN_PidTuning(PID_TEMP_TOO_HIGH)); TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH))); return; } @@ -682,7 +688,7 @@ volatile bool Temperature::raw_temps_ready = false; LEDColor color = ONHEATINGSTART(); #endif - TERN_(NO_FAN_SLOWING_IN_PID_TUNING, adaptive_fan_slowing = false); + TERN_(TEMP_TUNING_MAINTAIN_FAN, adaptive_fan_slowing = false); LCD_MESSAGE(MSG_HEATING); @@ -757,7 +763,7 @@ volatile bool Temperature::raw_temps_ready = false; SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH)); - TERN_(DWIN_LCD_PROUI, DWIN_PidTuning(PID_TEMP_TOO_HIGH)); + TERN_(DWIN_PID_TUNE, DWIN_PidTuning(PID_TEMP_TOO_HIGH)); TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH))); break; } @@ -794,7 +800,7 @@ volatile bool Temperature::raw_temps_ready = false; #endif if ((ms - _MIN(t1, t2)) > (MAX_CYCLE_TIME_PID_AUTOTUNE * 60L * 1000L)) { TERN_(DWIN_CREALITY_LCD, DWIN_Popup_Temperature(0)); - TERN_(DWIN_LCD_PROUI, DWIN_PidTuning(PID_TUNING_TIMEOUT)); + TERN_(DWIN_PID_TUNE, DWIN_PidTuning(PID_TUNING_TIMEOUT)); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TUNING_TIMEOUT)); TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TIMEOUT))); SERIAL_ECHOPGM(STR_PID_AUTOTUNE); @@ -849,7 +855,7 @@ volatile bool Temperature::raw_temps_ready = false; TERN_(PRINTER_EVENT_LEDS, printerEventLEDs.onPidTuningDone(color)); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_DONE)); - TERN_(DWIN_LCD_PROUI, DWIN_PidTuning(PID_DONE)); + TERN_(DWIN_PID_TUNE, DWIN_PidTuning(PID_DONE)); goto EXIT_M303; } @@ -867,10 +873,10 @@ volatile bool Temperature::raw_temps_ready = false; TERN_(PRINTER_EVENT_LEDS, printerEventLEDs.onPidTuningDone(color)); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_DONE)); - TERN_(DWIN_LCD_PROUI, DWIN_PidTuning(PID_DONE)); + TERN_(DWIN_PID_TUNE, DWIN_PidTuning(PID_DONE)); EXIT_M303: - TERN_(NO_FAN_SLOWING_IN_PID_TUNING, adaptive_fan_slowing = true); + TERN_(TEMP_TUNING_MAINTAIN_FAN, adaptive_fan_slowing = true); return; } @@ -879,7 +885,7 @@ volatile bool Temperature::raw_temps_ready = false; #if ENABLED(MPCTEMP) void Temperature::MPC_autotune() { - auto housekeeping = [] (millis_t& ms, celsius_float_t& current_temp, millis_t& next_report_ms) { + auto housekeeping = [] (millis_t &ms, celsius_float_t ¤t_temp, millis_t &next_report_ms) { ms = millis(); if (updateTemperaturesIfReady()) { // temp sample ready @@ -900,10 +906,11 @@ volatile bool Temperature::raw_temps_ready = false; if (!wait_for_heatup) { SERIAL_ECHOPGM(STR_MPC_AUTOTUNE); SERIAL_ECHOLNPGM(STR_MPC_AUTOTUNE_INTERRUPTED); - return false; + TERN_(DWIN_LCD_PROUI, DWIN_MPCTuning(MPC_INTERRUPTED)); + return true; } - return true; + return false; }; struct OnExit { @@ -920,13 +927,17 @@ volatile bool Temperature::raw_temps_ready = false; #endif do_z_clearance(MPC_TUNING_END_Z); + + TERN_(TEMP_TUNING_MAINTAIN_FAN, adaptive_fan_slowing = true); } } on_exit; SERIAL_ECHOPGM(STR_MPC_AUTOTUNE); SERIAL_ECHOLNPGM(STR_MPC_AUTOTUNE_START, active_extruder); MPCHeaterInfo &hotend = temp_hotend[active_extruder]; - MPC_t &constants = hotend.constants; + MPC_t &mpc = hotend.mpc; + + TERN_(TEMP_TUNING_MAINTAIN_FAN, adaptive_fan_slowing = false); // Move to center of bed, just above bed height and cool with max fan gcode.home_all_axes(true); @@ -936,18 +947,23 @@ volatile bool Temperature::raw_temps_ready = false; set_fan_speed(EITHER(MPC_FAN_0_ALL_HOTENDS, MPC_FAN_0_ACTIVE_HOTEND) ? 0 : active_extruder, 255); planner.sync_fan_speeds(fan_speed); #endif - const xyz_pos_t tuningpos = MPC_TUNING_POS; - do_blocking_move_to(tuningpos); + do_blocking_move_to(xyz_pos_t(MPC_TUNING_POS)); SERIAL_ECHOLNPGM(STR_MPC_COOLING_TO_AMBIENT); - LCD_MESSAGE(MSG_COOLING); + #if ENABLED(DWIN_LCD_PROUI) + DWIN_MPCTuning(MPCTEMP_START); + LCD_ALERTMESSAGE(MSG_MPC_COOLING_TO_AMBIENT); + #else + LCD_MESSAGE(MSG_COOLING); + #endif + millis_t ms = millis(), next_report_ms = ms, next_test_ms = ms + 10000UL; celsius_float_t current_temp = degHotend(active_extruder), ambient_temp = current_temp; wait_for_heatup = true; for (;;) { // Can be interrupted with M108 - if (!housekeeping(ms, current_temp, next_report_ms)) return; + if (housekeeping(ms, current_temp, next_report_ms)) return; if (ELAPSED(ms, next_test_ms)) { if (current_temp >= ambient_temp) { @@ -958,6 +974,7 @@ volatile bool Temperature::raw_temps_ready = false; next_test_ms += 10000UL; } } + wait_for_heatup = false; #if HAS_FAN set_fan_speed(EITHER(MPC_FAN_0_ALL_HOTENDS, MPC_FAN_0_ACTIVE_HOTEND) ? 0 : active_extruder, 0); @@ -967,17 +984,18 @@ volatile bool Temperature::raw_temps_ready = false; hotend.modeled_ambient_temp = ambient_temp; SERIAL_ECHOLNPGM(STR_MPC_HEATING_PAST_200); - LCD_MESSAGE(MSG_HEATING); + TERN(DWIN_LCD_PROUI, LCD_ALERTMESSAGE(MSG_MPC_HEATING_PAST_200), LCD_MESSAGE(MSG_HEATING)); hotend.target = 200.0f; // So M105 looks nice - hotend.soft_pwm_amount = MPC_MAX >> 1; + hotend.soft_pwm_amount = (MPC_MAX) >> 1; const millis_t heat_start_time = next_test_ms = ms; celsius_float_t temp_samples[16]; uint8_t sample_count = 0; uint16_t sample_distance = 1; float t1_time = 0; + wait_for_heatup = true; for (;;) { // Can be interrupted with M108 - if (!housekeeping(ms, current_temp, next_report_ms)) return; + if (housekeeping(ms, current_temp, next_report_ms)) return; if (ELAPSED(ms, next_test_ms)) { // Record samples between 100C and 200C @@ -999,6 +1017,8 @@ volatile bool Temperature::raw_temps_ready = false; next_test_ms += 1000UL * sample_distance; } } + wait_for_heatup = false; + hotend.soft_pwm_amount = 0; // Calculate physical constants from three equally-spaced samples @@ -1009,17 +1029,17 @@ volatile bool Temperature::raw_temps_ready = false; float asymp_temp = (t2 * t2 - t1 * t3) / (2 * t2 - t1 - t3), block_responsiveness = -log((t2 - asymp_temp) / (t1 - asymp_temp)) / (sample_distance * (sample_count >> 1)); - constants.ambient_xfer_coeff_fan0 = constants.heater_power * (MPC_MAX) / 255 / (asymp_temp - ambient_temp); - constants.fan255_adjustment = 0.0f; - constants.block_heat_capacity = constants.ambient_xfer_coeff_fan0 / block_responsiveness; - constants.sensor_responsiveness = block_responsiveness / (1.0f - (ambient_temp - asymp_temp) * exp(-block_responsiveness * t1_time) / (t1 - asymp_temp)); + mpc.ambient_xfer_coeff_fan0 = mpc.heater_power * (MPC_MAX) / 255 / (asymp_temp - ambient_temp); + mpc.fan255_adjustment = 0.0f; + mpc.block_heat_capacity = mpc.ambient_xfer_coeff_fan0 / block_responsiveness; + mpc.sensor_responsiveness = block_responsiveness / (1.0f - (ambient_temp - asymp_temp) * exp(-block_responsiveness * t1_time) / (t1 - asymp_temp)); hotend.modeled_block_temp = asymp_temp + (ambient_temp - asymp_temp) * exp(-block_responsiveness * (ms - heat_start_time) / 1000.0f); hotend.modeled_sensor_temp = current_temp; // Allow the system to stabilize under MPC, then get a better measure of ambient loss with and without fan SERIAL_ECHOLNPGM(STR_MPC_MEASURING_AMBIENT, hotend.modeled_block_temp); - LCD_MESSAGE(MSG_MPC_MEASURING_AMBIENT); + TERN(DWIN_LCD_PROUI, LCD_ALERTMESSAGE(MSG_MPC_MEASURING_AMBIENT), LCD_MESSAGE(MSG_MPC_MEASURING_AMBIENT)); hotend.target = hotend.modeled_block_temp; next_test_ms = ms + MPC_dT * 1000; constexpr millis_t settle_time = 20000UL, test_duration = 20000UL; @@ -1032,14 +1052,15 @@ volatile bool Temperature::raw_temps_ready = false; #endif float last_temp = current_temp; + wait_for_heatup = true; for (;;) { // Can be interrupted with M108 - if (!housekeeping(ms, current_temp, next_report_ms)) return; + if (housekeeping(ms, current_temp, next_report_ms)) return; if (ELAPSED(ms, next_test_ms)) { hotend.soft_pwm_amount = (int)get_pid_output_hotend(active_extruder) >> 1; if (ELAPSED(ms, settle_end_ms) && !ELAPSED(ms, test_end_ms) && TERN1(HAS_FAN, !fan0_done)) - total_energy_fan0 += constants.heater_power * hotend.soft_pwm_amount / 127 * MPC_dT + (last_temp - current_temp) * constants.block_heat_capacity; + total_energy_fan0 += mpc.heater_power * hotend.soft_pwm_amount / 127 * MPC_dT + (last_temp - current_temp) * mpc.block_heat_capacity; #if HAS_FAN else if (ELAPSED(ms, test_end_ms) && !fan0_done) { set_fan_speed(EITHER(MPC_FAN_0_ALL_HOTENDS, MPC_FAN_0_ACTIVE_HOTEND) ? 0 : active_extruder, 255); @@ -1049,7 +1070,7 @@ volatile bool Temperature::raw_temps_ready = false; fan0_done = true; } else if (ELAPSED(ms, settle_end_ms) && !ELAPSED(ms, test_end_ms)) - total_energy_fan255 += constants.heater_power * hotend.soft_pwm_amount / 127 * MPC_dT + (last_temp - current_temp) * constants.block_heat_capacity; + total_energy_fan255 += mpc.heater_power * hotend.soft_pwm_amount / 127 * MPC_dT + (last_temp - current_temp) * mpc.block_heat_capacity; #endif else if (ELAPSED(ms, test_end_ms)) break; @@ -1059,29 +1080,32 @@ volatile bool Temperature::raw_temps_ready = false; if (!WITHIN(current_temp, t3 - 15.0f, hotend.target + 15.0f)) { SERIAL_ECHOLNPGM(STR_MPC_TEMPERATURE_ERROR); + TERN_(DWIN_LCD_PROUI, DWIN_MPCTuning(MPC_TEMP_ERROR)); break; } } + wait_for_heatup = false; const float power_fan0 = total_energy_fan0 * 1000 / test_duration; - constants.ambient_xfer_coeff_fan0 = power_fan0 / (hotend.target - ambient_temp); + mpc.ambient_xfer_coeff_fan0 = power_fan0 / (hotend.target - ambient_temp); #if HAS_FAN const float power_fan255 = total_energy_fan255 * 1000 / test_duration, ambient_xfer_coeff_fan255 = power_fan255 / (hotend.target - ambient_temp); - constants.fan255_adjustment = ambient_xfer_coeff_fan255 - constants.ambient_xfer_coeff_fan0; + mpc.applyFanAdjustment(ambient_xfer_coeff_fan255); #endif // Calculate a new and better asymptotic temperature and re-evaluate the other constants - asymp_temp = ambient_temp + constants.heater_power * (MPC_MAX) / 255 / constants.ambient_xfer_coeff_fan0; + asymp_temp = ambient_temp + mpc.heater_power * (MPC_MAX) / 255 / mpc.ambient_xfer_coeff_fan0; block_responsiveness = -log((t2 - asymp_temp) / (t1 - asymp_temp)) / (sample_distance * (sample_count >> 1)); - constants.block_heat_capacity = constants.ambient_xfer_coeff_fan0 / block_responsiveness; - constants.sensor_responsiveness = block_responsiveness / (1.0f - (ambient_temp - asymp_temp) * exp(-block_responsiveness * t1_time) / (t1 - asymp_temp)); + mpc.block_heat_capacity = mpc.ambient_xfer_coeff_fan0 / block_responsiveness; + mpc.sensor_responsiveness = block_responsiveness / (1.0f - (ambient_temp - asymp_temp) * exp(-block_responsiveness * t1_time) / (t1 - asymp_temp)); SERIAL_ECHOPGM(STR_MPC_AUTOTUNE); SERIAL_ECHOLNPGM(STR_MPC_AUTOTUNE_FINISHED); + TERN_(DWIN_LCD_PROUI, DWIN_MPCTuning(MPC_DONE)); - /* <-- add a slash to enable + #if 0 SERIAL_ECHOLNPGM("t1_time ", t1_time); SERIAL_ECHOLNPGM("sample_count ", sample_count); SERIAL_ECHOLNPGM("sample_distance ", sample_distance); @@ -1090,10 +1114,11 @@ volatile bool Temperature::raw_temps_ready = false; SERIAL_ECHOLNPGM("t1 ", t1, " t2 ", t2, " t3 ", t3); SERIAL_ECHOLNPGM("asymp_temp ", asymp_temp); SERIAL_ECHOLNPAIR_F("block_responsiveness ", block_responsiveness, 4); - //*/ - SERIAL_ECHOLNPGM("MPC_BLOCK_HEAT_CAPACITY ", constants.block_heat_capacity); - SERIAL_ECHOLNPAIR_F("MPC_SENSOR_RESPONSIVENESS ", constants.sensor_responsiveness, 4); - SERIAL_ECHOLNPAIR_F("MPC_AMBIENT_XFER_COEFF ", constants.ambient_xfer_coeff_fan0, 4); + #endif + + SERIAL_ECHOLNPGM("MPC_BLOCK_HEAT_CAPACITY ", mpc.block_heat_capacity); + SERIAL_ECHOLNPAIR_F("MPC_SENSOR_RESPONSIVENESS ", mpc.sensor_responsiveness, 4); + SERIAL_ECHOLNPAIR_F("MPC_AMBIENT_XFER_COEFF ", mpc.ambient_xfer_coeff_fan0, 4); TERN_(HAS_FAN, SERIAL_ECHOLNPAIR_F("MPC_AMBIENT_XFER_COEFF_FAN255 ", ambient_xfer_coeff_fan255, 4)); } @@ -1410,7 +1435,7 @@ void Temperature::mintemp_error(const heater_id_t heater_id) { #elif ENABLED(MPCTEMP) MPCHeaterInfo &hotend = temp_hotend[ee]; - MPC_t &constants = hotend.constants; + MPC_t &mpc = hotend.mpc; // At startup, initialize modeled temperatures if (isnan(hotend.modeled_block_temp)) { @@ -1424,11 +1449,11 @@ void Temperature::mintemp_error(const heater_id_t heater_id) { const bool this_hotend = (ee == active_extruder); #endif - float ambient_xfer_coeff = constants.ambient_xfer_coeff_fan0; + float ambient_xfer_coeff = mpc.ambient_xfer_coeff_fan0; #if ENABLED(MPC_INCLUDE_FAN) const uint8_t fan_index = EITHER(MPC_FAN_0_ACTIVE_HOTEND, MPC_FAN_0_ALL_HOTENDS) ? 0 : ee; const float fan_fraction = TERN_(MPC_FAN_0_ACTIVE_HOTEND, !this_hotend ? 0.0f : ) fan_speed[fan_index] * RECIPROCAL(255); - ambient_xfer_coeff += fan_fraction * constants.fan255_adjustment; + ambient_xfer_coeff += fan_fraction * mpc.fan255_adjustment; #endif if (this_hotend) { @@ -1439,17 +1464,17 @@ void Temperature::mintemp_error(const heater_id_t heater_id) { if (fabs(e_speed) > planner.settings.max_feedrate_mm_s[E_AXIS]) mpc_e_position = e_position; else if (e_speed > 0.0f) { // Ignore retract/recover moves - ambient_xfer_coeff += e_speed * constants.filament_heat_capacity_permm; + ambient_xfer_coeff += e_speed * mpc.filament_heat_capacity_permm; mpc_e_position = e_position; } } // Update the modeled temperatures - float blocktempdelta = hotend.soft_pwm_amount * constants.heater_power * (MPC_dT / 127) / constants.block_heat_capacity; - blocktempdelta += (hotend.modeled_ambient_temp - hotend.modeled_block_temp) * ambient_xfer_coeff * MPC_dT / constants.block_heat_capacity; + float blocktempdelta = hotend.soft_pwm_amount * mpc.heater_power * (MPC_dT / 127) / mpc.block_heat_capacity; + blocktempdelta += (hotend.modeled_ambient_temp - hotend.modeled_block_temp) * ambient_xfer_coeff * MPC_dT / mpc.block_heat_capacity; hotend.modeled_block_temp += blocktempdelta; - const float sensortempdelta = (hotend.modeled_block_temp - hotend.modeled_sensor_temp) * (constants.sensor_responsiveness * MPC_dT); + const float sensortempdelta = (hotend.modeled_block_temp - hotend.modeled_sensor_temp) * (mpc.sensor_responsiveness * MPC_dT); hotend.modeled_sensor_temp += sensortempdelta; // Any delta between hotend.modeled_sensor_temp and hotend.celsius is either model @@ -1465,11 +1490,11 @@ void Temperature::mintemp_error(const heater_id_t heater_id) { float power = 0.0; if (hotend.target != 0 && !is_idling) { // Plan power level to get to target temperature in 2 seconds - power = (hotend.target - hotend.modeled_block_temp) * constants.block_heat_capacity / 2.0f; + power = (hotend.target - hotend.modeled_block_temp) * mpc.block_heat_capacity / 2.0f; power -= (hotend.modeled_ambient_temp - hotend.modeled_block_temp) * ambient_xfer_coeff; } - float pid_output = power * 254.0f / constants.heater_power + 1.0f; // Ensure correct quantization into a range of 0 to 127 + float pid_output = power * 254.0f / mpc.heater_power + 1.0f; // Ensure correct quantization into a range of 0 to 127 pid_output = constrain(pid_output, 0, MPC_MAX); /* <-- add a slash to enable @@ -1535,7 +1560,7 @@ void Temperature::mintemp_error(const heater_id_t heater_id) { tr_state_machine[e].run(temp_hotend[e].celsius, temp_hotend[e].target, (heater_id_t)e, THERMAL_PROTECTION_PERIOD, THERMAL_PROTECTION_HYSTERESIS); #endif - temp_hotend[e].soft_pwm_amount = (temp_hotend[e].celsius > temp_range[e].mintemp || is_preheating(e)) && temp_hotend[e].celsius < temp_range[e].maxtemp ? (int)get_pid_output_hotend(e) >> 1 : 0; + temp_hotend[e].soft_pwm_amount = (temp_hotend[e].celsius > temp_range[e].mintemp || is_hotend_preheating(e)) && temp_hotend[e].celsius < temp_range[e].maxtemp ? (int)get_pid_output_hotend(e) >> 1 : 0; #if WATCH_HOTENDS // Make sure temperature is increasing @@ -1609,25 +1634,30 @@ void Temperature::mintemp_error(const heater_id_t heater_id) { #endif if (!bed_timed_out) { - #if ENABLED(PIDTEMPBED) - temp_bed.soft_pwm_amount = WITHIN(temp_bed.celsius, BED_MINTEMP, BED_MAXTEMP) ? (int)get_pid_output_bed() >> 1 : 0; - #else - // Check if temperature is within the correct band - if (WITHIN(temp_bed.celsius, BED_MINTEMP, BED_MAXTEMP)) { - #if ENABLED(BED_LIMIT_SWITCHING) - if (temp_bed.is_above_target((BED_HYSTERESIS) - 1)) - temp_bed.soft_pwm_amount = 0; - else if (temp_bed.is_below_target((BED_HYSTERESIS) - 1)) - temp_bed.soft_pwm_amount = MAX_BED_POWER >> 1; - #else // !PIDTEMPBED && !BED_LIMIT_SWITCHING - temp_bed.soft_pwm_amount = temp_bed.is_below_target() ? MAX_BED_POWER >> 1 : 0; - #endif - } - else { - temp_bed.soft_pwm_amount = 0; - WRITE_HEATER_BED(LOW); - } - #endif + if (is_bed_preheating()) { + temp_bed.soft_pwm_amount = MAX_BED_POWER >> 1; + } + else { + #if ENABLED(PIDTEMPBED) + temp_bed.soft_pwm_amount = WITHIN(temp_bed.celsius, BED_MINTEMP, BED_MAXTEMP) ? (int)get_pid_output_bed() >> 1 : 0; + #else + // Check if temperature is within the correct band + if (WITHIN(temp_bed.celsius, BED_MINTEMP, BED_MAXTEMP)) { + #if ENABLED(BED_LIMIT_SWITCHING) + if (temp_bed.is_above_target((BED_HYSTERESIS) - 1)) + temp_bed.soft_pwm_amount = 0; + else if (temp_bed.is_below_target((BED_HYSTERESIS) - 1)) + temp_bed.soft_pwm_amount = MAX_BED_POWER >> 1; + #else // !PIDTEMPBED && !BED_LIMIT_SWITCHING + temp_bed.soft_pwm_amount = temp_bed.is_below_target() ? MAX_BED_POWER >> 1 : 0; + #endif + } + else { + temp_bed.soft_pwm_amount = 0; + WRITE_HEATER_BED(LOW); + } + #endif + } } } while (false); @@ -2394,7 +2424,7 @@ void Temperature::updateTemperaturesFromRawValues() { //*/ const bool heater_on = temp_hotend[e].target > 0; - if (heater_on && !is_preheating(e) && ((neg && r > temp_range[e].raw_min) || (pos && r < temp_range[e].raw_min))) { + if (heater_on && !is_hotend_preheating(e) && ((neg && r > temp_range[e].raw_min) || (pos && r < temp_range[e].raw_min))) { if (TERN1(MULTI_MAX_CONSECUTIVE_LOW_TEMP_ERR, ++consecutive_low_temperature_error[e] >= MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED)) mintemp_error((heater_id_t)e); } @@ -2408,7 +2438,7 @@ void Temperature::updateTemperaturesFromRawValues() { #define TP_CMP(S,A,B) (TEMPDIR(S) < 0 ? ((A)<(B)) : ((A)>(B))) #if ENABLED(THERMAL_PROTECTION_BED) if (TP_CMP(BED, temp_bed.getraw(), maxtemp_raw_BED)) maxtemp_error(H_BED); - if (temp_bed.target > 0 && TP_CMP(BED, mintemp_raw_BED, temp_bed.getraw())) mintemp_error(H_BED); + if (temp_bed.target > 0 && !is_bed_preheating() && TP_CMP(BED, mintemp_raw_BED, temp_bed.getraw())) mintemp_error(H_BED); #endif #if BOTH(HAS_HEATED_CHAMBER, THERMAL_PROTECTION_CHAMBER) @@ -4103,6 +4133,7 @@ void Temperature::isr() { } while (wait_for_heatup && TEMP_CONDITIONS); + // If wait_for_heatup is set, temperature was reached, no cancel if (wait_for_heatup) { wait_for_heatup = false; #if HAS_DWIN_E3V2_BASIC @@ -4241,6 +4272,7 @@ void Temperature::isr() { } while (wait_for_heatup && TEMP_BED_CONDITIONS); + // If wait_for_heatup is set, temperature was reached, no cancel if (wait_for_heatup) { wait_for_heatup = false; ui.reset_status(); @@ -4319,6 +4351,7 @@ void Temperature::isr() { } } + // If wait_for_heatup is set, temperature was reached, no cancel if (wait_for_heatup) { wait_for_heatup = false; ui.reset_status(); @@ -4418,6 +4451,7 @@ void Temperature::isr() { } } while (wait_for_heatup && TEMP_CHAMBER_CONDITIONS); + // If wait_for_heatup is set, temperature was reached, no cancel if (wait_for_heatup) { wait_for_heatup = false; ui.reset_status(); @@ -4504,6 +4538,7 @@ void Temperature::isr() { first_loop = false; #endif // TEMP_COOLER_RESIDENCY_TIME > 0 + // Prevent a wait-forever situation if R is misused i.e. M191 R0 if (wants_to_cool) { // Break after MIN_COOLING_SLOPE_TIME_CHAMBER seconds // if the temperature did not drop at least MIN_COOLING_SLOPE_DEG_CHAMBER @@ -4516,7 +4551,7 @@ void Temperature::isr() { } while (wait_for_heatup && TEMP_COOLER_CONDITIONS); - // Prevent a wait-forever situation if R is misused i.e. M191 R0 + // If wait_for_heatup is set, temperature was reached, no cancel if (wait_for_heatup) { wait_for_heatup = false; ui.reset_status(); diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index 091f218eb837..afbf656a7ab6 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -382,10 +382,14 @@ typedef struct { float p, i, d, c, f; } raw_pidcf_t; float block_heat_capacity; // M306 C float sensor_responsiveness; // M306 R float ambient_xfer_coeff_fan0; // M306 A + float filament_heat_capacity_permm; // M306 H #if ENABLED(MPC_INCLUDE_FAN) float fan255_adjustment; // M306 F + void applyFanAdjustment(const_float_t cf) { fan255_adjustment = cf - ambient_xfer_coeff_fan0; } + #else + void applyFanAdjustment(const_float_t) {} #endif - float filament_heat_capacity_permm; // M306 H + float fanCoefficient() { return SUM_TERN(MPC_INCLUDE_FAN, ambient_xfer_coeff_fan0, fan255_adjustment); } } MPC_t; #define MPC_dT ((OVERSAMPLENR * float(ACTUAL_ADC_SAMPLES)) / (TEMP_TIMER_FREQUENCY)) @@ -433,10 +437,12 @@ struct PIDHeaterInfo : public HeaterInfo { #if ENABLED(MPCTEMP) struct MPCHeaterInfo : public HeaterInfo { - MPC_t constants; + MPC_t mpc; float modeled_ambient_temp, modeled_block_temp, modeled_sensor_temp; + float fanCoefficient() { return mpc.fanCoefficient(); } + void applyFanAdjustment(const_float_t cf) { mpc.applyFanAdjustment(cf); } }; #endif @@ -637,6 +643,8 @@ class Temperature { static bool tooColdToExtrude(const uint8_t E_NAME) { return tooCold(wholeDegHotend(HOTEND_INDEX)); } static bool targetTooColdToExtrude(const uint8_t E_NAME) { return tooCold(degTargetHotend(HOTEND_INDEX)); } #else + static constexpr bool allow_cold_extrude = true; + static constexpr celsius_t extrude_min_temp = 0; static bool tooColdToExtrude(const uint8_t) { return false; } static bool targetTooColdToExtrude(const uint8_t) { return false; } #endif @@ -748,10 +756,6 @@ class Temperature { static uint8_t consecutive_low_temperature_error[HOTENDS]; #endif - #if MILLISECONDS_PREHEAT_TIME > 0 - static millis_t preheat_end_time[HOTENDS]; - #endif - #if HAS_FAN_LOGIC static millis_t fan_update_ms; @@ -907,20 +911,38 @@ class Temperature { static void task(); /** - * Preheating hotends + * Preheating hotends & bed */ - #if MILLISECONDS_PREHEAT_TIME > 0 - static bool is_preheating(const uint8_t E_NAME) { - return preheat_end_time[HOTEND_INDEX] && PENDING(millis(), preheat_end_time[HOTEND_INDEX]); + #if PREHEAT_TIME_HOTEND_MS > 0 + static millis_t preheat_end_ms_hotend[HOTENDS]; + static bool is_hotend_preheating(const uint8_t E_NAME) { + return preheat_end_ms_hotend[HOTEND_INDEX] && PENDING(millis(), preheat_end_ms_hotend[HOTEND_INDEX]); } - static void start_preheat_time(const uint8_t E_NAME) { - preheat_end_time[HOTEND_INDEX] = millis() + MILLISECONDS_PREHEAT_TIME; + static void start_hotend_preheat_time(const uint8_t E_NAME) { + preheat_end_ms_hotend[HOTEND_INDEX] = millis() + PREHEAT_TIME_HOTEND_MS; } - static void reset_preheat_time(const uint8_t E_NAME) { - preheat_end_time[HOTEND_INDEX] = 0; + static void reset_hotend_preheat_time(const uint8_t E_NAME) { + preheat_end_ms_hotend[HOTEND_INDEX] = 0; } #else - #define is_preheating(n) (false) + static bool is_hotend_preheating(const uint8_t) { return false; } + #endif + + #if HAS_HEATED_BED + #if PREHEAT_TIME_BED_MS > 0 + static millis_t preheat_end_ms_bed; + static bool is_bed_preheating() { + return preheat_end_ms_bed && PENDING(millis(), preheat_end_ms_bed); + } + static void start_bed_preheat_time() { + preheat_end_ms_bed = millis() + PREHEAT_TIME_BED_MS; + } + static void reset_bed_preheat_time() { + preheat_end_ms_bed = 0; + } + #else + static bool is_bed_preheating() { return false; } + #endif #endif //high level conversion routines, for use outside of temperature.cpp @@ -949,11 +971,11 @@ class Temperature { static void setTargetHotend(const celsius_t celsius, const uint8_t E_NAME) { const uint8_t ee = HOTEND_INDEX; - #if MILLISECONDS_PREHEAT_TIME > 0 + #if PREHEAT_TIME_HOTEND_MS > 0 if (celsius == 0) - reset_preheat_time(ee); + reset_hotend_preheat_time(ee); else if (temp_hotend[ee].target == 0) - start_preheat_time(ee); + start_hotend_preheat_time(ee); #endif TERN_(AUTO_POWER_CONTROL, if (celsius) powerManager.power_on()); temp_hotend[ee].target = _MIN(celsius, hotend_max_target(ee)); @@ -1016,6 +1038,12 @@ class Temperature { static void start_watching_bed() { TERN_(WATCH_BED, watch_bed.restart(degBed(), degTargetBed())); } static void setTargetBed(const celsius_t celsius) { + #if PREHEAT_TIME_BED_MS > 0 + if (celsius == 0) + reset_bed_preheat_time(); + else if (temp_bed.target == 0) + start_bed_preheat_time(); + #endif TERN_(AUTO_POWER_CONTROL, if (celsius) powerManager.power_on()); temp_bed.target = _MIN(celsius, BED_MAX_TARGET); start_watching_bed(); @@ -1134,6 +1162,12 @@ class Temperature { static void auto_job_check_timer(const bool can_start, const bool can_stop); #endif + #if ENABLED(TEMP_TUNING_MAINTAIN_FAN) + static bool adaptive_fan_slowing; + #elif ENABLED(ADAPTIVE_FAN_SLOWING) + static constexpr bool adaptive_fan_slowing = true; + #endif + /** * Perform auto-tuning for hotend or bed in response to M303 */ @@ -1145,12 +1179,6 @@ class Temperature { static void PID_autotune(const celsius_t target, const heater_id_t heater_id, const int8_t ncycles, const bool set_result=false); - #if ENABLED(NO_FAN_SLOWING_IN_PID_TUNING) - static bool adaptive_fan_slowing; - #elif ENABLED(ADAPTIVE_FAN_SLOWING) - static constexpr bool adaptive_fan_slowing = true; - #endif - // Update the temp manager when PID values change #if ENABLED(PIDTEMP) static void updatePID() { HOTEND_LOOP() temp_hotend[e].pid.reset(); } diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index 7322098c0bb7..74e99ac09344 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -929,7 +929,7 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0. * Returns FALSE if able to move. */ bool too_cold(uint8_t toolID){ - if (TERN0(PREVENT_COLD_EXTRUSION, !DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(toolID))) { + if (!DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(toolID)) { SERIAL_ECHO_MSG(STR_ERR_HOTEND_TOO_COLD); return true; } @@ -1429,12 +1429,10 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { bool extruder_migration() { - #if ENABLED(PREVENT_COLD_EXTRUSION) - if (thermalManager.targetTooColdToExtrude(active_extruder)) { - DEBUG_ECHOLNPGM("Migration Source Too Cold"); - return false; - } - #endif + if (thermalManager.targetTooColdToExtrude(active_extruder)) { + DEBUG_ECHOLNPGM("Migration Source Too Cold"); + return false; + } // No auto-migration or specified target? if (!migration.target && active_extruder >= migration.last) { diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h index aac839808119..a574a9fe8d0d 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h @@ -358,11 +358,11 @@ #define BEEPER_PIN EXP1_01_PIN #elif ENABLED(CR10_STOCKDISPLAY) - #define BTN_ENC EXP1_02_PIN // (58) open-drain #define LCD_PINS_RS EXP1_07_PIN #define BTN_EN1 EXP1_03_PIN #define BTN_EN2 EXP1_05_PIN + #define BTN_ENC EXP1_02_PIN #define LCD_PINS_ENABLE EXP1_08_PIN #define LCD_PINS_D4 EXP1_06_PIN diff --git a/Marlin/src/pins/ramps/pins_K8400.h b/Marlin/src/pins/ramps/pins_K8400.h index 686c29b7fb8f..22ac1be8abc9 100644 --- a/Marlin/src/pins/ramps/pins_K8400.h +++ b/Marlin/src/pins/ramps/pins_K8400.h @@ -51,7 +51,7 @@ #define Y_STOP_PIN 14 #if EITHER(BLTOUCH, TOUCH_MI_PROBE) - #define HAS_INVERTED_PROBE + #define INVERTED_PROBE_STATE #endif #include "pins_3DRAG.h" // ... RAMPS diff --git a/Marlin/src/pins/sanguino/pins_MELZI_CREALITY.h b/Marlin/src/pins/sanguino/pins_MELZI_CREALITY.h index f508093c2257..437ba35eeadc 100644 --- a/Marlin/src/pins/sanguino/pins_MELZI_CREALITY.h +++ b/Marlin/src/pins/sanguino/pins_MELZI_CREALITY.h @@ -43,13 +43,19 @@ #endif // -// For the stock CR-10 enable CR10_STOCKDISPLAY in Configuration.h +// LCD / Controller // -#if ENABLED(CR10_STOCKDISPLAY) - #define LCD_SDSS 31 // Smart Controller SD card reader (rather than the Melzi) - #define LCD_PINS_RS 28 // ST9720 CS - #define LCD_PINS_ENABLE 17 // ST9720 DAT - #define LCD_PINS_D4 30 // ST9720 CLK +#if ANY(MKS_MINI_12864, CR10_STOCKDISPLAY, ENDER2_STOCKDISPLAY) + #if ENABLED(CR10_STOCKDISPLAY) + #define LCD_PINS_RS 28 // ST9720 CS + #define LCD_PINS_ENABLE 17 // ST9720 DAT + #define LCD_PINS_D4 30 // ST9720 CLK + #elif EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY) + #define DOGLCD_CS 28 + #define DOGLCD_A0 30 + #endif + + #define LCD_SDSS 31 // Controller's SD card #define BTN_ENC 16 #define BTN_EN1 11 @@ -57,6 +63,7 @@ #define BEEPER_PIN 27 #define LCD_PINS_DEFINED + #endif #include "pins_MELZI.h" // ... SANGUINOLOLU_12 ... SANGUINOLOLU_11 diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h index 8ed09417f0df..9448d4f0c5b8 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h @@ -163,8 +163,8 @@ #if ENABLED(CR10_STOCKDISPLAY) #define BEEPER_PIN EXP1_01_PIN - #define BTN_ENC EXP1_02_PIN + #define BTN_ENC EXP1_02_PIN #define BTN_EN1 EXP1_03_PIN #define BTN_EN2 EXP1_05_PIN @@ -172,6 +172,37 @@ #define LCD_PINS_ENABLE EXP1_08_PIN #define LCD_PINS_D4 EXP1_06_PIN + #elif ENABLED(LCD_FOR_MELZI) + + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! LCD for Melzi v4 display requires a custom cable. See 'pins_BTT_SKR_MINI_E3_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif + + /** + * LCD for Melzi v4 needs a custom cable with reversed GND/5V pins; plugging in a standard cable may damage the board or LCD! + * 1. Swap the LCD's +5V (Pin2) and GND (Pin1) wires. (This is the critical part!) + * 2. Swap pin 4 on the Melzi LCD to pin 7 on the SKR Mini E3 EXP1 connector (pin 4 on the SKR is a RESET and cannot be used) + * + * LCD for Melzi V4 SKR Mini E3 V2.0 + * ------ ------ + * LCD RS | 1 2 | EN1 LCD RS | 1 2 | EN1 + * LCD EN | 3 4 | EN2 LCD EN | 3 4 | OPEN (RESET) + * LCD D4 | 5 6 | ENC LCD D4 | 5 6 | ENC + * E-Stop | 7 8 | BEEP EN2 | 7 8 | BEEP + * 5V | 9 10 | GND GND | 9 10 | 5V + * ------ ------ + * EXP1 EXP1 + */ + #define BEEPER_PIN EXP1_08_PIN + + #define BTN_ENC EXP1_06_PIN + #define BTN_EN1 EXP1_02_PIN + #define BTN_EN2 EXP1_07_PIN + + #define LCD_PINS_RS EXP1_01_PIN + #define LCD_PINS_ENABLE EXP1_03_PIN + #define LCD_PINS_D4 EXP1_05_PIN + #elif ENABLED(ZONESTAR_LCD) // ANET A8 LCD Controller - Must convert to 3.3V - CONNECTING TO 5V WILL DAMAGE THE BOARD! #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING @@ -306,7 +337,7 @@ #define FORCE_SOFT_SPI #else - #error "Only CR10_STOCKDISPLAY, ZONESTAR_LCD, ENDER2_STOCKDISPLAY, MKS_MINI_12864, TFTGLCD_PANEL_(SPI|I2C), FYSETC_MINI_12864_2_1, MKS_MINI_12864_V3, and BTT_MINI_12864_V1 are currently supported on the BIGTREE_SKR_MINI_E3." + #error "Only CR10_STOCKDISPLAY, LCD_FOR_MELZI, ZONESTAR_LCD, ENDER2_STOCKDISPLAY, MKS_MINI_12864, TFTGLCD_PANEL_(SPI|I2C), FYSETC_MINI_12864_2_1, MKS_MINI_12864_V3, and BTT_MINI_12864_V1 are currently supported on the BIGTREE_SKR_MINI_E3." #endif #endif // HAS_WIRED_LCD diff --git a/Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h b/Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h index b76ef52c420a..89e07d6a21e8 100644 --- a/Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h +++ b/Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h @@ -27,6 +27,8 @@ #define Z2_STEP_PIN PF5 #define Z2_DIR_PIN PF1 +#define Z_STOP_PIN PA14 + #ifndef FIL_RUNOUT2_PIN #define FIL_RUNOUT2_PIN PF13 #endif diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h index 59441dc80609..cd4989d73d49 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h @@ -149,26 +149,27 @@ * If the screen stays white, disable 'LCD_RESET_PIN' * to let the bootloader init the screen. */ -#if EITHER(HAS_FSMC_GRAPHICAL_TFT, TFT_320x240) - #define FSMC_CS_PIN PD7 // NE4 - #define FSMC_RS_PIN PD11 // A0 +#if HAS_FSMC_TFT - #define TFT_CS_PIN FSMC_CS_PIN - #define TFT_RS_PIN FSMC_RS_PIN + #define TFT_CS_PIN PD7 // NE4 + #define TFT_RS_PIN PD11 // A0 + #define LCD_RESET_PIN PC6 // FSMC_RST + #define LCD_BACKLIGHT_PIN PD13 + + #define FSMC_CS_PIN TFT_CS_PIN // NE4 + #define FSMC_RS_PIN TFT_RS_PIN // A0 #define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT #define FSMC_DMA_DEV DMA2 #define FSMC_DMA_CHANNEL DMA_CH5 - #define LCD_RESET_PIN PC6 // FSMC_RST - #define LCD_BACKLIGHT_PIN PD13 -#endif + #if NEED_TOUCH_PINS + #define TOUCH_CS_PIN PC2 // SPI2_NSS + #define TOUCH_SCK_PIN PB13 // SPI2_SCK + #define TOUCH_MISO_PIN PB14 // SPI2_MISO + #define TOUCH_MOSI_PIN PB15 // SPI2_MOSI + #endif -#if BOTH(NEED_TOUCH_PINS, HAS_FSMC_GRAPHICAL_TFT) || ENABLED(TFT_320x240) - #define TOUCH_CS_PIN PC2 // SPI2_NSS - #define TOUCH_SCK_PIN PB13 // SPI2_SCK - #define TOUCH_MISO_PIN PB14 // SPI2_MISO - #define TOUCH_MOSI_PIN PB15 // SPI2_MOSI #endif #if ENABLED(TFT_320x240) // TFT32/28 diff --git a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_common.h b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_common.h index b1031de8d5b7..1896cd5441b3 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_common.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_common.h @@ -344,7 +344,7 @@ #else #define LCD_PINS_D4 EXP1_05_PIN - #if ENABLED(ULTIPANEL) + #if IS_ULTIPANEL #define LCD_PINS_D5 EXP1_06_PIN #define LCD_PINS_D6 EXP1_07_PIN #define LCD_PINS_D7 EXP1_08_PIN diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h index 603da09d14ef..42b252d320e7 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h @@ -19,7 +19,6 @@ * along with this program. If not, see . * */ - #pragma once // @@ -362,7 +361,7 @@ #else // !MKS_MINI_12864 #define LCD_PINS_D4 EXP1_05_PIN - #if ENABLED(ULTIPANEL) + #if IS_ULTIPANEL #define LCD_PINS_D5 EXP1_06_PIN #define LCD_PINS_D6 EXP1_07_PIN #define LCD_PINS_D7 EXP1_08_PIN diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h index 873ba3e90d66..14b3d6616830 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h @@ -363,7 +363,7 @@ #else // !MKS_MINI_12864 #define LCD_PINS_D4 EXP1_05_PIN - #if ENABLED(ULTIPANEL) + #if IS_ULTIPANEL #define LCD_PINS_D5 EXP1_06_PIN #define LCD_PINS_D6 EXP1_07_PIN #define LCD_PINS_D7 EXP1_08_PIN diff --git a/Marlin/src/sd/SdBaseFile.cpp b/Marlin/src/sd/SdBaseFile.cpp index 1c1e0c7d145a..e3f95623acbc 100644 --- a/Marlin/src/sd/SdBaseFile.cpp +++ b/Marlin/src/sd/SdBaseFile.cpp @@ -1668,6 +1668,28 @@ bool SdBaseFile::remove(SdBaseFile *dirFile, const char *path) { return file.open(dirFile, path, O_WRITE) ? file.remove() : false; } +bool SdBaseFile::hide(const bool hidden) { + if (ENABLED(SDCARD_READONLY)) return false; + // must be an open file or subdirectory + if (!(isFile() || isSubDir())) return false; + // sync() and cache directory entry + sync(); + dir_t *d = cacheDirEntry(SdVolume::CACHE_FOR_WRITE); + if (!d) return false; + uint8_t a = d->attributes; + if (hidden) + a |= DIR_ATT_HIDDEN; + else + a &= ~DIR_ATT_HIDDEN; + + if (a != d->attributes) { + d->attributes = a; + return vol_->cacheFlush(); + } + + return true; +} + /** * Rename a file or subdirectory. * diff --git a/Marlin/src/sd/SdBaseFile.h b/Marlin/src/sd/SdBaseFile.h index bda44c6bd5c3..dd8e2aff4bd4 100644 --- a/Marlin/src/sd/SdBaseFile.h +++ b/Marlin/src/sd/SdBaseFile.h @@ -310,6 +310,11 @@ class SdBaseFile { bool rmdir(); bool rmRfStar(); + /** + * Set or clear DIR_ATT_HIDDEN attribute for directory entry + */ + bool hide(const bool hidden); + /** * Set the files position to current position + \a pos. See seekSet(). * \param[in] offset The new position in bytes from the current position. diff --git a/Marlin/src/sd/SdFile.h b/Marlin/src/sd/SdFile.h index 1ff05828d272..81eeadf5b571 100644 --- a/Marlin/src/sd/SdFile.h +++ b/Marlin/src/sd/SdFile.h @@ -53,3 +53,5 @@ class SdFile : public SdBaseFile { void write_P(PGM_P str); void writeln_P(PGM_P str); }; + +using MediaFile = SdFile; diff --git a/Marlin/src/sd/SdVolume.h b/Marlin/src/sd/SdVolume.h index b8e70ca9d7f5..309777303092 100644 --- a/Marlin/src/sd/SdVolume.h +++ b/Marlin/src/sd/SdVolume.h @@ -199,3 +199,5 @@ class SdVolume { bool readBlock(uint32_t block, uint8_t *dst) { return sdCard_->readBlock(block, dst); } bool writeBlock(uint32_t block, const uint8_t *dst) { return sdCard_->writeBlock(block, dst); } }; + +using MarlinVolume = SdVolume; diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index 3ec1183083d9..fb2721a2b282 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -79,7 +79,7 @@ IF_DISABLED(NO_SD_AUTOSTART, uint8_t CardReader::autofile_index); // = 0 // private: -SdFile CardReader::root, CardReader::workDir, CardReader::workDirParents[MAX_DIR_DEPTH]; +MediaFile CardReader::root, CardReader::workDir, CardReader::workDirParents[MAX_DIR_DEPTH]; uint8_t CardReader::workDirDepth; #if ENABLED(SDCARD_SORT_ALPHA) @@ -133,8 +133,8 @@ uint8_t CardReader::workDirDepth; #endif DiskIODriver* CardReader::driver = nullptr; -SdVolume CardReader::volume; -SdFile CardReader::file; +MarlinVolume CardReader::volume; +MediaFile CardReader::file; #if HAS_MEDIA_SUBCALLS uint8_t CardReader::file_subcall_ctr; @@ -228,7 +228,7 @@ bool CardReader::is_visible_entity(const dir_t &p OPTARG(CUSTOM_FIRMWARE_UPLOAD, // // Get the number of (compliant) items in the folder // -int CardReader::countItems(SdFile dir) { +int CardReader::countItems(MediaFile dir) { dir_t p; int c = 0; while (dir.readDir(&p, longFilename) > 0) @@ -244,7 +244,7 @@ int CardReader::countItems(SdFile dir) { // // Get file/folder info for an item by index // -void CardReader::selectByIndex(SdFile dir, const uint8_t index) { +void CardReader::selectByIndex(MediaFile dir, const uint8_t index) { dir_t p; for (uint8_t cnt = 0; dir.readDir(&p, longFilename) > 0;) { if (is_visible_entity(p)) { @@ -260,7 +260,7 @@ void CardReader::selectByIndex(SdFile dir, const uint8_t index) { // // Get file/folder info for an item by name // -void CardReader::selectByName(SdFile dir, const char * const match) { +void CardReader::selectByName(MediaFile dir, const char * const match) { dir_t p; for (uint8_t cnt = 0; dir.readDir(&p, longFilename) > 0; cnt++) { if (is_visible_entity(p)) { @@ -280,7 +280,7 @@ void CardReader::selectByName(SdFile dir, const char * const match) { * this can blow up the stack, so a 'depth' parameter would be a * good addition. */ -void CardReader::printListing(SdFile parent, const char * const prepend, const uint8_t lsflags +void CardReader::printListing(MediaFile parent, const char * const prepend, const uint8_t lsflags OPTARG(LONG_FILENAME_HOST_SUPPORT, const char * const prependLong/*=nullptr*/) ) { const bool includeTime = TERN0(M20_TIMESTAMP_SUPPORT, TEST(lsflags, LS_TIMESTAMP)); @@ -304,7 +304,7 @@ void CardReader::printListing(SdFile parent, const char * const prepend, const // Get a new directory object using the full path // and dive recursively into it. - SdFile child; // child.close() in destructor + MediaFile child; // child.close() in destructor if (child.open(&parent, dosFilename, O_READ)) { #if ENABLED(LONG_FILENAME_HOST_SUPPORT) if (includeLong) { @@ -375,7 +375,7 @@ void CardReader::ls(const uint8_t lsflags) { // Zero out slashes to make segments for (i = 0; i < pathLen; i++) if (path[i] == '/') path[i] = '\0'; - SdFile diveDir = root; // start from the root for segment 1 + MediaFile diveDir = root; // start from the root for segment 1 for (i = 0; i < pathLen;) { if (path[i] == '\0') i++; // move past a single nul @@ -404,7 +404,7 @@ void CardReader::ls(const uint8_t lsflags) { // SERIAL_ECHOPGM("Opening dir: "); SERIAL_ECHOLN(segment); // Open the sub-item as the new dive parent - SdFile dir; + MediaFile dir; if (!dir.open(&diveDir, segment, O_READ)) { SERIAL_EOL(); SERIAL_ECHO_START(); @@ -604,7 +604,7 @@ void CardReader::getAbsFilenameInCWD(char *dst) { *dst++ = '/'; uint8_t cnt = 1; - auto appendAtom = [&](SdFile &file) { + auto appendAtom = [&](MediaFile &file) { file.getDosName(dst); while (*dst && cnt < MAXPATHNAMELENGTH) { dst++; cnt++; } if (cnt < MAXPATHNAMELENGTH) { *dst = '/'; dst++; cnt++; } @@ -683,7 +683,7 @@ void CardReader::openFileRead(const char * const path, const uint8_t subcall_typ abortFilePrintNow(); - SdFile *diveDir; + MediaFile *diveDir; const char * const fname = diveToFile(true, diveDir, path); if (!fname) return openFailed(path); @@ -719,7 +719,7 @@ void CardReader::openFileWrite(const char * const path) { abortFilePrintNow(); - SdFile *diveDir; + MediaFile *diveDir; const char * const fname = diveToFile(false, diveDir, path); if (!fname) return openFailed(path); @@ -747,7 +747,7 @@ bool CardReader::fileExists(const char * const path) { DEBUG_ECHOLNPGM("fileExists: ", path); // Dive to the file's directory and get the base name - SdFile *diveDir = nullptr; + MediaFile *diveDir = nullptr; const char * const fname = diveToFile(false, diveDir, path); if (!fname) return false; @@ -757,7 +757,7 @@ bool CardReader::fileExists(const char * const path) { //diveDir->close(); // Try to open the file and return the result - SdFile tmpFile; + MediaFile tmpFile; const bool success = tmpFile.open(diveDir, fname, O_READ); if (success) tmpFile.close(); return success; @@ -771,7 +771,7 @@ void CardReader::removeFile(const char * const name) { //abortFilePrintNow(); - SdFile *itsDirPtr; + MediaFile *itsDirPtr; const char * const fname = diveToFile(false, itsDirPtr, name); if (!fname) return; @@ -919,23 +919,23 @@ uint16_t CardReader::countFilesInWorkDir() { * - The workDir points to the last-set navigation target by cd, cdup, cdroot, or diveToFile(true, ...) * * On exit: - * - Your curDir pointer contains an SdFile reference to the file's directory. + * - Your curDir pointer contains an MediaFile reference to the file's directory. * - If update_cwd was 'true' the workDir now points to the file's directory. * * Returns a pointer to the last segment (filename) of the given DOS 8.3 path. - * On exit, inDirPtr contains an SdFile reference to the file's directory. + * On exit, inDirPtr contains an MediaFile reference to the file's directory. * * A nullptr result indicates an unrecoverable error. * * NOTE: End the path with a slash to dive to a folder. In this case the * returned filename will be blank (points to the end of the path). */ -const char* CardReader::diveToFile(const bool update_cwd, SdFile* &inDirPtr, const char * const path, const bool echo/*=false*/) { +const char* CardReader::diveToFile(const bool update_cwd, MediaFile* &inDirPtr, const char * const path, const bool echo/*=false*/) { DEBUG_SECTION(est, "diveToFile", true); // Track both parent and subfolder - static SdFile newDir1, newDir2; - SdFile *sub = &newDir1, *startDirPtr; + static MediaFile newDir1, newDir2; + MediaFile *sub = &newDir1, *startDirPtr; // Parsing the path string const char *atom_ptr = path; @@ -1017,7 +1017,7 @@ const char* CardReader::diveToFile(const bool update_cwd, SdFile* &inDirPtr, con } void CardReader::cd(const char * relpath) { - SdFile newDir, *parent = &getWorkDir(); + MediaFile newDir, *parent = &getWorkDir(); if (newDir.open(parent, relpath, O_READ)) { workDir = newDir; diff --git a/Marlin/src/sd/cardreader.h b/Marlin/src/sd/cardreader.h index 6fe75f760e2d..86acb1b8628c 100644 --- a/Marlin/src/sd/cardreader.h +++ b/Marlin/src/sd/cardreader.h @@ -116,7 +116,7 @@ class CardReader { static void changeMedia(DiskIODriver *_driver) { driver = _driver; } - static SdFile getroot() { return root; } + static MediaFile getroot() { return root; } static void mount(); static void release(); @@ -190,12 +190,12 @@ class CardReader { * Relative paths apply to the workDir. * * update_cwd: Pass 'true' to update the workDir on success. - * inDirPtr: On exit your pointer points to the target SdFile. + * inDirPtr: On exit your pointer points to the target MediaFile. * A nullptr indicates failure. * path: Start with '/' for abs path. End with '/' to get a folder ref. * echo: Set 'true' to print the path throughout the loop. */ - static const char* diveToFile(const bool update_cwd, SdFile* &inDirPtr, const char * const path, const bool echo=false); + static const char* diveToFile(const bool update_cwd, MediaFile* &inDirPtr, const char * const path, const bool echo=false); #if ENABLED(SDCARD_SORT_ALPHA) static void presort(); @@ -223,7 +223,7 @@ class CardReader { // Current Working Dir - Set by cd, cdup, cdroot, and diveToFile(true, ...) static char* getWorkDirName() { workDir.getDosName(filename); return filename; } - static SdFile& getWorkDir() { return workDir.isOpen() ? workDir : root; } + static MediaFile& getWorkDir() { return workDir.isOpen() ? workDir : root; } // Print File stats static uint32_t getFileSize() { return filesize; } @@ -262,7 +262,7 @@ class CardReader { // // Working directory and parents // - static SdFile root, workDir, workDirParents[MAX_DIR_DEPTH]; + static MediaFile root, workDir, workDirParents[MAX_DIR_DEPTH]; static uint8_t workDirDepth; // @@ -322,8 +322,8 @@ class CardReader { #endif // SDCARD_SORT_ALPHA static DiskIODriver *driver; - static SdVolume volume; - static SdFile file; + static MarlinVolume volume; + static MediaFile file; static uint32_t filesize, // Total size of the current file, in bytes sdpos; // Index most recently read (one behind file.getPos) @@ -341,10 +341,11 @@ class CardReader { // Directory items // static bool is_visible_entity(const dir_t &p OPTARG(CUSTOM_FIRMWARE_UPLOAD, const bool onlyBin=false)); - static int countItems(SdFile dir); - static void selectByIndex(SdFile dir, const uint8_t index); - static void selectByName(SdFile dir, const char * const match); - static void printListing(SdFile parent, const char * const prepend, const uint8_t lsflags + static int countItems(MediaFile dir); + static void selectByIndex(MediaFile dir, const uint8_t index); + static void selectByName(MediaFile dir, const char * const match); + static void printListing( + MediaFile parent, const char * const prepend, const uint8_t lsflags OPTARG(LONG_FILENAME_HOST_SUPPORT, const char * const prependLong=nullptr) ); diff --git a/Marlin/src/sd/disk_io_driver.h b/Marlin/src/sd/disk_io_driver.h index 02e2b3c73991..3e2d688aea72 100644 --- a/Marlin/src/sd/disk_io_driver.h +++ b/Marlin/src/sd/disk_io_driver.h @@ -22,6 +22,7 @@ #pragma once #include +#include "SdInfo.h" /** * DiskIO Interface diff --git a/Marlin/src/sd/storage.h b/Marlin/src/sd/storage.h new file mode 100644 index 000000000000..3510e04bbe55 --- /dev/null +++ b/Marlin/src/sd/storage.h @@ -0,0 +1,74 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +/** + * Marlin Storage Architecture: + * + * DiskIODriver: + * Do all low level IO with the underline hardware or block device: SPI, SDIO, OTG + * + * FilesystemDriver: + * Handle the filesystem format / implementation. Uses the io driver to read and write data. + * Sd2Card is the very first and current filesystem implementation on Marlin, supporting FAT. + * FatFS - Work in progress. + * + * + * Marlin Abstractions: + * + * Using this names allow us to isolate filesystem driver code, keeping all Marlin code agnostic. + * + * MediaFilesystem: + * Abstraction of systemwide filesystem operation. + * + * MarlinVolume: + * Abstraction of a filesystem volume. + * + * MediaFile: + * Abstraction of a generic file. Using this name allow us to isolate filesystem driver code, + * keeping all Marlin code agnostic. + * + * PrintFromStorage: + * Class to handle printing from any attached storage. + * + */ + +/* + +Interface definition. Doesn't need to be compiled, as we use duck typing, +allowing drivers to just use type alias. + +Class MarlinVolume { +public: +}; + +Class MediaFile { +public: +}; + +Class MediaFilesystem { +public: + static void init(); + static MarlinVolume* openVolume(const char *); +}; + +*/ diff --git a/Marlin/src/sd/usb_flashdrive/lib-uhs2/settings.h b/Marlin/src/sd/usb_flashdrive/lib-uhs2/settings.h index 7ce7b5e6ba85..268c0e1d1dcd 100644 --- a/Marlin/src/sd/usb_flashdrive/lib-uhs2/settings.h +++ b/Marlin/src/sd/usb_flashdrive/lib-uhs2/settings.h @@ -65,12 +65,12 @@ * multiple serial ports are available. * For example Serial3. */ -#if ENABLED(USB_FLASH_DRIVE_SUPPORT) - #define USB_HOST_SERIAL MYSERIAL1 -#endif - #ifndef USB_HOST_SERIAL - #define USB_HOST_SERIAL Serial + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) + #define USB_HOST_SERIAL MYSERIAL1 + #else + #define USB_HOST_SERIAL Serial + #endif #endif //////////////////////////////////////////////////////////////////////////////// diff --git a/buildroot/bin/run_tests b/buildroot/bin/run_tests index 26284fa69330..9a03be3cc734 100755 --- a/buildroot/bin/run_tests +++ b/buildroot/bin/run_tests @@ -67,7 +67,7 @@ else printf "\033[0;32mMatching test \033[0m#$3\033[0;32m: '\033[0m$test_name\033[0;32m'\n" fi fi - $TESTS/$2 $1 $2 "$test_name" + "$TESTS/$2" $1 $2 "$test_name" if [[ $GIT_RESET_HARD == "true" ]]; then git reset --hard HEAD else diff --git a/buildroot/share/PlatformIO/scripts/configuration.py b/buildroot/share/PlatformIO/scripts/configuration.py index aed9fc2f3d02..42fc91038ecc 100644 --- a/buildroot/share/PlatformIO/scripts/configuration.py +++ b/buildroot/share/PlatformIO/scripts/configuration.py @@ -85,13 +85,12 @@ def apply_opt(name, val, conf=None): # Return True if any files were fetched. def fetch_example(url): if url.endswith("/"): url = url[:-1] - if url.startswith('http'): - url = url.replace("%", "%25").replace(" ", "%20") - else: + if not url.startswith('http'): brch = "bugfix-2.1.x" - if '@' in path: path, brch = map(str.strip, path.split('@')) + if '@' in url: url, brch = map(str.strip, url.split('@')) url = f"https://raw.githubusercontent.com/MarlinFirmware/Configurations/{brch}/config/{url}" - + url = url.replace("%", "%25").replace(" ", "%20") + # Find a suitable fetch command if shutil.which("curl") is not None: fetch = "curl -L -s -S -f -o" @@ -180,10 +179,11 @@ def apply_config_ini(cp): # For a key ending in .ini load and parse another .ini file if ckey.endswith('.ini'): sect = 'base' - if '@' in ckey: sect, ckey = ckey.split('@') - other_ini = configparser.ConfigParser() - other_ini.read(config_path(ckey)) - apply_sections(other_ini, sect) + if '@' in ckey: sect, ckey = map(str.strip, ckey.split('@')) + cp2 = configparser.ConfigParser() + cp2.read(config_path(ckey)) + apply_sections(cp2, sect) + ckey = 'base'; # (Allow 'example/' as a shortcut for 'examples/') elif ckey.startswith('example/'): @@ -191,11 +191,11 @@ def apply_config_ini(cp): # For 'examples/' fetch an example set from GitHub. # For https?:// do a direct fetch of the URL. - elif ckey.startswith('examples/') or ckey.startswith('http'): + if ckey.startswith('examples/') or ckey.startswith('http:'): fetch_example(ckey) ckey = 'base' - elif ckey == 'all': + if ckey == 'all': apply_sections(cp) else: diff --git a/buildroot/share/sublime/MarlinFirmware.sublime-project b/buildroot/share/sublime/MarlinFirmware.sublime-project index e0cf953fa813..11808dd45df0 100644 --- a/buildroot/share/sublime/MarlinFirmware.sublime-project +++ b/buildroot/share/sublime/MarlinFirmware.sublime-project @@ -11,7 +11,7 @@ ".vscode" ], "binary_file_patterns": - [ "*.psd", "*.png", "*.jpg", "*.jpeg", "*.bdf", "*.patch", "avrdude_5.*", "*.svg", "*.bin", "*.woff" ], + [ "*.psd", "*.png", "*.jpg", "*.jpeg", "*.bdf", "*.patch", "avrdude_5.*", "*.svg", "*.bin", "*.woff", "*.otf" ], "file_exclude_patterns": [ "Marlin/platformio.ini", diff --git a/buildroot/tests/LPC1768 b/buildroot/tests/LPC1768 index 535e776a3892..2e680b60d797 100755 --- a/buildroot/tests/LPC1768 +++ b/buildroot/tests/LPC1768 @@ -40,7 +40,7 @@ opt_set MOTHERBOARD BOARD_RAMPS_14_RE_ARM_EEB \ NOZZLE_CLEAN_MIN_TEMP 170 \ NOZZLE_CLEAN_START_POINT "{ { 10, 10, 3 }, { 10, 10, 3 } }" \ NOZZLE_CLEAN_END_POINT "{ { 10, 20, 3 }, { 10, 20, 3 } }" -opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER ADAPTIVE_FAN_SLOWING NO_FAN_SLOWING_IN_PID_TUNING \ +opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER ADAPTIVE_FAN_SLOWING TEMP_TUNING_MAINTAIN_FAN \ FILAMENT_WIDTH_SENSOR FILAMENT_LCD_DISPLAY PID_EXTRUSION_SCALING SOUND_MENU_ITEM \ NOZZLE_AS_PROBE AUTO_BED_LEVELING_BILINEAR PREHEAT_BEFORE_LEVELING G29_RETRY_AND_RECOVER Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \ ASSISTED_TRAMMING ASSISTED_TRAMMING_WIZARD REPORT_TRAMMING_MM ASSISTED_TRAMMING_WAIT_POSITION \ diff --git a/buildroot/tests/LPC1769 b/buildroot/tests/LPC1769 index 086dffffc92c..ec5c824450c6 100755 --- a/buildroot/tests/LPC1769 +++ b/buildroot/tests/LPC1769 @@ -18,7 +18,7 @@ opt_set MOTHERBOARD BOARD_SMOOTHIEBOARD \ GRID_MAX_POINTS_X 16 \ NOZZLE_CLEAN_START_POINT "{ { 10, 10, 3 }, { 10, 10, 3 } }" \ NOZZLE_CLEAN_END_POINT "{ { 10, 20, 3 }, { 10, 20, 3 } }" -opt_enable TFTGLCD_PANEL_SPI SDSUPPORT ADAPTIVE_FAN_SLOWING NO_FAN_SLOWING_IN_PID_TUNING \ +opt_enable TFTGLCD_PANEL_SPI SDSUPPORT ADAPTIVE_FAN_SLOWING TEMP_TUNING_MAINTAIN_FAN \ MAX31865_SENSOR_OHMS_0 MAX31865_CALIBRATION_OHMS_0 \ FIX_MOUNTED_PROBE AUTO_BED_LEVELING_BILINEAR G29_RETRY_AND_RECOVER Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \ BABYSTEPPING BABYSTEP_XY BABYSTEP_ZPROBE_OFFSET BED_TRAMMING_USE_PROBE BED_TRAMMING_VERIFY_RAISED \ diff --git a/buildroot/tests/SAMD21_minitronics20 b/buildroot/tests/SAMD21_minitronics20 index 018d6a70fe00..420495bb7659 100755 --- a/buildroot/tests/SAMD21_minitronics20 +++ b/buildroot/tests/SAMD21_minitronics20 @@ -26,7 +26,7 @@ opt_enable ENDSTOP_INTERRUPTS_FEATURE BLTOUCH Z_MIN_PROBE_REPEATABILITY_TEST \ SCROLL_LONG_FILENAMES BABYSTEPPING DOUBLECLICK_FOR_Z_BABYSTEPPING \ MOVE_Z_WHEN_IDLE BABYSTEP_ZPROBE_OFFSET BABYSTEP_ZPROBE_GFX_OVERLAY \ LIN_ADVANCE ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE MONITOR_DRIVER_STATUS SENSORLESS_HOMING \ - SQUARE_WAVE_STEPPING EXPERIMENTAL_SCURVE + SQUARE_WAVE_STEPPING exec_test $1 $2 "Minitronics 2.0 with assorted features" "$3" # clean up diff --git a/buildroot/tests/SAMD51_grandcentral_m4 b/buildroot/tests/SAMD51_grandcentral_m4 index 3a5ac8e70cc9..ef67e061fe4b 100755 --- a/buildroot/tests/SAMD51_grandcentral_m4 +++ b/buildroot/tests/SAMD51_grandcentral_m4 @@ -26,7 +26,7 @@ opt_enable ENDSTOP_INTERRUPTS_FEATURE S_CURVE_ACCELERATION BLTOUCH Z_MIN_PROBE_R SCROLL_LONG_FILENAMES BABYSTEPPING DOUBLECLICK_FOR_Z_BABYSTEPPING \ MOVE_Z_WHEN_IDLE BABYSTEP_ZPROBE_OFFSET BABYSTEP_ZPROBE_GFX_OVERLAY \ LIN_ADVANCE ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE MONITOR_DRIVER_STATUS SENSORLESS_HOMING \ - SQUARE_WAVE_STEPPING TMC_DEBUG EXPERIMENTAL_SCURVE + SQUARE_WAVE_STEPPING TMC_DEBUG exec_test $1 $2 "Grand Central M4 with assorted features" "$3" # clean up diff --git a/buildroot/tests/STM32F103RE_creality b/buildroot/tests/STM32F103RE_creality index a3c52372ef37..8c0a40d8ae22 100755 --- a/buildroot/tests/STM32F103RE_creality +++ b/buildroot/tests/STM32F103RE_creality @@ -25,7 +25,11 @@ opt_enable DWIN_LCD_PROUI INDIVIDUAL_AXIS_HOMING_SUBMENU SET_PROGRESS_MANUALLY S BLTOUCH Z_SAFE_HOMING AUTO_BED_LEVELING_UBL MESH_EDIT_MENU \ LIMITED_MAX_FR_EDITING LIMITED_MAX_ACCEL_EDITING LIMITED_JERK_EDITING BAUD_RATE_GCODE opt_set PREHEAT_3_LABEL '"CUSTOM"' PREHEAT_3_TEMP_HOTEND 240 PREHEAT_3_TEMP_BED 60 PREHEAT_3_FAN_SPEED 128 -exec_test $1 $2 "Ender-3 S1 with ProUI" "$3" +exec_test $1 $2 "Ender-3 S1 with ProUI (PIDTEMP)" "$3" + +opt_disable PIDTEMP +opt_enable MPCTEMP +exec_test $1 $2 "Ender-3 S1 with ProUI (MPCTEMP)" "$3" restore_configs opt_set MOTHERBOARD BOARD_CREALITY_V452 SERIAL_PORT 1 diff --git a/buildroot/tests/mks_robin_nano_v1v2_maple b/buildroot/tests/mks_robin_nano_v1v2_maple index ebd5466ce61c..e241c14b9fe6 100755 --- a/buildroot/tests/mks_robin_nano_v1v2_maple +++ b/buildroot/tests/mks_robin_nano_v1v2_maple @@ -40,11 +40,10 @@ exec_test $1 $2 "MKS Robin v2 nano LVGL SPI w/ WiFi" "$3" # (Robin v2 nano has no FSMC interface) # use_example_configs Mks/Robin -opt_set MOTHERBOARD BOARD_MKS_ROBIN_NANO_V2 -opt_disable TFT_INTERFACE_FSMC TFT_RES_320x240 -opt_enable TFT_INTERFACE_SPI TFT_RES_480x320 -opt_enable BINARY_FILE_TRANSFER -exec_test $1 $2 "MKS Robin v2 nano New Color UI 480x320 SPI + BINARY_FILE_TRANSFER" "$3" +opt_set MOTHERBOARD BOARD_MKS_ROBIN_NANO_V2 TFT_ROTATION TFT_ROTATE_90 +opt_disable TFT_INTERFACE_FSMC +opt_enable TFT_INTERFACE_SPI BINARY_FILE_TRANSFER +exec_test $1 $2 "MKS Robin v2 nano New Color UI 240x320 SPI + BINARY_FILE_TRANSFER" "$3" # # MKS Robin v2 nano LVGL SPI + TMC diff --git a/docs/Serial.md b/docs/Serial.md index be3b23e87dd7..88846e1bb45a 100644 --- a/docs/Serial.md +++ b/docs/Serial.md @@ -64,9 +64,9 @@ The following macros are defined (in `serial.h`) to output data to the serial po | `SERIAL_ECHOLNPGM_P` | Same as `SERIAL_ECHOPGM_P` | Do `SERIAL_ECHOPGM_P`, adding a newline | `SERIAL_ECHOLNPGM_P(PSTR("Alice"), 78);` | `alice78\n` | | `SERIAL_ECHOLIST` | String literal, values | Print a string literal and a list of values | `SERIAL_ECHOLIST(F("Key "), 1, 2, 3);` | `Key 1, 2, 3` | | `SERIAL_ECHO_START` | None | Prefix an echo line | `SERIAL_ECHO_START();` | `echo:` | -| `SERIAL_ECHO_MSG` | Same as `SERIAL_ECHOLN_PAIR` | Print a full echo line | `SERIAL_ECHO_MSG("Count is ", count);` | `echo:Count is 3` | +| `SERIAL_ECHO_MSG` | Same as `SERIAL_ECHOLNPGM` | Print a full echo line | `SERIAL_ECHO_MSG("Count is ", count);` | `echo:Count is 3` | | `SERIAL_ERROR_START`| None | Prefix an error line | `SERIAL_ERROR_START();` | `Error:` | -| `SERIAL_ERROR_MSG` | Same as `SERIAL_ECHOLN_PAIR` | Print a full error line | `SERIAL_ERROR_MSG("Not found");` | `Error:Not found` | +| `SERIAL_ERROR_MSG` | Same as `SERIAL_ECHOLNPGM` | Print a full error line | `SERIAL_ERROR_MSG("Not found");` | `Error:Not found` | | `SERIAL_ECHO_SP` | Number of spaces | Print one or more spaces | `SERIAL_ECHO_SP(3)` | ` ` | | `SERIAL_EOL` | None | Print an end of line | `SERIAL_EOL();` | `\n` | | `SERIAL_OUT` | `SERIAL_OUT(myMethod)` | Call a custom serial method | `SERIAL_OUT(msgDone);` | ... |