From 50a2c0bc78cada7959f5e99f76c10799505fceef Mon Sep 17 00:00:00 2001 From: Djonker83 <84191237+Djonker83@users.noreply.github.com> Date: Fri, 16 Jun 2023 04:19:16 -0400 Subject: [PATCH] Bugfix 2.1.x (#2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🩹 Update KEDI / GODI LCD_PINS_EN pin (#25886) * [cron] Bump distribution date (2023-05-29) * 🩹 Fix and improve GT2560 pins (#25890) Co-authored-by: Scott Lahteine * πŸ”¨ Install 'heatshrink' if needed (#25896) * [cron] Bump distribution date (2023-05-30) * πŸ”§ Default has Heated Bed (#25895) Co-authored-by: Scott Lahteine * 🚸 Probe Wizard display fix * πŸ§‘β€πŸ’» ExtUI::onLevelingStart/Done for all leveling (#25913) * 🌐 Update Russian translation (#25840) * 🌐 Remove unused strings * πŸ”§ Update LCD with NeoPixel Contrast (#25893) * [cron] Bump distribution date (2023-06-02) * πŸ“ M122 comment * πŸ”¨ Clarify env error (#25915) * πŸ”¨ Fix pins debugging for Simulator * 🎨 Lowercase method / data member names (#25914) * πŸ§‘β€πŸ’» numtostr use functions * πŸ§‘β€πŸ’» Dump BOTH and EITHER macros (#25908) * πŸ§‘β€πŸ’» Remove LOOP macros (#25917) * [cron] Bump distribution date (2023-06-03) * 🎨 Lowercase followup (#25923) Followup to #25914 * πŸ”¨ STM32H723VG (1024KB) (#25921) * 🩹 Endstop hit state followup (#25885) Followup to #25574 * πŸ§‘β€πŸ’» Fix narrowing conversions (#25924) * πŸ”§ BTT SKR 3 has onboard endstop pullups (#24876) * πŸ› Fix M25/M125 for LCDs with ui.resume_print (#24877) * [cron] Bump distribution date (2023-06-04) * ✏️ Fix LCD contrast typo (#25929) * 🩹 Fix D576 buffer underrun reporting (#25931) * [cron] Bump distribution date (2023-06-05) * πŸ”§ TMC Driver axis baud for Soft Serial (#25664) * 🎨 Detab C/C++ * πŸ§‘β€πŸ’» Dir change is AxisBits Followup to #25761 * 🩹 Wrap HAS_DISPLAY for if() Followup to #24877 * πŸ§‘β€πŸ’» Fix mfconfig trailing space * [cron] Bump distribution date (2023-06-06) * 🩹 Fix JyersUI corner pos Followup to #25631 * πŸ§‘β€πŸ’» Bypass error in build_example * πŸ§‘β€πŸ’» Suppress narrowing warnings Followup to #25924 * ⚑️ Mixer label in PROGMEM * 🩹 Conditional include probe.h * πŸ§‘β€πŸ’» Use Flags<> for runout (#25938) * [cron] Bump distribution date (2023-06-07) * 🌐 Update Italian language (#25940) * πŸ”¨ Teensy 4.1 pins env check (#25937) * [cron] Bump distribution date (2023-06-08) * πŸ”§ Z-MIN as CREALITY V25 S1 probe * 🚸 Fix TFT menu positioning (#25942) Co-authored-by: Ed <751406+helakejr@users.noreply.github.com> * πŸ”¨ Clean up some BTT envs, etc. (#25934) Followup to #25921 Co-authored-by: Scott Lahteine * 🚸 General TFT cleanup * 🚸 Portrait TS35 move axis screen (#25945) * πŸ”¨ Update STM32Hxx boards/variants Followup to #25934 * πŸ”¨ Fix serial port #error text * [cron] Bump distribution date (2023-06-09) * πŸ› Fix _MINMAX_TEST typo (#25954) * 🩹 Conditional u8g for SAMD21 (#25947) * πŸ”¨ Simpler distinct firmware rename (#25957) * πŸ› Fix dummy thermistors 998-999 (#25956) * [cron] Bump distribution date (2023-06-10) * πŸ”¨ Firmware rename followup (#25966) Followup to #25957 * [cron] Bump distribution date (2023-06-11) * πŸ”¨ SKR Mini E3 v3.0.1 XFER (#25955) * [cron] Bump distribution date (2023-06-12) * ♻️ Simplify SERIAL_ECHO (#25928) Since this increases AVR code size, try to optimize further. * πŸ”₯ Remove VAkE 403D (#25969) * [cron] Bump distribution date (2023-06-13) * 🎨 Lowercase methods, functions, data members (#25939) For: TFT, DGUS, MarlinUI, Anycubic, JyersUI, CrealityUI * πŸ”§ Sanity check IA_CREALITY mesh size * [cron] Bump distribution date (2023-06-15) * 🎨 Lowercase followup Followup to #25939 * 🎨 Group STM32G0 pins includes (#25977) * πŸ“ Document Manta E3 EZ / E3V2 LCD custom wiring (#25976) * ✨ BTT RAMPS 1.6+ (#25970) * [cron] Bump distribution date (2023-06-16) --------- Co-authored-by: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Co-authored-by: thinkyhead Co-authored-by: DejitaruJin Co-authored-by: EvilGremlin <22657714+EvilGremlin@users.noreply.github.com> Co-authored-by: I3DBeeTech <129617321+I3DBeeTech@users.noreply.github.com> Co-authored-by: alextrical <35117191+alextrical@users.noreply.github.com> Co-authored-by: ellensp <530024+ellensp@users.noreply.github.com> Co-authored-by: Manuel McLure Co-authored-by: Giuliano Zaro <3684609+GMagician@users.noreply.github.com> Co-authored-by: Andrew <18502096+classicrocker883@users.noreply.github.com> Co-authored-by: kisslorand <50251547+kisslorand@users.noreply.github.com> Co-authored-by: Roi RodrΓ­guez Huertas Co-authored-by: Ed <751406+helakejr@users.noreply.github.com> Co-authored-by: Dmitry Plastinin Co-authored-by: Miguel Risco-Castillo Co-authored-by: Bart Meijer --- Marlin/Version.h | 2 +- Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp | 12 +- Marlin/src/HAL/LPC1768/tft/tft_spi.cpp | 40 +- Marlin/src/HAL/LPC1768/tft/tft_spi.h | 38 +- Marlin/src/HAL/LPC1768/tft/xpt2046.cpp | 12 +- Marlin/src/HAL/LPC1768/tft/xpt2046.h | 10 +- Marlin/src/HAL/NATIVE_SIM/tft/tft_spi.h | 30 +- Marlin/src/HAL/NATIVE_SIM/tft/xpt2046.h | 10 +- .../u8g/u8g_com_HAL_samd21_shared_hw_spi.cpp | 6 + Marlin/src/HAL/STM32/HAL.h | 8 +- Marlin/src/HAL/STM32/tft/gt911.cpp | 2 +- Marlin/src/HAL/STM32/tft/gt911.h | 2 +- Marlin/src/HAL/STM32/tft/tft_fsmc.cpp | 84 +- Marlin/src/HAL/STM32/tft/tft_fsmc.h | 42 +- Marlin/src/HAL/STM32/tft/tft_ltdc.cpp | 60 +- Marlin/src/HAL/STM32/tft/tft_ltdc.h | 48 +- Marlin/src/HAL/STM32/tft/tft_spi.cpp | 62 +- Marlin/src/HAL/STM32/tft/tft_spi.h | 42 +- Marlin/src/HAL/STM32/tft/xpt2046.cpp | 10 +- Marlin/src/HAL/STM32/tft/xpt2046.h | 12 +- Marlin/src/HAL/STM32F1/tft/tft_fsmc.cpp | 44 +- Marlin/src/HAL/STM32F1/tft/tft_fsmc.h | 36 +- Marlin/src/HAL/STM32F1/tft/tft_spi.cpp | 42 +- Marlin/src/HAL/STM32F1/tft/tft_spi.h | 38 +- Marlin/src/HAL/STM32F1/tft/xpt2046.cpp | 12 +- Marlin/src/HAL/STM32F1/tft/xpt2046.h | 10 +- Marlin/src/HAL/shared/Delay.cpp | 8 +- .../src/HAL/shared/backtrace/unwmemaccess.cpp | 2 +- Marlin/src/MarlinCore.cpp | 6 +- Marlin/src/core/boards.h | 63 +- Marlin/src/core/debug_out.h | 24 - Marlin/src/core/debug_section.h | 7 +- Marlin/src/core/serial.cpp | 45 +- Marlin/src/core/serial.h | 192 +- Marlin/src/core/serial_base.h | 5 +- Marlin/src/core/types.h | 30 + Marlin/src/core/utility.cpp | 10 +- Marlin/src/core/utility.h | 19 + Marlin/src/feature/bedlevel/bedlevel.cpp | 4 +- .../bedlevel/mbl/mesh_bed_leveling.cpp | 3 +- Marlin/src/feature/bedlevel/ubl/ubl.cpp | 7 +- Marlin/src/feature/bedlevel/ubl/ubl.h | 6 +- Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp | 139 +- Marlin/src/feature/encoder_i2c.cpp | 5 +- Marlin/src/feature/host_actions.cpp | 5 +- Marlin/src/feature/max7219.cpp | 4 +- Marlin/src/feature/meatpack.cpp | 2 +- Marlin/src/feature/mixing.cpp | 13 +- Marlin/src/feature/mixing.h | 28 +- Marlin/src/feature/mmu/mmu2.cpp | 2 +- Marlin/src/feature/pause.cpp | 2 +- Marlin/src/feature/powerloss.cpp | 9 +- Marlin/src/feature/probe_temp_comp.cpp | 11 +- Marlin/src/feature/runout.h | 51 +- Marlin/src/feature/stepper_driver_safety.cpp | 3 +- Marlin/src/feature/tmc_util.cpp | 10 +- Marlin/src/feature/twibus.cpp | 3 +- Marlin/src/gcode/bedlevel/G35.cpp | 17 +- Marlin/src/gcode/bedlevel/M420.cpp | 2 +- Marlin/src/gcode/bedlevel/abl/G29.cpp | 12 +- Marlin/src/gcode/calibrate/G28.cpp | 2 +- Marlin/src/gcode/calibrate/G33.cpp | 11 +- Marlin/src/gcode/calibrate/G34_M422.cpp | 5 +- Marlin/src/gcode/calibrate/G76_M871.cpp | 2 +- Marlin/src/gcode/calibrate/M100.cpp | 4 +- Marlin/src/gcode/calibrate/M48.cpp | 19 +- Marlin/src/gcode/calibrate/M852.cpp | 6 +- Marlin/src/gcode/config/M218.cpp | 6 +- Marlin/src/gcode/config/M302.cpp | 4 +- Marlin/src/gcode/config/M43.cpp | 4 +- Marlin/src/gcode/config/M92.cpp | 2 +- Marlin/src/gcode/control/M80_M81.cpp | 2 +- Marlin/src/gcode/feature/advance/M900.cpp | 8 +- Marlin/src/gcode/feature/ft_motion/M493.cpp | 22 +- .../src/gcode/feature/network/M552-M554.cpp | 3 +- Marlin/src/gcode/feature/pause/G61.cpp | 3 +- Marlin/src/gcode/feature/powerloss/M1000.cpp | 3 +- Marlin/src/gcode/feature/powerloss/M413.cpp | 4 +- Marlin/src/gcode/feature/trinamic/M569.cpp | 8 +- Marlin/src/gcode/gcode.cpp | 5 +- Marlin/src/gcode/geometry/G17-G19.cpp | 2 +- Marlin/src/gcode/probe/G30.cpp | 2 +- Marlin/src/gcode/queue.cpp | 2 +- Marlin/src/gcode/stats/M31.cpp | 2 +- Marlin/src/gcode/temp/M306.cpp | 16 +- Marlin/src/gcode/units/M149.cpp | 3 +- Marlin/src/inc/Conditionals_adv.h | 58 +- Marlin/src/inc/Conditionals_post.h | 3 + Marlin/src/inc/SanityCheck.h | 9 +- Marlin/src/inc/Version.h | 2 +- Marlin/src/lcd/HD44780/marlinui_HD44780.cpp | 14 +- .../dogm/u8g_dev_tft_upscale_from_128x64.cpp | 30 +- Marlin/src/lcd/e3v2/creality/dwin.cpp | 2874 ++++++++--------- Marlin/src/lcd/e3v2/creality/dwin.h | 114 +- Marlin/src/lcd/e3v2/creality/dwin_lcd.cpp | 36 +- Marlin/src/lcd/e3v2/creality/dwin_lcd.h | 2 +- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 2142 ++++++------ Marlin/src/lcd/e3v2/jyersui/dwin.h | 132 +- Marlin/src/lcd/e3v2/jyersui/dwin_lcd.cpp | 26 +- Marlin/src/lcd/e3v2/jyersui/dwin_lcd.h | 4 +- Marlin/src/lcd/e3v2/marlinui/dwin_lcd.cpp | 16 +- Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp | 6 +- Marlin/src/lcd/e3v2/marlinui/dwin_string.h | 2 +- .../src/lcd/e3v2/marlinui/lcdprint_dwin.cpp | 8 +- Marlin/src/lcd/e3v2/marlinui/ui_common.cpp | 92 +- .../lcd/e3v2/marlinui/ui_status_480x272.cpp | 58 +- Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp | 18 +- Marlin/src/lcd/extui/anycubic/Tunes.cpp | 2 +- Marlin/src/lcd/extui/anycubic/Tunes.h | 2 +- .../lcd/extui/anycubic_chiron/chiron_tft.cpp | 35 +- .../anycubic_i3mega/anycubic_i3mega_lcd.cpp | 75 +- .../anycubic_i3mega/anycubic_i3mega_lcd.h | 6 +- .../extui/anycubic_vyper/FileNavigator.cpp | 6 +- .../src/lcd/extui/anycubic_vyper/dgus_tft.cpp | 484 +-- .../src/lcd/extui/anycubic_vyper/dgus_tft.h | 4 +- .../lcd/extui/anycubic_vyper/vyper_extui.cpp | 50 +- .../lcd/extui/dgus/DGUSScreenHandlerBase.h | 2 +- .../extui/dgus_reloaded/DGUSSetupHandler.cpp | 27 +- .../extui/dgus_reloaded/DGUSSetupHandler.h | 26 +- .../definition/DGUS_ScreenSetup.cpp | 26 +- .../dgus_reloaded/dgus_reloaded_extui.cpp | 2 +- .../lcd/extui/ia_creality/ia_creality_rts.cpp | 2 +- .../lcd/extui/ia_creality/ia_creality_rts.h | 2 +- Marlin/src/lcd/extui/mks_ui/SPI_TFT.cpp | 26 +- Marlin/src/lcd/extui/mks_ui/SPI_TFT.h | 10 +- .../lcd/extui/mks_ui/draw_error_message.cpp | 2 +- .../extui/mks_ui/draw_touch_calibration.cpp | 4 +- Marlin/src/lcd/extui/mks_ui/draw_ui.cpp | 4 +- Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp | 4 +- Marlin/src/lcd/extui/mks_ui/pic_manager.cpp | 40 +- Marlin/src/lcd/extui/mks_ui/pic_manager.h | 4 +- .../extui/mks_ui/tft_lvgl_configuration.cpp | 14 +- .../lcd/extui/mks_ui/tft_lvgl_configuration.h | 2 +- Marlin/src/lcd/extui/mks_ui/wifi_module.cpp | 8 +- Marlin/src/lcd/extui/nextion/nextion_tft.cpp | 26 +- Marlin/src/lcd/language/language_it.h | 27 +- Marlin/src/lcd/marlinui.cpp | 6 +- Marlin/src/lcd/menu/menu_configuration.cpp | 9 +- Marlin/src/lcd/tft/canvas.cpp | 8 +- Marlin/src/lcd/tft/tft.cpp | 4 +- Marlin/src/lcd/tft/tft.h | 6 +- Marlin/src/lcd/tft/tft_string.cpp | 32 +- Marlin/src/lcd/tft/tft_string.h | 36 +- Marlin/src/lcd/tft/touch.cpp | 2 +- Marlin/src/lcd/tft/ui_1024x600.cpp | 156 +- Marlin/src/lcd/tft/ui_320x240.cpp | 233 +- Marlin/src/lcd/tft/ui_480x320.cpp | 387 ++- Marlin/src/lcd/tft/ui_480x320.h | 6 +- Marlin/src/lcd/tft_io/tft_io.cpp | 106 +- Marlin/src/lcd/tft_io/tft_io.h | 30 +- Marlin/src/lcd/touch/touch_buttons.cpp | 2 +- Marlin/src/lcd/utf8.cpp | 9 +- Marlin/src/libs/vector_3.cpp | 13 +- Marlin/src/module/endstops.cpp | 5 +- Marlin/src/module/probe.cpp | 2 +- Marlin/src/module/settings.cpp | 20 +- Marlin/src/module/temperature.cpp | 49 +- Marlin/src/pins/pins.h | 694 ++-- Marlin/src/pins/pinsDebug.h | 8 +- .../src/pins/ramps/pins_RAMPS_BTT_16_PLUS.h | 49 + Marlin/src/pins/stm32f1/pins_CREALITY_V25S1.h | 18 +- Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h | 2 +- Marlin/src/pins/stm32f4/pins_VAKE403D.h | 226 -- .../pins/stm32g0/pins_BTT_MANTA_E3_EZ_V1_0.h | 38 +- Marlin/src/pins/teensy4/env_validate.h | 26 + Marlin/src/pins/teensy4/pins_T41U5XBB.h | 4 +- Marlin/src/pins/teensy4/pins_TEENSY41.h | 4 +- Marlin/src/sd/Sd2Card.h | 2 +- Marlin/src/sd/cardreader.cpp | 9 +- .../boards/marlin_CREALITY_STM32F401RC.json | 65 - ...M32H723Zx.json => marlin_STM32H723ZE.json} | 2 +- ...M32H743Vx.json => marlin_STM32H743VI.json} | 2 +- .../PlatformIO/scripts/offset_and_rename.py | 3 +- .../share/PlatformIO/scripts/random-bin.py | 9 - .../PeripheralPins.c | 0 .../PinNamesVar.h | 0 .../ldscript.ld | 0 .../variant_MARLIN_STM32H723ZE.cpp} | 0 .../variant_MARLIN_STM32H723ZE.h} | 0 .../PeripheralPins.c | 0 .../PinNamesVar.h | 0 .../ldscript.ld | 0 .../variant_MARLIN_STM32H743VI.cpp} | 0 .../variant_MARLIN_STM32H743VI.h} | 0 docs/Serial.md | 3 - ini/renamed.ini | 7 +- ini/stm32f1-maple.ini | 8 +- ini/stm32f1.ini | 3 +- ini/stm32f4.ini | 20 +- ini/stm32h7.ini | 31 +- 190 files changed, 5171 insertions(+), 5364 deletions(-) create mode 100644 Marlin/src/pins/ramps/pins_RAMPS_BTT_16_PLUS.h delete mode 100644 Marlin/src/pins/stm32f4/pins_VAKE403D.h create mode 100644 Marlin/src/pins/teensy4/env_validate.h delete mode 100644 buildroot/share/PlatformIO/boards/marlin_CREALITY_STM32F401RC.json rename buildroot/share/PlatformIO/boards/{marlin_STM32H723Zx.json => marlin_STM32H723ZE.json} (97%) rename buildroot/share/PlatformIO/boards/{marlin_STM32H743Vx.json => marlin_STM32H743VI.json} (97%) delete mode 100644 buildroot/share/PlatformIO/scripts/random-bin.py rename buildroot/share/PlatformIO/variants/{MARLIN_H723Zx => MARLIN_H723ZE}/PeripheralPins.c (100%) rename buildroot/share/PlatformIO/variants/{MARLIN_H723Zx => MARLIN_H723ZE}/PinNamesVar.h (100%) rename buildroot/share/PlatformIO/variants/{MARLIN_H723Zx => MARLIN_H723ZE}/ldscript.ld (100%) rename buildroot/share/PlatformIO/variants/{MARLIN_H723Zx/variant_MARLIN_STM32H723ZX.cpp => MARLIN_H723ZE/variant_MARLIN_STM32H723ZE.cpp} (100%) rename buildroot/share/PlatformIO/variants/{MARLIN_H723Zx/variant_MARLIN_STM32H723ZX.h => MARLIN_H723ZE/variant_MARLIN_STM32H723ZE.h} (100%) rename buildroot/share/PlatformIO/variants/{MARLIN_H743Vx => MARLIN_H743VI}/PeripheralPins.c (100%) rename buildroot/share/PlatformIO/variants/{MARLIN_H743Vx => MARLIN_H743VI}/PinNamesVar.h (100%) rename buildroot/share/PlatformIO/variants/{MARLIN_H743Vx => MARLIN_H743VI}/ldscript.ld (100%) rename buildroot/share/PlatformIO/variants/{MARLIN_H743Vx/variant_MARLIN_STM32H743VX.cpp => MARLIN_H743VI/variant_MARLIN_STM32H743VI.cpp} (100%) rename buildroot/share/PlatformIO/variants/{MARLIN_H743Vx/variant_MARLIN_STM32H743VX.h => MARLIN_H743VI/variant_MARLIN_STM32H743VI.h} (100%) diff --git a/Marlin/Version.h b/Marlin/Version.h index b5808dcf44f03..962a745208ac6 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-06-06" +//#define STRING_DISTRIBUTION_DATE "2023-06-16" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp b/Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp index 1991d79719599..5ebd437c1e159 100644 --- a/Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp +++ b/Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp @@ -91,15 +91,9 @@ bool PersistentStore::access_finish() { static void debug_rw(const bool write, int &pos, const uint8_t *value, const size_t size, const FRESULT s, const size_t total=0) { #if ENABLED(DEBUG_SD_EEPROM_EMULATION) FSTR_P const rw_str = write ? F("write") : F("read"); - SERIAL_CHAR(' '); - SERIAL_ECHOF(rw_str); - SERIAL_ECHOLNPGM("_data(", pos, ",", *value, ",", size, ", ...)"); - if (total) { - SERIAL_ECHOPGM(" f_"); - SERIAL_ECHOF(rw_str); - SERIAL_ECHOPGM("()=", s, "\n size=", size, "\n bytes_"); - SERIAL_ECHOLNF(write ? F("written=") : F("read="), total); - } + SERIAL_ECHOLN(AS_CHAR(' '), rw_str, F("_data("), pos, AS_CHAR(','), *value, AS_CHAR(','), size, F(", ...)")); + if (total) + SERIAL_ECHOLN(F(" f_"), rw_str, F("()="), s, F("\n size="), size, F("\n bytes_"), write ? F("written=") : F("read="), total); else SERIAL_ECHOLNPGM(" f_lseek()=", s); #endif diff --git a/Marlin/src/HAL/LPC1768/tft/tft_spi.cpp b/Marlin/src/HAL/LPC1768/tft/tft_spi.cpp index c148617785cc7..440e9f8598d5b 100644 --- a/Marlin/src/HAL/LPC1768/tft/tft_spi.cpp +++ b/Marlin/src/HAL/LPC1768/tft/tft_spi.cpp @@ -30,7 +30,7 @@ SPIClass TFT_SPI::SPIx(TFT_SPI_DEVICE); -void TFT_SPI::Init() { +void TFT_SPI::init() { #if PIN_EXISTS(TFT_RESET) OUT_WRITE(TFT_RESET_PIN, HIGH); delay(100); @@ -49,21 +49,21 @@ void TFT_SPI::Init() { SPIx.setDataMode(SPI_MODE0); } -void TFT_SPI::DataTransferBegin(uint16_t DataSize) { - SPIx.setDataSize(DataSize); +void TFT_SPI::dataTransferBegin(uint16_t dataSize) { + SPIx.setDataSize(dataSize); SPIx.begin(); WRITE(TFT_CS_PIN, LOW); } -uint32_t TFT_SPI::GetID() { +uint32_t TFT_SPI::getID() { uint32_t id; - id = ReadID(LCD_READ_ID); + id = readID(LCD_READ_ID); if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF) - id = ReadID(LCD_READ_ID4); + id = readID(LCD_READ_ID4); return id; } -uint32_t TFT_SPI::ReadID(uint16_t Reg) { +uint32_t TFT_SPI::readID(uint16_t reg) { uint32_t data = 0; #if PIN_EXISTS(TFT_MISO) @@ -72,14 +72,14 @@ uint32_t TFT_SPI::ReadID(uint16_t Reg) { SPIx.setClock(SPI_CLOCK_DIV64); SPIx.begin(); WRITE(TFT_CS_PIN, LOW); - WriteReg(Reg); + writeReg(reg); for (uint8_t i = 0; i < 4; ++i) { SPIx.read((uint8_t*)&d, 1); data = (data << 8) | d; } - DataTransferEnd(); + dataTransferEnd(); SPIx.setClock(SPI_CLOCK_MAX_TFT); #endif @@ -103,11 +103,11 @@ bool TFT_SPI::isBusy() { if ((SSP_GetStatus(LPC_SSPx, SSP_STAT_TXFIFO_EMPTY) == RESET) || (SSP_GetStatus(LPC_SSPx, SSP_STAT_BUSY) == SET)) return true; } - Abort(); + abort(); return false; } -void TFT_SPI::Abort() { +void TFT_SPI::abort() { // DMA Channel 0 is hardcoded in dmaSendAsync() and dmaSend() // Disable DMA @@ -126,20 +126,20 @@ void TFT_SPI::Abort() { LPC_GPDMACH0->DMACCSrcAddr = 0U; LPC_GPDMACH0->DMACCDestAddr = 0U; - DataTransferEnd(); + dataTransferEnd(); } -void TFT_SPI::Transmit(uint16_t Data) { SPIx.transfer(Data); } +void TFT_SPI::transmit(uint16_t data) { SPIx.transfer(data); } -void TFT_SPI::Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) { - DataTransferBegin(DATASIZE_16BIT); - SPIx.dmaSend(Data, Count, MemoryIncrease); - Abort(); +void TFT_SPI::transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count) { + dataTransferBegin(DATASIZE_16BIT); + SPIx.dmaSend(data, count, memoryIncrease); + abort(); } -void TFT_SPI::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) { - DataTransferBegin(DATASIZE_16BIT); - SPIx.dmaSendAsync(Data, Count, MemoryIncrease); +void TFT_SPI::transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count) { + dataTransferBegin(DATASIZE_16BIT); + SPIx.dmaSendAsync(data, count, memoryIncrease); TERN_(TFT_SHARED_IO, while (isBusy())); } diff --git a/Marlin/src/HAL/LPC1768/tft/tft_spi.h b/Marlin/src/HAL/LPC1768/tft/tft_spi.h index 4817a5aae30a8..884bcaed04123 100644 --- a/Marlin/src/HAL/LPC1768/tft/tft_spi.h +++ b/Marlin/src/HAL/LPC1768/tft/tft_spi.h @@ -56,34 +56,34 @@ class TFT_SPI { private: - static uint32_t ReadID(uint16_t Reg); - static void Transmit(uint16_t Data); - static void Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count); - static void TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count); + static uint32_t readID(uint16_t reg); + static void transmit(uint16_t data); + static void transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count); + static void transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count); public: static SPIClass SPIx; - static void Init(); - static uint32_t GetID(); + static void init(); + static uint32_t getID(); static bool isBusy(); - static void Abort(); + static void abort(); - static void DataTransferBegin(uint16_t DataWidth=DATASIZE_16BIT); - static void DataTransferEnd() { WRITE(TFT_CS_PIN, HIGH); SSP_Cmd(LPC_SSPx, DISABLE); }; - static void DataTransferAbort(); + static void dataTransferBegin(uint16_t dataWidth=DATASIZE_16BIT); + static void dataTransferEnd() { WRITE(TFT_CS_PIN, HIGH); SSP_Cmd(LPC_SSPx, DISABLE); }; + static void dataTransferAbort(); - static void WriteData(uint16_t Data) { Transmit(Data); } - static void WriteReg(uint16_t Reg) { WRITE(TFT_DC_PIN, LOW); Transmit(Reg); WRITE(TFT_DC_PIN, HIGH); } + static void writeData(uint16_t data) { transmit(data); } + static void writeReg(uint16_t reg) { WRITE(TFT_DC_PIN, LOW); transmit(reg); WRITE(TFT_DC_PIN, HIGH); } - static void WriteSequence_DMA(uint16_t *Data, uint16_t Count) { TransmitDMA(DMA_MINC_ENABLE, Data, Count); } - static void WriteMultiple_DMA(uint16_t Color, uint16_t Count) { static uint16_t Data; Data = Color; TransmitDMA(DMA_MINC_DISABLE, &Data, Count); } + static void writeSequence_DMA(uint16_t *data, uint16_t count) { transmitDMA(DMA_MINC_ENABLE, data, count); } + static void writeMultiple_DMA(uint16_t color, uint16_t count) { static uint16_t data; data = color; transmitDMA(DMA_MINC_DISABLE, &data, count); } - static void WriteSequence(uint16_t *Data, uint16_t Count) { Transmit(DMA_MINC_ENABLE, Data, Count); } - static void WriteMultiple(uint16_t Color, uint32_t Count) { - while (Count > 0) { - Transmit(DMA_MINC_DISABLE, &Color, Count > DMA_MAX_SIZE ? DMA_MAX_SIZE : Count); - Count = Count > DMA_MAX_SIZE ? Count - DMA_MAX_SIZE : 0; + static void writeSequence(uint16_t *data, uint16_t count) { transmit(DMA_MINC_ENABLE, data, count); } + static void writeMultiple(uint16_t color, uint32_t count) { + while (count > 0) { + transmit(DMA_MINC_DISABLE, &color, count > DMA_MAX_SIZE ? DMA_MAX_SIZE : count); + count = count > DMA_MAX_SIZE ? count - DMA_MAX_SIZE : 0; } } }; diff --git a/Marlin/src/HAL/LPC1768/tft/xpt2046.cpp b/Marlin/src/HAL/LPC1768/tft/xpt2046.cpp index 910511612b9b4..74596935e967c 100644 --- a/Marlin/src/HAL/LPC1768/tft/xpt2046.cpp +++ b/Marlin/src/HAL/LPC1768/tft/xpt2046.cpp @@ -45,7 +45,7 @@ uint16_t delta(uint16_t a, uint16_t b) { return a > b ? a - b : b - a; } } #endif -void XPT2046::Init() { +void XPT2046::init() { #if DISABLED(TOUCH_BUTTONS_HW_SPI) SET_INPUT(TOUCH_MISO_PIN); SET_OUTPUT(TOUCH_MOSI_PIN); @@ -85,7 +85,7 @@ bool XPT2046::getRawPoint(int16_t *x, int16_t *y) { uint16_t XPT2046::getRawData(const XPTCoordinate coordinate) { uint16_t data[3]; - DataTransferBegin(); + dataTransferBegin(); TERN_(TOUCH_BUTTONS_HW_SPI, SPIx.begin()); for (uint16_t i = 0; i < 3 ; i++) { @@ -94,7 +94,7 @@ uint16_t XPT2046::getRawData(const XPTCoordinate coordinate) { } TERN_(TOUCH_BUTTONS_HW_SPI, SPIx.end()); - DataTransferEnd(); + dataTransferEnd(); uint16_t delta01 = delta(data[0], data[1]), delta02 = delta(data[0], data[2]), @@ -107,18 +107,18 @@ uint16_t XPT2046::getRawData(const XPTCoordinate coordinate) { } uint16_t XPT2046::IO(uint16_t data) { - return TERN(TOUCH_BUTTONS_HW_SPI, HardwareIO, SoftwareIO)(data); + return TERN(TOUCH_BUTTONS_HW_SPI, hardwareIO, softwareIO)(data); } extern uint8_t spiTransfer(uint8_t b); #if ENABLED(TOUCH_BUTTONS_HW_SPI) - uint16_t XPT2046::HardwareIO(uint16_t data) { + uint16_t XPT2046::hardwareIO(uint16_t data) { return SPIx.transfer(data & 0xFF); } #endif -uint16_t XPT2046::SoftwareIO(uint16_t data) { +uint16_t XPT2046::softwareIO(uint16_t data) { uint16_t result = 0; for (uint8_t j = 0x80; j; j >>= 1) { diff --git a/Marlin/src/HAL/LPC1768/tft/xpt2046.h b/Marlin/src/HAL/LPC1768/tft/xpt2046.h index 7c456cf00e1be..8fdcacf926419 100644 --- a/Marlin/src/HAL/LPC1768/tft/xpt2046.h +++ b/Marlin/src/HAL/LPC1768/tft/xpt2046.h @@ -65,12 +65,12 @@ class XPT2046 { static uint16_t getRawData(const XPTCoordinate coordinate); static bool isTouched(); - static void DataTransferBegin() { WRITE(TOUCH_CS_PIN, LOW); }; - static void DataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); }; + static void dataTransferBegin() { WRITE(TOUCH_CS_PIN, LOW); }; + static void dataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); }; #if ENABLED(TOUCH_BUTTONS_HW_SPI) - static uint16_t HardwareIO(uint16_t data); + static uint16_t hardwareIO(uint16_t data); #endif - static uint16_t SoftwareIO(uint16_t data); + static uint16_t softwareIO(uint16_t data); static uint16_t IO(uint16_t data = 0); public: @@ -78,6 +78,6 @@ class XPT2046 { static SPIClass SPIx; #endif - static void Init(); + static void init(); static bool getRawPoint(int16_t *x, int16_t *y); }; diff --git a/Marlin/src/HAL/NATIVE_SIM/tft/tft_spi.h b/Marlin/src/HAL/NATIVE_SIM/tft/tft_spi.h index f3b64c4ccad40..df7b9420994b9 100644 --- a/Marlin/src/HAL/NATIVE_SIM/tft/tft_spi.h +++ b/Marlin/src/HAL/NATIVE_SIM/tft/tft_spi.h @@ -40,28 +40,28 @@ class TFT_SPI { private: - static uint32_t ReadID(uint16_t Reg); - static void Transmit(uint16_t Data); - static void TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count); + static uint32_t readID(uint16_t reg); + static void transmit(uint16_t data); + static void transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count); public: // static SPIClass SPIx; - static void Init(); - static uint32_t GetID(); + static void init(); + static uint32_t getID(); static bool isBusy(); - static void Abort(); + static void abort(); - static void DataTransferBegin(uint16_t DataWidth=DATASIZE_16BIT); - static void DataTransferEnd(); - static void DataTransferAbort(); + static void dataTransferBegin(uint16_t dataWidth=DATASIZE_16BIT); + static void dataTransferEnd(); + static void dataTransferAbort(); - static void WriteData(uint16_t Data); - static void WriteReg(uint16_t Reg); + 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_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, uint32_t Count); + static void writeSequence(uint16_t *data, uint16_t count); + static void writeMultiple(uint16_t color, uint32_t count); }; diff --git a/Marlin/src/HAL/NATIVE_SIM/tft/xpt2046.h b/Marlin/src/HAL/NATIVE_SIM/tft/xpt2046.h index 4e999f88ff981..c546646d16fe9 100644 --- a/Marlin/src/HAL/NATIVE_SIM/tft/xpt2046.h +++ b/Marlin/src/HAL/NATIVE_SIM/tft/xpt2046.h @@ -62,12 +62,12 @@ class XPT2046 { static uint16_t getRawData(const XPTCoordinate coordinate); static bool isTouched(); - static void DataTransferBegin(); - static void DataTransferEnd(); + static void dataTransferBegin(); + static void dataTransferEnd(); #if ENABLED(TOUCH_BUTTONS_HW_SPI) - static uint16_t HardwareIO(uint16_t data); + static uint16_t hardwareIO(uint16_t data); #endif - static uint16_t SoftwareIO(uint16_t data); + static uint16_t softwareIO(uint16_t data); static uint16_t IO(uint16_t data = 0); public: @@ -75,6 +75,6 @@ class XPT2046 { static SPIClass SPIx; #endif - static void Init(); + static void init(); static bool getRawPoint(int16_t *x, int16_t *y); }; diff --git a/Marlin/src/HAL/SAMD21/u8g/u8g_com_HAL_samd21_shared_hw_spi.cpp b/Marlin/src/HAL/SAMD21/u8g/u8g_com_HAL_samd21_shared_hw_spi.cpp index 02dc77229676b..025e5a3bb60d4 100644 --- a/Marlin/src/HAL/SAMD21/u8g/u8g_com_HAL_samd21_shared_hw_spi.cpp +++ b/Marlin/src/HAL/SAMD21/u8g/u8g_com_HAL_samd21_shared_hw_spi.cpp @@ -60,6 +60,10 @@ #ifdef __SAMD21__ +#include "../../../inc/MarlinConfigPre.h" + +#if HAS_MARLINUI_U8GLIB + #include #include "SPI.h" @@ -151,4 +155,6 @@ uint8_t u8g_com_samd21_st7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val return 1; } +#endif // HAS_MARLINUI_U8GLIB + #endif // __SAMD21__ diff --git a/Marlin/src/HAL/STM32/HAL.h b/Marlin/src/HAL/STM32/HAL.h index dc36cc1eca337..24589d0fcc362 100644 --- a/Marlin/src/HAL/STM32/HAL.h +++ b/Marlin/src/HAL/STM32/HAL.h @@ -71,7 +71,7 @@ #if WITHIN(SERIAL_PORT_2, 1, 6) #define MYSERIAL2 MSERIAL(SERIAL_PORT_2) #elif !defined(USBCON) - #error "SERIAL_PORT must be from 1 to 6." + #error "SERIAL_PORT_2 must be from 1 to 6." #elif SERIAL_PORT_2 == -1 #define MYSERIAL2 MSerialUSB #else @@ -83,7 +83,7 @@ #if WITHIN(SERIAL_PORT_3, 1, 6) #define MYSERIAL3 MSERIAL(SERIAL_PORT_3) #elif !defined(USBCON) - #error "SERIAL_PORT must be from 1 to 6." + #error "SERIAL_PORT_3 must be from 1 to 6." #elif SERIAL_PORT_3 == -1 #define MYSERIAL3 MSerialUSB #else @@ -95,7 +95,7 @@ #if WITHIN(MMU2_SERIAL_PORT, 1, 6) #define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT) #elif !defined(USBCON) - #error "SERIAL_PORT must be from 1 to 6." + #error "MMU2_SERIAL_PORT must be from 1 to 6." #elif MMU2_SERIAL_PORT == -1 #define MMU2_SERIAL MSerialUSB #else @@ -107,7 +107,7 @@ #if WITHIN(LCD_SERIAL_PORT, 1, 6) #define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT) #elif !defined(USBCON) - #error "SERIAL_PORT must be from 1 to 6." + #error "LCD_SERIAL_PORT must be from 1 to 6." #elif LCD_SERIAL_PORT == -1 #define LCD_SERIAL MSerialUSB #else diff --git a/Marlin/src/HAL/STM32/tft/gt911.cpp b/Marlin/src/HAL/STM32/tft/gt911.cpp index 6809f66200934..52119c19b7941 100644 --- a/Marlin/src/HAL/STM32/tft/gt911.cpp +++ b/Marlin/src/HAL/STM32/tft/gt911.cpp @@ -156,7 +156,7 @@ void GT911::read_reg(uint16_t reg, uint8_t reg_len, uint8_t* r_data, uint8_t r_l sw_iic.stop(); } -void GT911::Init() { +void GT911::init() { OUT_WRITE(GT911_RST_PIN, LOW); OUT_WRITE(GT911_INT_PIN, LOW); delay(11); diff --git a/Marlin/src/HAL/STM32/tft/gt911.h b/Marlin/src/HAL/STM32/tft/gt911.h index 260c195eca636..75e025245d62c 100644 --- a/Marlin/src/HAL/STM32/tft/gt911.h +++ b/Marlin/src/HAL/STM32/tft/gt911.h @@ -90,7 +90,7 @@ class GT911 { static void read_reg(uint16_t reg, uint8_t reg_len, uint8_t* r_data, uint8_t r_len); public: - static void Init(); + static void init(); static bool getFirstTouchPoint(int16_t *x, int16_t *y); static bool getPoint(int16_t *x, int16_t *y); }; diff --git a/Marlin/src/HAL/STM32/tft/tft_fsmc.cpp b/Marlin/src/HAL/STM32/tft/tft_fsmc.cpp index 6ac3549b41b21..35606460ac628 100644 --- a/Marlin/src/HAL/STM32/tft/tft_fsmc.cpp +++ b/Marlin/src/HAL/STM32/tft/tft_fsmc.cpp @@ -35,17 +35,17 @@ SRAM_HandleTypeDef TFT_FSMC::SRAMx; DMA_HandleTypeDef TFT_FSMC::DMAtx; LCD_CONTROLLER_TypeDef *TFT_FSMC::LCD; -void TFT_FSMC::Init() { +void TFT_FSMC::init() { uint32_t controllerAddress; - FSMC_NORSRAM_TimingTypeDef Timing, ExtTiming; + FSMC_NORSRAM_TimingTypeDef timing, extTiming; - uint32_t NSBank = (uint32_t)pinmap_peripheral(digitalPinToPinName(TFT_CS_PIN), PinMap_FSMC_CS); + uint32_t nsBank = (uint32_t)pinmap_peripheral(digitalPinToPinName(TFT_CS_PIN), pinMap_FSMC_CS); // Perform the SRAM1 memory initialization sequence SRAMx.Instance = FSMC_NORSRAM_DEVICE; SRAMx.Extended = FSMC_NORSRAM_EXTENDED_DEVICE; // SRAMx.Init - SRAMx.Init.NSBank = NSBank; + SRAMx.Init.NSBank = nsBank; SRAMx.Init.DataAddressMux = FSMC_DATA_ADDRESS_MUX_DISABLE; SRAMx.Init.MemoryType = FSMC_MEMORY_TYPE_SRAM; SRAMx.Init.MemoryDataWidth = TERN(TFT_INTERFACE_FSMC_8BIT, FSMC_NORSRAM_MEM_BUS_WIDTH_8, FSMC_NORSRAM_MEM_BUS_WIDTH_16); @@ -63,42 +63,42 @@ void TFT_FSMC::Init() { #endif // Read Timing - relatively slow to ensure ID information is correctly read from TFT controller // Can be decreases from 15-15-24 to 4-4-8 with risk of stability loss - Timing.AddressSetupTime = 15; - Timing.AddressHoldTime = 15; - Timing.DataSetupTime = 24; - Timing.BusTurnAroundDuration = 0; - Timing.CLKDivision = 16; - Timing.DataLatency = 17; - Timing.AccessMode = FSMC_ACCESS_MODE_A; + timing.AddressSetupTime = 15; + timing.AddressHoldTime = 15; + timing.DataSetupTime = 24; + timing.BusTurnAroundDuration = 0; + timing.CLKDivision = 16; + timing.DataLatency = 17; + timing.AccessMode = FSMC_ACCESS_MODE_A; // Write Timing // Can be decreased from 8-15-8 to 0-0-1 with risk of stability loss - ExtTiming.AddressSetupTime = 8; - ExtTiming.AddressHoldTime = 15; - ExtTiming.DataSetupTime = 8; - ExtTiming.BusTurnAroundDuration = 0; - ExtTiming.CLKDivision = 16; - ExtTiming.DataLatency = 17; - ExtTiming.AccessMode = FSMC_ACCESS_MODE_A; + extTiming.AddressSetupTime = 8; + extTiming.AddressHoldTime = 15; + extTiming.DataSetupTime = 8; + extTiming.BusTurnAroundDuration = 0; + extTiming.CLKDivision = 16; + extTiming.DataLatency = 17; + extTiming.AccessMode = FSMC_ACCESS_MODE_A; __HAL_RCC_FSMC_CLK_ENABLE(); - for (uint16_t i = 0; PinMap_FSMC[i].pin != NC; i++) - pinmap_pinout(PinMap_FSMC[i].pin, PinMap_FSMC); - pinmap_pinout(digitalPinToPinName(TFT_CS_PIN), PinMap_FSMC_CS); - pinmap_pinout(digitalPinToPinName(TFT_RS_PIN), PinMap_FSMC_RS); + for (uint16_t i = 0; pinMap_FSMC[i].pin != NC; i++) + pinmap_pinout(pinMap_FSMC[i].pin, pinMap_FSMC); + pinmap_pinout(digitalPinToPinName(TFT_CS_PIN), pinMap_FSMC_CS); + pinmap_pinout(digitalPinToPinName(TFT_RS_PIN), pinMap_FSMC_RS); controllerAddress = FSMC_BANK1_1; #ifdef PF0 - switch (NSBank) { + switch (nsBank) { case FSMC_NORSRAM_BANK2: controllerAddress = FSMC_BANK1_2 ; break; case FSMC_NORSRAM_BANK3: controllerAddress = FSMC_BANK1_3 ; break; case FSMC_NORSRAM_BANK4: controllerAddress = FSMC_BANK1_4 ; break; } #endif - controllerAddress |= (uint32_t)pinmap_peripheral(digitalPinToPinName(TFT_RS_PIN), PinMap_FSMC_RS); + controllerAddress |= (uint32_t)pinmap_peripheral(digitalPinToPinName(TFT_RS_PIN), pinMap_FSMC_RS); - HAL_SRAM_Init(&SRAMx, &Timing, &ExtTiming); + HAL_SRAM_Init(&SRAMx, &timing, &extTiming); #ifdef STM32F1xx __HAL_RCC_DMA1_CLK_ENABLE(); @@ -123,23 +123,23 @@ void TFT_FSMC::Init() { LCD = (LCD_CONTROLLER_TypeDef *)controllerAddress; } -uint32_t TFT_FSMC::GetID() { +uint32_t TFT_FSMC::getID() { uint32_t id; - WriteReg(0); + writeReg(0); id = LCD->RAM; if (id == 0) - id = ReadID(LCD_READ_ID); + id = readID(LCD_READ_ID); if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF) - id = ReadID(LCD_READ_ID4); + id = readID(LCD_READ_ID4); return id; } -uint32_t TFT_FSMC::ReadID(tft_data_t Reg) { +uint32_t TFT_FSMC::readID(tft_data_t reg) { uint32_t id; - WriteReg(Reg); + writeReg(reg); id = LCD->RAM; // dummy read - id = Reg << 24; + id = reg << 24; id |= (LCD->RAM & 0x00FF) << 16; id |= (LCD->RAM & 0x00FF) << 8; id |= LCD->RAM & 0x00FF; @@ -161,30 +161,30 @@ bool TFT_FSMC::isBusy() { if ((__HAL_DMA_GET_FLAG(&DMAtx, __HAL_DMA_GET_TE_FLAG_INDEX(&DMAtx)) == 0) && (__HAL_DMA_GET_FLAG(&DMAtx, __HAL_DMA_GET_TC_FLAG_INDEX(&DMAtx)) == 0)) return true; __DSB(); - Abort(); + abort(); return false; } -void TFT_FSMC::Abort() { +void TFT_FSMC::abort() { HAL_DMA_Abort(&DMAtx); // Abort DMA transfer if any HAL_DMA_DeInit(&DMAtx); // Deconfigure DMA } -void TFT_FSMC::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) { - DMAtx.Init.PeriphInc = MemoryIncrease; +void TFT_FSMC::transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count) { + DMAtx.Init.PeriphInc = memoryIncrease; HAL_DMA_Init(&DMAtx); - HAL_DMA_Start(&DMAtx, (uint32_t)Data, (uint32_t)&(LCD->RAM), Count); + HAL_DMA_Start(&DMAtx, (uint32_t)data, (uint32_t)&(LCD->RAM), count); TERN_(TFT_SHARED_IO, while (isBusy())); } -void TFT_FSMC::Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) { - DMAtx.Init.PeriphInc = MemoryIncrease; +void TFT_FSMC::transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count) { + DMAtx.Init.PeriphInc = memoryIncrease; HAL_DMA_Init(&DMAtx); - DataTransferBegin(); - HAL_DMA_Start(&DMAtx, (uint32_t)Data, (uint32_t)&(LCD->RAM), Count); + dataTransferBegin(); + HAL_DMA_Start(&DMAtx, (uint32_t)data, (uint32_t)&(LCD->RAM), count); HAL_DMA_PollForTransfer(&DMAtx, HAL_DMA_FULL_TRANSFER, HAL_MAX_DELAY); - Abort(); + abort(); } #endif // HAS_FSMC_TFT diff --git a/Marlin/src/HAL/STM32/tft/tft_fsmc.h b/Marlin/src/HAL/STM32/tft/tft_fsmc.h index 8eb41d717d6d7..1b0a45ff79ac5 100644 --- a/Marlin/src/HAL/STM32/tft/tft_fsmc.h +++ b/Marlin/src/HAL/STM32/tft/tft_fsmc.h @@ -62,31 +62,31 @@ class TFT_FSMC { static LCD_CONTROLLER_TypeDef *LCD; - static uint32_t ReadID(tft_data_t Reg); - static void Transmit(tft_data_t Data) { LCD->RAM = Data; __DSB(); } - static void Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count); - static void TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count); + static uint32_t readID(tft_data_t reg); + static void transmit(tft_data_t data) { LCD->RAM = data; __DSB(); } + static void transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count); + static void transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count); public: - static void Init(); - static uint32_t GetID(); + static void init(); + static uint32_t getID(); static bool isBusy(); - static void Abort(); + static void abort(); - static void DataTransferBegin(uint16_t DataWidth=TFT_DATASIZE) {} - static void DataTransferEnd() {} + static void dataTransferBegin(uint16_t dataWidth=TFT_DATASIZE) {} + static void dataTransferEnd() {} - static void WriteData(uint16_t Data) { Transmit(tft_data_t(Data)); } - static void WriteReg(uint16_t Reg) { LCD->REG = tft_data_t(Reg); __DSB(); } + static void writeData(uint16_t data) { transmit(tft_data_t(data)); } + static void writeReg(uint16_t reg) { LCD->REG = tft_data_t(reg); __DSB(); } - static void WriteSequence_DMA(uint16_t *Data, uint16_t Count) { TransmitDMA(DMA_PINC_ENABLE, Data, Count); } - static void WriteMultiple_DMA(uint16_t Color, uint16_t Count) { static uint16_t Data; Data = Color; TransmitDMA(DMA_PINC_DISABLE, &Data, Count); } + static void writeSequence_DMA(uint16_t *data, uint16_t count) { transmitDMA(DMA_PINC_ENABLE, data, count); } + static void writeMultiple_DMA(uint16_t color, uint16_t count) { static uint16_t data; data = color; transmitDMA(DMA_PINC_DISABLE, &data, count); } - static void WriteSequence(uint16_t *Data, uint16_t Count) { Transmit(DMA_PINC_ENABLE, Data, Count); } - static void WriteMultiple(uint16_t Color, uint32_t Count) { - while (Count > 0) { - Transmit(DMA_MINC_DISABLE, &Color, Count > DMA_MAX_SIZE ? DMA_MAX_SIZE : Count); - Count = Count > DMA_MAX_SIZE ? Count - DMA_MAX_SIZE : 0; + static void writeSequence(uint16_t *data, uint16_t count) { transmit(DMA_PINC_ENABLE, data, count); } + static void writeMultiple(uint16_t color, uint32_t count) { + while (count > 0) { + transmit(DMA_MINC_DISABLE, &color, count > DMA_MAX_SIZE ? DMA_MAX_SIZE : count); + count = count > DMA_MAX_SIZE ? count - DMA_MAX_SIZE : 0; } } }; @@ -103,7 +103,7 @@ class TFT_FSMC { #error No configuration for this MCU #endif -const PinMap PinMap_FSMC[] = { +const PinMap pinMap_FSMC[] = { {PD_14, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D00 {PD_15, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D01 {PD_0, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D02 @@ -127,7 +127,7 @@ const PinMap PinMap_FSMC[] = { {NC, NP, 0} }; -const PinMap PinMap_FSMC_CS[] = { +const PinMap pinMap_FSMC_CS[] = { {PD_7, (void *)FSMC_NORSRAM_BANK1, FSMC_PIN_DATA}, // FSMC_NE1 #ifdef PF0 {PG_9, (void *)FSMC_NORSRAM_BANK2, FSMC_PIN_DATA}, // FSMC_NE2 @@ -143,7 +143,7 @@ const PinMap PinMap_FSMC_CS[] = { #define FSMC_RS(A) (void *)((2 << A) - 2) #endif -const PinMap PinMap_FSMC_RS[] = { +const PinMap pinMap_FSMC_RS[] = { #ifdef PF0 {PF_0, FSMC_RS( 0), FSMC_PIN_DATA}, // FSMC_A0 {PF_1, FSMC_RS( 1), FSMC_PIN_DATA}, // FSMC_A1 diff --git a/Marlin/src/HAL/STM32/tft/tft_ltdc.cpp b/Marlin/src/HAL/STM32/tft/tft_ltdc.cpp index 2be900618f20a..ce47d2e1ecdfa 100644 --- a/Marlin/src/HAL/STM32/tft/tft_ltdc.cpp +++ b/Marlin/src/HAL/STM32/tft/tft_ltdc.cpp @@ -246,28 +246,28 @@ uint16_t TFT_LTDC::y_cur = 0; uint8_t TFT_LTDC::reg = 0; volatile uint16_t* TFT_LTDC::framebuffer = (volatile uint16_t* )FRAME_BUFFER_ADDRESS; -void TFT_LTDC::Init() { +void TFT_LTDC::init() { // SDRAM pins init - for (uint16_t i = 0; PinMap_SDRAM[i].pin != NC; i++) - pinmap_pinout(PinMap_SDRAM[i].pin, PinMap_SDRAM); + for (uint16_t i = 0; pinMap_SDRAM[i].pin != NC; i++) + pinmap_pinout(pinMap_SDRAM[i].pin, pinMap_SDRAM); // SDRAM peripheral config SDRAM_Config(); // LTDC pins init - for (uint16_t i = 0; PinMap_LTDC[i].pin != NC; i++) - pinmap_pinout(PinMap_LTDC[i].pin, PinMap_LTDC); + for (uint16_t i = 0; pinMap_LTDC[i].pin != NC; i++) + pinmap_pinout(pinMap_LTDC[i].pin, pinMap_LTDC); // LTDC peripheral config LTDC_Config(); } -uint32_t TFT_LTDC::GetID() { +uint32_t TFT_LTDC::getID() { return 0xABAB; } -uint32_t TFT_LTDC::ReadID(tft_data_t Reg) { +uint32_t TFT_LTDC::readID(tft_data_t reg) { return 0xABAB; } @@ -275,15 +275,15 @@ bool TFT_LTDC::isBusy() { return false; } -uint16_t TFT_LTDC::ReadPoint(uint16_t x, uint16_t y) { +uint16_t TFT_LTDC::readPoint(uint16_t x, uint16_t y) { return framebuffer[(TFT_WIDTH * y) + x]; } -void TFT_LTDC::DrawPoint(uint16_t x, uint16_t y, uint16_t color) { +void TFT_LTDC::drawPoint(uint16_t x, uint16_t y, uint16_t color) { framebuffer[(TFT_WIDTH * y) + x] = color; } -void TFT_LTDC::DrawRect(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t color) { +void TFT_LTDC::drawRect(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t color) { if (sx == ex || sy == ey) return; @@ -307,7 +307,7 @@ void TFT_LTDC::DrawRect(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint SBI(DMA2D->IFCR, 1); } -void TFT_LTDC::DrawImage(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t *colors) { +void TFT_LTDC::drawImage(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t *colors) { if (sx == ex || sy == ey) return; @@ -332,18 +332,18 @@ void TFT_LTDC::DrawImage(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uin SBI(DMA2D->IFCR, 1); } -void TFT_LTDC::WriteData(uint16_t data) { +void TFT_LTDC::writeData(uint16_t data) { switch (reg) { case 0x01: x_cur = x_min = data; return; case 0x02: x_max = data; return; case 0x03: y_cur = y_min = data; return; case 0x04: y_max = data; return; } - Transmit(data); + transmit(data); } -void TFT_LTDC::Transmit(tft_data_t Data) { - DrawPoint(x_cur, y_cur, Data); +void TFT_LTDC::transmit(tft_data_t data) { + drawPoint(x_cur, y_cur, data); x_cur++; if (x_cur > x_max) { x_cur = x_min; @@ -352,35 +352,35 @@ void TFT_LTDC::Transmit(tft_data_t Data) { } } -void TFT_LTDC::WriteReg(uint16_t Reg) { - reg = Reg; +void TFT_LTDC::writeReg(uint16_t reg) { + reg = reg; } -void TFT_LTDC::Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) { +void TFT_LTDC::transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count) { - while (x_cur != x_min && Count) { - Transmit(*Data); - if (MemoryIncrease == DMA_PINC_ENABLE) Data++; - Count--; + while (x_cur != x_min && count) { + transmit(*data); + if (memoryIncrease == DMA_PINC_ENABLE) data++; + count--; } uint16_t width = x_max - x_min + 1; - uint16_t height = Count / width; - uint16_t x_end_cnt = Count - (width * height); + uint16_t height = count / width; + uint16_t x_end_cnt = count - (width * height); if (height) { - if (MemoryIncrease == DMA_PINC_ENABLE) { - DrawImage(x_min, y_cur, x_min + width, y_cur + height, Data); - Data += width * height; + if (memoryIncrease == DMA_PINC_ENABLE) { + drawImage(x_min, y_cur, x_min + width, y_cur + height, data); + data += width * height; } else - DrawRect(x_min, y_cur, x_min + width, y_cur + height, *Data); + drawRect(x_min, y_cur, x_min + width, y_cur + height, *data); y_cur += height; } while (x_end_cnt) { - Transmit(*Data); - if (MemoryIncrease == DMA_PINC_ENABLE) Data++; + transmit(*data); + if (memoryIncrease == DMA_PINC_ENABLE) data++; x_end_cnt--; } } diff --git a/Marlin/src/HAL/STM32/tft/tft_ltdc.h b/Marlin/src/HAL/STM32/tft/tft_ltdc.h index ee655610116ea..d4a254ba7063b 100644 --- a/Marlin/src/HAL/STM32/tft/tft_ltdc.h +++ b/Marlin/src/HAL/STM32/tft/tft_ltdc.h @@ -43,41 +43,41 @@ class TFT_LTDC { static uint16_t x_min, x_max, y_min, y_max, x_cur, y_cur; static uint8_t reg; - static uint32_t ReadID(tft_data_t Reg); + static uint32_t readID(tft_data_t reg); - static uint16_t ReadPoint(uint16_t x, uint16_t y); - static void DrawPoint(uint16_t x, uint16_t y, uint16_t color); - static void DrawRect(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t color); - static void DrawImage(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t *colors); - static void Transmit(tft_data_t Data); - static void Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count); + static uint16_t readPoint(uint16_t x, uint16_t y); + static void drawPoint(uint16_t x, uint16_t y, uint16_t color); + static void drawRect(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t color); + static void drawImage(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t *colors); + static void transmit(tft_data_t data); + static void transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count); public: - static void Init(); - static uint32_t GetID(); + static void init(); + static uint32_t getID(); static bool isBusy(); - static void Abort() { /*__HAL_DMA_DISABLE(&DMAtx);*/ } + static void abort() { /*__HAL_DMA_DISABLE(&DMAtx);*/ } - static void DataTransferBegin(uint16_t DataWidth=TFT_DATASIZE) {} - static void DataTransferEnd() {}; + static void dataTransferBegin(uint16_t dataWidth=TFT_DATASIZE) {} + static void dataTransferEnd() {}; - static void WriteData(uint16_t Data); - static void WriteReg(uint16_t Reg); + static void writeData(uint16_t data); + static void writeReg(uint16_t reg); // Non-blocking DMA data transfer is not implemented for LTDC interface - inline static void WriteSequence_DMA(uint16_t *Data, uint16_t Count) { WriteSequence(Data, Count); } - inline static void WriteMultiple_DMA(uint16_t Color, uint16_t Count) { WriteMultiple(Color, Count); } - - static void WriteSequence(uint16_t *Data, uint16_t Count) { Transmit(DMA_PINC_ENABLE, Data, Count); } - static void WriteMultiple(uint16_t Color, uint32_t Count) { - while (Count > 0) { - Transmit(DMA_PINC_DISABLE, &Color, Count > DMA_MAX_SIZE ? DMA_MAX_SIZE : Count); - Count = Count > DMA_MAX_SIZE ? Count - DMA_MAX_SIZE : 0; + inline static void writeSequence_DMA(uint16_t *data, uint16_t count) { writeSequence(data, count); } + inline static void writeMultiple_DMA(uint16_t color, uint16_t count) { writeMultiple(color, count); } + + static void writeSequence(uint16_t *data, uint16_t count) { transmit(DMA_PINC_ENABLE, data, count); } + static void writeMultiple(uint16_t color, uint32_t count) { + while (count > 0) { + transmit(DMA_PINC_DISABLE, &color, count > DMA_MAX_SIZE ? DMA_MAX_SIZE : count); + count = count > DMA_MAX_SIZE ? count - DMA_MAX_SIZE : 0; } } }; -const PinMap PinMap_LTDC[] = { +const PinMap pinMap_LTDC[] = { {PF_10, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_DE {PG_7, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_CLK {PI_9, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_VSYNC @@ -104,7 +104,7 @@ const PinMap PinMap_LTDC[] = { {NC, NP, 0} }; -const PinMap PinMap_SDRAM[] = { +const PinMap pinMap_SDRAM[] = { {PC_0, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_SDNWE {PC_2, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_SDNE0 {PC_3, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_SDCKE0 diff --git a/Marlin/src/HAL/STM32/tft/tft_spi.cpp b/Marlin/src/HAL/STM32/tft/tft_spi.cpp index dbb93c786b4ee..eebf366b8c38d 100644 --- a/Marlin/src/HAL/STM32/tft/tft_spi.cpp +++ b/Marlin/src/HAL/STM32/tft/tft_spi.cpp @@ -34,7 +34,7 @@ SPI_HandleTypeDef TFT_SPI::SPIx; DMA_HandleTypeDef TFT_SPI::DMAtx; -void TFT_SPI::Init() { +void TFT_SPI::init() { SPI_TypeDef *spiInstance; OUT_WRITE(TFT_A0_PIN, HIGH); @@ -122,8 +122,8 @@ void TFT_SPI::Init() { #endif } -void TFT_SPI::DataTransferBegin(uint16_t DataSize) { - SPIx.Init.DataSize = DataSize == DATASIZE_8BIT ? SPI_DATASIZE_8BIT : SPI_DATASIZE_16BIT; +void TFT_SPI::dataTransferBegin(uint16_t dataSize) { + SPIx.Init.DataSize = dataSize == DATASIZE_8BIT ? SPI_DATASIZE_8BIT : SPI_DATASIZE_16BIT; HAL_SPI_Init(&SPIx); WRITE(TFT_CS_PIN, LOW); } @@ -132,11 +132,11 @@ void TFT_SPI::DataTransferBegin(uint16_t DataSize) { #include "../../../lcd/tft_io/tft_ids.h" #endif -uint32_t TFT_SPI::GetID() { +uint32_t TFT_SPI::getID() { uint32_t id; - id = ReadID(LCD_READ_ID); + id = readID(LCD_READ_ID); if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF) { - id = ReadID(LCD_READ_ID4); + id = readID(LCD_READ_ID4); #ifdef TFT_DEFAULT_DRIVER if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF) id = TFT_DEFAULT_DRIVER; @@ -145,15 +145,15 @@ uint32_t TFT_SPI::GetID() { return id; } -uint32_t TFT_SPI::ReadID(uint16_t Reg) { - uint32_t Data = 0; +uint32_t TFT_SPI::readID(uint16_t reg) { + uint32_t data = 0; #if PIN_EXISTS(TFT_MISO) uint32_t BaudRatePrescaler = SPIx.Init.BaudRatePrescaler; uint32_t i; SPIx.Init.BaudRatePrescaler = SPIx.Instance == SPI1 ? SPI_BAUDRATEPRESCALER_8 : SPI_BAUDRATEPRESCALER_4; - DataTransferBegin(DATASIZE_8BIT); - WriteReg(Reg); + dataTransferBegin(DATASIZE_8BIT); + writeReg(reg); if (SPIx.Init.Direction == SPI_DIRECTION_1LINE) SPI_1LINE_RX(&SPIx); __HAL_SPI_ENABLE(&SPIx); @@ -164,15 +164,15 @@ uint32_t TFT_SPI::ReadID(uint16_t Reg) { SPIx.Instance->DR = 0; #endif while (!__HAL_SPI_GET_FLAG(&SPIx, SPI_FLAG_RXNE)) {} - Data = (Data << 8) | SPIx.Instance->DR; + data = (data << 8) | SPIx.Instance->DR; } - DataTransferEnd(); + dataTransferEnd(); SPIx.Init.BaudRatePrescaler = BaudRatePrescaler; #endif - return Data >> 7; + return data >> 7; } bool TFT_SPI::isBusy() { @@ -197,27 +197,27 @@ bool TFT_SPI::isBusy() { if ((!__HAL_SPI_GET_FLAG(&SPIx, SPI_FLAG_TXE)) || (__HAL_SPI_GET_FLAG(&SPIx, SPI_FLAG_BSY))) return true; } - Abort(); + abort(); return false; } -void TFT_SPI::Abort() { +void TFT_SPI::abort() { HAL_DMA_Abort(&DMAtx); // Abort DMA transfer if any HAL_DMA_DeInit(&DMAtx); CLEAR_BIT(SPIx.Instance->CR2, SPI_CR2_TXDMAEN); - DataTransferEnd(); // Stop SPI and deselect CS + dataTransferEnd(); // Stop SPI and deselect CS } -void TFT_SPI::Transmit(uint16_t Data) { +void TFT_SPI::transmit(uint16_t data) { #if TFT_MISO_PIN == TFT_MOSI_PIN SPI_1LINE_TX(&SPIx); #endif __HAL_SPI_ENABLE(&SPIx); - SPIx.Instance->DR = Data; + SPIx.Instance->DR = data; while (!__HAL_SPI_GET_FLAG(&SPIx, SPI_FLAG_TXE)) {} while ( __HAL_SPI_GET_FLAG(&SPIx, SPI_FLAG_BSY)) {} @@ -227,17 +227,17 @@ void TFT_SPI::Transmit(uint16_t Data) { #endif } -void TFT_SPI::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) { - DMAtx.Init.MemInc = MemoryIncrease; +void TFT_SPI::transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count) { + DMAtx.Init.MemInc = memoryIncrease; HAL_DMA_Init(&DMAtx); #if TFT_MISO_PIN == TFT_MOSI_PIN SPI_1LINE_TX(&SPIx); #endif - DataTransferBegin(); + dataTransferBegin(); - HAL_DMA_Start(&DMAtx, (uint32_t)Data, (uint32_t)&(SPIx.Instance->DR), Count); + HAL_DMA_Start(&DMAtx, (uint32_t)data, (uint32_t)&(SPIx.Instance->DR), count); __HAL_SPI_ENABLE(&SPIx); SET_BIT(SPIx.Instance->CR2, SPI_CR2_TXDMAEN); // Enable Tx DMA Request @@ -245,39 +245,39 @@ void TFT_SPI::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Coun TERN_(TFT_SHARED_IO, while (isBusy())); } -void TFT_SPI::Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) { - DMAtx.Init.MemInc = MemoryIncrease; +void TFT_SPI::transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count) { + DMAtx.Init.MemInc = memoryIncrease; HAL_DMA_Init(&DMAtx); if (TFT_MISO_PIN == TFT_MOSI_PIN) SPI_1LINE_TX(&SPIx); - DataTransferBegin(); + dataTransferBegin(); - HAL_DMA_Start(&DMAtx, (uint32_t)Data, (uint32_t)&(SPIx.Instance->DR), Count); + HAL_DMA_Start(&DMAtx, (uint32_t)data, (uint32_t)&(SPIx.Instance->DR), count); __HAL_SPI_ENABLE(&SPIx); SET_BIT(SPIx.Instance->CR2, SPI_CR2_TXDMAEN); // Enable Tx DMA Request HAL_DMA_PollForTransfer(&DMAtx, HAL_DMA_FULL_TRANSFER, HAL_MAX_DELAY); while ( __HAL_SPI_GET_FLAG(&SPIx, SPI_FLAG_BSY)) {} - Abort(); + abort(); } #if ENABLED(USE_SPI_DMA_TC) - void TFT_SPI::TransmitDMA_IT(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) { + void TFT_SPI::TransmitDMA_IT(uint32_t memoryIncrease, uint16_t *data, uint16_t count) { - DMAtx.Init.MemInc = MemoryIncrease; + DMAtx.Init.MemInc = memoryIncrease; HAL_DMA_Init(&DMAtx); if (TFT_MISO_PIN == TFT_MOSI_PIN) SPI_1LINE_TX(&SPIx); - DataTransferBegin(); + dataTransferBegin(); HAL_NVIC_SetPriority(DMA2_Stream3_IRQn, 5, 0); HAL_NVIC_EnableIRQ(DMA2_Stream3_IRQn); - HAL_DMA_Start_IT(&DMAtx, (uint32_t)Data, (uint32_t)&(SPIx.Instance->DR), Count); + HAL_DMA_Start_IT(&DMAtx, (uint32_t)data, (uint32_t)&(SPIx.Instance->DR), count); __HAL_SPI_ENABLE(&SPIx); SET_BIT(SPIx.Instance->CR2, SPI_CR2_TXDMAEN); // Enable Tx DMA Request diff --git a/Marlin/src/HAL/STM32/tft/tft_spi.h b/Marlin/src/HAL/STM32/tft/tft_spi.h index 4825b65c68c30..09f0e0810731a 100644 --- a/Marlin/src/HAL/STM32/tft/tft_spi.h +++ b/Marlin/src/HAL/STM32/tft/tft_spi.h @@ -46,40 +46,40 @@ class TFT_SPI { static SPI_HandleTypeDef SPIx; static DMA_HandleTypeDef DMAtx; - static uint32_t ReadID(uint16_t Reg); - static void Transmit(uint16_t Data); - static void Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count); - static void TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count); + static uint32_t readID(uint16_t reg); + static void transmit(uint16_t data); + static void transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count); + static void transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count); #if ENABLED(USE_SPI_DMA_TC) - static void TransmitDMA_IT(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count); + static void TransmitDMA_IT(uint32_t memoryIncrease, uint16_t *data, uint16_t count); #endif public: - static void Init(); - static uint32_t GetID(); + static void init(); + static uint32_t getID(); static bool isBusy(); - static void Abort(); + static void abort(); - static void DataTransferBegin(uint16_t DataWidth=DATASIZE_16BIT); - static void DataTransferEnd() { WRITE(TFT_CS_PIN, HIGH); __HAL_SPI_DISABLE(&SPIx); }; - static void DataTransferAbort(); + static void dataTransferBegin(uint16_t dataWidth=DATASIZE_16BIT); + static void dataTransferEnd() { WRITE(TFT_CS_PIN, HIGH); __HAL_SPI_DISABLE(&SPIx); }; + static void dataTransferAbort(); - static void WriteData(uint16_t Data) { Transmit(Data); } - static void WriteReg(uint16_t Reg) { WRITE(TFT_A0_PIN, LOW); Transmit(Reg); WRITE(TFT_A0_PIN, HIGH); } + static void writeData(uint16_t data) { transmit(data); } + static void writeReg(uint16_t reg) { WRITE(TFT_A0_PIN, LOW); transmit(reg); WRITE(TFT_A0_PIN, HIGH); } - static void WriteSequence_DMA(uint16_t *Data, uint16_t Count) { TransmitDMA(DMA_MINC_ENABLE, Data, Count); } - static void WriteMultiple_DMA(uint16_t Color, uint16_t Count) { static uint16_t Data; Data = Color; TransmitDMA(DMA_MINC_DISABLE, &Data, Count); } + static void writeSequence_DMA(uint16_t *data, uint16_t count) { transmitDMA(DMA_MINC_ENABLE, data, count); } + static void writeMultiple_DMA(uint16_t color, uint16_t count) { static uint16_t data; data = color; transmitDMA(DMA_MINC_DISABLE, &data, count); } #if ENABLED(USE_SPI_DMA_TC) - static void WriteSequenceIT(uint16_t *Data, uint16_t Count) { TransmitDMA_IT(DMA_MINC_ENABLE, Data, Count); } + static void writeSequenceIT(uint16_t *data, uint16_t count) { TransmitDMA_IT(DMA_MINC_ENABLE, data, count); } inline static void DMA_IRQHandler() { HAL_DMA_IRQHandler(&TFT_SPI::DMAtx); } #endif - static void WriteSequence(uint16_t *Data, uint16_t Count) { Transmit(DMA_MINC_ENABLE, Data, Count); } - static void WriteMultiple(uint16_t Color, uint32_t Count) { - while (Count > 0) { - Transmit(DMA_MINC_DISABLE, &Color, Count > DMA_MAX_SIZE ? DMA_MAX_SIZE : Count); - Count = Count > DMA_MAX_SIZE ? Count - DMA_MAX_SIZE : 0; + static void writeSequence(uint16_t *data, uint16_t count) { transmit(DMA_MINC_ENABLE, data, count); } + static void writeMultiple(uint16_t color, uint32_t count) { + while (count > 0) { + transmit(DMA_MINC_DISABLE, &color, count > DMA_MAX_SIZE ? DMA_MAX_SIZE : count); + count = count > DMA_MAX_SIZE ? count - DMA_MAX_SIZE : 0; } } }; diff --git a/Marlin/src/HAL/STM32/tft/xpt2046.cpp b/Marlin/src/HAL/STM32/tft/xpt2046.cpp index cf4a8f18e9ac2..8efbfb84f8b0a 100644 --- a/Marlin/src/HAL/STM32/tft/xpt2046.cpp +++ b/Marlin/src/HAL/STM32/tft/xpt2046.cpp @@ -35,7 +35,7 @@ uint16_t delta(uint16_t a, uint16_t b) { return a > b ? a - b : b - a; } SPI_HandleTypeDef XPT2046::SPIx; -void XPT2046::Init() { +void XPT2046::init() { SPI_TypeDef *spiInstance; OUT_WRITE(TOUCH_CS_PIN, HIGH); @@ -117,14 +117,14 @@ bool XPT2046::getRawPoint(int16_t *x, int16_t *y) { uint16_t XPT2046::getRawData(const XPTCoordinate coordinate) { uint16_t data[3]; - DataTransferBegin(); + dataTransferBegin(); for (uint16_t i = 0; i < 3 ; i++) { IO(coordinate); data[i] = (IO() << 4) | (IO() >> 4); } - DataTransferEnd(); + dataTransferEnd(); uint16_t delta01 = delta(data[0], data[1]); uint16_t delta02 = delta(data[0], data[2]); @@ -140,7 +140,7 @@ uint16_t XPT2046::getRawData(const XPTCoordinate coordinate) { return (data[0] + data[1]) >> 1; } -uint16_t XPT2046::HardwareIO(uint16_t data) { +uint16_t XPT2046::hardwareIO(uint16_t data) { __HAL_SPI_ENABLE(&SPIx); while ((SPIx.Instance->SR & SPI_FLAG_TXE) != SPI_FLAG_TXE) {} SPIx.Instance->DR = data; @@ -150,7 +150,7 @@ uint16_t XPT2046::HardwareIO(uint16_t data) { return SPIx.Instance->DR; } -uint16_t XPT2046::SoftwareIO(uint16_t data) { +uint16_t XPT2046::softwareIO(uint16_t data) { uint16_t result = 0; for (uint8_t j = 0x80; j > 0; j >>= 1) { diff --git a/Marlin/src/HAL/STM32/tft/xpt2046.h b/Marlin/src/HAL/STM32/tft/xpt2046.h index 71de6b00251b1..6b2492c339385 100644 --- a/Marlin/src/HAL/STM32/tft/xpt2046.h +++ b/Marlin/src/HAL/STM32/tft/xpt2046.h @@ -69,13 +69,13 @@ class XPT2046 { static uint16_t getRawData(const XPTCoordinate coordinate); static bool isTouched(); - static void DataTransferBegin() { if (SPIx.Instance) { HAL_SPI_Init(&SPIx); } WRITE(TOUCH_CS_PIN, LOW); }; - static void DataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); }; - static uint16_t HardwareIO(uint16_t data); - static uint16_t SoftwareIO(uint16_t data); - static uint16_t IO(uint16_t data = 0) { return SPIx.Instance ? HardwareIO(data) : SoftwareIO(data); } + static void dataTransferBegin() { if (SPIx.Instance) { HAL_SPI_Init(&SPIx); } WRITE(TOUCH_CS_PIN, LOW); }; + static void dataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); }; + static uint16_t hardwareIO(uint16_t data); + static uint16_t softwareIO(uint16_t data); + static uint16_t IO(uint16_t data = 0) { return SPIx.Instance ? hardwareIO(data) : softwareIO(data); } public: - static void Init(); + static void init(); static bool getRawPoint(int16_t *x, int16_t *y); }; diff --git a/Marlin/src/HAL/STM32F1/tft/tft_fsmc.cpp b/Marlin/src/HAL/STM32F1/tft/tft_fsmc.cpp index 1e4dfec8a6905..a910cd5af080b 100644 --- a/Marlin/src/HAL/STM32F1/tft/tft_fsmc.cpp +++ b/Marlin/src/HAL/STM32F1/tft/tft_fsmc.cpp @@ -87,7 +87,7 @@ __attribute__((always_inline)) __STATIC_INLINE void __DSB() { #define FSMC_DATA_SETUP_TIME 15 // DataSetupTime static uint8_t fsmcInit = 0; -void TFT_FSMC::Init() { +void TFT_FSMC::init() { uint8_t cs = FSMC_CS_PIN, rs = FSMC_RS_PIN; uint32_t controllerAddress; @@ -181,35 +181,35 @@ void TFT_FSMC::Init() { LCD = (LCD_CONTROLLER_TypeDef*)controllerAddress; } -void TFT_FSMC::Transmit(uint16_t Data) { - LCD->RAM = Data; +void TFT_FSMC::transmit(uint16_t data) { + LCD->RAM = data; __DSB(); } -void TFT_FSMC::WriteReg(uint16_t Reg) { - LCD->REG = Reg; +void TFT_FSMC::writeReg(uint16_t reg) { + LCD->REG = reg; __DSB(); } -uint32_t TFT_FSMC::GetID() { +uint32_t TFT_FSMC::getID() { uint32_t id; - WriteReg(0x0000); + writeReg(0x0000); id = LCD->RAM; if (id == 0) - id = ReadID(LCD_READ_ID); + id = readID(LCD_READ_ID); if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF) - id = ReadID(LCD_READ_ID4); + id = readID(LCD_READ_ID4); if ((id & 0xFF00) == 0 && (id & 0xFF) != 0) - id = ReadID(LCD_READ_ID4); + id = readID(LCD_READ_ID4); return id; } - uint32_t TFT_FSMC::ReadID(uint16_t Reg) { + uint32_t TFT_FSMC::readID(uint16_t reg) { uint32_t id; - WriteReg(Reg); + writeReg(reg); id = LCD->RAM; // dummy read - id = Reg << 24; + id = reg << 24; id |= (LCD->RAM & 0x00FF) << 16; id |= (LCD->RAM & 0x00FF) << 8; id |= LCD->RAM & 0x00FF; @@ -225,11 +225,11 @@ bool TFT_FSMC::isBusy() { if ((dma_get_isr_bits(FSMC_DMA_DEV, FSMC_DMA_CHANNEL) & (DMA_ISR_TCIF | DMA_ISR_TEIF)) == 0) return true; __DSB(); - Abort(); + abort(); return false; } -void TFT_FSMC::Abort() { +void TFT_FSMC::abort() { dma_channel_reg_map *channel_regs = dma_channel_regs(FSMC_DMA_DEV, FSMC_DMA_CHANNEL); dma_disable(FSMC_DMA_DEV, FSMC_DMA_CHANNEL); // Abort DMA transfer if any @@ -241,25 +241,25 @@ void TFT_FSMC::Abort() { channel_regs->CPAR = 0U; } -void TFT_FSMC::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) { +void TFT_FSMC::transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count) { // TODO: HAL STM32 uses DMA2_Channel1 for FSMC on STM32F1 - dma_setup_transfer(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, Data, DMA_SIZE_16BITS, &LCD->RAM, DMA_SIZE_16BITS, DMA_MEM_2_MEM | MemoryIncrease); - dma_set_num_transfers(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, Count); + dma_setup_transfer(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, data, DMA_SIZE_16BITS, &LCD->RAM, DMA_SIZE_16BITS, DMA_MEM_2_MEM | memoryIncrease); + dma_set_num_transfers(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, count); dma_clear_isr_bits(FSMC_DMA_DEV, FSMC_DMA_CHANNEL); dma_enable(FSMC_DMA_DEV, FSMC_DMA_CHANNEL); TERN_(TFT_SHARED_IO, while (isBusy())); } -void TFT_FSMC::Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) { +void TFT_FSMC::transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count) { #if defined(FSMC_DMA_DEV) && defined(FSMC_DMA_CHANNEL) - dma_setup_transfer(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, Data, DMA_SIZE_16BITS, &LCD->RAM, DMA_SIZE_16BITS, DMA_MEM_2_MEM | MemoryIncrease); - dma_set_num_transfers(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, Count); + dma_setup_transfer(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, data, DMA_SIZE_16BITS, &LCD->RAM, DMA_SIZE_16BITS, DMA_MEM_2_MEM | memoryIncrease); + dma_set_num_transfers(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, count); dma_clear_isr_bits(FSMC_DMA_DEV, FSMC_DMA_CHANNEL); dma_enable(FSMC_DMA_DEV, FSMC_DMA_CHANNEL); while ((dma_get_isr_bits(FSMC_DMA_DEV, FSMC_DMA_CHANNEL) & (DMA_CCR_TEIE | DMA_CCR_TCIE)) == 0) {} - Abort(); + abort(); #endif } diff --git a/Marlin/src/HAL/STM32F1/tft/tft_fsmc.h b/Marlin/src/HAL/STM32F1/tft/tft_fsmc.h index 0db7f559b67a7..0e74ce2c2bd66 100644 --- a/Marlin/src/HAL/STM32F1/tft/tft_fsmc.h +++ b/Marlin/src/HAL/STM32F1/tft/tft_fsmc.h @@ -54,31 +54,31 @@ class TFT_FSMC { private: static LCD_CONTROLLER_TypeDef *LCD; - static uint32_t ReadID(uint16_t Reg); - static void Transmit(uint16_t Data); - static void Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count); - static void TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count); + static uint32_t readID(uint16_t reg); + static void transmit(uint16_t data); + static void transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count); + static void transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count); public: - static void Init(); - static uint32_t GetID(); + static void init(); + static uint32_t getID(); static bool isBusy(); - static void Abort(); + static void abort(); - static void DataTransferBegin(uint16_t DataWidth=DATASIZE_16BIT) {}; - static void DataTransferEnd() {}; + static void dataTransferBegin(uint16_t dataWidth=DATASIZE_16BIT) {}; + static void dataTransferEnd() {}; - static void WriteData(uint16_t Data) { Transmit(Data); } - static void WriteReg(uint16_t Reg); + static void writeData(uint16_t data) { transmit(data); } + static void writeReg(uint16_t reg); - static void WriteSequence_DMA(uint16_t *Data, uint16_t Count) { TransmitDMA(DMA_PINC_ENABLE, Data, Count); } - static void WriteMultiple_DMA(uint16_t Color, uint16_t Count) { static uint16_t Data; Data = Color; TransmitDMA(DMA_PINC_DISABLE, &Data, Count); } + static void writeSequence_DMA(uint16_t *data, uint16_t count) { transmitDMA(DMA_PINC_ENABLE, data, count); } + static void writeMultiple_DMA(uint16_t color, uint16_t count) { static uint16_t data; data = color; transmitDMA(DMA_PINC_DISABLE, &data, count); } - static void WriteSequence(uint16_t *Data, uint16_t Count) { Transmit(DMA_PINC_ENABLE, Data, Count); } - static void WriteMultiple(uint16_t Color, uint32_t Count) { - while (Count > 0) { - Transmit(DMA_PINC_DISABLE, &Color, Count > DMA_MAX_SIZE ? DMA_MAX_SIZE : Count); - Count = Count > DMA_MAX_SIZE ? Count - DMA_MAX_SIZE : 0; + static void writeSequence(uint16_t *data, uint16_t count) { transmit(DMA_PINC_ENABLE, data, count); } + static void writeMultiple(uint16_t color, uint32_t count) { + while (count > 0) { + transmit(DMA_PINC_DISABLE, &color, count > DMA_MAX_SIZE ? DMA_MAX_SIZE : count); + count = count > DMA_MAX_SIZE ? count - DMA_MAX_SIZE : 0; } } }; diff --git a/Marlin/src/HAL/STM32F1/tft/tft_spi.cpp b/Marlin/src/HAL/STM32F1/tft/tft_spi.cpp index a68b2b98f8a3c..18d5644437614 100644 --- a/Marlin/src/HAL/STM32F1/tft/tft_spi.cpp +++ b/Marlin/src/HAL/STM32F1/tft/tft_spi.cpp @@ -30,7 +30,7 @@ SPIClass TFT_SPI::SPIx(TFT_SPI_DEVICE); -void TFT_SPI::Init() { +void TFT_SPI::init() { #if PIN_EXISTS(TFT_RESET) OUT_WRITE(TFT_RESET_PIN, HIGH); delay(100); @@ -70,8 +70,8 @@ void TFT_SPI::Init() { SPIx.setDataMode(SPI_MODE0); } -void TFT_SPI::DataTransferBegin(uint16_t DataSize) { - SPIx.setDataSize(DataSize); +void TFT_SPI::dataTransferBegin(uint16_t dataSize) { + SPIx.setDataSize(dataSize); SPIx.begin(); WRITE(TFT_CS_PIN, LOW); } @@ -80,11 +80,11 @@ void TFT_SPI::DataTransferBegin(uint16_t DataSize) { #include "../../../lcd/tft_io/tft_ids.h" #endif -uint32_t TFT_SPI::GetID() { +uint32_t TFT_SPI::getID() { uint32_t id; - id = ReadID(LCD_READ_ID); + id = readID(LCD_READ_ID); if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF) { - id = ReadID(LCD_READ_ID4); + id = readID(LCD_READ_ID4); #ifdef TFT_DEFAULT_DRIVER if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF) id = TFT_DEFAULT_DRIVER; @@ -93,13 +93,13 @@ uint32_t TFT_SPI::GetID() { return id; } -uint32_t TFT_SPI::ReadID(uint16_t Reg) { +uint32_t TFT_SPI::readID(uint16_t reg) { uint32_t data = 0; #if PIN_EXISTS(TFT_MISO) SPIx.setClockDivider(SPI_CLOCK_DIV16); - DataTransferBegin(DATASIZE_8BIT); - WriteReg(Reg); + dataTransferBegin(DATASIZE_8BIT); + writeReg(reg); for (uint8_t i = 0; i < 4; ++i) { uint8_t d; @@ -107,7 +107,7 @@ uint32_t TFT_SPI::ReadID(uint16_t Reg) { data = (data << 8) | d; } - DataTransferEnd(); + dataTransferEnd(); SPIx.setClockDivider(SPI_CLOCK_MAX); #endif @@ -130,11 +130,11 @@ bool TFT_SPI::isBusy() { if (!(SPIdev->regs->SR & SPI_SR_TXE) || (SPIdev->regs->SR & SPI_SR_BSY)) return true; } - Abort(); + abort(); return false; } -void TFT_SPI::Abort() { +void TFT_SPI::abort() { dma_channel_reg_map *channel_regs = dma_channel_regs(DMAx, DMA_CHx); dma_disable(DMAx, DMA_CHx); // Abort DMA transfer if any @@ -146,23 +146,23 @@ void TFT_SPI::Abort() { channel_regs->CMAR = 0U; channel_regs->CPAR = 0U; - DataTransferEnd(); + dataTransferEnd(); } -void TFT_SPI::Transmit(uint16_t Data) { SPIx.send(Data); } +void TFT_SPI::transmit(uint16_t data) { SPIx.send(data); } -void TFT_SPI::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) { - DataTransferBegin(); - SPIx.dmaSendAsync(Data, Count, MemoryIncrease == DMA_MINC_ENABLE); +void TFT_SPI::transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count) { + dataTransferBegin(); + SPIx.dmaSendAsync(data, count, memoryIncrease == DMA_MINC_ENABLE); TERN_(TFT_SHARED_IO, while (isBusy())); } -void TFT_SPI::Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) { +void TFT_SPI::transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count) { WRITE(TFT_DC_PIN, HIGH); - DataTransferBegin(); - SPIx.dmaSend(Data, Count, MemoryIncrease == DMA_MINC_ENABLE); - DataTransferEnd(); + dataTransferBegin(); + SPIx.dmaSend(data, count, memoryIncrease == DMA_MINC_ENABLE); + dataTransferEnd(); } #endif // HAS_SPI_TFT diff --git a/Marlin/src/HAL/STM32F1/tft/tft_spi.h b/Marlin/src/HAL/STM32F1/tft/tft_spi.h index 573077d21d907..d0c2e50486f0d 100644 --- a/Marlin/src/HAL/STM32F1/tft/tft_spi.h +++ b/Marlin/src/HAL/STM32F1/tft/tft_spi.h @@ -63,34 +63,34 @@ class TFT_SPI { private: - static uint32_t ReadID(uint16_t Reg); - static void Transmit(uint16_t Data); - static void Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count); - static void TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count); + static uint32_t readID(uint16_t reg); + static void transmit(uint16_t data); + static void transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count); + static void transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count); public: static SPIClass SPIx; - static void Init(); - static uint32_t GetID(); + static void init(); + static uint32_t getID(); static bool isBusy(); - static void Abort(); + static void abort(); - static void DataTransferBegin(uint16_t DataWidth=DATA_SIZE_16BIT); - static void DataTransferEnd() { WRITE(TFT_CS_PIN, HIGH); SPIx.end(); }; - static void DataTransferAbort(); + static void dataTransferBegin(uint16_t dataWidth=DATA_SIZE_16BIT); + static void dataTransferEnd() { WRITE(TFT_CS_PIN, HIGH); SPIx.end(); }; + static void dataTransferAbort(); - static void WriteData(uint16_t Data) { Transmit(Data); } - static void WriteReg(uint16_t Reg) { WRITE(TFT_DC_PIN, LOW); Transmit(Reg); WRITE(TFT_DC_PIN, HIGH); } + static void writeData(uint16_t data) { transmit(data); } + static void writeReg(uint16_t reg) { WRITE(TFT_DC_PIN, LOW); transmit(reg); WRITE(TFT_DC_PIN, HIGH); } - static void WriteSequence_DMA(uint16_t *Data, uint16_t Count) { TransmitDMA(DMA_MINC_ENABLE, Data, Count); } - static void WriteMultiple_DMA(uint16_t Color, uint16_t Count) { static uint16_t Data; Data = Color; TransmitDMA(DMA_MINC_DISABLE, &Data, Count); } + static void writeSequence_DMA(uint16_t *data, uint16_t count) { transmitDMA(DMA_MINC_ENABLE, data, count); } + static void writeMultiple_DMA(uint16_t color, uint16_t count) { static uint16_t data; data = color; transmitDMA(DMA_MINC_DISABLE, &data, count); } - static void WriteSequence(uint16_t *Data, uint16_t Count) { Transmit(DMA_MINC_ENABLE, Data, Count); } - static void WriteMultiple(uint16_t Color, uint32_t Count) { - while (Count > 0) { - Transmit(DMA_MINC_DISABLE, &Color, Count > DMA_MAX_SIZE ? DMA_MAX_SIZE : Count); - Count = Count > DMA_MAX_SIZE ? Count - DMA_MAX_SIZE : 0; + static void writeSequence(uint16_t *data, uint16_t count) { transmit(DMA_MINC_ENABLE, data, count); } + static void writeMultiple(uint16_t color, uint32_t count) { + while (count > 0) { + transmit(DMA_MINC_DISABLE, &color, count > DMA_MAX_SIZE ? DMA_MAX_SIZE : count); + count = count > DMA_MAX_SIZE ? count - DMA_MAX_SIZE : 0; } } }; diff --git a/Marlin/src/HAL/STM32F1/tft/xpt2046.cpp b/Marlin/src/HAL/STM32F1/tft/xpt2046.cpp index bf57ba0034b15..845a57a8147b8 100644 --- a/Marlin/src/HAL/STM32F1/tft/xpt2046.cpp +++ b/Marlin/src/HAL/STM32F1/tft/xpt2046.cpp @@ -59,7 +59,7 @@ uint16_t delta(uint16_t a, uint16_t b) { return a > b ? a - b : b - a; } } #endif // TOUCH_BUTTONS_HW_SPI -void XPT2046::Init() { +void XPT2046::init() { SET_INPUT(TOUCH_MISO_PIN); SET_OUTPUT(TOUCH_MOSI_PIN); SET_OUTPUT(TOUCH_SCK_PIN); @@ -97,7 +97,7 @@ bool XPT2046::getRawPoint(int16_t *x, int16_t *y) { uint16_t XPT2046::getRawData(const XPTCoordinate coordinate) { uint16_t data[3]; - DataTransferBegin(); + dataTransferBegin(); TERN_(TOUCH_BUTTONS_HW_SPI, SPIx.begin()); for (uint16_t i = 0; i < 3 ; i++) { @@ -106,7 +106,7 @@ uint16_t XPT2046::getRawData(const XPTCoordinate coordinate) { } TERN_(TOUCH_BUTTONS_HW_SPI, SPIx.end()); - DataTransferEnd(); + dataTransferEnd(); uint16_t delta01 = delta(data[0], data[1]), delta02 = delta(data[0], data[2]), @@ -119,17 +119,17 @@ uint16_t XPT2046::getRawData(const XPTCoordinate coordinate) { } uint16_t XPT2046::IO(uint16_t data) { - return TERN(TOUCH_BUTTONS_HW_SPI, HardwareIO, SoftwareIO)(data); + return TERN(TOUCH_BUTTONS_HW_SPI, hardwareIO, softwareIO)(data); } #if ENABLED(TOUCH_BUTTONS_HW_SPI) - uint16_t XPT2046::HardwareIO(uint16_t data) { + uint16_t XPT2046::hardwareIO(uint16_t data) { uint16_t result = SPIx.transfer(data); return result; } #endif -uint16_t XPT2046::SoftwareIO(uint16_t data) { +uint16_t XPT2046::softwareIO(uint16_t data) { uint16_t result = 0; for (uint8_t j = 0x80; j; j >>= 1) { diff --git a/Marlin/src/HAL/STM32F1/tft/xpt2046.h b/Marlin/src/HAL/STM32F1/tft/xpt2046.h index 7c456cf00e1be..8fdcacf926419 100644 --- a/Marlin/src/HAL/STM32F1/tft/xpt2046.h +++ b/Marlin/src/HAL/STM32F1/tft/xpt2046.h @@ -65,12 +65,12 @@ class XPT2046 { static uint16_t getRawData(const XPTCoordinate coordinate); static bool isTouched(); - static void DataTransferBegin() { WRITE(TOUCH_CS_PIN, LOW); }; - static void DataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); }; + static void dataTransferBegin() { WRITE(TOUCH_CS_PIN, LOW); }; + static void dataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); }; #if ENABLED(TOUCH_BUTTONS_HW_SPI) - static uint16_t HardwareIO(uint16_t data); + static uint16_t hardwareIO(uint16_t data); #endif - static uint16_t SoftwareIO(uint16_t data); + static uint16_t softwareIO(uint16_t data); static uint16_t IO(uint16_t data = 0); public: @@ -78,6 +78,6 @@ class XPT2046 { static SPIClass SPIx; #endif - static void Init(); + static void init(); static bool getRawPoint(int16_t *x, int16_t *y); }; diff --git a/Marlin/src/HAL/shared/Delay.cpp b/Marlin/src/HAL/shared/Delay.cpp index c64376d25d9ab..31c3f45765394 100644 --- a/Marlin/src/HAL/shared/Delay.cpp +++ b/Marlin/src/HAL/shared/Delay.cpp @@ -109,13 +109,7 @@ #if ENABLED(MARLIN_DEV_MODE) void dump_delay_accuracy_check() { auto report_call_time = [](FSTR_P const name, FSTR_P const unit, const uint32_t cycles, const uint32_t total, const bool do_flush=true) { - SERIAL_ECHOPGM("Calling "); - SERIAL_ECHOF(name); - SERIAL_ECHOLNPGM(" for ", cycles); - SERIAL_ECHOF(unit); - SERIAL_ECHOLNPGM(" took: ", total); - SERIAL_CHAR(' '); - SERIAL_ECHOF(unit); + SERIAL_ECHOLN(F("Calling "), name, F(" for "), cycles, AS_CHAR(' '), unit, F(" took: "), total, AS_CHAR(' '), unit); if (do_flush) SERIAL_FLUSHTX(); }; diff --git a/Marlin/src/HAL/shared/backtrace/unwmemaccess.cpp b/Marlin/src/HAL/shared/backtrace/unwmemaccess.cpp index a4151b38c20e2..da1cff4fcc885 100644 --- a/Marlin/src/HAL/shared/backtrace/unwmemaccess.cpp +++ b/Marlin/src/HAL/shared/backtrace/unwmemaccess.cpp @@ -135,7 +135,7 @@ // Generic ARM code, that's testing if an access to the given address would cause a fault or not // It can't guarantee an address is in RAM or Flash only, but we usually don't care - #define NVIC_FAULT_STAT 0xE000ED28 // Configurable Fault Status Reg. + #define NVIC_FAULT_STAT 0xE000ED28 // Configurable Fault Status reg. #define NVIC_CFG_CTRL 0xE000ED14 // Configuration Control Register #define NVIC_FAULT_STAT_BFARV 0x00008000 // BFAR is valid #define NVIC_CFG_CTRL_BFHFNMIGN 0x00000100 // Ignore bus fault in NMI/fault diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index ac5a6b7ff9b02..e183a04359892 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -819,7 +819,7 @@ void idle(const bool no_stepper_sleep/*=false*/) { TERN_(HAS_BEEPER, buzzer.tick()); // Handle UI input / draw events - TERN(DWIN_CREALITY_LCD, DWIN_Update(), ui.update()); + TERN(DWIN_CREALITY_LCD, dwinUpdate(), ui.update()); // Run i2c Position Encoders #if ENABLED(I2C_POSITION_ENCODERS) @@ -882,7 +882,7 @@ void kill(FSTR_P const lcd_error/*=nullptr*/, FSTR_P const lcd_component/*=nullp TERN_(HAS_CUTTER, cutter.kill()); // Full cutter shutdown including ISR control // Echo the LCD message to serial for extra context - if (lcd_error) { SERIAL_ECHO_START(); SERIAL_ECHOLNF(lcd_error); } + if (lcd_error) { SERIAL_ECHO_START(); SERIAL_ECHOLN(lcd_error); } #if HAS_DISPLAY ui.kill_screen(lcd_error ?: GET_TEXT_F(MSG_KILLED), lcd_component ?: FPSTR(NUL_STR)); @@ -1583,7 +1583,7 @@ void setup() { #endif #if HAS_DWIN_E3V2_BASIC - SETUP_RUN(DWIN_InitScreen()); + SETUP_RUN(dwinInitScreen()); #endif #if HAS_SERVICE_INTERVALS && !HAS_DWIN_E3V2_BASIC diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 742cf8f236fcb..12e72517a3d04 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -54,6 +54,12 @@ #define BOARD_RAMPS_PLUS_EEF 1033 // RAMPS Plus 3DYMY (Power outputs: Hotend0, Hotend1, Fan) #define BOARD_RAMPS_PLUS_SF 1034 // RAMPS Plus 3DYMY (Power outputs: Spindle, Controller Fan) +#define BOARD_RAMPS_BTT_16_PLUS_EFB 1035 // RAMPS 1.6+ (Power outputs: Hotend, Fan, Bed) +#define BOARD_RAMPS_BTT_16_PLUS_EEB 1036 // RAMPS 1.6+ (Power outputs: Hotend0, Hotend1, Bed) +#define BOARD_RAMPS_BTT_16_PLUS_EFF 1037 // RAMPS 1.6+ (Power outputs: Hotend, Fan0, Fan1) +#define BOARD_RAMPS_BTT_16_PLUS_EEF 1038 // RAMPS 1.6+ (Power outputs: Hotend0, Hotend1, Fan) +#define BOARD_RAMPS_BTT_16_PLUS_SF 1039 // RAMPS 1.6+ (Power outputs: Spindle, Controller Fan) + // // RAMPS Derivatives - ATmega1280, ATmega2560 // @@ -425,34 +431,33 @@ #define BOARD_LERDGE_K 5218 // Lerdge K (STM32F407ZG) #define BOARD_LERDGE_S 5219 // Lerdge S (STM32F407VE) #define BOARD_LERDGE_X 5220 // Lerdge X (STM32F407VE) -#define BOARD_VAKE403D 5221 // VAkE 403D (STM32F446VE) -#define BOARD_FYSETC_S6 5222 // FYSETC S6 (STM32F446VE) -#define BOARD_FYSETC_S6_V2_0 5223 // FYSETC S6 v2.0 (STM32F446VE) -#define BOARD_FYSETC_SPIDER 5224 // FYSETC Spider (STM32F446VE) -#define BOARD_FLYF407ZG 5225 // FLYmaker FLYF407ZG (STM32F407ZG) -#define BOARD_MKS_ROBIN2 5226 // MKS Robin2 V1.0 (STM32F407ZE) -#define BOARD_MKS_ROBIN_PRO_V2 5227 // MKS Robin Pro V2 (STM32F407VE) -#define BOARD_MKS_ROBIN_NANO_V3 5228 // MKS Robin Nano V3 (STM32F407VG) -#define BOARD_MKS_ROBIN_NANO_V3_1 5229 // MKS Robin Nano V3.1 (STM32F407VE) -#define BOARD_MKS_MONSTER8_V1 5230 // MKS Monster8 V1 (STM32F407VE) -#define BOARD_MKS_MONSTER8_V2 5231 // MKS Monster8 V2 (STM32F407VE) -#define BOARD_ANET_ET4 5232 // ANET ET4 V1.x (STM32F407VG) -#define BOARD_ANET_ET4P 5233 // ANET ET4P V1.x (STM32F407VG) -#define BOARD_FYSETC_CHEETAH_V20 5234 // FYSETC Cheetah V2.0 (STM32F401RC) -#define BOARD_TH3D_EZBOARD_V2 5235 // TH3D EZBoard v2.0 (STM32F405RG) -#define BOARD_OPULO_LUMEN_REV3 5236 // Opulo Lumen PnP Controller REV3 (STM32F407VE / STM32F407VG) -#define BOARD_MKS_ROBIN_NANO_V1_3_F4 5237 // MKS Robin Nano V1.3 and MKS Robin Nano-S V1.3 (STM32F407VE) -#define BOARD_MKS_EAGLE 5238 // MKS Eagle (STM32F407VE) -#define BOARD_ARTILLERY_RUBY 5239 // Artillery Ruby (STM32F401RC) -#define BOARD_FYSETC_SPIDER_V2_2 5240 // FYSETC Spider V2.2 (STM32F446VE) -#define BOARD_CREALITY_V24S1_301F4 5241 // Creality v2.4.S1_301F4 (STM32F401RC) as found in the Ender-3 S1 F4 -#define BOARD_OPULO_LUMEN_REV4 5242 // Opulo Lumen PnP Controller REV4 (STM32F407VE / STM32F407VG) -#define BOARD_FYSETC_SPIDER_KING407 5243 // FYSETC Spider King407 (STM32F407ZG) -#define BOARD_MKS_SKIPR_V1 5244 // MKS SKIPR v1.0 all-in-one board (STM32F407VE) -#define BOARD_TRONXY_V10 5245 // TRONXY V10 (STM32F446ZE) -#define BOARD_CREALITY_F401RE 5246 // Creality CR4NS200141C13 (STM32F401RE) as found in the Ender-5 S1 -#define BOARD_BLACKPILL_CUSTOM 5247 // Custom board based on STM32F401CDU6. -#define BOARD_I3DBEEZ9_V1 5248 // I3DBEEZ9 V1 (STM32F407ZG) +#define BOARD_FYSETC_S6 5221 // FYSETC S6 (STM32F446VE) +#define BOARD_FYSETC_S6_V2_0 5222 // FYSETC S6 v2.0 (STM32F446VE) +#define BOARD_FYSETC_SPIDER 5223 // FYSETC Spider (STM32F446VE) +#define BOARD_FLYF407ZG 5224 // FLYmaker FLYF407ZG (STM32F407ZG) +#define BOARD_MKS_ROBIN2 5225 // MKS Robin2 V1.0 (STM32F407ZE) +#define BOARD_MKS_ROBIN_PRO_V2 5226 // MKS Robin Pro V2 (STM32F407VE) +#define BOARD_MKS_ROBIN_NANO_V3 5227 // MKS Robin Nano V3 (STM32F407VG) +#define BOARD_MKS_ROBIN_NANO_V3_1 5228 // MKS Robin Nano V3.1 (STM32F407VE) +#define BOARD_MKS_MONSTER8_V1 5229 // MKS Monster8 V1 (STM32F407VE) +#define BOARD_MKS_MONSTER8_V2 5230 // MKS Monster8 V2 (STM32F407VE) +#define BOARD_ANET_ET4 5231 // ANET ET4 V1.x (STM32F407VG) +#define BOARD_ANET_ET4P 5232 // ANET ET4P V1.x (STM32F407VG) +#define BOARD_FYSETC_CHEETAH_V20 5233 // FYSETC Cheetah V2.0 (STM32F401RC) +#define BOARD_TH3D_EZBOARD_V2 5234 // TH3D EZBoard v2.0 (STM32F405RG) +#define BOARD_OPULO_LUMEN_REV3 5235 // Opulo Lumen PnP Controller REV3 (STM32F407VE / STM32F407VG) +#define BOARD_MKS_ROBIN_NANO_V1_3_F4 5236 // MKS Robin Nano V1.3 and MKS Robin Nano-S V1.3 (STM32F407VE) +#define BOARD_MKS_EAGLE 5237 // MKS Eagle (STM32F407VE) +#define BOARD_ARTILLERY_RUBY 5238 // Artillery Ruby (STM32F401RC) +#define BOARD_FYSETC_SPIDER_V2_2 5239 // FYSETC Spider V2.2 (STM32F446VE) +#define BOARD_CREALITY_V24S1_301F4 5240 // Creality v2.4.S1_301F4 (STM32F401RC) as found in the Ender-3 S1 F4 +#define BOARD_OPULO_LUMEN_REV4 5241 // Opulo Lumen PnP Controller REV4 (STM32F407VE / STM32F407VG) +#define BOARD_FYSETC_SPIDER_KING407 5242 // FYSETC Spider King407 (STM32F407ZG) +#define BOARD_MKS_SKIPR_V1 5243 // MKS SKIPR v1.0 all-in-one board (STM32F407VE) +#define BOARD_TRONXY_V10 5244 // TRONXY V10 (STM32F446ZE) +#define BOARD_CREALITY_F401RE 5245 // Creality CR4NS200141C13 (STM32F401RE) as found in the Ender-5 S1 +#define BOARD_BLACKPILL_CUSTOM 5246 // Custom board based on STM32F401CDU6. +#define BOARD_I3DBEEZ9_V1 5247 // I3DBEEZ9 V1 (STM32F407ZG) // // ARM Cortex-M7 @@ -466,7 +471,7 @@ #define BOARD_BTT_SKR_SE_BX_V3 6005 // BigTreeTech SKR SE BX V3.0 (STM32H743II) #define BOARD_BTT_SKR_V3_0 6006 // BigTreeTech SKR V3.0 (STM32H743VG) #define BOARD_BTT_SKR_V3_0_EZ 6007 // BigTreeTech SKR V3.0 EZ (STM32H743VG) -#define BOARD_BTT_OCTOPUS_MAX_EZ_V1_0 6008 // BigTreeTech Octopus Max EZ V1.0 (STM32H723VE / STM32H723ZE) +#define BOARD_BTT_OCTOPUS_MAX_EZ_V1_0 6008 // BigTreeTech Octopus Max EZ V1.0 (STM32H723ZE) // // Espressif ESP32 WiFi diff --git a/Marlin/src/core/debug_out.h b/Marlin/src/core/debug_out.h index eb1c91e507865..92ee233e03582 100644 --- a/Marlin/src/core/debug_out.h +++ b/Marlin/src/core/debug_out.h @@ -31,19 +31,11 @@ #undef DEBUG_ERROR_START #undef DEBUG_CHAR #undef DEBUG_ECHO -#undef DEBUG_DECIMAL -#undef DEBUG_ECHO_F #undef DEBUG_ECHOLN #undef DEBUG_ECHOPGM #undef DEBUG_ECHOLNPGM -#undef DEBUG_ECHOF -#undef DEBUG_ECHOLNF #undef DEBUG_ECHOPGM_P #undef DEBUG_ECHOLNPGM_P -#undef DEBUG_ECHOPAIR_F -#undef DEBUG_ECHOPAIR_F_P -#undef DEBUG_ECHOLNPAIR_F -#undef DEBUG_ECHOLNPAIR_F_P #undef DEBUG_ECHO_MSG #undef DEBUG_ERROR_MSG #undef DEBUG_EOL @@ -62,21 +54,13 @@ #define DEBUG_ERROR_START SERIAL_ERROR_START #define DEBUG_CHAR SERIAL_CHAR #define DEBUG_ECHO SERIAL_ECHO - #define DEBUG_DECIMAL SERIAL_DECIMAL - #define DEBUG_ECHO_F SERIAL_ECHO_F #define DEBUG_ECHOLN SERIAL_ECHOLN #define DEBUG_ECHOPGM SERIAL_ECHOPGM #define DEBUG_ECHOLNPGM SERIAL_ECHOLNPGM - #define DEBUG_ECHOF SERIAL_ECHOF - #define DEBUG_ECHOLNF SERIAL_ECHOLNF #define DEBUG_ECHOPGM SERIAL_ECHOPGM #define DEBUG_ECHOPGM_P SERIAL_ECHOPGM_P - #define DEBUG_ECHOPAIR_F SERIAL_ECHOPAIR_F - #define DEBUG_ECHOPAIR_F_P SERIAL_ECHOPAIR_F_P #define DEBUG_ECHOLNPGM SERIAL_ECHOLNPGM #define DEBUG_ECHOLNPGM_P SERIAL_ECHOLNPGM_P - #define DEBUG_ECHOLNPAIR_F SERIAL_ECHOLNPAIR_F - #define DEBUG_ECHOLNPAIR_F_P SERIAL_ECHOLNPAIR_F_P #define DEBUG_ECHO_MSG SERIAL_ECHO_MSG #define DEBUG_ERROR_MSG SERIAL_ERROR_MSG #define DEBUG_EOL SERIAL_EOL @@ -93,19 +77,11 @@ #define DEBUG_ERROR_START() NOOP #define DEBUG_CHAR(...) NOOP #define DEBUG_ECHO(...) NOOP - #define DEBUG_DECIMAL(...) NOOP - #define DEBUG_ECHO_F(...) NOOP #define DEBUG_ECHOLN(...) NOOP #define DEBUG_ECHOPGM(...) NOOP #define DEBUG_ECHOLNPGM(...) NOOP - #define DEBUG_ECHOF(...) NOOP - #define DEBUG_ECHOLNF(...) NOOP #define DEBUG_ECHOPGM_P(...) NOOP #define DEBUG_ECHOLNPGM_P(...) NOOP - #define DEBUG_ECHOPAIR_F(...) NOOP - #define DEBUG_ECHOPAIR_F_P(...) NOOP - #define DEBUG_ECHOLNPAIR_F(...) NOOP - #define DEBUG_ECHOLNPAIR_F_P(...) NOOP #define DEBUG_ECHO_MSG(...) NOOP #define DEBUG_ERROR_MSG(...) NOOP #define DEBUG_EOL() NOOP diff --git a/Marlin/src/core/debug_section.h b/Marlin/src/core/debug_section.h index 6e23d9e4edb6c..dc4cc0143c3ee 100644 --- a/Marlin/src/core/debug_section.h +++ b/Marlin/src/core/debug_section.h @@ -38,11 +38,8 @@ class SectionLog { bool debug; void echo_msg(FSTR_P const fpre) { - SERIAL_ECHOF(fpre); - if (the_msg) { - SERIAL_CHAR(' '); - SERIAL_ECHOF(the_msg); - } + SERIAL_ECHO(fpre); + if (the_msg) SERIAL_ECHO(AS_CHAR(' '), the_msg); SERIAL_CHAR(' '); print_pos(current_position); } diff --git a/Marlin/src/core/serial.cpp b/Marlin/src/core/serial.cpp index 8f3a59c81408a..bda1527545ddd 100644 --- a/Marlin/src/core/serial.cpp +++ b/Marlin/src/core/serial.cpp @@ -68,26 +68,51 @@ MAP(_N_LBL, LOGICAL_AXIS_NAMES); MAP(_SP_N_LBL, LOGICAL_AXIS_NAMES); #endif -void serial_print_P(PGM_P str) { - while (const char c = pgm_read_byte(str++)) SERIAL_CHAR(c); +// Specializations for float, p_float_t, w_float_t +template <> void SERIAL_ECHO(const float f) { SERIAL_IMPL.print(f); } +template <> void SERIAL_ECHO(const p_float_t pf) { SERIAL_IMPL.print(pf.value, pf.prec); } +template <> void SERIAL_ECHO(const w_float_t wf) { char f1[20]; SERIAL_IMPL.print(dtostrf(wf.value, wf.width, wf.prec, f1)); } + +// Specializations for F-string +template <> void SERIAL_ECHO(const FSTR_P fstr) { SERIAL_ECHO_P(FTOP(fstr)); } +template <> void SERIAL_ECHOLN(const FSTR_P fstr) { SERIAL_ECHOLN_P(FTOP(fstr)); } + +void SERIAL_CHAR(char a) { SERIAL_IMPL.write(a); } +void SERIAL_EOL() { SERIAL_CHAR('\n'); } + +void SERIAL_ECHO(serial_char_t x) { SERIAL_IMPL.write(x.c); } + +void SERIAL_FLUSH() { SERIAL_IMPL.flush(); } +void SERIAL_FLUSHTX() { SERIAL_IMPL.flushTX(); } + +void SERIAL_ECHO_P(PGM_P pstr) { + while (const char c = pgm_read_byte(pstr++)) SERIAL_CHAR(c); } +void SERIAL_ECHOLN_P(PGM_P pstr) { SERIAL_ECHO_P(pstr); SERIAL_EOL(); } -void serial_echo_start() { serial_print(F("echo:")); } -void serial_error_start() { serial_print(F("Error:")); } +void SERIAL_ECHO_START() { SERIAL_ECHO(F("echo:")); } +void SERIAL_ERROR_START() { SERIAL_ECHO(F("Error:")); } -void serial_spaces(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR(' '); } +void SERIAL_ECHO_SP(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR(' '); } void serial_offset(const_float_t v, const uint8_t sp/*=0*/) { if (v == 0 && sp == 1) SERIAL_CHAR(' '); else if (v > 0 || (v == 0 && sp == 2)) SERIAL_CHAR('+'); - SERIAL_DECIMAL(v); + SERIAL_ECHO(v); +} + +void serial_ternary(FSTR_P const pre, const bool onoff, FSTR_P const on, FSTR_P const off, FSTR_P const post/*=nullptr*/) { + if (pre) SERIAL_ECHO(pre); + if (onoff && on) SERIAL_ECHO(on); + if (!onoff && off) SERIAL_ECHO(off); + if (post) SERIAL_ECHO(post); } -void serialprint_onoff(const bool onoff) { serial_print(onoff ? F(STR_ON) : F(STR_OFF)); } +void serialprint_onoff(const bool onoff) { SERIAL_ECHO(onoff ? F(STR_ON) : F(STR_OFF)); } void serialprintln_onoff(const bool onoff) { serialprint_onoff(onoff); SERIAL_EOL(); } -void serialprint_truefalse(const bool tf) { serial_print(tf ? F("true") : F("false")); } +void serialprint_truefalse(const bool tf) { SERIAL_ECHO(tf ? F("true") : F("false")); } void print_bin(uint16_t val) { for (uint8_t i = 16; i--;) { @@ -97,11 +122,11 @@ void print_bin(uint16_t val) { } void print_pos(NUM_AXIS_ARGS_(const_float_t) FSTR_P const prefix/*=nullptr*/, FSTR_P const suffix/*=nullptr*/) { - if (prefix) serial_print(prefix); + if (prefix) SERIAL_ECHO(prefix); #if NUM_AXES SERIAL_ECHOPGM_P( LIST_N(DOUBLE(NUM_AXES), SP_X_STR, x, SP_Y_STR, y, SP_Z_STR, z, SP_I_STR, i, SP_J_STR, j, SP_K_STR, k, SP_U_STR, u, SP_V_STR, v, SP_W_STR, w) ); #endif - if (suffix) serial_print(suffix); else SERIAL_EOL(); + if (suffix) SERIAL_ECHO(suffix); else SERIAL_EOL(); } diff --git a/Marlin/src/core/serial.h b/Marlin/src/core/serial.h index 62e1294e04686..09f453d3b5a82 100644 --- a/Marlin/src/core/serial.h +++ b/Marlin/src/core/serial.h @@ -125,8 +125,6 @@ extern uint8_t marlin_debug_flags; #define SERIAL_IMPL SERIAL_LEAF_1 #endif -#define SERIAL_OUT(WHAT, V...) (void)SERIAL_IMPL.WHAT(V) - #define PORT_REDIRECT(p) _PORT_REDIRECT(1,p) #define PORT_RESTORE() _PORT_RESTORE(1) #define SERIAL_PORTMASK(P) SerialMask::from(P) @@ -134,65 +132,69 @@ extern uint8_t marlin_debug_flags; // // SERIAL_CHAR - Print one or more individual chars // -inline void SERIAL_CHAR(char a) { SERIAL_IMPL.write(a); } +void SERIAL_CHAR(char a); template void SERIAL_CHAR(char a, Args ... args) { SERIAL_IMPL.write(a); SERIAL_CHAR(args ...); } /** - * SERIAL_ECHO - Print a single string or value. + * SERIAL_ECHO / SERIAL_ECHOLN - Print a single string or value. * Any numeric parameter (including char) is printed as a base-10 number. * A string pointer or literal will be output as a string. * * NOTE: Use SERIAL_CHAR to print char as a single character. */ -template -void SERIAL_ECHO(T x) { SERIAL_IMPL.print(x); } +template void SERIAL_ECHO(T x) { SERIAL_IMPL.print(x); } +template void SERIAL_ECHOLN(T x) { SERIAL_IMPL.println(x); } // Wrapper for ECHO commands to interpret a char -typedef struct SerialChar { char c; SerialChar(char n) : c(n) { } } serial_char_t; -inline void SERIAL_ECHO(serial_char_t x) { SERIAL_IMPL.write(x.c); } -#define AS_CHAR(C) serial_char_t(C) +void SERIAL_ECHO(serial_char_t x); #define AS_DIGIT(C) AS_CHAR('0' + (C)) -template -void SERIAL_ECHOLN(T x) { SERIAL_IMPL.println(x); } - -// SERIAL_PRINT works like SERIAL_ECHO but also takes the numeric base -template -void SERIAL_PRINT(T x, U y) { SERIAL_IMPL.print(x, y); } - -template -void SERIAL_PRINTLN(T x, PrintBase y) { SERIAL_IMPL.println(x, y); } +// Print an integer with a numeric base such as PrintBase::Hex +template void SERIAL_PRINT(T x, PrintBase y) { SERIAL_IMPL.print(x, y); } +template void SERIAL_PRINTLN(T x, PrintBase y) { SERIAL_IMPL.println(x, y); } // Flush the serial port -inline void SERIAL_FLUSH() { SERIAL_IMPL.flush(); } -inline void SERIAL_FLUSHTX() { SERIAL_IMPL.flushTX(); } +void SERIAL_FLUSH(); +void SERIAL_FLUSHTX(); -// Serial echo and error prefixes -#define SERIAL_ECHO_START() serial_echo_start() -#define SERIAL_ERROR_START() serial_error_start() +// Start an echo: or error: output +void SERIAL_ECHO_START(); +void SERIAL_ERROR_START(); // Serial end-of-line -#define SERIAL_EOL() SERIAL_CHAR('\n') +void SERIAL_EOL(); // Print a single PROGMEM, PGM_P, or PSTR() string. -void serial_print_P(PGM_P str); -inline void serial_println_P(PGM_P str) { serial_print_P(str); SERIAL_EOL(); } +void SERIAL_ECHO_P(PGM_P pstr); +void SERIAL_ECHOLN_P(PGM_P pstr); + +// Specializations for float, p_float_t, and w_float_t +template<> void SERIAL_ECHO(const float f); +template<> void SERIAL_ECHO(const p_float_t pf); +template<> void SERIAL_ECHO(const w_float_t wf); + +// Specializations for F-string +template<> void SERIAL_ECHO(const FSTR_P fstr); +template<> void SERIAL_ECHOLN(const FSTR_P fstr); -// Print a single FSTR_P, F(), or FPSTR() string. -inline void serial_print(FSTR_P const fstr) { serial_print_P(FTOP(fstr)); } -inline void serial_println(FSTR_P const fstr) { serial_println_P(FTOP(fstr)); } +// Print any number of items with arbitrary types (except loose PROGMEM strings) +template +void SERIAL_ECHO(T arg1, Args ... args) { SERIAL_ECHO(arg1); SERIAL_ECHO(args ...); } +template +void SERIAL_ECHOLN(T arg1, Args ... args) { SERIAL_ECHO(arg1); SERIAL_ECHO(args ...); SERIAL_EOL(); } // -// SERIAL_ECHOPGM... macros are used to output string-value pairs. +// SERIAL_ECHOPGM... macros are used to output string-value pairs, wrapping +// all the odd loose string elements as PROGMEM strings. // // Print up to 20 pairs of values. Odd elements must be literal strings. #define __SEP_N(N,V...) _SEP_##N(V) #define _SEP_N(N,V...) __SEP_N(N,V) #define _SEP_N_REF() _SEP_N -#define _SEP_1(s) serial_print(F(s)); -#define _SEP_2(s,v) serial_echopair(F(s),v); +#define _SEP_1(s) SERIAL_ECHO(F(s)); +#define _SEP_2(s,v) SERIAL_ECHO(F(s),v); #define _SEP_3(s,v,V...) _SEP_2(s,v); DEFER2(_SEP_N_REF)()(TWO_ARGS(V),V); #define SERIAL_ECHOPGM(V...) do{ EVAL(_SEP_N(TWO_ARGS(V),V)); }while(0) @@ -200,8 +202,8 @@ inline void serial_println(FSTR_P const fstr) { serial_println_P(FTOP(fstr)); } #define __SELP_N(N,V...) _SELP_##N(V) #define _SELP_N(N,V...) __SELP_N(N,V) #define _SELP_N_REF() _SELP_N -#define _SELP_1(s) serial_print(F(s "\n")); -#define _SELP_2(s,v) serial_echolnpair(F(s),v); +#define _SELP_1(s) SERIAL_ECHO(F(s "\n")); +#define _SELP_2(s,v) SERIAL_ECHOLN(F(s),v); #define _SELP_3(s,v,V...) _SEP_2(s,v); DEFER2(_SELP_N_REF)()(TWO_ARGS(V),V); #define SERIAL_ECHOLNPGM(V...) do{ EVAL(_SELP_N(TWO_ARGS(V),V)); }while(0) @@ -209,8 +211,8 @@ inline void serial_println(FSTR_P const fstr) { serial_println_P(FTOP(fstr)); } #define __SEP_N_P(N,V...) _SEP_##N##_P(V) #define _SEP_N_P(N,V...) __SEP_N_P(N,V) #define _SEP_N_P_REF() _SEP_N_P -#define _SEP_1_P(p) serial_print_P(p); -#define _SEP_2_P(p,v) serial_echopair_P(p,v); +#define _SEP_1_P(p) SERIAL_ECHO(FPSTR(p)); +#define _SEP_2_P(p,v) SERIAL_ECHO(FPSTR(p),v); #define _SEP_3_P(p,v,V...) _SEP_2_P(p,v); DEFER2(_SEP_N_P_REF)()(TWO_ARGS(V),V); #define SERIAL_ECHOPGM_P(V...) do{ EVAL(_SEP_N_P(TWO_ARGS(V),V)); }while(0) @@ -218,125 +220,25 @@ inline void serial_println(FSTR_P const fstr) { serial_println_P(FTOP(fstr)); } #define __SELP_N_P(N,V...) _SELP_##N##_P(V) #define _SELP_N_P(N,V...) __SELP_N_P(N,V) #define _SELP_N_P_REF() _SELP_N_P -#define _SELP_1_P(p) serial_println_P(p) -#define _SELP_2_P(p,v) serial_echolnpair_P(p,v) +#define _SELP_1_P(p) SERIAL_ECHOLN(FPSTR(p)); +#define _SELP_2_P(p,v) SERIAL_ECHOLN(FPSTR(p),v); #define _SELP_3_P(p,v,V...) { _SEP_2_P(p,v); DEFER2(_SELP_N_P_REF)()(TWO_ARGS(V),V); } #define SERIAL_ECHOLNPGM_P(V...) do{ EVAL(_SELP_N_P(TWO_ARGS(V),V)); }while(0) -// Print up to 20 pairs of values. Odd elements must be FSTR_P, F(), or FPSTR(). -#define __SEP_N_F(N,V...) _SEP_##N##_F(V) -#define _SEP_N_F(N,V...) __SEP_N_F(N,V) -#define _SEP_N_F_REF() _SEP_N_F -#define _SEP_1_F(p) serial_print(p); -#define _SEP_2_F(p,v) serial_echopair(p,v); -#define _SEP_3_F(p,v,V...) _SEP_2_F(p,v); DEFER2(_SEP_N_F_REF)()(TWO_ARGS(V),V); -#define SERIAL_ECHOF(V...) do{ EVAL(_SEP_N_F(TWO_ARGS(V),V)); }while(0) - -// Print up to 20 pairs of values followed by newline. Odd elements must be FSTR_P, F(), or FPSTR(). -#define __SELP_N_F(N,V...) _SELP_##N##_F(V) -#define _SELP_N_F(N,V...) __SELP_N_F(N,V) -#define _SELP_N_F_REF() _SELP_N_F -#define _SELP_1_F(p) serial_println(p) -#define _SELP_2_F(p,v) serial_echolnpair(p,v) -#define _SELP_3_F(p,v,V...) { _SEP_2_F(p,v); DEFER2(_SELP_N_F_REF)()(TWO_ARGS(V),V); } -#define SERIAL_ECHOLNF(V...) do{ EVAL(_SELP_N_F(TWO_ARGS(V),V)); }while(0) - -#ifdef AllowDifferentTypeInList - - inline void SERIAL_ECHOLIST_IMPL() {} - template - void SERIAL_ECHOLIST_IMPL(T && t) { SERIAL_IMPL.print(t); } - - template - void SERIAL_ECHOLIST_IMPL(T && t, Args && ... args) { - SERIAL_IMPL.print(t); - serial_print(F(", ")); - SERIAL_ECHOLIST_IMPL(args...); - } - - template - void SERIAL_ECHOLIST(FSTR_P const str, Args && ... args) { - SERIAL_IMPL.print(FTOP(str)); - SERIAL_ECHOLIST_IMPL(args...); - } - -#else // Optimization if the listed type are all the same (seems to be the case in the codebase so use that instead) - - template - void SERIAL_ECHOLIST(FSTR_P const fstr, Args && ... args) { - serial_print(fstr); - typename Private::first_type_of::type values[] = { args... }; - constexpr size_t argsSize = sizeof...(args); - for (size_t i = 0; i < argsSize; i++) { - if (i) serial_print(F(", ")); - SERIAL_IMPL.print(values[i]); - } - } - -#endif - -// SERIAL_ECHO_F prints a floating point value with optional precision -inline void SERIAL_ECHO_F(EnsureDouble x, int digit=2) { SERIAL_IMPL.print(x, digit); } - -#define SERIAL_ECHOPAIR_F_P(P,V...) do{ serial_print_P(P); SERIAL_ECHO_F(V); }while(0) -#define SERIAL_ECHOLNPAIR_F_P(P,V...) do{ SERIAL_ECHOPAIR_F_P(P,V); SERIAL_EOL(); }while(0) - -#define SERIAL_ECHOPAIR_F_F(S,V...) do{ serial_print(S); SERIAL_ECHO_F(V); }while(0) -#define SERIAL_ECHOLNPAIR_F_F(S,V...) do{ SERIAL_ECHOPAIR_F_F(S,V); SERIAL_EOL(); }while(0) - -#define SERIAL_ECHOPAIR_F(S,V...) SERIAL_ECHOPAIR_F_F(F(S),V) -#define SERIAL_ECHOLNPAIR_F(V...) do{ SERIAL_ECHOPAIR_F(V); SERIAL_EOL(); }while(0) - -#define SERIAL_ECHO_MSG(V...) do{ SERIAL_ECHO_START(); SERIAL_ECHOLNPGM(V); }while(0) -#define SERIAL_ERROR_MSG(V...) do{ SERIAL_ERROR_START(); SERIAL_ECHOLNPGM(V); }while(0) - -#define SERIAL_ECHO_SP(C) serial_spaces(C) +#define SERIAL_ECHO_MSG(V...) do{ SERIAL_ECHO_START(); SERIAL_ECHOLNPGM(V); }while(0) +#define SERIAL_ERROR_MSG(V...) do{ SERIAL_ERROR_START(); SERIAL_ECHOLNPGM(V); }while(0) +// Print a prefix, conditional string, and suffix +void serial_ternary(FSTR_P const pre, const bool onoff, FSTR_P const on, FSTR_P const off, FSTR_P const post=nullptr); +// Shorthand to put loose strings in PROGMEM #define SERIAL_ECHO_TERNARY(TF, PRE, ON, OFF, POST) serial_ternary(F(PRE), TF, F(ON), F(OFF), F(POST)) -#if SERIAL_FLOAT_PRECISION - #define SERIAL_DECIMAL(V) SERIAL_PRINT(V, SERIAL_FLOAT_PRECISION) -#else - #define SERIAL_DECIMAL(V) SERIAL_ECHO(V) -#endif +// Print up to 255 spaces +void SERIAL_ECHO_SP(uint8_t count); -// -// Functions for serial printing from PROGMEM. (Saves loads of SRAM.) -// -inline void serial_echopair_P(PGM_P const pstr, serial_char_t v) { serial_print_P(pstr); SERIAL_CHAR(v.c); } -inline void serial_echopair_P(PGM_P const pstr, float v) { serial_print_P(pstr); SERIAL_DECIMAL(v); } -inline void serial_echopair_P(PGM_P const pstr, double v) { serial_print_P(pstr); SERIAL_DECIMAL(v); } -//inline void serial_echopair_P(PGM_P const pstr, const char *v) { serial_print_P(pstr); SERIAL_ECHO(v); } -inline void serial_echopair_P(PGM_P const pstr, FSTR_P v) { serial_print_P(pstr); SERIAL_ECHOF(v); } - -// Default implementation for types without a specialization. Handles integers. -template -inline void serial_echopair_P(PGM_P const pstr, T v) { serial_print_P(pstr); SERIAL_ECHO(v); } - -// Add a newline. -template -inline void serial_echolnpair_P(PGM_P const pstr, T v) { serial_echopair_P(pstr, v); SERIAL_EOL(); } - -// Catch-all for __FlashStringHelper * -template -inline void serial_echopair(FSTR_P const fstr, T v) { serial_echopair_P(FTOP(fstr), v); } - -// Add a newline to the serial output -template -inline void serial_echolnpair(FSTR_P const fstr, T v) { serial_echolnpair_P(FTOP(fstr), v); } - -void serial_echo_start(); -void serial_error_start(); -inline void serial_ternary(FSTR_P const pre, const bool onoff, FSTR_P const on, FSTR_P const off, FSTR_P const post=nullptr) { - if (pre) serial_print(pre); - if (onoff && on) serial_print(on); - if (!onoff && off) serial_print(off); - if (post) serial_print(post); -} void serialprint_onoff(const bool onoff); void serialprintln_onoff(const bool onoff); void serialprint_truefalse(const bool tf); -void serial_spaces(uint8_t count); void serial_offset(const_float_t v, const uint8_t sp=0); // For v==0 draw space (sp==1) or plus (sp==2) void print_bin(const uint16_t val); diff --git a/Marlin/src/core/serial_base.h b/Marlin/src/core/serial_base.h index fa0a2298f7c00..a2f49417b7dce 100644 --- a/Marlin/src/core/serial_base.h +++ b/Marlin/src/core/serial_base.h @@ -79,7 +79,7 @@ struct EnsureDouble { operator double() { return a; } // If the compiler breaks on ambiguity here, it's likely because print(X, base) is called with X not a double/float, and // a base that's not a PrintBase value. This code is made to detect the error. You MUST set a base explicitly like this: - // SERIAL_PRINT(v, PrintBase::Hex) + //SERIAL_PRINT(v, PrintBase::Hex) EnsureDouble(double a) : a(a) {} EnsureDouble(float a) : a(a) {} }; @@ -169,7 +169,6 @@ struct SerialBase { FORCE_INLINE void print(unsigned int c, PrintBase base) { printNumber_unsigned(c, base); } FORCE_INLINE void print(unsigned long c, PrintBase base) { printNumber_unsigned(c, base); } - void print(EnsureDouble c, int digits) { printFloat(c, digits); } // Forward the call to the former's method @@ -180,7 +179,7 @@ struct SerialBase { void print(T c) { print(c, PrintBase::Dec); } void print(float c) { print(c, 2); } - void print(double c) { print(c, 2); } + void print(double c) { print(c, 2); } void println(char *s) { print(s); println(); } void println(const char *s) { print(s); println(); } diff --git a/Marlin/src/core/types.h b/Marlin/src/core/types.h index 8fcaa0000c614..3168322860ae5 100644 --- a/Marlin/src/core/types.h +++ b/Marlin/src/core/types.h @@ -283,6 +283,36 @@ typedef IF 255)), uint16_t, uint8_t>::ty #define MMM_TO_MMS(MM_M) feedRate_t(static_cast(MM_M) / 60.0f) #define MMS_TO_MMM(MM_S) (static_cast(MM_S) * 60.0f) +// Packaged character for AS_CHAR macro and other usage +typedef struct SerialChar { char c; SerialChar(char n) : c(n) { } } serial_char_t; +#define AS_CHAR(C) serial_char_t(C) + +// Packaged types: float with precision and/or width; a repeated space/character +typedef struct WFloat { float value; char width; char prec; + WFloat(float v, char w, char p) : value(v), width(w), prec(p) {} + } w_float_t; +typedef struct PFloat { float value; char prec; + PFloat(float v, char p) : value(v), prec(p) {} + } p_float_t; +typedef struct RepChr { char asc; uint8_t count; + RepChr(char a, uint8_t c) : asc(a), count(c) {} + } repchr_t; +typedef struct Spaces { uint8_t count; + Spaces(uint8_t c) : count(c) {} + } spaces_t; + +#ifdef __AVR__ + typedef w_float_t w_double_t; + typedef p_float_t p_double_t; +#else + typedef struct WDouble { double value; char width; char prec; + WDouble(double v, char w, char p) : value(v), width(w), prec(p) {} + } w_double_t; + typedef struct PDouble { double value; char prec; + PDouble(double v, char p) : value(v), prec(p) {} + } p_double_t; +#endif + // // Coordinates structures for XY, XYZ, XYZE... // diff --git a/Marlin/src/core/utility.cpp b/Marlin/src/core/utility.cpp index 64f083e197184..8476591d4b0e8 100644 --- a/Marlin/src/core/utility.cpp +++ b/Marlin/src/core/utility.cpp @@ -25,6 +25,10 @@ #include "../MarlinCore.h" #include "../module/temperature.h" +#if ENABLED(MARLIN_DEV_MODE) + MarlinError marlin_error_number; // Error Number - Marlin can beep X times periodically, display, and emit... +#endif + void safe_delay(millis_t ms) { while (ms > 50) { ms -= 50; @@ -95,9 +99,9 @@ void safe_delay(millis_t ms) { SERIAL_ECHOPGM(" (Aligned With"); if (probe.offset_xy.y > 0) - SERIAL_ECHOF(F(TERN(IS_SCARA, "-Distal", "-Back"))); + SERIAL_ECHO(F(TERN(IS_SCARA, "-Distal", "-Back"))); else if (probe.offset_xy.y < 0) - SERIAL_ECHOF(F(TERN(IS_SCARA, "-Proximal", "-Front"))); + SERIAL_ECHO(F(TERN(IS_SCARA, "-Proximal", "-Front"))); else if (probe.offset_xy.x != 0) SERIAL_ECHOPGM("-Center"); @@ -105,7 +109,7 @@ void safe_delay(millis_t ms) { #endif - SERIAL_ECHOF(probe.offset.z < 0 ? F("Below") : probe.offset.z > 0 ? F("Above") : F("Same Z as")); + SERIAL_ECHO(probe.offset.z < 0 ? F("Below") : probe.offset.z > 0 ? F("Above") : F("Same Z as")); SERIAL_ECHOLNPGM(" Nozzle)"); #endif diff --git a/Marlin/src/core/utility.h b/Marlin/src/core/utility.h index c4bb3c2a8a3d0..891a4e43836ba 100644 --- a/Marlin/src/core/utility.h +++ b/Marlin/src/core/utility.h @@ -92,3 +92,22 @@ const xyze_char_t axis_codes LOGICAL_AXIS_ARRAY('E', 'X', 'Y', 'Z', AXIS4_NAME, #define AXIS_CHAR(A) axis_codes[A] #define IAXIS_CHAR(A) iaxis_codes[A] #endif + +#if ENABLED(MARLIN_DEV_MODE) + enum MarlinError : uint8_t { + ERR_NONE, + ERR_STRING_RANGE, // A string buffer was too small to set the whole blob + ERR_ASSERTION, // An assertion was triggered + ERR_MALFUNCTION, + ERR_MEMORY_LEAK, + ERR_COMMS_SERIAL, + ERR_COMMS_SPI, + ERR_PLANNER_STARVED, + ERR_TMC_SHUTDOWN, + ERR_PROCEDURE_FAILED, + ERR_TOO_WACK, + ERR_PLAID_IN_SUMMER + }; + extern MarlinError marlin_error_number; // Error Number - Marlin can beep, display, and emit... + inline void error(const MarlinError err) { marlin_error_number = err; } +#endif diff --git a/Marlin/src/feature/bedlevel/bedlevel.cpp b/Marlin/src/feature/bedlevel/bedlevel.cpp index 17407eafb958c..a76c6cdd269e2 100644 --- a/Marlin/src/feature/bedlevel/bedlevel.cpp +++ b/Marlin/src/feature/bedlevel/bedlevel.cpp @@ -138,7 +138,7 @@ void reset_bed_level() { void print_2d_array(const uint8_t sx, const uint8_t sy, const uint8_t precision, const float *values) { #ifndef SCAD_MESH_OUTPUT for (uint8_t x = 0; x < sx; ++x) { - serial_spaces(precision + (x < 10 ? 3 : 2)); + SERIAL_ECHO_SP(precision + (x < 10 ? 3 : 2)); SERIAL_ECHO(x); } SERIAL_EOL(); @@ -158,7 +158,7 @@ void reset_bed_level() { const float offset = values[x * sy + y]; if (!isnan(offset)) { if (offset >= 0) SERIAL_CHAR('+'); - SERIAL_ECHO_F(offset, int(precision)); + SERIAL_ECHO(p_float_t(offset, precision)); } else { #ifdef SCAD_MESH_OUTPUT diff --git a/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp b/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp index 787827bb9bfca..f40cbccadd79f 100644 --- a/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp +++ b/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp @@ -123,8 +123,7 @@ #endif // IS_CARTESIAN && !SEGMENT_LEVELED_MOVES void mesh_bed_leveling::report_mesh() { - SERIAL_ECHOPAIR_F(STRINGIFY(GRID_MAX_POINTS_X) "x" STRINGIFY(GRID_MAX_POINTS_Y) " mesh. Z offset: ", z_offset, 5); - SERIAL_ECHOLNPGM("\nMeasured points:"); + SERIAL_ECHOLN(F(STRINGIFY(GRID_MAX_POINTS_X) "x" STRINGIFY(GRID_MAX_POINTS_Y) " mesh. Z offset: "), p_float_t(z_offset, 5), F("\nMeasured points:")); print_2d_array(GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y, 5, z_values[0]); } diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.cpp b/Marlin/src/feature/bedlevel/ubl/ubl.cpp index b99334795d13d..0228bd247ebd1 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl.cpp @@ -51,8 +51,7 @@ void unified_bed_leveling::report_current_mesh() { GRID_LOOP(x, y) if (!isnan(z_values[x][y])) { SERIAL_ECHO_START(); - SERIAL_ECHOPGM(" M421 I", x, " J", y); - SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, z_values[x][y], 4); + SERIAL_ECHOLN(F(" M421 I"), x, F(" J"), y, FPSTR(SP_Z_STR), p_float_t(z_values[x][y], 4)); serial_delay(75); // Prevent Printrun from exploding } } @@ -211,10 +210,10 @@ void unified_bed_leveling::display_map(const uint8_t map_type) { // TODO: Display on Graphical LCD } else if (isnan(f)) - SERIAL_ECHOF(human ? F(" . ") : F("NAN")); + SERIAL_ECHO(human ? F(" . ") : F("NAN")); else if (human || csv) { if (human && f >= 0) SERIAL_CHAR(f > 0 ? '+' : ' '); // Display sign also for positive numbers (' ' for 0) - SERIAL_DECIMAL(f); // Positive: 5 digits, Negative: 6 digits + SERIAL_ECHO(p_float_t(f, 3)); // Positive: 5 digits, Negative: 6 digits } if (csv && i < (GRID_MAX_POINTS_X) - 1) SERIAL_CHAR('\t'); diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.h b/Marlin/src/feature/bedlevel/ubl/ubl.h index c9bc7974296c0..f751ce40d0d20 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.h +++ b/Marlin/src/feature/bedlevel/ubl/ubl.h @@ -279,10 +279,8 @@ class unified_bed_leveling { if (DEBUGGING(MESH_ADJUST)) DEBUG_ECHOLNPGM("??? Yikes! NAN in "); } - if (DEBUGGING(MESH_ADJUST)) { - DEBUG_ECHOPGM("get_z_correction(", rx0, ", ", ry0); - DEBUG_ECHOLNPAIR_F(") => ", z0, 6); - } + if (DEBUGGING(MESH_ADJUST)) + DEBUG_ECHOLN(F("get_z_correction("), rx0, F(", "), ry0, F(") => "), p_float_t(z0, 6)); return z0; } diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index 551277c35d1c8..1c43af1884a7b 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -458,12 +458,8 @@ void unified_bed_leveling::G29() { invalidate(); SERIAL_ECHOLNPGM("Mesh invalidated. Probing mesh."); } - if (param.V_verbosity > 1) { - SERIAL_ECHOPGM("Probing around (", param.XY_pos.x); - SERIAL_CHAR(','); - SERIAL_DECIMAL(param.XY_pos.y); - SERIAL_ECHOLNPGM(").\n"); - } + if (param.V_verbosity > 1) + SERIAL_ECHOLN(F("Probing around ("), param.XY_pos.x, AS_CHAR(','), param.XY_pos.y, F(").\n")); probe_entire_mesh(param.XY_pos, parser.seen_test('T'), parser.seen_test('E'), parser.seen_test('U')); report_current_position(); @@ -722,10 +718,10 @@ void unified_bed_leveling::adjust_mesh_to_mean(const bool cflag, const_float_t o sum_of_diff_squared += sq(z_values[x][y] - mean); SERIAL_ECHOLNPGM("# of samples: ", n); - SERIAL_ECHOLNPAIR_F("Mean Mesh Height: ", mean, 6); + SERIAL_ECHOLNPGM("Mean Mesh Height: ", p_float_t(mean, 6)); const float sigma = SQRT(sum_of_diff_squared / (n + 1)); - SERIAL_ECHOLNPAIR_F("Standard Deviation: ", sigma, 6); + SERIAL_ECHOLNPGM("Standard Deviation: ", p_float_t(sigma, 6)); if (cflag) GRID_LOOP(x, y) @@ -924,10 +920,8 @@ void set_message_with_feedback(FSTR_P const fstr) { const float thickness = ABS(z1 - z2); - if (param.V_verbosity > 1) { - SERIAL_ECHOPAIR_F("Business Card is ", thickness, 4); - SERIAL_ECHOLNPGM("mm thick."); - } + if (param.V_verbosity > 1) + SERIAL_ECHOLNPGM("Business Card is ", p_float_t(thickness, 4), "mm thick."); restore_ubl_active_state_and_leave(); @@ -993,7 +987,7 @@ void set_message_with_feedback(FSTR_P const fstr) { TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(location, z_values[lpos.x][lpos.y])); if (param.V_verbosity > 2) - SERIAL_ECHOLNPAIR_F("Mesh Point Measured at: ", z_values[lpos.x][lpos.y], 6); + SERIAL_ECHOLNPGM("Mesh Point Measured at: ", p_float_t(z_values[lpos.x][lpos.y], 6)); SERIAL_FLUSH(); // Prevent host M105 buffer overrun. } while (location.valid()); @@ -1504,7 +1498,7 @@ void unified_bed_leveling::smart_fill_mesh() { measured_z -= TERN(UBL_TILT_ON_MESH_POINTS_3POINT, z_values[cpos[i].pos.x][cpos[i].pos.y], get_z_correction(points[i])); TERN_(VALIDATE_MESH_TILT, gotz[i] = measured_z); - if (param.V_verbosity > 3) { serial_spaces(16); SERIAL_ECHOLNPGM("Corrected_Z=", measured_z); } + if (param.V_verbosity > 3) { SERIAL_ECHO_SP(16); SERIAL_ECHOLNPGM("Corrected_Z=", measured_z); } incremental_LSF(&lsf_results, points[i], measured_z); } @@ -1562,26 +1556,28 @@ void unified_bed_leveling::smart_fill_mesh() { #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) { - const xy_pos_t lpos = rpos.asLogical(); #if ENABLED(UBL_TILT_ON_MESH_POINTS) const xy_pos_t oldLpos = oldRpos.asLogical(); - DEBUG_ECHOPGM("Calculated point: ("); DEBUG_ECHO_F(oldRpos.x, 7); DEBUG_CHAR(','); DEBUG_ECHO_F(oldRpos.y, 7); - DEBUG_ECHOPAIR_F(") logical: (", oldLpos.x, 7); DEBUG_CHAR(','); DEBUG_ECHO_F(oldLpos.y, 7); - DEBUG_ECHOPGM(")\nSelected mesh point: "); + DEBUG_ECHO(F("Calculated point: ("), p_float_t(oldRpos.x, 7), AS_CHAR(','), p_float_t(oldRpos.y, 7), + F(") logical: ("), p_float_t(oldLpos.x, 7), AS_CHAR(','), p_float_t(oldLpos.y, 7), + F(")\nSelected mesh point: ") + ); #endif - DEBUG_CHAR('('); DEBUG_ECHO_F(rpos.x, 7); DEBUG_CHAR(','); DEBUG_ECHO_F(rpos.y, 7); - DEBUG_ECHOPAIR_F(") logical: (", lpos.x, 7); DEBUG_CHAR(','); DEBUG_ECHO_F(lpos.y, 7); - DEBUG_ECHOPAIR_F(") measured: ", measured_z, 7); - DEBUG_ECHOPAIR_F(" correction: ", zcorr, 7); + const xy_pos_t lpos = rpos.asLogical(); + DEBUG_ECHO( AS_CHAR('('), p_float_t(rpos.x, 7), AS_CHAR(','), p_float_t(rpos.y, 7), + F(") logical: ("), p_float_t(lpos.x, 7), AS_CHAR(','), p_float_t(lpos.y, 7), + F(") measured: "), p_float_t(measured_z, 7), + F(" correction: "), p_float_t(zcorr, 7) + ); } #endif measured_z -= zcorr; - if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR_F(" final >>>---> ", measured_z, 7); + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM(" final >>>---> ", p_float_t(measured_z, 7)); if (param.V_verbosity > 3) { - serial_spaces(16); + SERIAL_ECHO_SP(16); SERIAL_ECHOLNPGM("Corrected_Z=", measured_z); } incremental_LSF(&lsf_results, rpos, measured_z); @@ -1597,20 +1593,14 @@ void unified_bed_leveling::smart_fill_mesh() { probe.move_z_after_probing(); if (abort_flag || finish_incremental_LSF(&lsf_results)) { - SERIAL_ECHOPGM("Could not complete LSF!"); + SERIAL_ECHOLNPGM("Could not complete LSF!"); return; } vector_3 normal = vector_3(lsf_results.A, lsf_results.B, 1).get_normal(); - if (param.V_verbosity > 2) { - SERIAL_ECHOPAIR_F("bed plane normal = [", normal.x, 7); - SERIAL_CHAR(','); - SERIAL_ECHO_F(normal.y, 7); - SERIAL_CHAR(','); - SERIAL_ECHO_F(normal.z, 7); - SERIAL_ECHOLNPGM("]"); - } + if (param.V_verbosity > 2) + SERIAL_ECHOLN(F("bed plane normal = ["), p_float_t(normal.x, 7), AS_CHAR(','), p_float_t(normal.y, 7), AS_CHAR(','), p_float_t(normal.z, 7), AS_CHAR(']')); matrix_3x3 rotation = matrix_3x3::create_look_at(vector_3(lsf_results.A, lsf_results.B, 1)); @@ -1618,24 +1608,14 @@ void unified_bed_leveling::smart_fill_mesh() { float mx = get_mesh_x(i), my = get_mesh_y(j), mz = z_values[i][j]; if (DEBUGGING(LEVELING)) { - DEBUG_ECHOPAIR_F("before rotation = [", mx, 7); - DEBUG_CHAR(','); - DEBUG_ECHO_F(my, 7); - DEBUG_CHAR(','); - DEBUG_ECHO_F(mz, 7); - DEBUG_ECHOPGM("] ---> "); + DEBUG_ECHOLN(F("before rotation = ["), p_float_t(mx, 7), AS_CHAR(','), p_float_t(my, 7), AS_CHAR(','), p_float_t(mz, 7), F("] ---> ")); DEBUG_DELAY(20); } rotation.apply_rotation_xyz(mx, my, mz); if (DEBUGGING(LEVELING)) { - DEBUG_ECHOPAIR_F("after rotation = [", mx, 7); - DEBUG_CHAR(','); - DEBUG_ECHO_F(my, 7); - DEBUG_CHAR(','); - DEBUG_ECHO_F(mz, 7); - DEBUG_ECHOLNPGM("]"); + DEBUG_ECHOLN(F("after rotation = ["), p_float_t(mx, 7), AS_CHAR(','), p_float_t(my, 7), AS_CHAR(','), p_float_t(mz, 7), F("] ---> ")); DEBUG_DELAY(20); } @@ -1645,17 +1625,9 @@ void unified_bed_leveling::smart_fill_mesh() { if (DEBUGGING(LEVELING)) { rotation.debug(F("rotation matrix:\n")); - DEBUG_ECHOPAIR_F("LSF Results A=", lsf_results.A, 7); - DEBUG_ECHOPAIR_F(" B=", lsf_results.B, 7); - DEBUG_ECHOLNPAIR_F(" D=", lsf_results.D, 7); + DEBUG_ECHOLN(F("LSF Results A="), p_float_t(lsf_results.A, 7), F(" B="), p_float_t(lsf_results.B, 7), F(" D="), p_float_t(lsf_results.D, 7)); DEBUG_DELAY(55); - - DEBUG_ECHOPAIR_F("bed plane normal = [", normal.x, 7); - DEBUG_CHAR(','); - DEBUG_ECHO_F(normal.y, 7); - DEBUG_CHAR(','); - DEBUG_ECHO_F(normal.z, 7); - DEBUG_ECHOLNPGM("]"); + DEBUG_ECHOLN(F("bed plane normal = ["), p_float_t(normal.x, 7), AS_CHAR(','), p_float_t(normal.y, 7), AS_CHAR(','), p_float_t(normal.z, 7), AS_CHAR(']')); DEBUG_EOL(); /** @@ -1672,21 +1644,17 @@ void unified_bed_leveling::smart_fill_mesh() { return normal.x * pos.x + normal.y * pos.y + zadd; }; auto debug_pt = [](const int num, const xy_pos_t &pos, const_float_t zadd) { - d_from(); DEBUG_ECHOPGM("Point ", num, ":"); - DEBUG_ECHO_F(normed(pos, zadd), 6); - DEBUG_ECHOLNPAIR_F(" Z error = ", zadd - get_z_correction(pos), 6); + d_from(); + DEBUG_ECHOLN(F("Point "), num, AS_CHAR(':'), p_float_t(normed(pos, zadd), 6), F(" Z error = "), p_float_t(zadd - get_z_correction(pos), 6)); }; debug_pt(1, probe_pt[0], normal.z * gotz[0]); debug_pt(2, probe_pt[1], normal.z * gotz[1]); debug_pt(3, probe_pt[2], normal.z * gotz[2]); #if ENABLED(Z_SAFE_HOMING) constexpr xy_float_t safe_xy = { Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT }; - d_from(); DEBUG_ECHOPGM("safe home with Z="); - DEBUG_ECHOLNPAIR_F("0 : ", normed(safe_xy, 0), 6); - d_from(); DEBUG_ECHOPGM("safe home with Z="); - DEBUG_ECHOLNPAIR_F("mesh value ", normed(safe_xy, get_z_correction(safe_xy)), 6); - DEBUG_ECHOPGM(" Z error = (", Z_SAFE_HOMING_X_POINT, ",", Z_SAFE_HOMING_Y_POINT); - DEBUG_ECHOLNPAIR_F(") = ", get_z_correction(safe_xy), 6); + d_from(); DEBUG_ECHOLN(F("safe home with Z="), F("0 : "), p_float_t(normed(safe_xy, 0), 6)); + d_from(); DEBUG_ECHOLN(F("safe home with Z="), F("mesh value "), p_float_t(normed(safe_xy, get_z_correction(safe_xy)), 6)); + DEBUG_ECHO(F(" Z error = ("), Z_SAFE_HOMING_X_POINT, AS_CHAR(','), Z_SAFE_HOMING_Y_POINT, F(") = "), p_float_t(get_z_correction(safe_xy), 6)); #endif #endif } // DEBUGGING(LEVELING) @@ -1734,7 +1702,7 @@ void unified_bed_leveling::smart_fill_mesh() { } } if (finish_incremental_LSF(&lsf_results)) { - SERIAL_ECHOLNPGM("Insufficient data"); + SERIAL_ECHOLNPGM(" Insufficient data"); return; } const float ez = -lsf_results.D - lsf_results.A * ppos.x - lsf_results.B * ppos.y; @@ -1745,7 +1713,7 @@ void unified_bed_leveling::smart_fill_mesh() { } } - SERIAL_ECHOLNPGM("done"); + SERIAL_ECHOLNPGM(" done."); } #endif // UBL_G29_P31 @@ -1758,20 +1726,19 @@ void unified_bed_leveling::smart_fill_mesh() { report_state(); if (storage_slot == -1) - SERIAL_ECHOPGM("No Mesh Loaded."); + SERIAL_ECHOLNPGM("No Mesh Loaded."); else - SERIAL_ECHOPGM("Mesh ", storage_slot, " Loaded."); - SERIAL_EOL(); + SERIAL_ECHOLNPGM("Mesh ", storage_slot, " Loaded."); serial_delay(50); #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) - SERIAL_ECHOLNPAIR_F("Fade Height M420 Z", planner.z_fade_height, 4); + SERIAL_ECHOLN(F("Fade Height M420 Z"), p_float_t(planner.z_fade_height, 4)); #endif adjust_mesh_to_mean(param.C_seen, param.C_constant); #if HAS_BED_PROBE - SERIAL_ECHOLNPAIR_F("Probe Offset M851 Z", probe.offset.z, 7); + SERIAL_ECHOLNPGM("Probe Offset M851 Z", p_float_t(probe.offset.z, 7)); #endif SERIAL_ECHOLNPGM("MESH_MIN_X " STRINGIFY(MESH_MIN_X) "=", MESH_MIN_X); serial_delay(50); @@ -1785,16 +1752,14 @@ void unified_bed_leveling::smart_fill_mesh() { SERIAL_ECHOPGM("X-Axis Mesh Points at: "); for (uint8_t i = 0; i < GRID_MAX_POINTS_X; ++i) { - SERIAL_ECHO_F(LOGICAL_X_POSITION(get_mesh_x(i)), 3); - SERIAL_ECHOPGM(" "); + SERIAL_ECHO(p_float_t(LOGICAL_X_POSITION(get_mesh_x(i)), 3), F(" ")); serial_delay(25); } SERIAL_EOL(); SERIAL_ECHOPGM("Y-Axis Mesh Points at: "); for (uint8_t i = 0; i < GRID_MAX_POINTS_Y; ++i) { - SERIAL_ECHO_F(LOGICAL_Y_POSITION(get_mesh_y(i)), 3); - SERIAL_ECHOPGM(" "); + SERIAL_ECHO(p_float_t(LOGICAL_Y_POSITION(get_mesh_y(i)), 3), F(" ")); serial_delay(25); } SERIAL_EOL(); @@ -1806,23 +1771,21 @@ void unified_bed_leveling::smart_fill_mesh() { SERIAL_EOL(); serial_delay(50); - #if ENABLED(UBL_DEVEL_DEBUGGING) - SERIAL_ECHOLNPGM("ubl_state_at_invocation :", ubl_state_at_invocation, "\nubl_state_recursion_chk :", ubl_state_recursion_chk); - serial_delay(50); + SERIAL_ECHOLNPGM("ubl_state_at_invocation :", ubl_state_at_invocation, "\nubl_state_recursion_chk :", ubl_state_recursion_chk); + serial_delay(50); - SERIAL_ECHOLNPGM("Meshes go from ", hex_address((void*)settings.meshes_start_index()), " to ", hex_address((void*)settings.meshes_end_index())); - serial_delay(50); + SERIAL_ECHOLNPGM("Meshes go from ", hex_address((void*)settings.meshes_start_index()), " to ", hex_address((void*)settings.meshes_end_index())); + serial_delay(50); - SERIAL_ECHOLNPGM("sizeof(ubl) : ", sizeof(ubl)); SERIAL_EOL(); - SERIAL_ECHOLNPGM("z_value[][] size: ", sizeof(z_values)); SERIAL_EOL(); - serial_delay(25); + SERIAL_ECHOLNPGM("sizeof(ubl) : ", sizeof(ubl)); SERIAL_EOL(); + SERIAL_ECHOLNPGM("z_value[][] size: ", sizeof(z_values)); SERIAL_EOL(); + serial_delay(25); - SERIAL_ECHOLNPGM("EEPROM free for UBL: ", hex_address((void*)(settings.meshes_end_index() - settings.meshes_start_index()))); - serial_delay(50); + SERIAL_ECHOLNPGM("EEPROM free for UBL: ", hex_address((void*)(settings.meshes_end_index() - settings.meshes_start_index()))); + serial_delay(50); - SERIAL_ECHOLNPGM("EEPROM can hold ", settings.calc_num_meshes(), " meshes.\n"); - serial_delay(25); - #endif // UBL_DEVEL_DEBUGGING + SERIAL_ECHOLNPGM("EEPROM can hold ", settings.calc_num_meshes(), " meshes.\n"); + serial_delay(25); if (!sanity_check()) { echo_name(); diff --git a/Marlin/src/feature/encoder_i2c.cpp b/Marlin/src/feature/encoder_i2c.cpp index 1c01e1c23b5ec..a367cea48dc63 100644 --- a/Marlin/src/feature/encoder_i2c.cpp +++ b/Marlin/src/feature/encoder_i2c.cpp @@ -106,10 +106,7 @@ void I2CPositionEncoder::update() { SERIAL_ECHOLNPGM("Current position is ", pos); SERIAL_ECHOLNPGM("Position in encoder ticks is ", positionInTicks); SERIAL_ECHOLNPGM("New zero-offset of ", zeroOffset); - SERIAL_ECHOPGM("New position reads as ", get_position()); - SERIAL_CHAR('('); - SERIAL_DECIMAL(mm_from_count(get_position())); - SERIAL_ECHOLNPGM(")"); + SERIAL_ECHOLN(F("New position reads as "), get_position(), AS_CHAR('('), mm_from_count(get_position()), AS_CHAR(')')); #endif } #endif diff --git a/Marlin/src/feature/host_actions.cpp b/Marlin/src/feature/host_actions.cpp index 235253b5a345d..cc5face2594d5 100644 --- a/Marlin/src/feature/host_actions.cpp +++ b/Marlin/src/feature/host_actions.cpp @@ -41,8 +41,7 @@ HostUI hostui; void HostUI::action(FSTR_P const fstr, const bool eol) { PORT_REDIRECT(SerialMask::All); - SERIAL_ECHOPGM("//action:"); - SERIAL_ECHOF(fstr); + SERIAL_ECHOPGM("//action:", fstr); if (eol) SERIAL_EOL(); } @@ -107,7 +106,7 @@ void HostUI::action(FSTR_P const fstr, const bool eol) { void HostUI::prompt(FSTR_P const ptype, const bool eol/*=true*/) { PORT_REDIRECT(SerialMask::All); action(F("prompt_"), false); - SERIAL_ECHOF(ptype); + SERIAL_ECHO(ptype); if (eol) SERIAL_EOL(); } diff --git a/Marlin/src/feature/max7219.cpp b/Marlin/src/feature/max7219.cpp index d3328855f4441..991f3e79db95d 100644 --- a/Marlin/src/feature/max7219.cpp +++ b/Marlin/src/feature/max7219.cpp @@ -136,9 +136,7 @@ uint8_t Max7219::suspended; // = 0; void Max7219::error(FSTR_P const func, const int32_t v1, const int32_t v2/*=-1*/) { #if ENABLED(MAX7219_ERRORS) - SERIAL_ECHOPGM("??? Max7219::"); - SERIAL_ECHOF(func, AS_CHAR('(')); - SERIAL_ECHO(v1); + SERIAL_ECHO(F("??? Max7219::"), func, AS_CHAR('('), v1); if (v2 > 0) SERIAL_ECHOPGM(", ", v2); SERIAL_CHAR(')'); SERIAL_EOL(); diff --git a/Marlin/src/feature/meatpack.cpp b/Marlin/src/feature/meatpack.cpp index 07ff41e5be228..5d2d112967df5 100644 --- a/Marlin/src/feature/meatpack.cpp +++ b/Marlin/src/feature/meatpack.cpp @@ -171,7 +171,7 @@ void MeatPack::report_state() { // should not contain the "PV' substring, as this is used to indicate protocol version SERIAL_ECHOPGM("[MP] " MeatPack_ProtocolVersion " "); serialprint_onoff(TEST(state, MPConfig_Bit_Active)); - SERIAL_ECHOF(TEST(state, MPConfig_Bit_NoSpaces) ? F(" NSP\n") : F(" ESP\n")); + SERIAL_ECHO(TEST(state, MPConfig_Bit_NoSpaces) ? F(" NSP\n") : F(" ESP\n")); } /** diff --git a/Marlin/src/feature/mixing.cpp b/Marlin/src/feature/mixing.cpp index 1ce489224813e..6cf59fdb56ff0 100644 --- a/Marlin/src/feature/mixing.cpp +++ b/Marlin/src/feature/mixing.cpp @@ -60,10 +60,7 @@ void Mixer::normalize(const uint8_t tool_index) { } #ifdef MIXER_NORMALIZER_DEBUG SERIAL_ECHOPGM("Mixer: Old relation : [ "); - MIXER_STEPPER_LOOP(i) { - SERIAL_DECIMAL(collector[i] / csum); - SERIAL_CHAR(' '); - } + MIXER_STEPPER_LOOP(i) SERIAL_ECHO(collector[i] / csum, AS_CHAR(' ')); SERIAL_ECHOLNPGM("]"); #endif @@ -75,16 +72,12 @@ void Mixer::normalize(const uint8_t tool_index) { csum = 0; SERIAL_ECHOPGM("Mixer: Normalize to : [ "); MIXER_STEPPER_LOOP(i) { - SERIAL_ECHO(uint16_t(color[tool_index][i])); - SERIAL_CHAR(' '); + SERIAL_ECHO(uint16_t(color[tool_index][i]), AS_CHAR(' ')); csum += color[tool_index][i]; } SERIAL_ECHOLNPGM("]"); SERIAL_ECHOPGM("Mixer: New relation : [ "); - MIXER_STEPPER_LOOP(i) { - SERIAL_ECHO_F(uint16_t(color[tool_index][i]) / csum, 3); - SERIAL_CHAR(' '); - } + MIXER_STEPPER_LOOP(i) SERIAL_ECHO(p_float_t(uint16_t(color[tool_index][i]) / csum, 3), AS_CHAR(' ')); SERIAL_ECHOLNPGM("]"); #endif diff --git a/Marlin/src/feature/mixing.h b/Marlin/src/feature/mixing.h index a43b0599447ae..c5c60a5e9f68a 100644 --- a/Marlin/src/feature/mixing.h +++ b/Marlin/src/feature/mixing.h @@ -137,11 +137,11 @@ class Mixer { MIXER_STEPPER_LOOP(i) tcolor[i] = mix[i] * scale; #ifdef MIXER_NORMALIZER_DEBUG - SERIAL_ECHOPGM("Mix [ "); - SERIAL_ECHOLIST_N(MIXING_STEPPERS, mix[0], mix[1], mix[2], mix[3], mix[4], mix[5]); - SERIAL_ECHOPGM(" ] to Color [ "); - SERIAL_ECHOLIST_N(MIXING_STEPPERS, tcolor[0], tcolor[1], tcolor[2], tcolor[3], tcolor[4], tcolor[5]); - SERIAL_ECHOLNPGM(" ]"); + SERIAL_ECHOLN( + F("Mix [ "), LIST_N(MIXING_STEPPERS, mix[0], mix[1], mix[2], mix[3], mix[4], mix[5]), + F(" ] to Color [ "), LIST_N(MIXING_STEPPERS, tcolor[0], tcolor[1], tcolor[2], tcolor[3], tcolor[4], tcolor[5]), + F(" ]") + ); #endif } @@ -151,11 +151,10 @@ class Mixer { MIXER_STEPPER_LOOP(i) mix[i] = mixer_perc_t(100.0f * color[j][i] / ctot + 0.5f); #ifdef MIXER_NORMALIZER_DEBUG - SERIAL_ECHOPGM("V-tool ", j, " [ "); - SERIAL_ECHOLIST_N(MIXING_STEPPERS, color[j][0], color[j][1], color[j][2], color[j][3], color[j][4], color[j][5]); - SERIAL_ECHOPGM(" ] to Mix [ "); - SERIAL_ECHOLIST_N(MIXING_STEPPERS, mix[0], mix[1], mix[2], mix[3], mix[4], mix[5]); - SERIAL_ECHOLNPGM(" ]"); + SERIAL_ECHOLN(F("V-tool "), j, + F(" [ "), LIST_N(MIXING_STEPPERS, color[j][0], color[j][1], color[j][2], color[j][3], color[j][4], color[j][5]), + F(" ] to Mix [ "), LIST_N(MIXING_STEPPERS, mix[0], mix[1], mix[2], mix[3], mix[4], mix[5]), F(" ]") + ); #endif } @@ -196,11 +195,10 @@ class Mixer { MIXER_STEPPER_LOOP(i) mix[i] = (mixer_perc_t)CEIL(100.0f * gradient.color[i] / ctot); #ifdef MIXER_NORMALIZER_DEBUG - SERIAL_ECHOPGM("Gradient [ "); - SERIAL_ECHOLIST_N(MIXING_STEPPERS, gradient.color[0], gradient.color[1], gradient.color[2], gradient.color[3], gradient.color[4], gradient.color[5]); - SERIAL_ECHOPGM(" ] to Mix [ "); - SERIAL_ECHOLIST_N(MIXING_STEPPERS, mix[0], mix[1], mix[2], mix[3], mix[4], mix[5]); - SERIAL_ECHOLNPGM(" ]"); + SERIAL_ECHOLN( + F("Gradient [ "), LIST_N(MIXING_STEPPERS, gradient.color[0], gradient.color[1], gradient.color[2], gradient.color[3], gradient.color[4], gradient.color[5]), + F(" ] to Mix [ "), LIST_N(MIXING_STEPPERS, mix[0], mix[1], mix[2], mix[3], mix[4], mix[5]), F(" ]") + ); #endif } diff --git a/Marlin/src/feature/mmu/mmu2.cpp b/Marlin/src/feature/mmu/mmu2.cpp index ea1a33ddaad49..19aae7b7d7477 100644 --- a/Marlin/src/feature/mmu/mmu2.cpp +++ b/Marlin/src/feature/mmu/mmu2.cpp @@ -286,7 +286,7 @@ void MMU2::mmu_loop() { sscanf(rx_buffer, "%hhuok\n", &finda); // This is super annoying. Only activate if necessary - // if (finda_runout_valid) DEBUG_ECHOLNPAIR_F("MMU <= 'P0'\nMMU => ", finda, 6); + //if (finda_runout_valid) DEBUG_ECHOLNPGM("MMU <= 'P0'\nMMU => ", p_float_t(finda, 6)); if (!finda && finda_runout_valid) filament_runout(); if (cmd == MMU_CMD_NONE) ready = true; diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index 66f7ad15edfdc..02287a51b8f1c 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -502,7 +502,7 @@ void show_continue_prompt(const bool is_reload) { ui.pause_show_message(is_reload ? PAUSE_MESSAGE_INSERT : PAUSE_MESSAGE_WAITING); SERIAL_ECHO_START(); - SERIAL_ECHOF(is_reload ? F(_PMSG(STR_FILAMENT_CHANGE_INSERT) "\n") : F(_PMSG(STR_FILAMENT_CHANGE_WAIT) "\n")); + SERIAL_ECHO(is_reload ? F(_PMSG(STR_FILAMENT_CHANGE_INSERT) "\n") : F(_PMSG(STR_FILAMENT_CHANGE_WAIT) "\n")); } void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep_count/*=0*/ DXC_ARGS) { diff --git a/Marlin/src/feature/powerloss.cpp b/Marlin/src/feature/powerloss.cpp index af85a16448629..a8dfadc1f6c83 100644 --- a/Marlin/src/feature/powerloss.cpp +++ b/Marlin/src/feature/powerloss.cpp @@ -613,14 +613,13 @@ void PrintJobRecovery::resume() { #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) void PrintJobRecovery::debug(FSTR_P const prefix) { - DEBUG_ECHOF(prefix); - DEBUG_ECHOLNPGM(" Job Recovery Info...\nvalid_head:", info.valid_head, " valid_foot:", info.valid_foot); + DEBUG_ECHOLN(prefix, F(" Job Recovery Info...\nvalid_head:"), info.valid_head, F(" valid_foot:"), info.valid_foot); if (info.valid_head) { if (info.valid_head == info.valid_foot) { DEBUG_ECHOPGM("current_position: "); LOOP_LOGICAL_AXES(i) { if (i) DEBUG_CHAR(','); - DEBUG_DECIMAL(info.current_position[i]); + DEBUG_ECHO(info.current_position[i]); } DEBUG_EOL(); @@ -638,7 +637,7 @@ void PrintJobRecovery::resume() { DEBUG_ECHOPGM("home_offset: "); LOOP_NUM_AXES(i) { if (i) DEBUG_CHAR(','); - DEBUG_DECIMAL(info.home_offset[i]); + DEBUG_ECHO(info.home_offset[i]); } DEBUG_EOL(); #endif @@ -647,7 +646,7 @@ void PrintJobRecovery::resume() { DEBUG_ECHOPGM("position_shift: "); LOOP_NUM_AXES(i) { if (i) DEBUG_CHAR(','); - DEBUG_DECIMAL(info.position_shift[i]); + DEBUG_ECHO(info.position_shift[i]); } DEBUG_EOL(); #endif diff --git a/Marlin/src/feature/probe_temp_comp.cpp b/Marlin/src/feature/probe_temp_comp.cpp index 2b362a2186b6f..f640a9fd2f718 100644 --- a/Marlin/src/feature/probe_temp_comp.cpp +++ b/Marlin/src/feature/probe_temp_comp.cpp @@ -87,14 +87,9 @@ void ProbeTempComp::print_offsets() { for (uint8_t s = 0; s < TSI_COUNT; ++s) { celsius_t temp = cali_info[s].start_temp; for (int16_t i = -1; i < cali_info[s].measurements; ++i) { - SERIAL_ECHOF( - TERN_(PTC_BED, s == TSI_BED ? F("Bed") :) - TERN_(PTC_HOTEND, s == TSI_EXT ? F("Extruder") :) - F("Probe") - ); - SERIAL_ECHOLNPGM( - " temp: ", temp, - "C; Offset: ", i < 0 ? 0.0f : sensor_z_offsets[s][i], " um" + SERIAL_ECHOLN( + TERN_(PTC_BED, s == TSI_BED ? F("Bed") :) TERN_(PTC_HOTEND, s == TSI_EXT ? F("Extruder") :) F("Probe"), + F(" temp: "), temp, F("C; Offset: "), i < 0 ? 0.0f : sensor_z_offsets[s][i], F(" um") ); temp += cali_info[s].temp_resolution; } diff --git a/Marlin/src/feature/runout.h b/Marlin/src/feature/runout.h index ea17cbc4422b5..42463e1a347c7 100644 --- a/Marlin/src/feature/runout.h +++ b/Marlin/src/feature/runout.h @@ -50,6 +50,8 @@ #define HAS_FILAMENT_SWITCH 1 #endif +typedef Flags<8> runout_flags_t; + void event_filament_runout(const uint8_t extruder); template @@ -130,39 +132,29 @@ class TFilamentMonitor : public FilamentMonitorBase { TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, cli()); // Prevent RunoutResponseDelayed::block_completed from accumulating here response.run(); sensor.run(); - const uint8_t runout_flags = response.has_run_out(); + const runout_flags_t runout_flags = response.has_run_out(); TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, sei()); #if MULTI_FILAMENT_SENSOR #if ENABLED(WATCH_ALL_RUNOUT_SENSORS) - const bool ran_out = !!runout_flags; // any sensor triggers + const bool ran_out = bool(runout_flags); // any sensor triggers uint8_t extruder = 0; - if (ran_out) { - uint8_t bitmask = runout_flags; - while (!(bitmask & 1)) { - bitmask >>= 1; - extruder++; - } - } + if (ran_out) while (!runout_flags.test(extruder)) extruder++; #else - const bool ran_out = TEST(runout_flags, active_extruder); // suppress non active extruders + const bool ran_out = runout_flags[active_extruder]; // suppress non active extruders uint8_t extruder = active_extruder; #endif #else - const bool ran_out = !!runout_flags; + const bool ran_out = bool(runout_flags); uint8_t extruder = active_extruder; #endif - #if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG) - if (runout_flags) { + if (ran_out) { + #if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG) SERIAL_ECHOPGM("Runout Sensors: "); - for (uint8_t i = 0; i < 8; ++i) SERIAL_ECHO('0' + TEST(runout_flags, i)); - SERIAL_ECHOPGM(" -> ", extruder); - if (ran_out) SERIAL_ECHOPGM(" RUN OUT"); - SERIAL_EOL(); - } - #endif + for (uint8_t i = 0; i < 8; ++i) SERIAL_ECHO('0' + char(runout_flags[i])); + SERIAL_ECHOLNPGM(" -> ", extruder, " RUN OUT"); + #endif - if (ran_out) { filament_ran_out = true; event_filament_runout(extruder); planner.synchronize(); @@ -311,7 +303,7 @@ class FilamentSensorBase { static uint8_t was_out; // = 0 if (out != TEST(was_out, s)) { TBI(was_out, s); - SERIAL_ECHOLNF(F("Filament Sensor "), AS_DIGIT(s), out ? F(" OUT") : F(" IN")); + SERIAL_ECHOLN(F("Filament Sensor "), AS_DIGIT(s), out ? F(" OUT") : F(" IN")); } #endif } @@ -377,21 +369,20 @@ class FilamentSensorBase { if (ELAPSED(ms, t)) { t = millis() + 1000UL; for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) - SERIAL_ECHOF(i ? F(", ") : F("Runout remaining mm: "), mm_countdown.runout[i]); + SERIAL_ECHO(i ? F(", ") : F("Runout remaining mm: "), mm_countdown.runout[i]); #if ENABLED(FILAMENT_SWITCH_AND_MOTION) for (uint8_t i = 0; i < NUM_MOTION_SENSORS; ++i) - SERIAL_ECHOF(i ? F(", ") : F("Motion remaining mm: "), mm_countdown.motion[i]); #endif SERIAL_EOL(); } #endif } - static uint8_t has_run_out() { - uint8_t runout_flags = 0; - for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) if (mm_countdown.runout[i] < 0) SBI(runout_flags, i); + static runout_flags_t has_run_out() { + runout_flags_t runout_flags{0}; + for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) if (mm_countdown.runout[i] < 0) runout_flags.set(i); #if ENABLED(FILAMENT_SWITCH_AND_MOTION) - for (uint8_t i = 0; i < NUM_MOTION_SENSORS; ++i) if (mm_countdown.motion[i] < 0) SBI(runout_flags, i); + for (uint8_t i = 0; i < NUM_MOTION_SENSORS; ++i) if (mm_countdown.motion[i] < 0) runout_flags.set(i); #endif return runout_flags; } @@ -439,9 +430,9 @@ class FilamentSensorBase { for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) if (runout_count[i] >= 0) runout_count[i]--; } - static uint8_t has_run_out() { - uint8_t runout_flags = 0; - for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) if (runout_count[i] < 0) SBI(runout_flags, i); + static runout_flags_t has_run_out() { + runout_flags_t runout_flags{0}; + for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) if (runout_count[i] < 0) runout_flags.set(i); return runout_flags; } diff --git a/Marlin/src/feature/stepper_driver_safety.cpp b/Marlin/src/feature/stepper_driver_safety.cpp index d3fc1614861e6..acdd695909db2 100644 --- a/Marlin/src/feature/stepper_driver_safety.cpp +++ b/Marlin/src/feature/stepper_driver_safety.cpp @@ -30,8 +30,7 @@ static uint32_t axis_plug_backward = 0; void stepper_driver_backward_error(FSTR_P const fstr) { SERIAL_ERROR_START(); - SERIAL_ECHOF(fstr); - SERIAL_ECHOLNPGM(" driver is backward!"); + SERIAL_ECHOLN(fstr, F(" driver is backward!")); ui.status_printf(2, F(S_FMT S_FMT), FTOP(fstr), GET_TEXT(MSG_DRIVER_BACKWARD)); } diff --git a/Marlin/src/feature/tmc_util.cpp b/Marlin/src/feature/tmc_util.cpp index 095e14fe15588..556a608914574 100644 --- a/Marlin/src/feature/tmc_util.cpp +++ b/Marlin/src/feature/tmc_util.cpp @@ -562,7 +562,7 @@ }; template - static void print_vsense(TMC &st) { SERIAL_ECHOF(st.vsense() ? F("1=.18") : F("0=.325")); } + static void print_vsense(TMC &st) { SERIAL_ECHO(st.vsense() ? F("1=.18") : F("0=.325")); } #if HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC5130) static void _tmc_status(TMC2130Stepper &st, const TMC_debug_enum i) { @@ -680,7 +680,7 @@ case TMC_ENABLED: serialprint_truefalse(st.isEnabled()); break; case TMC_CURRENT: SERIAL_ECHO(st.getMilliamps()); break; case TMC_RMS_CURRENT: SERIAL_ECHO(st.rms_current()); break; - case TMC_MAX_CURRENT: SERIAL_PRINT((float)st.rms_current() * 1.41, 0); break; + case TMC_MAX_CURRENT: SERIAL_ECHO(p_float_t(st.rms_current() * 1.41, 0)); break; case TMC_IRUN: SERIAL_ECHO(st.irun()); SERIAL_ECHOPGM("/31"); @@ -728,12 +728,12 @@ case TMC_ENABLED: serialprint_truefalse(st.isEnabled()); break; case TMC_CURRENT: SERIAL_ECHO(st.getMilliamps()); break; case TMC_RMS_CURRENT: SERIAL_ECHO(st.rms_current()); break; - case TMC_MAX_CURRENT: SERIAL_PRINT((float)st.rms_current() * 1.41, 0); break; + case TMC_MAX_CURRENT: SERIAL_ECHO(p_float_t(st.rms_current() * 1.41, 0)); break; case TMC_IRUN: SERIAL_ECHO(st.cs()); SERIAL_ECHOPGM("/31"); break; - case TMC_VSENSE: SERIAL_ECHOF(st.vsense() ? F("1=.165") : F("0=.310")); break; + case TMC_VSENSE: SERIAL_ECHO(st.vsense() ? F("1=.165") : F("0=.310")); break; case TMC_MICROSTEPS: SERIAL_ECHO(st.microsteps()); break; //case TMC_OTPW: serialprint_truefalse(st.otpw()); break; //case TMC_OTPW_TRIGGERED: serialprint_truefalse(st.getOTPW()); break; @@ -1228,7 +1228,7 @@ static bool test_connection(TMC &st) { case 1: stat = F("HIGH"); break; case 2: stat = F("LOW"); break; } - SERIAL_ECHOLNF(stat); + SERIAL_ECHOLN(stat); return test_result; } diff --git a/Marlin/src/feature/twibus.cpp b/Marlin/src/feature/twibus.cpp index 4aedb4b5f3c50..5cfe9f9421bc3 100644 --- a/Marlin/src/feature/twibus.cpp +++ b/Marlin/src/feature/twibus.cpp @@ -93,8 +93,7 @@ void TWIBus::send() { // static void TWIBus::echoprefix(uint8_t bytes, FSTR_P const pref, uint8_t adr) { SERIAL_ECHO_START(); - SERIAL_ECHOF(pref); - SERIAL_ECHOPGM(": from:", adr, " bytes:", bytes, " data:"); + SERIAL_ECHO(pref, F(": from:"), adr, F(" bytes:"), bytes, F(" data:")); } // static diff --git a/Marlin/src/gcode/bedlevel/G35.cpp b/Marlin/src/gcode/bedlevel/G35.cpp index 9c1ee472ec5ae..a37e5623e746c 100644 --- a/Marlin/src/gcode/bedlevel/G35.cpp +++ b/Marlin/src/gcode/bedlevel/G35.cpp @@ -100,19 +100,20 @@ void GcodeSuite::G35() { for (uint8_t i = 0; i < G35_PROBE_COUNT; ++i) { const float z_probed_height = probe.probe_at_point(tramming_points[i], PROBE_PT_RAISE); if (isnan(z_probed_height)) { - SERIAL_ECHOPGM("G35 failed at point ", i + 1, " ("); - SERIAL_ECHOPGM_P((char *)pgm_read_ptr(&tramming_point_name[i])); - SERIAL_CHAR(')'); - SERIAL_ECHOLNPGM_P(SP_X_STR, tramming_points[i].x, SP_Y_STR, tramming_points[i].y); + SERIAL_ECHO( + F("G35 failed at point "), i + 1, F(" ("), FPSTR(pgm_read_ptr(&tramming_point_name[i])), AS_CHAR(')'), + FPSTR(SP_X_STR), tramming_points[i].x, FPSTR(SP_Y_STR), tramming_points[i].y + ); err_break = true; break; } if (DEBUGGING(LEVELING)) { - DEBUG_ECHOPGM("Probing point ", i + 1, " ("); - DEBUG_ECHOF(FPSTR(pgm_read_ptr(&tramming_point_name[i]))); - DEBUG_CHAR(')'); - DEBUG_ECHOLNPGM_P(SP_X_STR, tramming_points[i].x, SP_Y_STR, tramming_points[i].y, SP_Z_STR, z_probed_height); + DEBUG_ECHOLN( + F("Probing point "), i + 1, F(" ("), FPSTR(pgm_read_ptr(&tramming_point_name[i])), AS_CHAR(')'), + FPSTR(SP_X_STR), tramming_points[i].x, FPSTR(SP_Y_STR), tramming_points[i].y, + FPSTR(SP_Z_STR), z_probed_height + ); } z_measured[i] = z_probed_height; diff --git a/Marlin/src/gcode/bedlevel/M420.cpp b/Marlin/src/gcode/bedlevel/M420.cpp index 277f95b9ffe16..d870a4f4308a3 100644 --- a/Marlin/src/gcode/bedlevel/M420.cpp +++ b/Marlin/src/gcode/bedlevel/M420.cpp @@ -248,7 +248,7 @@ void GcodeSuite::M420_report(const bool forReplay/*=true*/) { report_heading_etc(forReplay, F( TERN(MESH_BED_LEVELING, "Mesh Bed Leveling", TERN(AUTO_BED_LEVELING_UBL, "Unified Bed Leveling", "Auto Bed Leveling")) )); - SERIAL_ECHOF( + SERIAL_ECHO( F(" M420 S"), planner.leveling_active #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) , FPSTR(SP_Z_STR), LINEAR_UNIT(planner.z_fade_height) diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index ca02fc9765362..3b669fbba2a01 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -817,11 +817,11 @@ G29_TYPE GcodeSuite::G29() { abl.mean /= abl.abl_points; if (abl.verbose_level) { - SERIAL_ECHOPAIR_F("Eqn coefficients: a: ", plane_equation_coefficients.a, 8); - SERIAL_ECHOPAIR_F(" b: ", plane_equation_coefficients.b, 8); - SERIAL_ECHOPAIR_F(" d: ", plane_equation_coefficients.d, 8); + SERIAL_ECHOPGM("Eqn coefficients: a: ", p_float_t(plane_equation_coefficients.a, 8), + " b: ", p_float_t(plane_equation_coefficients.b, 8), + " d: ", p_float_t(plane_equation_coefficients.d, 8)); if (abl.verbose_level > 2) - SERIAL_ECHOPAIR_F("\nMean of sampled points: ", abl.mean, 8); + SERIAL_ECHOPGM("\nMean of sampled points: ", p_float_t(abl.mean, 8)); SERIAL_EOL(); } @@ -837,7 +837,7 @@ G29_TYPE GcodeSuite::G29() { float min_diff = 999; auto print_topo_map = [&](FSTR_P const title, const bool get_min) { - SERIAL_ECHOF(title); + SERIAL_ECHO(title); for (int8_t yy = abl.grid_points.y - 1; yy >= 0; yy--) { for (uint8_t xx = 0; xx < abl.grid_points.x; ++xx) { const int ind = abl.indexIntoAB[xx][yy]; @@ -848,7 +848,7 @@ G29_TYPE GcodeSuite::G29() { const float subval = get_min ? abl.mean : tmp.z + min_diff, diff = abl.eqnBVector[ind] - subval; SERIAL_CHAR(' '); if (diff >= 0.0) SERIAL_CHAR('+'); // Include + for column alignment - SERIAL_ECHO_F(diff, 5); + SERIAL_ECHO(p_float_t(diff, 5)); } // xx SERIAL_EOL(); } // yy diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index fde640fe98953..ab7b03961c336 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -274,7 +274,7 @@ void GcodeSuite::G28() { #if HAS_HOMING_CURRENT auto debug_current = [](FSTR_P const s, const int16_t a, const int16_t b) { - DEBUG_ECHOF(s); DEBUG_ECHOLNPGM(" current: ", a, " -> ", b); + DEBUG_ECHOLN(s, F(" current: "), a, F(" -> "), b); }; #if HAS_CURRENT_HOME(X) const int16_t tmc_save_current_X = stepperX.getMilliamps(); diff --git a/Marlin/src/gcode/calibrate/G33.cpp b/Marlin/src/gcode/calibrate/G33.cpp index 226570acce368..ba6cccffab789 100644 --- a/Marlin/src/gcode/calibrate/G33.cpp +++ b/Marlin/src/gcode/calibrate/G33.cpp @@ -92,8 +92,7 @@ void ac_cleanup(TERN_(HAS_MULTI_HOTEND, const uint8_t old_tool_index)) { } void print_signed_float(FSTR_P const prefix, const_float_t f) { - SERIAL_ECHOPGM(" "); - SERIAL_ECHOF(prefix, AS_CHAR(':')); + SERIAL_ECHO(F(" "), prefix, AS_CHAR(':')); serial_offset(f); } @@ -636,7 +635,7 @@ void GcodeSuite::G33() { else #endif { - SERIAL_ECHOPAIR_F("std dev:", zero_std_dev_min, 3); + SERIAL_ECHOPGM("std dev:", p_float_t(zero_std_dev_min, 3)); } SERIAL_EOL(); char mess[21]; @@ -657,7 +656,7 @@ void GcodeSuite::G33() { strcpy_P(mess, PSTR("No convergence")); SERIAL_ECHO(mess); SERIAL_ECHO_SP(32); - SERIAL_ECHOLNPAIR_F("std dev:", zero_std_dev, 3); + SERIAL_ECHOLNPGM("std dev:", p_float_t(zero_std_dev, 3)); ui.set_status(mess); if (verbose_level > 1) print_calibration_settings(_endstop_results, _angle_results); @@ -665,9 +664,9 @@ void GcodeSuite::G33() { } else { // dry run FSTR_P const enddryrun = F("End DRY-RUN"); - SERIAL_ECHOF(enddryrun); + SERIAL_ECHO(enddryrun); SERIAL_ECHO_SP(35); - SERIAL_ECHOLNPAIR_F("std dev:", zero_std_dev, 3); + SERIAL_ECHOLNPGM("std dev:", p_float_t(zero_std_dev, 3)); char mess[21]; strcpy_P(mess, FTOP(enddryrun)); diff --git a/Marlin/src/gcode/calibrate/G34_M422.cpp b/Marlin/src/gcode/calibrate/G34_M422.cpp index 7650443de8621..39f3d2d5dfdc0 100644 --- a/Marlin/src/gcode/calibrate/G34_M422.cpp +++ b/Marlin/src/gcode/calibrate/G34_M422.cpp @@ -411,7 +411,7 @@ void GcodeSuite::G34() { SERIAL_ECHOLNPGM("G34 aborted."); else { SERIAL_ECHOLNPGM("Did ", iteration + (iteration != z_auto_align_iterations), " of ", z_auto_align_iterations); - SERIAL_ECHOLNPAIR_F("Accuracy: ", z_maxdiff); + SERIAL_ECHOLNPGM("Accuracy: ", p_float_t(z_maxdiff, 2)); } // Stow the probe because the last call to probe.probe_at_point(...) @@ -501,8 +501,7 @@ void GcodeSuite::M422() { } if (!WITHIN(position_index, 1, NUM_Z_STEPPERS)) { - SERIAL_ECHOF(err_string); - SERIAL_ECHOLNPGM(" index invalid (1.." STRINGIFY(NUM_Z_STEPPERS) ")."); + SERIAL_ECHOLN(err_string, F(" index invalid (1.." STRINGIFY(NUM_Z_STEPPERS) ").")); return; } diff --git a/Marlin/src/gcode/calibrate/G76_M871.cpp b/Marlin/src/gcode/calibrate/G76_M871.cpp index 34b72ecdf3178..6fe3dd89cf173 100644 --- a/Marlin/src/gcode/calibrate/G76_M871.cpp +++ b/Marlin/src/gcode/calibrate/G76_M871.cpp @@ -113,7 +113,7 @@ if (isnan(measured_z)) SERIAL_ECHOLNPGM("!Received NAN. Aborting."); else { - SERIAL_ECHOLNPAIR_F("Measured: ", measured_z); + SERIAL_ECHOLNPGM("Measured: ", p_float_t(measured_z, 2)); if (targ == ProbeTempComp::cali_info[sid].start_temp) ptc.prepare_new_calibration(measured_z); else diff --git a/Marlin/src/gcode/calibrate/M100.cpp b/Marlin/src/gcode/calibrate/M100.cpp index 3791c69f88bd6..c05fe12fc3893 100644 --- a/Marlin/src/gcode/calibrate/M100.cpp +++ b/Marlin/src/gcode/calibrate/M100.cpp @@ -183,7 +183,7 @@ inline int32_t count_test_bytes(const char * const start_free_memory) { } void M100_dump_routine(FSTR_P const title, const char * const start, const uintptr_t size) { - SERIAL_ECHOLNF(title); + SERIAL_ECHOLN(title); // // Round the start and end locations to produce full lines of output // @@ -197,7 +197,7 @@ inline int32_t count_test_bytes(const char * const start_free_memory) { #endif // M100_FREE_MEMORY_DUMPER inline int check_for_free_memory_corruption(FSTR_P const title) { - SERIAL_ECHOF(title); + SERIAL_ECHO(title); char *start_free_memory = free_memory_start, *end_free_memory = free_memory_end; int n = end_free_memory - start_free_memory; diff --git a/Marlin/src/gcode/calibrate/M48.cpp b/Marlin/src/gcode/calibrate/M48.cpp index 2748d4e7bada7..9f285b8b8ae30 100644 --- a/Marlin/src/gcode/calibrate/M48.cpp +++ b/Marlin/src/gcode/calibrate/M48.cpp @@ -126,15 +126,13 @@ void GcodeSuite::M48() { auto dev_report = [](const bool verbose, const_float_t mean, const_float_t sigma, const_float_t min, const_float_t max, const bool final=false) { if (verbose) { - SERIAL_ECHOPAIR_F("Mean: ", mean, 6); - if (!final) SERIAL_ECHOPAIR_F(" Sigma: ", sigma, 6); - SERIAL_ECHOPAIR_F(" Min: ", min, 3); - SERIAL_ECHOPAIR_F(" Max: ", max, 3); - SERIAL_ECHOPAIR_F(" Range: ", max-min, 3); + SERIAL_ECHOPGM("Mean: ", p_float_t(mean, 6)); + if (!final) SERIAL_ECHOPGM(" Sigma: ", p_float_t(sigma, 6)); + SERIAL_ECHOPGM(" Min: ", p_float_t(min, 3), " Max: ", p_float_t(max, 3), " Range: ", p_float_t(max-min, 3)); if (final) SERIAL_EOL(); } if (final) { - SERIAL_ECHOLNPAIR_F("Standard Deviation: ", sigma, 6); + SERIAL_ECHOLNPGM("Standard Deviation: ", p_float_t(sigma, 6)); SERIAL_EOL(); } }; @@ -207,7 +205,7 @@ void GcodeSuite::M48() { while (!probe.can_reach(next_pos)) { next_pos *= 0.8f; if (verbose_level > 3) - SERIAL_ECHOLNPGM_P(PSTR("Moving inward: X"), next_pos.x, SP_Y_STR, next_pos.y); + SERIAL_ECHOLN(F("Moving inward: X"), next_pos.x, FPSTR(SP_Y_STR), next_pos.y); } #elif HAS_ENDSTOPS // For a rectangular bed just keep the probe in bounds @@ -216,7 +214,7 @@ void GcodeSuite::M48() { #endif if (verbose_level > 3) - SERIAL_ECHOLNPGM_P(PSTR("Going to: X"), next_pos.x, SP_Y_STR, next_pos.y); + SERIAL_ECHOLN(F("Going to: X"), next_pos.x, FPSTR(SP_Y_STR), next_pos.y); do_blocking_move_to_xy(next_pos); } // n_legs loop @@ -247,10 +245,7 @@ void GcodeSuite::M48() { sigma = SQRT(dev_sum / (n + 1)); if (verbose_level > 1) { - SERIAL_ECHO(n + 1); - SERIAL_ECHOPGM(" of ", n_samples); - SERIAL_ECHOPAIR_F(": z: ", pz, 3); - SERIAL_CHAR(' '); + SERIAL_ECHO(n + 1, F(" of "), n_samples, F(": z: "), p_float_t(pz, 3), AS_CHAR(' ')); dev_report(verbose_level > 2, mean, sigma, min, max); SERIAL_EOL(); } diff --git a/Marlin/src/gcode/calibrate/M852.cpp b/Marlin/src/gcode/calibrate/M852.cpp index 6c661dcd61d9b..6d3c004548c6d 100644 --- a/Marlin/src/gcode/calibrate/M852.cpp +++ b/Marlin/src/gcode/calibrate/M852.cpp @@ -93,11 +93,9 @@ void GcodeSuite::M852() { void GcodeSuite::M852_report(const bool forReplay/*=true*/) { report_heading_etc(forReplay, F(STR_SKEW_FACTOR)); - SERIAL_ECHOPAIR_F(" M852 I", planner.skew_factor.xy, 6); + SERIAL_ECHOPGM(" M852 I", p_float_t(planner.skew_factor.xy, 6)); #if ENABLED(SKEW_CORRECTION_FOR_Z) - SERIAL_ECHOPAIR_F(" J", planner.skew_factor.xz, 6); - SERIAL_ECHOPAIR_F(" K", planner.skew_factor.yz, 6); - SERIAL_ECHOLNPGM(" ; XY, XZ, YZ"); + SERIAL_ECHOLNPGM(" J", p_float_t(planner.skew_factor.xz, 6), " K", p_float_t(planner.skew_factor.yz, 6), " ; XY, XZ, YZ"); #else SERIAL_ECHOLNPGM(" ; XY"); #endif diff --git a/Marlin/src/gcode/config/M218.cpp b/Marlin/src/gcode/config/M218.cpp index d645685701ec6..ff63dcaf34e7c 100644 --- a/Marlin/src/gcode/config/M218.cpp +++ b/Marlin/src/gcode/config/M218.cpp @@ -66,12 +66,12 @@ void GcodeSuite::M218_report(const bool forReplay/*=true*/) { report_heading_etc(forReplay, F(STR_HOTEND_OFFSETS)); for (uint8_t e = 1; e < HOTENDS; ++e) { report_echo_start(forReplay); - SERIAL_ECHOPGM_P( + SERIAL_ECHOLNPGM_P( PSTR(" M218 T"), e, SP_X_STR, LINEAR_UNIT(hotend_offset[e].x), - SP_Y_STR, LINEAR_UNIT(hotend_offset[e].y) + SP_Y_STR, LINEAR_UNIT(hotend_offset[e].y), + SP_Z_STR, p_float_t(LINEAR_UNIT(hotend_offset[e].z), 3) ); - SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, LINEAR_UNIT(hotend_offset[e].z), 3); } } diff --git a/Marlin/src/gcode/config/M302.cpp b/Marlin/src/gcode/config/M302.cpp index 12408c898755a..26e5a468cabc2 100644 --- a/Marlin/src/gcode/config/M302.cpp +++ b/Marlin/src/gcode/config/M302.cpp @@ -59,9 +59,7 @@ void GcodeSuite::M302() { else if (!seen_S) { // Report current state SERIAL_ECHO_START(); - SERIAL_ECHOPGM("Cold extrudes are "); - SERIAL_ECHOF(thermalManager.allow_cold_extrude ? F("en") : F("dis")); - SERIAL_ECHOLNPGM("abled (min temp ", thermalManager.extrude_min_temp, "C)"); + SERIAL_ECHOLN(F("Cold extrudes are "), thermalManager.allow_cold_extrude ? F("en") : F("dis"), F("abled (min temp "), thermalManager.extrude_min_temp, F("C)")); } } diff --git a/Marlin/src/gcode/config/M43.cpp b/Marlin/src/gcode/config/M43.cpp index 7daf8afab8b6e..7657aadc6d858 100644 --- a/Marlin/src/gcode/config/M43.cpp +++ b/Marlin/src/gcode/config/M43.cpp @@ -294,9 +294,7 @@ void GcodeSuite::M43() { // 'E' Enable or disable endstop monitoring and return if (parser.seen('E')) { endstops.monitor_flag = parser.value_bool(); - SERIAL_ECHOPGM("endstop monitor "); - SERIAL_ECHOF(endstops.monitor_flag ? F("en") : F("dis")); - SERIAL_ECHOLNPGM("abled"); + SERIAL_ECHOLN(F("endstop monitor "), endstops.monitor_flag ? F("en") : F("dis"), F("abled")); return; } diff --git a/Marlin/src/gcode/config/M92.cpp b/Marlin/src/gcode/config/M92.cpp index e848665e6b6d1..67f55e2232b02 100644 --- a/Marlin/src/gcode/config/M92.cpp +++ b/Marlin/src/gcode/config/M92.cpp @@ -82,7 +82,7 @@ void GcodeSuite::M92() { if (wanted) { const float best = uint16_t(wanted / z_full_step_mm) * z_full_step_mm; SERIAL_ECHOPGM(", best:[", best); - if (best != wanted) { SERIAL_CHAR(','); SERIAL_DECIMAL(best + z_full_step_mm); } + if (best != wanted) { SERIAL_ECHO(AS_CHAR(','), best + z_full_step_mm); } SERIAL_CHAR(']'); } SERIAL_ECHOLNPGM(" }"); diff --git a/Marlin/src/gcode/control/M80_M81.cpp b/Marlin/src/gcode/control/M80_M81.cpp index 94dd5e3dd93f3..2d3e407446a02 100644 --- a/Marlin/src/gcode/control/M80_M81.cpp +++ b/Marlin/src/gcode/control/M80_M81.cpp @@ -48,7 +48,7 @@ // S: Report the current power supply state and exit if (parser.seen('S')) { - SERIAL_ECHOF(powerManager.psu_on ? F("PS:1\n") : F("PS:0\n")); + SERIAL_ECHO(powerManager.psu_on ? F("PS:1\n") : F("PS:0\n")); return; } diff --git a/Marlin/src/gcode/feature/advance/M900.cpp b/Marlin/src/gcode/feature/advance/M900.cpp index 8c0da41801cc2..28cc4f80472a6 100644 --- a/Marlin/src/gcode/feature/advance/M900.cpp +++ b/Marlin/src/gcode/feature/advance/M900.cpp @@ -120,8 +120,7 @@ void GcodeSuite::M900() { EXTRUDER_LOOP() { const bool slot = TEST(lin_adv_slot, e); SERIAL_ECHOLNPGM("Advance T", e, " S", slot, " K", planner.extruder_advance_K[e], - "(S", !slot, " K", other_extruder_advance_K[e], ")"); - SERIAL_EOL(); + "(S", !slot, " K", other_extruder_advance_K[e], ")"); } #endif @@ -132,10 +131,7 @@ void GcodeSuite::M900() { SERIAL_ECHOLNPGM("Advance K=", planner.extruder_advance_K[0]); #else SERIAL_ECHOPGM("Advance K"); - EXTRUDER_LOOP() { - SERIAL_CHAR(' ', '0' + e, ':'); - SERIAL_DECIMAL(planner.extruder_advance_K[e]); - } + EXTRUDER_LOOP() SERIAL_ECHO(AS_CHAR(' '), AS_CHAR('0' + e), AS_CHAR(':'), planner.extruder_advance_K[e]); SERIAL_EOL(); #endif diff --git a/Marlin/src/gcode/feature/ft_motion/M493.cpp b/Marlin/src/gcode/feature/ft_motion/M493.cpp index 9469f1575b612..f34c6c1bd7f3f 100644 --- a/Marlin/src/gcode/feature/ft_motion/M493.cpp +++ b/Marlin/src/gcode/feature/ft_motion/M493.cpp @@ -74,28 +74,18 @@ void say_shaping() { #if HAS_X_AXIS SERIAL_ECHO_TERNARY(dynamic, "X/A ", "base dynamic", "static", " compensator frequency: "); - SERIAL_ECHO_F(fxdTiCtrl.cfg.baseFreq[X_AXIS], 2); - SERIAL_ECHOPGM("Hz"); + SERIAL_ECHO(p_float_t(fxdTiCtrl.cfg.baseFreq[X_AXIS], 2), F("Hz")); #if HAS_DYNAMIC_FREQ - if (dynamic) { - SERIAL_ECHOPGM(" scaling: "); - SERIAL_ECHO_F(fxdTiCtrl.cfg.dynFreqK[X_AXIS], 8); - serial_ternary(F("Hz/"), z_based, F("mm"), F("g")); - } + if (dynamic) SERIAL_ECHO(" scaling: ", p_float_t(fxdTiCtrl.cfg.dynFreqK[X_AXIS], 8), F("Hz/"), z_based ? F("mm") : F("g")); #endif SERIAL_EOL(); #endif #if HAS_Y_AXIS SERIAL_ECHO_TERNARY(dynamic, "Y/B ", "base dynamic", "static", " compensator frequency: "); - SERIAL_ECHO_F(fxdTiCtrl.cfg.baseFreq[Y_AXIS], 2); - SERIAL_ECHOLNPGM(" Hz"); + SERIAL_ECHO(p_float_t(fxdTiCtrl.cfg.baseFreq[Y_AXIS], 2), F(" Hz")); #if HAS_DYNAMIC_FREQ - if (dynamic) { - SERIAL_ECHOPGM(" scaling: "); - SERIAL_ECHO_F(fxdTiCtrl.cfg.dynFreqK[Y_AXIS], 8); - serial_ternary(F("Hz/"), z_based, F("mm"), F("g")); - } + if (dynamic) SERIAL_ECHO(F(" scaling: "), p_float_t(fxdTiCtrl.cfg.dynFreqK[Y_AXIS], 8), F("Hz/"), z_based ? F("mm") : F("g")); #endif SERIAL_EOL(); #endif @@ -103,10 +93,8 @@ void say_shaping() { #if HAS_EXTRUDERS SERIAL_ECHO_TERNARY(fxdTiCtrl.cfg.linearAdvEna, "Linear Advance ", "en", "dis", "abled"); - SERIAL_ECHOPGM(". Gain: "); SERIAL_ECHO_F(fxdTiCtrl.cfg.linearAdvK, 5); - SERIAL_EOL(); + SERIAL_ECHOLN(F(". Gain: "), p_float_t(fxdTiCtrl.cfg.linearAdvK, 5)); #endif - } void GcodeSuite::M493_report(const bool forReplay/*=true*/) { diff --git a/Marlin/src/gcode/feature/network/M552-M554.cpp b/Marlin/src/gcode/feature/network/M552-M554.cpp index ca7ddd0d360fc..7633ec1fd5324 100644 --- a/Marlin/src/gcode/feature/network/M552-M554.cpp +++ b/Marlin/src/gcode/feature/network/M552-M554.cpp @@ -63,8 +63,7 @@ void ip_report(const uint16_t cmd, FSTR_P const post, const IPAddress &ipo) { SERIAL_ECHO(ipo[i]); if (i < 3) SERIAL_CHAR('.'); } - SERIAL_ECHOPGM(" ; "); - SERIAL_ECHOLNF(post); + SERIAL_ECHOLN(F(" ; "), post); } /** diff --git a/Marlin/src/gcode/feature/pause/G61.cpp b/Marlin/src/gcode/feature/pause/G61.cpp index 0efcfbf208de5..423632e72e0a0 100644 --- a/Marlin/src/gcode/feature/pause/G61.cpp +++ b/Marlin/src/gcode/feature/pause/G61.cpp @@ -87,8 +87,7 @@ void GcodeSuite::G61() { 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)); - DEBUG_ECHO_F(destination[i]); + DEBUG_ECHO(AS_CHAR(' '), AS_CHAR(AXIS_CHAR(i)), p_float_t(destination[i], 2)); } DEBUG_EOL(); // Move to the saved position diff --git a/Marlin/src/gcode/feature/powerloss/M1000.cpp b/Marlin/src/gcode/feature/powerloss/M1000.cpp index 1629a154bce3e..e874c19d5e9ee 100644 --- a/Marlin/src/gcode/feature/powerloss/M1000.cpp +++ b/Marlin/src/gcode/feature/powerloss/M1000.cpp @@ -47,8 +47,7 @@ void menu_job_recovery(); inline void plr_error(FSTR_P const prefix) { #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) DEBUG_ECHO_START(); - DEBUG_ECHOF(prefix); - DEBUG_ECHOLNPGM(" Job Recovery Data"); + DEBUG_ECHOLN(prefix, F(" Job Recovery Data")); #else UNUSED(prefix); #endif diff --git a/Marlin/src/gcode/feature/powerloss/M413.cpp b/Marlin/src/gcode/feature/powerloss/M413.cpp index f6d82b0ad9449..5e508d4f28ae6 100644 --- a/Marlin/src/gcode/feature/powerloss/M413.cpp +++ b/Marlin/src/gcode/feature/powerloss/M413.cpp @@ -50,8 +50,8 @@ void GcodeSuite::M413() { if (parser.seen_test('D')) recovery.debug(F("M413")); if (parser.seen_test('O')) recovery._outage(true); if (parser.seen_test('C')) (void)recovery.check(); - if (parser.seen_test('E')) SERIAL_ECHOF(recovery.exists() ? F("PLR Exists\n") : F("No PLR\n")); - if (parser.seen_test('V')) SERIAL_ECHOF(recovery.valid() ? F("Valid\n") : F("Invalid\n")); + if (parser.seen_test('E')) SERIAL_ECHO(recovery.exists() ? F("PLR Exists\n") : F("No PLR\n")); + if (parser.seen_test('V')) SERIAL_ECHO(recovery.valid() ? F("Valid\n") : F("Invalid\n")); #endif } diff --git a/Marlin/src/gcode/feature/trinamic/M569.cpp b/Marlin/src/gcode/feature/trinamic/M569.cpp index 50ac5c7468711..6f1af7b68155d 100644 --- a/Marlin/src/gcode/feature/trinamic/M569.cpp +++ b/Marlin/src/gcode/feature/trinamic/M569.cpp @@ -35,8 +35,7 @@ template void tmc_say_stealth_status(TMC &st) { st.printLabel(); - SERIAL_ECHOPGM(" driver mode:\t"); - SERIAL_ECHOLNF(st.get_stealthChop() ? F("stealthChop") : F("spreadCycle")); + SERIAL_ECHOLN(F(" driver mode:\t"), st.get_stealthChop() ? F("stealthChop") : F("spreadCycle")); } template void tmc_set_stealthChop(TMC &st, const bool enable) { @@ -161,10 +160,7 @@ void GcodeSuite::M569_report(const bool forReplay/*=true*/) { auto say_M569 = [](const bool forReplay, FSTR_P const etc=nullptr, const bool eol=false) { if (!forReplay) SERIAL_ECHO_START(); SERIAL_ECHOPGM(" M569 S1"); - if (etc) { - SERIAL_CHAR(' '); - SERIAL_ECHOF(etc); - } + if (etc) SERIAL_ECHO(AS_CHAR(' '), etc); if (eol) SERIAL_EOL(); }; diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 01b48a4af92b4..cedcf97c514dd 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -105,8 +105,7 @@ void GcodeSuite::report_heading(const bool forReplay, FSTR_P const fstr, const b if (forReplay) return; if (fstr) { SERIAL_ECHO_START(); - SERIAL_ECHOPGM("; "); - SERIAL_ECHOF(fstr); + SERIAL_ECHO(F("; "), fstr); } if (eol) { SERIAL_CHAR(':'); SERIAL_EOL(); } } @@ -1120,7 +1119,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { if (!no_ok) queue.ok_to_send(); - SERIAL_OUT(msgDone); // Call the msgDone serial hook to signal command processing done + SERIAL_IMPL.msgDone(); // Call the msgDone serial hook to signal command processing done } #if ENABLED(M100_FREE_MEMORY_DUMPER) diff --git a/Marlin/src/gcode/geometry/G17-G19.cpp b/Marlin/src/gcode/geometry/G17-G19.cpp index fbac7470ca2bd..312b89286c276 100644 --- a/Marlin/src/gcode/geometry/G17-G19.cpp +++ b/Marlin/src/gcode/geometry/G17-G19.cpp @@ -29,7 +29,7 @@ inline void report_workspace_plane() { SERIAL_ECHO_START(); SERIAL_ECHOPGM("Workspace Plane "); - SERIAL_ECHOF( + SERIAL_ECHO( gcode.workspace_plane == GcodeSuite::PLANE_YZ ? F("YZ\n") : gcode.workspace_plane == GcodeSuite::PLANE_ZX ? F("ZX\n") : F("XY\n") diff --git a/Marlin/src/gcode/probe/G30.cpp b/Marlin/src/gcode/probe/G30.cpp index 4c044af9d6e7b..43fc27bfc1895 100644 --- a/Marlin/src/gcode/probe/G30.cpp +++ b/Marlin/src/gcode/probe/G30.cpp @@ -100,7 +100,7 @@ void GcodeSuite::G30() { report_current_position(); } else { - SERIAL_ECHOLNF(GET_EN_TEXT_F(MSG_ZPROBE_OUT)); + SERIAL_ECHOLN(GET_EN_TEXT_F(MSG_ZPROBE_OUT)); LCD_MESSAGE(MSG_ZPROBE_OUT); } diff --git a/Marlin/src/gcode/queue.cpp b/Marlin/src/gcode/queue.cpp index 967ab76897f7f..9ce28f781cd85 100644 --- a/Marlin/src/gcode/queue.cpp +++ b/Marlin/src/gcode/queue.cpp @@ -324,7 +324,7 @@ inline int read_serial(const serial_index_t index) { return SERIAL_IMPL.read(ind void GCodeQueue::gcode_line_error(FSTR_P const ferr, const serial_index_t serial_ind) { PORT_REDIRECT(SERIAL_PORTMASK(serial_ind)); // Reply to the serial port that sent the command SERIAL_ERROR_START(); - SERIAL_ECHOLNF(ferr, serial_state[serial_ind.index].last_N); + SERIAL_ECHOLN(ferr, serial_state[serial_ind.index].last_N); while (read_serial(serial_ind) != -1) { /* nada */ } // Clear out the RX buffer. Why don't use flush here ? flush_and_request_resend(serial_ind); serial_state[serial_ind.index].count = 0; diff --git a/Marlin/src/gcode/stats/M31.cpp b/Marlin/src/gcode/stats/M31.cpp index 1a1c13ba2f1a5..a76ec7ee4def6 100644 --- a/Marlin/src/gcode/stats/M31.cpp +++ b/Marlin/src/gcode/stats/M31.cpp @@ -33,7 +33,7 @@ void GcodeSuite::M31() { char buffer[22]; duration_t(print_job_timer.duration()).toString(buffer); - ui.set_status(buffer, ENABLED(DWIN_LCD_PROUI)); + ui.set_status(buffer, ENABLED(DWIN_LCD_PROUI)); // No expire on ProUI SERIAL_ECHO_MSG("Print time: ", buffer); } diff --git a/Marlin/src/gcode/temp/M306.cpp b/Marlin/src/gcode/temp/M306.cpp index 7d2d94952ff08..2830a77ab4fdb 100644 --- a/Marlin/src/gcode/temp/M306.cpp +++ b/Marlin/src/gcode/temp/M306.cpp @@ -92,16 +92,16 @@ void GcodeSuite::M306_report(const bool forReplay/*=true*/) { HOTEND_LOOP() { report_echo_start(forReplay); MPC_t &mpc = thermalManager.temp_hotend[e].mpc; - SERIAL_ECHOPGM(" M306 E", e); - 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); + SERIAL_ECHOPGM(" M306 E", e, + " P", p_float_t(mpc.heater_power, 2), + " C", p_float_t(mpc.block_heat_capacity, 2), + " R", p_float_t(mpc.sensor_responsiveness, 4), + " A", p_float_t(mpc.ambient_xfer_coeff_fan0, 4) + ); #if ENABLED(MPC_INCLUDE_FAN) - SERIAL_ECHOPAIR_F(" F", mpc.fanCoefficient(), 4); + SERIAL_ECHOPGM(" F", p_float_t(mpc.fanCoefficient(), 4)); #endif - SERIAL_ECHOPAIR_F(" H", mpc.filament_heat_capacity_permm, 4); - SERIAL_EOL(); + SERIAL_ECHOLNPGM(" H", p_float_t(mpc.filament_heat_capacity_permm, 4)); } } diff --git a/Marlin/src/gcode/units/M149.cpp b/Marlin/src/gcode/units/M149.cpp index a04247cbcb172..43091b6710e78 100644 --- a/Marlin/src/gcode/units/M149.cpp +++ b/Marlin/src/gcode/units/M149.cpp @@ -38,8 +38,7 @@ void GcodeSuite::M149() { void GcodeSuite::M149_report(const bool forReplay/*=true*/) { report_heading_etc(forReplay, F(STR_TEMPERATURE_UNITS)); - SERIAL_ECHOPGM(" M149 ", AS_CHAR(parser.temp_units_code()), " ; Units in "); - SERIAL_ECHOLNF(parser.temp_units_name()); + SERIAL_ECHOLN(F(" M149 "), AS_CHAR(parser.temp_units_code()), F(" ; Units in "), parser.temp_units_name()); } #endif // TEMPERATURE_UNITS_SUPPORT diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index 683eeb3da217b..4892ff24b1425 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -364,12 +364,12 @@ #define TEMP_SENSOR_0_IS_AD8495 1 #elif TEMP_SENSOR_0 == -1 #define TEMP_SENSOR_0_IS_AD595 1 -#elif TEMP_SENSOR_0 == 998 || TEMP_SENSOR_0 == 999 - #define TEMP_SENSOR_0_IS_DUMMY 1 #elif TEMP_SENSOR_0 > 0 #define TEMP_SENSOR_0_IS_THERMISTOR 1 #if TEMP_SENSOR_0 == 1000 #define TEMP_SENSOR_0_IS_CUSTOM 1 + #elif TEMP_SENSOR_0 == 998 || TEMP_SENSOR_0 == 999 + #define TEMP_SENSOR_0_IS_DUMMY 1 #endif #endif @@ -407,12 +407,12 @@ #define TEMP_SENSOR_1_IS_AD8495 1 #elif TEMP_SENSOR_1 == -1 #define TEMP_SENSOR_1_IS_AD595 1 -#elif TEMP_SENSOR_1 == 998 || TEMP_SENSOR_1 == 999 - #define TEMP_SENSOR_1_IS_DUMMY 1 #elif TEMP_SENSOR_1 > 0 #define TEMP_SENSOR_1_IS_THERMISTOR 1 #if TEMP_SENSOR_1 == 1000 #define TEMP_SENSOR_1_IS_CUSTOM 1 + #elif TEMP_SENSOR_1 == 998 || TEMP_SENSOR_1 == 999 + #define TEMP_SENSOR_1_IS_DUMMY 1 #endif #endif @@ -450,57 +450,57 @@ #define TEMP_SENSOR_2_IS_AD8495 1 #elif TEMP_SENSOR_2 == -1 #define TEMP_SENSOR_2_IS_AD595 1 -#elif TEMP_SENSOR_2 == 998 || TEMP_SENSOR_2 == 999 - #define TEMP_SENSOR_2_IS_DUMMY 1 #elif TEMP_SENSOR_2 > 0 #define TEMP_SENSOR_2_IS_THERMISTOR 1 #if TEMP_SENSOR_2 == 1000 #define TEMP_SENSOR_2_IS_CUSTOM 1 + #elif TEMP_SENSOR_2 == 998 || TEMP_SENSOR_2 == 999 + #define TEMP_SENSOR_2_IS_DUMMY 1 #endif #endif -#if TEMP_SENSOR_3 == 998 || TEMP_SENSOR_3 == 999 - #define TEMP_SENSOR_3_IS_DUMMY 1 -#elif TEMP_SENSOR_3 > 0 +#if TEMP_SENSOR_3 > 0 #define TEMP_SENSOR_3_IS_THERMISTOR 1 #if TEMP_SENSOR_3 == 1000 #define TEMP_SENSOR_3_IS_CUSTOM 1 + #elif TEMP_SENSOR_3 == 998 || TEMP_SENSOR_3 == 999 + #define TEMP_SENSOR_3_IS_DUMMY 1 #endif #endif -#if TEMP_SENSOR_4 == 998 || TEMP_SENSOR_4 == 999 - #define TEMP_SENSOR_4_IS_DUMMY 1 -#elif TEMP_SENSOR_4 > 0 +#if TEMP_SENSOR_4 > 0 #define TEMP_SENSOR_4_IS_THERMISTOR 1 #if TEMP_SENSOR_4 == 1000 #define TEMP_SENSOR_4_IS_CUSTOM 1 + #elif TEMP_SENSOR_4 == 998 || TEMP_SENSOR_4 == 999 + #define TEMP_SENSOR_4_IS_DUMMY 1 #endif #endif -#if TEMP_SENSOR_5 == 998 || TEMP_SENSOR_5 == 999 - #define TEMP_SENSOR_5_IS_DUMMY 1 -#elif TEMP_SENSOR_5 > 0 +#if TEMP_SENSOR_5 > 0 #define TEMP_SENSOR_5_IS_THERMISTOR 1 #if TEMP_SENSOR_5 == 1000 #define TEMP_SENSOR_5_IS_CUSTOM 1 + #elif TEMP_SENSOR_5 == 998 || TEMP_SENSOR_5 == 999 + #define TEMP_SENSOR_5_IS_DUMMY 1 #endif #endif -#if TEMP_SENSOR_6 == 998 || TEMP_SENSOR_6 == 999 - #define TEMP_SENSOR_6_IS_DUMMY 1 -#elif TEMP_SENSOR_6 > 0 +#if TEMP_SENSOR_6 > 0 #define TEMP_SENSOR_6_IS_THERMISTOR 1 #if TEMP_SENSOR_6 == 1000 #define TEMP_SENSOR_6_IS_CUSTOM 1 + #elif TEMP_SENSOR_6 == 998 || TEMP_SENSOR_6 == 999 + #define TEMP_SENSOR_6_IS_DUMMY 1 #endif #endif -#if TEMP_SENSOR_7 == 998 || TEMP_SENSOR_7 == 999 - #define TEMP_SENSOR_7_IS_DUMMY 1 -#elif TEMP_SENSOR_7 > 0 +#if TEMP_SENSOR_7 > 0 #define TEMP_SENSOR_7_IS_THERMISTOR 1 #if TEMP_SENSOR_7 == 1000 #define TEMP_SENSOR_7_IS_CUSTOM 1 + #elif TEMP_SENSOR_7 == 998 || TEMP_SENSOR_7 == 999 + #define TEMP_SENSOR_7_IS_DUMMY 1 #endif #endif @@ -680,12 +680,12 @@ #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_BED." #elif TEMP_SENSOR_BED == -1 #define TEMP_SENSOR_BED_IS_AD595 1 -#elif TEMP_SENSOR_BED == 998 || TEMP_SENSOR_BED == 999 - #define TEMP_SENSOR_BED_IS_DUMMY 1 #elif TEMP_SENSOR_BED > 0 #define TEMP_SENSOR_BED_IS_THERMISTOR 1 #if TEMP_SENSOR_BED == 1000 #define TEMP_SENSOR_BED_IS_CUSTOM 1 + #elif TEMP_SENSOR_BED == 998 || TEMP_SENSOR_BED == 999 + #define TEMP_SENSOR_BED_IS_DUMMY 1 #endif #else #undef BED_MINTEMP @@ -700,12 +700,12 @@ #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_CHAMBER." #elif TEMP_SENSOR_CHAMBER == -1 #define TEMP_SENSOR_CHAMBER_IS_AD595 1 -#elif TEMP_SENSOR_CHAMBER == 998 || TEMP_SENSOR_CHAMBER == 999 - #define TEMP_SENSOR_CHAMBER_IS_DUMMY 1 #elif TEMP_SENSOR_CHAMBER > 0 #define TEMP_SENSOR_CHAMBER_IS_THERMISTOR 1 #if TEMP_SENSOR_CHAMBER == 1000 #define TEMP_SENSOR_CHAMBER_IS_CUSTOM 1 + #elif TEMP_SENSOR_CHAMBER == 998 || TEMP_SENSOR_CHAMBER == 999 + #define TEMP_SENSOR_CHAMBER_IS_DUMMY 1 #endif #else #undef THERMAL_PROTECTION_CHAMBER @@ -742,12 +742,12 @@ #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_PROBE." #elif TEMP_SENSOR_PROBE == -1 #define TEMP_SENSOR_PROBE_IS_AD595 1 -#elif TEMP_SENSOR_PROBE == 998 || TEMP_SENSOR_PROBE == 999 - #define TEMP_SENSOR_PROBE_IS_DUMMY 1 #elif TEMP_SENSOR_PROBE > 0 #define TEMP_SENSOR_PROBE_IS_THERMISTOR 1 #if TEMP_SENSOR_PROBE == 1000 #define TEMP_SENSOR_PROBE_IS_CUSTOM 1 + #elif TEMP_SENSOR_PROBE == 998 || TEMP_SENSOR_PROBE == 999 + #define TEMP_SENSOR_PROBE_IS_DUMMY 1 #endif #endif @@ -759,12 +759,12 @@ #error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_BOARD." #elif TEMP_SENSOR_BOARD == -1 #define TEMP_SENSOR_BOARD_IS_AD595 1 -#elif TEMP_SENSOR_BOARD == 998 || TEMP_SENSOR_BOARD == 999 - #define TEMP_SENSOR_BOARD_IS_DUMMY 1 #elif TEMP_SENSOR_BOARD > 0 #define TEMP_SENSOR_BOARD_IS_THERMISTOR 1 #if TEMP_SENSOR_BOARD == 1000 #define TEMP_SENSOR_BOARD_IS_CUSTOM 1 + #elif TEMP_SENSOR_BOARD == 998 || TEMP_SENSOR_BOARD == 999 + #define TEMP_SENSOR_BOARD_IS_DUMMY 1 #endif #endif diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 6d2bbd6edf229..bc33c20f41b93 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -1815,6 +1815,9 @@ #if ANY_AXIS_HAS(SW_SERIAL) #define HAS_TMC_SW_SERIAL 1 #endif +#ifndef SERIAL_FLOAT_PRECISION + #define SERIAL_FLOAT_PRECISION 2 +#endif #if DISABLED(SENSORLESS_HOMING) #undef SENSORLESS_BACKOFF_MM diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 00b5321205185..ab4b0e4e12626 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -375,7 +375,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #endif #if HAS_LCDPRINT && HAS_EXTRA_PROGRESS && LCD_HEIGHT < 4 - #error "Displays with fewer than 4 rows of text can't show progress values." + #error "Displays with fewer than 4 rows can't show progress values (e.g., SHOW_PROGRESS_PERCENT, SHOW_ELAPSED_TIME, SHOW_REMAINING_TIME, SHOW_INTERACTION_TIME)." #endif #if !HAS_MARLINUI_MENU && ENABLED(SD_REPRINT_LAST_SELECTED_FILE) @@ -1552,6 +1552,9 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #if HAS_MESH && HAS_CLASSIC_JERK static_assert(DEFAULT_ZJERK > 0.1, "Low DEFAULT_ZJERK values are incompatible with mesh-based leveling."); #endif +#if HAS_MESH && DGUS_LCD_UI_IA_CREALITY && GRID_MAX_POINTS > 25 + #error "DGUS_LCD_UI IA_CREALITY requires a mesh with no more than 25 points as defined by GRID_MAX_POINTS_X/Y." +#endif #if ENABLED(G26_MESH_VALIDATION) #if !HAS_EXTRUDERS @@ -3988,8 +3991,8 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive." #endif // Check requirements for upload.py -#if ENABLED(XFER_BUILD) && !ALL(BINARY_FILE_TRANSFER, CUSTOM_FIRMWARE_UPLOAD) - #error "BINARY_FILE_TRANSFER and CUSTOM_FIRMWARE_UPLOAD are required for custom upload." +#if ENABLED(XFER_BUILD) && !ALL(SDSUPPORT, BINARY_FILE_TRANSFER, CUSTOM_FIRMWARE_UPLOAD) + #error "SDSUPPORT, BINARY_FILE_TRANSFER, and CUSTOM_FIRMWARE_UPLOAD are required for custom upload." #endif /** diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index af412a701a912..3300716c83506 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-06-06" + #define STRING_DISTRIBUTION_DATE "2023-06-16" #endif /** diff --git a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp index ba467d1a61c1e..1aa53241ad99a 100644 --- a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp +++ b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp @@ -787,9 +787,10 @@ void MarlinUI::draw_status_message(const bool blink) { #define TPOFFSET (LCD_WIDTH - 1) static uint8_t timepos = TPOFFSET - 6; static char buffer[8]; - static lcd_uint_t pc, pr; #if ENABLED(SHOW_PROGRESS_PERCENT) + static lcd_uint_t pc = 0, pr = 2; + inline void setPercentPos(const lcd_uint_t c, const lcd_uint_t r) { pc = c; pr = r; } void MarlinUI::drawPercent() { const uint8_t progress = ui.get_progress_percent(); if (progress) { @@ -800,6 +801,7 @@ void MarlinUI::draw_status_message(const bool blink) { } } #endif + #if ENABLED(SHOW_REMAINING_TIME) void MarlinUI::drawRemain() { if (printJobOngoing()) { @@ -811,6 +813,7 @@ void MarlinUI::draw_status_message(const bool blink) { } } #endif + #if ENABLED(SHOW_INTERACTION_TIME) void MarlinUI::drawInter() { const duration_t interactt = ui.interaction_time; @@ -822,6 +825,7 @@ void MarlinUI::draw_status_message(const bool blink) { } } #endif + #if ENABLED(SHOW_ELAPSED_TIME) void MarlinUI::drawElapsed() { if (printJobOngoing()) { @@ -947,7 +951,7 @@ void MarlinUI::draw_status_screen() { #if LCD_WIDTH < 20 #if HAS_PRINT_PROGRESS - pc = 0; pr = 2; + TERN_(SHOW_PROGRESS_PERCENT, setPercentPos(0, 2)); rotate_progress(); #endif @@ -1039,7 +1043,7 @@ void MarlinUI::draw_status_screen() { #if LCD_WIDTH >= 20 #if HAS_PRINT_PROGRESS - pc = 6; pr = 2; + TERN_(SHOW_PROGRESS_PERCENT, setPercentPos(6, 2)); rotate_progress(); #else char c; @@ -1122,7 +1126,7 @@ void MarlinUI::draw_status_screen() { _draw_bed_status(blink); #elif HAS_PRINT_PROGRESS #define DREW_PRINT_PROGRESS 1 - pc = 0; pr = 2; + TERN_(SHOW_PROGRESS_PERCENT, setPercentPos(0, 2)); rotate_progress(); #endif @@ -1130,7 +1134,7 @@ void MarlinUI::draw_status_screen() { // All progress strings // #if HAS_PRINT_PROGRESS && !DREW_PRINT_PROGRESS - pc = LCD_WIDTH - 9; pr = 2; + TERN_(SHOW_PROGRESS_PERCENT, setPercentPos(LCD_WIDTH - 9, 2)); rotate_progress(); #endif #endif // LCD_INFO_SCREEN_STYLE 1 diff --git a/Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp b/Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp index 3e173aab6cec0..d16693cee4ee6 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp @@ -305,7 +305,7 @@ static void setWindow(u8g_t *u8g, u8g_dev_t *dev, uint16_t Xmin, uint16_t Ymin, for (uint16_t l = 0; l < UPSCALE0(length); l++) buffer[l + n * UPSCALE0(length)] = buffer[l]; - tftio.WriteSequence(buffer, length * sq(GRAPHICAL_TFT_UPSCALE)); + tftio.writeSequence(buffer, length * sq(GRAPHICAL_TFT_UPSCALE)); #else for (uint8_t i = GRAPHICAL_TFT_UPSCALE; i--;) u8g_WriteSequence(u8g, dev, k << 1, (uint8_t*)buffer); @@ -351,7 +351,7 @@ static void u8g_upscale_clear_lcd(u8g_t *u8g, u8g_dev_t *dev, uint16_t *buffer) setWindow(u8g, dev, 0, 0, (TFT_WIDTH) - 1, (TFT_HEIGHT) - 1); #if HAS_LCD_IO UNUSED(buffer); - tftio.WriteMultiple(TFT_MARLINBG_COLOR, (TFT_WIDTH) * (TFT_HEIGHT)); + tftio.writeMultiple(TFT_MARLINBG_COLOR, (TFT_WIDTH) * (TFT_HEIGHT)); #else memset2(buffer, TFT_MARLINBG_COLOR, (TFT_WIDTH) / 2); for (uint16_t i = 0; i < (TFT_HEIGHT) * sq(GRAPHICAL_TFT_UPSCALE); i++) @@ -381,8 +381,8 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u } if (msgInitCount) return -1; - tftio.Init(); - tftio.InitTFT(); + tftio.init(); + tftio.initTFT(); TERN_(TOUCH_SCREEN_CALIBRATION, touch_calibration.calibration_reset()); u8g_upscale_clear_lcd(u8g, dev, buffer); return 0; @@ -425,7 +425,7 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u for (uint16_t l = 0; l < UPSCALE0(WIDTH); l++) buffer[l + n * UPSCALE0(WIDTH)] = buffer[l]; - tftio.WriteSequence(buffer, COUNT(bufferA)); + tftio.writeSequence(buffer, COUNT(bufferA)); #else uint8_t *bufptr = (uint8_t*) buffer; for (uint8_t i = GRAPHICAL_TFT_UPSCALE; i--;) { @@ -469,19 +469,19 @@ uint8_t u8g_com_hal_tft_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_p break; case U8G_COM_MSG_WRITE_BYTE: - tftio.DataTransferBegin(DATASIZE_8BIT); + tftio.dataTransferBegin(DATASIZE_8BIT); if (isCommand) - tftio.WriteReg(arg_val); + tftio.writeReg(arg_val); else - tftio.WriteData((uint16_t)arg_val); - tftio.DataTransferEnd(); + tftio.writeData((uint16_t)arg_val); + tftio.dataTransferEnd(); break; case U8G_COM_MSG_WRITE_SEQ: - tftio.DataTransferBegin(DATASIZE_16BIT); + tftio.dataTransferBegin(DATASIZE_16BIT); for (uint8_t i = 0; i < arg_val; i += 2) - tftio.WriteData(*(uint16_t *)(((uintptr_t)arg_ptr) + i)); - tftio.DataTransferEnd(); + tftio.writeData(*(uint16_t *)(((uintptr_t)arg_ptr) + i)); + tftio.dataTransferEnd(); break; } @@ -494,9 +494,9 @@ U8G_PB_DEV(u8g_dev_tft_320x240_upscale_from_128x64, WIDTH, HEIGHT, PAGE_HEIGHT, static void drawCross(uint16_t x, uint16_t y, uint16_t color) { tftio.set_window(x - 15, y, x + 15, y); - tftio.WriteMultiple(color, 31); + tftio.writeMultiple(color, 31); tftio.set_window(x, y - 15, x, y + 15); - tftio.WriteMultiple(color, 31); + tftio.writeMultiple(color, 31); } void MarlinUI::touch_calibration_screen() { @@ -508,7 +508,7 @@ U8G_PB_DEV(u8g_dev_tft_320x240_upscale_from_128x64, WIDTH, HEIGHT, PAGE_HEIGHT, defer_status_screen(true); stage = touch_calibration.calibration_start(); tftio.set_window(0, 0, (TFT_WIDTH) - 1, (TFT_HEIGHT) - 1); - tftio.WriteMultiple(TFT_MARLINBG_COLOR, uint32_t(TFT_WIDTH) * (TFT_HEIGHT)); + tftio.writeMultiple(TFT_MARLINBG_COLOR, uint32_t(TFT_WIDTH) * (TFT_HEIGHT)); } else { // clear last cross diff --git a/Marlin/src/lcd/e3v2/creality/dwin.cpp b/Marlin/src/lcd/e3v2/creality/dwin.cpp index af3d1eaeb8fa8..3143a41861ba9 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.cpp +++ b/Marlin/src/lcd/e3v2/creality/dwin.cpp @@ -128,8 +128,8 @@ constexpr uint16_t MROWS = TROWS - 1, // Last Row Index #define DWIN_RIGHT (DWIN_WIDTH-1) // Value Init -HMI_value_t HMI_ValueStruct; -HMI_flag_t HMI_flag{0}; +hmi_value_t hmiValues; +hmi_flag_t hmiFlag{0}; millis_t dwin_heat_time = 0; @@ -194,206 +194,207 @@ static uint16_t _remain_time = 0; #define DWIN_LANGUAGE_EEPROM_ADDRESS 0x01 // Between 0x01 and 0x63 (EEPROM_OFFSET-1) // BL24CXX::check() uses 0x00 -inline bool HMI_IsChinese() { return HMI_flag.language == DWIN_CHINESE; } +inline bool hmiIsChinese() { return hmiFlag.language == DWIN_CHINESE; } -void HMI_SetLanguageCache() { - DWIN_JPG_CacheTo1(HMI_IsChinese() ? Language_Chinese : Language_English); +void hmiSetLanguageCache() { + dwinJPGCacheTo1(hmiIsChinese() ? Language_Chinese : Language_English); } -void HMI_SetLanguage() { + +void hmiSetLanguage() { #if ALL(EEPROM_SETTINGS, IIC_BL24CXX_EEPROM) - BL24CXX::read(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&HMI_flag.language, sizeof(HMI_flag.language)); + BL24CXX::read(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&hmiFlag.language, sizeof(hmiFlag.language)); #endif - HMI_SetLanguageCache(); + hmiSetLanguageCache(); } -void HMI_ToggleLanguage() { - HMI_flag.language = HMI_IsChinese() ? DWIN_ENGLISH : DWIN_CHINESE; - HMI_SetLanguageCache(); +void hmiToggleLanguage() { + hmiFlag.language = hmiIsChinese() ? DWIN_ENGLISH : DWIN_CHINESE; + hmiSetLanguageCache(); #if ALL(EEPROM_SETTINGS, IIC_BL24CXX_EEPROM) - BL24CXX::write(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&HMI_flag.language, sizeof(HMI_flag.language)); + BL24CXX::write(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&hmiFlag.language, sizeof(hmiFlag.language)); #endif } typedef struct { uint16_t x, y, w, h; } icon_info_t; typedef struct { uint16_t x, y[2], w, h; } text_info_t; -void ICON_Button(const bool here, const int iconid, const icon_info_t &ico, const text_info_t (&txt)[2]) { - const bool cn = HMI_IsChinese(); - DWIN_ICON_Show(ICON, iconid + here, ico.x, ico.y); - if (here) DWIN_Draw_Rectangle(0, Color_White, ico.x, ico.y, ico.x + ico.w - 1, ico.y + ico.h - 1); - DWIN_Frame_AreaCopy(1, txt[cn].x, txt[cn].y[here], txt[cn].x + txt[cn].w - 1, txt[cn].y[here] + txt[cn].h - 1, ico.x + (ico.w - txt[cn].w) / 2, (ico.y + ico.h - 28) - txt[cn].h/2); +void iconButton(const bool here, const int iconid, const icon_info_t &ico, const text_info_t (&txt)[2]) { + const bool cn = hmiIsChinese(); + dwinIconShow(ICON, iconid + here, ico.x, ico.y); + if (here) dwinDrawRectangle(0, Color_White, ico.x, ico.y, ico.x + ico.w - 1, ico.y + ico.h - 1); + dwinFrameAreaCopy(1, txt[cn].x, txt[cn].y[here], txt[cn].x + txt[cn].w - 1, txt[cn].y[here] + txt[cn].h - 1, ico.x + (ico.w - txt[cn].w) / 2, (ico.y + ico.h - 28) - txt[cn].h/2); } // // Main Menu: "Print" // -void ICON_Print() { +void iconPrint() { constexpr icon_info_t ico = { 17, 110, 110, 100 }; constexpr text_info_t txt[2] = { { 1, { 417, 449 }, 30, 14 }, { 1, { 405, 447 }, 27, 15 } }; - ICON_Button(select_page.now == PAGE_PRINT, ICON_Print_0, ico, txt); + iconButton(select_page.now == PAGE_PRINT, ICON_Print_0, ico, txt); } // // Main Menu: "Prepare" // -void ICON_Prepare() { +void iconPrepare() { constexpr icon_info_t ico = { 145, 110, 110, 100 }; constexpr text_info_t txt[2] = { { 33, { 417, 449 }, 51, 14 }, { 31, { 405, 447 }, 27, 15 } }; - ICON_Button(select_page.now == PAGE_PREPARE, ICON_Prepare_0, ico, txt); + iconButton(select_page.now == PAGE_PREPARE, ICON_Prepare_0, ico, txt); } // // Main Menu: "Control" // -void ICON_Control() { +void iconControl() { constexpr icon_info_t ico = { 17, 226, 110, 100 }; constexpr text_info_t txt[2] = { { 85, { 417, 449 }, 46, 14 }, { 61, { 405, 447 }, 27, 15 } }; - ICON_Button(select_page.now == PAGE_CONTROL, ICON_Control_0, ico, txt); + iconButton(select_page.now == PAGE_CONTROL, ICON_Control_0, ico, txt); } // // Main Menu: "Info" // -void ICON_StartInfo() { +void iconStartInfo() { constexpr icon_info_t ico = { 145, 226, 110, 100 }; constexpr text_info_t txt[2] = { { 133, { 417, 449 }, 23, 14 }, { 91, { 405, 447 }, 27, 15 } }; - ICON_Button(select_page.now == PAGE_INFO_LEVELING, ICON_Info_0, ico, txt); + iconButton(select_page.now == PAGE_INFO_LEVELING, ICON_Info_0, ico, txt); } // // Main Menu: "Level" // -void ICON_Leveling() { +void iconLeveling() { constexpr icon_info_t ico = { 145, 226, 110, 100 }; constexpr text_info_t txt[2] = { { 88, { 433, 464 }, 36, 14 }, { 211, { 405, 447 }, 27, 15 } }; - ICON_Button(select_page.now == PAGE_INFO_LEVELING, ICON_Leveling_0, ico, txt); + iconButton(select_page.now == PAGE_INFO_LEVELING, ICON_Leveling_0, ico, txt); } // // Printing: "Tune" // -void ICON_Tune() { +void iconTune() { constexpr icon_info_t ico = { 8, 232, 80, 100 }; constexpr text_info_t txt[2] = { { 0, { 433, 464 }, 32, 14 }, { 121, { 405, 447 }, 27, 15 } }; - ICON_Button(select_print.now == PRINT_SETUP, ICON_Setup_0, ico, txt); + iconButton(select_print.now == PRINT_SETUP, ICON_Setup_0, ico, txt); } // // Printing: "Pause" // -void ICON_Pause() { +void iconPause() { constexpr icon_info_t ico = { 96, 232, 80, 100 }; constexpr text_info_t txt[2] = { { 157, { 417, 449 }, 39, 14 }, { 181, { 405, 447 }, 27, 15 } }; - ICON_Button(select_print.now == PRINT_PAUSE_RESUME, ICON_Pause_0, ico, txt); + iconButton(select_print.now == PRINT_PAUSE_RESUME, ICON_Pause_0, ico, txt); } // // Printing: "Resume" // -void ICON_Resume() { +void iconResume() { constexpr icon_info_t ico = { 96, 232, 80, 100 }; constexpr text_info_t txt[2] = { { 33, { 433, 464 }, 53, 14 }, { 1, { 405, 447 }, 27, 15 } }; - ICON_Button(select_print.now == PRINT_PAUSE_RESUME, ICON_Continue_0, ico, txt); + iconButton(select_print.now == PRINT_PAUSE_RESUME, ICON_Continue_0, ico, txt); } -void ICON_ResumeOrPause() { - if (printingIsPaused() || HMI_flag.pause_flag || HMI_flag.pause_action) - ICON_Resume(); +void iconResumeOrPause() { + if (printingIsPaused() || hmiFlag.pause_flag || hmiFlag.pause_action) + iconResume(); else - ICON_Pause(); + iconPause(); } // // Printing: "Stop" // -void ICON_Stop() { +void iconStop() { constexpr icon_info_t ico = { 184, 232, 80, 100 }; constexpr text_info_t txt[2] = { { 196, { 417, 449 }, 29, 14 }, { 151, { 405, 447 }, 27, 12 } }; - ICON_Button(select_print.now == PRINT_STOP, ICON_Stop_0, ico, txt); + iconButton(select_print.now == PRINT_STOP, ICON_Stop_0, ico, txt); } -inline void Clear_Title_Bar() { - DWIN_Draw_Box(1, Color_Bg_Blue, 0, 0, DWIN_WIDTH, TITLE_HEIGHT); +inline void clearTitleBar() { + dwinDrawBox(1, Color_Bg_Blue, 0, 0, DWIN_WIDTH, TITLE_HEIGHT); } -void Draw_Title(FSTR_P ftitle) { - DWIN_Draw_String(false, DWIN_FONT_HEAD, Color_White, Color_Bg_Blue, 14, 4, ftitle); +void drawTitle(FSTR_P ftitle) { + dwinDrawString(false, DWIN_FONT_HEAD, Color_White, Color_Bg_Blue, 14, 4, ftitle); } -inline void Clear_Menu_Area() { - DWIN_Draw_Box(1, Color_Bg_Black, 0, TITLE_HEIGHT, DWIN_WIDTH, STATUS_Y - TITLE_HEIGHT); +inline void clearMenuArea() { + dwinDrawBox(1, Color_Bg_Black, 0, TITLE_HEIGHT, DWIN_WIDTH, STATUS_Y - TITLE_HEIGHT); } -void Clear_Main_Window() { - Clear_Title_Bar(); - Clear_Menu_Area(); +void clearMainWindow() { + clearTitleBar(); + clearMenuArea(); } -void Clear_Popup_Area() { - Clear_Title_Bar(); - DWIN_Draw_Rectangle(1, Color_Bg_Black, 0, 31, DWIN_WIDTH, DWIN_HEIGHT); +void clearPopupArea() { + clearTitleBar(); + dwinDrawRectangle(1, Color_Bg_Black, 0, 31, DWIN_WIDTH, DWIN_HEIGHT); } -void Draw_Popup_Bkgd_105() { - DWIN_Draw_Rectangle(1, Color_Bg_Window, 14, 105, 258, 374); +void drawPopupBkgd105() { + dwinDrawRectangle(1, Color_Bg_Window, 14, 105, 258, 374); } -void Draw_More_Icon(const uint8_t line) { - DWIN_ICON_Show(ICON, ICON_More, 226, MBASE(line) - 3); +void drawMoreIcon(const uint8_t line) { + dwinIconShow(ICON, ICON_More, 226, MBASE(line) - 3); } -void Draw_Menu_Cursor(const uint8_t line) { - //DWIN_ICON_Show(ICON, ICON_Rectangle, 0, MBASE(line) - 18); - DWIN_Draw_Rectangle(1, Rectangle_Color, 0, MBASE(line) - 18, 14, MBASE(line + 1) - 20); +void drawMenuCursor(const uint8_t line) { + //dwinIconShow(ICON, ICON_Rectangle, 0, MBASE(line) - 18); + dwinDrawRectangle(1, Rectangle_Color, 0, MBASE(line) - 18, 14, MBASE(line + 1) - 20); } -void Erase_Menu_Cursor(const uint8_t line) { - DWIN_Draw_Rectangle(1, Color_Bg_Black, 0, MBASE(line) - 18, 14, MBASE(line + 1) - 20); +void eraseMenuCursor(const uint8_t line) { + dwinDrawRectangle(1, Color_Bg_Black, 0, MBASE(line) - 18, 14, MBASE(line + 1) - 20); } -void Move_Highlight(const int16_t from, const uint16_t newline) { - Erase_Menu_Cursor(newline - from); - Draw_Menu_Cursor(newline); +void moveHighlight(const int16_t from, const uint16_t newline) { + eraseMenuCursor(newline - from); + drawMenuCursor(newline); } -void Add_Menu_Line() { - Move_Highlight(1, MROWS); - DWIN_Draw_Line(Line_Color, 16, MBASE(MROWS + 1) - 20, 256, MBASE(MROWS + 1) - 19); +void addMenuLine() { + moveHighlight(1, MROWS); + dwinDrawLine(Line_Color, 16, MBASE(MROWS + 1) - 20, 256, MBASE(MROWS + 1) - 19); } -void Scroll_Menu(const uint8_t dir) { - DWIN_Frame_AreaMove(1, dir, MLINE, Color_Bg_Black, 0, 31, DWIN_WIDTH, 349); +void scrollMenu(const uint8_t dir) { + dwinFrameAreaMove(1, dir, MLINE, Color_Bg_Black, 0, 31, DWIN_WIDTH, 349); switch (dir) { - case DWIN_SCROLL_DOWN: Move_Highlight(-1, 0); break; - case DWIN_SCROLL_UP: Add_Menu_Line(); break; + case DWIN_SCROLL_DOWN: moveHighlight(-1, 0); break; + case DWIN_SCROLL_UP: addMenuLine(); break; } } @@ -401,61 +402,61 @@ inline uint16_t nr_sd_menu_items() { return card.get_num_items() + !card.flag.workDirIsRoot; } -void Erase_Menu_Text(const uint8_t line) { - DWIN_Draw_Rectangle(1, Color_Bg_Black, LBLX, MBASE(line) - 14, 271, MBASE(line) + 28); +void eraseMenuText(const uint8_t line) { + dwinDrawRectangle(1, Color_Bg_Black, LBLX, MBASE(line) - 14, 271, MBASE(line) + 28); } -void Draw_Menu_Icon(const uint8_t line, const uint8_t icon) { - DWIN_ICON_Show(ICON, icon, 26, MBASE(line) - 3); +void drawMenuIcon(const uint8_t line, const uint8_t icon) { + dwinIconShow(ICON, icon, 26, MBASE(line) - 3); } -void _Decorate_Menu_Item(const uint8_t line, const uint8_t icon, bool more) { - if (icon) Draw_Menu_Icon(line, icon); - if (more) Draw_More_Icon(line); +void _decorateMenuItem(const uint8_t line, const uint8_t icon, bool more) { + if (icon) drawMenuIcon(line, icon); + if (more) drawMoreIcon(line); } -void Draw_Menu_Item(const uint8_t line, const uint8_t icon=0, const char * const label=nullptr, bool more=false) { - if (label) DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(line) - 1, (char*)label); - _Decorate_Menu_Item(line, icon, more); +void drawMenuItem(const uint8_t line, const uint8_t icon=0, const char * const label=nullptr, bool more=false) { + if (label) dwinDrawString(false, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(line) - 1, (char*)label); + _decorateMenuItem(line, icon, more); } -void Draw_Menu_Item(const uint8_t line, const uint8_t icon=0, FSTR_P const flabel=nullptr, bool more=false) { - if (flabel) DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(line) - 1, flabel); - _Decorate_Menu_Item(line, icon, more); +void drawMenuItem(const uint8_t line, const uint8_t icon=0, FSTR_P const flabel=nullptr, bool more=false) { + if (flabel) dwinDrawString(false, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(line) - 1, flabel); + _decorateMenuItem(line, icon, more); } -void Draw_Menu_Line(const uint8_t line, const uint8_t icon=0, const char * const label=nullptr, bool more=false) { - Draw_Menu_Item(line, icon, label, more); - DWIN_Draw_Line(Line_Color, 16, MBASE(line) + 33, 256, MBASE(line) + 34); +void drawMenuLine(const uint8_t line, const uint8_t icon=0, const char * const label=nullptr, bool more=false) { + drawMenuItem(line, icon, label, more); + dwinDrawLine(Line_Color, 16, MBASE(line) + 33, 256, MBASE(line) + 34); } -void Draw_Menu_Line(const uint8_t line, const uint8_t icon, FSTR_P const flabel, bool more=false) { - Draw_Menu_Item(line, icon, flabel, more); - DWIN_Draw_Line(Line_Color, 16, MBASE(line) + 33, 256, MBASE(line) + 34); +void drawMenuLine(const uint8_t line, const uint8_t icon, FSTR_P const flabel, bool more=false) { + drawMenuItem(line, icon, flabel, more); + dwinDrawLine(Line_Color, 16, MBASE(line) + 33, 256, MBASE(line) + 34); } -void Draw_Checkbox_Line(const uint8_t line, const bool ison) { +void drawCheckboxLine(const uint8_t line, const bool ison) { const uint16_t x = 225, y = EBASE(line) - 2; - DWIN_Draw_String(true, font8x16, Color_White, Color_Bg_Black, x + 5, y, ison ? F("X") : F(" ")); - DWIN_Draw_Rectangle(0, Color_White, x + 2, y + 2, x + 16, y + 16); + dwinDrawString(true, font8x16, Color_White, Color_Bg_Black, x + 5, y, ison ? F("X") : F(" ")); + dwinDrawRectangle(0, Color_White, x + 2, y + 2, x + 16, y + 16); } // AreaCopy for a Menu Item -void Item_AreaCopy(const uint16_t x1, const uint16_t y1, const uint16_t x2, const uint16_t y2, const uint8_t row=0, const uint16_t inset=0, const uint16_t yadd=0) { - DWIN_Frame_AreaCopy(1, x1, y1, x2, y2, LBLX + inset, MBASE(row) + yadd); +void itemAreaCopy(const uint16_t x1, const uint16_t y1, const uint16_t x2, const uint16_t y2, const uint8_t row=0, const uint16_t inset=0, const uint16_t yadd=0) { + dwinFrameAreaCopy(1, x1, y1, x2, y2, LBLX + inset, MBASE(row) + yadd); } // AreaCopy for a Screen Title -void DWIN_Frame_TitleCopy(const uint16_t x1, const uint16_t y1, const uint16_t w, const uint16_t h) { - DWIN_Frame_AreaCopy(1, x1, y1, x1 + w - 1, y1 + h - 1, (DWIN_WIDTH - w) / 2, (TITLE_HEIGHT - h) / 2); +void dwinFrameTitleCopy(const uint16_t x1, const uint16_t y1, const uint16_t w, const uint16_t h) { + dwinFrameAreaCopy(1, x1, y1, x1 + w - 1, y1 + h - 1, (DWIN_WIDTH - w) / 2, (TITLE_HEIGHT - h) / 2); } // Draw "Back" line at the top -void Draw_Back_First(const bool is_sel=true) { - Draw_Menu_Line(0, ICON_Back); - if (HMI_IsChinese()) - Item_AreaCopy(129, 72, 156, 84); +void drawBackFirst(const bool is_sel=true) { + drawMenuLine(0, ICON_Back); + if (hmiIsChinese()) + itemAreaCopy(129, 72, 156, 84); else - Item_AreaCopy(223, 179, 254, 189); - if (is_sel) Draw_Menu_Cursor(0); + itemAreaCopy(223, 179, 254, 189); + if (is_sel) drawMenuCursor(0); } // @@ -520,323 +521,323 @@ void Draw_Back_First(const bool is_sel=true) { // void say_move_en(const uint8_t row) { - Item_AreaCopy( 69, 61, 102, 71, row); // "Move" + itemAreaCopy( 69, 61, 102, 71, row); // "Move" } void say_max_en(const uint8_t row) { - Item_AreaCopy( 75, 119, 100, 129, row); // "Max" + itemAreaCopy( 75, 119, 100, 129, row); // "Max" } void say_jerk_en(const uint8_t row) { - Item_AreaCopy(104, 119, 128, 129, row, 30); // "Jerk" + itemAreaCopy(104, 119, 128, 129, row, 30); // "Jerk" } void say_speed_en(const uint16_t inset, const uint8_t row) { - Item_AreaCopy(133, 119, 172, 132, row, inset); // "Speed" + itemAreaCopy(133, 119, 172, 132, row, inset); // "Speed" } void say_max_accel_en(const uint8_t row) { say_max_en(row); // "Max" - Item_AreaCopy( 0, 135, 79, 145, row, 30); // "Acceleration" + itemAreaCopy( 0, 135, 79, 145, row, 30); // "Acceleration" } void say_max_jerk_speed_en(const uint8_t row) { - Item_AreaCopy( 75, 119, 172, 132, row); // "Max Jerk Speed" + itemAreaCopy( 75, 119, 172, 132, row); // "Max Jerk Speed" } void say_x_en(const uint16_t inset, const uint8_t row) { - Item_AreaCopy(175, 119, 184, 129, row, inset); // "X" + itemAreaCopy(175, 119, 184, 129, row, inset); // "X" } void say_y_en(const uint16_t inset, const uint8_t row) { - Item_AreaCopy(184, 119, 192, 129, row, inset); // "Y" + itemAreaCopy(184, 119, 192, 129, row, inset); // "Y" } void say_z_en(const uint16_t inset, const uint8_t row) { - Item_AreaCopy(193, 119, 201, 129, row, inset); // "Z" + itemAreaCopy(193, 119, 201, 129, row, inset); // "Z" } void say_e_en(const uint16_t inset, const uint8_t row) { - Item_AreaCopy(201, 119, 209, 129, row, inset); // "E" + itemAreaCopy(201, 119, 209, 129, row, inset); // "E" } void say_pla_en(const uint16_t inset, const uint8_t row) { - Item_AreaCopy(131, 164, 153, 174, row, inset); // "PLA" + itemAreaCopy(131, 164, 153, 174, row, inset); // "PLA" } void say_abs_en(const uint16_t inset, const uint8_t row) { - Item_AreaCopy(157, 76, 181, 86, row, inset); // "ABS" + itemAreaCopy(157, 76, 181, 86, row, inset); // "ABS" } void say_home_offs_en(const uint8_t row) { - Item_AreaCopy(153, 193, 225, 203, row); // "Home Offset" + itemAreaCopy(153, 193, 225, 203, row); // "Home Offset" } void say_probe_offs_en(const uint8_t row) { - Item_AreaCopy(153, 205, 225, 215, row); // "Probe Offset" + itemAreaCopy(153, 205, 225, 215, row); // "Probe Offset" } void say_steps_per_mm_en(const uint8_t row) { - Item_AreaCopy( 1, 151, 91, 161, row); // "Steps-per-mm" + itemAreaCopy( 1, 151, 91, 161, row); // "Steps-per-mm" } -void DWIN_Draw_Label(const uint8_t row, char *string) { - DWIN_Draw_String(true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(row), string); +void dwinDrawLabel(const uint8_t row, char *string) { + dwinDrawString(true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(row), string); } -void DWIN_Draw_Label(const uint8_t row, FSTR_P title) { - DWIN_Draw_Label(row, (char*)title); +void dwinDrawLabel(const uint8_t row, FSTR_P title) { + dwinDrawLabel(row, (char*)title); } -void DWIN_Draw_Signed_Float(uint8_t size, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, int32_t value) { - DWIN_Draw_String(true, size, Color_White, bColor, x - 8, y, value < 0 ? F("-") : F(" ")); - DWIN_Draw_FloatValue(true, true, 0, size, Color_White, bColor, iNum, fNum, x, y, value < 0 ? -value : value); +void dwinDrawSigned_Float(uint8_t size, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, int32_t value) { + dwinDrawString(true, size, Color_White, bColor, x - 8, y, value < 0 ? F("-") : F(" ")); + dwinDrawFloatValue(true, true, 0, size, Color_White, bColor, iNum, fNum, x, y, value < 0 ? -value : value); } -void Draw_Edit_Integer3(const uint8_t row, const uint16_t value, const bool active=false) { - DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, active ? Select_Color : Color_Bg_Black, 3, 220, EBASE(row), value); +void drawEditInteger3(const uint8_t row, const uint16_t value, const bool active=false) { + dwinDrawIntValue(true, true, 0, font8x16, Color_White, active ? Select_Color : Color_Bg_Black, 3, 220, EBASE(row), value); } -void Draw_Edit_Integer4(const uint8_t row, const uint16_t value, const bool active=false) { - DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, active ? Select_Color : Color_Bg_Black, 4, 220 - 1 * 8, EBASE(row), value); +void drawEditInteger4(const uint8_t row, const uint16_t value, const bool active=false) { + dwinDrawIntValue(true, true, 0, font8x16, Color_White, active ? Select_Color : Color_Bg_Black, 4, 220 - 1 * 8, EBASE(row), value); } -void Draw_Edit_Float3(const uint8_t row, const uint16_t value, const bool active=false) { - DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, active ? Select_Color : Color_Bg_Black, 3, UNITFDIGITS, 220 - UNITFDIGITS * 8, EBASE(row), (int32_t)value); +void drawEditFloat3(const uint8_t row, const uint16_t value, const bool active=false) { + dwinDrawFloatValue(true, true, 0, font8x16, Color_White, active ? Select_Color : Color_Bg_Black, 3, UNITFDIGITS, 220 - UNITFDIGITS * 8, EBASE(row), (int32_t)value); } -void Draw_Edit_Signed_Float2(const uint8_t row, const float value, const bool active=false) { - DWIN_Draw_Signed_Float(font8x16, active ? Select_Color : Color_Bg_Black, 2, UNITFDIGITS + 1, 220 + 8 - UNITFDIGITS * 8, EBASE(row), value); +void drawEditSignedFloat2(const uint8_t row, const float value, const bool active=false) { + dwinDrawSigned_Float(font8x16, active ? Select_Color : Color_Bg_Black, 2, UNITFDIGITS + 1, 220 + 8 - UNITFDIGITS * 8, EBASE(row), value); } -void Draw_Edit_Signed_Float3(const uint8_t row, const float value, const bool active=false) { - DWIN_Draw_Signed_Float(font8x16, active ? Select_Color : Color_Bg_Black, 3, UNITFDIGITS, 220 - UNITFDIGITS * 8, EBASE(row), value); +void drawEditSignedFloat3(const uint8_t row, const float value, const bool active=false) { + dwinDrawSigned_Float(font8x16, active ? Select_Color : Color_Bg_Black, 3, UNITFDIGITS, 220 - UNITFDIGITS * 8, EBASE(row), value); } -void Draw_Stat_Int(const uint16_t xpos, const uint16_t ypos, const uint16_t value) { - DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, xpos, ypos, value); +void drawStatInt(const uint16_t xpos, const uint16_t ypos, const uint16_t value) { + dwinDrawIntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, xpos, ypos, value); } -void Draw_Stat_Float(const uint16_t xpos, const uint16_t ypos, const float value) { - DWIN_Draw_FloatValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 2, 2, xpos, ypos, value); +void drawStatFloat(const uint16_t xpos, const uint16_t ypos, const float value) { + dwinDrawFloatValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 2, 2, xpos, ypos, value); } // // Prepare Menu // -void Item_Prepare_Move(const uint8_t row) { - if (HMI_IsChinese()) - Item_AreaCopy(159, 70, 200, 84, row); +void itemPrepareMove(const uint8_t row) { + if (hmiIsChinese()) + itemAreaCopy(159, 70, 200, 84, row); else say_move_en(row); // "Move" - Draw_Menu_Line(row, ICON_Axis); - Draw_More_Icon(row); + drawMenuLine(row, ICON_Axis); + drawMoreIcon(row); } -void Item_Prepare_Disable(const uint8_t row) { - if (HMI_IsChinese()) - Item_AreaCopy(204, 70, 259, 82, row); +void itemPrepareDisable(const uint8_t row) { + if (hmiIsChinese()) + itemAreaCopy(204, 70, 259, 82, row); else { #ifdef USE_STRING_TITLES - DWIN_Draw_Label(row, GET_TEXT_F(MSG_DISABLE_STEPPERS)); + dwinDrawLabel(row, GET_TEXT_F(MSG_DISABLE_STEPPERS)); #else - Item_AreaCopy(104, 61, 191, 74, row); // "Disable Stepper" + itemAreaCopy(104, 61, 191, 74, row); // "Disable Stepper" #endif } - Draw_Menu_Line(row, ICON_CloseMotor); + drawMenuLine(row, ICON_CloseMotor); } -void Item_Prepare_Home(const uint8_t row) { - if (HMI_IsChinese()) - Item_AreaCopy(0, 89, 41, 101, row); +void itemPrepareHome(const uint8_t row) { + if (hmiIsChinese()) + itemAreaCopy(0, 89, 41, 101, row); else { #ifdef USE_STRING_TITLES - DWIN_Draw_Label(row, GET_TEXT_F(MSG_AUTO_HOME)); + dwinDrawLabel(row, GET_TEXT_F(MSG_AUTO_HOME)); #else - Item_AreaCopy(202, 61, 271, 71, row); // "Auto Home" + itemAreaCopy(202, 61, 271, 71, row); // "Auto Home" #endif } - Draw_Menu_Line(row, ICON_Homing); + drawMenuLine(row, ICON_Homing); } #if HAS_ZOFFSET_ITEM - void Item_Prepare_Offset(const uint8_t row) { - if (HMI_IsChinese()) { + void itemPrepareOffset(const uint8_t row) { + if (hmiIsChinese()) { #if HAS_BED_PROBE - Item_AreaCopy(174, 164, 223, 177, row); + itemAreaCopy(174, 164, 223, 177, row); #else - Item_AreaCopy(43, 89, 98, 101, row); + itemAreaCopy(43, 89, 98, 101, row); #endif } else { #if HAS_BED_PROBE #ifdef USE_STRING_TITLES - DWIN_Draw_Label(row, GET_TEXT_F(MSG_ZPROBE_ZOFFSET)); + dwinDrawLabel(row, GET_TEXT_F(MSG_ZPROBE_ZOFFSET)); #else - Item_AreaCopy( 94, 179, 143, 190, row); // "Z-Offset" + itemAreaCopy( 94, 179, 143, 190, row); // "Z-Offset" #endif #else #ifdef USE_STRING_TITLES - DWIN_Draw_Label(row, GET_TEXT_F(MSG_SET_HOME_OFFSETS)); + dwinDrawLabel(row, GET_TEXT_F(MSG_SET_HOME_OFFSETS)); #else - Item_AreaCopy( 1, 76, 103, 87, row); // "Set home offsets" + itemAreaCopy( 1, 76, 103, 87, row); // "Set home offsets" #endif #endif } - Draw_Edit_Signed_Float2(row, BABY_Z_VAR * 100); - Draw_Menu_Line(row, ICON_SetHome); + drawEditSignedFloat2(row, BABY_Z_VAR * 100); + drawMenuLine(row, ICON_SetHome); } #endif #if HAS_PREHEAT - void Item_Prepare_PLA(const uint8_t row) { - if (HMI_IsChinese()) - Item_AreaCopy(100, 89, 151, 101, row); + void itemPrepare_PLA(const uint8_t row) { + if (hmiIsChinese()) + itemAreaCopy(100, 89, 151, 101, row); else { #ifdef USE_STRING_TITLES - DWIN_Draw_Label(row, GET_TEXT_F(MSG_PREHEAT_1)); + dwinDrawLabel(row, GET_TEXT_F(MSG_PREHEAT_1)); #else - Item_AreaCopy(108, 76, 155, 87, row); // "Preheat" + itemAreaCopy(108, 76, 155, 87, row); // "Preheat" say_pla_en(52, row); // "PLA" #endif } - Draw_Menu_Line(row, ICON_PLAPreheat); + drawMenuLine(row, ICON_PLAPreheat); } #if PREHEAT_COUNT > 1 - void Item_Prepare_ABS(const uint8_t row) { - if (HMI_IsChinese()) - Item_AreaCopy(180, 89, 233, 100, row); + void itemPrepare_ABS(const uint8_t row) { + if (hmiIsChinese()) + itemAreaCopy(180, 89, 233, 100, row); else { #ifdef USE_STRING_TITLES - DWIN_Draw_Label(row, F("Preheat " PREHEAT_2_LABEL)); + dwinDrawLabel(row, F("Preheat " PREHEAT_2_LABEL)); #else - Item_AreaCopy(108, 76, 155, 87, row); // "Preheat" + itemAreaCopy(108, 76, 155, 87, row); // "Preheat" say_abs_en(52, row); // "ABS" #endif } - Draw_Menu_Line(row, ICON_ABSPreheat); + drawMenuLine(row, ICON_ABSPreheat); } #endif - void Item_Prepare_Cool(const uint8_t row) { - if (HMI_IsChinese()) - Item_AreaCopy(1, 104, 56, 117, row); + void itemPrepareCool(const uint8_t row) { + if (hmiIsChinese()) + itemAreaCopy(1, 104, 56, 117, row); else { #ifdef USE_STRING_TITLES - DWIN_Draw_Label(row, GET_TEXT_F(MSG_COOLDOWN)); + dwinDrawLabel(row, GET_TEXT_F(MSG_COOLDOWN)); #else - Item_AreaCopy(200, 76, 264, 86, row); // "Cooldown" + itemAreaCopy(200, 76, 264, 86, row); // "Cooldown" #endif } - Draw_Menu_Line(row, ICON_Cool); + drawMenuLine(row, ICON_Cool); } #endif -void Item_Prepare_Lang(const uint8_t row) { - if (HMI_IsChinese()) - Item_AreaCopy(239, 134, 266, 146, row); +void itemPrepareLang(const uint8_t row) { + if (hmiIsChinese()) + itemAreaCopy(239, 134, 266, 146, row); else { #ifdef USE_STRING_TITLES - DWIN_Draw_Label(row, F("UI Language")); + dwinDrawLabel(row, F("UI Language")); #else - Item_AreaCopy(1, 194, 96, 206, row); // "LCD Language" + itemAreaCopy(1, 194, 96, 206, row); // "LCD Language" #endif } - DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Black, 226, EBASE(row), HMI_IsChinese() ? F("CN") : F("EN")); - Draw_Menu_Icon(row, ICON_Language); + dwinDrawString(false, font8x16, Color_White, Color_Bg_Black, 226, EBASE(row), hmiIsChinese() ? F("CN") : F("EN")); + drawMenuIcon(row, ICON_Language); } #define VISI(T,L,S) (WITHIN(L, T - MROWS, MROWS) || WITHIN(S, 0, MROWS)) -void Draw_Prepare_Menu() { - Clear_Main_Window(); +void drawPrepareMenu() { + clearMainWindow(); const int16_t scroll = MROWS - index_prepare; // Scrolled-up lines #define PSCROL(L) (scroll + (L)) #define PVISI(L) VISI(PREPARE_CASE_TOTAL, L, PSCROL(L)) - if (HMI_IsChinese()) - DWIN_Frame_TitleCopy(133, 1, 28, 13); // "Prepare" + if (hmiIsChinese()) + dwinFrameTitleCopy(133, 1, 28, 13); // "Prepare" else { #ifdef USE_STRING_HEADINGS - Draw_Title(GET_TEXT_F(MSG_PREPARE)); + drawTitle(GET_TEXT_F(MSG_PREPARE)); #else - DWIN_Frame_TitleCopy(179, 0, 48, 14); // "Prepare" + dwinFrameTitleCopy(179, 0, 48, 14); // "Prepare" #endif } - if (PVISI(0)) Draw_Back_First(select_prepare.now == CASE_BACK); // < Back - if (PVISI(PREPARE_CASE_MOVE)) Item_Prepare_Move(PSCROL(PREPARE_CASE_MOVE)); // Move > - if (PVISI(PREPARE_CASE_DISA)) Item_Prepare_Disable(PSCROL(PREPARE_CASE_DISA)); // Disable Stepper - if (PVISI(PREPARE_CASE_HOME)) Item_Prepare_Home(PSCROL(PREPARE_CASE_HOME)); // Auto Home + if (PVISI(0)) drawBackFirst(select_prepare.now == CASE_BACK); // < Back + if (PVISI(PREPARE_CASE_MOVE)) itemPrepareMove(PSCROL(PREPARE_CASE_MOVE)); // Move > + if (PVISI(PREPARE_CASE_DISA)) itemPrepareDisable(PSCROL(PREPARE_CASE_DISA)); // Disable Stepper + if (PVISI(PREPARE_CASE_HOME)) itemPrepareHome(PSCROL(PREPARE_CASE_HOME)); // Auto Home #if HAS_ZOFFSET_ITEM - if (PVISI(PREPARE_CASE_ZOFF)) Item_Prepare_Offset(PSCROL(PREPARE_CASE_ZOFF)); // Edit Z-Offset / Babystep / Set Home Offset + if (PVISI(PREPARE_CASE_ZOFF)) itemPrepareOffset(PSCROL(PREPARE_CASE_ZOFF)); // Edit Z-Offset / Babystep / Set Home Offset #endif #if HAS_PREHEAT - if (PVISI(PREPARE_CASE_PLA)) Item_Prepare_PLA(PSCROL(PREPARE_CASE_PLA)); // Preheat PLA + if (PVISI(PREPARE_CASE_PLA)) itemPrepare_PLA(PSCROL(PREPARE_CASE_PLA)); // Preheat PLA #if PREHEAT_COUNT > 1 - if (PVISI(PREPARE_CASE_ABS)) Item_Prepare_ABS(PSCROL(PREPARE_CASE_ABS)); // Preheat ABS + if (PVISI(PREPARE_CASE_ABS)) itemPrepare_ABS(PSCROL(PREPARE_CASE_ABS)); // Preheat ABS #endif #endif #if HAS_HOTEND || HAS_HEATED_BED - if (PVISI(PREPARE_CASE_COOL)) Item_Prepare_Cool(PSCROL(PREPARE_CASE_COOL)); // Cooldown + if (PVISI(PREPARE_CASE_COOL)) itemPrepareCool(PSCROL(PREPARE_CASE_COOL)); // Cooldown #endif - if (PVISI(PREPARE_CASE_LANG)) Item_Prepare_Lang(PSCROL(PREPARE_CASE_LANG)); // Language CN/EN + if (PVISI(PREPARE_CASE_LANG)) itemPrepareLang(PSCROL(PREPARE_CASE_LANG)); // Language CN/EN - if (select_prepare.now != CASE_BACK) Draw_Menu_Cursor(PSCROL(select_prepare.now)); + if (select_prepare.now != CASE_BACK) drawMenuCursor(PSCROL(select_prepare.now)); } // // Control Menu // -void Item_Control_Temp(const uint16_t row) { - if (HMI_IsChinese()) - Item_AreaCopy(57, 104, 84, 116, row); +void itemControlTemp(const uint16_t row) { + if (hmiIsChinese()) + itemAreaCopy(57, 104, 84, 116, row); else { #ifdef USE_STRING_TITLES - DWIN_Draw_Label(row, GET_TEXT_F(MSG_TEMPERATURE)); + dwinDrawLabel(row, GET_TEXT_F(MSG_TEMPERATURE)); #else - Item_AreaCopy(1, 89, 83, 101, row); + itemAreaCopy(1, 89, 83, 101, row); #endif } - Draw_Menu_Line(row, ICON_Temperature); - Draw_More_Icon(row); + drawMenuLine(row, ICON_Temperature); + drawMoreIcon(row); } -void Item_Control_Motion(const uint16_t row) { - if (HMI_IsChinese()) - Item_AreaCopy(87, 104, 114, 116, row); +void itemControlMotion(const uint16_t row) { + if (hmiIsChinese()) + itemAreaCopy(87, 104, 114, 116, row); else { #ifdef USE_STRING_TITLES - DWIN_Draw_Label(row, GET_TEXT_F(MSG_MOTION)); + dwinDrawLabel(row, GET_TEXT_F(MSG_MOTION)); #else - Item_AreaCopy(84, 89, 128, 99, row); + itemAreaCopy(84, 89, 128, 99, row); #endif } - Draw_Menu_Line(row, ICON_Motion); - Draw_More_Icon(row); + drawMenuLine(row, ICON_Motion); + drawMoreIcon(row); } -void Item_Control_Advanced(const uint16_t row) { - if (HMI_IsChinese()) - Item_AreaCopy(62, 180, 120, 192, row); +void itemControlAdvanced(const uint16_t row) { + if (hmiIsChinese()) + itemAreaCopy(62, 180, 120, 192, row); else { #ifdef USE_STRING_TITLES - DWIN_Draw_Label(row, GET_TEXT_F(MSG_ADVANCED_SETTINGS)); + dwinDrawLabel(row, GET_TEXT_F(MSG_ADVANCED_SETTINGS)); #else - Item_AreaCopy(82, 135, 200, 149, row); + itemAreaCopy(82, 135, 200, 149, row); #endif } - Draw_Menu_Line(row, ICON_AdvSet); - Draw_More_Icon(row); + drawMenuLine(row, ICON_AdvSet); + drawMoreIcon(row); } -void Item_Control_Info(const uint16_t row) { - if (HMI_IsChinese()) - Item_AreaCopy(231, 104, 258, 116, row); +void itemControlInfo(const uint16_t row) { + if (hmiIsChinese()) + itemAreaCopy(231, 104, 258, 116, row); else { #ifdef USE_STRING_TITLES - DWIN_Draw_Label(row, GET_TEXT_F(MSG_INFO_SCREEN)); + dwinDrawLabel(row, GET_TEXT_F(MSG_INFO_SCREEN)); #else - Item_AreaCopy(0, 104, 24, 114, row); + itemAreaCopy(0, 104, 24, 114, row); #endif } - Draw_Menu_Line(row, ICON_Info); - Draw_More_Icon(row); + drawMenuLine(row, ICON_Info); + drawMoreIcon(row); } -void Draw_Control_Menu() { - Clear_Main_Window(); +void drawControlMenu() { + clearMainWindow(); #if CONTROL_CASE_TOTAL >= TROWS const int16_t scroll = MROWS - index_control; // Scrolled-up lines @@ -847,62 +848,62 @@ void Draw_Control_Menu() { #define CLINE(L) MBASE(CSCROL(L)) #define CVISI(L) VISI(CONTROL_CASE_TOTAL, L, CSCROL(L)) - if (HMI_IsChinese()) - DWIN_Frame_TitleCopy(103, 1, 28, 14); // "Control" + if (hmiIsChinese()) + dwinFrameTitleCopy(103, 1, 28, 14); // "Control" else { #ifdef USE_STRING_HEADINGS - Draw_Title(GET_TEXT_F(MSG_CONTROL)); + drawTitle(GET_TEXT_F(MSG_CONTROL)); #else - DWIN_Frame_TitleCopy(128, 2, 49, 11); // "Control" + dwinFrameTitleCopy(128, 2, 49, 11); // "Control" #endif } - if (CVISI(0)) Draw_Back_First(select_control.now == CASE_BACK); // < Back - if (CVISI(CONTROL_CASE_TEMP)) Item_Control_Temp(CSCROL(CONTROL_CASE_TEMP)); // Temperature > - if (CVISI(CONTROL_CASE_MOVE)) Item_Control_Motion(CSCROL(CONTROL_CASE_MOVE)); // Motion > + if (CVISI(0)) drawBackFirst(select_control.now == CASE_BACK); // < Back + if (CVISI(CONTROL_CASE_TEMP)) itemControlTemp(CSCROL(CONTROL_CASE_TEMP)); // Temperature > + if (CVISI(CONTROL_CASE_MOVE)) itemControlMotion(CSCROL(CONTROL_CASE_MOVE)); // Motion > - if (HMI_IsChinese()) { + if (hmiIsChinese()) { #if ENABLED(EEPROM_SETTINGS) - Item_AreaCopy(117, 104, 172, 116, CSCROL(CONTROL_CASE_SAVE)); // "Store Configuration" - Item_AreaCopy(174, 103, 229, 116, CSCROL(CONTROL_CASE_LOAD)); // "Read Configuration" - Item_AreaCopy( 1, 118, 56, 131, CSCROL(CONTROL_CASE_RESET)); // "Reset Configuration" + itemAreaCopy(117, 104, 172, 116, CSCROL(CONTROL_CASE_SAVE)); // "Store Configuration" + itemAreaCopy(174, 103, 229, 116, CSCROL(CONTROL_CASE_LOAD)); // "Read Configuration" + itemAreaCopy( 1, 118, 56, 131, CSCROL(CONTROL_CASE_RESET)); // "Reset Configuration" #endif } else { #ifdef USE_STRING_TITLES #if ENABLED(EEPROM_SETTINGS) - if (CVISI(CONTROL_CASE_SAVE)) DWIN_Draw_Label(CSCROL(CONTROL_CASE_SAVE), GET_TEXT_F(MSG_STORE_EEPROM)); // "Store Configuration" - if (CVISI(CONTROL_CASE_LOAD)) DWIN_Draw_Label(CSCROL(CONTROL_CASE_LOAD), GET_TEXT_F(MSG_LOAD_EEPROM)); // "Read Configuration" - if (CVISI(CONTROL_CASE_RESET)) DWIN_Draw_Label(CSCROL(CONTROL_CASE_RESET), GET_TEXT_F(MSG_RESTORE_DEFAULTS)); // "Reset Configuration" + if (CVISI(CONTROL_CASE_SAVE)) dwinDrawLabel(CSCROL(CONTROL_CASE_SAVE), GET_TEXT_F(MSG_STORE_EEPROM)); // "Store Configuration" + if (CVISI(CONTROL_CASE_LOAD)) dwinDrawLabel(CSCROL(CONTROL_CASE_LOAD), GET_TEXT_F(MSG_LOAD_EEPROM)); // "Read Configuration" + if (CVISI(CONTROL_CASE_RESET)) dwinDrawLabel(CSCROL(CONTROL_CASE_RESET), GET_TEXT_F(MSG_RESTORE_DEFAULTS)); // "Reset Configuration" #endif #else #if ENABLED(EEPROM_SETTINGS) if (CVISI(CONTROL_CASE_SAVE)) - Item_AreaCopy(150, 89, 263, 102, CSCROL(CONTROL_CASE_SAVE)); // "Store Configuration" + itemAreaCopy(150, 89, 263, 102, CSCROL(CONTROL_CASE_SAVE)); // "Store Configuration" if (CVISI(CONTROL_CASE_LOAD)) { - Item_AreaCopy( 26, 104, 57, 114, CSCROL(CONTROL_CASE_LOAD)); // "Read" - Item_AreaCopy(182, 89, 263, 102, CSCROL(CONTROL_CASE_LOAD), 34); // "Configuration" + itemAreaCopy( 26, 104, 57, 114, CSCROL(CONTROL_CASE_LOAD)); // "Read" + itemAreaCopy(182, 89, 263, 102, CSCROL(CONTROL_CASE_LOAD), 34); // "Configuration" } if (CVISI(CONTROL_CASE_RESET)) { - Item_AreaCopy( 59, 104, 93, 114, CSCROL(CONTROL_CASE_RESET)); // "Reset" - Item_AreaCopy(182, 89, 263, 102, CSCROL(CONTROL_CASE_RESET), 37); // "Configuration" + itemAreaCopy( 59, 104, 93, 114, CSCROL(CONTROL_CASE_RESET)); // "Reset" + itemAreaCopy(182, 89, 263, 102, CSCROL(CONTROL_CASE_RESET), 37); // "Configuration" } #endif #endif } - if (CVISI(CONTROL_CASE_ADVSET)) Item_Control_Advanced(CSCROL(CONTROL_CASE_ADVSET)); - if (CVISI(CONTROL_CASE_INFO)) Item_Control_Info(CSCROL(CONTROL_CASE_INFO)); + if (CVISI(CONTROL_CASE_ADVSET)) itemControlAdvanced(CSCROL(CONTROL_CASE_ADVSET)); + if (CVISI(CONTROL_CASE_INFO)) itemControlInfo(CSCROL(CONTROL_CASE_INFO)); if (select_control.now != CASE_BACK && CVISI(select_control.now)) - Draw_Menu_Cursor(CSCROL(select_control.now)); + drawMenuCursor(CSCROL(select_control.now)); // Draw icons and lines #define _TEMP_ICON(N, I, M) do { \ if (CVISI(N)) { \ - Draw_Menu_Line(CSCROL(N), I); \ + drawMenuLine(CSCROL(N), I); \ if (M) { \ - Draw_More_Icon(CSCROL(N)); \ + drawMoreIcon(CSCROL(N)); \ } \ } \ } while(0) @@ -918,117 +919,117 @@ void Draw_Control_Menu() { // Tune Menu // -void Draw_Tune_Menu() { - Clear_Main_Window(); +void drawTuneMenu() { + clearMainWindow(); - if (HMI_IsChinese()) { - DWIN_Frame_TitleCopy(73, 2, 28, 12); // "Tune" - Item_AreaCopy(116, 164, 171, 176, TUNE_CASE_SPEED); + if (hmiIsChinese()) { + dwinFrameTitleCopy(73, 2, 28, 12); // "Tune" + itemAreaCopy(116, 164, 171, 176, TUNE_CASE_SPEED); #if HAS_HOTEND - Item_AreaCopy(1, 134, 56, 146, TUNE_CASE_TEMP); + itemAreaCopy(1, 134, 56, 146, TUNE_CASE_TEMP); #endif #if HAS_HEATED_BED - Item_AreaCopy(58, 134, 113, 146, TUNE_CASE_BED); + itemAreaCopy(58, 134, 113, 146, TUNE_CASE_BED); #endif #if HAS_FAN - Item_AreaCopy(115, 134, 170, 146, TUNE_CASE_FAN); + itemAreaCopy(115, 134, 170, 146, TUNE_CASE_FAN); #endif #if HAS_ZOFFSET_ITEM - Item_AreaCopy(174, 164, 223, 177, TUNE_CASE_ZOFF); + itemAreaCopy(174, 164, 223, 177, TUNE_CASE_ZOFF); #endif } else { #ifdef USE_STRING_HEADINGS - Draw_Title(GET_TEXT_F(MSG_TUNE)); + drawTitle(GET_TEXT_F(MSG_TUNE)); #else - DWIN_Frame_TitleCopy(94, 2, 33, 11); // "Tune" + dwinFrameTitleCopy(94, 2, 33, 11); // "Tune" #endif #ifdef USE_STRING_TITLES - DWIN_Draw_Label(TUNE_CASE_SPEED, GET_TEXT_F(MSG_SPEED)); + dwinDrawLabel(TUNE_CASE_SPEED, GET_TEXT_F(MSG_SPEED)); #if HAS_HOTEND - DWIN_Draw_Label(TUNE_CASE_TEMP, GET_TEXT_F(MSG_UBL_SET_TEMP_HOTEND)); + dwinDrawLabel(TUNE_CASE_TEMP, GET_TEXT_F(MSG_UBL_SET_TEMP_HOTEND)); #endif #if HAS_HEATED_BED - DWIN_Draw_Label(TUNE_CASE_BED, GET_TEXT_F(MSG_UBL_SET_TEMP_BED)); + dwinDrawLabel(TUNE_CASE_BED, GET_TEXT_F(MSG_UBL_SET_TEMP_BED)); #endif #if HAS_FAN - DWIN_Draw_Label(TUNE_CASE_FAN, GET_TEXT_F(MSG_FAN_SPEED)); + dwinDrawLabel(TUNE_CASE_FAN, GET_TEXT_F(MSG_FAN_SPEED)); #endif - DWIN_Draw_Label(TUNE_CASE_ZOFF, GET_TEXT_F(MSG_ZPROBE_ZOFFSET)); + dwinDrawLabel(TUNE_CASE_ZOFF, GET_TEXT_F(MSG_ZPROBE_ZOFFSET)); #else - Item_AreaCopy(1, 179, 92, 190, TUNE_CASE_SPEED); // "Print speed" + itemAreaCopy(1, 179, 92, 190, TUNE_CASE_SPEED); // "Print speed" #if HAS_HOTEND - Item_AreaCopy(197, 104, 238, 114, TUNE_CASE_TEMP); // "Hotend" - Item_AreaCopy( 1, 89, 83, 101, TUNE_CASE_TEMP, 44); // "Temperature" + itemAreaCopy(197, 104, 238, 114, TUNE_CASE_TEMP); // "Hotend" + itemAreaCopy( 1, 89, 83, 101, TUNE_CASE_TEMP, 44); // "Temperature" #endif #if HAS_HEATED_BED - Item_AreaCopy(240, 104, 264, 114, TUNE_CASE_BED); // "Bed" - Item_AreaCopy( 1, 89, 83, 101, TUNE_CASE_BED, 27); // "Temperature" + itemAreaCopy(240, 104, 264, 114, TUNE_CASE_BED); // "Bed" + itemAreaCopy( 1, 89, 83, 101, TUNE_CASE_BED, 27); // "Temperature" #endif #if HAS_FAN - Item_AreaCopy(0, 119, 64, 132, TUNE_CASE_FAN); // "Fan speed" + itemAreaCopy(0, 119, 64, 132, TUNE_CASE_FAN); // "Fan speed" #endif #if HAS_ZOFFSET_ITEM - Item_AreaCopy(93, 179, 141, 189, TUNE_CASE_ZOFF); // "Z-offset" + itemAreaCopy(93, 179, 141, 189, TUNE_CASE_ZOFF); // "Z-offset" #endif #endif } - Draw_Back_First(select_tune.now == CASE_BACK); - if (select_tune.now != CASE_BACK) Draw_Menu_Cursor(select_tune.now); + drawBackFirst(select_tune.now == CASE_BACK); + if (select_tune.now != CASE_BACK) drawMenuCursor(select_tune.now); - Draw_Menu_Line(TUNE_CASE_SPEED, ICON_Speed); - Draw_Edit_Integer3(TUNE_CASE_SPEED, feedrate_percentage); + drawMenuLine(TUNE_CASE_SPEED, ICON_Speed); + drawEditInteger3(TUNE_CASE_SPEED, feedrate_percentage); #if HAS_HOTEND - Draw_Menu_Line(TUNE_CASE_TEMP, ICON_HotendTemp); - Draw_Edit_Integer3(TUNE_CASE_TEMP, thermalManager.degTargetHotend(0)); + drawMenuLine(TUNE_CASE_TEMP, ICON_HotendTemp); + drawEditInteger3(TUNE_CASE_TEMP, thermalManager.degTargetHotend(0)); #endif #if HAS_HEATED_BED - Draw_Menu_Line(TUNE_CASE_BED, ICON_BedTemp); - Draw_Edit_Integer3(TUNE_CASE_BED, thermalManager.degTargetBed()); + drawMenuLine(TUNE_CASE_BED, ICON_BedTemp); + drawEditInteger3(TUNE_CASE_BED, thermalManager.degTargetBed()); #endif #if HAS_FAN - Draw_Menu_Line(TUNE_CASE_FAN, ICON_FanSpeed); - Draw_Edit_Integer3(TUNE_CASE_FAN, thermalManager.fan_speed[0]); + drawMenuLine(TUNE_CASE_FAN, ICON_FanSpeed); + drawEditInteger3(TUNE_CASE_FAN, thermalManager.fan_speed[0]); #endif #if HAS_ZOFFSET_ITEM - Draw_Menu_Line(TUNE_CASE_ZOFF, ICON_Zoffset); - Draw_Edit_Signed_Float2(TUNE_CASE_ZOFF, BABY_Z_VAR * 100); + drawMenuLine(TUNE_CASE_ZOFF, ICON_Zoffset); + drawEditSignedFloat2(TUNE_CASE_ZOFF, BABY_Z_VAR * 100); #endif } // // Motion Menu // -void Draw_Motion_Menu() { - Clear_Main_Window(); - - if (HMI_IsChinese()) { - DWIN_Frame_TitleCopy(1, 16, 28, 13); // "Motion" - Item_AreaCopy(173, 133, 228, 147, MOTION_CASE_RATE); // Max speed - Item_AreaCopy(173, 133, 200, 147, MOTION_CASE_ACCEL); // Max... - Item_AreaCopy(28, 149, 69, 161, MOTION_CASE_ACCEL, 30, 1); // ...Acceleration +void drawMotionMenu() { + clearMainWindow(); + + if (hmiIsChinese()) { + dwinFrameTitleCopy(1, 16, 28, 13); // "Motion" + itemAreaCopy(173, 133, 228, 147, MOTION_CASE_RATE); // Max speed + itemAreaCopy(173, 133, 200, 147, MOTION_CASE_ACCEL); // Max... + itemAreaCopy(28, 149, 69, 161, MOTION_CASE_ACCEL, 30, 1); // ...Acceleration #if HAS_CLASSIC_JERK - Item_AreaCopy(173, 133, 200, 147, MOTION_CASE_JERK); // Max... - Item_AreaCopy(1, 180, 28, 192, MOTION_CASE_JERK, 30, 1); // ... - Item_AreaCopy(202, 133, 228, 147, MOTION_CASE_JERK, 57); // ...Jerk + itemAreaCopy(173, 133, 200, 147, MOTION_CASE_JERK); // Max... + itemAreaCopy(1, 180, 28, 192, MOTION_CASE_JERK, 30, 1); // ... + itemAreaCopy(202, 133, 228, 147, MOTION_CASE_JERK, 57); // ...Jerk #endif - Item_AreaCopy(153, 148, 194, 161, MOTION_CASE_STEPS); // Flow ratio + itemAreaCopy(153, 148, 194, 161, MOTION_CASE_STEPS); // Flow ratio } else { #ifdef USE_STRING_HEADINGS - Draw_Title(GET_TEXT_F(MSG_MOTION)); + drawTitle(GET_TEXT_F(MSG_MOTION)); #else - DWIN_Frame_TitleCopy(144, 16, 46, 11); // "Motion" + dwinFrameTitleCopy(144, 16, 46, 11); // "Motion" #endif #ifdef USE_STRING_TITLES - DWIN_Draw_Label(MOTION_CASE_RATE, F("Feedrate")); // "Feedrate" - DWIN_Draw_Label(MOTION_CASE_ACCEL, GET_TEXT_F(MSG_ACCELERATION)); // "Acceleration" + dwinDrawLabel(MOTION_CASE_RATE, F("Feedrate")); // "Feedrate" + dwinDrawLabel(MOTION_CASE_ACCEL, GET_TEXT_F(MSG_ACCELERATION)); // "Acceleration" #if HAS_CLASSIC_JERK - DWIN_Draw_Label(MOTION_CASE_JERK, GET_TEXT_F(MSG_JERK)); // "Jerk" + dwinDrawLabel(MOTION_CASE_JERK, GET_TEXT_F(MSG_JERK)); // "Jerk" #endif - DWIN_Draw_Label(MOTION_CASE_STEPS, GET_TEXT_F(MSG_STEPS_PER_MM)); // "Steps/mm" + dwinDrawLabel(MOTION_CASE_STEPS, GET_TEXT_F(MSG_STEPS_PER_MM)); // "Steps/mm" #else say_max_en(MOTION_CASE_RATE); say_speed_en(30, MOTION_CASE_RATE); // "Max Speed" say_max_accel_en(MOTION_CASE_ACCEL); // "Max Acceleration" @@ -1039,17 +1040,17 @@ void Draw_Motion_Menu() { #endif } - Draw_Back_First(select_motion.now == CASE_BACK); - if (select_motion.now != CASE_BACK) Draw_Menu_Cursor(select_motion.now); + drawBackFirst(select_motion.now == CASE_BACK); + if (select_motion.now != CASE_BACK) drawMenuCursor(select_motion.now); uint8_t i = 0; - #define _MOTION_ICON(N) Draw_Menu_Line(++i, ICON_MaxSpeed + (N) - 1) - _MOTION_ICON(MOTION_CASE_RATE); Draw_More_Icon(i); - _MOTION_ICON(MOTION_CASE_ACCEL); Draw_More_Icon(i); + #define _MOTION_ICON(N) drawMenuLine(++i, ICON_MaxSpeed + (N) - 1) + _MOTION_ICON(MOTION_CASE_RATE); drawMoreIcon(i); + _MOTION_ICON(MOTION_CASE_ACCEL); drawMoreIcon(i); #if HAS_CLASSIC_JERK - _MOTION_ICON(MOTION_CASE_JERK); Draw_More_Icon(i); + _MOTION_ICON(MOTION_CASE_JERK); drawMoreIcon(i); #endif - _MOTION_ICON(MOTION_CASE_STEPS); Draw_More_Icon(i); + _MOTION_ICON(MOTION_CASE_STEPS); drawMoreIcon(i); } // @@ -1058,339 +1059,339 @@ void Draw_Motion_Menu() { #if HAS_HOTEND || HAS_HEATED_BED - void DWIN_Popup_Temperature(const bool toohigh) { - Clear_Popup_Area(); - Draw_Popup_Bkgd_105(); + void dwinPopupTemperature(const bool toohigh) { + clearPopupArea(); + drawPopupBkgd105(); if (toohigh) { - DWIN_ICON_Show(ICON, ICON_TempTooHigh, 102, 165); - if (HMI_IsChinese()) { - DWIN_Frame_AreaCopy(1, 103, 371, 237, 386, 52, 285); // Temp Too High - DWIN_Frame_AreaCopy(1, 151, 389, 185, 402, 187, 285); - DWIN_Frame_AreaCopy(1, 189, 389, 271, 402, 95, 310); + dwinIconShow(ICON, ICON_TempTooHigh, 102, 165); + if (hmiIsChinese()) { + dwinFrameAreaCopy(1, 103, 371, 237, 386, 52, 285); // Temp Too High + dwinFrameAreaCopy(1, 151, 389, 185, 402, 187, 285); + dwinFrameAreaCopy(1, 189, 389, 271, 402, 95, 310); } else { - DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, 36, 300, F("Nozzle or Bed temperature")); - DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, 92, 300, F("is too high")); + dwinDrawString(true, font8x16, Popup_Text_Color, Color_Bg_Window, 36, 300, F("Nozzle or Bed temperature")); + dwinDrawString(true, font8x16, Popup_Text_Color, Color_Bg_Window, 92, 300, F("is too high")); } } else { - DWIN_ICON_Show(ICON, ICON_TempTooLow, 102, 165); - if (HMI_IsChinese()) { - DWIN_Frame_AreaCopy(1, 103, 371, 270, 386, 52, 285); // Tenp Too Low - DWIN_Frame_AreaCopy(1, 189, 389, 271, 402, 95, 310); + dwinIconShow(ICON, ICON_TempTooLow, 102, 165); + if (hmiIsChinese()) { + dwinFrameAreaCopy(1, 103, 371, 270, 386, 52, 285); // Tenp Too Low + dwinFrameAreaCopy(1, 189, 389, 271, 402, 95, 310); } else { - DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, 36, 300, F("Nozzle or Bed temperature")); - DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, 92, 300, F("is too low")); + dwinDrawString(true, font8x16, Popup_Text_Color, Color_Bg_Window, 36, 300, F("Nozzle or Bed temperature")); + dwinDrawString(true, font8x16, Popup_Text_Color, Color_Bg_Window, 92, 300, F("is too low")); } } } #endif -void Draw_Popup_Bkgd_60() { - DWIN_Draw_Rectangle(1, Color_Bg_Window, 14, 60, 258, 330); +void drawPopupBkgd60() { + dwinDrawRectangle(1, Color_Bg_Window, 14, 60, 258, 330); } #if HAS_HOTEND - void Popup_Window_ETempTooLow() { - Clear_Main_Window(); - Draw_Popup_Bkgd_60(); - DWIN_ICON_Show(ICON, ICON_TempTooLow, 102, 105); - if (HMI_IsChinese()) { - DWIN_Frame_AreaCopy(1, 103, 371, 136, 386, 69, 240); // Nozzle Too Cold - DWIN_Frame_AreaCopy(1, 170, 371, 270, 386, 69 + 33, 240); - DWIN_ICON_Show(ICON, ICON_Confirm_C, 86, 280); + void popupWindowETempTooLow() { + clearMainWindow(); + drawPopupBkgd60(); + dwinIconShow(ICON, ICON_TempTooLow, 102, 105); + if (hmiIsChinese()) { + dwinFrameAreaCopy(1, 103, 371, 136, 386, 69, 240); // Nozzle Too Cold + dwinFrameAreaCopy(1, 170, 371, 270, 386, 69 + 33, 240); + dwinIconShow(ICON, ICON_Confirm_C, 86, 280); } else { - DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, 20, 235, F("Nozzle is too cold")); - DWIN_ICON_Show(ICON, ICON_Confirm_E, 86, 280); + dwinDrawString(true, font8x16, Popup_Text_Color, Color_Bg_Window, 20, 235, F("Nozzle is too cold")); + dwinIconShow(ICON, ICON_Confirm_E, 86, 280); } } #endif -void Popup_Window_Resume() { - Clear_Popup_Area(); - Draw_Popup_Bkgd_105(); - if (HMI_IsChinese()) { - DWIN_Frame_AreaCopy(1, 160, 338, 235, 354, 98, 135); // Resume Interrupted Print - DWIN_Frame_AreaCopy(1, 103, 321, 271, 335, 52, 192); - DWIN_ICON_Show(ICON, ICON_Cancel_C, 26, 307); - DWIN_ICON_Show(ICON, ICON_Continue_C, 146, 307); +void popupWindowResume() { + clearPopupArea(); + drawPopupBkgd105(); + if (hmiIsChinese()) { + dwinFrameAreaCopy(1, 160, 338, 235, 354, 98, 135); // Resume Interrupted Print + dwinFrameAreaCopy(1, 103, 321, 271, 335, 52, 192); + dwinIconShow(ICON, ICON_Cancel_C, 26, 307); + dwinIconShow(ICON, ICON_Continue_C, 146, 307); } else { - DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 14) / 2, 115, F("Continue Print")); - DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 22) / 2, 192, F("It looks like the last")); - DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 22) / 2, 212, F("file was interrupted.")); - DWIN_ICON_Show(ICON, ICON_Cancel_E, 26, 307); - DWIN_ICON_Show(ICON, ICON_Continue_E, 146, 307); + dwinDrawString(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 14) / 2, 115, F("Continue Print")); + dwinDrawString(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 22) / 2, 192, F("It looks like the last")); + dwinDrawString(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 22) / 2, 212, F("file was interrupted.")); + dwinIconShow(ICON, ICON_Cancel_E, 26, 307); + dwinIconShow(ICON, ICON_Continue_E, 146, 307); } } -void Popup_Window_Home(const bool parking/*=false*/) { - Clear_Main_Window(); - Draw_Popup_Bkgd_60(); - DWIN_ICON_Show(ICON, ICON_BLTouch, 101, 105); - if (HMI_IsChinese()) { - DWIN_Frame_AreaCopy(1, 0, 371, 33, 386, 85, 240); // Wait for Move to Complete - DWIN_Frame_AreaCopy(1, 203, 286, 271, 302, 118, 240); - DWIN_Frame_AreaCopy(1, 0, 389, 150, 402, 61, 280); +void popupWindowHome(const bool parking/*=false*/) { + clearMainWindow(); + drawPopupBkgd60(); + dwinIconShow(ICON, ICON_BLTouch, 101, 105); + if (hmiIsChinese()) { + dwinFrameAreaCopy(1, 0, 371, 33, 386, 85, 240); // Wait for Move to Complete + dwinFrameAreaCopy(1, 203, 286, 271, 302, 118, 240); + dwinFrameAreaCopy(1, 0, 389, 150, 402, 61, 280); } else { - DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * (parking ? 7 : 10)) / 2, 230, parking ? F("Parking") : F("Homing XYZ")); - DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 23) / 2, 260, F("Please wait until done.")); + dwinDrawString(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * (parking ? 7 : 10)) / 2, 230, parking ? F("Parking") : F("Homing XYZ")); + dwinDrawString(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 23) / 2, 260, F("Please wait until done.")); } } #if HAS_ONESTEP_LEVELING - void Popup_Window_Leveling() { - Clear_Main_Window(); - Draw_Popup_Bkgd_60(); - DWIN_ICON_Show(ICON, ICON_AutoLeveling, 101, 105); - if (HMI_IsChinese()) { - DWIN_Frame_AreaCopy(1, 0, 371, 100, 386, 84, 240); // Wait for Leveling - DWIN_Frame_AreaCopy(1, 0, 389, 150, 402, 61, 280); + void popupWindowLeveling() { + clearMainWindow(); + drawPopupBkgd60(); + dwinIconShow(ICON, ICON_AutoLeveling, 101, 105); + if (hmiIsChinese()) { + dwinFrameAreaCopy(1, 0, 371, 100, 386, 84, 240); // Wait for Leveling + dwinFrameAreaCopy(1, 0, 389, 150, 402, 61, 280); } else { - DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 13) / 2, 230, GET_TEXT_F(MSG_BED_LEVELING)); - DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 23) / 2, 260, F("Please wait until done.")); + dwinDrawString(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 13) / 2, 230, GET_TEXT_F(MSG_BED_LEVELING)); + dwinDrawString(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 23) / 2, 260, F("Please wait until done.")); } } #endif -void Draw_Select_Highlight(const bool sel) { - HMI_flag.select_flag = sel; +void drawSelectHighlight(const bool sel) { + hmiFlag.select_flag = sel; const uint16_t c1 = sel ? Select_Color : Color_Bg_Window, c2 = sel ? Color_Bg_Window : Select_Color; - DWIN_Draw_Rectangle(0, c1, 25, 279, 126, 318); - DWIN_Draw_Rectangle(0, c1, 24, 278, 127, 319); - DWIN_Draw_Rectangle(0, c2, 145, 279, 246, 318); - DWIN_Draw_Rectangle(0, c2, 144, 278, 247, 319); -} - -void Popup_window_PauseOrStop() { - Clear_Main_Window(); - Draw_Popup_Bkgd_60(); - if (HMI_IsChinese()) { - if (select_print.now == PRINT_PAUSE_RESUME) DWIN_Frame_AreaCopy(1, 237, 338, 269, 356, 98, 150); // Pause - else if (select_print.now == PRINT_STOP) DWIN_Frame_AreaCopy(1, 221, 320, 253, 336, 98, 150); // Stop - DWIN_Frame_AreaCopy(1, 220, 304, 264, 319, 130, 150); // Print - DWIN_ICON_Show(ICON, ICON_Confirm_C, 26, 280); - DWIN_ICON_Show(ICON, ICON_Cancel_C, 146, 280); + dwinDrawRectangle(0, c1, 25, 279, 126, 318); + dwinDrawRectangle(0, c1, 24, 278, 127, 319); + dwinDrawRectangle(0, c2, 145, 279, 246, 318); + dwinDrawRectangle(0, c2, 144, 278, 247, 319); +} + +void popupwindowPauseOrStop() { + clearMainWindow(); + drawPopupBkgd60(); + if (hmiIsChinese()) { + if (select_print.now == PRINT_PAUSE_RESUME) dwinFrameAreaCopy(1, 237, 338, 269, 356, 98, 150); // Pause + else if (select_print.now == PRINT_STOP) dwinFrameAreaCopy(1, 221, 320, 253, 336, 98, 150); // Stop + dwinFrameAreaCopy(1, 220, 304, 264, 319, 130, 150); // Print + dwinIconShow(ICON, ICON_Confirm_C, 26, 280); + dwinIconShow(ICON, ICON_Cancel_C, 146, 280); } else { - if (select_print.now == PRINT_PAUSE_RESUME) DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 11) / 2, 150, GET_TEXT_F(MSG_PAUSE_PRINT)); - else if (select_print.now == PRINT_STOP) DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 10) / 2, 150, GET_TEXT_F(MSG_STOP_PRINT)); - DWIN_ICON_Show(ICON, ICON_Confirm_E, 26, 280); - DWIN_ICON_Show(ICON, ICON_Cancel_E, 146, 280); + if (select_print.now == PRINT_PAUSE_RESUME) dwinDrawString(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 11) / 2, 150, GET_TEXT_F(MSG_PAUSE_PRINT)); + else if (select_print.now == PRINT_STOP) dwinDrawString(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 10) / 2, 150, GET_TEXT_F(MSG_STOP_PRINT)); + dwinIconShow(ICON, ICON_Confirm_E, 26, 280); + dwinIconShow(ICON, ICON_Cancel_E, 146, 280); } - Draw_Select_Highlight(true); + drawSelectHighlight(true); } -void Draw_Printing_Screen() { +void drawPrintingScreen() { const uint16_t y = 168; - if (HMI_IsChinese()) { - DWIN_Frame_TitleCopy(30, 1, 42, 14); // "Printing" - DWIN_Frame_AreaCopy(1, 0, 72, 63, 86, 43, y); // "Printing Time" - DWIN_Frame_AreaCopy(1, 65, 72, 128, 86, 178, y); // "Remain" + if (hmiIsChinese()) { + dwinFrameTitleCopy(30, 1, 42, 14); // "Printing" + dwinFrameAreaCopy(1, 0, 72, 63, 86, 43, y); // "Printing Time" + dwinFrameAreaCopy(1, 65, 72, 128, 86, 178, y); // "Remain" } else { - DWIN_Frame_TitleCopy(42, 0, 47, 14); // "Printing" - DWIN_Frame_AreaCopy(1, 1, 43, 97, 59, 43, y); // "Printing Time" - DWIN_Frame_AreaCopy(1, 100, 43, 152, 56, 178, y); // "Remain" + dwinFrameTitleCopy(42, 0, 47, 14); // "Printing" + dwinFrameAreaCopy(1, 1, 43, 97, 59, 43, y); // "Printing Time" + dwinFrameAreaCopy(1, 100, 43, 152, 56, 178, y); // "Remain" } } -void Draw_Print_ProgressBar() { +void drawPrintProgressBar() { constexpr uint16_t y = 93, h = 21; - DWIN_ICON_Show(ICON, ICON_Bar, 15, 93); - DWIN_Draw_Rectangle(1, BarFill_Color, 16 + _card_percent * 240 / 100, y, 256, y + h - 1); - DWIN_Draw_IntValue(true, true, 0, font8x16, Percent_Color, Color_Bg_Black, 2, 117, y + 40, _card_percent); - DWIN_Draw_String(false, font8x16, Percent_Color, Color_Bg_Black, 133, y + 40, F("%")); + dwinIconShow(ICON, ICON_Bar, 15, 93); + dwinDrawRectangle(1, BarFill_Color, 16 + _card_percent * 240 / 100, y, 256, y + h - 1); + dwinDrawIntValue(true, true, 0, font8x16, Percent_Color, Color_Bg_Black, 2, 117, y + 40, _card_percent); + dwinDrawString(false, font8x16, Percent_Color, Color_Bg_Black, 133, y + 40, F("%")); } -void Draw_Print_ProgressElapsed() { +void drawPrintProgressElapsed() { constexpr uint16_t x = 45, y = 192; duration_t elapsed = print_job_timer.duration(); // print timer - DWIN_Draw_IntValue(true, true, 1, font8x16, Color_White, Color_Bg_Black, 2, x, y, elapsed.value / 3600); - DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Black, x + 8 * 2, y, F(":")); - DWIN_Draw_IntValue(true, true, 1, font8x16, Color_White, Color_Bg_Black, 2, x + 8 * 3, y, (elapsed.value % 3600) / 60); + dwinDrawIntValue(true, true, 1, font8x16, Color_White, Color_Bg_Black, 2, x, y, elapsed.value / 3600); + dwinDrawString(false, font8x16, Color_White, Color_Bg_Black, x + 8 * 2, y, F(":")); + dwinDrawIntValue(true, true, 1, font8x16, Color_White, Color_Bg_Black, 2, x + 8 * 3, y, (elapsed.value % 3600) / 60); } -void Draw_Print_ProgressRemain() { +void drawPrintProgressRemain() { constexpr uint16_t x = 179, y = 192; - DWIN_Draw_IntValue(true, true, 1, font8x16, Color_White, Color_Bg_Black, 2, x, y, _remain_time / 3600); - DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Black, x + 8 * 2, y, F(":")); - DWIN_Draw_IntValue(true, true, 1, font8x16, Color_White, Color_Bg_Black, 2, x + 8 * 3, y, (_remain_time % 3600) / 60); + dwinDrawIntValue(true, true, 1, font8x16, Color_White, Color_Bg_Black, 2, x, y, _remain_time / 3600); + dwinDrawString(false, font8x16, Color_White, Color_Bg_Black, x + 8 * 2, y, F(":")); + dwinDrawIntValue(true, true, 1, font8x16, Color_White, Color_Bg_Black, 2, x + 8 * 3, y, (_remain_time % 3600) / 60); } -void Goto_PrintProcess() { +void gotoPrintProcess() { checkkey = PrintProcess; - Clear_Main_Window(); - Draw_Printing_Screen(); + clearMainWindow(); + drawPrintingScreen(); - ICON_Tune(); - ICON_ResumeOrPause(); - ICON_Stop(); + iconTune(); + iconResumeOrPause(); + iconStop(); // Copy into filebuf string before entry char * const name = card.longest_filename(); const int8_t npos = _MAX(0U, DWIN_WIDTH - strlen(name) * MENU_CHR_W) / 2; - DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Black, npos, 60, name); + dwinDrawString(false, font8x16, Color_White, Color_Bg_Black, npos, 60, name); - DWIN_ICON_Show(ICON, ICON_PrintTime, 17, 163); - DWIN_ICON_Show(ICON, ICON_RemainTime, 150, 161); + dwinIconShow(ICON, ICON_PrintTime, 17, 163); + dwinIconShow(ICON, ICON_RemainTime, 150, 161); - Draw_Print_ProgressBar(); - Draw_Print_ProgressElapsed(); - Draw_Print_ProgressRemain(); + drawPrintProgressBar(); + drawPrintProgressElapsed(); + drawPrintProgressRemain(); } -void Goto_MainMenu() { +void gotoMainMenu() { checkkey = MainMenu; - Clear_Main_Window(); + clearMainWindow(); - if (HMI_IsChinese()) - DWIN_Frame_TitleCopy(2, 2, 26, 13); // "Home" etc + if (hmiIsChinese()) + dwinFrameTitleCopy(2, 2, 26, 13); // "Home" etc else { #ifdef USE_STRING_HEADINGS - Draw_Title(GET_TEXT_F(MSG_MAIN_MENU)); + drawTitle(GET_TEXT_F(MSG_MAIN_MENU)); #else - DWIN_Frame_TitleCopy(0, 2, 40, 11); // "Home" + dwinFrameTitleCopy(0, 2, 40, 11); // "Home" #endif } - DWIN_ICON_Show(ICON, ICON_LOGO, 71, 52); + dwinIconShow(ICON, ICON_LOGO, 71, 52); - ICON_Print(); - ICON_Prepare(); - ICON_Control(); - TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)(); + iconPrint(); + iconPrepare(); + iconControl(); + TERN(HAS_ONESTEP_LEVELING, iconLeveling, iconStartInfo)(); } -void HMI_Plan_Move(const feedRate_t fr_mm_s) { +void hmiPlanMove(const feedRate_t fr_mm_s) { if (!planner.is_full()) { planner.synchronize(); planner.buffer_line(current_position, fr_mm_s); - DWIN_UpdateLCD(); + dwinUpdateLCD(); } } -void HMI_Move_Done(const AxisEnum axis) { - EncoderRate.enabled = false; +void hmiMoveDone(const AxisEnum axis) { + encoderRate.enabled = false; planner.synchronize(); checkkey = AxisMove; - DWIN_UpdateLCD(); + dwinUpdateLCD(); } -void HMI_Move_X() { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); +void hmiMoveX() { + EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; - if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Move_X_scaled)) { - Draw_Edit_Float3(1, HMI_ValueStruct.Move_X_scaled); - return HMI_Move_Done(X_AXIS); + if (applyEncoder(encoder_diffState, hmiValues.Move_X_scaled)) { + drawEditFloat3(1, hmiValues.Move_X_scaled); + return hmiMoveDone(X_AXIS); } - LIMIT(HMI_ValueStruct.Move_X_scaled, (X_MIN_POS) * MINUNITMULT, (X_MAX_POS) * MINUNITMULT); - current_position.x = HMI_ValueStruct.Move_X_scaled / MINUNITMULT; - Draw_Edit_Float3(1, HMI_ValueStruct.Move_X_scaled, true); - DWIN_UpdateLCD(); - HMI_Plan_Move(homing_feedrate(X_AXIS)); + LIMIT(hmiValues.Move_X_scaled, (X_MIN_POS) * MINUNITMULT, (X_MAX_POS) * MINUNITMULT); + current_position.x = hmiValues.Move_X_scaled / MINUNITMULT; + drawEditFloat3(1, hmiValues.Move_X_scaled, true); + dwinUpdateLCD(); + hmiPlanMove(homing_feedrate(X_AXIS)); } -void HMI_Move_Y() { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); +void hmiMoveY() { + EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; - if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Move_Y_scaled)) { - Draw_Edit_Float3(2, HMI_ValueStruct.Move_Y_scaled); - return HMI_Move_Done(Y_AXIS); + if (applyEncoder(encoder_diffState, hmiValues.Move_Y_scaled)) { + drawEditFloat3(2, hmiValues.Move_Y_scaled); + return hmiMoveDone(Y_AXIS); } - LIMIT(HMI_ValueStruct.Move_Y_scaled, (Y_MIN_POS) * MINUNITMULT, (Y_MAX_POS) * MINUNITMULT); - current_position.y = HMI_ValueStruct.Move_Y_scaled / MINUNITMULT; - Draw_Edit_Float3(2, HMI_ValueStruct.Move_Y_scaled, true); - DWIN_UpdateLCD(); - HMI_Plan_Move(homing_feedrate(Y_AXIS)); + LIMIT(hmiValues.Move_Y_scaled, (Y_MIN_POS) * MINUNITMULT, (Y_MAX_POS) * MINUNITMULT); + current_position.y = hmiValues.Move_Y_scaled / MINUNITMULT; + drawEditFloat3(2, hmiValues.Move_Y_scaled, true); + dwinUpdateLCD(); + hmiPlanMove(homing_feedrate(Y_AXIS)); } -void HMI_Move_Z() { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); +void hmiMoveZ() { + EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; - if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Move_Z_scaled)) { - Draw_Edit_Float3(3, HMI_ValueStruct.Move_Z_scaled); - return HMI_Move_Done(Z_AXIS); + if (applyEncoder(encoder_diffState, hmiValues.Move_Z_scaled)) { + drawEditFloat3(3, hmiValues.Move_Z_scaled); + return hmiMoveDone(Z_AXIS); } - LIMIT(HMI_ValueStruct.Move_Z_scaled, (Z_MIN_POS) * MINUNITMULT, (Z_MAX_POS) * MINUNITMULT); - current_position.z = HMI_ValueStruct.Move_Z_scaled / MINUNITMULT; - Draw_Edit_Float3(3, HMI_ValueStruct.Move_Z_scaled, true); - DWIN_UpdateLCD(); - HMI_Plan_Move(homing_feedrate(Z_AXIS)); + LIMIT(hmiValues.Move_Z_scaled, (Z_MIN_POS) * MINUNITMULT, (Z_MAX_POS) * MINUNITMULT); + current_position.z = hmiValues.Move_Z_scaled / MINUNITMULT; + drawEditFloat3(3, hmiValues.Move_Z_scaled, true); + dwinUpdateLCD(); + hmiPlanMove(homing_feedrate(Z_AXIS)); } #if HAS_HOTEND - void HMI_Move_E() { + void hmiMoveE() { static float last_E_scaled = 0; - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); + EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; - if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Move_E_scaled)) { - last_E_scaled = HMI_ValueStruct.Move_E_scaled; - Draw_Edit_Signed_Float3(4, last_E_scaled); - return HMI_Move_Done(E_AXIS); + if (applyEncoder(encoder_diffState, hmiValues.Move_E_scaled)) { + last_E_scaled = hmiValues.Move_E_scaled; + drawEditSignedFloat3(4, last_E_scaled); + return hmiMoveDone(E_AXIS); } - LIMIT(HMI_ValueStruct.Move_E_scaled, last_E_scaled - (EXTRUDE_MAXLENGTH) * MINUNITMULT, last_E_scaled + (EXTRUDE_MAXLENGTH) * MINUNITMULT); - current_position.e = HMI_ValueStruct.Move_E_scaled / MINUNITMULT; - Draw_Edit_Signed_Float3(4, HMI_ValueStruct.Move_E_scaled, true); - DWIN_UpdateLCD(); - HMI_Plan_Move(MMM_TO_MMS(FEEDRATE_E)); + LIMIT(hmiValues.Move_E_scaled, last_E_scaled - (EXTRUDE_MAXLENGTH) * MINUNITMULT, last_E_scaled + (EXTRUDE_MAXLENGTH) * MINUNITMULT); + current_position.e = hmiValues.Move_E_scaled / MINUNITMULT; + drawEditSignedFloat3(4, hmiValues.Move_E_scaled, true); + dwinUpdateLCD(); + hmiPlanMove(MMM_TO_MMS(FEEDRATE_E)); } #endif #if HAS_ZOFFSET_ITEM - void HMI_Zoffset() { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); + void hmiZoffset() { + EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; uint8_t zoff_line; - switch (HMI_ValueStruct.show_mode) { + switch (hmiValues.show_mode) { case -4: zoff_line = PREPARE_CASE_ZOFF + MROWS - index_prepare; break; default: zoff_line = TUNE_CASE_ZOFF + MROWS - index_tune; } - if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.offset_value)) { - EncoderRate.enabled = false; + if (applyEncoder(encoder_diffState, hmiValues.offset_value)) { + encoderRate.enabled = false; #if HAS_BED_PROBE probe.offset.z = dwin_zoffset; TERN_(EEPROM_SETTINGS, settings.save()); #endif - checkkey = HMI_ValueStruct.show_mode == -4 ? Prepare : Tune; - Draw_Edit_Signed_Float2(zoff_line, TERN(HAS_BED_PROBE, BABY_Z_VAR * 100, HMI_ValueStruct.offset_value)); - DWIN_UpdateLCD(); + checkkey = hmiValues.show_mode == -4 ? Prepare : Tune; + drawEditSignedFloat2(zoff_line, TERN(HAS_BED_PROBE, BABY_Z_VAR * 100, hmiValues.offset_value)); + dwinUpdateLCD(); return; } - LIMIT(HMI_ValueStruct.offset_value, (Z_PROBE_OFFSET_RANGE_MIN) * 100, (Z_PROBE_OFFSET_RANGE_MAX) * 100); + LIMIT(hmiValues.offset_value, (Z_PROBE_OFFSET_RANGE_MIN) * 100, (Z_PROBE_OFFSET_RANGE_MAX) * 100); last_zoffset = dwin_zoffset; - dwin_zoffset = HMI_ValueStruct.offset_value / 100.0f; + dwin_zoffset = hmiValues.offset_value / 100.0f; #if ANY(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP) if (BABYSTEP_ALLOWED()) babystep.add_mm(Z_AXIS, dwin_zoffset - last_zoffset); #endif - Draw_Edit_Signed_Float2(zoff_line, HMI_ValueStruct.offset_value, true); - DWIN_UpdateLCD(); + drawEditSignedFloat2(zoff_line, hmiValues.offset_value, true); + dwinUpdateLCD(); } #endif // HAS_ZOFFSET_ITEM #if HAS_HOTEND - void HMI_ETemp() { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); + void hmiETemp() { + EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; uint8_t temp_line; - switch (HMI_ValueStruct.show_mode) { + switch (hmiValues.show_mode) { case -1: temp_line = TEMP_CASE_TEMP; break; #if HAS_PREHEAT case -2: temp_line = PREHEAT_CASE_TEMP; break; @@ -1400,48 +1401,48 @@ void HMI_Move_Z() { #endif default: temp_line = TUNE_CASE_TEMP + MROWS - index_tune; } - if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.E_Temp)) { - EncoderRate.enabled = false; + if (applyEncoder(encoder_diffState, hmiValues.E_Temp)) { + encoderRate.enabled = false; #if HAS_PREHEAT - if (HMI_ValueStruct.show_mode == -2) { + if (hmiValues.show_mode == -2) { checkkey = PLAPreheat; - ui.material_preset[0].hotend_temp = HMI_ValueStruct.E_Temp; - Draw_Edit_Integer3(temp_line, ui.material_preset[0].hotend_temp); + ui.material_preset[0].hotend_temp = hmiValues.E_Temp; + drawEditInteger3(temp_line, ui.material_preset[0].hotend_temp); return; } #if PREHEAT_COUNT > 1 - if (HMI_ValueStruct.show_mode == -3) { + if (hmiValues.show_mode == -3) { checkkey = ABSPreheat; - ui.material_preset[1].hotend_temp = HMI_ValueStruct.E_Temp; - Draw_Edit_Integer3(temp_line, ui.material_preset[1].hotend_temp); + ui.material_preset[1].hotend_temp = hmiValues.E_Temp; + drawEditInteger3(temp_line, ui.material_preset[1].hotend_temp); return; } #endif #endif - if (HMI_ValueStruct.show_mode == -1) // Temperature + if (hmiValues.show_mode == -1) // Temperature checkkey = TemperatureID; else checkkey = Tune; - Draw_Edit_Integer3(temp_line, HMI_ValueStruct.E_Temp); - thermalManager.setTargetHotend(HMI_ValueStruct.E_Temp, 0); + drawEditInteger3(temp_line, hmiValues.E_Temp); + thermalManager.setTargetHotend(hmiValues.E_Temp, 0); return; } // E_Temp limit - LIMIT(HMI_ValueStruct.E_Temp, HEATER_0_MINTEMP, thermalManager.hotend_max_target(0)); + LIMIT(hmiValues.E_Temp, HEATER_0_MINTEMP, thermalManager.hotend_max_target(0)); // E_Temp value - Draw_Edit_Integer3(temp_line, HMI_ValueStruct.E_Temp, true); + drawEditInteger3(temp_line, hmiValues.E_Temp, true); } #endif // HAS_HOTEND #if HAS_HEATED_BED - void HMI_BedTemp() { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); + void hmiBedTemp() { + EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; uint8_t bed_line; - switch (HMI_ValueStruct.show_mode) { + switch (hmiValues.show_mode) { case -1: bed_line = TEMP_CASE_BED; break; #if HAS_PREHEAT case -2: bed_line = PREHEAT_CASE_BED; break; @@ -1451,171 +1452,171 @@ void HMI_Move_Z() { #endif default: bed_line = TUNE_CASE_BED + MROWS - index_tune; } - if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Bed_Temp)) { - EncoderRate.enabled = false; + if (applyEncoder(encoder_diffState, hmiValues.Bed_Temp)) { + encoderRate.enabled = false; #if HAS_PREHEAT - if (HMI_ValueStruct.show_mode == -2) { + if (hmiValues.show_mode == -2) { checkkey = PLAPreheat; - ui.material_preset[0].bed_temp = HMI_ValueStruct.Bed_Temp; - Draw_Edit_Integer3(bed_line, ui.material_preset[0].bed_temp); + ui.material_preset[0].bed_temp = hmiValues.Bed_Temp; + drawEditInteger3(bed_line, ui.material_preset[0].bed_temp); return; } #if PREHEAT_COUNT > 1 - if (HMI_ValueStruct.show_mode == -3) { + if (hmiValues.show_mode == -3) { checkkey = ABSPreheat; - ui.material_preset[1].bed_temp = HMI_ValueStruct.Bed_Temp; - Draw_Edit_Integer3(bed_line, ui.material_preset[1].bed_temp); + ui.material_preset[1].bed_temp = hmiValues.Bed_Temp; + drawEditInteger3(bed_line, ui.material_preset[1].bed_temp); return; } #endif #endif - checkkey = HMI_ValueStruct.show_mode == -1 ? TemperatureID : Tune; - Draw_Edit_Integer3(bed_line, HMI_ValueStruct.Bed_Temp); - thermalManager.setTargetBed(HMI_ValueStruct.Bed_Temp); + checkkey = hmiValues.show_mode == -1 ? TemperatureID : Tune; + drawEditInteger3(bed_line, hmiValues.Bed_Temp); + thermalManager.setTargetBed(hmiValues.Bed_Temp); return; } // Bed_Temp limit - LIMIT(HMI_ValueStruct.Bed_Temp, BED_MINTEMP, BED_MAX_TARGET); + LIMIT(hmiValues.Bed_Temp, BED_MINTEMP, BED_MAX_TARGET); // Bed_Temp value - Draw_Edit_Integer3(bed_line, HMI_ValueStruct.Bed_Temp, true); + drawEditInteger3(bed_line, hmiValues.Bed_Temp, true); } #endif // HAS_HEATED_BED #if HAS_PREHEAT && HAS_FAN - void HMI_FanSpeed() { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); + void hmiFanSpeed() { + EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; uint8_t fan_line; - switch (HMI_ValueStruct.show_mode) { + switch (hmiValues.show_mode) { case -1: fan_line = TEMP_CASE_FAN; break; case -2: fan_line = PREHEAT_CASE_FAN; break; case -3: fan_line = PREHEAT_CASE_FAN; break; default: fan_line = TUNE_CASE_FAN + MROWS - index_tune; } - if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Fan_speed)) { - EncoderRate.enabled = false; - if (HMI_ValueStruct.show_mode == -2) { + if (applyEncoder(encoder_diffState, hmiValues.Fan_speed)) { + encoderRate.enabled = false; + if (hmiValues.show_mode == -2) { checkkey = PLAPreheat; - ui.material_preset[0].fan_speed = HMI_ValueStruct.Fan_speed; - Draw_Edit_Integer3(fan_line, ui.material_preset[0].fan_speed); + ui.material_preset[0].fan_speed = hmiValues.Fan_speed; + drawEditInteger3(fan_line, ui.material_preset[0].fan_speed); return; } #if PREHEAT_COUNT > 1 - if (HMI_ValueStruct.show_mode == -3) { + if (hmiValues.show_mode == -3) { checkkey = ABSPreheat; - ui.material_preset[1].fan_speed = HMI_ValueStruct.Fan_speed; - Draw_Edit_Integer3(fan_line, ui.material_preset[1].fan_speed); + ui.material_preset[1].fan_speed = hmiValues.Fan_speed; + drawEditInteger3(fan_line, ui.material_preset[1].fan_speed); return; } #endif - checkkey = HMI_ValueStruct.show_mode == -1 ? TemperatureID : Tune; - Draw_Edit_Integer3(fan_line, HMI_ValueStruct.Fan_speed); - thermalManager.set_fan_speed(0, HMI_ValueStruct.Fan_speed); + checkkey = hmiValues.show_mode == -1 ? TemperatureID : Tune; + drawEditInteger3(fan_line, hmiValues.Fan_speed); + thermalManager.set_fan_speed(0, hmiValues.Fan_speed); return; } // Fan_speed limit - LIMIT(HMI_ValueStruct.Fan_speed, 0, 255); + LIMIT(hmiValues.Fan_speed, 0, 255); // Fan_speed value - Draw_Edit_Integer3(fan_line, HMI_ValueStruct.Fan_speed, true); + drawEditInteger3(fan_line, hmiValues.Fan_speed, true); } #endif // HAS_PREHEAT && HAS_FAN -void HMI_PrintSpeed() { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); +void hmiPrintSpeed() { + EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; - if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.print_speed)) { + if (applyEncoder(encoder_diffState, hmiValues.print_speed)) { checkkey = Tune; - EncoderRate.enabled = false; - feedrate_percentage = HMI_ValueStruct.print_speed; - Draw_Edit_Integer3(select_tune.now + MROWS - index_tune, HMI_ValueStruct.print_speed); + encoderRate.enabled = false; + feedrate_percentage = hmiValues.print_speed; + drawEditInteger3(select_tune.now + MROWS - index_tune, hmiValues.print_speed); return; } // print_speed limit - LIMIT(HMI_ValueStruct.print_speed, MIN_PRINT_SPEED, MAX_PRINT_SPEED); + LIMIT(hmiValues.print_speed, MIN_PRINT_SPEED, MAX_PRINT_SPEED); // print_speed value - Draw_Edit_Integer3(select_tune.now + MROWS - index_tune, HMI_ValueStruct.print_speed, true); + drawEditInteger3(select_tune.now + MROWS - index_tune, hmiValues.print_speed, true); } #define LAST_AXIS TERN(HAS_HOTEND, E_AXIS, Z_AXIS) -void HMI_MaxFeedspeedXYZE() { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); +void hmiMaxFeedspeedXYZE() { + EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; - if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Feedspeed)) { + if (applyEncoder(encoder_diffState, hmiValues.Max_Feedspeed)) { checkkey = MaxSpeed; - EncoderRate.enabled = false; - if (WITHIN(HMI_flag.feedspeed_axis, X_AXIS, LAST_AXIS)) - planner.set_max_feedrate(HMI_flag.feedspeed_axis, HMI_ValueStruct.Max_Feedspeed); - Draw_Edit_Integer4(select_speed.now, HMI_ValueStruct.Max_Feedspeed); + encoderRate.enabled = false; + if (WITHIN(hmiFlag.feedspeed_axis, X_AXIS, LAST_AXIS)) + planner.set_max_feedrate(hmiFlag.feedspeed_axis, hmiValues.Max_Feedspeed); + drawEditInteger4(select_speed.now, hmiValues.Max_Feedspeed); return; } // MaxFeedspeed limit - if (WITHIN(HMI_flag.feedspeed_axis, X_AXIS, LAST_AXIS)) - LIMIT(HMI_ValueStruct.Max_Feedspeed, min_feedrate_edit_values[HMI_flag.feedspeed_axis], max_feedrate_edit_values[HMI_flag.feedspeed_axis]); + if (WITHIN(hmiFlag.feedspeed_axis, X_AXIS, LAST_AXIS)) + LIMIT(hmiValues.Max_Feedspeed, min_feedrate_edit_values[hmiFlag.feedspeed_axis], max_feedrate_edit_values[hmiFlag.feedspeed_axis]); // MaxFeedspeed value - Draw_Edit_Integer4(select_speed.now, HMI_ValueStruct.Max_Feedspeed, true); + drawEditInteger4(select_speed.now, hmiValues.Max_Feedspeed, true); } -void HMI_MaxAccelerationXYZE() { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); +void hmiMaxAccelerationXYZE() { + EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; - if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Acceleration)) { + if (applyEncoder(encoder_diffState, hmiValues.Max_Acceleration)) { checkkey = MaxAcceleration; - EncoderRate.enabled = false; - if (WITHIN(HMI_flag.acc_axis, X_AXIS, LAST_AXIS)) - planner.set_max_acceleration(HMI_flag.acc_axis, HMI_ValueStruct.Max_Acceleration); - Draw_Edit_Integer4(select_acc.now, HMI_ValueStruct.Max_Acceleration); + encoderRate.enabled = false; + if (WITHIN(hmiFlag.acc_axis, X_AXIS, LAST_AXIS)) + planner.set_max_acceleration(hmiFlag.acc_axis, hmiValues.Max_Acceleration); + drawEditInteger4(select_acc.now, hmiValues.Max_Acceleration); return; } // MaxAcceleration limit - if (WITHIN(HMI_flag.acc_axis, X_AXIS, LAST_AXIS)) - LIMIT(HMI_ValueStruct.Max_Acceleration, min_acceleration_edit_values[HMI_flag.acc_axis], max_acceleration_edit_values[HMI_flag.acc_axis]); + if (WITHIN(hmiFlag.acc_axis, X_AXIS, LAST_AXIS)) + LIMIT(hmiValues.Max_Acceleration, min_acceleration_edit_values[hmiFlag.acc_axis], max_acceleration_edit_values[hmiFlag.acc_axis]); // MaxAcceleration value - Draw_Edit_Integer4(select_acc.now, HMI_ValueStruct.Max_Acceleration, true); + drawEditInteger4(select_acc.now, hmiValues.Max_Acceleration, true); } #if HAS_CLASSIC_JERK - void HMI_MaxJerkXYZE() { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); + void hmiMaxJerkXYZE() { + EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; - if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Jerk_scaled)) { + if (applyEncoder(encoder_diffState, hmiValues.Max_Jerk_scaled)) { checkkey = MaxJerk; - EncoderRate.enabled = false; - if (WITHIN(HMI_flag.jerk_axis, X_AXIS, LAST_AXIS)) - planner.set_max_jerk(HMI_flag.jerk_axis, HMI_ValueStruct.Max_Jerk_scaled / MINUNITMULT); - Draw_Edit_Float3(select_jerk.now, HMI_ValueStruct.Max_Jerk_scaled); + encoderRate.enabled = false; + if (WITHIN(hmiFlag.jerk_axis, X_AXIS, LAST_AXIS)) + planner.set_max_jerk(hmiFlag.jerk_axis, hmiValues.Max_Jerk_scaled / MINUNITMULT); + drawEditFloat3(select_jerk.now, hmiValues.Max_Jerk_scaled); return; } // MaxJerk limit - if (WITHIN(HMI_flag.jerk_axis, X_AXIS, LAST_AXIS)) - LIMIT(HMI_ValueStruct.Max_Jerk_scaled, min_jerk_edit_values[HMI_flag.jerk_axis] * MINUNITMULT, max_jerk_edit_values[HMI_flag.jerk_axis] * MINUNITMULT); + if (WITHIN(hmiFlag.jerk_axis, X_AXIS, LAST_AXIS)) + LIMIT(hmiValues.Max_Jerk_scaled, min_jerk_edit_values[hmiFlag.jerk_axis] * MINUNITMULT, max_jerk_edit_values[hmiFlag.jerk_axis] * MINUNITMULT); // MaxJerk value - Draw_Edit_Float3(select_jerk.now, HMI_ValueStruct.Max_Jerk_scaled, true); + drawEditFloat3(select_jerk.now, hmiValues.Max_Jerk_scaled, true); } #endif // HAS_CLASSIC_JERK -void HMI_StepXYZE() { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); +void hmiStepXYZE() { + EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; - if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Step_scaled)) { + if (applyEncoder(encoder_diffState, hmiValues.Max_Step_scaled)) { checkkey = Step; - EncoderRate.enabled = false; - if (WITHIN(HMI_flag.step_axis, X_AXIS, LAST_AXIS)) - planner.settings.axis_steps_per_mm[HMI_flag.step_axis] = HMI_ValueStruct.Max_Step_scaled / MINUNITMULT; - Draw_Edit_Float3(select_step.now, HMI_ValueStruct.Max_Step_scaled); + encoderRate.enabled = false; + if (WITHIN(hmiFlag.step_axis, X_AXIS, LAST_AXIS)) + planner.settings.axis_steps_per_mm[hmiFlag.step_axis] = hmiValues.Max_Step_scaled / MINUNITMULT; + drawEditFloat3(select_step.now, hmiValues.Max_Step_scaled); return; } // Step limit - if (WITHIN(HMI_flag.step_axis, X_AXIS, LAST_AXIS)) - LIMIT(HMI_ValueStruct.Max_Step_scaled, min_steps_edit_values[HMI_flag.step_axis] * MINUNITMULT, max_steps_edit_values[HMI_flag.step_axis] * MINUNITMULT); + if (WITHIN(hmiFlag.step_axis, X_AXIS, LAST_AXIS)) + LIMIT(hmiValues.Max_Step_scaled, min_steps_edit_values[hmiFlag.step_axis] * MINUNITMULT, max_steps_edit_values[hmiFlag.step_axis] * MINUNITMULT); // Step value - Draw_Edit_Float3(select_step.now, HMI_ValueStruct.Max_Step_scaled, true); + drawEditFloat3(select_step.now, hmiValues.Max_Step_scaled, true); } // Draw X, Y, Z and blink if in an un-homed or un-trusted state @@ -1631,11 +1632,11 @@ void _update_axis_value(const AxisEnum axis, const uint16_t x, const uint16_t y, if (force || changed || draw_qmark || draw_empty) { if (blink && draw_qmark) - DWIN_Draw_String(true, font8x16, Color_White, Color_Bg_Black, x, y, F("???.?")); + dwinDrawString(true, font8x16, Color_White, Color_Bg_Black, x, y, F("???.?")); else if (blink && draw_empty) - DWIN_Draw_String(true, font8x16, Color_White, Color_Bg_Black, x, y, F(" ")); + dwinDrawString(true, font8x16, Color_White, Color_Bg_Black, x, y, F(" ")); else - DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, x, y, p); + dwinDrawFloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, x, y, p); } } @@ -1682,27 +1683,27 @@ void update_variable() { // Tune page temperature update #if HAS_HOTEND if (_new_hotend_target) - Draw_Edit_Integer3(TUNE_CASE_TEMP + MROWS - index_tune, _hotendtarget); + drawEditInteger3(TUNE_CASE_TEMP + MROWS - index_tune, _hotendtarget); #endif #if HAS_HEATED_BED if (_new_bed_target) - Draw_Edit_Integer3(TUNE_CASE_BED + MROWS - index_tune, _bedtarget); + drawEditInteger3(TUNE_CASE_BED + MROWS - index_tune, _bedtarget); #endif #if HAS_FAN if (_new_fanspeed) - Draw_Edit_Integer3(TUNE_CASE_FAN + MROWS - index_tune, _fanspeed); + drawEditInteger3(TUNE_CASE_FAN + MROWS - index_tune, _fanspeed); #endif } else if (checkkey == TemperatureID) { // Temperature page temperature update #if HAS_HOTEND - if (_new_hotend_target) Draw_Edit_Integer3(TEMP_CASE_TEMP, _hotendtarget); + if (_new_hotend_target) drawEditInteger3(TEMP_CASE_TEMP, _hotendtarget); #endif #if HAS_HEATED_BED - if (_new_bed_target) Draw_Edit_Integer3(TEMP_CASE_BED, _bedtarget); + if (_new_bed_target) drawEditInteger3(TEMP_CASE_BED, _bedtarget); #endif #if HAS_FAN - if (_new_fanspeed) Draw_Edit_Integer3(TEMP_CASE_FAN, _fanspeed); + if (_new_fanspeed) drawEditInteger3(TEMP_CASE_FAN, _fanspeed); #endif } @@ -1710,34 +1711,34 @@ void update_variable() { #if HAS_HOTEND if (_new_hotend_temp) - Draw_Stat_Int(28, 384, _hotendtemp); + drawStatInt(28, 384, _hotendtemp); if (_new_hotend_target) - Draw_Stat_Int(25 + 4 * STAT_CHR_W + 6, 384, _hotendtarget); + drawStatInt(25 + 4 * STAT_CHR_W + 6, 384, _hotendtarget); static int16_t _flow = 0; if (_flow != planner.flow_percentage[0]) { _flow = planner.flow_percentage[0]; - Draw_Stat_Int(116 + 2 * STAT_CHR_W, 417, _flow); + drawStatInt(116 + 2 * STAT_CHR_W, 417, _flow); } #endif #if HAS_HEATED_BED if (_new_bed_temp) - Draw_Stat_Int(28, 417, _bedtemp); + drawStatInt(28, 417, _bedtemp); if (_new_bed_target) - Draw_Stat_Int(25 + 4 * STAT_CHR_W + 6, 417, _bedtarget); + drawStatInt(25 + 4 * STAT_CHR_W + 6, 417, _bedtarget); #endif static int16_t _feedrate = 0; if (_feedrate != feedrate_percentage) { _feedrate = feedrate_percentage; - Draw_Stat_Int(116 + 2 * STAT_CHR_W, 384, _feedrate); + drawStatInt(116 + 2 * STAT_CHR_W, 384, _feedrate); } #if HAS_FAN if (_new_fanspeed) { _fanspeed = thermalManager.fan_speed[0]; - Draw_Stat_Int(195 + 2 * STAT_CHR_W, 384, _fanspeed); + drawStatInt(195 + 2 * STAT_CHR_W, 384, _fanspeed); } #endif @@ -1745,12 +1746,12 @@ void update_variable() { if (BABY_Z_VAR != _offset) { _offset = BABY_Z_VAR; if (BABY_Z_VAR < 0) { - Draw_Stat_Float(207, 417, -_offset); - DWIN_Draw_String(true, font8x16, Color_White, Color_Bg_Black, 205, 419, F("-")); + drawStatFloat(207, 417, -_offset); + dwinDrawString(true, font8x16, Color_White, Color_Bg_Black, 205, 419, F("-")); } else { - Draw_Stat_Float(207, 417, _offset); - DWIN_Draw_String(true, font8x16, Color_White, Color_Bg_Black, 205, 419, F(" ")); + drawStatFloat(207, 417, _offset); + dwinDrawString(true, font8x16, Color_White, Color_Bg_Black, 205, 419, F(" ")); } } @@ -1765,10 +1766,6 @@ void update_variable() { * cache files here. */ -#ifndef strcasecmp_P - #define strcasecmp_P(a, b) strcasecmp((a), (b)) -#endif - void make_name_without_ext(char *dst, char *src, size_t maxlen=MENU_CHAR_LIMIT) { char * const name = card.longest_filename(); size_t pos = strlen(name); // index of ending nul @@ -1792,15 +1789,15 @@ void make_name_without_ext(char *dst, char *src, size_t maxlen=MENU_CHAR_LIMIT) while (pos--) dst[pos] = src[pos]; } -void HMI_SDCardInit() { card.cdroot(); } +void hmiSDCardInit() { card.cdroot(); } // Initialize or re-initialize the LCD -void MarlinUI::init_lcd() { DWIN_Startup(); } +void MarlinUI::init_lcd() { dwinStartup(); } void MarlinUI::refresh() { /* Nothing to see here */ } #if HAS_LCD_BRIGHTNESS - void MarlinUI::_set_brightness() { DWIN_LCD_Brightness(backlight ? brightness : 0); } + void MarlinUI::_set_brightness() { dwinLCDBrightness(backlight ? brightness : 0); } #endif #if ENABLED(SCROLL_LONG_FILENAMES) @@ -1810,7 +1807,7 @@ void MarlinUI::refresh() { /* Nothing to see here */ } millis_t shift_ms; // = 0 // Init the shift name based on the highlighted item - void Init_Shift_Name() { + void initShiftName() { const bool is_subdir = !card.flag.workDirIsRoot; const int8_t filenum = select_file.now - 1 - is_subdir; // Skip "Back" and ".." const int16_t fileCnt = card.get_num_items(); @@ -1821,7 +1818,7 @@ void MarlinUI::refresh() { /* Nothing to see here */ } } } - void Init_SDItem_Shift() { + void initSDItemShift() { shift_amt = 0; shift_ms = select_file.now != CASE_BACK && strlen(shift_name) > MENU_CHAR_LIMIT ? millis() + 750UL : 0; @@ -1832,11 +1829,11 @@ void MarlinUI::refresh() { /* Nothing to see here */ } /** * Display an SD item, adding a CDUP for subfolders. */ -void Draw_SDItem(const uint16_t item, int16_t row=-1) { +void drawSDItem(const uint16_t item, int16_t row=-1) { if (row < 0) row = item + 1 + MROWS - index_file; const bool is_subdir = !card.flag.workDirIsRoot; if (is_subdir && item == 0) { - Draw_Menu_Line(row, ICON_Folder, F("..")); + drawMenuLine(row, ICON_Folder, F("..")); return; } @@ -1848,19 +1845,19 @@ void Draw_SDItem(const uint16_t item, int16_t row=-1) { // This is used during scroll drawing if (item == select_file.now - 1) { make_name_without_ext(shift_name, name, 100); - Init_SDItem_Shift(); + initSDItemShift(); } #endif // Draw the file/folder with name aligned left char str[strlen(name) + 1]; make_name_without_ext(str, name); - Draw_Menu_Line(row, card.flag.filenameIsDir ? ICON_Folder : ICON_File, str); + drawMenuLine(row, card.flag.filenameIsDir ? ICON_Folder : ICON_File, str); } #if ENABLED(SCROLL_LONG_FILENAMES) - void Draw_SDItem_Shifted(uint8_t &shift) { + void drawSDItemShifted(uint8_t &shift) { // Limit to the number of chars past the cutoff const size_t len = strlen(shift_name); NOMORE(shift, _MAX(len - MENU_CHAR_LIMIT, 0U)); @@ -1872,8 +1869,8 @@ void Draw_SDItem(const uint16_t item, int16_t row=-1) { shift_name[lastchar] = '\0'; const uint8_t row = select_file.now + MROWS - index_file; // skip "Back" and scroll - Erase_Menu_Text(row); - Draw_Menu_Line(row, 0, &shift_name[shift]); + eraseMenuText(row); + drawMenuLine(row, 0, &shift_name[shift]); shift_name[lastchar] = c; } @@ -1881,57 +1878,57 @@ void Draw_SDItem(const uint16_t item, int16_t row=-1) { #endif // Redraw the first set of SD Files -void Redraw_SD_List() { +void redrawSDList() { select_file.reset(); index_file = MROWS; - Clear_Menu_Area(); // Leave title bar unchanged + clearMenuArea(); // Leave title bar unchanged - Draw_Back_First(); + drawBackFirst(); if (card.isMounted()) { // As many files as will fit for (uint8_t i = 0; i < _MIN(nr_sd_menu_items(), MROWS); ++i) - Draw_SDItem(i, i + 1); + drawSDItem(i, i + 1); - TERN_(SCROLL_LONG_FILENAMES, Init_SDItem_Shift()); + TERN_(SCROLL_LONG_FILENAMES, initSDItemShift()); } else { - DWIN_Draw_Rectangle(1, Color_Bg_Red, 10, MBASE(3) - 10, DWIN_WIDTH - 10, MBASE(4)); - DWIN_Draw_String(false, font16x32, Color_Yellow, Color_Bg_Red, ((DWIN_WIDTH) - 8 * 16) / 2, MBASE(3), F("No Media")); + dwinDrawRectangle(1, Color_Bg_Red, 10, MBASE(3) - 10, DWIN_WIDTH - 10, MBASE(4)); + dwinDrawString(false, font16x32, Color_Yellow, Color_Bg_Red, ((DWIN_WIDTH) - 8 * 16) / 2, MBASE(3), F("No Media")); } } bool DWIN_lcd_sd_status = false; -void SDCard_Up() { +void sdCardUp() { card.cdup(); - Redraw_SD_List(); + redrawSDList(); DWIN_lcd_sd_status = false; // On next DWIN_Update } -void SDCard_Folder(char * const dirname) { +void sdCardFolder(char * const dirname) { card.cd(dirname); - Redraw_SD_List(); + redrawSDList(); DWIN_lcd_sd_status = false; // On next DWIN_Update } // // Watch for media mount / unmount // -void HMI_SDCardUpdate() { - if (HMI_flag.home_flag) return; +void hmiSDCardUpdate() { + if (hmiFlag.home_flag) return; if (DWIN_lcd_sd_status != card.isMounted()) { DWIN_lcd_sd_status = card.isMounted(); //SERIAL_ECHOLNPGM("HMI_SDCardUpdate: ", DWIN_lcd_sd_status); if (DWIN_lcd_sd_status) { if (checkkey == SelectFile) - Redraw_SD_List(); + redrawSDList(); } else { // clean file icon if (checkkey == SelectFile) { - Redraw_SD_List(); + redrawSDList(); } else if (checkkey == PrintProcess || checkkey == Tune || printingIsActive()) { // TODO: Move card removed abort handling @@ -1941,7 +1938,7 @@ void HMI_SDCardUpdate() { dwin_abort_flag = true; // Reset feedrate, return to Home } } - DWIN_UpdateLCD(); + dwinUpdateLCD(); } } @@ -1949,139 +1946,139 @@ void HMI_SDCardUpdate() { // The status area is always on-screen, except during // full-screen modal dialogs. (TODO: Keep alive during dialogs) // -void Draw_Status_Area(const bool with_update) { +void drawStatusArea(const bool with_update) { - DWIN_Draw_Rectangle(1, Color_Bg_Black, 0, STATUS_Y, DWIN_WIDTH, DWIN_HEIGHT - 1); + dwinDrawRectangle(1, Color_Bg_Black, 0, STATUS_Y, DWIN_WIDTH, DWIN_HEIGHT - 1); #if HAS_HOTEND - DWIN_ICON_Show(ICON, ICON_HotendTemp, 10, 383); - Draw_Stat_Int(28, 384, thermalManager.wholeDegHotend(0)); - DWIN_Draw_String(false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 384, F("/")); - Draw_Stat_Int(25 + 4 * STAT_CHR_W + 6, 384, thermalManager.degTargetHotend(0)); - - DWIN_ICON_Show(ICON, ICON_StepE, 112, 417); - Draw_Stat_Int(116 + 2 * STAT_CHR_W, 417, planner.flow_percentage[0]); - DWIN_Draw_String(false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 116 + 5 * STAT_CHR_W + 2, 417, F("%")); + dwinIconShow(ICON, ICON_HotendTemp, 10, 383); + drawStatInt(28, 384, thermalManager.wholeDegHotend(0)); + dwinDrawString(false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 384, F("/")); + drawStatInt(25 + 4 * STAT_CHR_W + 6, 384, thermalManager.degTargetHotend(0)); + + dwinIconShow(ICON, ICON_StepE, 112, 417); + drawStatInt(116 + 2 * STAT_CHR_W, 417, planner.flow_percentage[0]); + dwinDrawString(false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 116 + 5 * STAT_CHR_W + 2, 417, F("%")); #endif #if HAS_HEATED_BED - DWIN_ICON_Show(ICON, ICON_BedTemp, 10, 416); - Draw_Stat_Int(28, 417, thermalManager.wholeDegBed()); - DWIN_Draw_String(false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 417, F("/")); - Draw_Stat_Int(25 + 4 * STAT_CHR_W + 6, 417, thermalManager.degTargetBed()); + dwinIconShow(ICON, ICON_BedTemp, 10, 416); + drawStatInt(28, 417, thermalManager.wholeDegBed()); + dwinDrawString(false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 417, F("/")); + drawStatInt(25 + 4 * STAT_CHR_W + 6, 417, thermalManager.degTargetBed()); #endif - DWIN_ICON_Show(ICON, ICON_Speed, 113, 383); - Draw_Stat_Int(116 + 2 * STAT_CHR_W, 384, feedrate_percentage); - DWIN_Draw_String(false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 116 + 5 * STAT_CHR_W + 2, 384, F("%")); + dwinIconShow(ICON, ICON_Speed, 113, 383); + drawStatInt(116 + 2 * STAT_CHR_W, 384, feedrate_percentage); + dwinDrawString(false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 116 + 5 * STAT_CHR_W + 2, 384, F("%")); #if HAS_FAN - DWIN_ICON_Show(ICON, ICON_FanSpeed, 187, 383); - Draw_Stat_Int(195 + 2 * STAT_CHR_W, 384, thermalManager.fan_speed[0]); + dwinIconShow(ICON, ICON_FanSpeed, 187, 383); + drawStatInt(195 + 2 * STAT_CHR_W, 384, thermalManager.fan_speed[0]); #endif #if HAS_ZOFFSET_ITEM - DWIN_ICON_Show(ICON, ICON_Zoffset, 187, 416); + dwinIconShow(ICON, ICON_Zoffset, 187, 416); #endif if (BABY_Z_VAR < 0) { - Draw_Stat_Float(207, 417, -BABY_Z_VAR * 100); - DWIN_Draw_String(true, font8x16, Color_White, Color_Bg_Black, 205, 419, F("-")); + drawStatFloat(207, 417, -BABY_Z_VAR * 100); + dwinDrawString(true, font8x16, Color_White, Color_Bg_Black, 205, 419, F("-")); } else { - Draw_Stat_Float(207, 417, BABY_Z_VAR * 100); - DWIN_Draw_String(true, font8x16, Color_White, Color_Bg_Black, 205, 419, F(" ")); + drawStatFloat(207, 417, BABY_Z_VAR * 100); + dwinDrawString(true, font8x16, Color_White, Color_Bg_Black, 205, 419, F(" ")); } - DWIN_Draw_Rectangle(1, Line_Color, 0, 449, DWIN_WIDTH, 451); + dwinDrawRectangle(1, Line_Color, 0, 449, DWIN_WIDTH, 451); - DWIN_ICON_Show(ICON, ICON_MaxSpeedX, 10, 456); - DWIN_ICON_Show(ICON, ICON_MaxSpeedY, 95, 456); - DWIN_ICON_Show(ICON, ICON_MaxSpeedZ, 180, 456); + dwinIconShow(ICON, ICON_MaxSpeedX, 10, 456); + dwinIconShow(ICON, ICON_MaxSpeedY, 95, 456); + dwinIconShow(ICON, ICON_MaxSpeedZ, 180, 456); _draw_xyz_position(true); if (with_update) { - DWIN_UpdateLCD(); + dwinUpdateLCD(); delay(5); } } -void HMI_StartFrame(const bool with_update) { - Goto_MainMenu(); - Draw_Status_Area(with_update); +void hmiStartFrame(const bool with_update) { + gotoMainMenu(); + drawStatusArea(with_update); } -void Draw_Info_Menu() { - Clear_Main_Window(); +void drawInfoMenu() { + clearMainWindow(); - DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Black, (DWIN_WIDTH - strlen(MACHINE_SIZE) * MENU_CHR_W) / 2, 122, F(MACHINE_SIZE)); - DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Black, (DWIN_WIDTH - strlen(SHORT_BUILD_VERSION) * MENU_CHR_W) / 2, 195, F(SHORT_BUILD_VERSION)); + dwinDrawString(false, font8x16, Color_White, Color_Bg_Black, (DWIN_WIDTH - strlen(MACHINE_SIZE) * MENU_CHR_W) / 2, 122, F(MACHINE_SIZE)); + dwinDrawString(false, font8x16, Color_White, Color_Bg_Black, (DWIN_WIDTH - strlen(SHORT_BUILD_VERSION) * MENU_CHR_W) / 2, 195, F(SHORT_BUILD_VERSION)); - if (HMI_IsChinese()) { - DWIN_Frame_TitleCopy(30, 17, 28, 13); // "Info" + if (hmiIsChinese()) { + dwinFrameTitleCopy(30, 17, 28, 13); // "Info" - DWIN_Frame_AreaCopy(1, 197, 149, 252, 161, 108, 102); // "Size" - DWIN_Frame_AreaCopy(1, 1, 164, 56, 176, 108, 175); // "Firmware Version" - DWIN_Frame_AreaCopy(1, 58, 164, 113, 176, 105, 248); // "Contact Details" + dwinFrameAreaCopy(1, 197, 149, 252, 161, 108, 102); // "Size" + dwinFrameAreaCopy(1, 1, 164, 56, 176, 108, 175); // "Firmware Version" + dwinFrameAreaCopy(1, 58, 164, 113, 176, 105, 248); // "Contact Details" } else { #ifdef USE_STRING_HEADINGS - Draw_Title(GET_TEXT_F(MSG_INFO_SCREEN)); + drawTitle(GET_TEXT_F(MSG_INFO_SCREEN)); #else - DWIN_Frame_TitleCopy(192, 15, 23, 12); // "Info" + dwinFrameTitleCopy(192, 15, 23, 12); // "Info" #endif - DWIN_Frame_AreaCopy(1, 120, 150, 146, 161, 124, 102); // "Size" - DWIN_Frame_AreaCopy(1, 146, 151, 254, 161, 82, 175); // "Firmware Version" - DWIN_Frame_AreaCopy(1, 1, 164, 96, 175, 89, 248); // "Contact details" + dwinFrameAreaCopy(1, 120, 150, 146, 161, 124, 102); // "Size" + dwinFrameAreaCopy(1, 146, 151, 254, 161, 82, 175); // "Firmware Version" + dwinFrameAreaCopy(1, 1, 164, 96, 175, 89, 248); // "Contact details" } - DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Black, (DWIN_WIDTH - strlen(CORP_WEBSITE) * MENU_CHR_W) / 2, 268, F(CORP_WEBSITE)); + dwinDrawString(false, font8x16, Color_White, Color_Bg_Black, (DWIN_WIDTH - strlen(CORP_WEBSITE) * MENU_CHR_W) / 2, 268, F(CORP_WEBSITE)); - Draw_Back_First(); + drawBackFirst(); for (uint8_t i = 0; i < 3; ++i) { - DWIN_ICON_Show(ICON, ICON_PrintSize + i, 26, 99 + i * 73); - DWIN_Draw_Line(Line_Color, 16, MBASE(2) + i * 73, 256, 156 + i * 73); + dwinIconShow(ICON, ICON_PrintSize + i, 26, 99 + i * 73); + dwinDrawLine(Line_Color, 16, MBASE(2) + i * 73, 256, 156 + i * 73); } } -void Draw_Print_File_Menu() { - Clear_Title_Bar(); +void drawPrintFileMenu() { + clearTitleBar(); - if (HMI_IsChinese()) - DWIN_Frame_TitleCopy(0, 31, 56, 14); // "Print file" + if (hmiIsChinese()) + dwinFrameTitleCopy(0, 31, 56, 14); // "Print file" else { #ifdef USE_STRING_HEADINGS - Draw_Title(GET_TEXT_F(MSG_MEDIA_MENU)); + drawTitle(GET_TEXT_F(MSG_MEDIA_MENU)); #else - DWIN_Frame_TitleCopy(52, 31, 86, 11); // "Print file" + dwinFrameTitleCopy(52, 31, 86, 11); // "Print file" #endif } - Redraw_SD_List(); + redrawSDList(); } // Main Process -void HMI_MainMenu() { +void hmiMainMenu() { EncoderState encoder_diffState = get_encoder_state(); if (encoder_diffState == ENCODER_DIFF_NO) return; if (encoder_diffState == ENCODER_DIFF_CW) { if (select_page.inc(4)) { switch (select_page.now) { - case PAGE_PRINT: ICON_Print(); break; - case PAGE_PREPARE: ICON_Print(); ICON_Prepare(); break; - case PAGE_CONTROL: ICON_Prepare(); ICON_Control(); break; - case PAGE_INFO_LEVELING: ICON_Control(); TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)(); break; + case PAGE_PRINT: iconPrint(); break; + case PAGE_PREPARE: iconPrint(); iconPrepare(); break; + case PAGE_CONTROL: iconPrepare(); iconControl(); break; + case PAGE_INFO_LEVELING: iconControl(); TERN(HAS_ONESTEP_LEVELING, iconLeveling, iconStartInfo)(); break; } } } else if (encoder_diffState == ENCODER_DIFF_CCW) { if (select_page.dec()) { switch (select_page.now) { - case PAGE_PRINT: ICON_Print(); ICON_Prepare(); break; - case PAGE_PREPARE: ICON_Prepare(); ICON_Control(); break; - case PAGE_CONTROL: ICON_Control(); TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)(); break; - case PAGE_INFO_LEVELING: TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)(); break; + case PAGE_PRINT: iconPrint(); iconPrepare(); break; + case PAGE_PREPARE: iconPrepare(); iconControl(); break; + case PAGE_CONTROL: iconControl(); TERN(HAS_ONESTEP_LEVELING, iconLeveling, iconStartInfo)(); break; + case PAGE_INFO_LEVELING: TERN(HAS_ONESTEP_LEVELING, iconLeveling, iconStartInfo)(); break; } } } @@ -2089,39 +2086,39 @@ void HMI_MainMenu() { switch (select_page.now) { case PAGE_PRINT: checkkey = SelectFile; - Draw_Print_File_Menu(); + drawPrintFileMenu(); break; case PAGE_PREPARE: checkkey = Prepare; select_prepare.reset(); index_prepare = MROWS; - Draw_Prepare_Menu(); + drawPrepareMenu(); break; case PAGE_CONTROL: checkkey = Control; select_control.reset(); index_control = MROWS; - Draw_Control_Menu(); + drawControlMenu(); break; case PAGE_INFO_LEVELING: #if HAS_ONESTEP_LEVELING checkkey = Leveling; - HMI_Leveling(); + hmiLeveling(); #else checkkey = Info; - Draw_Info_Menu(); + drawInfoMenu(); #endif break; } } - DWIN_UpdateLCD(); + dwinUpdateLCD(); } // Select (and Print) File -void HMI_SelectFile() { +void hmiSelectFile() { EncoderState encoder_diffState = get_encoder_state(); const uint16_t hasUpDir = !card.flag.workDirIsRoot; @@ -2134,8 +2131,8 @@ void HMI_SelectFile() { if (ELAPSED(ms, shift_ms)) { const bool was_reset = shift_amt < 0; shift_ms = ms + 375UL + was_reset * 250UL; // ms per character - uint8_t shift_new = shift_amt + 1; // Try to shift by... - Draw_SDItem_Shifted(shift_new); // Draw the item + uint8_t shift_new = shift_amt + 1; // Try to shift by... + drawSDItemShifted(shift_new); // Draw the item if (!was_reset && shift_new == 0) // Was it limited to 0? shift_ms = 0; // No scrolling needed else if (shift_new == shift_amt) // Scroll reached the end @@ -2156,52 +2153,52 @@ void HMI_SelectFile() { if (select_file.inc(1 + fullCnt)) { const uint8_t itemnum = select_file.now - 1; // -1 for "Back" if (TERN0(SCROLL_LONG_FILENAMES, shift_ms)) { // If line was shifted - Erase_Menu_Text(itemnum + MROWS - index_file); // Erase and - Draw_SDItem(itemnum - 1); // redraw + eraseMenuText(itemnum + MROWS - index_file); // Erase and + drawSDItem(itemnum - 1); // redraw } if (select_file.now > MROWS && select_file.now > index_file) { // Cursor past the bottom index_file = select_file.now; // New bottom line - Scroll_Menu(DWIN_SCROLL_UP); - Draw_SDItem(itemnum, MROWS); // Draw and init the shift name + scrollMenu(DWIN_SCROLL_UP); + drawSDItem(itemnum, MROWS); // Draw and init the shift name } else { - Move_Highlight(1, select_file.now + MROWS - index_file); // Just move highlight - TERN_(SCROLL_LONG_FILENAMES, Init_Shift_Name()); // ...and init the shift name + moveHighlight(1, select_file.now + MROWS - index_file); // Just move highlight + TERN_(SCROLL_LONG_FILENAMES, initShiftName()); // ...and init the shift name } - TERN_(SCROLL_LONG_FILENAMES, Init_SDItem_Shift()); + TERN_(SCROLL_LONG_FILENAMES, initSDItemShift()); } } else if (encoder_diffState == ENCODER_DIFF_CCW && fullCnt) { if (select_file.dec()) { const uint8_t itemnum = select_file.now - 1; // -1 for "Back" if (TERN0(SCROLL_LONG_FILENAMES, shift_ms)) { // If line was shifted - Erase_Menu_Text(select_file.now + 1 + MROWS - index_file); // Erase and - Draw_SDItem(itemnum + 1); // redraw + eraseMenuText(select_file.now + 1 + MROWS - index_file); // Erase and + drawSDItem(itemnum + 1); // redraw } if (select_file.now < index_file - MROWS) { // Cursor past the top index_file--; // New bottom line - Scroll_Menu(DWIN_SCROLL_DOWN); + scrollMenu(DWIN_SCROLL_DOWN); if (index_file == MROWS) { - Draw_Back_First(); + drawBackFirst(); TERN_(SCROLL_LONG_FILENAMES, shift_ms = 0); } else - Draw_SDItem(itemnum, 0); // Draw the item (and init shift name) + drawSDItem(itemnum, 0); // Draw the item (and init shift name) } else { - Move_Highlight(-1, select_file.now + MROWS - index_file); // Just move highlight - TERN_(SCROLL_LONG_FILENAMES, Init_Shift_Name()); // ...and init the shift name + moveHighlight(-1, select_file.now + MROWS - index_file); // Just move highlight + TERN_(SCROLL_LONG_FILENAMES, initShiftName()); // ...and init the shift name } - TERN_(SCROLL_LONG_FILENAMES, Init_SDItem_Shift()); // Reset left. Init timer. + TERN_(SCROLL_LONG_FILENAMES, initSDItemShift()); // Reset left. Init timer. } } else if (encoder_diffState == ENCODER_DIFF_ENTER) { if (select_file.now == CASE_BACK) { // Back select_page.set(0); - Goto_MainMenu(); + gotoMainMenu(); } else if (hasUpDir && select_file.now == 1) { // CD-Up - SDCard_Up(); + sdCardUp(); goto HMI_SelectFileExit; } else { @@ -2210,7 +2207,7 @@ void HMI_SelectFile() { // Enter that folder! if (card.flag.filenameIsDir) { - SDCard_Folder(card.filename); + sdCardFolder(card.filename); goto HMI_SelectFileExit; } @@ -2219,9 +2216,9 @@ void HMI_SelectFile() { select_file.reset(); // Start choice and print SD file - HMI_flag.heat_flag = true; - HMI_flag.print_finish = false; - HMI_ValueStruct.show_mode = 0; + hmiFlag.heat_flag = true; + hmiFlag.print_finish = false; + hmiValues.show_mode = 0; card.openAndPrintFile(card.filename); @@ -2234,22 +2231,22 @@ void HMI_SelectFile() { _card_percent = 0; _remain_time = 0; - Goto_PrintProcess(); + gotoPrintProcess(); } } HMI_SelectFileExit: - DWIN_UpdateLCD(); + dwinUpdateLCD(); } // Printing -void HMI_Printing() { +void hmiPrinting() { EncoderState encoder_diffState = get_encoder_state(); if (encoder_diffState == ENCODER_DIFF_NO) return; - if (HMI_flag.done_confirm_flag) { + if (hmiFlag.done_confirm_flag) { if (encoder_diffState == ENCODER_DIFF_ENTER) { - HMI_flag.done_confirm_flag = false; + hmiFlag.done_confirm_flag = false; dwin_abort_flag = true; // Reset feedrate, return to Home } return; @@ -2259,18 +2256,18 @@ void HMI_Printing() { if (encoder_diffState == ENCODER_DIFF_CW) { if (select_print.inc(3)) { switch (select_print.now) { - case PRINT_SETUP: ICON_Tune(); break; - case PRINT_PAUSE_RESUME: ICON_Tune(); ICON_ResumeOrPause(); break; - case PRINT_STOP: ICON_ResumeOrPause(); ICON_Stop(); break; + case PRINT_SETUP: iconTune(); break; + case PRINT_PAUSE_RESUME: iconTune(); iconResumeOrPause(); break; + case PRINT_STOP: iconResumeOrPause(); iconStop(); break; } } } else if (encoder_diffState == ENCODER_DIFF_CCW) { if (select_print.dec()) { switch (select_print.now) { - case PRINT_SETUP: ICON_Tune(); ICON_ResumeOrPause(); break; - case PRINT_PAUSE_RESUME: ICON_ResumeOrPause(); ICON_Stop(); break; - case PRINT_STOP: ICON_Stop(); break; + case PRINT_SETUP: iconTune(); iconResumeOrPause(); break; + case PRINT_PAUSE_RESUME: iconResumeOrPause(); iconStop(); break; + case PRINT_STOP: iconStop(); break; } } } @@ -2278,15 +2275,15 @@ void HMI_Printing() { switch (select_print.now) { case PRINT_SETUP: checkkey = Tune; - HMI_ValueStruct.show_mode = 0; + hmiValues.show_mode = 0; select_tune.reset(); index_tune = MROWS; - Draw_Tune_Menu(); + drawTuneMenu(); break; case PRINT_PAUSE_RESUME: - if (HMI_flag.pause_flag) { - ICON_Pause(); + if (hmiFlag.pause_flag) { + iconPause(); char cmd[40]; cmd[0] = '\0'; @@ -2302,181 +2299,181 @@ void HMI_Printing() { queue.inject(cmd); } else { - HMI_flag.select_flag = true; + hmiFlag.select_flag = true; checkkey = Print_window; - Popup_window_PauseOrStop(); + popupwindowPauseOrStop(); } break; case PRINT_STOP: - HMI_flag.select_flag = true; + hmiFlag.select_flag = true; checkkey = Print_window; - Popup_window_PauseOrStop(); + popupwindowPauseOrStop(); break; default: break; } } - DWIN_UpdateLCD(); + dwinUpdateLCD(); } // Pause and Stop window -void HMI_PauseOrStop() { +void hmiPauseOrStop() { EncoderState encoder_diffState = get_encoder_state(); if (encoder_diffState == ENCODER_DIFF_NO) return; if (encoder_diffState == ENCODER_DIFF_CW) - Draw_Select_Highlight(false); + drawSelectHighlight(false); else if (encoder_diffState == ENCODER_DIFF_CCW) - Draw_Select_Highlight(true); + drawSelectHighlight(true); else if (encoder_diffState == ENCODER_DIFF_ENTER) { if (select_print.now == PRINT_PAUSE_RESUME) { - if (HMI_flag.select_flag) { - HMI_flag.pause_action = true; + if (hmiFlag.select_flag) { + hmiFlag.pause_action = true; queue.inject(F("M25")); } - Goto_PrintProcess(); + gotoPrintProcess(); } else if (select_print.now == PRINT_STOP) { - if (HMI_flag.select_flag) { + if (hmiFlag.select_flag) { checkkey = Back_Main; - wait_for_heatup = wait_for_user = false; // Stop waiting for heating/user - card.abortFilePrintSoon(); // Let the main loop handle SD abort - dwin_abort_flag = true; // Reset feedrate, return to Home + wait_for_heatup = wait_for_user = false; // Stop waiting for heating/user + card.abortFilePrintSoon(); // Let the main loop handle SD abort + dwin_abort_flag = true; // Reset feedrate, return to Home #ifdef ACTION_ON_CANCEL hostui.cancel(); #endif - Popup_Window_Home(true); - if (HMI_flag.home_flag) planner.synchronize(); // Wait for planner moves to finish! + popupWindowHome(true); + if (hmiFlag.home_flag) planner.synchronize(); // Wait for planner moves to finish! } else - Goto_PrintProcess(); // cancel stop + gotoPrintProcess(); // cancel stop } } - DWIN_UpdateLCD(); + dwinUpdateLCD(); } -void Draw_Move_Menu() { - Clear_Main_Window(); +void drawMoveMenu() { + clearMainWindow(); - if (HMI_IsChinese()) { - DWIN_Frame_TitleCopy(192, 1, 42, 14); // "Move" - Item_AreaCopy(58, 118, 106, 132, 1); - Item_AreaCopy(109, 118, 157, 132, 2); - Item_AreaCopy(160, 118, 209, 132, 3); - TERN_(HAS_HOTEND, Item_AreaCopy(212, 118, 253, 131, 4)); + if (hmiIsChinese()) { + dwinFrameTitleCopy(192, 1, 42, 14); // "Move" + itemAreaCopy(58, 118, 106, 132, 1); + itemAreaCopy(109, 118, 157, 132, 2); + itemAreaCopy(160, 118, 209, 132, 3); + TERN_(HAS_HOTEND, itemAreaCopy(212, 118, 253, 131, 4)); } else { #ifdef USE_STRING_HEADINGS - Draw_Title(GET_TEXT_F(MSG_MOVE_AXIS)); + drawTitle(GET_TEXT_F(MSG_MOVE_AXIS)); #else - DWIN_Frame_TitleCopy(231, 2, 35, 11); // "Move" + dwinFrameTitleCopy(231, 2, 35, 11); // "Move" #endif #ifdef USE_STRING_TITLES - DWIN_Draw_Label(1, GET_TEXT_F(MSG_MOVE_X)); - DWIN_Draw_Label(2, GET_TEXT_F(MSG_MOVE_Y)); - DWIN_Draw_Label(3, GET_TEXT_F(MSG_MOVE_Z)); - TERN_(HAS_HOTEND, DWIN_Draw_Label(4, GET_TEXT_F(MSG_MOVE_E))); + dwinDrawLabel(1, GET_TEXT_F(MSG_MOVE_X)); + dwinDrawLabel(2, GET_TEXT_F(MSG_MOVE_Y)); + dwinDrawLabel(3, GET_TEXT_F(MSG_MOVE_Z)); + TERN_(HAS_HOTEND, dwinDrawLabel(4, GET_TEXT_F(MSG_MOVE_E))); #else say_move_en(1); say_x_en(38, 1); // "Move X" say_move_en(2); say_y_en(38, 2); // "Move Y" say_move_en(3); say_z_en(38, 3); // "Move Z" - TERN_(HAS_HOTEND, (say_move_en(4), Item_AreaCopy(99, 194, 151, 204, 4, 38))); // "Move Extruder" + TERN_(HAS_HOTEND, (say_move_en(4), itemAreaCopy(99, 194, 151, 204, 4, 38))); // "Move Extruder" #endif } - Draw_Back_First(select_axis.now == CASE_BACK); - if (select_axis.now != CASE_BACK) Draw_Menu_Cursor(select_axis.now); + drawBackFirst(select_axis.now == CASE_BACK); + if (select_axis.now != CASE_BACK) drawMenuCursor(select_axis.now); // Draw separators and icons - for (uint8_t i = 0; i < 3 + ENABLED(HAS_HOTEND); ++i) Draw_Menu_Line(i + 1, ICON_MoveX + i); + for (uint8_t i = 0; i < 3 + ENABLED(HAS_HOTEND); ++i) drawMenuLine(i + 1, ICON_MoveX + i); } -void Item_Adv_HomeOffsets(const uint8_t row) { - if (false && HMI_IsChinese()) { +void itemAdvHomeOffsets(const uint8_t row) { + if (false && hmiIsChinese()) { // TODO: Chinese "Set Home Offsets" } else { #ifdef USE_STRING_TITLES - DWIN_Draw_Label(row, GET_TEXT_F(MSG_SET_HOME_OFFSETS)); + dwinDrawLabel(row, GET_TEXT_F(MSG_SET_HOME_OFFSETS)); #else - Item_AreaCopy(1, 76, 102, 87, row); // "Set Home Offsets" + itemAreaCopy(1, 76, 102, 87, row); // "Set Home Offsets" #endif } - Draw_Menu_Line(row, ICON_HomeOffset); - Draw_More_Icon(row); + drawMenuLine(row, ICON_HomeOffset); + drawMoreIcon(row); } #if HAS_ONESTEP_LEVELING - void Item_Adv_ProbeOffsets(const uint8_t row) { - if (false && HMI_IsChinese()) { + void itemAdvProbeOffsets(const uint8_t row) { + if (false && hmiIsChinese()) { // TODO: Chinese "Probe Offsets" } else { #ifdef USE_STRING_TITLES - DWIN_Draw_Label(row, GET_TEXT_F(MSG_ZPROBE_OFFSETS)); + dwinDrawLabel(row, GET_TEXT_F(MSG_ZPROBE_OFFSETS)); #else say_probe_offs_en(row); #endif } - Draw_Menu_Line(row, ICON_ProbeOffset); - Draw_More_Icon(row); + drawMenuLine(row, ICON_ProbeOffset); + drawMoreIcon(row); } #endif -void Item_Adv_HotendPID(const uint8_t row) { - if (false && HMI_IsChinese()) { +void itemAdvHotendPID(const uint8_t row) { + if (false && hmiIsChinese()) { // TODO: Chinese "Hotend PID" } else { #ifdef USE_STRING_TITLES - DWIN_Draw_Label(row, F("Hotend PID")); + dwinDrawLabel(row, F("Hotend PID")); #else - Item_AreaCopy(96, 104, 167, 114, row); // "Hotend PID" + itemAreaCopy(96, 104, 167, 114, row); // "Hotend PID" #endif } - Draw_Menu_Line(row, ICON_PIDNozzle); + drawMenuLine(row, ICON_PIDNozzle); } -void Item_Adv_BedPID(const uint8_t row) { - if (false && HMI_IsChinese()) { +void itemAdvBedPID(const uint8_t row) { + if (false && hmiIsChinese()) { // TODO: Chinese "Bed PID" } else { #ifdef USE_STRING_TITLES - DWIN_Draw_Label(row, F("Bed PID")); + dwinDrawLabel(row, F("Bed PID")); #else - Item_AreaCopy(241, 104, 263, 115, row); // "Bed" - Item_AreaCopy(145, 104, 167, 114, row, 27); // "PID" + itemAreaCopy(241, 104, 263, 115, row); // "Bed" + itemAreaCopy(145, 104, 167, 114, row, 27); // "PID" #endif } - Draw_Menu_Line(row, ICON_PIDbed); + drawMenuLine(row, ICON_PIDbed); } #if ENABLED(POWER_LOSS_RECOVERY) - void Item_Adv_PLR(const uint8_t row) { - if (false && HMI_IsChinese()) { + void itemAdv_PLR(const uint8_t row) { + if (false && hmiIsChinese()) { // TODO: Chinese "Power-loss Recovery" } else { #ifdef USE_STRING_TITLES - DWIN_Draw_Label(row, GET_TEXT_F(MSG_ZPROBE_OFFSETS)); + dwinDrawLabel(row, GET_TEXT_F(MSG_ZPROBE_OFFSETS)); #else - Item_AreaCopy(1, 208, 137, 221, row); // "Power-loss Recovery" + itemAreaCopy(1, 208, 137, 221, row); // "Power-loss Recovery" #endif } - Draw_Menu_Line(row, ICON_Motion); - Draw_Checkbox_Line(row, recovery.enabled); + drawMenuLine(row, ICON_Motion); + drawCheckboxLine(row, recovery.enabled); } #endif -void Draw_AdvancedSettings_Menu() { - Clear_Main_Window(); +void drawAdvancedSettingsMenu() { + clearMainWindow(); #if ADVSET_CASE_TOTAL >= TROWS const int16_t scroll = MROWS - index_advset; // Scrolled-up lines @@ -2486,128 +2483,128 @@ void Draw_AdvancedSettings_Menu() { #define ASCROL(L) (scroll + (L)) #define AVISI(L) VISI(ADVSET_CASE_TOTAL, L, ASCROL(L)) - if (false && HMI_IsChinese()) { + if (false && hmiIsChinese()) { // TODO: Chinese "Advanced Settings" } else { #ifdef USE_STRING_HEADINGS - Draw_Title(GET_TEXT_F(MSG_ADVANCED_SETTINGS)); + drawTitle(GET_TEXT_F(MSG_ADVANCED_SETTINGS)); #else - DWIN_Frame_TitleCopy(93, 401, 126, 15); // "Advanced Settings" + dwinFrameTitleCopy(93, 401, 126, 15); // "Advanced Settings" #endif } - if (AVISI(0)) Draw_Back_First(select_advset.now == CASE_BACK); - if (AVISI(ADVSET_CASE_HOMEOFF)) Item_Adv_HomeOffsets(ASCROL(ADVSET_CASE_HOMEOFF)); // Set Home Offsets > + if (AVISI(0)) drawBackFirst(select_advset.now == CASE_BACK); + if (AVISI(ADVSET_CASE_HOMEOFF)) itemAdvHomeOffsets(ASCROL(ADVSET_CASE_HOMEOFF)); // Set Home Offsets > #if HAS_ONESTEP_LEVELING - if (AVISI(ADVSET_CASE_PROBEOFF)) Item_Adv_ProbeOffsets(ASCROL(ADVSET_CASE_PROBEOFF)); // Probe Offsets > + if (AVISI(ADVSET_CASE_PROBEOFF)) itemAdvProbeOffsets(ASCROL(ADVSET_CASE_PROBEOFF)); // Probe Offsets > #endif - if (AVISI(ADVSET_CASE_HEPID)) Item_Adv_HotendPID(ASCROL(ADVSET_CASE_HEPID)); // Nozzle PID - if (AVISI(ADVSET_CASE_BEDPID)) Item_Adv_BedPID(ASCROL(ADVSET_CASE_BEDPID)); // Bed PID + if (AVISI(ADVSET_CASE_HEPID)) itemAdvHotendPID(ASCROL(ADVSET_CASE_HEPID)); // Nozzle PID + if (AVISI(ADVSET_CASE_BEDPID)) itemAdvBedPID(ASCROL(ADVSET_CASE_BEDPID)); // Bed PID #if ENABLED(POWER_LOSS_RECOVERY) - if (AVISI(ADVSET_CASE_PWRLOSSR)) Item_Adv_PLR(ASCROL(ADVSET_CASE_PWRLOSSR)); // Power-loss recovery + if (AVISI(ADVSET_CASE_PWRLOSSR)) itemAdv_PLR(ASCROL(ADVSET_CASE_PWRLOSSR)); // Power-loss recovery #endif - if (select_advset.now != CASE_BACK) Draw_Menu_Cursor(ASCROL(select_advset.now)); + if (select_advset.now != CASE_BACK) drawMenuCursor(ASCROL(select_advset.now)); } -void Item_HomeOffs_X(const uint8_t row) { - if (false && HMI_IsChinese()) { +void itemHomeOffs_X(const uint8_t row) { + if (false && hmiIsChinese()) { // TODO: Chinese "Home Offset X" } else { #ifdef USE_STRING_TITLES - Draw_Menu_Line(row, ICON_HomeOffsetX, GET_TEXT_F(MSG_HOME_OFFSET_X)); + drawMenuLine(row, ICON_HomeOffsetX, GET_TEXT_F(MSG_HOME_OFFSET_X)); #else say_home_offs_en(row); say_x_en(75, row); // "Home Offset X" #endif } - Draw_Menu_Line(row, ICON_HomeOffset); - Draw_Edit_Signed_Float3(row, HMI_ValueStruct.Home_OffX_scaled); + drawMenuLine(row, ICON_HomeOffset); + drawEditSignedFloat3(row, hmiValues.Home_OffX_scaled); } -void Item_HomeOffs_Y(const uint8_t row) { - if (false && HMI_IsChinese()) { +void itemHomeOffs_Y(const uint8_t row) { + if (false && hmiIsChinese()) { // TODO: Chinese "Home Offset Y" } else { #ifdef USE_STRING_TITLES - Draw_Menu_Line(row, ICON_HomeOffsetY, GET_TEXT_F(MSG_HOME_OFFSET_Y)); + drawMenuLine(row, ICON_HomeOffsetY, GET_TEXT_F(MSG_HOME_OFFSET_Y)); #else say_home_offs_en(row); say_y_en(75, row); // "Home Offset X" #endif } - Draw_Menu_Line(row, ICON_HomeOffset); - Draw_Edit_Signed_Float3(row, HMI_ValueStruct.Home_OffY_scaled); + drawMenuLine(row, ICON_HomeOffset); + drawEditSignedFloat3(row, hmiValues.Home_OffY_scaled); } -void Item_HomeOffs_Z(const uint8_t row) { - if (false && HMI_IsChinese()) { +void itemHomeOffs_Z(const uint8_t row) { + if (false && hmiIsChinese()) { // TODO: Chinese "Home Offset Z" } else { #ifdef USE_STRING_TITLES - Draw_Menu_Line(row, ICON_HomeOffsetZ, GET_TEXT_F(MSG_HOME_OFFSET_Z)); + drawMenuLine(row, ICON_HomeOffsetZ, GET_TEXT_F(MSG_HOME_OFFSET_Z)); #else say_home_offs_en(row); say_z_en(75, row); // "Home Offset Z" #endif } - Draw_Menu_Line(row, ICON_HomeOffset); - Draw_Edit_Signed_Float3(row, HMI_ValueStruct.Home_OffZ_scaled); + drawMenuLine(row, ICON_HomeOffset); + drawEditSignedFloat3(row, hmiValues.Home_OffZ_scaled); } -void Draw_HomeOff_Menu() { - Clear_Main_Window(); - if (false && HMI_IsChinese()) { +void drawHomeOffMenu() { + clearMainWindow(); + if (false && hmiIsChinese()) { // TODO: Chinese "Home Offsets" } else { #ifdef USE_STRING_HEADINGS - Draw_Title(GET_TEXT_F(MSG_SET_HOME_OFFSETS)); + drawTitle(GET_TEXT_F(MSG_SET_HOME_OFFSETS)); #else - DWIN_Frame_TitleCopy(1, 401, 91, 12); // "Home Offsets" + dwinFrameTitleCopy(1, 401, 91, 12); // "Home Offsets" #endif } - Draw_Back_First(select_item.now == CASE_BACK); - Item_HomeOffs_X(1); // "Home Offset X" - Item_HomeOffs_Y(2); // "Home Offset Y" - Item_HomeOffs_Z(3); // "Home Offset Z" - if (select_item.now != CASE_BACK) Draw_Menu_Cursor(select_item.now); + drawBackFirst(select_item.now == CASE_BACK); + itemHomeOffs_X(1); // "Home Offset X" + itemHomeOffs_Y(2); // "Home Offset Y" + itemHomeOffs_Z(3); // "Home Offset Z" + if (select_item.now != CASE_BACK) drawMenuCursor(select_item.now); } #if HAS_ONESTEP_LEVELING - void Draw_ProbeOff_Menu() { - Clear_Main_Window(); - Draw_Back_First(select_item.now == CASE_BACK); - if (false && HMI_IsChinese()) { + void drawProbeOffMenu() { + clearMainWindow(); + drawBackFirst(select_item.now == CASE_BACK); + if (false && hmiIsChinese()) { // TODO: Chinese "Probe Offsets" } else { #ifdef USE_STRING_HEADINGS - Draw_Title(GET_TEXT_F(MSG_ZPROBE_OFFSETS)); + drawTitle(GET_TEXT_F(MSG_ZPROBE_OFFSETS)); #else - DWIN_Frame_TitleCopy(124, 431, 91, 12); // "Probe Offsets" + dwinFrameTitleCopy(124, 431, 91, 12); // "Probe Offsets" #endif #ifdef USE_STRING_TITLES - Draw_Menu_Line(1, ICON_ProbeOffsetX, GET_TEXT_F(MSG_ZPROBE_XOFFSET)); // Probe X Offset - Draw_Menu_Line(2, ICON_ProbeOffsetY, GET_TEXT_F(MSG_ZPROBE_YOFFSET)); // Probe Y Offset + drawMenuLine(1, ICON_ProbeOffsetX, GET_TEXT_F(MSG_ZPROBE_XOFFSET)); // Probe X Offset + drawMenuLine(2, ICON_ProbeOffsetY, GET_TEXT_F(MSG_ZPROBE_YOFFSET)); // Probe Y Offset #else say_probe_offs_en(1); say_x_en(75, 1); // "Probe Offset X" say_probe_offs_en(2); say_y_en(75, 2); // "Probe Offset Y" #endif } - Draw_Edit_Signed_Float3(1, HMI_ValueStruct.Probe_OffX_scaled); - Draw_Edit_Signed_Float3(2, HMI_ValueStruct.Probe_OffY_scaled); + drawEditSignedFloat3(1, hmiValues.Probe_OffX_scaled); + drawEditSignedFloat3(2, hmiValues.Probe_OffY_scaled); - if (select_item.now != CASE_BACK) Draw_Menu_Cursor(select_item.now); + if (select_item.now != CASE_BACK) drawMenuCursor(select_item.now); } #endif #include "../../../libs/buzzer.h" -void HMI_AudioFeedback(const bool success=true) { +void hmiAudioFeedback(const bool success=true) { if (success) { BUZZ(100, 659); BUZZ(10, 0); @@ -2618,7 +2615,7 @@ void HMI_AudioFeedback(const bool success=true) { } // Prepare -void HMI_Prepare() { +void hmiPrepare() { EncoderState encoder_diffState = get_encoder_state(); if (encoder_diffState == ENCODER_DIFF_NO) return; @@ -2629,22 +2626,22 @@ void HMI_Prepare() { index_prepare = select_prepare.now; // Scroll up and draw a blank bottom line - Scroll_Menu(DWIN_SCROLL_UP); - Draw_Menu_Icon(MROWS, ICON_Axis + select_prepare.now - 1); + scrollMenu(DWIN_SCROLL_UP); + drawMenuIcon(MROWS, ICON_Axis + select_prepare.now - 1); // Draw "More" icon for sub-menus - if (index_prepare < 7) Draw_More_Icon(MROWS - index_prepare + 1); + if (index_prepare < 7) drawMoreIcon(MROWS - index_prepare + 1); #if PREHEAT_COUNT > 1 - if (index_prepare == PREPARE_CASE_ABS) Item_Prepare_ABS(MROWS); + if (index_prepare == PREPARE_CASE_ABS) itemPrepare_ABS(MROWS); #endif #if HAS_HOTEND || HAS_HEATED_BED - if (index_prepare == PREPARE_CASE_COOL) Item_Prepare_Cool(MROWS); + if (index_prepare == PREPARE_CASE_COOL) itemPrepareCool(MROWS); #endif - if (index_prepare == PREPARE_CASE_LANG) Item_Prepare_Lang(MROWS); + if (index_prepare == PREPARE_CASE_LANG) itemPrepareLang(MROWS); } else { - Move_Highlight(1, select_prepare.now + MROWS - index_prepare); + moveHighlight(1, select_prepare.now + MROWS - index_prepare); } } } @@ -2652,21 +2649,21 @@ void HMI_Prepare() { if (select_prepare.dec()) { if (select_prepare.now < index_prepare - MROWS) { index_prepare--; - Scroll_Menu(DWIN_SCROLL_DOWN); + scrollMenu(DWIN_SCROLL_DOWN); if (index_prepare == MROWS) - Draw_Back_First(); + drawBackFirst(); else - Draw_Menu_Line(0, ICON_Axis + select_prepare.now - 1); + drawMenuLine(0, ICON_Axis + select_prepare.now - 1); - if (index_prepare < 7) Draw_More_Icon(MROWS - index_prepare + 1); + if (index_prepare < 7) drawMoreIcon(MROWS - index_prepare + 1); - if (index_prepare == 6) Item_Prepare_Move(0); - else if (index_prepare == 7) Item_Prepare_Disable(0); - else if (index_prepare == 8) Item_Prepare_Home(0); + if (index_prepare == 6) itemPrepareMove(0); + else if (index_prepare == 7) itemPrepareDisable(0); + else if (index_prepare == 8) itemPrepareHome(0); } else { - Move_Highlight(-1, select_prepare.now + MROWS - index_prepare); + moveHighlight(-1, select_prepare.now + MROWS - index_prepare); } } } @@ -2674,19 +2671,19 @@ void HMI_Prepare() { switch (select_prepare.now) { case CASE_BACK: select_page.set(1); - Goto_MainMenu(); + gotoMainMenu(); break; case PREPARE_CASE_MOVE: checkkey = AxisMove; select_axis.reset(); - Draw_Move_Menu(); + drawMoveMenu(); - Draw_Edit_Float3(1, current_position.x * MINUNITMULT); - Draw_Edit_Float3(2, current_position.y * MINUNITMULT); - Draw_Edit_Float3(3, current_position.z * MINUNITMULT); + drawEditFloat3(1, current_position.x * MINUNITMULT); + drawEditFloat3(2, current_position.y * MINUNITMULT); + drawEditFloat3(3, current_position.z * MINUNITMULT); #if HAS_HOTEND - HMI_ValueStruct.Move_E_scaled = current_position.e * MINUNITMULT; - Draw_Edit_Signed_Float3(4, HMI_ValueStruct.Move_E_scaled); + hmiValues.Move_E_scaled = current_position.e * MINUNITMULT; + drawEditSignedFloat3(4, hmiValues.Move_E_scaled); #endif break; @@ -2696,21 +2693,21 @@ void HMI_Prepare() { checkkey = Last_Prepare; index_prepare = MROWS; queue.inject_P(G28_STR); // G28 will set home_flag - Popup_Window_Home(); + popupWindowHome(); break; #if HAS_ZOFFSET_ITEM case PREPARE_CASE_ZOFF: #if ANY(HAS_BED_PROBE, BABYSTEPPING) checkkey = Homeoffset; - HMI_ValueStruct.show_mode = -4; - HMI_ValueStruct.offset_value = BABY_Z_VAR * 100; - Draw_Edit_Signed_Float2(PREPARE_CASE_ZOFF + MROWS - index_prepare, HMI_ValueStruct.offset_value, true); - EncoderRate.enabled = true; + hmiValues.show_mode = -4; + hmiValues.offset_value = BABY_Z_VAR * 100; + drawEditSignedFloat2(PREPARE_CASE_ZOFF + MROWS - index_prepare, hmiValues.offset_value, true); + encoderRate.enabled = true; #else // Apply workspace offset, making the current position 0,0,0 queue.inject(F("G92X0Y0Z0")); - HMI_AudioFeedback(); + hmiAudioFeedback(); #endif break; #endif @@ -2730,113 +2727,113 @@ void HMI_Prepare() { #endif case PREPARE_CASE_LANG: - HMI_ToggleLanguage(); - Draw_Prepare_Menu(); + hmiToggleLanguage(); + drawPrepareMenu(); break; default: break; } } - DWIN_UpdateLCD(); + dwinUpdateLCD(); } -void Draw_Temperature_Menu() { - Clear_Main_Window(); +void drawTemperatureMenu() { + clearMainWindow(); - if (HMI_IsChinese()) { - DWIN_Frame_TitleCopy(236, 2, 28, 12); // "Temperature" + if (hmiIsChinese()) { + dwinFrameTitleCopy(236, 2, 28, 12); // "Temperature" #if HAS_HOTEND - Item_AreaCopy(1, 134, 56, 146, TEMP_CASE_TEMP); + itemAreaCopy(1, 134, 56, 146, TEMP_CASE_TEMP); #endif #if HAS_HEATED_BED - Item_AreaCopy(58, 134, 113, 146, TEMP_CASE_BED); + itemAreaCopy(58, 134, 113, 146, TEMP_CASE_BED); #endif #if HAS_FAN - Item_AreaCopy(115, 134, 170, 146, TEMP_CASE_FAN); + itemAreaCopy(115, 134, 170, 146, TEMP_CASE_FAN); #endif #if HAS_PREHEAT - Item_AreaCopy(100, 89, 178, 101, TEMP_CASE_PLA); + itemAreaCopy(100, 89, 178, 101, TEMP_CASE_PLA); #if PREHEAT_COUNT > 1 - Item_AreaCopy(180, 89, 260, 100, TEMP_CASE_ABS); + itemAreaCopy(180, 89, 260, 100, TEMP_CASE_ABS); #endif #endif } else { #ifdef USE_STRING_HEADINGS - Draw_Title(GET_TEXT_F(MSG_TEMPERATURE)); + drawTitle(GET_TEXT_F(MSG_TEMPERATURE)); #else - DWIN_Frame_TitleCopy(56, 15, 85, 14); // "Temperature" + dwinFrameTitleCopy(56, 15, 85, 14); // "Temperature" #endif #ifdef USE_STRING_TITLES #if HAS_HOTEND - DWIN_Draw_Label(TEMP_CASE_TEMP, GET_TEXT_F(MSG_UBL_SET_TEMP_HOTEND)); + dwinDrawLabel(TEMP_CASE_TEMP, GET_TEXT_F(MSG_UBL_SET_TEMP_HOTEND)); #endif #if HAS_HEATED_BED - DWIN_Draw_Label(TEMP_CASE_BED, GET_TEXT_F(MSG_UBL_SET_TEMP_BED)); + dwinDrawLabel(TEMP_CASE_BED, GET_TEXT_F(MSG_UBL_SET_TEMP_BED)); #endif #if HAS_FAN - DWIN_Draw_Label(TEMP_CASE_FAN, GET_TEXT_F(MSG_FAN_SPEED)); + dwinDrawLabel(TEMP_CASE_FAN, GET_TEXT_F(MSG_FAN_SPEED)); #endif #if HAS_PREHEAT - DWIN_Draw_Label(TEMP_CASE_PLA, F(PREHEAT_1_LABEL " Preheat Settings")); + dwinDrawLabel(TEMP_CASE_PLA, F(PREHEAT_1_LABEL " Preheat Settings")); #if PREHEAT_COUNT > 1 - DWIN_Draw_Label(TEMP_CASE_ABS, F(PREHEAT_2_LABEL " Preheat Settings")); + dwinDrawLabel(TEMP_CASE_ABS, F(PREHEAT_2_LABEL " Preheat Settings")); #endif #endif #else #if HAS_HOTEND - Item_AreaCopy(197, 104, 238, 114, TEMP_CASE_TEMP); // "Nozzle" - Item_AreaCopy(1, 89, 83, 101, TEMP_CASE_TEMP, 44); // "Temperature" + itemAreaCopy(197, 104, 238, 114, TEMP_CASE_TEMP); // "Nozzle" + itemAreaCopy(1, 89, 83, 101, TEMP_CASE_TEMP, 44); // "Temperature" #endif #if HAS_HEATED_BED - Item_AreaCopy(240, 104, 264, 114, TEMP_CASE_BED); // "Bed" - Item_AreaCopy(1, 89, 83, 101, TEMP_CASE_BED, 27); // "Temperature" + itemAreaCopy(240, 104, 264, 114, TEMP_CASE_BED); // "Bed" + itemAreaCopy(1, 89, 83, 101, TEMP_CASE_BED, 27); // "Temperature" #endif #if HAS_FAN - Item_AreaCopy( 1, 119, 61, 132, TEMP_CASE_FAN); // "Fan speed" + itemAreaCopy( 1, 119, 61, 132, TEMP_CASE_FAN); // "Fan speed" #endif #if HAS_PREHEAT - Item_AreaCopy(107, 76, 156, 86, TEMP_CASE_PLA); // "Preheat" + itemAreaCopy(107, 76, 156, 86, TEMP_CASE_PLA); // "Preheat" say_pla_en(52, TEMP_CASE_PLA); // "PLA" - Item_AreaCopy(150, 135, 202, 148, TEMP_CASE_PLA, 79); // "Settings" + itemAreaCopy(150, 135, 202, 148, TEMP_CASE_PLA, 79); // "Settings" #if PREHEAT_COUNT > 1 - Item_AreaCopy(107, 76, 156, 86, TEMP_CASE_ABS); // "Preheat" + itemAreaCopy(107, 76, 156, 86, TEMP_CASE_ABS); // "Preheat" say_abs_en(52, TEMP_CASE_ABS); // "ABS" - Item_AreaCopy(150, 135, 202, 148, TEMP_CASE_ABS, 81); // "Settings" + itemAreaCopy(150, 135, 202, 148, TEMP_CASE_ABS, 81); // "Settings" #endif #endif #endif } - Draw_Back_First(select_temp.now == CASE_BACK); - if (select_temp.now != CASE_BACK) Draw_Menu_Cursor(select_temp.now); + drawBackFirst(select_temp.now == CASE_BACK); + if (select_temp.now != CASE_BACK) drawMenuCursor(select_temp.now); // Draw icons and lines uint8_t i = 0; - #define _TMENU_ICON(N) Draw_Menu_Line(++i, ICON_SetEndTemp + (N) - 1) + #define _TMENU_ICON(N) drawMenuLine(++i, ICON_SetEndTemp + (N) - 1) #if HAS_HOTEND _TMENU_ICON(TEMP_CASE_TEMP); - Draw_Edit_Integer3(i, thermalManager.degTargetHotend(0)); + drawEditInteger3(i, thermalManager.degTargetHotend(0)); #endif #if HAS_HEATED_BED _TMENU_ICON(TEMP_CASE_BED); - Draw_Edit_Integer3(i, thermalManager.degTargetBed()); + drawEditInteger3(i, thermalManager.degTargetBed()); #endif #if HAS_FAN _TMENU_ICON(TEMP_CASE_FAN); - Draw_Edit_Integer3(i, thermalManager.fan_speed[0]); + drawEditInteger3(i, thermalManager.fan_speed[0]); #endif #if HAS_PREHEAT // PLA/ABS items have submenus - _TMENU_ICON(TEMP_CASE_PLA); Draw_More_Icon(i); + _TMENU_ICON(TEMP_CASE_PLA); drawMoreIcon(i); #if PREHEAT_COUNT > 1 - _TMENU_ICON(TEMP_CASE_ABS); Draw_More_Icon(i); + _TMENU_ICON(TEMP_CASE_ABS); drawMoreIcon(i); #endif #endif } // Control -void HMI_Control() { +void hmiControl() { EncoderState encoder_diffState = get_encoder_state(); if (encoder_diffState == ENCODER_DIFF_NO) return; @@ -2847,107 +2844,107 @@ void HMI_Control() { index_control = select_control.now; // Scroll up and draw a blank bottom line - Scroll_Menu(DWIN_SCROLL_UP); + scrollMenu(DWIN_SCROLL_UP); switch (index_control) { // Last menu items - case CONTROL_CASE_ADVSET: Item_Control_Advanced(MROWS); break; - case CONTROL_CASE_INFO: Item_Control_Info(MROWS); break; + case CONTROL_CASE_ADVSET: itemControlAdvanced(MROWS); break; + case CONTROL_CASE_INFO: itemControlInfo(MROWS); break; default: break; } } else - Move_Highlight(1, select_control.now + MROWS - index_control); + moveHighlight(1, select_control.now + MROWS - index_control); } } else if (encoder_diffState == ENCODER_DIFF_CCW) { if (select_control.dec()) { if (select_control.now < index_control - MROWS) { index_control--; - Scroll_Menu(DWIN_SCROLL_DOWN); + scrollMenu(DWIN_SCROLL_DOWN); switch (index_control) { // First menu items - case MROWS: Draw_Back_First(); break; - case MROWS + 1: Item_Control_Temp(0); break; - case MROWS + 2: Item_Control_Motion(0); break; + case MROWS: drawBackFirst(); break; + case MROWS + 1: itemControlTemp(0); break; + case MROWS + 2: itemControlMotion(0); break; default: break; } } else - Move_Highlight(-1, select_control.now + MROWS - index_control); + moveHighlight(-1, select_control.now + MROWS - index_control); } } else if (encoder_diffState == ENCODER_DIFF_ENTER) { switch (select_control.now) { case CASE_BACK: select_page.set(2); - Goto_MainMenu(); + gotoMainMenu(); break; case CONTROL_CASE_TEMP: checkkey = TemperatureID; - HMI_ValueStruct.show_mode = -1; + hmiValues.show_mode = -1; select_temp.reset(); - Draw_Temperature_Menu(); + drawTemperatureMenu(); break; case CONTROL_CASE_MOVE: checkkey = Motion; select_motion.reset(); - Draw_Motion_Menu(); + drawMotionMenu(); break; #if ENABLED(EEPROM_SETTINGS) case CONTROL_CASE_SAVE: { const bool success = settings.save(); - HMI_AudioFeedback(success); + hmiAudioFeedback(success); } break; case CONTROL_CASE_LOAD: { const bool success = settings.load(); - HMI_AudioFeedback(success); + hmiAudioFeedback(success); } break; case CONTROL_CASE_RESET: settings.reset(); - HMI_AudioFeedback(); + hmiAudioFeedback(); break; #endif case CONTROL_CASE_ADVSET: checkkey = AdvSet; select_advset.reset(); - Draw_AdvancedSettings_Menu(); + drawAdvancedSettingsMenu(); break; case CONTROL_CASE_INFO: checkkey = Info; - Draw_Info_Menu(); + drawInfoMenu(); break; default: break; } } - DWIN_UpdateLCD(); + dwinUpdateLCD(); } #if HAS_ONESTEP_LEVELING // Leveling - void HMI_Leveling() { - Popup_Window_Leveling(); - DWIN_UpdateLCD(); + void hmiLeveling() { + popupWindowLeveling(); + dwinUpdateLCD(); queue.inject(F("G28O\nG29")); } #endif // Axis Move -void HMI_AxisMove() { +void hmiAxisMove() { EncoderState encoder_diffState = get_encoder_state(); if (encoder_diffState == ENCODER_DIFF_NO) return; #if ENABLED(PREVENT_COLD_EXTRUSION) // popup window resume - if (HMI_flag.cold_flag) { + if (hmiFlag.cold_flag) { if (encoder_diffState == ENCODER_DIFF_ENTER) { - HMI_flag.cold_flag = false; - HMI_ValueStruct.Move_E_scaled = current_position.e * MINUNITMULT; - Draw_Move_Menu(); - Draw_Edit_Float3(1, HMI_ValueStruct.Move_X_scaled); - Draw_Edit_Float3(2, HMI_ValueStruct.Move_Y_scaled); - Draw_Edit_Float3(3, HMI_ValueStruct.Move_Z_scaled); - Draw_Edit_Signed_Float3(4, 0); - DWIN_UpdateLCD(); + hmiFlag.cold_flag = false; + hmiValues.Move_E_scaled = current_position.e * MINUNITMULT; + drawMoveMenu(); + drawEditFloat3(1, hmiValues.Move_X_scaled); + drawEditFloat3(2, hmiValues.Move_Y_scaled); + drawEditFloat3(3, hmiValues.Move_Z_scaled); + drawEditSignedFloat3(4, 0); + dwinUpdateLCD(); } return; } @@ -2955,10 +2952,10 @@ void HMI_AxisMove() { // Avoid flicker by updating only the previous menu if (encoder_diffState == ENCODER_DIFF_CW) { - if (select_axis.inc(1 + 3 + ENABLED(HAS_HOTEND))) Move_Highlight(1, select_axis.now); + if (select_axis.inc(1 + 3 + ENABLED(HAS_HOTEND))) moveHighlight(1, select_axis.now); } else if (encoder_diffState == ENCODER_DIFF_CCW) { - if (select_axis.dec()) Move_Highlight(-1, select_axis.now); + if (select_axis.dec()) moveHighlight(-1, select_axis.now); } else if (encoder_diffState == ENCODER_DIFF_ENTER) { switch (select_axis.now) { @@ -2966,58 +2963,58 @@ void HMI_AxisMove() { checkkey = Prepare; select_prepare.set(1); index_prepare = MROWS; - Draw_Prepare_Menu(); + drawPrepareMenu(); break; case 1: // X axis move checkkey = Move_X; - HMI_ValueStruct.Move_X_scaled = current_position.x * MINUNITMULT; - Draw_Edit_Float3(1, HMI_ValueStruct.Move_X_scaled, true); - EncoderRate.enabled = true; + hmiValues.Move_X_scaled = current_position.x * MINUNITMULT; + drawEditFloat3(1, hmiValues.Move_X_scaled, true); + encoderRate.enabled = true; break; case 2: // Y axis move checkkey = Move_Y; - HMI_ValueStruct.Move_Y_scaled = current_position.y * MINUNITMULT; - Draw_Edit_Float3(2, HMI_ValueStruct.Move_Y_scaled, true); - EncoderRate.enabled = true; + hmiValues.Move_Y_scaled = current_position.y * MINUNITMULT; + drawEditFloat3(2, hmiValues.Move_Y_scaled, true); + encoderRate.enabled = true; break; case 3: // Z axis move checkkey = Move_Z; - HMI_ValueStruct.Move_Z_scaled = current_position.z * MINUNITMULT; - Draw_Edit_Float3(3, HMI_ValueStruct.Move_Z_scaled, true); - EncoderRate.enabled = true; + hmiValues.Move_Z_scaled = current_position.z * MINUNITMULT; + drawEditFloat3(3, hmiValues.Move_Z_scaled, true); + encoderRate.enabled = true; break; #if HAS_HOTEND case 4: // Extruder #if ENABLED(PREVENT_COLD_EXTRUSION) if (thermalManager.tooColdToExtrude(0)) { - HMI_flag.cold_flag = true; - Popup_Window_ETempTooLow(); - DWIN_UpdateLCD(); + hmiFlag.cold_flag = true; + popupWindowETempTooLow(); + dwinUpdateLCD(); return; } #endif checkkey = Extruder; - HMI_ValueStruct.Move_E_scaled = current_position.e * MINUNITMULT; - Draw_Edit_Signed_Float3(4, HMI_ValueStruct.Move_E_scaled, true); - EncoderRate.enabled = true; + hmiValues.Move_E_scaled = current_position.e * MINUNITMULT; + drawEditSignedFloat3(4, hmiValues.Move_E_scaled, true); + encoderRate.enabled = true; break; #endif } } - DWIN_UpdateLCD(); + dwinUpdateLCD(); } // TemperatureID -void HMI_Temperature() { +void hmiTemperature() { EncoderState encoder_diffState = get_encoder_state(); if (encoder_diffState == ENCODER_DIFF_NO) return; // Avoid flicker by updating only the previous menu if (encoder_diffState == ENCODER_DIFF_CW) { - if (select_temp.inc(1 + TEMP_CASE_TOTAL)) Move_Highlight(1, select_temp.now); + if (select_temp.inc(1 + TEMP_CASE_TOTAL)) moveHighlight(1, select_temp.now); } else if (encoder_diffState == ENCODER_DIFF_CCW) { - if (select_temp.dec()) Move_Highlight(-1, select_temp.now); + if (select_temp.dec()) moveHighlight(-1, select_temp.now); } else if (encoder_diffState == ENCODER_DIFF_ENTER) { switch (select_temp.now) { @@ -3025,30 +3022,30 @@ void HMI_Temperature() { checkkey = Control; select_control.set(1); index_control = MROWS; - Draw_Control_Menu(); + drawControlMenu(); break; #if HAS_HOTEND case TEMP_CASE_TEMP: checkkey = ETemp; - HMI_ValueStruct.E_Temp = thermalManager.degTargetHotend(0); - Draw_Edit_Integer3(1, HMI_ValueStruct.E_Temp, true); - EncoderRate.enabled = true; + hmiValues.E_Temp = thermalManager.degTargetHotend(0); + drawEditInteger3(1, hmiValues.E_Temp, true); + encoderRate.enabled = true; break; #endif #if HAS_HEATED_BED case TEMP_CASE_BED: checkkey = BedTemp; - HMI_ValueStruct.Bed_Temp = thermalManager.degTargetBed(); - Draw_Edit_Integer3(2, HMI_ValueStruct.Bed_Temp, true); - EncoderRate.enabled = true; + hmiValues.Bed_Temp = thermalManager.degTargetBed(); + drawEditInteger3(2, hmiValues.Bed_Temp, true); + encoderRate.enabled = true; break; #endif #if HAS_FAN case TEMP_CASE_FAN: checkkey = FanSpeed; - HMI_ValueStruct.Fan_speed = thermalManager.fan_speed[0]; - Draw_Edit_Integer3(3, HMI_ValueStruct.Fan_speed, true); - EncoderRate.enabled = true; + hmiValues.Fan_speed = thermalManager.fan_speed[0]; + drawEditInteger3(3, hmiValues.Fan_speed, true); + encoderRate.enabled = true; break; #endif @@ -3056,77 +3053,77 @@ void HMI_Temperature() { case TEMP_CASE_PLA: { checkkey = PLAPreheat; select_PLA.reset(); - HMI_ValueStruct.show_mode = -2; + hmiValues.show_mode = -2; - Clear_Main_Window(); + clearMainWindow(); - if (HMI_IsChinese()) { - DWIN_Frame_TitleCopy(59, 16, 81, 14); // "PLA Settings" - Item_AreaCopy(100, 89, 124, 101, PREHEAT_CASE_TEMP); - Item_AreaCopy(1, 134, 56, 146, PREHEAT_CASE_TEMP, 24); // PLA nozzle temp + if (hmiIsChinese()) { + dwinFrameTitleCopy(59, 16, 81, 14); // "PLA Settings" + itemAreaCopy(100, 89, 124, 101, PREHEAT_CASE_TEMP); + itemAreaCopy(1, 134, 56, 146, PREHEAT_CASE_TEMP, 24); // PLA nozzle temp #if HAS_HEATED_BED - Item_AreaCopy(100, 89, 124, 101, PREHEAT_CASE_BED); - Item_AreaCopy(58, 134, 113, 146, PREHEAT_CASE_BED, 24); // PLA bed temp + itemAreaCopy(100, 89, 124, 101, PREHEAT_CASE_BED); + itemAreaCopy(58, 134, 113, 146, PREHEAT_CASE_BED, 24); // PLA bed temp #endif #if HAS_FAN - Item_AreaCopy(100, 89, 124, 101, PREHEAT_CASE_FAN); - Item_AreaCopy(115, 134, 170, 146, PREHEAT_CASE_FAN, 24); // PLA fan speed + itemAreaCopy(100, 89, 124, 101, PREHEAT_CASE_FAN); + itemAreaCopy(115, 134, 170, 146, PREHEAT_CASE_FAN, 24); // PLA fan speed #endif #if ENABLED(EEPROM_SETTINGS) - Item_AreaCopy(72, 148, 151, 162, PREHEAT_CASE_SAVE); // Save PLA configuration + itemAreaCopy(72, 148, 151, 162, PREHEAT_CASE_SAVE); // Save PLA configuration #endif } else { #ifdef USE_STRING_HEADINGS - Draw_Title(F(PREHEAT_1_LABEL " Settings")); // TODO: GET_TEXT_F + drawTitle(F(PREHEAT_1_LABEL " Settings")); // TODO: GET_TEXT_F #else - DWIN_Frame_TitleCopy(56, 15, 85, 14); // "Temperature" TODO: "PLA Settings" + dwinFrameTitleCopy(56, 15, 85, 14); // "Temperature" TODO: "PLA Settings" #endif #ifdef USE_STRING_TITLES - DWIN_Draw_Label(PREHEAT_CASE_TEMP, F("Nozzle Temp")); + dwinDrawLabel(PREHEAT_CASE_TEMP, F("Nozzle Temp")); #if HAS_HEATED_BED - DWIN_Draw_Label(PREHEAT_CASE_BED, F("Bed Temp")); + dwinDrawLabel(PREHEAT_CASE_BED, F("Bed Temp")); #endif #if HAS_FAN - DWIN_Draw_Label(PREHEAT_CASE_FAN, GET_TEXT_F(MSG_FAN_SPEED)); + dwinDrawLabel(PREHEAT_CASE_FAN, GET_TEXT_F(MSG_FAN_SPEED)); #endif #if ENABLED(EEPROM_SETTINGS) - DWIN_Draw_Label(PREHEAT_CASE_SAVE, GET_TEXT_F(MSG_STORE_EEPROM)); + dwinDrawLabel(PREHEAT_CASE_SAVE, GET_TEXT_F(MSG_STORE_EEPROM)); #endif #else say_pla_en(0, PREHEAT_CASE_TEMP); // "PLA" - Item_AreaCopy(198, 104, 237, 114, PREHEAT_CASE_TEMP, 27); // "Nozzle" - Item_AreaCopy(1, 89, 81, 102, PREHEAT_CASE_TEMP, 71); // "Temperature" + itemAreaCopy(198, 104, 237, 114, PREHEAT_CASE_TEMP, 27); // "Nozzle" + itemAreaCopy(1, 89, 81, 102, PREHEAT_CASE_TEMP, 71); // "Temperature" #if HAS_HEATED_BED say_pla_en(0, PREHEAT_CASE_BED); // "PLA" - Item_AreaCopy(240, 104, 264, 114, PREHEAT_CASE_BED, 27); // "Bed" - Item_AreaCopy(1, 89, 83, 101, PREHEAT_CASE_BED, 54); // "Temperature" + itemAreaCopy(240, 104, 264, 114, PREHEAT_CASE_BED, 27); // "Bed" + itemAreaCopy(1, 89, 83, 101, PREHEAT_CASE_BED, 54); // "Temperature" #endif #if HAS_FAN say_pla_en(0, PREHEAT_CASE_FAN); // "PLA" - Item_AreaCopy(0, 119, 64, 132, PREHEAT_CASE_FAN, 27); // "Fan speed" + itemAreaCopy(0, 119, 64, 132, PREHEAT_CASE_FAN, 27); // "Fan speed" #endif #if ENABLED(EEPROM_SETTINGS) - Item_AreaCopy(98, 164, 233, 177, PREHEAT_CASE_SAVE); // "Save PLA parameters" + itemAreaCopy(98, 164, 233, 177, PREHEAT_CASE_SAVE); // "Save PLA parameters" #endif #endif } - Draw_Back_First(); + drawBackFirst(); uint8_t i = 0; - Draw_Menu_Line(++i, ICON_SetEndTemp); - Draw_Edit_Integer3(i, ui.material_preset[0].hotend_temp); + drawMenuLine(++i, ICON_SetEndTemp); + drawEditInteger3(i, ui.material_preset[0].hotend_temp); #if HAS_HEATED_BED - Draw_Menu_Line(++i, ICON_SetBedTemp); - Draw_Edit_Integer3(i, ui.material_preset[0].bed_temp); + drawMenuLine(++i, ICON_SetBedTemp); + drawEditInteger3(i, ui.material_preset[0].bed_temp); #endif #if HAS_FAN - Draw_Menu_Line(++i, ICON_FanSpeed); - Draw_Edit_Integer3(i, ui.material_preset[0].fan_speed); + drawMenuLine(++i, ICON_FanSpeed); + drawEditInteger3(i, ui.material_preset[0].fan_speed); #endif #if ENABLED(EEPROM_SETTINGS) - Draw_Menu_Line(++i, ICON_WriteEEPROM); + drawMenuLine(++i, ICON_WriteEEPROM); #endif } break; #endif // HAS_PREHEAT @@ -3135,80 +3132,80 @@ void HMI_Temperature() { case TEMP_CASE_ABS: { // ABS preheat setting checkkey = ABSPreheat; select_ABS.reset(); - HMI_ValueStruct.show_mode = -3; + hmiValues.show_mode = -3; - Clear_Main_Window(); + clearMainWindow(); - if (HMI_IsChinese()) { - DWIN_Frame_TitleCopy(142, 16, 82, 14); // "ABS Settings" + if (hmiIsChinese()) { + dwinFrameTitleCopy(142, 16, 82, 14); // "ABS Settings" - Item_AreaCopy(180, 89, 204, 100, PREHEAT_CASE_TEMP); - Item_AreaCopy(1, 134, 56, 146, PREHEAT_CASE_TEMP, 24); // ABS nozzle temp + itemAreaCopy(180, 89, 204, 100, PREHEAT_CASE_TEMP); + itemAreaCopy(1, 134, 56, 146, PREHEAT_CASE_TEMP, 24); // ABS nozzle temp #if HAS_HEATED_BED - Item_AreaCopy(180, 89, 204, 100, PREHEAT_CASE_BED); - Item_AreaCopy(58, 134, 113, 146, PREHEAT_CASE_BED, 24); // ABS bed temp + itemAreaCopy(180, 89, 204, 100, PREHEAT_CASE_BED); + itemAreaCopy(58, 134, 113, 146, PREHEAT_CASE_BED, 24); // ABS bed temp #endif #if HAS_FAN - Item_AreaCopy(180, 89, 204, 100, PREHEAT_CASE_FAN); - Item_AreaCopy(115, 134, 170, 146, PREHEAT_CASE_FAN, 24); // ABS fan speed + itemAreaCopy(180, 89, 204, 100, PREHEAT_CASE_FAN); + itemAreaCopy(115, 134, 170, 146, PREHEAT_CASE_FAN, 24); // ABS fan speed #endif #if ENABLED(EEPROM_SETTINGS) - Item_AreaCopy(72, 148, 151, 162, PREHEAT_CASE_SAVE); - Item_AreaCopy(180, 89, 204, 100, PREHEAT_CASE_SAVE, 28, 2); // Save ABS configuration + itemAreaCopy(72, 148, 151, 162, PREHEAT_CASE_SAVE); + itemAreaCopy(180, 89, 204, 100, PREHEAT_CASE_SAVE, 28, 2); // Save ABS configuration #endif } else { #ifdef USE_STRING_HEADINGS - Draw_Title(F("ABS Settings")); // TODO: GET_TEXT_F + drawTitle(F("ABS Settings")); // TODO: GET_TEXT_F #else - DWIN_Frame_TitleCopy(56, 15, 85, 14); // "Temperature" TODO: "ABS Settings" + dwinFrameTitleCopy(56, 15, 85, 14); // "Temperature" TODO: "ABS Settings" #endif #ifdef USE_STRING_TITLES - DWIN_Draw_Label(PREHEAT_CASE_TEMP, F("Nozzle Temp")); + dwinDrawLabel(PREHEAT_CASE_TEMP, F("Nozzle Temp")); #if HAS_HEATED_BED - DWIN_Draw_Label(PREHEAT_CASE_BED, F("Bed Temp")); + dwinDrawLabel(PREHEAT_CASE_BED, F("Bed Temp")); #endif #if HAS_FAN - DWIN_Draw_Label(PREHEAT_CASE_FAN, GET_TEXT_F(MSG_FAN_SPEED)); + dwinDrawLabel(PREHEAT_CASE_FAN, GET_TEXT_F(MSG_FAN_SPEED)); #endif #if ENABLED(EEPROM_SETTINGS) - DWIN_Draw_Label(PREHEAT_CASE_SAVE, GET_TEXT_F(MSG_STORE_EEPROM)); + dwinDrawLabel(PREHEAT_CASE_SAVE, GET_TEXT_F(MSG_STORE_EEPROM)); #endif #else say_abs_en(0, PREHEAT_CASE_TEMP); // "ABS" - Item_AreaCopy(197, 104, 238, 114, PREHEAT_CASE_TEMP, 29); // "Nozzle" - Item_AreaCopy(1, 89, 34, 102, PREHEAT_CASE_TEMP, 73); // "Temp" + itemAreaCopy(197, 104, 238, 114, PREHEAT_CASE_TEMP, 29); // "Nozzle" + itemAreaCopy(1, 89, 34, 102, PREHEAT_CASE_TEMP, 73); // "Temp" #if HAS_HEATED_BED say_abs_en(0, PREHEAT_CASE_BED); // "ABS" - Item_AreaCopy(240, 104, 264, 114, PREHEAT_CASE_BED, 29); // "Bed" - Item_AreaCopy(1, 89, 83, 102, PREHEAT_CASE_BED, 56); // "Temperature" + itemAreaCopy(240, 104, 264, 114, PREHEAT_CASE_BED, 29); // "Bed" + itemAreaCopy(1, 89, 83, 102, PREHEAT_CASE_BED, 56); // "Temperature" #endif #if HAS_FAN say_abs_en(0, PREHEAT_CASE_FAN); // "ABS" - Item_AreaCopy(0, 119, 64, 132, PREHEAT_CASE_FAN, 29); // "Fan speed" + itemAreaCopy(0, 119, 64, 132, PREHEAT_CASE_FAN, 29); // "Fan speed" #endif #if ENABLED(EEPROM_SETTINGS) - Item_AreaCopy(98, 165, 233, 177, PREHEAT_CASE_SAVE); // "Save PLA parameters" + itemAreaCopy(98, 165, 233, 177, PREHEAT_CASE_SAVE); // "Save PLA parameters" say_abs_en(33, PREHEAT_CASE_SAVE); // "ABS" #endif #endif } - Draw_Back_First(); + drawBackFirst(); uint8_t i = 0; - Draw_Menu_Line(++i, ICON_SetEndTemp); - Draw_Edit_Integer3(i, ui.material_preset[1].hotend_temp); + drawMenuLine(++i, ICON_SetEndTemp); + drawEditInteger3(i, ui.material_preset[1].hotend_temp); #if HAS_HEATED_BED - Draw_Menu_Line(++i, ICON_SetBedTemp); - Draw_Edit_Integer3(i, ui.material_preset[1].bed_temp); + drawMenuLine(++i, ICON_SetBedTemp); + drawEditInteger3(i, ui.material_preset[1].bed_temp); #endif #if HAS_FAN - Draw_Menu_Line(++i, ICON_FanSpeed); - Draw_Edit_Integer3(i, ui.material_preset[1].fan_speed); + drawMenuLine(++i, ICON_FanSpeed); + drawEditInteger3(i, ui.material_preset[1].fan_speed); #endif #if ENABLED(EEPROM_SETTINGS) - Draw_Menu_Line(++i, ICON_WriteEEPROM); + drawMenuLine(++i, ICON_WriteEEPROM); #endif } break; @@ -3216,42 +3213,42 @@ void HMI_Temperature() { #endif // PREHEAT_COUNT > 1 } } - DWIN_UpdateLCD(); + dwinUpdateLCD(); } -void Draw_Max_Speed_Menu() { - Clear_Main_Window(); +void drawMaxSpeedMenu() { + clearMainWindow(); - if (HMI_IsChinese()) { - DWIN_Frame_TitleCopy(1, 16, 28, 13); // "Max Speed (mm/s)" + if (hmiIsChinese()) { + dwinFrameTitleCopy(1, 16, 28, 13); // "Max Speed (mm/s)" auto say_max_speed_cn = [](const uint8_t line) { - Item_AreaCopy(173, 133, 228, 147, line); // "Max speed" + itemAreaCopy(173, 133, 228, 147, line); // "Max speed" }; say_max_speed_cn(1); // "Max speed" - Item_AreaCopy(229, 133, 236, 147, 1, 58); // "X" + itemAreaCopy(229, 133, 236, 147, 1, 58); // "X" say_max_speed_cn(2); // "Max speed" - Item_AreaCopy(1, 150, 7, 160, 2, 58, 3); // "Y" + itemAreaCopy(1, 150, 7, 160, 2, 58, 3); // "Y" say_max_speed_cn(3); // "Max speed" - Item_AreaCopy(9, 150, 16, 160, 3, 58, 3); // "Z" + itemAreaCopy(9, 150, 16, 160, 3, 58, 3); // "Z" #if HAS_HOTEND say_max_speed_cn(4); // "Max speed" - Item_AreaCopy(18, 150, 25, 160, 4, 58, 3); // "E" + itemAreaCopy(18, 150, 25, 160, 4, 58, 3); // "E" #endif } else { #ifdef USE_STRING_HEADINGS - Draw_Title(F("Max Speed (mm/s)")); // TODO: GET_TEXT_F + drawTitle(F("Max Speed (mm/s)")); // TODO: GET_TEXT_F #else - DWIN_Frame_TitleCopy(144, 16, 46, 11); // "Max Speed (mm/s)" + dwinFrameTitleCopy(144, 16, 46, 11); // "Max Speed (mm/s)" #endif #ifdef USE_STRING_TITLES - DWIN_Draw_Label(1, F("Max Feedrate X")); - DWIN_Draw_Label(2, F("Max Feedrate Y")); - DWIN_Draw_Label(3, F("Max Feedrate Z")); + dwinDrawLabel(1, F("Max Feedrate X")); + dwinDrawLabel(2, F("Max Feedrate Y")); + dwinDrawLabel(3, F("Max Feedrate Z")); #if HAS_HOTEND - DWIN_Draw_Label(4, F("Max Feedrate E")); + dwinDrawLabel(4, F("Max Feedrate E")); #endif #else say_max_en(1); say_speed_en(30, 1); say_x_en(73, 1); // "Max Speed X" @@ -3263,49 +3260,49 @@ void Draw_Max_Speed_Menu() { #endif } - Draw_Back_First(); - for (uint8_t i = 0; i < 3 + ENABLED(HAS_HOTEND); ++i) Draw_Menu_Line(i + 1, ICON_MaxSpeedX + i); - Draw_Edit_Integer4(1, planner.settings.max_feedrate_mm_s[X_AXIS]); - Draw_Edit_Integer4(2, planner.settings.max_feedrate_mm_s[Y_AXIS]); - Draw_Edit_Integer4(3, planner.settings.max_feedrate_mm_s[Z_AXIS]); + drawBackFirst(); + for (uint8_t i = 0; i < 3 + ENABLED(HAS_HOTEND); ++i) drawMenuLine(i + 1, ICON_MaxSpeedX + i); + drawEditInteger4(1, planner.settings.max_feedrate_mm_s[X_AXIS]); + drawEditInteger4(2, planner.settings.max_feedrate_mm_s[Y_AXIS]); + drawEditInteger4(3, planner.settings.max_feedrate_mm_s[Z_AXIS]); #if HAS_HOTEND - Draw_Edit_Integer4(4, planner.settings.max_feedrate_mm_s[E_AXIS]); + drawEditInteger4(4, planner.settings.max_feedrate_mm_s[E_AXIS]); #endif } -void Draw_Max_Accel_Menu() { - Clear_Main_Window(); +void drawMaxAccelMenu() { + clearMainWindow(); - if (HMI_IsChinese()) { - DWIN_Frame_TitleCopy(1, 16, 28, 13); // "Acceleration" + if (hmiIsChinese()) { + dwinFrameTitleCopy(1, 16, 28, 13); // "Acceleration" - Item_AreaCopy(173, 133, 200, 147, 1); - Item_AreaCopy( 28, 149, 69, 161, 1, 30, 1); - Item_AreaCopy(229, 133, 236, 147, 1, 74); // Max acceleration X - Item_AreaCopy(173, 133, 200, 147, 2); - Item_AreaCopy( 28, 149, 69, 161, 2, 30, 1); - Item_AreaCopy( 1, 150, 7, 160, 2, 74, 2); // Max acceleration Y - Item_AreaCopy(173, 133, 200, 147, 3); - Item_AreaCopy( 28, 149, 69, 161, 3, 30, 1); - Item_AreaCopy( 9, 150, 16, 160, 3, 74, 2); // Max acceleration Z + itemAreaCopy(173, 133, 200, 147, 1); + itemAreaCopy( 28, 149, 69, 161, 1, 30, 1); + itemAreaCopy(229, 133, 236, 147, 1, 74); // Max acceleration X + itemAreaCopy(173, 133, 200, 147, 2); + itemAreaCopy( 28, 149, 69, 161, 2, 30, 1); + itemAreaCopy( 1, 150, 7, 160, 2, 74, 2); // Max acceleration Y + itemAreaCopy(173, 133, 200, 147, 3); + itemAreaCopy( 28, 149, 69, 161, 3, 30, 1); + itemAreaCopy( 9, 150, 16, 160, 3, 74, 2); // Max acceleration Z #if HAS_HOTEND - Item_AreaCopy(173, 133, 200, 147, 4); - Item_AreaCopy( 28, 149, 69, 161, 4, 30, 1); - Item_AreaCopy( 18, 150, 25, 160, 4, 74, 2); // Max acceleration E + itemAreaCopy(173, 133, 200, 147, 4); + itemAreaCopy( 28, 149, 69, 161, 4, 30, 1); + itemAreaCopy( 18, 150, 25, 160, 4, 74, 2); // Max acceleration E #endif } else { #ifdef USE_STRING_HEADINGS - Draw_Title(GET_TEXT_F(MSG_ACCELERATION)); + drawTitle(GET_TEXT_F(MSG_ACCELERATION)); #else - DWIN_Frame_TitleCopy(144, 16, 46, 11); // "Acceleration" + dwinFrameTitleCopy(144, 16, 46, 11); // "Acceleration" #endif #ifdef USE_STRING_TITLES - DWIN_Draw_Label(1, F("Max Accel X")); - DWIN_Draw_Label(2, F("Max Accel Y")); - DWIN_Draw_Label(3, F("Max Accel Z")); + dwinDrawLabel(1, F("Max Accel X")); + dwinDrawLabel(2, F("Max Accel Y")); + dwinDrawLabel(3, F("Max Accel Z")); #if HAS_HOTEND - DWIN_Draw_Label(4, F("Max Accel E")); + dwinDrawLabel(4, F("Max Accel E")); #endif #else say_max_accel_en(1); say_x_en(112, 1); // "Max Acceleration X" @@ -3317,54 +3314,54 @@ void Draw_Max_Accel_Menu() { #endif } - Draw_Back_First(); - for (uint8_t i = 0; i < 3 + ENABLED(HAS_HOTEND); ++i) Draw_Menu_Line(i + 1, ICON_MaxAccX + i); - Draw_Edit_Integer4(1, planner.settings.max_acceleration_mm_per_s2[X_AXIS]); - Draw_Edit_Integer4(2, planner.settings.max_acceleration_mm_per_s2[Y_AXIS]); - Draw_Edit_Integer4(3, planner.settings.max_acceleration_mm_per_s2[Z_AXIS]); + drawBackFirst(); + for (uint8_t i = 0; i < 3 + ENABLED(HAS_HOTEND); ++i) drawMenuLine(i + 1, ICON_MaxAccX + i); + drawEditInteger4(1, planner.settings.max_acceleration_mm_per_s2[X_AXIS]); + drawEditInteger4(2, planner.settings.max_acceleration_mm_per_s2[Y_AXIS]); + drawEditInteger4(3, planner.settings.max_acceleration_mm_per_s2[Z_AXIS]); #if HAS_HOTEND - Draw_Edit_Integer4(4, planner.settings.max_acceleration_mm_per_s2[E_AXIS]); + drawEditInteger4(4, planner.settings.max_acceleration_mm_per_s2[E_AXIS]); #endif } #if HAS_CLASSIC_JERK - void Draw_Max_Jerk_Menu() { - Clear_Main_Window(); - - if (HMI_IsChinese()) { - DWIN_Frame_TitleCopy(1, 16, 28, 13); // "Jerk" - - Item_AreaCopy(173, 133, 200, 147, 1); - Item_AreaCopy( 1, 180, 28, 192, 1, 30, 1); - Item_AreaCopy(202, 133, 228, 147, 1, 56); - Item_AreaCopy(229, 133, 236, 147, 1, 86); // Max Jerk speed X - Item_AreaCopy(173, 133, 200, 147, 2); - Item_AreaCopy( 1, 180, 28, 192, 2, 30, 1); - Item_AreaCopy(202, 133, 228, 147, 2, 56); - Item_AreaCopy( 1, 150, 7, 160, 2, 86, 3); // Max Jerk speed Y - Item_AreaCopy(173, 133, 200, 147, 3); - Item_AreaCopy( 1, 180, 28, 192, 3, 30, 1); - Item_AreaCopy(202, 133, 228, 147, 3, 56); - Item_AreaCopy( 9, 150, 16, 160, 3, 86, 3); // Max Jerk speed Z + void drawMaxJerkMenu() { + clearMainWindow(); + + if (hmiIsChinese()) { + dwinFrameTitleCopy(1, 16, 28, 13); // "Jerk" + + itemAreaCopy(173, 133, 200, 147, 1); + itemAreaCopy( 1, 180, 28, 192, 1, 30, 1); + itemAreaCopy(202, 133, 228, 147, 1, 56); + itemAreaCopy(229, 133, 236, 147, 1, 86); // Max Jerk speed X + itemAreaCopy(173, 133, 200, 147, 2); + itemAreaCopy( 1, 180, 28, 192, 2, 30, 1); + itemAreaCopy(202, 133, 228, 147, 2, 56); + itemAreaCopy( 1, 150, 7, 160, 2, 86, 3); // Max Jerk speed Y + itemAreaCopy(173, 133, 200, 147, 3); + itemAreaCopy( 1, 180, 28, 192, 3, 30, 1); + itemAreaCopy(202, 133, 228, 147, 3, 56); + itemAreaCopy( 9, 150, 16, 160, 3, 86, 3); // Max Jerk speed Z #if HAS_HOTEND - Item_AreaCopy(173, 133, 200, 147, 4); - Item_AreaCopy( 1, 180, 28, 192, 4, 30, 1); - Item_AreaCopy(202, 133, 228, 147, 4, 56); - Item_AreaCopy( 18, 150, 25, 160, 4, 86, 3); // Max Jerk speed E + itemAreaCopy(173, 133, 200, 147, 4); + itemAreaCopy( 1, 180, 28, 192, 4, 30, 1); + itemAreaCopy(202, 133, 228, 147, 4, 56); + itemAreaCopy( 18, 150, 25, 160, 4, 86, 3); // Max Jerk speed E #endif } else { #ifdef USE_STRING_HEADINGS - Draw_Title(GET_TEXT_F(MSG_JERK)); + drawTitle(GET_TEXT_F(MSG_JERK)); #else - DWIN_Frame_TitleCopy(144, 16, 46, 11); // "Jerk" + dwinFrameTitleCopy(144, 16, 46, 11); // "Jerk" #endif #ifdef USE_STRING_TITLES - DWIN_Draw_Label(1, GET_TEXT_F(MSG_VA_JERK)); - DWIN_Draw_Label(2, GET_TEXT_F(MSG_VB_JERK)); - DWIN_Draw_Label(3, GET_TEXT_F(MSG_VC_JERK)); + dwinDrawLabel(1, GET_TEXT_F(MSG_VA_JERK)); + dwinDrawLabel(2, GET_TEXT_F(MSG_VB_JERK)); + dwinDrawLabel(3, GET_TEXT_F(MSG_VC_JERK)); #if HAS_HOTEND - DWIN_Draw_Label(4, GET_TEXT_F(MSG_VE_JERK)); + dwinDrawLabel(4, GET_TEXT_F(MSG_VE_JERK)); #endif #else say_max_jerk_speed_en(1); say_x_en(102, 1); // Max Jerk speed X @@ -3376,46 +3373,46 @@ void Draw_Max_Accel_Menu() { #endif } - Draw_Back_First(); - for (uint8_t i = 0; i < 3 + ENABLED(HAS_HOTEND); ++i) Draw_Menu_Line(i + 1, ICON_MaxSpeedJerkX + i); - Draw_Edit_Float3(1, planner.max_jerk.x * MINUNITMULT); - Draw_Edit_Float3(2, planner.max_jerk.y * MINUNITMULT); - Draw_Edit_Float3(3, planner.max_jerk.z * MINUNITMULT); + drawBackFirst(); + for (uint8_t i = 0; i < 3 + ENABLED(HAS_HOTEND); ++i) drawMenuLine(i + 1, ICON_MaxSpeedJerkX + i); + drawEditFloat3(1, planner.max_jerk.x * MINUNITMULT); + drawEditFloat3(2, planner.max_jerk.y * MINUNITMULT); + drawEditFloat3(3, planner.max_jerk.z * MINUNITMULT); #if HAS_HOTEND - Draw_Edit_Float3(4, planner.max_jerk.e * MINUNITMULT); + drawEditFloat3(4, planner.max_jerk.e * MINUNITMULT); #endif } #endif -void Draw_Steps_Menu() { - Clear_Main_Window(); +void drawStepsMenu() { + clearMainWindow(); - if (HMI_IsChinese()) { - DWIN_Frame_TitleCopy(1, 16, 28, 13); // "Steps per mm" + if (hmiIsChinese()) { + dwinFrameTitleCopy(1, 16, 28, 13); // "Steps per mm" - Item_AreaCopy(153, 148, 194, 161, 1); - Item_AreaCopy(229, 133, 236, 147, 1, 44); // Transmission Ratio X - Item_AreaCopy(153, 148, 194, 161, 2); - Item_AreaCopy( 1, 150, 7, 160, 2, 44, 3); // Transmission Ratio Y - Item_AreaCopy(153, 148, 194, 161, 3); - Item_AreaCopy( 9, 150, 16, 160, 3, 44, 3); // Transmission Ratio Z + itemAreaCopy(153, 148, 194, 161, 1); + itemAreaCopy(229, 133, 236, 147, 1, 44); // Transmission Ratio X + itemAreaCopy(153, 148, 194, 161, 2); + itemAreaCopy( 1, 150, 7, 160, 2, 44, 3); // Transmission Ratio Y + itemAreaCopy(153, 148, 194, 161, 3); + itemAreaCopy( 9, 150, 16, 160, 3, 44, 3); // Transmission Ratio Z #if HAS_HOTEND - Item_AreaCopy(153, 148, 194, 161, 4); - Item_AreaCopy( 18, 150, 25, 160, 4, 44, 3); // Transmission Ratio E + itemAreaCopy(153, 148, 194, 161, 4); + itemAreaCopy( 18, 150, 25, 160, 4, 44, 3); // Transmission Ratio E #endif } else { #ifdef USE_STRING_HEADINGS - Draw_Title(GET_TEXT_F(MSG_STEPS_PER_MM)); + drawTitle(GET_TEXT_F(MSG_STEPS_PER_MM)); #else - DWIN_Frame_TitleCopy(144, 16, 46, 11); // "Steps per mm" + dwinFrameTitleCopy(144, 16, 46, 11); // "Steps per mm" #endif #ifdef USE_STRING_TITLES - DWIN_Draw_Label(1, GET_TEXT_F(MSG_A_STEPS)); - DWIN_Draw_Label(2, GET_TEXT_F(MSG_B_STEPS)); - DWIN_Draw_Label(3, GET_TEXT_F(MSG_C_STEPS)); + dwinDrawLabel(1, GET_TEXT_F(MSG_A_STEPS)); + dwinDrawLabel(2, GET_TEXT_F(MSG_B_STEPS)); + dwinDrawLabel(3, GET_TEXT_F(MSG_C_STEPS)); #if HAS_HOTEND - DWIN_Draw_Label(4, GET_TEXT_F(MSG_E_STEPS)); + dwinDrawLabel(4, GET_TEXT_F(MSG_E_STEPS)); #endif #else say_steps_per_mm_en(1); say_x_en(101, 1); // "Steps-per-mm X" @@ -3427,27 +3424,27 @@ void Draw_Steps_Menu() { #endif } - Draw_Back_First(); - for (uint8_t i = 0; i < 3 + ENABLED(HAS_HOTEND); ++i) Draw_Menu_Line(i + 1, ICON_StepX + i); - Draw_Edit_Float3(1, planner.settings.axis_steps_per_mm[X_AXIS] * MINUNITMULT); - Draw_Edit_Float3(2, planner.settings.axis_steps_per_mm[Y_AXIS] * MINUNITMULT); - Draw_Edit_Float3(3, planner.settings.axis_steps_per_mm[Z_AXIS] * MINUNITMULT); + drawBackFirst(); + for (uint8_t i = 0; i < 3 + ENABLED(HAS_HOTEND); ++i) drawMenuLine(i + 1, ICON_StepX + i); + drawEditFloat3(1, planner.settings.axis_steps_per_mm[X_AXIS] * MINUNITMULT); + drawEditFloat3(2, planner.settings.axis_steps_per_mm[Y_AXIS] * MINUNITMULT); + drawEditFloat3(3, planner.settings.axis_steps_per_mm[Z_AXIS] * MINUNITMULT); #if HAS_HOTEND - Draw_Edit_Float3(4, planner.settings.axis_steps_per_mm[E_AXIS] * MINUNITMULT); + drawEditFloat3(4, planner.settings.axis_steps_per_mm[E_AXIS] * MINUNITMULT); #endif } // Motion -void HMI_Motion() { +void hmiMotion() { EncoderState encoder_diffState = get_encoder_state(); if (encoder_diffState == ENCODER_DIFF_NO) return; // Avoid flicker by updating only the previous menu if (encoder_diffState == ENCODER_DIFF_CW) { - if (select_motion.inc(1 + MOTION_CASE_TOTAL)) Move_Highlight(1, select_motion.now); + if (select_motion.inc(1 + MOTION_CASE_TOTAL)) moveHighlight(1, select_motion.now); } else if (encoder_diffState == ENCODER_DIFF_CCW) { - if (select_motion.dec()) Move_Highlight(-1, select_motion.now); + if (select_motion.dec()) moveHighlight(-1, select_motion.now); } else if (encoder_diffState == ENCODER_DIFF_ENTER) { switch (select_motion.now) { @@ -3455,38 +3452,38 @@ void HMI_Motion() { checkkey = Control; select_control.set(CONTROL_CASE_MOVE); index_control = MROWS; - Draw_Control_Menu(); + drawControlMenu(); break; case MOTION_CASE_RATE: checkkey = MaxSpeed; select_speed.reset(); - Draw_Max_Speed_Menu(); + drawMaxSpeedMenu(); break; case MOTION_CASE_ACCEL: checkkey = MaxAcceleration; select_acc.reset(); - Draw_Max_Accel_Menu(); + drawMaxAccelMenu(); break; #if HAS_CLASSIC_JERK case MOTION_CASE_JERK: checkkey = MaxJerk; select_jerk.reset(); - Draw_Max_Jerk_Menu(); + drawMaxJerkMenu(); break; #endif case MOTION_CASE_STEPS: checkkey = Step; select_step.reset(); - Draw_Steps_Menu(); + drawStepsMenu(); break; default: break; } } - DWIN_UpdateLCD(); + dwinUpdateLCD(); } // Advanced Settings -void HMI_AdvSet() { +void hmiAdvSet() { EncoderState encoder_diffState = get_encoder_state(); if (encoder_diffState == ENCODER_DIFF_NO) return; @@ -3497,7 +3494,7 @@ void HMI_AdvSet() { index_advset = select_advset.now; // Scroll up and draw a blank bottom line - Scroll_Menu(DWIN_SCROLL_UP); + scrollMenu(DWIN_SCROLL_UP); //switch (index_advset) { // Redraw last menu items // default: break; @@ -3505,7 +3502,7 @@ void HMI_AdvSet() { } else { - Move_Highlight(1, select_advset.now + MROWS - index_advset); + moveHighlight(1, select_advset.now + MROWS - index_advset); } } } @@ -3513,14 +3510,14 @@ void HMI_AdvSet() { if (select_advset.dec()) { if (select_advset.now < index_advset - MROWS) { index_advset--; - Scroll_Menu(DWIN_SCROLL_DOWN); + scrollMenu(DWIN_SCROLL_DOWN); //switch (index_advset) { // Redraw first menu items // default: break; //} } else { - Move_Highlight(-1, select_advset.now + MROWS - index_advset); + moveHighlight(-1, select_advset.now + MROWS - index_advset); } } } @@ -3530,17 +3527,17 @@ void HMI_AdvSet() { checkkey = Control; select_control.set(CONTROL_CASE_ADVSET); index_control = CONTROL_CASE_ADVSET; - Draw_Control_Menu(); + drawControlMenu(); break; #if HAS_HOME_OFFSET case ADVSET_CASE_HOMEOFF: checkkey = HomeOff; select_item.reset(); - HMI_ValueStruct.Home_OffX_scaled = home_offset.x * 10; - HMI_ValueStruct.Home_OffY_scaled = home_offset.y * 10; - HMI_ValueStruct.Home_OffZ_scaled = home_offset.z * 10; - Draw_HomeOff_Menu(); + hmiValues.Home_OffX_scaled = home_offset.x * 10; + hmiValues.Home_OffY_scaled = home_offset.y * 10; + hmiValues.Home_OffZ_scaled = home_offset.z * 10; + drawHomeOffMenu(); break; #endif @@ -3548,9 +3545,9 @@ void HMI_AdvSet() { case ADVSET_CASE_PROBEOFF: checkkey = ProbeOff; select_item.reset(); - HMI_ValueStruct.Probe_OffX_scaled = probe.offset.x * 10; - HMI_ValueStruct.Probe_OffY_scaled = probe.offset.y * 10; - Draw_ProbeOff_Menu(); + hmiValues.Probe_OffX_scaled = probe.offset.x * 10; + hmiValues.Probe_OffY_scaled = probe.offset.y * 10; + drawProbeOffMenu(); break; #endif @@ -3569,153 +3566,153 @@ void HMI_AdvSet() { #if ENABLED(POWER_LOSS_RECOVERY) case ADVSET_CASE_PWRLOSSR: recovery.enable(!recovery.enabled); - Draw_Checkbox_Line(ADVSET_CASE_PWRLOSSR + MROWS - index_advset, recovery.enabled); + drawCheckboxLine(ADVSET_CASE_PWRLOSSR + MROWS - index_advset, recovery.enabled); break; #endif default: break; } } - DWIN_UpdateLCD(); + dwinUpdateLCD(); } #if HAS_HOME_OFFSET // Home Offset - void HMI_HomeOff() { + void hmiHomeOff() { EncoderState encoder_diffState = get_encoder_state(); if (encoder_diffState == ENCODER_DIFF_NO) return; // Avoid flicker by updating only the previous menu if (encoder_diffState == ENCODER_DIFF_CW) { - if (select_item.inc(1 + 3)) Move_Highlight(1, select_item.now); + if (select_item.inc(1 + 3)) moveHighlight(1, select_item.now); } else if (encoder_diffState == ENCODER_DIFF_CCW) { - if (select_item.dec()) Move_Highlight(-1, select_item.now); + if (select_item.dec()) moveHighlight(-1, select_item.now); } else if (encoder_diffState == ENCODER_DIFF_ENTER) { switch (select_item.now) { case CASE_BACK: checkkey = AdvSet; select_advset.set(ADVSET_CASE_HOMEOFF); - Draw_AdvancedSettings_Menu(); + drawAdvancedSettingsMenu(); break; case 1: // Home Offset X checkkey = HomeOffX; - Draw_Edit_Signed_Float3(1, HMI_ValueStruct.Home_OffX_scaled, true); - EncoderRate.enabled = true; + drawEditSignedFloat3(1, hmiValues.Home_OffX_scaled, true); + encoderRate.enabled = true; break; case 2: // Home Offset Y checkkey = HomeOffY; - Draw_Edit_Signed_Float3(2, HMI_ValueStruct.Home_OffY_scaled, true); - EncoderRate.enabled = true; + drawEditSignedFloat3(2, hmiValues.Home_OffY_scaled, true); + encoderRate.enabled = true; break; case 3: // Home Offset Z checkkey = HomeOffZ; - Draw_Edit_Signed_Float3(3, HMI_ValueStruct.Home_OffZ_scaled, true); - EncoderRate.enabled = true; + drawEditSignedFloat3(3, hmiValues.Home_OffZ_scaled, true); + encoderRate.enabled = true; break; default: break; } } - DWIN_UpdateLCD(); + dwinUpdateLCD(); } - void HMI_HomeOffN(const AxisEnum axis, float &posScaled, const_float_t lo, const_float_t hi) { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); + void hmiHomeOffN(const AxisEnum axis, float &posScaled, const_float_t lo, const_float_t hi) { + EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; - if (Apply_Encoder(encoder_diffState, posScaled)) { + if (applyEncoder(encoder_diffState, posScaled)) { checkkey = HomeOff; - EncoderRate.enabled = false; + encoderRate.enabled = false; set_home_offset(axis, posScaled / 10); - Draw_Edit_Signed_Float3(select_item.now, posScaled); + drawEditSignedFloat3(select_item.now, posScaled); return; } LIMIT(posScaled, lo, hi); - Draw_Edit_Signed_Float3(select_item.now, posScaled, true); + drawEditSignedFloat3(select_item.now, posScaled, true); } - void HMI_HomeOffX() { HMI_HomeOffN(X_AXIS, HMI_ValueStruct.Home_OffX_scaled, -500, 500); } - void HMI_HomeOffY() { HMI_HomeOffN(Y_AXIS, HMI_ValueStruct.Home_OffY_scaled, -500, 500); } - void HMI_HomeOffZ() { HMI_HomeOffN(Z_AXIS, HMI_ValueStruct.Home_OffZ_scaled, -20, 20); } + void hmiHomeOffX() { hmiHomeOffN(X_AXIS, hmiValues.Home_OffX_scaled, -500, 500); } + void hmiHomeOffY() { hmiHomeOffN(Y_AXIS, hmiValues.Home_OffY_scaled, -500, 500); } + void hmiHomeOffZ() { hmiHomeOffN(Z_AXIS, hmiValues.Home_OffZ_scaled, -20, 20); } #endif // HAS_HOME_OFFSET #if HAS_ONESTEP_LEVELING // Probe Offset - void HMI_ProbeOff() { + void hmiProbeOff() { EncoderState encoder_diffState = get_encoder_state(); if (encoder_diffState == ENCODER_DIFF_NO) return; // Avoid flicker by updating only the previous menu if (encoder_diffState == ENCODER_DIFF_CW) { - if (select_item.inc(1 + 2)) Move_Highlight(1, select_item.now); + if (select_item.inc(1 + 2)) moveHighlight(1, select_item.now); } else if (encoder_diffState == ENCODER_DIFF_CCW) { - if (select_item.dec()) Move_Highlight(-1, select_item.now); + if (select_item.dec()) moveHighlight(-1, select_item.now); } else if (encoder_diffState == ENCODER_DIFF_ENTER) { switch (select_item.now) { case CASE_BACK: checkkey = AdvSet; select_advset.set(ADVSET_CASE_PROBEOFF); - Draw_AdvancedSettings_Menu(); + drawAdvancedSettingsMenu(); break; case 1: // Probe Offset X checkkey = ProbeOffX; - Draw_Edit_Signed_Float3(1, HMI_ValueStruct.Probe_OffX_scaled, true); - EncoderRate.enabled = true; + drawEditSignedFloat3(1, hmiValues.Probe_OffX_scaled, true); + encoderRate.enabled = true; break; case 2: // Probe Offset Y checkkey = ProbeOffY; - Draw_Edit_Signed_Float3(2, HMI_ValueStruct.Probe_OffY_scaled, true); - EncoderRate.enabled = true; + drawEditSignedFloat3(2, hmiValues.Probe_OffY_scaled, true); + encoderRate.enabled = true; break; } } - DWIN_UpdateLCD(); + dwinUpdateLCD(); } - void HMI_ProbeOffN(float &posScaled, float &offset_ref) { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); + void hmiProbeOffN(float &posScaled, float &offset_ref) { + EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; - if (Apply_Encoder(encoder_diffState, posScaled)) { + if (applyEncoder(encoder_diffState, posScaled)) { checkkey = ProbeOff; - EncoderRate.enabled = false; + encoderRate.enabled = false; offset_ref = posScaled / 10; - Draw_Edit_Signed_Float3(select_item.now, posScaled); + drawEditSignedFloat3(select_item.now, posScaled); return; } LIMIT(posScaled, -500, 500); - Draw_Edit_Signed_Float3(select_item.now, posScaled, true); + drawEditSignedFloat3(select_item.now, posScaled, true); } - void HMI_ProbeOffX() { HMI_ProbeOffN(HMI_ValueStruct.Probe_OffX_scaled, probe.offset.x); } - void HMI_ProbeOffY() { HMI_ProbeOffN(HMI_ValueStruct.Probe_OffY_scaled, probe.offset.y); } + void hmiProbeOffX() { hmiProbeOffN(hmiValues.Probe_OffX_scaled, probe.offset.x); } + void hmiProbeOffY() { hmiProbeOffN(hmiValues.Probe_OffY_scaled, probe.offset.y); } #endif // HAS_ONESTEP_LEVELING // Info -void HMI_Info() { +void hmiInfo() { EncoderState encoder_diffState = get_encoder_state(); if (encoder_diffState == ENCODER_DIFF_NO) return; if (encoder_diffState == ENCODER_DIFF_ENTER) { #if HAS_ONESTEP_LEVELING checkkey = Control; select_control.set(CONTROL_CASE_INFO); - Draw_Control_Menu(); + drawControlMenu(); #else select_page.set(3); - Goto_MainMenu(); + gotoMainMenu(); #endif } - DWIN_UpdateLCD(); + dwinUpdateLCD(); } // Tune -void HMI_Tune() { +void hmiTune() { EncoderState encoder_diffState = get_encoder_state(); if (encoder_diffState == ENCODER_DIFF_NO) return; @@ -3724,343 +3721,343 @@ void HMI_Tune() { if (select_tune.inc(1 + TUNE_CASE_TOTAL)) { if (select_tune.now > MROWS && select_tune.now > index_tune) { index_tune = select_tune.now; - Scroll_Menu(DWIN_SCROLL_UP); + scrollMenu(DWIN_SCROLL_UP); } else - Move_Highlight(1, select_tune.now + MROWS - index_tune); + moveHighlight(1, select_tune.now + MROWS - index_tune); } } else if (encoder_diffState == ENCODER_DIFF_CCW) { if (select_tune.dec()) { if (select_tune.now < index_tune - MROWS) { index_tune--; - Scroll_Menu(DWIN_SCROLL_DOWN); - if (index_tune == MROWS) Draw_Back_First(); + scrollMenu(DWIN_SCROLL_DOWN); + if (index_tune == MROWS) drawBackFirst(); } else - Move_Highlight(-1, select_tune.now + MROWS - index_tune); + moveHighlight(-1, select_tune.now + MROWS - index_tune); } } else if (encoder_diffState == ENCODER_DIFF_ENTER) { switch (select_tune.now) { case 0: { // Back select_print.set(0); - Goto_PrintProcess(); + gotoPrintProcess(); } break; case TUNE_CASE_SPEED: // Print speed checkkey = PrintSpeed; - HMI_ValueStruct.print_speed = feedrate_percentage; - Draw_Edit_Integer3(TUNE_CASE_SPEED + MROWS - index_tune, HMI_ValueStruct.print_speed, true); - EncoderRate.enabled = true; + hmiValues.print_speed = feedrate_percentage; + drawEditInteger3(TUNE_CASE_SPEED + MROWS - index_tune, hmiValues.print_speed, true); + encoderRate.enabled = true; break; #if HAS_HOTEND case TUNE_CASE_TEMP: // Nozzle temp checkkey = ETemp; - HMI_ValueStruct.E_Temp = thermalManager.degTargetHotend(0); - Draw_Edit_Integer3(TUNE_CASE_TEMP + MROWS - index_tune, HMI_ValueStruct.E_Temp, true); - EncoderRate.enabled = true; + hmiValues.E_Temp = thermalManager.degTargetHotend(0); + drawEditInteger3(TUNE_CASE_TEMP + MROWS - index_tune, hmiValues.E_Temp, true); + encoderRate.enabled = true; break; #endif #if HAS_HEATED_BED case TUNE_CASE_BED: // Bed temp checkkey = BedTemp; - HMI_ValueStruct.Bed_Temp = thermalManager.degTargetBed(); - Draw_Edit_Integer3(TUNE_CASE_BED + MROWS - index_tune, HMI_ValueStruct.Bed_Temp, true); - EncoderRate.enabled = true; + hmiValues.Bed_Temp = thermalManager.degTargetBed(); + drawEditInteger3(TUNE_CASE_BED + MROWS - index_tune, hmiValues.Bed_Temp, true); + encoderRate.enabled = true; break; #endif #if HAS_FAN case TUNE_CASE_FAN: // Fan speed checkkey = FanSpeed; - HMI_ValueStruct.Fan_speed = thermalManager.fan_speed[0]; - Draw_Edit_Integer3(TUNE_CASE_FAN + MROWS - index_tune, HMI_ValueStruct.Fan_speed, true); - EncoderRate.enabled = true; + hmiValues.Fan_speed = thermalManager.fan_speed[0]; + drawEditInteger3(TUNE_CASE_FAN + MROWS - index_tune, hmiValues.Fan_speed, true); + encoderRate.enabled = true; break; #endif #if HAS_ZOFFSET_ITEM case TUNE_CASE_ZOFF: // Z-offset #if ANY(HAS_BED_PROBE, BABYSTEPPING) checkkey = Homeoffset; - HMI_ValueStruct.offset_value = BABY_Z_VAR * 100; - Draw_Edit_Signed_Float2(TUNE_CASE_ZOFF + MROWS - index_tune, HMI_ValueStruct.offset_value, true); - EncoderRate.enabled = true; + hmiValues.offset_value = BABY_Z_VAR * 100; + drawEditSignedFloat2(TUNE_CASE_ZOFF + MROWS - index_tune, hmiValues.offset_value, true); + encoderRate.enabled = true; #else // Apply workspace offset, making the current position 0,0,0 queue.inject(F("G92X0Y0Z0")); - HMI_AudioFeedback(); + hmiAudioFeedback(); #endif break; #endif default: break; } } - DWIN_UpdateLCD(); + dwinUpdateLCD(); } #if HAS_PREHEAT // PLA Preheat - void HMI_PLAPreheatSetting() { + void hmiPLAPreheatSetting() { EncoderState encoder_diffState = get_encoder_state(); if (encoder_diffState == ENCODER_DIFF_NO) return; // Avoid flicker by updating only the previous menu if (encoder_diffState == ENCODER_DIFF_CW) { - if (select_PLA.inc(1 + PREHEAT_CASE_TOTAL)) Move_Highlight(1, select_PLA.now); + if (select_PLA.inc(1 + PREHEAT_CASE_TOTAL)) moveHighlight(1, select_PLA.now); } else if (encoder_diffState == ENCODER_DIFF_CCW) { - if (select_PLA.dec()) Move_Highlight(-1, select_PLA.now); + if (select_PLA.dec()) moveHighlight(-1, select_PLA.now); } else if (encoder_diffState == ENCODER_DIFF_ENTER) { switch (select_PLA.now) { case CASE_BACK: checkkey = TemperatureID; select_temp.now = TEMP_CASE_PLA; - HMI_ValueStruct.show_mode = -1; - Draw_Temperature_Menu(); + hmiValues.show_mode = -1; + drawTemperatureMenu(); break; #if HAS_HOTEND case PREHEAT_CASE_TEMP: checkkey = ETemp; - HMI_ValueStruct.E_Temp = ui.material_preset[0].hotend_temp; - Draw_Edit_Integer3(PREHEAT_CASE_TEMP, ui.material_preset[0].hotend_temp, true); - EncoderRate.enabled = true; + hmiValues.E_Temp = ui.material_preset[0].hotend_temp; + drawEditInteger3(PREHEAT_CASE_TEMP, ui.material_preset[0].hotend_temp, true); + encoderRate.enabled = true; break; #endif #if HAS_HEATED_BED case PREHEAT_CASE_BED: checkkey = BedTemp; - HMI_ValueStruct.Bed_Temp = ui.material_preset[0].bed_temp; - Draw_Edit_Integer3(PREHEAT_CASE_BED, ui.material_preset[0].bed_temp, true); - EncoderRate.enabled = true; + hmiValues.Bed_Temp = ui.material_preset[0].bed_temp; + drawEditInteger3(PREHEAT_CASE_BED, ui.material_preset[0].bed_temp, true); + encoderRate.enabled = true; break; #endif #if HAS_FAN case PREHEAT_CASE_FAN: checkkey = FanSpeed; - HMI_ValueStruct.Fan_speed = ui.material_preset[0].fan_speed; - Draw_Edit_Integer3(PREHEAT_CASE_FAN, ui.material_preset[0].fan_speed, true); - EncoderRate.enabled = true; + hmiValues.Fan_speed = ui.material_preset[0].fan_speed; + drawEditInteger3(PREHEAT_CASE_FAN, ui.material_preset[0].fan_speed, true); + encoderRate.enabled = true; break; #endif #if ENABLED(EEPROM_SETTINGS) case PREHEAT_CASE_SAVE: { const bool success = settings.save(); - HMI_AudioFeedback(success); + hmiAudioFeedback(success); } break; #endif default: break; } } - DWIN_UpdateLCD(); + dwinUpdateLCD(); } #if PREHEAT_COUNT > 1 // ABS Preheat - void HMI_ABSPreheatSetting() { + void hmiABSPreheatSetting() { EncoderState encoder_diffState = get_encoder_state(); if (encoder_diffState == ENCODER_DIFF_NO) return; // Avoid flicker by updating only the previous menu if (encoder_diffState == ENCODER_DIFF_CW) { - if (select_ABS.inc(1 + PREHEAT_CASE_TOTAL)) Move_Highlight(1, select_ABS.now); + if (select_ABS.inc(1 + PREHEAT_CASE_TOTAL)) moveHighlight(1, select_ABS.now); } else if (encoder_diffState == ENCODER_DIFF_CCW) { - if (select_ABS.dec()) Move_Highlight(-1, select_ABS.now); + if (select_ABS.dec()) moveHighlight(-1, select_ABS.now); } else if (encoder_diffState == ENCODER_DIFF_ENTER) { switch (select_ABS.now) { case CASE_BACK: checkkey = TemperatureID; select_temp.now = TEMP_CASE_ABS; - HMI_ValueStruct.show_mode = -1; - Draw_Temperature_Menu(); + hmiValues.show_mode = -1; + drawTemperatureMenu(); break; #if HAS_HOTEND case PREHEAT_CASE_TEMP: checkkey = ETemp; - HMI_ValueStruct.E_Temp = ui.material_preset[1].hotend_temp; - Draw_Edit_Integer3(PREHEAT_CASE_TEMP, ui.material_preset[1].hotend_temp, true); - EncoderRate.enabled = true; + hmiValues.E_Temp = ui.material_preset[1].hotend_temp; + drawEditInteger3(PREHEAT_CASE_TEMP, ui.material_preset[1].hotend_temp, true); + encoderRate.enabled = true; break; #endif #if HAS_HEATED_BED case PREHEAT_CASE_BED: checkkey = BedTemp; - HMI_ValueStruct.Bed_Temp = ui.material_preset[1].bed_temp; - Draw_Edit_Integer3(PREHEAT_CASE_BED, ui.material_preset[1].bed_temp, true); - EncoderRate.enabled = true; + hmiValues.Bed_Temp = ui.material_preset[1].bed_temp; + drawEditInteger3(PREHEAT_CASE_BED, ui.material_preset[1].bed_temp, true); + encoderRate.enabled = true; break; #endif #if HAS_FAN case PREHEAT_CASE_FAN: checkkey = FanSpeed; - HMI_ValueStruct.Fan_speed = ui.material_preset[1].fan_speed; - Draw_Edit_Integer3(PREHEAT_CASE_FAN, ui.material_preset[1].fan_speed, true); - EncoderRate.enabled = true; + hmiValues.Fan_speed = ui.material_preset[1].fan_speed; + drawEditInteger3(PREHEAT_CASE_FAN, ui.material_preset[1].fan_speed, true); + encoderRate.enabled = true; break; #endif #if ENABLED(EEPROM_SETTINGS) case PREHEAT_CASE_SAVE: { const bool success = settings.save(); - HMI_AudioFeedback(success); + hmiAudioFeedback(success); } break; #endif default: break; } } - DWIN_UpdateLCD(); + dwinUpdateLCD(); } #endif // PREHEAT_COUNT > 1 #endif // HAS_PREHEAT // Max Speed -void HMI_MaxSpeed() { +void hmiMaxSpeed() { EncoderState encoder_diffState = get_encoder_state(); if (encoder_diffState == ENCODER_DIFF_NO) return; // Avoid flicker by updating only the previous menu if (encoder_diffState == ENCODER_DIFF_CW) { - if (select_speed.inc(1 + 3 + ENABLED(HAS_HOTEND))) Move_Highlight(1, select_speed.now); + if (select_speed.inc(1 + 3 + ENABLED(HAS_HOTEND))) moveHighlight(1, select_speed.now); } else if (encoder_diffState == ENCODER_DIFF_CCW) { - if (select_speed.dec()) Move_Highlight(-1, select_speed.now); + if (select_speed.dec()) moveHighlight(-1, select_speed.now); } else if (encoder_diffState == ENCODER_DIFF_ENTER) { if (WITHIN(select_speed.now, 1, 4)) { checkkey = MaxSpeed_value; - HMI_flag.feedspeed_axis = AxisEnum(select_speed.now - 1); - HMI_ValueStruct.Max_Feedspeed = planner.settings.max_feedrate_mm_s[HMI_flag.feedspeed_axis]; - Draw_Edit_Integer4(select_speed.now, HMI_ValueStruct.Max_Feedspeed, true); - EncoderRate.enabled = true; + hmiFlag.feedspeed_axis = AxisEnum(select_speed.now - 1); + hmiValues.Max_Feedspeed = planner.settings.max_feedrate_mm_s[hmiFlag.feedspeed_axis]; + drawEditInteger4(select_speed.now, hmiValues.Max_Feedspeed, true); + encoderRate.enabled = true; } else { // Back checkkey = Motion; select_motion.now = MOTION_CASE_RATE; - Draw_Motion_Menu(); + drawMotionMenu(); } } - DWIN_UpdateLCD(); + dwinUpdateLCD(); } // Max Acceleration -void HMI_MaxAcceleration() { +void hmiMaxAcceleration() { EncoderState encoder_diffState = get_encoder_state(); if (encoder_diffState == ENCODER_DIFF_NO) return; // Avoid flicker by updating only the previous menu if (encoder_diffState == ENCODER_DIFF_CW) { - if (select_acc.inc(1 + 3 + ENABLED(HAS_HOTEND))) Move_Highlight(1, select_acc.now); + if (select_acc.inc(1 + 3 + ENABLED(HAS_HOTEND))) moveHighlight(1, select_acc.now); } else if (encoder_diffState == ENCODER_DIFF_CCW) { - if (select_acc.dec()) Move_Highlight(-1, select_acc.now); + if (select_acc.dec()) moveHighlight(-1, select_acc.now); } else if (encoder_diffState == ENCODER_DIFF_ENTER) { if (WITHIN(select_acc.now, 1, 4)) { checkkey = MaxAcceleration_value; - HMI_flag.acc_axis = AxisEnum(select_acc.now - 1); - HMI_ValueStruct.Max_Acceleration = planner.settings.max_acceleration_mm_per_s2[HMI_flag.acc_axis]; - Draw_Edit_Integer4(select_acc.now, HMI_ValueStruct.Max_Acceleration, true); - EncoderRate.enabled = true; + hmiFlag.acc_axis = AxisEnum(select_acc.now - 1); + hmiValues.Max_Acceleration = planner.settings.max_acceleration_mm_per_s2[hmiFlag.acc_axis]; + drawEditInteger4(select_acc.now, hmiValues.Max_Acceleration, true); + encoderRate.enabled = true; } else { // Back checkkey = Motion; select_motion.now = MOTION_CASE_ACCEL; - Draw_Motion_Menu(); + drawMotionMenu(); } } - DWIN_UpdateLCD(); + dwinUpdateLCD(); } #if HAS_CLASSIC_JERK // Max Jerk - void HMI_MaxJerk() { + void hmiMaxJerk() { EncoderState encoder_diffState = get_encoder_state(); if (encoder_diffState == ENCODER_DIFF_NO) return; // Avoid flicker by updating only the previous menu if (encoder_diffState == ENCODER_DIFF_CW) { - if (select_jerk.inc(1 + 3 + ENABLED(HAS_HOTEND))) Move_Highlight(1, select_jerk.now); + if (select_jerk.inc(1 + 3 + ENABLED(HAS_HOTEND))) moveHighlight(1, select_jerk.now); } else if (encoder_diffState == ENCODER_DIFF_CCW) { - if (select_jerk.dec()) Move_Highlight(-1, select_jerk.now); + if (select_jerk.dec()) moveHighlight(-1, select_jerk.now); } else if (encoder_diffState == ENCODER_DIFF_ENTER) { if (WITHIN(select_jerk.now, 1, 4)) { checkkey = MaxJerk_value; - HMI_flag.jerk_axis = AxisEnum(select_jerk.now - 1); - HMI_ValueStruct.Max_Jerk_scaled = planner.max_jerk[HMI_flag.jerk_axis] * MINUNITMULT; - Draw_Edit_Float3(select_jerk.now, HMI_ValueStruct.Max_Jerk_scaled, true); - EncoderRate.enabled = true; + hmiFlag.jerk_axis = AxisEnum(select_jerk.now - 1); + hmiValues.Max_Jerk_scaled = planner.max_jerk[hmiFlag.jerk_axis] * MINUNITMULT; + drawEditFloat3(select_jerk.now, hmiValues.Max_Jerk_scaled, true); + encoderRate.enabled = true; } else { // Back checkkey = Motion; select_motion.now = MOTION_CASE_JERK; - Draw_Motion_Menu(); + drawMotionMenu(); } } - DWIN_UpdateLCD(); + dwinUpdateLCD(); } #endif // HAS_CLASSIC_JERK // Step -void HMI_Step() { +void hmiStep() { EncoderState encoder_diffState = get_encoder_state(); if (encoder_diffState == ENCODER_DIFF_NO) return; // Avoid flicker by updating only the previous menu if (encoder_diffState == ENCODER_DIFF_CW) { - if (select_step.inc(1 + 3 + ENABLED(HAS_HOTEND))) Move_Highlight(1, select_step.now); + if (select_step.inc(1 + 3 + ENABLED(HAS_HOTEND))) moveHighlight(1, select_step.now); } else if (encoder_diffState == ENCODER_DIFF_CCW) { - if (select_step.dec()) Move_Highlight(-1, select_step.now); + if (select_step.dec()) moveHighlight(-1, select_step.now); } else if (encoder_diffState == ENCODER_DIFF_ENTER) { if (WITHIN(select_step.now, 1, 4)) { checkkey = Step_value; - HMI_flag.step_axis = AxisEnum(select_step.now - 1); - HMI_ValueStruct.Max_Step_scaled = planner.settings.axis_steps_per_mm[HMI_flag.step_axis] * MINUNITMULT; - Draw_Edit_Float3(select_step.now, HMI_ValueStruct.Max_Step_scaled, true); - EncoderRate.enabled = true; + hmiFlag.step_axis = AxisEnum(select_step.now - 1); + hmiValues.Max_Step_scaled = planner.settings.axis_steps_per_mm[hmiFlag.step_axis] * MINUNITMULT; + drawEditFloat3(select_step.now, hmiValues.Max_Step_scaled, true); + encoderRate.enabled = true; } else { // Back checkkey = Motion; select_motion.now = MOTION_CASE_STEPS; - Draw_Motion_Menu(); + drawMotionMenu(); } } - DWIN_UpdateLCD(); + dwinUpdateLCD(); } -void HMI_Init() { - HMI_SDCardInit(); +void hmiInit() { + hmiSDCardInit(); for (uint16_t t = 0; t <= 100; t += 2) { - DWIN_ICON_Show(ICON, ICON_Bar, 15, 260); - DWIN_Draw_Rectangle(1, Color_Bg_Black, 15 + t * 242 / 100, 260, 257, 280); - DWIN_UpdateLCD(); + dwinIconShow(ICON, ICON_Bar, 15, 260); + dwinDrawRectangle(1, Color_Bg_Black, 15 + t * 242 / 100, 260, 257, 280); + dwinUpdateLCD(); delay(20); } - HMI_SetLanguage(); + hmiSetLanguage(); } -void DWIN_InitScreen() { - Encoder_Configuration(); - HMI_Init(); - HMI_SetLanguageCache(); - HMI_StartFrame(true); +void dwinInitScreen() { + encoderConfiguration(); + hmiInit(); + hmiSetLanguageCache(); + hmiStartFrame(true); } -void DWIN_Update() { - EachMomentUpdate(); // Status update - HMI_SDCardUpdate(); // SD card update - DWIN_HandleScreen(); // Rotary encoder update +void dwinUpdate() { + eachMomentUpdate(); // Status update + hmiSDCardUpdate(); // SD card update + dwinHandleScreen(); // Rotary encoder update } -void EachMomentUpdate() { +void eachMomentUpdate() { static millis_t next_var_update_ms = 0, next_rts_update_ms = 0; const millis_t ms = millis(); @@ -4074,9 +4071,9 @@ void EachMomentUpdate() { if (checkkey == PrintProcess) { // if print done - if (HMI_flag.print_finish && !HMI_flag.done_confirm_flag) { - HMI_flag.print_finish = false; - HMI_flag.done_confirm_flag = true; + if (hmiFlag.print_finish && !hmiFlag.done_confirm_flag) { + hmiFlag.print_finish = false; + hmiFlag.done_confirm_flag = true; TERN_(POWER_LOSS_RECOVERY, recovery.cancel()); @@ -4084,22 +4081,22 @@ void EachMomentUpdate() { // show percent bar and value _card_percent = 0; - Draw_Print_ProgressBar(); + drawPrintProgressBar(); // show print done confirm - DWIN_Draw_Rectangle(1, Color_Bg_Black, 0, 250, DWIN_WIDTH - 1, STATUS_Y); - DWIN_ICON_Show(ICON, HMI_IsChinese() ? ICON_Confirm_C : ICON_Confirm_E, 86, 283); + dwinDrawRectangle(1, Color_Bg_Black, 0, 250, DWIN_WIDTH - 1, STATUS_Y); + dwinIconShow(ICON, hmiIsChinese() ? ICON_Confirm_C : ICON_Confirm_E, 86, 283); } - else if (HMI_flag.pause_flag != printingIsPaused()) { + else if (hmiFlag.pause_flag != printingIsPaused()) { // print status update - HMI_flag.pause_flag = printingIsPaused(); - ICON_ResumeOrPause(); + hmiFlag.pause_flag = printingIsPaused(); + iconResumeOrPause(); } } // pause after homing - if (HMI_flag.pause_action && printingIsPaused() && !planner.has_blocks_queued()) { - HMI_flag.pause_action = false; + if (hmiFlag.pause_action && printingIsPaused() && !planner.has_blocks_queued()) { + hmiFlag.pause_action = false; #if ENABLED(PAUSE_HEAT) TERN_(HAS_HOTEND, resume_hotend_temp = thermalManager.degTargetHotend(0)); TERN_(HAS_HEATED_BED, resume_bed_temp = thermalManager.degTargetBed()); @@ -4115,7 +4112,7 @@ void EachMomentUpdate() { last_cardpercentValue = card_pct; if (card_pct) { _card_percent = card_pct; - Draw_Print_ProgressBar(); + drawPrintProgressBar(); } } @@ -4126,174 +4123,175 @@ void EachMomentUpdate() { const uint16_t min = (elapsed.value % 3600) / 60; if (last_Printtime != min) { // 1 minute update last_Printtime = min; - Draw_Print_ProgressElapsed(); + drawPrintProgressElapsed(); } // Estimate remaining time every 20 seconds static millis_t next_remain_time_update = 0; - if (_card_percent > 1 && ELAPSED(ms, next_remain_time_update) && !HMI_flag.heat_flag) { + if (_card_percent > 1 && ELAPSED(ms, next_remain_time_update) && !hmiFlag.heat_flag) { _remain_time = (elapsed.value - dwin_heat_time) / (_card_percent * 0.01f) - (elapsed.value - dwin_heat_time); next_remain_time_update += DWIN_REMAIN_TIME_UPDATE_INTERVAL; - Draw_Print_ProgressRemain(); + drawPrintProgressRemain(); } } - else if (dwin_abort_flag && !HMI_flag.home_flag) { // Print Stop + else if (dwin_abort_flag && !hmiFlag.home_flag) { // Print Stop dwin_abort_flag = false; - HMI_ValueStruct.print_speed = feedrate_percentage = 100; + hmiValues.print_speed = feedrate_percentage = 100; dwin_zoffset = BABY_Z_VAR; select_page.set(0); - Goto_MainMenu(); + gotoMainMenu(); } #if ENABLED(POWER_LOSS_RECOVERY) else if (DWIN_lcd_sd_status && recovery.dwin_flag) { // resume print before power off recovery.dwin_flag = false; auto update_selection = [&](const bool sel) { - HMI_flag.select_flag = sel; + hmiFlag.select_flag = sel; const uint16_t c1 = sel ? Color_Bg_Window : Select_Color; - DWIN_Draw_Rectangle(0, c1, 25, 306, 126, 345); - DWIN_Draw_Rectangle(0, c1, 24, 305, 127, 346); + dwinDrawRectangle(0, c1, 25, 306, 126, 345); + dwinDrawRectangle(0, c1, 24, 305, 127, 346); const uint16_t c2 = sel ? Select_Color : Color_Bg_Window; - DWIN_Draw_Rectangle(0, c2, 145, 306, 246, 345); - DWIN_Draw_Rectangle(0, c2, 144, 305, 247, 346); + dwinDrawRectangle(0, c2, 145, 306, 246, 345); + dwinDrawRectangle(0, c2, 144, 305, 247, 346); }; - Popup_Window_Resume(); + popupWindowResume(); update_selection(true); char * const name = card.longest_filename(); const int8_t npos = _MAX(0U, DWIN_WIDTH - strlen(name) * (MENU_CHR_W)) / 2; - DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, npos, 252, name); - DWIN_UpdateLCD(); + dwinDrawString(true, font8x16, Popup_Text_Color, Color_Bg_Window, npos, 252, name); + dwinUpdateLCD(); bool recovery_flag = true; while (recovery_flag) { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); + EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState != ENCODER_DIFF_NO) { if (encoder_diffState == ENCODER_DIFF_ENTER) { recovery_flag = false; - if (HMI_flag.select_flag) break; + if (hmiFlag.select_flag) break; TERN_(POWER_LOSS_RECOVERY, queue.inject(F("M1000C"))); - HMI_StartFrame(true); + hmiStartFrame(true); return; } else update_selection(encoder_diffState == ENCODER_DIFF_CW); - DWIN_UpdateLCD(); + dwinUpdateLCD(); } } select_print.set(0); - HMI_ValueStruct.show_mode = 0; + hmiValues.show_mode = 0; queue.inject(F("M1000")); - Goto_PrintProcess(); - Draw_Status_Area(true); + gotoPrintProcess(); + drawStatusArea(true); } #endif // POWER_LOSS_RECOVERY - DWIN_UpdateLCD(); + dwinUpdateLCD(); } -void DWIN_HandleScreen() { +void dwinHandleScreen() { switch (checkkey) { - case MainMenu: HMI_MainMenu(); break; - case SelectFile: HMI_SelectFile(); break; - case Prepare: HMI_Prepare(); break; - case Control: HMI_Control(); break; + case MainMenu: hmiMainMenu(); break; + case SelectFile: hmiSelectFile(); break; + case Prepare: hmiPrepare(); break; + case Control: hmiControl(); break; case Leveling: break; - case PrintProcess: HMI_Printing(); break; - case Print_window: HMI_PauseOrStop(); break; - case AxisMove: HMI_AxisMove(); break; - case TemperatureID: HMI_Temperature(); break; - case Motion: HMI_Motion(); break; - case AdvSet: HMI_AdvSet(); break; + case PrintProcess: hmiPrinting(); break; + case Print_window: hmiPauseOrStop(); break; + case AxisMove: hmiAxisMove(); break; + case TemperatureID: hmiTemperature(); break; + case Motion: hmiMotion(); break; + case AdvSet: hmiAdvSet(); break; #if HAS_HOME_OFFSET - case HomeOff: HMI_HomeOff(); break; - case HomeOffX: HMI_HomeOffX(); break; - case HomeOffY: HMI_HomeOffY(); break; - case HomeOffZ: HMI_HomeOffZ(); break; + case HomeOff: hmiHomeOff(); break; + case HomeOffX: hmiHomeOffX(); break; + case HomeOffY: hmiHomeOffY(); break; + case HomeOffZ: hmiHomeOffZ(); break; #endif #if HAS_ONESTEP_LEVELING - case ProbeOff: HMI_ProbeOff(); break; - case ProbeOffX: HMI_ProbeOffX(); break; - case ProbeOffY: HMI_ProbeOffY(); break; + case ProbeOff: hmiProbeOff(); break; + case ProbeOffX: hmiProbeOffX(); break; + case ProbeOffY: hmiProbeOffY(); break; #endif - case Info: HMI_Info(); break; - case Tune: HMI_Tune(); break; + case Info: hmiInfo(); break; + case Tune: hmiTune(); break; #if HAS_PREHEAT - case PLAPreheat: HMI_PLAPreheatSetting(); break; + case PLAPreheat: hmiPLAPreheatSetting(); break; #if PREHEAT_COUNT > 1 - case ABSPreheat: HMI_ABSPreheatSetting(); break; + case ABSPreheat: hmiABSPreheatSetting(); break; #endif #endif - case MaxSpeed: HMI_MaxSpeed(); break; - case MaxAcceleration: HMI_MaxAcceleration(); break; + case MaxSpeed: hmiMaxSpeed(); break; + case MaxAcceleration: hmiMaxAcceleration(); break; #if HAS_CLASSIC_JERK - case MaxJerk: HMI_MaxJerk(); break; + case MaxJerk: hmiMaxJerk(); break; #endif - case Step: HMI_Step(); break; - case Move_X: HMI_Move_X(); break; - case Move_Y: HMI_Move_Y(); break; - case Move_Z: HMI_Move_Z(); break; + case Step: hmiStep(); break; + case Move_X: hmiMoveX(); break; + case Move_Y: hmiMoveY(); break; + case Move_Z: hmiMoveZ(); break; #if HAS_HOTEND - case Extruder: HMI_Move_E(); break; - case ETemp: HMI_ETemp(); break; + case Extruder: hmiMoveE(); break; + case ETemp: hmiETemp(); break; #endif #if ANY(HAS_BED_PROBE, BABYSTEPPING) - case Homeoffset: HMI_Zoffset(); break; + case Homeoffset: hmiZoffset(); break; + #endif #if HAS_HEATED_BED - case BedTemp: HMI_BedTemp(); break; + case BedTemp: hmiBedTemp(); break; #endif #if HAS_PREHEAT && HAS_FAN - case FanSpeed: HMI_FanSpeed(); break; + case FanSpeed: hmiFanSpeed(); break; #endif - case PrintSpeed: HMI_PrintSpeed(); break; - case MaxSpeed_value: HMI_MaxFeedspeedXYZE(); break; - case MaxAcceleration_value: HMI_MaxAccelerationXYZE(); break; + case PrintSpeed: hmiPrintSpeed(); break; + case MaxSpeed_value: hmiMaxFeedspeedXYZE(); break; + case MaxAcceleration_value: hmiMaxAccelerationXYZE(); break; #if HAS_CLASSIC_JERK - case MaxJerk_value: HMI_MaxJerkXYZE(); break; + case MaxJerk_value: hmiMaxJerkXYZE(); break; #endif - case Step_value: HMI_StepXYZE(); break; + case Step_value: hmiStepXYZE(); break; default: break; } } -void DWIN_HomingDone() { - HMI_flag.home_flag = false; +void dwinHomingDone() { + hmiFlag.home_flag = false; dwin_zoffset = TERN0(HAS_BED_PROBE, probe.offset.z); if (checkkey == Last_Prepare) { checkkey = Prepare; select_prepare.now = PREPARE_CASE_HOME; index_prepare = MROWS; - Draw_Prepare_Menu(); + drawPrepareMenu(); } else if (checkkey == Back_Main) { - HMI_ValueStruct.print_speed = feedrate_percentage = 100; + hmiValues.print_speed = feedrate_percentage = 100; planner.finish_and_disable(); - Goto_MainMenu(); + gotoMainMenu(); } } -void DWIN_LevelingDone() { - if (checkkey == Leveling) Goto_MainMenu(); +void dwinLevelingDone() { + if (checkkey == Leveling) gotoMainMenu(); } -void DWIN_StatusChanged(const char * const cstr/*=nullptr*/) { - DWIN_Draw_Rectangle(1, Color_Bg_Blue, 0, STATUS_Y, DWIN_WIDTH, STATUS_Y + 24); +void dwinStatusChanged(const char * const cstr/*=nullptr*/) { + dwinDrawRectangle(1, Color_Bg_Blue, 0, STATUS_Y, DWIN_WIDTH, STATUS_Y + 24); const int8_t x = _MAX(0U, DWIN_WIDTH - strlen(cstr) * MENU_CHR_W) / 2; - DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Blue, x, STATUS_Y + 3, cstr); - DWIN_UpdateLCD(); + dwinDrawString(false, font8x16, Color_White, Color_Bg_Blue, x, STATUS_Y + 3, cstr); + dwinUpdateLCD(); } -void DWIN_StatusChanged(FSTR_P const fstr) { +void dwinStatusChanged(FSTR_P const fstr) { #ifdef __AVR__ char str[strlen_P(FTOP(fstr)) + 1]; strcpy_P(str, FTOP(fstr)); - DWIN_StatusChanged(str); + dwinStatusChanged(str); #else - DWIN_StatusChanged(FTOP(fstr)); + dwinStatusChanged(FTOP(fstr)); #endif } diff --git a/Marlin/src/lcd/e3v2/creality/dwin.h b/Marlin/src/lcd/e3v2/creality/dwin.h index 854a011c5e3f1..0e2d42eee91cc 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.h +++ b/Marlin/src/lcd/e3v2/creality/dwin.h @@ -133,7 +133,7 @@ typedef struct { float Home_OffZ_scaled = 0; float Probe_OffX_scaled = 0; float Probe_OffY_scaled = 0; -} HMI_value_t; +} hmi_value_t; #define DWIN_CHINESE 123 #define DWIN_ENGLISH 0 @@ -151,59 +151,59 @@ typedef struct { bool cold_flag:1; #endif AxisEnum feedspeed_axis, acc_axis, jerk_axis, step_axis; -} HMI_flag_t; +} hmi_flag_t; -extern HMI_value_t HMI_ValueStruct; -extern HMI_flag_t HMI_flag; +extern hmi_value_t hmiValues; +extern hmi_flag_t hmiFlag; #if HAS_HOTEND || HAS_HEATED_BED // Popup message window - void DWIN_Popup_Temperature(const bool toohigh); + void dwinPopupTemperature(const bool toohigh); #endif #if HAS_HOTEND - void Popup_Window_ETempTooLow(); + void popupWindowETempTooLow(); #endif -void Popup_Window_Resume(); -void Popup_Window_Home(const bool parking=false); -void Popup_Window_Leveling(); +void popupWindowResume(); +void popupWindowHome(const bool parking=false); +void popupWindowLeveling(); -void Goto_PrintProcess(); -void Goto_MainMenu(); +void gotoPrintProcess(); +void gotoMainMenu(); // Variable control -void HMI_Move_X(); -void HMI_Move_Y(); -void HMI_Move_Z(); -void HMI_Move_E(); +void hmiMoveX(); +void hmiMoveY(); +void hmiMoveZ(); +void hmiMoveE(); -void HMI_Zoffset(); +void hmiZoffset(); #if HAS_HOTEND - void HMI_ETemp(); + void hmiETemp(); #endif #if HAS_HEATED_BED - void HMI_BedTemp(); + void hmiBedTemp(); #endif #if HAS_FAN - void HMI_FanSpeed(); + void hmiFanSpeed(); #endif -void HMI_PrintSpeed(); +void hmiPrintSpeed(); -void HMI_MaxFeedspeedXYZE(); -void HMI_MaxAccelerationXYZE(); -void HMI_MaxJerkXYZE(); -void HMI_StepXYZE(); -void HMI_SetLanguageCache(); +void hmiMaxFeedspeedXYZE(); +void hmiMaxAccelerationXYZE(); +void hmiMaxJerkXYZE(); +void hmiStepXYZE(); +void hmiSetLanguageCache(); void update_variable(); -void DWIN_Draw_Signed_Float(uint8_t size, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, long value); +void dwinDrawSigned_Float(uint8_t size, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, long value); // SD Card -void HMI_SDCardInit(); -void HMI_SDCardUpdate(); +void hmiSDCardInit(); +void hmiSDCardUpdate(); // Main Process void Icon_print(bool value); @@ -212,39 +212,39 @@ void Icon_temperature(bool value); void Icon_leveling(bool value); // Other -void Draw_Status_Area(const bool with_update); // Status Area -void HMI_StartFrame(const bool with_update); // Prepare the menu view -void HMI_MainMenu(); // Main process screen -void HMI_SelectFile(); // File page -void HMI_Printing(); // Print page -void HMI_Prepare(); // Prepare page -void HMI_Control(); // Control page -void HMI_Leveling(); // Level the page -void HMI_AxisMove(); // Axis movement menu -void HMI_Temperature(); // Temperature menu -void HMI_Motion(); // Sports menu -void HMI_Info(); // Information menu -void HMI_Tune(); // Adjust the menu +void drawStatusArea(const bool with_update); // Status Area +void hmiStartFrame(const bool with_update); // Prepare the menu view +void hmiMainMenu(); // Main process screen +void hmiSelectFile(); // File page +void hmiPrinting(); // Print page +void hmiPrepare(); // Prepare page +void hmiControl(); // Control page +void hmiLeveling(); // Level the page +void hmiAxisMove(); // Axis movement menu +void hmiTemperature(); // Temperature menu +void hmiMotion(); // Sports menu +void hmiInfo(); // Information menu +void hmiTune(); // Adjust the menu #if HAS_PREHEAT - void HMI_PLAPreheatSetting(); // PLA warm-up setting - void HMI_ABSPreheatSetting(); // ABS warm-up setting + void hmiPLAPreheatSetting(); // PLA warm-up setting + void hmiABSPreheatSetting(); // ABS warm-up setting #endif -void HMI_MaxSpeed(); // Maximum speed submenu -void HMI_MaxAcceleration(); // Maximum acceleration submenu -void HMI_MaxJerk(); // Maximum jerk speed submenu -void HMI_Step(); // Transmission ratio +void hmiMaxSpeed(); // Maximum speed submenu +void hmiMaxAcceleration(); // Maximum acceleration submenu +void hmiMaxJerk(); // Maximum jerk speed submenu +void hmiStep(); // Transmission ratio -void HMI_Init(); -void DWIN_InitScreen(); -void DWIN_Update(); -void EachMomentUpdate(); -void DWIN_HandleScreen(); -void DWIN_StatusChanged(const char * const cstr=nullptr); -void DWIN_StatusChanged(FSTR_P const fstr); +void hmiInit(); +void dwinInitScreen(); +void dwinUpdate(); +void eachMomentUpdate(); +void dwinHandleScreen(); +void dwinStatusChanged(const char * const cstr=nullptr); +void dwinStatusChanged(FSTR_P const fstr); -inline void DWIN_HomingStart() { HMI_flag.home_flag = true; } +inline void dwinHomingStart() { hmiFlag.home_flag = true; } -void DWIN_HomingDone(); -void DWIN_LevelingDone(); +void dwinHomingDone(); +void dwinLevelingDone(); diff --git a/Marlin/src/lcd/e3v2/creality/dwin_lcd.cpp b/Marlin/src/lcd/e3v2/creality/dwin_lcd.cpp index 3d60e32a79086..7a0587df43100 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin_lcd.cpp +++ b/Marlin/src/lcd/e3v2/creality/dwin_lcd.cpp @@ -41,16 +41,16 @@ /*-------------------------------------- System variable function --------------------------------------*/ -void DWIN_Startup() { +void dwinStartup() { DEBUG_ECHOPGM("\r\nDWIN handshake "); delay(750); // Delay here or init later in the boot process - if (DWIN_Handshake()) DEBUG_ECHOLNPGM("ok."); else DEBUG_ECHOLNPGM("error."); - DWIN_Frame_SetDir(1); + if (dwinHandshake()) DEBUG_ECHOLNPGM("ok."); else DEBUG_ECHOLNPGM("error."); + dwinFrameSetDir(1); #if DISABLED(SHOW_BOOTSCREEN) - DWIN_Frame_Clear(Color_Bg_Black); // MarlinUI handles the bootscreen so just clear here + dwinFrameClear(Color_Bg_Black); // MarlinUI handles the bootscreen so just clear here #endif - DWIN_JPG_ShowAndCache(3); - DWIN_UpdateLCD(); + dwinJPGShowAndCache(3); + dwinUpdateLCD(); } /*---------------------------------------- Picture related functions ----------------------------------------*/ @@ -59,8 +59,8 @@ void DWIN_Startup() { // libID: Icon library ID // picID: Icon ID // x/y: Upper-left point -void DWIN_ICON_Show(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) { - DWIN_ICON_Show(true, false, false, libID, picID, x, y); +void dwinIconShow(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) { + dwinIconShow(true, false, false, libID, picID, x, y); } // Copy area from virtual display area to current screen @@ -68,17 +68,17 @@ void DWIN_ICON_Show(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) { // xStart/yStart: Upper-left of virtual area // xEnd/yEnd: Lower-right of virtual area // x/y: Screen paste point -void DWIN_Frame_AreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y) { +void dwinFrameAreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y) { size_t i = 0; - DWIN_Byte(i, 0x27); - DWIN_Byte(i, 0x80 | cacheID); - DWIN_Word(i, xStart); - DWIN_Word(i, yStart); - DWIN_Word(i, xEnd); - DWIN_Word(i, yEnd); - DWIN_Word(i, x); - DWIN_Word(i, y); - DWIN_Send(i); + dwinByte(i, 0x27); + dwinByte(i, 0x80 | cacheID); + dwinWord(i, xStart); + dwinWord(i, yStart); + dwinWord(i, xEnd); + dwinWord(i, yEnd); + dwinWord(i, x); + dwinWord(i, y); + dwinSend(i); } #endif // DWIN_CREALITY_LCD diff --git a/Marlin/src/lcd/e3v2/creality/dwin_lcd.h b/Marlin/src/lcd/e3v2/creality/dwin_lcd.h index b37a65977c5c9..b60fe2970d66b 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin_lcd.h +++ b/Marlin/src/lcd/e3v2/creality/dwin_lcd.h @@ -44,4 +44,4 @@ // xStart/yStart: Upper-left of virtual area // xEnd/yEnd: Lower-right of virtual area // x/y: Screen paste point -void DWIN_Frame_AreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y); +void dwinFrameAreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y); diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 1ef9ee8517f83..b7b2629f99692 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -58,10 +58,6 @@ #define HAS_ZOFFSET_ITEM 1 #endif -#ifndef strcasecmp_P - #define strcasecmp_P(a, b) strcasecmp((a), (b)) -#endif - #if HAS_LEVELING #include "../../../feature/bedlevel/bedlevel.h" #endif @@ -206,7 +202,7 @@ float corner_pos; bool probe_deployed = false; -CrealityDWINClass CrealityDWIN; +CrealityDWIN crealityDWIN; template class TextScroller { @@ -295,29 +291,17 @@ class TextScroller { matrix_3x3 rotation = matrix_3x3::create_look_at(vector_3(lsf_results.A, lsf_results.B, 1)); GRID_LOOP(i, j) { - float mx = bedlevel.get_mesh_x(i), - my = bedlevel.get_mesh_y(j), - mz = bedlevel.z_values[i][j]; + float mx = bedlevel.get_mesh_x(i), my = bedlevel.get_mesh_y(j), mz = bedlevel.z_values[i][j]; if (DEBUGGING(LEVELING)) { - DEBUG_ECHOPAIR_F("before rotation = [", mx, 7); - DEBUG_CHAR(','); - DEBUG_ECHO_F(my, 7); - DEBUG_CHAR(','); - DEBUG_ECHO_F(mz, 7); - DEBUG_ECHOPGM("] ---> "); + DEBUG_ECHOLN(F("before rotation = ["), p_float_t(mx, 7), AS_CHAR(','), p_float_t(my, 7), AS_CHAR(','), p_float_t(mz, 7), F("] ---> ")); DEBUG_DELAY(20); } rotation.apply_rotation_xyz(mx, my, mz); if (DEBUGGING(LEVELING)) { - DEBUG_ECHOPAIR_F("after rotation = [", mx, 7); - DEBUG_CHAR(','); - DEBUG_ECHO_F(my, 7); - DEBUG_CHAR(','); - DEBUG_ECHO_F(mz, 7); - DEBUG_ECHOLNPGM("]"); + DEBUG_ECHOLN(F("after rotation = ["), p_float_t(mx, 7), AS_CHAR(','), p_float_t(my, 7), AS_CHAR(','), p_float_t(mz, 7), AS_CHAR(']')); DEBUG_DELAY(20); } @@ -344,7 +328,7 @@ class TextScroller { planner.synchronize(); } else { - CrealityDWIN.Popup_Handler(MoveWait); + crealityDWIN.popupHandler(MoveWait); sprintf_P(cmd, PSTR("G0 F300 Z%s"), dtostrf(Z_CLEARANCE_BETWEEN_PROBES, 1, 3, str_1)); gcode.process_subcommands_now(cmd); sprintf_P(cmd, PSTR("G42 F4000 I%i J%i"), mesh_x, mesh_y); @@ -353,7 +337,7 @@ class TextScroller { current_position.z = goto_mesh_value ? bedlevel.z_values[mesh_x][mesh_y] : Z_CLEARANCE_BETWEEN_PROBES; planner.buffer_line(current_position, homing_feedrate(Z_AXIS), active_extruder); planner.synchronize(); - CrealityDWIN.Redraw_Menu(); + crealityDWIN.redrawMenu(); } } @@ -375,7 +359,7 @@ class TextScroller { return min; } - void Draw_Bed_Mesh(const int16_t selected=-1, const uint8_t gridline_width=1, const uint16_t padding_x=8, const uint16_t padding_y_top=40 + 53 - 7) { + void drawBedMesh(const int16_t selected=-1, const uint8_t gridline_width=1, const uint16_t padding_x=8, const uint16_t padding_y_top=40 + 53 - 7) { drawing_mesh = true; const uint16_t total_width_px = DWIN_WIDTH - padding_x - padding_x, cell_width_px = total_width_px / (GRID_MAX_POINTS_X), @@ -383,13 +367,13 @@ class TextScroller { const float v_max = abs(get_max_value()), v_min = abs(get_min_value()), range = _MAX(v_min, v_max); // Clear background from previous selection and select new square - DWIN_Draw_Rectangle(1, Color_Bg_Black, _MAX(0, padding_x - gridline_width), _MAX(0, padding_y_top - gridline_width), padding_x + total_width_px, padding_y_top + total_width_px); + dwinDrawRectangle(1, Color_Bg_Black, _MAX(0, padding_x - gridline_width), _MAX(0, padding_y_top - gridline_width), padding_x + total_width_px, padding_y_top + total_width_px); if (selected >= 0) { const auto selected_y = selected / (GRID_MAX_POINTS_X); const auto selected_x = selected - (GRID_MAX_POINTS_X) * selected_y; const auto start_y_px = padding_y_top + selected_y * cell_height_px; const auto start_x_px = padding_x + selected_x * cell_width_px; - DWIN_Draw_Rectangle(1, Color_White, _MAX(0, start_x_px - gridline_width), _MAX(0, start_y_px - gridline_width), start_x_px + cell_width_px, start_y_px + cell_height_px); + dwinDrawRectangle(1, Color_White, _MAX(0, start_x_px - gridline_width), _MAX(0, start_y_px - gridline_width), start_x_px + cell_width_px, start_y_px + cell_height_px); } // Draw value square grid @@ -399,7 +383,7 @@ class TextScroller { const auto end_x_px = start_x_px + cell_width_px - 1 - gridline_width; const auto start_y_px = padding_y_top + (GRID_MAX_POINTS_Y - y - 1) * cell_height_px; const auto end_y_px = start_y_px + cell_height_px - 1 - gridline_width; - DWIN_Draw_Rectangle(1, // RGB565 colors: http://www.barth-dev.de/online/rgb565-color-picker/ + dwinDrawRectangle(1, // RGB565 colors: http://www.barth-dev.de/online/rgb565-color-picker/ isnan(bedlevel.z_values[x][y]) ? Color_Grey : ( // gray if undefined (bedlevel.z_values[x][y] < 0 ? (uint16_t)round(0x1F * -bedlevel.z_values[x][y] / (!viewer_asymmetric_range ? range : v_min)) << 11 : // red if mesh point value is negative @@ -415,7 +399,7 @@ class TextScroller { if (viewer_print_value) { int8_t offset_x, offset_y = cell_height_px / 2 - 6; if (isnan(bedlevel.z_values[x][y])) { // undefined - DWIN_Draw_String(false, font6x12, Color_White, Color_Bg_Blue, start_x_px + cell_width_px / 2 - 5, start_y_px + offset_y, F("X")); + dwinDrawString(false, font6x12, Color_White, Color_Bg_Blue, start_x_px + cell_width_px / 2 - 5, start_y_px + offset_y, F("X")); } else { // has value if (GRID_MAX_POINTS_X < 10) @@ -424,8 +408,8 @@ class TextScroller { sprintf_P(buf, PSTR("%02i"), (uint16_t)(abs(bedlevel.z_values[x][y] - (int16_t)bedlevel.z_values[x][y]) * 100)); offset_x = cell_width_px / 2 - 3 * (strlen(buf)) - 2; if (!(GRID_MAX_POINTS_X < 10)) - DWIN_Draw_String(false, font6x12, Color_White, Color_Bg_Blue, start_x_px - 2 + offset_x, start_y_px + offset_y /*+ square / 2 - 6*/, F(".")); - DWIN_Draw_String(false, font6x12, Color_White, Color_Bg_Blue, start_x_px + 1 + offset_x, start_y_px + offset_y /*+ square / 2 - 6*/, buf); + dwinDrawString(false, font6x12, Color_White, Color_Bg_Blue, start_x_px - 2 + offset_x, start_y_px + offset_y /*+ square / 2 - 6*/, F(".")); + dwinDrawString(false, font6x12, Color_White, Color_Bg_Blue, start_x_px + 1 + offset_x, start_y_px + offset_y /*+ square / 2 - 6*/, buf); } safe_delay(10); LCD_SERIAL.flushTX(); @@ -433,7 +417,7 @@ class TextScroller { } } - void Set_Mesh_Viewer_Status() { // TODO: draw gradient with values as a legend instead + void setMeshViewerStatus() { // TODO: draw gradient with values as a legend instead float v_max = abs(get_max_value()), v_min = abs(get_min_value()), range = _MAX(v_min, v_max); if (v_min > 3e+10F) v_min = 0.0000001; if (v_max > 3e+10F) v_max = 0.0000001; @@ -448,7 +432,7 @@ class TextScroller { dtostrf( range, 1, 3, str_2); } sprintf_P(msg, PSTR("Red %s..0..%s Green"), str_1, str_2); - CrealityDWIN.Update_Status(msg); + crealityDWIN.updateStatus(msg); drawing_mesh = false; } @@ -459,42 +443,42 @@ class TextScroller { /* General Display Functions */ -struct CrealityDWINClass::EEPROM_Settings CrealityDWINClass::eeprom_settings{0}; -constexpr const char * const CrealityDWINClass::color_names[11]; -constexpr const char * const CrealityDWINClass::preheat_modes[3]; +struct CrealityDWIN::EEPROM_Settings CrealityDWIN::eeprom_settings{0}; +constexpr const char * const CrealityDWIN::color_names[11]; +constexpr const char * const CrealityDWIN::preheat_modes[3]; // Clear a part of the screen // 4=Entire screen // 3=Title bar and Menu area (default) // 2=Menu area // 1=Title bar -void CrealityDWINClass::Clear_Screen(const uint8_t e/*=3*/) { - if (e == 1 || e == 3 || e == 4) DWIN_Draw_Rectangle(1, GetColor(eeprom_settings.menu_top_bg, Color_Bg_Blue, false), 0, 0, DWIN_WIDTH, TITLE_HEIGHT); // Clear Title Bar - if (e == 2 || e == 3) DWIN_Draw_Rectangle(1, Color_Bg_Black, 0, 31, DWIN_WIDTH, STATUS_Y); // Clear Menu Area - if (e == 4) DWIN_Draw_Rectangle(1, Color_Bg_Black, 0, 31, DWIN_WIDTH, DWIN_HEIGHT); // Clear Popup Area +void CrealityDWIN::clearScreen(const uint8_t e/*=3*/) { + if (e == 1 || e == 3 || e == 4) dwinDrawRectangle(1, getColor(eeprom_settings.menu_top_bg, Color_Bg_Blue, false), 0, 0, DWIN_WIDTH, TITLE_HEIGHT); // Clear Title Bar + if (e == 2 || e == 3) dwinDrawRectangle(1, Color_Bg_Black, 0, 31, DWIN_WIDTH, STATUS_Y); // Clear Menu Area + if (e == 4) dwinDrawRectangle(1, Color_Bg_Black, 0, 31, DWIN_WIDTH, DWIN_HEIGHT); // Clear Popup Area } -void CrealityDWINClass::Draw_Float(const_float_t value, const uint8_t row, const bool selected/*=false*/, const uint8_t minunit/*=10*/) { +void CrealityDWIN::drawFloat(const_float_t value, const uint8_t row, const bool selected/*=false*/, const uint8_t minunit/*=10*/) { const uint8_t digits = (uint8_t)floor(log10(abs(value))) + log10(minunit) + (minunit > 1); const uint16_t bColor = selected ? Select_Color : Color_Bg_Black; const uint16_t xpos = 240 - (digits * 8); - DWIN_Draw_Rectangle(1, Color_Bg_Black, 194, MBASE(row), 234 - (digits * 8), MBASE(row) + 16); + dwinDrawRectangle(1, Color_Bg_Black, 194, MBASE(row), 234 - (digits * 8), MBASE(row) + 16); if (isnan(value)) - DWIN_Draw_String(true, DWIN_FONT_MENU, Color_White, bColor, xpos - 8, MBASE(row), F(" NaN")); + dwinDrawString(true, DWIN_FONT_MENU, Color_White, bColor, xpos - 8, MBASE(row), F(" NaN")); else { - DWIN_Draw_FloatValue(true, true, 0, DWIN_FONT_MENU, Color_White, bColor, digits - log10(minunit) + 1, log10(minunit), xpos, MBASE(row), (value < 0 ? -value : value)); - DWIN_Draw_String(true, DWIN_FONT_MENU, Color_White, bColor, xpos - 8, MBASE(row), value < 0 ? F("-") : F(" ")); + dwinDrawFloatValue(true, true, 0, DWIN_FONT_MENU, Color_White, bColor, digits - log10(minunit) + 1, log10(minunit), xpos, MBASE(row), (value < 0 ? -value : value)); + dwinDrawString(true, DWIN_FONT_MENU, Color_White, bColor, xpos - 8, MBASE(row), value < 0 ? F("-") : F(" ")); } } -void CrealityDWINClass::Draw_Option(const uint8_t value, const char * const * options, const uint8_t row, const bool selected/*=false*/, const bool color/*=false*/) { +void CrealityDWIN::drawOption(const uint8_t value, const char * const * options, const uint8_t row, const bool selected/*=false*/, const bool color/*=false*/) { const uint16_t bColor = selected ? Select_Color : Color_Bg_Black, - tColor = color ? GetColor(value, Color_White, false) : Color_White; - DWIN_Draw_Rectangle(1, bColor, 202, MBASE(row) + 14, 258, MBASE(row) - 2); - DWIN_Draw_String(false, DWIN_FONT_MENU, tColor, bColor, 202, MBASE(row) - 1, options[value]); + tColor = color ? getColor(value, Color_White, false) : Color_White; + dwinDrawRectangle(1, bColor, 202, MBASE(row) + 14, 258, MBASE(row) - 2); + dwinDrawString(false, DWIN_FONT_MENU, tColor, bColor, 202, MBASE(row) - 1, options[value]); } -uint16_t CrealityDWINClass::GetColor(const uint8_t color, const uint16_t original, const bool light/*=false*/) { +uint16_t CrealityDWIN::getColor(const uint8_t color, const uint16_t original, const bool light/*=false*/) { switch (color) { case Default: return original; @@ -533,215 +517,215 @@ uint16_t CrealityDWINClass::GetColor(const uint8_t color, const uint16_t origina return Color_White; } -void CrealityDWINClass::Draw_Title(const char * const ctitle) { - DWIN_Draw_String(false, DWIN_FONT_HEAD, GetColor(eeprom_settings.menu_top_txt, Color_White, false), Color_Bg_Blue, (DWIN_WIDTH - strlen(ctitle) * STAT_CHR_W) / 2, 5, ctitle); +void CrealityDWIN::drawTitle(const char * const ctitle) { + dwinDrawString(false, DWIN_FONT_HEAD, getColor(eeprom_settings.menu_top_txt, Color_White, false), Color_Bg_Blue, (DWIN_WIDTH - strlen(ctitle) * STAT_CHR_W) / 2, 5, ctitle); } -void CrealityDWINClass::Draw_Title(FSTR_P const ftitle) { - DWIN_Draw_String(false, DWIN_FONT_HEAD, GetColor(eeprom_settings.menu_top_txt, Color_White, false), Color_Bg_Blue, (DWIN_WIDTH - strlen_P(FTOP(ftitle)) * STAT_CHR_W) / 2, 5, ftitle); +void CrealityDWIN::drawTitle(FSTR_P const ftitle) { + dwinDrawString(false, DWIN_FONT_HEAD, getColor(eeprom_settings.menu_top_txt, Color_White, false), Color_Bg_Blue, (DWIN_WIDTH - strlen_P(FTOP(ftitle)) * STAT_CHR_W) / 2, 5, ftitle); } -void _Decorate_Menu_Item(uint8_t row, uint8_t icon, bool more) { - if (icon) DWIN_ICON_Show(ICON, icon, 26, MBASE(row) - 3); //Draw Menu Icon - if (more) DWIN_ICON_Show(ICON, ICON_More, 226, MBASE(row) - 3); // Draw More Arrow - DWIN_Draw_Line(CrealityDWIN.GetColor(CrealityDWIN.eeprom_settings.menu_split_line, Line_Color, true), 16, MBASE(row) + 33, 256, MBASE(row) + 33); // Draw Menu Line +void _decorateMenuItem(uint8_t row, uint8_t icon, bool more) { + if (icon) dwinIconShow(ICON, icon, 26, MBASE(row) - 3); //Draw Menu Icon + if (more) dwinIconShow(ICON, ICON_More, 226, MBASE(row) - 3); // Draw More Arrow + dwinDrawLine(crealityDWIN.getColor(crealityDWIN.eeprom_settings.menu_split_line, Line_Color, true), 16, MBASE(row) + 33, 256, MBASE(row) + 33); // Draw Menu Line } -void CrealityDWINClass::Draw_Menu_Item(const uint8_t row, const uint8_t icon/*=0*/, const char * const label1, const char * const label2, const bool more/*=false*/, const bool centered/*=false*/) { +void CrealityDWIN::drawMenuItem(const uint8_t row, const uint8_t icon/*=0*/, const char * const label1, const char * const label2, const bool more/*=false*/, const bool centered/*=false*/) { const uint8_t label_offset_y = (label1 || label2) ? MENU_CHR_H * 3 / 5 : 0, label1_offset_x = !centered ? LBLX : LBLX * 4/5 + _MAX(LBLX * 1U/5, (DWIN_WIDTH - LBLX - (label1 ? strlen(label1) : 0) * MENU_CHR_W) / 2), label2_offset_x = !centered ? LBLX : LBLX * 4/5 + _MAX(LBLX * 1U/5, (DWIN_WIDTH - LBLX - (label2 ? strlen(label2) : 0) * MENU_CHR_W) / 2); - if (label1) DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, label1_offset_x, MBASE(row) - 1 - label_offset_y, label1); // Draw Label - if (label2) DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, label2_offset_x, MBASE(row) - 1 + label_offset_y, label2); // Draw Label - _Decorate_Menu_Item(row, icon, more); + if (label1) dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, label1_offset_x, MBASE(row) - 1 - label_offset_y, label1); // Draw Label + if (label2) dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, label2_offset_x, MBASE(row) - 1 + label_offset_y, label2); // Draw Label + _decorateMenuItem(row, icon, more); } -void CrealityDWINClass::Draw_Menu_Item(const uint8_t row, const uint8_t icon/*=0*/, FSTR_P const flabel1, FSTR_P const flabel2, const bool more/*=false*/, const bool centered/*=false*/) { +void CrealityDWIN::drawMenuItem(const uint8_t row, const uint8_t icon/*=0*/, FSTR_P const flabel1, FSTR_P const flabel2, const bool more/*=false*/, const bool centered/*=false*/) { const uint8_t label_offset_y = (flabel1 || flabel2) ? MENU_CHR_H * 3 / 5 : 0, label1_offset_x = !centered ? LBLX : LBLX * 4/5 + _MAX(LBLX * 1U/5, (DWIN_WIDTH - LBLX - (flabel1 ? strlen_P(FTOP(flabel1)) : 0) * MENU_CHR_W) / 2), label2_offset_x = !centered ? LBLX : LBLX * 4/5 + _MAX(LBLX * 1U/5, (DWIN_WIDTH - LBLX - (flabel2 ? strlen_P(FTOP(flabel2)) : 0) * MENU_CHR_W) / 2); - if (flabel1) DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, label1_offset_x, MBASE(row) - 1 - label_offset_y, flabel1); // Draw Label - if (flabel2) DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, label2_offset_x, MBASE(row) - 1 + label_offset_y, flabel2); // Draw Label - _Decorate_Menu_Item(row, icon, more); + if (flabel1) dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, label1_offset_x, MBASE(row) - 1 - label_offset_y, flabel1); // Draw Label + if (flabel2) dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, label2_offset_x, MBASE(row) - 1 + label_offset_y, flabel2); // Draw Label + _decorateMenuItem(row, icon, more); } -void CrealityDWINClass::Draw_Checkbox(const uint8_t row, const bool value) { +void CrealityDWIN::drawCheckbox(const uint8_t row, const bool value) { #if ENABLED(DWIN_CREALITY_LCD_CUSTOM_ICONS) // Draw appropriate checkbox icon - DWIN_ICON_Show(ICON, (value ? ICON_Checkbox_T : ICON_Checkbox_F), 226, MBASE(row) - 3); + dwinIconShow(ICON, (value ? ICON_Checkbox_T : ICON_Checkbox_F), 226, MBASE(row) - 3); #else // Draw a basic checkbox using rectangles and lines - DWIN_Draw_Rectangle(1, Color_Bg_Black, 226, MBASE(row) - 3, 226 + 20, MBASE(row) - 3 + 20); - DWIN_Draw_Rectangle(0, Color_White, 226, MBASE(row) - 3, 226 + 20, MBASE(row) - 3 + 20); + dwinDrawRectangle(1, Color_Bg_Black, 226, MBASE(row) - 3, 226 + 20, MBASE(row) - 3 + 20); + dwinDrawRectangle(0, Color_White, 226, MBASE(row) - 3, 226 + 20, MBASE(row) - 3 + 20); if (value) { - DWIN_Draw_Line(Check_Color, 227, MBASE(row) - 3 + 11, 226 + 8, MBASE(row) - 3 + 17); - DWIN_Draw_Line(Check_Color, 227 + 8, MBASE(row) - 3 + 17, 226 + 19, MBASE(row) - 3 + 1); - DWIN_Draw_Line(Check_Color, 227, MBASE(row) - 3 + 12, 226 + 8, MBASE(row) - 3 + 18); - DWIN_Draw_Line(Check_Color, 227 + 8, MBASE(row) - 3 + 18, 226 + 19, MBASE(row) - 3 + 2); - DWIN_Draw_Line(Check_Color, 227, MBASE(row) - 3 + 13, 226 + 8, MBASE(row) - 3 + 19); - DWIN_Draw_Line(Check_Color, 227 + 8, MBASE(row) - 3 + 19, 226 + 19, MBASE(row) - 3 + 3); + dwinDrawLine(Check_Color, 227, MBASE(row) - 3 + 11, 226 + 8, MBASE(row) - 3 + 17); + dwinDrawLine(Check_Color, 227 + 8, MBASE(row) - 3 + 17, 226 + 19, MBASE(row) - 3 + 1); + dwinDrawLine(Check_Color, 227, MBASE(row) - 3 + 12, 226 + 8, MBASE(row) - 3 + 18); + dwinDrawLine(Check_Color, 227 + 8, MBASE(row) - 3 + 18, 226 + 19, MBASE(row) - 3 + 2); + dwinDrawLine(Check_Color, 227, MBASE(row) - 3 + 13, 226 + 8, MBASE(row) - 3 + 19); + dwinDrawLine(Check_Color, 227 + 8, MBASE(row) - 3 + 19, 226 + 19, MBASE(row) - 3 + 3); } #endif } -void CrealityDWINClass::Draw_Menu(const uint8_t menu, const uint8_t select/*=0*/, const uint8_t scroll/*=0*/) { +void CrealityDWIN::drawMenu(const uint8_t menu, const uint8_t select/*=0*/, const uint8_t scroll/*=0*/) { if (active_menu != menu) { last_menu = active_menu; if (process == Menu) last_selection = selection; } - selection = _MIN(select, Get_Menu_Size(menu)); + selection = _MIN(select, getMenuSize(menu)); scrollpos = scroll; if (selection - scrollpos > MROWS) scrollpos = selection - MROWS; process = Menu; active_menu = menu; - Clear_Screen(); - Draw_Title(Get_Menu_Title(menu)); - for (uint8_t i = 0; i < TROWS; ++i) Menu_Item_Handler(menu, i + scrollpos); - DWIN_Draw_Rectangle(1, GetColor(eeprom_settings.cursor_color, Rectangle_Color), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); + clearScreen(); + drawTitle(getMenuTitle(menu)); + for (uint8_t i = 0; i < TROWS; ++i) menuItemHandler(menu, i + scrollpos); + dwinDrawRectangle(1, getColor(eeprom_settings.cursor_color, Rectangle_Color), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); } -void CrealityDWINClass::Redraw_Menu(const bool lastproc/*=true*/, const bool lastsel/*=false*/, const bool lastmenu/*=false*/) { +void CrealityDWIN::redrawMenu(const bool lastproc/*=true*/, const bool lastsel/*=false*/, const bool lastmenu/*=false*/) { switch (lastproc ? last_process : process) { case Menu: - Draw_Menu(lastmenu ? last_menu : active_menu, lastsel ? last_selection : selection, lastmenu ? 0 : scrollpos); + drawMenu(lastmenu ? last_menu : active_menu, lastsel ? last_selection : selection, lastmenu ? 0 : scrollpos); break; - case Main: Draw_Main_Menu(lastsel ? last_selection : selection); break; - case Print: Draw_Print_Screen(); break; - case File: Draw_SD_List(); break; + case Main: drawMainMenu(lastsel ? last_selection : selection); break; + case Print: drawPrintScreen(); break; + case File: drawSDList(); break; default: break; } } -void CrealityDWINClass::Redraw_Screen() { - Redraw_Menu(false); - Draw_Status_Area(true); - Update_Status_Bar(true); +void CrealityDWIN::redrawScreen() { + redrawMenu(false); + drawStatusArea(true); + updateStatusBar(true); } /* Primary Menus and Screen Elements */ -void CrealityDWINClass::Main_Menu_Icons() { +void CrealityDWIN::mainMenuIcons() { if (selection == 0) { - DWIN_ICON_Show(ICON, ICON_Print_1, 17, 130); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Color_White), 17, 130, 126, 229); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 52, 200, F("Print")); + dwinIconShow(ICON, ICON_Print_1, 17, 130); + dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, Color_White), 17, 130, 126, 229); + dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 52, 200, F("Print")); } else { - DWIN_ICON_Show(ICON, ICON_Print_0, 17, 130); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 52, 200, F("Print")); + dwinIconShow(ICON, ICON_Print_0, 17, 130); + dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 52, 200, F("Print")); } if (selection == 1) { - DWIN_ICON_Show(ICON, ICON_Prepare_1, 145, 130); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Color_White), 145, 130, 254, 229); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 170, 200, F("Prepare")); + dwinIconShow(ICON, ICON_Prepare_1, 145, 130); + dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, Color_White), 145, 130, 254, 229); + dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 170, 200, F("Prepare")); } else { - DWIN_ICON_Show(ICON, ICON_Prepare_0, 145, 130); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 170, 200, F("Prepare")); + dwinIconShow(ICON, ICON_Prepare_0, 145, 130); + dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 170, 200, F("Prepare")); } if (selection == 2) { - DWIN_ICON_Show(ICON, ICON_Control_1, 17, 246); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Color_White), 17, 246, 126, 345); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 43, 317, F("Control")); + dwinIconShow(ICON, ICON_Control_1, 17, 246); + dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, Color_White), 17, 246, 126, 345); + dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 43, 317, F("Control")); } else { - DWIN_ICON_Show(ICON, ICON_Control_0, 17, 246); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 43, 317, F("Control")); + dwinIconShow(ICON, ICON_Control_0, 17, 246); + dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 43, 317, F("Control")); } #if HAS_ABL_OR_UBL if (selection == 3) { - DWIN_ICON_Show(ICON, ICON_Leveling_1, 145, 246); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Color_White), 145, 246, 254, 345); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 179, 317, F("Level")); + dwinIconShow(ICON, ICON_Leveling_1, 145, 246); + dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, Color_White), 145, 246, 254, 345); + dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 179, 317, F("Level")); } else { - DWIN_ICON_Show(ICON, ICON_Leveling_0, 145, 246); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 179, 317, F("Level")); + dwinIconShow(ICON, ICON_Leveling_0, 145, 246); + dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 179, 317, F("Level")); } #else if (selection == 3) { - DWIN_ICON_Show(ICON, ICON_Info_1, 145, 246); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Color_White), 145, 246, 254, 345); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 181, 317, F("Info")); + dwinIconShow(ICON, ICON_Info_1, 145, 246); + dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, Color_White), 145, 246, 254, 345); + dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 181, 317, F("Info")); } else { - DWIN_ICON_Show(ICON, ICON_Info_0, 145, 246); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 181, 317, F("Info")); + dwinIconShow(ICON, ICON_Info_0, 145, 246); + dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 181, 317, F("Info")); } #endif } -void CrealityDWINClass::Draw_Main_Menu(const uint8_t select/*=0*/) { +void CrealityDWIN::drawMainMenu(const uint8_t select/*=0*/) { process = Main; active_menu = MainMenu; selection = select; - Clear_Screen(); - Draw_Title(Get_Menu_Title(MainMenu)); + clearScreen(); + drawTitle(getMenuTitle(MainMenu)); SERIAL_ECHOPGM("\nDWIN handshake "); - DWIN_ICON_Show(ICON, ICON_LOGO, 71, 72); - Main_Menu_Icons(); + dwinIconShow(ICON, ICON_LOGO, 71, 72); + mainMenuIcons(); } -void CrealityDWINClass::Print_Screen_Icons() { +void CrealityDWIN::printScreenIcons() { if (selection == 0) { - DWIN_ICON_Show(ICON, ICON_Setup_1, 8, 252); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Color_White), 8, 252, 87, 351); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 30, 322, F("Tune")); + dwinIconShow(ICON, ICON_Setup_1, 8, 252); + dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, Color_White), 8, 252, 87, 351); + dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 30, 322, F("Tune")); } else { - DWIN_ICON_Show(ICON, ICON_Setup_0, 8, 252); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 30, 322, F("Tune")); + dwinIconShow(ICON, ICON_Setup_0, 8, 252); + dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 30, 322, F("Tune")); } if (selection == 2) { - DWIN_ICON_Show(ICON, ICON_Stop_1, 184, 252); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Color_White), 184, 252, 263, 351); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 205, 322, F("Stop")); + dwinIconShow(ICON, ICON_Stop_1, 184, 252); + dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, Color_White), 184, 252, 263, 351); + dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 205, 322, F("Stop")); } else { - DWIN_ICON_Show(ICON, ICON_Stop_0, 184, 252); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 205, 322, F("Stop")); + dwinIconShow(ICON, ICON_Stop_0, 184, 252); + dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 205, 322, F("Stop")); } if (paused) { if (selection == 1) { - DWIN_ICON_Show(ICON, ICON_Continue_1, 96, 252); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Color_White), 96, 252, 175, 351); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 114, 322, F("Print")); + dwinIconShow(ICON, ICON_Continue_1, 96, 252); + dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, Color_White), 96, 252, 175, 351); + dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 114, 322, F("Print")); } else { - DWIN_ICON_Show(ICON, ICON_Continue_0, 96, 252); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 114, 322, F("Print")); + dwinIconShow(ICON, ICON_Continue_0, 96, 252); + dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 114, 322, F("Print")); } } else { if (selection == 1) { - DWIN_ICON_Show(ICON, ICON_Pause_1, 96, 252); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Color_White), 96, 252, 175, 351); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 114, 322, F("Pause")); + dwinIconShow(ICON, ICON_Pause_1, 96, 252); + dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, Color_White), 96, 252, 175, 351); + dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 114, 322, F("Pause")); } else { - DWIN_ICON_Show(ICON, ICON_Pause_0, 96, 252); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 114, 322, F("Pause")); + dwinIconShow(ICON, ICON_Pause_0, 96, 252); + dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Blue, 114, 322, F("Pause")); } } } -void CrealityDWINClass::Draw_Print_Screen() { +void CrealityDWIN::drawPrintScreen() { process = Print; selection = 0; - Clear_Screen(); - DWIN_Draw_Rectangle(1, Color_Bg_Black, 8, 352, DWIN_WIDTH - 8, 376); - Draw_Title("Printing..."); - Print_Screen_Icons(); - DWIN_ICON_Show(ICON, ICON_PrintTime, 14, 171); - DWIN_ICON_Show(ICON, ICON_RemainTime, 147, 169); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, 41, 163, F("Elapsed")); - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, 176, 163, F("Remaining")); - Update_Status_Bar(true); - Draw_Print_ProgressBar(); - Draw_Print_ProgressElapsed(); - TERN_(SET_REMAINING_TIME, Draw_Print_ProgressRemain()); - Draw_Print_Filename(true); + clearScreen(); + dwinDrawRectangle(1, Color_Bg_Black, 8, 352, DWIN_WIDTH - 8, 376); + drawTitle("Printing..."); + printScreenIcons(); + dwinIconShow(ICON, ICON_PrintTime, 14, 171); + dwinIconShow(ICON, ICON_RemainTime, 147, 169); + dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, 41, 163, F("Elapsed")); + dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, 176, 163, F("Remaining")); + updateStatusBar(true); + drawPrintProgressBar(); + drawPrintProgressElapsed(); + TERN_(SET_REMAINING_TIME, drawPrintProgressRemain()); + drawPrintFilename(true); } -void CrealityDWINClass::Draw_Print_Filename(const bool reset/*=false*/) { +void CrealityDWIN::drawPrintFilename(const bool reset/*=false*/) { typedef TextScroller<30> Scroller; static Scroller scroller; if (reset) scroller.reset(); @@ -749,61 +733,61 @@ void CrealityDWINClass::Draw_Print_Filename(const bool reset/*=false*/) { Scroller::Buffer buf; size_t outlen = 0; const char* outstr = scroller.scroll(outlen, buf, filename); - DWIN_Draw_Rectangle(1, Color_Bg_Black, 8, 50, DWIN_WIDTH - 8, 80); + dwinDrawRectangle(1, Color_Bg_Black, 8, 50, DWIN_WIDTH - 8, 80); const int8_t npos = (DWIN_WIDTH - outlen * MENU_CHR_W) / 2; - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, npos, 60, outstr); + dwinDrawString(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, npos, 60, outstr); } } -void CrealityDWINClass::Draw_Print_ProgressBar() { +void CrealityDWIN::drawPrintProgressBar() { uint8_t printpercent = sdprint ? card.percentDone() : (ui._get_progress() / 100); - DWIN_ICON_Show(ICON, ICON_Bar, 15, 93); - DWIN_Draw_Rectangle(1, BarFill_Color, 16 + printpercent * 240 / 100, 93, 256, 113); - DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_percent, Percent_Color), Color_Bg_Black, 3, 109, 133, printpercent); - DWIN_Draw_String(false, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_percent, Percent_Color), Color_Bg_Black, 133, 133, F("%")); + dwinIconShow(ICON, ICON_Bar, 15, 93); + dwinDrawRectangle(1, BarFill_Color, 16 + printpercent * 240 / 100, 93, 256, 113); + dwinDrawIntValue(true, true, 0, DWIN_FONT_MENU, getColor(eeprom_settings.progress_percent, Percent_Color), Color_Bg_Black, 3, 109, 133, printpercent); + dwinDrawString(false, DWIN_FONT_MENU, getColor(eeprom_settings.progress_percent, Percent_Color), Color_Bg_Black, 133, 133, F("%")); } #if ENABLED(SET_REMAINING_TIME) - void CrealityDWINClass::Draw_Print_ProgressRemain() { + void CrealityDWIN::drawPrintProgressRemain() { uint16_t remainingtime = ui.get_remaining_time(); - DWIN_Draw_IntValue(true, true, 1, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 2, 176, 187, remainingtime / 3600); - DWIN_Draw_IntValue(true, true, 1, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 2, 200, 187, (remainingtime % 3600) / 60); + dwinDrawIntValue(true, true, 1, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 2, 176, 187, remainingtime / 3600); + dwinDrawIntValue(true, true, 1, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 2, 200, 187, (remainingtime % 3600) / 60); if (eeprom_settings.time_format_textual) { - DWIN_Draw_String(false, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 192, 187, F("h")); - DWIN_Draw_String(false, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 216, 187, F("m")); + dwinDrawString(false, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 192, 187, F("h")); + dwinDrawString(false, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 216, 187, F("m")); } else - DWIN_Draw_String(false, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 192, 187, F(":")); + dwinDrawString(false, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 192, 187, F(":")); } #endif -void CrealityDWINClass::Draw_Print_ProgressElapsed() { +void CrealityDWIN::drawPrintProgressElapsed() { duration_t elapsed = print_job_timer.duration(); - DWIN_Draw_IntValue(true, true, 1, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 2, 42, 187, elapsed.value / 3600); - DWIN_Draw_IntValue(true, true, 1, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 2, 66, 187, (elapsed.value % 3600) / 60); + dwinDrawIntValue(true, true, 1, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 2, 42, 187, elapsed.value / 3600); + dwinDrawIntValue(true, true, 1, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 2, 66, 187, (elapsed.value % 3600) / 60); if (eeprom_settings.time_format_textual) { - DWIN_Draw_String(false, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 58, 187, F("h")); - DWIN_Draw_String(false, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 82, 187, F("m")); + dwinDrawString(false, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 58, 187, F("h")); + dwinDrawString(false, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 82, 187, F("m")); } else - DWIN_Draw_String(false, DWIN_FONT_MENU, GetColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 58, 187, F(":")); + dwinDrawString(false, DWIN_FONT_MENU, getColor(eeprom_settings.progress_time, Color_White), Color_Bg_Black, 58, 187, F(":")); } -void CrealityDWINClass::Draw_Print_confirm() { - Draw_Print_Screen(); +void CrealityDWIN::drawPrintConfirm() { + drawPrintScreen(); process = Confirm; popup = Complete; - DWIN_Draw_Rectangle(1, Color_Bg_Black, 8, 252, 263, 351); - DWIN_ICON_Show(ICON, ICON_Confirm_E, 87, 283); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Color_White), 86, 282, 187, 321); - DWIN_Draw_Rectangle(0, GetColor(eeprom_settings.highlight_box, Color_White), 85, 281, 188, 322); + dwinDrawRectangle(1, Color_Bg_Black, 8, 252, 263, 351); + dwinIconShow(ICON, ICON_Confirm_E, 87, 283); + dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, Color_White), 86, 282, 187, 321); + dwinDrawRectangle(0, getColor(eeprom_settings.highlight_box, Color_White), 85, 281, 188, 322); } -void CrealityDWINClass::Draw_SD_Item(const uint8_t item, const uint8_t row) { +void CrealityDWIN::drawSDItem(const uint8_t item, const uint8_t row) { if (item == 0) - Draw_Menu_Item(0, ICON_Back, card.flag.workDirIsRoot ? F("Back") : F("..")); + drawMenuItem(0, ICON_Back, card.flag.workDirIsRoot ? F("Back") : F("..")); else { card.selectFileByIndexSorted(item - 1); char * const filename = card.longest_filename(); @@ -818,31 +802,31 @@ void CrealityDWINClass::Draw_SD_Item(const uint8_t item, const uint8_t row) { if (pos > max) for (uint8_t i = len - 3; i < len; ++i) name[i] = '.'; name[len] = '\0'; - Draw_Menu_Item(row, card.flag.filenameIsDir ? ICON_More : ICON_File, name); + drawMenuItem(row, card.flag.filenameIsDir ? ICON_More : ICON_File, name); } } -void CrealityDWINClass::Draw_SD_List(const bool removed/*=false*/) { - Clear_Screen(); - Draw_Title("Select File"); +void CrealityDWIN::drawSDList(const bool removed/*=false*/) { + clearScreen(); + drawTitle("Select File"); selection = 0; scrollpos = 0; process = File; if (card.isMounted() && !removed) { for (uint8_t i = 0; i < _MIN(card.get_num_items() + 1, TROWS); ++i) - Draw_SD_Item(i, i); + drawSDItem(i, i); } else { - Draw_Menu_Item(0, ICON_Back, F("Back")); - DWIN_Draw_Rectangle(1, Color_Bg_Red, 10, MBASE(3) - 10, DWIN_WIDTH - 10, MBASE(4)); - DWIN_Draw_String(false, font16x32, Color_Yellow, Color_Bg_Red, ((DWIN_WIDTH) - 8 * 16) / 2, MBASE(3), F("No Media")); + drawMenuItem(0, ICON_Back, F("Back")); + dwinDrawRectangle(1, Color_Bg_Red, 10, MBASE(3) - 10, DWIN_WIDTH - 10, MBASE(4)); + dwinDrawString(false, font16x32, Color_Yellow, Color_Bg_Red, ((DWIN_WIDTH) - 8 * 16) / 2, MBASE(3), F("No Media")); } - DWIN_Draw_Rectangle(1, GetColor(eeprom_settings.cursor_color, Rectangle_Color), 0, MBASE(0) - 18, 14, MBASE(0) + 33); + dwinDrawRectangle(1, getColor(eeprom_settings.cursor_color, Rectangle_Color), 0, MBASE(0) - 18, 14, MBASE(0) + 33); } -void CrealityDWINClass::Draw_Status_Area(const bool icons/*=false*/) { +void CrealityDWIN::drawStatusArea(const bool icons/*=false*/) { - if (icons) DWIN_Draw_Rectangle(1, Color_Bg_Black, 0, STATUS_Y, DWIN_WIDTH, DWIN_HEIGHT - 1); + if (icons) dwinDrawRectangle(1, Color_Bg_Black, 0, STATUS_Y, DWIN_WIDTH, DWIN_HEIGHT - 1); #if HAS_HOTEND static float hotend = -1; @@ -850,27 +834,27 @@ void CrealityDWINClass::Draw_Status_Area(const bool icons/*=false*/) { if (icons) { hotend = -1; hotendtarget = -1; - DWIN_ICON_Show(ICON, ICON_HotendTemp, 10, 383); - DWIN_Draw_String(false, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 384, F("/")); + dwinIconShow(ICON, ICON_HotendTemp, 10, 383); + dwinDrawString(false, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 384, F("/")); } if (thermalManager.temp_hotend[0].celsius != hotend) { hotend = thermalManager.temp_hotend[0].celsius; - DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 3, 28, 384, thermalManager.temp_hotend[0].celsius); - DWIN_Draw_DegreeSymbol(GetColor(eeprom_settings.status_area_text, Color_White), 25 + 3 * STAT_CHR_W + 5, 386); + dwinDrawIntValue(true, true, 0, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 3, 28, 384, thermalManager.temp_hotend[0].celsius); + dwinDrawDegreeSymbol(getColor(eeprom_settings.status_area_text, Color_White), 25 + 3 * STAT_CHR_W + 5, 386); } if (thermalManager.temp_hotend[0].target != hotendtarget) { hotendtarget = thermalManager.temp_hotend[0].target; - DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 3, 25 + 4 * STAT_CHR_W + 6, 384, thermalManager.temp_hotend[0].target); - DWIN_Draw_DegreeSymbol(GetColor(eeprom_settings.status_area_text, Color_White), 25 + 4 * STAT_CHR_W + 39, 386); + dwinDrawIntValue(true, true, 0, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 3, 25 + 4 * STAT_CHR_W + 6, 384, thermalManager.temp_hotend[0].target); + dwinDrawDegreeSymbol(getColor(eeprom_settings.status_area_text, Color_White), 25 + 4 * STAT_CHR_W + 39, 386); } if (icons) { flow = -1; - DWIN_ICON_Show(ICON, ICON_StepE, 112, 417); - DWIN_Draw_String(false, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 116 + 5 * STAT_CHR_W + 2, 417, F("%")); + dwinIconShow(ICON, ICON_StepE, 112, 417); + dwinDrawString(false, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 116 + 5 * STAT_CHR_W + 2, 417, F("%")); } if (planner.flow_percentage[0] != flow) { flow = planner.flow_percentage[0]; - DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 3, 116 + 2 * STAT_CHR_W, 417, planner.flow_percentage[0]); + dwinDrawIntValue(true, true, 0, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 3, 116 + 2 * STAT_CHR_W, 417, planner.flow_percentage[0]); } #endif @@ -880,18 +864,18 @@ void CrealityDWINClass::Draw_Status_Area(const bool icons/*=false*/) { if (icons) { bed = -1; bedtarget = -1; - DWIN_ICON_Show(ICON, ICON_BedTemp, 10, 416); - DWIN_Draw_String(false, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 417, F("/")); + dwinIconShow(ICON, ICON_BedTemp, 10, 416); + dwinDrawString(false, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 417, F("/")); } if (thermalManager.temp_bed.celsius != bed) { bed = thermalManager.temp_bed.celsius; - DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 3, 28, 417, thermalManager.temp_bed.celsius); - DWIN_Draw_DegreeSymbol(GetColor(eeprom_settings.status_area_text, Color_White), 25 + 3 * STAT_CHR_W + 5, 419); + dwinDrawIntValue(true, true, 0, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 3, 28, 417, thermalManager.temp_bed.celsius); + dwinDrawDegreeSymbol(getColor(eeprom_settings.status_area_text, Color_White), 25 + 3 * STAT_CHR_W + 5, 419); } if (thermalManager.temp_bed.target != bedtarget) { bedtarget = thermalManager.temp_bed.target; - DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 3, 25 + 4 * STAT_CHR_W + 6, 417, thermalManager.temp_bed.target); - DWIN_Draw_DegreeSymbol(GetColor(eeprom_settings.status_area_text, Color_White), 25 + 4 * STAT_CHR_W + 39, 419); + dwinDrawIntValue(true, true, 0, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 3, 25 + 4 * STAT_CHR_W + 6, 417, thermalManager.temp_bed.target); + dwinDrawDegreeSymbol(getColor(eeprom_settings.status_area_text, Color_White), 25 + 4 * STAT_CHR_W + 39, 419); } #endif @@ -899,11 +883,11 @@ void CrealityDWINClass::Draw_Status_Area(const bool icons/*=false*/) { static uint8_t fan = -1; if (icons) { fan = -1; - DWIN_ICON_Show(ICON, ICON_FanSpeed, 187, 383); + dwinIconShow(ICON, ICON_FanSpeed, 187, 383); } if (thermalManager.fan_speed[0] != fan) { fan = thermalManager.fan_speed[0]; - DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 3, 195 + 2 * STAT_CHR_W, 384, thermalManager.fan_speed[0]); + dwinDrawIntValue(true, true, 0, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 3, 195 + 2 * STAT_CHR_W, 384, thermalManager.fan_speed[0]); } #endif @@ -912,24 +896,24 @@ void CrealityDWINClass::Draw_Status_Area(const bool icons/*=false*/) { if (icons) { offset = -1; - DWIN_ICON_Show(ICON, ICON_Zoffset, 187, 416); + dwinIconShow(ICON, ICON_Zoffset, 187, 416); } if (zoffsetvalue != offset) { offset = zoffsetvalue; - DWIN_Draw_FloatValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 2, 2, 207, 417, (zoffsetvalue < 0 ? -zoffsetvalue : zoffsetvalue)); - DWIN_Draw_String(true, DWIN_FONT_MENU, GetColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 205, 419, zoffsetvalue < 0 ? F("-") : F(" ")); + dwinDrawFloatValue(true, true, 0, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 2, 2, 207, 417, (zoffsetvalue < 0 ? -zoffsetvalue : zoffsetvalue)); + dwinDrawString(true, DWIN_FONT_MENU, getColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 205, 419, zoffsetvalue < 0 ? F("-") : F(" ")); } #endif static int16_t feedrate = -1; if (icons) { feedrate = -1; - DWIN_ICON_Show(ICON, ICON_Speed, 113, 383); - DWIN_Draw_String(false, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 116 + 5 * STAT_CHR_W + 2, 384, F("%")); + dwinIconShow(ICON, ICON_Speed, 113, 383); + dwinDrawString(false, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 116 + 5 * STAT_CHR_W + 2, 384, F("%")); } if (feedrate_percentage != feedrate) { feedrate = feedrate_percentage; - DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 3, 116 + 2 * STAT_CHR_W, 384, feedrate_percentage); + dwinDrawIntValue(true, true, 0, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 3, 116 + 2 * STAT_CHR_W, 384, feedrate_percentage); } static float x = -1, y = -1, z = -1; @@ -939,75 +923,75 @@ void CrealityDWINClass::Draw_Status_Area(const bool icons/*=false*/) { update_z = (current_position.z != z || axis_should_home(Z_AXIS) || update_z); if (icons) { x = y = z = -1; - DWIN_Draw_Line(GetColor(eeprom_settings.coordinates_split_line, Line_Color, true), 16, 450, 256, 450); - DWIN_ICON_Show(ICON, ICON_MaxSpeedX, 10, 456); - DWIN_ICON_Show(ICON, ICON_MaxSpeedY, 95, 456); - DWIN_ICON_Show(ICON, ICON_MaxSpeedZ, 180, 456); + dwinDrawLine(getColor(eeprom_settings.coordinates_split_line, Line_Color, true), 16, 450, 256, 450); + dwinIconShow(ICON, ICON_MaxSpeedX, 10, 456); + dwinIconShow(ICON, ICON_MaxSpeedY, 95, 456); + dwinIconShow(ICON, ICON_MaxSpeedZ, 180, 456); } if (update_x) { x = current_position.x; if ((update_x = axis_should_home(X_AXIS) && ui.get_blink())) - DWIN_Draw_String(true, DWIN_FONT_MENU, GetColor(eeprom_settings.coordinates_text, Color_White), Color_Bg_Black, 35, 459, F(" -?- ")); + dwinDrawString(true, DWIN_FONT_MENU, getColor(eeprom_settings.coordinates_text, Color_White), Color_Bg_Black, 35, 459, F(" -?- ")); else - DWIN_Draw_FloatValue(true, true, 0, DWIN_FONT_MENU, GetColor(eeprom_settings.coordinates_text, Color_White), Color_Bg_Black, 3, 1, 35, 459, current_position.x); + dwinDrawFloatValue(true, true, 0, DWIN_FONT_MENU, getColor(eeprom_settings.coordinates_text, Color_White), Color_Bg_Black, 3, 1, 35, 459, current_position.x); } if (update_y) { y = current_position.y; if ((update_y = axis_should_home(Y_AXIS) && ui.get_blink())) - DWIN_Draw_String(true, DWIN_FONT_MENU, GetColor(eeprom_settings.coordinates_text, Color_White), Color_Bg_Black, 120, 459, F(" -?- ")); + dwinDrawString(true, DWIN_FONT_MENU, getColor(eeprom_settings.coordinates_text, Color_White), Color_Bg_Black, 120, 459, F(" -?- ")); else - DWIN_Draw_FloatValue(true, true, 0, DWIN_FONT_MENU, GetColor(eeprom_settings.coordinates_text, Color_White), Color_Bg_Black, 3, 1, 120, 459, current_position.y); + dwinDrawFloatValue(true, true, 0, DWIN_FONT_MENU, getColor(eeprom_settings.coordinates_text, Color_White), Color_Bg_Black, 3, 1, 120, 459, current_position.y); } if (update_z) { z = current_position.z; if ((update_z = axis_should_home(Z_AXIS) && ui.get_blink())) - DWIN_Draw_String(true, DWIN_FONT_MENU, GetColor(eeprom_settings.coordinates_text, Color_White), Color_Bg_Black, 205, 459, F(" -?- ")); + dwinDrawString(true, DWIN_FONT_MENU, getColor(eeprom_settings.coordinates_text, Color_White), Color_Bg_Black, 205, 459, F(" -?- ")); else - DWIN_Draw_FloatValue(true, true, 0, DWIN_FONT_MENU, GetColor(eeprom_settings.coordinates_text, Color_White), Color_Bg_Black, 3, 2, 205, 459, current_position.z >= 0 ? current_position.z : 0); + dwinDrawFloatValue(true, true, 0, DWIN_FONT_MENU, getColor(eeprom_settings.coordinates_text, Color_White), Color_Bg_Black, 3, 2, 205, 459, current_position.z >= 0 ? current_position.z : 0); } - DWIN_UpdateLCD(); + dwinUpdateLCD(); } -void CrealityDWINClass::Draw_Popup(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, uint8_t mode, uint8_t icon/*=0*/) { +void CrealityDWIN::drawPopup(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, uint8_t mode, uint8_t icon/*=0*/) { if (process != Confirm && process != Popup && process != Wait) last_process = process; if ((process == Menu || process == Wait) && mode == Popup) last_selection = selection; process = mode; - Clear_Screen(); - DWIN_Draw_Rectangle(0, Color_White, 13, 59, 259, 351); - DWIN_Draw_Rectangle(1, Color_Bg_Window, 14, 60, 258, 350); + clearScreen(); + dwinDrawRectangle(0, Color_White, 13, 59, 259, 351); + dwinDrawRectangle(1, Color_Bg_Window, 14, 60, 258, 350); const uint8_t ypos = (mode == Popup || mode == Confirm) ? 150 : 230; - if (icon > 0) DWIN_ICON_Show(ICON, icon, 101, 105); - DWIN_Draw_String(true, DWIN_FONT_MENU, Popup_Text_Color, Color_Bg_Window, (272 - 8 * strlen_P(FTOP(line1))) / 2, ypos, line1); - DWIN_Draw_String(true, DWIN_FONT_MENU, Popup_Text_Color, Color_Bg_Window, (272 - 8 * strlen_P(FTOP(line2))) / 2, ypos + 30, line2); - DWIN_Draw_String(true, DWIN_FONT_MENU, Popup_Text_Color, Color_Bg_Window, (272 - 8 * strlen_P(FTOP(line3))) / 2, ypos + 60, line3); + if (icon > 0) dwinIconShow(ICON, icon, 101, 105); + dwinDrawString(true, DWIN_FONT_MENU, Popup_Text_Color, Color_Bg_Window, (272 - 8 * strlen_P(FTOP(line1))) / 2, ypos, line1); + dwinDrawString(true, DWIN_FONT_MENU, Popup_Text_Color, Color_Bg_Window, (272 - 8 * strlen_P(FTOP(line2))) / 2, ypos + 30, line2); + dwinDrawString(true, DWIN_FONT_MENU, Popup_Text_Color, Color_Bg_Window, (272 - 8 * strlen_P(FTOP(line3))) / 2, ypos + 60, line3); if (mode == Popup) { selection = 0; - DWIN_Draw_Rectangle(1, Confirm_Color, 26, 280, 125, 317); - DWIN_Draw_Rectangle(1, Cancel_Color, 146, 280, 245, 317); - DWIN_Draw_String(false, DWIN_FONT_STAT, Color_White, Color_Bg_Window, 39, 290, F("Confirm")); - DWIN_Draw_String(false, DWIN_FONT_STAT, Color_White, Color_Bg_Window, 165, 290, F("Cancel")); - Popup_Select(); + dwinDrawRectangle(1, Confirm_Color, 26, 280, 125, 317); + dwinDrawRectangle(1, Cancel_Color, 146, 280, 245, 317); + dwinDrawString(false, DWIN_FONT_STAT, Color_White, Color_Bg_Window, 39, 290, F("Confirm")); + dwinDrawString(false, DWIN_FONT_STAT, Color_White, Color_Bg_Window, 165, 290, F("Cancel")); + popupSelect(); } else if (mode == Confirm) { - DWIN_Draw_Rectangle(1, Confirm_Color, 87, 280, 186, 317); - DWIN_Draw_String(false, DWIN_FONT_STAT, Color_White, Color_Bg_Window, 96, 290, F("Continue")); + dwinDrawRectangle(1, Confirm_Color, 87, 280, 186, 317); + dwinDrawString(false, DWIN_FONT_STAT, Color_White, Color_Bg_Window, 96, 290, F("Continue")); } } void MarlinUI::kill_screen(FSTR_P const error, FSTR_P const) { - CrealityDWIN.Draw_Popup(F("Printer Kill Reason:"), error, F("Restart Required"), Wait, ICON_BLTouch); + crealityDWIN.drawPopup(F("Printer Kill Reason:"), error, F("Restart Required"), Wait, ICON_BLTouch); } -void CrealityDWINClass::Popup_Select() { - const uint16_t c1 = selection ? Color_Bg_Window : GetColor(eeprom_settings.highlight_box, Color_White), - c2 = selection ? GetColor(eeprom_settings.highlight_box, Color_White) : Color_Bg_Window; - DWIN_Draw_Rectangle(0, c1, 25, 279, 126, 318); - DWIN_Draw_Rectangle(0, c1, 24, 278, 127, 319); - DWIN_Draw_Rectangle(0, c2, 145, 279, 246, 318); - DWIN_Draw_Rectangle(0, c2, 144, 278, 247, 319); +void CrealityDWIN::popupSelect() { + const uint16_t c1 = selection ? Color_Bg_Window : getColor(eeprom_settings.highlight_box, Color_White), + c2 = selection ? getColor(eeprom_settings.highlight_box, Color_White) : Color_Bg_Window; + dwinDrawRectangle(0, c1, 25, 279, 126, 318); + dwinDrawRectangle(0, c1, 24, 278, 127, 319); + dwinDrawRectangle(0, c2, 145, 279, 246, 318); + dwinDrawRectangle(0, c2, 144, 278, 247, 319); } -void CrealityDWINClass::Update_Status_Bar(const bool refresh/*=false*/) { +void CrealityDWIN::updateStatusBar(const bool refresh/*=false*/) { typedef TextScroller<30> Scroller; static bool new_msg; static Scroller scroller; @@ -1023,21 +1007,21 @@ void CrealityDWINClass::Update_Status_Bar(const bool refresh/*=false*/) { if (new_msg) { new_msg = false; if (process == Print) { - DWIN_Draw_Rectangle(1, Color_Grey, 8, 214, DWIN_WIDTH - 8, 238); + dwinDrawRectangle(1, Color_Grey, 8, 214, DWIN_WIDTH - 8, 238); const int8_t npos = (DWIN_WIDTH - len * MENU_CHR_W) / 2; - DWIN_Draw_String(false, DWIN_FONT_MENU, GetColor(eeprom_settings.status_bar_text, Color_White), Color_Bg_Black, npos, 219, dispmsg); + dwinDrawString(false, DWIN_FONT_MENU, getColor(eeprom_settings.status_bar_text, Color_White), Color_Bg_Black, npos, 219, dispmsg); } else { - DWIN_Draw_Rectangle(1, Color_Bg_Black, 8, 352, DWIN_WIDTH - 8, 376); + dwinDrawRectangle(1, Color_Bg_Black, 8, 352, DWIN_WIDTH - 8, 376); const int8_t npos = (DWIN_WIDTH - len * MENU_CHR_W) / 2; - DWIN_Draw_String(false, DWIN_FONT_MENU, GetColor(eeprom_settings.status_bar_text, Color_White), Color_Bg_Black, npos, 357, dispmsg); + dwinDrawString(false, DWIN_FONT_MENU, getColor(eeprom_settings.status_bar_text, Color_White), Color_Bg_Black, npos, 357, dispmsg); } } } /* Menu Item Config */ -void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item, bool draw/*=true*/) { +void CrealityDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool draw/*=true*/) { const uint8_t row = item - scrollpos; #if HAS_LEVELING static bool level_state; @@ -1055,38 +1039,38 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case PREHEAT_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else - Draw_Menu(TempMenu, sel); + drawMenu(TempMenu, sel); break; #if HAS_HOTEND case PREHEAT_SUBMENU_HOTEND: if (draw) { - Draw_Menu_Item(row, ICON_SetEndTemp, F("Hotend")); - Draw_Float(ui.material_preset[index].hotend_temp, row, false, 1); + drawMenuItem(row, ICON_SetEndTemp, F("Hotend")); + drawFloat(ui.material_preset[index].hotend_temp, row, false, 1); } else - Modify_Value(ui.material_preset[index].hotend_temp, MIN_E_TEMP, MAX_E_TEMP, 1); + modifyValue(ui.material_preset[index].hotend_temp, MIN_E_TEMP, MAX_E_TEMP, 1); break; #endif #if HAS_HEATED_BED case PREHEAT_SUBMENU_BED: if (draw) { - Draw_Menu_Item(row, ICON_SetBedTemp, F("Bed")); - Draw_Float(ui.material_preset[index].bed_temp, row, false, 1); + drawMenuItem(row, ICON_SetBedTemp, F("Bed")); + drawFloat(ui.material_preset[index].bed_temp, row, false, 1); } else - Modify_Value(ui.material_preset[index].bed_temp, MIN_BED_TEMP, MAX_BED_TEMP, 1); + modifyValue(ui.material_preset[index].bed_temp, MIN_BED_TEMP, MAX_BED_TEMP, 1); break; #endif #if HAS_FAN case PREHEAT_SUBMENU_FAN: if (draw) { - Draw_Menu_Item(row, ICON_FanSpeed, F("Fan")); - Draw_Float(ui.material_preset[index].fan_speed, row, false, 1); + drawMenuItem(row, ICON_FanSpeed, F("Fan")); + drawFloat(ui.material_preset[index].fan_speed, row, false, 1); } else - Modify_Value(ui.material_preset[index].fan_speed, MIN_FAN_SPEED, MAX_FAN_SPEED, 1); + modifyValue(ui.material_preset[index].fan_speed, MIN_FAN_SPEED, MAX_FAN_SPEED, 1); break; #endif } @@ -1112,54 +1096,54 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case PREPARE_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else - Draw_Main_Menu(1); + drawMainMenu(1); break; case PREPARE_MOVE: if (draw) - Draw_Menu_Item(row, ICON_Axis, F("Move"), nullptr, true); + drawMenuItem(row, ICON_Axis, F("Move"), nullptr, true); else - Draw_Menu(Move); + drawMenu(Move); break; case PREPARE_DISABLE: if (draw) - Draw_Menu_Item(row, ICON_CloseMotor, F("Disable Stepper")); + drawMenuItem(row, ICON_CloseMotor, F("Disable Stepper")); else queue.inject(F("M84")); break; case PREPARE_HOME: if (draw) - Draw_Menu_Item(row, ICON_SetHome, F("Homing"), nullptr, true); + drawMenuItem(row, ICON_SetHome, F("Homing"), nullptr, true); else - Draw_Menu(HomeMenu); + drawMenu(HomeMenu); break; case PREPARE_MANUALLEVEL: if (draw) - Draw_Menu_Item(row, ICON_PrintSize, F("Manual Leveling"), nullptr, true); + drawMenuItem(row, ICON_PrintSize, F("Manual Leveling"), nullptr, true); else { if (axes_should_home()) { - Popup_Handler(Home); + popupHandler(Home); gcode.home_all_axes(true); } #if HAS_LEVELING level_state = planner.leveling_active; set_bed_leveling_enabled(false); #endif - Draw_Menu(ManualLevel); + drawMenu(ManualLevel); } break; #if HAS_ZOFFSET_ITEM case PREPARE_ZOFFSET: if (draw) - Draw_Menu_Item(row, ICON_Zoffset, F("Z-Offset"), nullptr, true); + drawMenuItem(row, ICON_Zoffset, F("Z-Offset"), nullptr, true); else { #if HAS_LEVELING level_state = planner.leveling_active; set_bed_leveling_enabled(false); #endif - Draw_Menu(ZOffset); + drawMenu(ZOffset); } break; #endif @@ -1167,16 +1151,16 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item #if HAS_PREHEAT case PREPARE_PREHEAT: if (draw) - Draw_Menu_Item(row, ICON_Temperature, F("Preheat"), nullptr, true); + drawMenuItem(row, ICON_Temperature, F("Preheat"), nullptr, true); else - Draw_Menu(Preheat); + drawMenu(Preheat); break; #endif #if HAS_HOTEND || HAS_HEATED_BED case PREPARE_COOLDOWN: if (draw) - Draw_Menu_Item(row, ICON_Cool, F("Cooldown")); + drawMenuItem(row, ICON_Cool, F("Cooldown")); else thermalManager.cooldown(); break; @@ -1188,16 +1172,16 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item #define CUSTOM_MENU_CONFIG_TITLE "Custom Commands" #endif if (draw) - Draw_Menu_Item(row, ICON_Version, F(CUSTOM_MENU_CONFIG_TITLE)); + drawMenuItem(row, ICON_Version, F(CUSTOM_MENU_CONFIG_TITLE)); else - Draw_Menu(MenuCustom); + drawMenu(MenuCustom); break; #endif #if ENABLED(ADVANCED_PAUSE_FEATURE) case PREPARE_CHANGEFIL: if (draw) { - Draw_Menu_Item(row, ICON_ResumeEEPROM, GET_TEXT_F(MSG_FILAMENTCHANGE) + drawMenuItem(row, ICON_ResumeEEPROM, GET_TEXT_F(MSG_FILAMENTCHANGE) #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) , nullptr, true #endif @@ -1205,16 +1189,16 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item } else { #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) - Draw_Menu(ChangeFilament); + drawMenu(ChangeFilament); #else if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp) - Popup_Handler(ETemp); + popupHandler(ETemp); else { if (thermalManager.temp_hotend[0].is_below_target(2)) { - Popup_Handler(Heating); + popupHandler(Heating); thermalManager.wait_for_hotend(0); } - Popup_Handler(FilChange); + popupHandler(FilChange); sprintf_P(cmd, PSTR("M600 B1 R%i"), thermalManager.temp_hotend[0].target); gcode.process_subcommands_now(cmd); } @@ -1238,55 +1222,55 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case HOME_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else - Draw_Menu(Prepare, PREPARE_HOME); + drawMenu(Prepare, PREPARE_HOME); break; case HOME_ALL: if (draw) - Draw_Menu_Item(row, ICON_Homing, F("Home All")); + drawMenuItem(row, ICON_Homing, F("Home All")); else { - Popup_Handler(Home); + popupHandler(Home); gcode.home_all_axes(true); - Redraw_Menu(); + redrawMenu(); } break; case HOME_X: if (draw) - Draw_Menu_Item(row, ICON_MoveX, F("Home X")); + drawMenuItem(row, ICON_MoveX, F("Home X")); else { - Popup_Handler(Home); + popupHandler(Home); gcode.process_subcommands_now(F("G28 X")); planner.synchronize(); - Redraw_Menu(); + redrawMenu(); } break; case HOME_Y: if (draw) - Draw_Menu_Item(row, ICON_MoveY, F("Home Y")); + drawMenuItem(row, ICON_MoveY, F("Home Y")); else { - Popup_Handler(Home); + popupHandler(Home); gcode.process_subcommands_now(F("G28 Y")); planner.synchronize(); - Redraw_Menu(); + redrawMenu(); } break; case HOME_Z: if (draw) - Draw_Menu_Item(row, ICON_MoveZ, F("Home Z")); + drawMenuItem(row, ICON_MoveZ, F("Home Z")); else { - Popup_Handler(Home); + popupHandler(Home); gcode.process_subcommands_now(F("G28 Z")); planner.synchronize(); - Redraw_Menu(); + redrawMenu(); } break; case HOME_SET: if (draw) - Draw_Menu_Item(row, ICON_SetHome, F("Set Home Position")); + drawMenuItem(row, ICON_SetHome, F("Set Home Position")); else { gcode.process_subcommands_now(F("G92X0Y0Z0")); - AudioFeedback(); + audioFeedback(); } break; } @@ -1306,61 +1290,61 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case MOVE_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else { #if HAS_BED_PROBE probe_deployed = false; probe.set_deployed(probe_deployed); #endif - Draw_Menu(Prepare, PREPARE_MOVE); + drawMenu(Prepare, PREPARE_MOVE); } break; case MOVE_X: if (draw) { - Draw_Menu_Item(row, ICON_MoveX, F("Move X")); - Draw_Float(current_position.x, row, false); + drawMenuItem(row, ICON_MoveX, F("Move X")); + drawFloat(current_position.x, row, false); } else - Modify_Value(current_position.x, X_MIN_POS, X_MAX_POS, 10); + modifyValue(current_position.x, X_MIN_POS, X_MAX_POS, 10); break; case MOVE_Y: if (draw) { - Draw_Menu_Item(row, ICON_MoveY, F("Move Y")); - Draw_Float(current_position.y, row); + drawMenuItem(row, ICON_MoveY, F("Move Y")); + drawFloat(current_position.y, row); } else - Modify_Value(current_position.y, Y_MIN_POS, Y_MAX_POS, 10); + modifyValue(current_position.y, Y_MIN_POS, Y_MAX_POS, 10); break; case MOVE_Z: if (draw) { - Draw_Menu_Item(row, ICON_MoveZ, F("Move Z")); - Draw_Float(current_position.z, row); + drawMenuItem(row, ICON_MoveZ, F("Move Z")); + drawFloat(current_position.z, row); } else - Modify_Value(current_position.z, Z_MIN_POS, Z_MAX_POS, 10); + modifyValue(current_position.z, Z_MIN_POS, Z_MAX_POS, 10); break; #if HAS_HOTEND case MOVE_E: if (draw) { - Draw_Menu_Item(row, ICON_Extruder, F("Extruder")); + drawMenuItem(row, ICON_Extruder, F("Extruder")); current_position.e = 0; sync_plan_position(); - Draw_Float(current_position.e, row); + drawFloat(current_position.e, row); } else { if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp) { - Popup_Handler(ETemp); + popupHandler(ETemp); } else { if (thermalManager.temp_hotend[0].is_below_target(2)) { - Popup_Handler(Heating); + popupHandler(Heating); thermalManager.wait_for_hotend(0); - Redraw_Menu(); + redrawMenu(); } current_position.e = 0; sync_plan_position(); - Modify_Value(current_position.e, -500, 500, 10); + modifyValue(current_position.e, -500, 500, 10); } } break; @@ -1369,25 +1353,25 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item #if HAS_BED_PROBE case MOVE_P: if (draw) { - Draw_Menu_Item(row, ICON_StockConfiguration, F("Probe")); - Draw_Checkbox(row, probe_deployed); + drawMenuItem(row, ICON_StockConfiguration, F("Probe")); + drawCheckbox(row, probe_deployed); } else { probe_deployed = !probe_deployed; probe.set_deployed(probe_deployed); - Draw_Checkbox(row, probe_deployed); + drawCheckbox(row, probe_deployed); } break; #endif case MOVE_LIVE: if (draw) { - Draw_Menu_Item(row, ICON_Axis, F("Live Movement")); - Draw_Checkbox(row, livemove); + drawMenuItem(row, ICON_Axis, F("Live Movement")); + drawCheckbox(row, livemove); } else { livemove = !livemove; - Draw_Checkbox(row, livemove); + drawCheckbox(row, livemove); } break; } @@ -1417,24 +1401,24 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case MLEVEL_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else { TERN_(HAS_LEVELING, set_bed_leveling_enabled(level_state)); - Draw_Menu(Prepare, PREPARE_MANUALLEVEL); + drawMenu(Prepare, PREPARE_MANUALLEVEL); } break; #if HAS_BED_PROBE case MLEVEL_PROBE: if (draw) { - Draw_Menu_Item(row, ICON_Zoffset, F("Use Probe")); - Draw_Checkbox(row, use_probe); + drawMenuItem(row, ICON_Zoffset, F("Use Probe")); + drawCheckbox(row, use_probe); } else { use_probe ^= true; - Draw_Checkbox(row, use_probe); + drawCheckbox(row, use_probe); if (use_probe) { - Popup_Handler(Level); + popupHandler(Level); const struct { xy_pos_t p; ProbePtRaise r; } points[] = { { { probe_x_min, probe_y_min }, PROBE_PT_RAISE }, { { probe_x_min, probe_y_max }, PROBE_PT_RAISE }, @@ -1448,7 +1432,7 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item corner_avg += mz; } corner_avg /= 4; - Redraw_Menu(); + redrawMenu(); } } break; @@ -1456,116 +1440,116 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item case MLEVEL_BL: if (draw) - Draw_Menu_Item(row, ICON_AxisBL, F("Bottom Left")); + drawMenuItem(row, ICON_AxisBL, F("Bottom Left")); else { - Popup_Handler(MoveWait); + popupHandler(MoveWait); if (use_probe) { #if HAS_BED_PROBE sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s"), dtostrf(probe_x_min, 1, 3, str_1), dtostrf(probe_y_min, 1, 3, str_2)); gcode.process_subcommands_now(cmd); planner.synchronize(); - Popup_Handler(ManualProbing); + popupHandler(ManualProbing); #endif } else { sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s\nG0 F300 Z%s"), dtostrf(corner_pos, 1, 3, str_1), dtostrf(corner_pos, 1, 3, str_2), dtostrf(mlev_z_pos, 1, 3, str_3)); gcode.process_subcommands_now(cmd); planner.synchronize(); - Redraw_Menu(); + redrawMenu(); } } break; case MLEVEL_TL: if (draw) - Draw_Menu_Item(row, ICON_AxisTL, F("Top Left")); + drawMenuItem(row, ICON_AxisTL, F("Top Left")); else { - Popup_Handler(MoveWait); + popupHandler(MoveWait); if (use_probe) { #if HAS_BED_PROBE sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s"), dtostrf(probe_x_min, 1, 3, str_1), dtostrf(probe_y_max, 1, 3, str_2)); gcode.process_subcommands_now(cmd); planner.synchronize(); - Popup_Handler(ManualProbing); + popupHandler(ManualProbing); #endif } else { sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s\nG0 F300 Z%s"), dtostrf(corner_pos, 1, 3, str_1), dtostrf((Y_BED_SIZE + Y_MIN_POS) - corner_pos, 1, 3, str_2), dtostrf(mlev_z_pos, 1, 3, str_3)); gcode.process_subcommands_now(cmd); planner.synchronize(); - Redraw_Menu(); + redrawMenu(); } } break; case MLEVEL_TR: if (draw) - Draw_Menu_Item(row, ICON_AxisTR, F("Top Right")); + drawMenuItem(row, ICON_AxisTR, F("Top Right")); else { - Popup_Handler(MoveWait); + popupHandler(MoveWait); if (use_probe) { #if HAS_BED_PROBE sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s"), dtostrf(probe_x_max, 1, 3, str_1), dtostrf(probe_y_max, 1, 3, str_2)); gcode.process_subcommands_now(cmd); planner.synchronize(); - Popup_Handler(ManualProbing); + popupHandler(ManualProbing); #endif } else { sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s\nG0 F300 Z%s"), dtostrf((X_BED_SIZE + X_MIN_POS) - corner_pos, 1, 3, str_1), dtostrf((Y_BED_SIZE + Y_MIN_POS) - corner_pos, 1, 3, str_2), dtostrf(mlev_z_pos, 1, 3, str_3)); gcode.process_subcommands_now(cmd); planner.synchronize(); - Redraw_Menu(); + redrawMenu(); } } break; case MLEVEL_BR: if (draw) - Draw_Menu_Item(row, ICON_AxisBR, F("Bottom Right")); + drawMenuItem(row, ICON_AxisBR, F("Bottom Right")); else { - Popup_Handler(MoveWait); + popupHandler(MoveWait); if (use_probe) { #if HAS_BED_PROBE sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s"), dtostrf(probe_x_max, 1, 3, str_1), dtostrf(probe_y_min, 1, 3, str_2)); gcode.process_subcommands_now(cmd); planner.synchronize(); - Popup_Handler(ManualProbing); + popupHandler(ManualProbing); #endif } else { sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s\nG0 F300 Z%s"), dtostrf((X_BED_SIZE + X_MIN_POS) - corner_pos, 1, 3, str_1), dtostrf(corner_pos, 1, 3, str_2), dtostrf(mlev_z_pos, 1, 3, str_3)); gcode.process_subcommands_now(cmd); planner.synchronize(); - Redraw_Menu(); + redrawMenu(); } } break; case MLEVEL_C: if (draw) - Draw_Menu_Item(row, ICON_AxisC, F("Center")); + drawMenuItem(row, ICON_AxisC, F("Center")); else { - Popup_Handler(MoveWait); + popupHandler(MoveWait); if (use_probe) { #if HAS_BED_PROBE sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s"), dtostrf(X_MAX_POS / 2.0f - probe.offset.x, 1, 3, str_1), dtostrf(Y_MAX_POS / 2.0f - probe.offset.y, 1, 3, str_2)); gcode.process_subcommands_now(cmd); planner.synchronize(); - Popup_Handler(ManualProbing); + popupHandler(ManualProbing); #endif } else { sprintf_P(cmd, PSTR("G0 F4000\nG0 Z10\nG0 X%s Y%s\nG0 F300 Z%s"), dtostrf((X_BED_SIZE + X_MIN_POS) / 2.0f, 1, 3, str_1), dtostrf((Y_BED_SIZE + Y_MIN_POS) / 2.0f, 1, 3, str_2), dtostrf(mlev_z_pos, 1, 3, str_3)); gcode.process_subcommands_now(cmd); planner.synchronize(); - Redraw_Menu(); + redrawMenu(); } } break; case MLEVEL_ZPOS: if (draw) { - Draw_Menu_Item(row, ICON_SetZOffset, F("Z Position")); - Draw_Float(mlev_z_pos, row, false, 100); + drawMenuItem(row, ICON_SetZOffset, F("Z Position")); + drawFloat(mlev_z_pos, row, false, 100); } else - Modify_Value(mlev_z_pos, 0, MAX_Z_OFFSET, 100); + modifyValue(mlev_z_pos, 0, MAX_Z_OFFSET, 100); break; } @@ -1586,20 +1570,20 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case ZOFFSET_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else { liveadjust = false; TERN_(HAS_LEVELING, set_bed_leveling_enabled(level_state)); - Draw_Menu(Prepare, PREPARE_ZOFFSET); + drawMenu(Prepare, PREPARE_ZOFFSET); } break; case ZOFFSET_HOME: if (draw) - Draw_Menu_Item(row, ICON_Homing, F("Home Z Axis")); + drawMenuItem(row, ICON_Homing, F("Home Z Axis")); else { - Popup_Handler(Home); + popupHandler(Home); gcode.process_subcommands_now(F("G28 Z")); - Popup_Handler(MoveWait); + popupHandler(MoveWait); #if ENABLED(Z_SAFE_HOMING) planner.synchronize(); sprintf_P(cmd, PSTR("G0 F4000 X%s Y%s"), dtostrf(Z_SAFE_HOMING_X_POINT, 1, 3, str_1), dtostrf(Z_SAFE_HOMING_Y_POINT, 1, 3, str_2)); @@ -1609,21 +1593,21 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item #endif gcode.process_subcommands_now(F("G0 F300 Z0")); planner.synchronize(); - Redraw_Menu(); + redrawMenu(); } break; case ZOFFSET_MODE: if (draw) { - Draw_Menu_Item(row, ICON_Zoffset, F("Live Adjustment")); - Draw_Checkbox(row, liveadjust); + drawMenuItem(row, ICON_Zoffset, F("Live Adjustment")); + drawCheckbox(row, liveadjust); } else { if (!liveadjust) { if (axes_should_home()) { - Popup_Handler(Home); + popupHandler(Home); gcode.home_all_axes(true); } - Popup_Handler(MoveWait); + popupHandler(MoveWait); #if ENABLED(Z_SAFE_HOMING) planner.synchronize(); sprintf_P(cmd, PSTR("G0 F4000 X%s Y%s"), dtostrf(Z_SAFE_HOMING_X_POINT, 1, 3, str_1), dtostrf(Z_SAFE_HOMING_Y_POINT, 1, 3, str_2)); @@ -1633,23 +1617,23 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item #endif gcode.process_subcommands_now(F("G0 F300 Z0")); planner.synchronize(); - Redraw_Menu(); + redrawMenu(); } liveadjust = !liveadjust; - Draw_Checkbox(row, liveadjust); + drawCheckbox(row, liveadjust); } break; case ZOFFSET_OFFSET: if (draw) { - Draw_Menu_Item(row, ICON_SetZOffset, F("Z Offset")); - Draw_Float(zoffsetvalue, row, false, 100); + drawMenuItem(row, ICON_SetZOffset, F("Z Offset")); + drawFloat(zoffsetvalue, row, false, 100); } else - Modify_Value(zoffsetvalue, MIN_Z_OFFSET, MAX_Z_OFFSET, 100); + modifyValue(zoffsetvalue, MIN_Z_OFFSET, MAX_Z_OFFSET, 100); break; case ZOFFSET_UP: if (draw) - Draw_Menu_Item(row, ICON_Axis, F("Microstep Up")); + drawMenuItem(row, ICON_Axis, F("Microstep Up")); else { if (zoffsetvalue < MAX_Z_OFFSET) { if (liveadjust) { @@ -1657,13 +1641,13 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item planner.synchronize(); } zoffsetvalue += 0.01; - Draw_Float(zoffsetvalue, row - 1, false, 100); + drawFloat(zoffsetvalue, row - 1, false, 100); } } break; case ZOFFSET_DOWN: if (draw) - Draw_Menu_Item(row, ICON_AxisD, F("Microstep Down")); + drawMenuItem(row, ICON_AxisD, F("Microstep Down")); else { if (zoffsetvalue > MIN_Z_OFFSET) { if (liveadjust) { @@ -1671,16 +1655,16 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item planner.synchronize(); } zoffsetvalue -= 0.01; - Draw_Float(zoffsetvalue, row - 2, false, 100); + drawFloat(zoffsetvalue, row - 2, false, 100); } } break; #if ENABLED(EEPROM_SETTINGS) case ZOFFSET_SAVE: if (draw) - Draw_Menu_Item(row, ICON_WriteEEPROM, F("Save")); + drawMenuItem(row, ICON_WriteEEPROM, F("Save")); else - AudioFeedback(settings.save()); + audioFeedback(settings.save()); break; #endif } @@ -1706,23 +1690,23 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case PREHEAT_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else - Draw_Menu(Prepare, PREPARE_PREHEAT); + drawMenu(Prepare, PREPARE_PREHEAT); break; case PREHEAT_MODE: if (draw) { - Draw_Menu_Item(row, ICON_Homing, F("Preheat Mode")); - Draw_Option(preheatmode, preheat_modes, row); + drawMenuItem(row, ICON_Homing, F("Preheat Mode")); + drawOption(preheatmode, preheat_modes, row); } else - Modify_Option(preheatmode, preheat_modes, 2); + modifyOption(preheatmode, preheat_modes, 2); break; #define _PREHEAT_CASE(N) \ case PREHEAT_##N: { \ - if (draw) Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_## N ##_LABEL)); \ + if (draw) drawMenuItem(row, ICON_Temperature, F(PREHEAT_## N ##_LABEL)); \ else do_preheat(N - 1); \ } break; @@ -1743,59 +1727,59 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case CHANGEFIL_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else - Draw_Menu(Prepare, PREPARE_CHANGEFIL); + drawMenu(Prepare, PREPARE_CHANGEFIL); break; case CHANGEFIL_LOAD: if (draw) - Draw_Menu_Item(row, ICON_WriteEEPROM, GET_TEXT_F(MSG_FILAMENTLOAD)); + drawMenuItem(row, ICON_WriteEEPROM, GET_TEXT_F(MSG_FILAMENTLOAD)); else { if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp) - Popup_Handler(ETemp); + popupHandler(ETemp); else { if (thermalManager.temp_hotend[0].is_below_target(2)) { - Popup_Handler(Heating); + popupHandler(Heating); thermalManager.wait_for_hotend(0); } - Popup_Handler(FilLoad); + popupHandler(FilLoad); gcode.process_subcommands_now(F("M701")); planner.synchronize(); - Redraw_Menu(); + redrawMenu(); } } break; case CHANGEFIL_UNLOAD: if (draw) - Draw_Menu_Item(row, ICON_ReadEEPROM, GET_TEXT_F(MSG_FILAMENTUNLOAD)); + drawMenuItem(row, ICON_ReadEEPROM, GET_TEXT_F(MSG_FILAMENTUNLOAD)); else { if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp) { - Popup_Handler(ETemp); + popupHandler(ETemp); } else { if (thermalManager.temp_hotend[0].is_below_target(2)) { - Popup_Handler(Heating); + popupHandler(Heating); thermalManager.wait_for_hotend(0); } - Popup_Handler(FilLoad, true); + popupHandler(FilLoad, true); gcode.process_subcommands_now(F("M702")); planner.synchronize(); - Redraw_Menu(); + redrawMenu(); } } break; case CHANGEFIL_CHANGE: if (draw) - Draw_Menu_Item(row, ICON_ResumeEEPROM, GET_TEXT_F(MSG_FILAMENTCHANGE)); + drawMenuItem(row, ICON_ResumeEEPROM, GET_TEXT_F(MSG_FILAMENTCHANGE)); else { if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp) - Popup_Handler(ETemp); + popupHandler(ETemp); else { if (thermalManager.temp_hotend[0].is_below_target(2)) { - Popup_Handler(Heating); + popupHandler(Heating); thermalManager.wait_for_hotend(0); } - Popup_Handler(FilChange); + popupHandler(FilChange); sprintf_P(cmd, PSTR("M600 B1 R%i"), thermalManager.temp_hotend[0].target); gcode.process_subcommands_now(cmd); } @@ -1820,23 +1804,23 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case CUSTOM_MENU_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else - Draw_Menu(Prepare, PREPARE_CUSTOM_MENU); + drawMenu(Prepare, PREPARE_CUSTOM_MENU); break; #if CUSTOM_MENU_COUNT >= 1 case CUSTOM_MENU_1: if (draw) - Draw_Menu_Item(row, ICON_Info, F(CONFIG_MENU_ITEM_1_DESC)); + drawMenuItem(row, ICON_Info, F(CONFIG_MENU_ITEM_1_DESC)); else { - Popup_Handler(Custom); + popupHandler(Custom); //queue.inject(F(CONFIG_MENU_ITEM_1_GCODE)); // Old code gcode.process_subcommands_now(F(CONFIG_MENU_ITEM_1_GCODE)); planner.synchronize(); - Redraw_Menu(); + redrawMenu(); #if ENABLED(CUSTOM_MENU_CONFIG_SCRIPT_AUDIBLE_FEEDBACK) - AudioFeedback(); + audioFeedback(); #endif #ifdef CUSTOM_MENU_CONFIG_SCRIPT_RETURN queue.inject(F(CUSTOM_MENU_CONFIG_SCRIPT_DONE)); @@ -1848,14 +1832,14 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item #if CUSTOM_MENU_COUNT >= 2 case CUSTOM_MENU_2: if (draw) - Draw_Menu_Item(row, ICON_Info, F(CONFIG_MENU_ITEM_2_DESC)); + drawMenuItem(row, ICON_Info, F(CONFIG_MENU_ITEM_2_DESC)); else { - Popup_Handler(Custom); + popupHandler(Custom); gcode.process_subcommands_now(F(CONFIG_MENU_ITEM_2_GCODE)); planner.synchronize(); - Redraw_Menu(); + redrawMenu(); #if ENABLED(CUSTOM_MENU_CONFIG_SCRIPT_AUDIBLE_FEEDBACK) - AudioFeedback(); + audioFeedback(); #endif #ifdef CUSTOM_MENU_CONFIG_SCRIPT_RETURN queue.inject(F(CUSTOM_MENU_CONFIG_SCRIPT_DONE)); @@ -1867,14 +1851,14 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item #if CUSTOM_MENU_COUNT >= 3 case CUSTOM_MENU_3: if (draw) - Draw_Menu_Item(row, ICON_Info, F(CONFIG_MENU_ITEM_3_DESC)); + drawMenuItem(row, ICON_Info, F(CONFIG_MENU_ITEM_3_DESC)); else { - Popup_Handler(Custom); + popupHandler(Custom); gcode.process_subcommands_now(F(CONFIG_MENU_ITEM_3_GCODE)); planner.synchronize(); - Redraw_Menu(); + redrawMenu(); #if ENABLED(CUSTOM_MENU_CONFIG_SCRIPT_AUDIBLE_FEEDBACK) - AudioFeedback(); + audioFeedback(); #endif #ifdef CUSTOM_MENU_CONFIG_SCRIPT_RETURN queue.inject(F(CUSTOM_MENU_CONFIG_SCRIPT_DONE)); @@ -1886,14 +1870,14 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item #if CUSTOM_MENU_COUNT >= 4 case CUSTOM_MENU_4: if (draw) - Draw_Menu_Item(row, ICON_Info, F(CONFIG_MENU_ITEM_4_DESC)); + drawMenuItem(row, ICON_Info, F(CONFIG_MENU_ITEM_4_DESC)); else { - Popup_Handler(Custom); + popupHandler(Custom); gcode.process_subcommands_now(F(CONFIG_MENU_ITEM_4_GCODE)); planner.synchronize(); - Redraw_Menu(); + redrawMenu(); #if ENABLED(CUSTOM_MENU_CONFIG_SCRIPT_AUDIBLE_FEEDBACK) - AudioFeedback(); + audioFeedback(); #endif #ifdef CUSTOM_MENU_CONFIG_SCRIPT_RETURN queue.inject(F(CUSTOM_MENU_CONFIG_SCRIPT_DONE)); @@ -1905,14 +1889,14 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item #if CUSTOM_MENU_COUNT >= 5 case CUSTOM_MENU_5: if (draw) - Draw_Menu_Item(row, ICON_Info, F(CONFIG_MENU_ITEM_5_DESC)); + drawMenuItem(row, ICON_Info, F(CONFIG_MENU_ITEM_5_DESC)); else { - Popup_Handler(Custom); + popupHandler(Custom); gcode.process_subcommands_now(F(CONFIG_MENU_ITEM_5_GCODE)); planner.synchronize(); - Redraw_Menu(); + redrawMenu(); #if ENABLED(CUSTOM_MENU_CONFIG_SCRIPT_AUDIBLE_FEEDBACK) - AudioFeedback(); + audioFeedback(); #endif #ifdef CUSTOM_MENU_CONFIG_SCRIPT_RETURN queue.inject(F(CUSTOM_MENU_CONFIG_SCRIPT_DONE)); @@ -1941,61 +1925,61 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case CONTROL_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else - Draw_Main_Menu(2); + drawMainMenu(2); break; case CONTROL_TEMP: if (draw) - Draw_Menu_Item(row, ICON_Temperature, F("Temperature"), nullptr, true); + drawMenuItem(row, ICON_Temperature, F("Temperature"), nullptr, true); else - Draw_Menu(TempMenu); + drawMenu(TempMenu); break; case CONTROL_MOTION: if (draw) - Draw_Menu_Item(row, ICON_Motion, F("Motion"), nullptr, true); + drawMenuItem(row, ICON_Motion, F("Motion"), nullptr, true); else - Draw_Menu(Motion); + drawMenu(Motion); break; case CONTROL_VISUAL: if (draw) - Draw_Menu_Item(row, ICON_PrintSize, F("Visual"), nullptr, true); + drawMenuItem(row, ICON_PrintSize, F("Visual"), nullptr, true); else - Draw_Menu(Visual); + drawMenu(Visual); break; case CONTROL_ADVANCED: if (draw) - Draw_Menu_Item(row, ICON_Version, F("Advanced"), nullptr, true); + drawMenuItem(row, ICON_Version, F("Advanced"), nullptr, true); else - Draw_Menu(Advanced); + drawMenu(Advanced); break; #if ENABLED(EEPROM_SETTINGS) case CONTROL_SAVE: if (draw) - Draw_Menu_Item(row, ICON_WriteEEPROM, F("Store Settings")); + drawMenuItem(row, ICON_WriteEEPROM, F("Store Settings")); else - AudioFeedback(settings.save()); + audioFeedback(settings.save()); break; case CONTROL_RESTORE: if (draw) - Draw_Menu_Item(row, ICON_ReadEEPROM, F("Restore Settings")); + drawMenuItem(row, ICON_ReadEEPROM, F("Restore Settings")); else - AudioFeedback(settings.load()); + audioFeedback(settings.load()); break; case CONTROL_RESET: if (draw) - Draw_Menu_Item(row, ICON_Temperature, F("Reset to Defaults")); + drawMenuItem(row, ICON_Temperature, F("Reset to Defaults")); else { settings.reset(); - AudioFeedback(); + audioFeedback(); } break; #endif case CONTROL_INFO: if (draw) - Draw_Menu_Item(row, ICON_Info, F("Info")); + drawMenuItem(row, ICON_Info, F("Info")); else - Draw_Menu(Info); + drawMenu(Info); break; } break; @@ -2017,53 +2001,53 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case TEMP_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else - Draw_Menu(Control, CONTROL_TEMP); + drawMenu(Control, CONTROL_TEMP); break; #if HAS_HOTEND case TEMP_HOTEND: if (draw) { - Draw_Menu_Item(row, ICON_SetEndTemp, F("Hotend")); - Draw_Float(thermalManager.temp_hotend[0].target, row, false, 1); + drawMenuItem(row, ICON_SetEndTemp, F("Hotend")); + drawFloat(thermalManager.temp_hotend[0].target, row, false, 1); } else - Modify_Value(thermalManager.temp_hotend[0].target, MIN_E_TEMP, MAX_E_TEMP, 1); + modifyValue(thermalManager.temp_hotend[0].target, MIN_E_TEMP, MAX_E_TEMP, 1); break; #endif #if HAS_HEATED_BED case TEMP_BED: if (draw) { - Draw_Menu_Item(row, ICON_SetBedTemp, F("Bed")); - Draw_Float(thermalManager.temp_bed.target, row, false, 1); + drawMenuItem(row, ICON_SetBedTemp, F("Bed")); + drawFloat(thermalManager.temp_bed.target, row, false, 1); } else - Modify_Value(thermalManager.temp_bed.target, MIN_BED_TEMP, MAX_BED_TEMP, 1); + modifyValue(thermalManager.temp_bed.target, MIN_BED_TEMP, MAX_BED_TEMP, 1); break; #endif #if HAS_FAN case TEMP_FAN: if (draw) { - Draw_Menu_Item(row, ICON_FanSpeed, F("Fan")); - Draw_Float(thermalManager.fan_speed[0], row, false, 1); + drawMenuItem(row, ICON_FanSpeed, F("Fan")); + drawFloat(thermalManager.fan_speed[0], row, false, 1); } else - Modify_Value(thermalManager.fan_speed[0], MIN_FAN_SPEED, MAX_FAN_SPEED, 1); + modifyValue(thermalManager.fan_speed[0], MIN_FAN_SPEED, MAX_FAN_SPEED, 1); break; #endif #if HAS_HOTEND || HAS_HEATED_BED case TEMP_PID: if (draw) - Draw_Menu_Item(row, ICON_Step, F("PID"), nullptr, true); + drawMenuItem(row, ICON_Step, F("PID"), nullptr, true); else - Draw_Menu(PID); + drawMenu(PID); break; #endif #define _TEMP_PREHEAT_CASE(N) \ case TEMP_PREHEAT##N: { \ - if (draw) Draw_Menu_Item(row, ICON_Step, F(PREHEAT_## N ##_LABEL), nullptr, true); \ - else Draw_Menu(Preheat##N); \ + if (draw) drawMenuItem(row, ICON_Step, F(PREHEAT_## N ##_LABEL), nullptr, true); \ + else drawMenu(Preheat##N); \ } break; REPEAT_1(PREHEAT_COUNT, _TEMP_PREHEAT_CASE) @@ -2084,33 +2068,33 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case PID_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else - Draw_Menu(TempMenu, TEMP_PID); + drawMenu(TempMenu, TEMP_PID); break; #if HAS_HOTEND case PID_HOTEND: if (draw) - Draw_Menu_Item(row, ICON_HotendTemp, F("Hotend"), nullptr, true); + drawMenuItem(row, ICON_HotendTemp, F("Hotend"), nullptr, true); else - Draw_Menu(HotendPID); + drawMenu(HotendPID); break; #endif #if HAS_HEATED_BED case PID_BED: if (draw) - Draw_Menu_Item(row, ICON_BedTemp, F("Bed"), nullptr, true); + drawMenuItem(row, ICON_BedTemp, F("Bed"), nullptr, true); else - Draw_Menu(BedPID); + drawMenu(BedPID); break; #endif case PID_CYCLES: if (draw) { - Draw_Menu_Item(row, ICON_FanSpeed, F("Cycles")); - Draw_Float(PID_cycles, row, false, 1); + drawMenuItem(row, ICON_FanSpeed, F("Cycles")); + drawFloat(PID_cycles, row, false, 1); } else - Modify_Value(PID_cycles, 3, 50, 1); + modifyValue(PID_cycles, 3, 50, 1); break; } break; @@ -2132,52 +2116,52 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case HOTENDPID_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else - Draw_Menu(PID, PID_HOTEND); + drawMenu(PID, PID_HOTEND); break; case HOTENDPID_TUNE: if (draw) - Draw_Menu_Item(row, ICON_HotendTemp, F("Autotune")); + drawMenuItem(row, ICON_HotendTemp, F("Autotune")); else { - Popup_Handler(PIDWait); + popupHandler(PIDWait); sprintf_P(cmd, PSTR("M303 E0 C%i S%i U1"), PID_cycles, PID_e_temp); gcode.process_subcommands_now(cmd); planner.synchronize(); - Redraw_Menu(); + redrawMenu(); } break; case HOTENDPID_TEMP: if (draw) { - Draw_Menu_Item(row, ICON_Temperature, F("Temperature")); - Draw_Float(PID_e_temp, row, false, 1); + drawMenuItem(row, ICON_Temperature, F("Temperature")); + drawFloat(PID_e_temp, row, false, 1); } else - Modify_Value(PID_e_temp, MIN_E_TEMP, MAX_E_TEMP, 1); + modifyValue(PID_e_temp, MIN_E_TEMP, MAX_E_TEMP, 1); break; case HOTENDPID_KP: if (draw) { - Draw_Menu_Item(row, ICON_Version, F("Kp Value")); - Draw_Float(thermalManager.temp_hotend[0].pid.p(), row, false, 100); + drawMenuItem(row, ICON_Version, F("Kp Value")); + drawFloat(thermalManager.temp_hotend[0].pid.p(), row, false, 100); } else - Modify_Value(thermalManager.temp_hotend[0].pid.Kp, 0, 5000, 100, thermalManager.updatePID); + modifyValue(thermalManager.temp_hotend[0].pid.Kp, 0, 5000, 100, thermalManager.updatePID); break; case HOTENDPID_KI: if (draw) { - Draw_Menu_Item(row, ICON_Version, F("Ki Value")); - Draw_Float(thermalManager.temp_hotend[0].pid.i(), row, false, 100); + drawMenuItem(row, ICON_Version, F("Ki Value")); + drawFloat(thermalManager.temp_hotend[0].pid.i(), row, false, 100); } else - Modify_Value(thermalManager.temp_hotend[0].pid.Ki, 0, 5000, 100, thermalManager.updatePID); + modifyValue(thermalManager.temp_hotend[0].pid.Ki, 0, 5000, 100, thermalManager.updatePID); break; case HOTENDPID_KD: if (draw) { - Draw_Menu_Item(row, ICON_Version, F("Kd Value")); - Draw_Float(thermalManager.temp_hotend[0].pid.d(), row, false, 100); + drawMenuItem(row, ICON_Version, F("Kd Value")); + drawFloat(thermalManager.temp_hotend[0].pid.d(), row, false, 100); } else - Modify_Value(thermalManager.temp_hotend[0].pid.Kd, 0, 5000, 100, thermalManager.updatePID); + modifyValue(thermalManager.temp_hotend[0].pid.Kd, 0, 5000, 100, thermalManager.updatePID); break; } break; @@ -2199,53 +2183,53 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case BEDPID_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else - Draw_Menu(PID, PID_BED); + drawMenu(PID, PID_BED); break; case BEDPID_TUNE: if (draw) - Draw_Menu_Item(row, ICON_HotendTemp, F("Autotune")); + drawMenuItem(row, ICON_HotendTemp, F("Autotune")); else { - Popup_Handler(PIDWait); + popupHandler(PIDWait); sprintf_P(cmd, PSTR("M303 E-1 C%i S%i U1"), PID_cycles, PID_bed_temp); gcode.process_subcommands_now(cmd); planner.synchronize(); - Redraw_Menu(); + redrawMenu(); } break; case BEDPID_TEMP: if (draw) { - Draw_Menu_Item(row, ICON_Temperature, F("Temperature")); - Draw_Float(PID_bed_temp, row, false, 1); + drawMenuItem(row, ICON_Temperature, F("Temperature")); + drawFloat(PID_bed_temp, row, false, 1); } else - Modify_Value(PID_bed_temp, MIN_BED_TEMP, MAX_BED_TEMP, 1); + modifyValue(PID_bed_temp, MIN_BED_TEMP, MAX_BED_TEMP, 1); break; case BEDPID_KP: if (draw) { - Draw_Menu_Item(row, ICON_Version, F("Kp Value")); - Draw_Float(thermalManager.temp_bed.pid.p(), row, false, 100); + drawMenuItem(row, ICON_Version, F("Kp Value")); + drawFloat(thermalManager.temp_bed.pid.p(), row, false, 100); } else { - Modify_Value(thermalManager.temp_bed.pid.Kp, 0, 5000, 100, thermalManager.updatePID); + modifyValue(thermalManager.temp_bed.pid.Kp, 0, 5000, 100, thermalManager.updatePID); } break; case BEDPID_KI: if (draw) { - Draw_Menu_Item(row, ICON_Version, F("Ki Value")); - Draw_Float(thermalManager.temp_bed.pid.i(), row, false, 100); + drawMenuItem(row, ICON_Version, F("Ki Value")); + drawFloat(thermalManager.temp_bed.pid.i(), row, false, 100); } else - Modify_Value(thermalManager.temp_bed.pid.Ki, 0, 5000, 100, thermalManager.updatePID); + modifyValue(thermalManager.temp_bed.pid.Ki, 0, 5000, 100, thermalManager.updatePID); break; case BEDPID_KD: if (draw) { - Draw_Menu_Item(row, ICON_Version, F("Kd Value")); - Draw_Float(thermalManager.temp_bed.pid.d(), row, false, 100); + drawMenuItem(row, ICON_Version, F("Kd Value")); + drawFloat(thermalManager.temp_bed.pid.d(), row, false, 100); } else - Modify_Value(thermalManager.temp_bed.pid.Kd, 0, 5000, 100, thermalManager.updatePID); + modifyValue(thermalManager.temp_bed.pid.Kd, 0, 5000, 100, thermalManager.updatePID); break; } break; @@ -2270,50 +2254,50 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case MOTION_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else - Draw_Menu(Control, CONTROL_MOTION); + drawMenu(Control, CONTROL_MOTION); break; case MOTION_HOMEOFFSETS: if (draw) - Draw_Menu_Item(row, ICON_SetHome, F("Home Offsets"), nullptr, true); + drawMenuItem(row, ICON_SetHome, F("Home Offsets"), nullptr, true); else - Draw_Menu(HomeOffsets); + drawMenu(HomeOffsets); break; case MOTION_SPEED: if (draw) - Draw_Menu_Item(row, ICON_MaxSpeed, F("Max Speed"), nullptr, true); + drawMenuItem(row, ICON_MaxSpeed, F("Max Speed"), nullptr, true); else - Draw_Menu(MaxSpeed); + drawMenu(MaxSpeed); break; case MOTION_ACCEL: if (draw) - Draw_Menu_Item(row, ICON_MaxAccelerated, F("Max Acceleration"), nullptr, true); + drawMenuItem(row, ICON_MaxAccelerated, F("Max Acceleration"), nullptr, true); else - Draw_Menu(MaxAcceleration); + drawMenu(MaxAcceleration); break; #if HAS_CLASSIC_JERK case MOTION_JERK: if (draw) - Draw_Menu_Item(row, ICON_MaxJerk, F("Max Jerk"), nullptr, true); + drawMenuItem(row, ICON_MaxJerk, F("Max Jerk"), nullptr, true); else - Draw_Menu(MaxJerk); + drawMenu(MaxJerk); break; #endif case MOTION_STEPS: if (draw) - Draw_Menu_Item(row, ICON_Step, F("Steps/mm"), nullptr, true); + drawMenuItem(row, ICON_Step, F("Steps/mm"), nullptr, true); else - Draw_Menu(Steps); + drawMenu(Steps); break; #if HAS_HOTEND case MOTION_FLOW: if (draw) { - Draw_Menu_Item(row, ICON_Speed, F("Flow Rate")); - Draw_Float(planner.flow_percentage[0], row, false, 1); + drawMenuItem(row, ICON_Speed, F("Flow Rate")); + drawFloat(planner.flow_percentage[0], row, false, 1); } else - Modify_Value(planner.flow_percentage[0], MIN_FLOW_RATE, MAX_FLOW_RATE, 1, []{ planner.refresh_e_factor(0); }); + modifyValue(planner.flow_percentage[0], MIN_FLOW_RATE, MAX_FLOW_RATE, 1, []{ planner.refresh_e_factor(0); }); break; #endif } @@ -2329,25 +2313,25 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case HOMEOFFSETS_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else - Draw_Menu(Motion, MOTION_HOMEOFFSETS); + drawMenu(Motion, MOTION_HOMEOFFSETS); break; case HOMEOFFSETS_XOFFSET: if (draw) { - Draw_Menu_Item(row, ICON_StepX, F("X Offset")); - Draw_Float(home_offset.x, row, false, 100); + drawMenuItem(row, ICON_StepX, F("X Offset")); + drawFloat(home_offset.x, row, false, 100); } else - Modify_Value(home_offset.x, -MAX_XY_OFFSET, MAX_XY_OFFSET, 100); + modifyValue(home_offset.x, -MAX_XY_OFFSET, MAX_XY_OFFSET, 100); break; case HOMEOFFSETS_YOFFSET: if (draw) { - Draw_Menu_Item(row, ICON_StepY, F("Y Offset")); - Draw_Float(home_offset.y, row, false, 100); + drawMenuItem(row, ICON_StepY, F("Y Offset")); + drawFloat(home_offset.y, row, false, 100); } else - Modify_Value(home_offset.y, -MAX_XY_OFFSET, MAX_XY_OFFSET, 100); + modifyValue(home_offset.y, -MAX_XY_OFFSET, MAX_XY_OFFSET, 100); break; } break; @@ -2363,51 +2347,51 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case SPEED_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else - Draw_Menu(Motion, MOTION_SPEED); + drawMenu(Motion, MOTION_SPEED); break; #if HAS_X_AXIS case SPEED_X: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedX, F("X Axis")); - Draw_Float(planner.settings.max_feedrate_mm_s[X_AXIS], row, false, FEEDRATE_UNIT); + drawMenuItem(row, ICON_MaxSpeedX, F("X Axis")); + drawFloat(planner.settings.max_feedrate_mm_s[X_AXIS], row, false, FEEDRATE_UNIT); } else - Modify_Value(planner.settings.max_feedrate_mm_s[X_AXIS], min_feedrate_edit_values.x, max_feedrate_edit_values.x, FEEDRATE_UNIT); + modifyValue(planner.settings.max_feedrate_mm_s[X_AXIS], min_feedrate_edit_values.x, max_feedrate_edit_values.x, FEEDRATE_UNIT); break; #endif #if HAS_Y_AXIS case SPEED_Y: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedY, F("Y Axis")); - Draw_Float(planner.settings.max_feedrate_mm_s[Y_AXIS], row, false, FEEDRATE_UNIT); + drawMenuItem(row, ICON_MaxSpeedY, F("Y Axis")); + drawFloat(planner.settings.max_feedrate_mm_s[Y_AXIS], row, false, FEEDRATE_UNIT); } else - Modify_Value(planner.settings.max_feedrate_mm_s[Y_AXIS], min_feedrate_edit_values.y, max_feedrate_edit_values.y, FEEDRATE_UNIT); + modifyValue(planner.settings.max_feedrate_mm_s[Y_AXIS], min_feedrate_edit_values.y, max_feedrate_edit_values.y, FEEDRATE_UNIT); break; #endif #if HAS_Z_AXIS case SPEED_Z: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedZ, F("Z Axis")); - Draw_Float(planner.settings.max_feedrate_mm_s[Z_AXIS], row, false, FEEDRATE_UNIT); + drawMenuItem(row, ICON_MaxSpeedZ, F("Z Axis")); + drawFloat(planner.settings.max_feedrate_mm_s[Z_AXIS], row, false, FEEDRATE_UNIT); } else - Modify_Value(planner.settings.max_feedrate_mm_s[Z_AXIS], min_feedrate_edit_values.z, max_feedrate_edit_values.z, FEEDRATE_UNIT); + modifyValue(planner.settings.max_feedrate_mm_s[Z_AXIS], min_feedrate_edit_values.z, max_feedrate_edit_values.z, FEEDRATE_UNIT); break; #endif #if HAS_HOTEND case SPEED_E: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedE, F("Extruder")); - Draw_Float(planner.settings.max_feedrate_mm_s[E_AXIS], row, false, FEEDRATE_UNIT); + drawMenuItem(row, ICON_MaxSpeedE, F("Extruder")); + drawFloat(planner.settings.max_feedrate_mm_s[E_AXIS], row, false, FEEDRATE_UNIT); } else - Modify_Value(planner.settings.max_feedrate_mm_s[E_AXIS], min_feedrate_edit_values.e, max_feedrate_edit_values.e, FEEDRATE_UNIT); + modifyValue(planner.settings.max_feedrate_mm_s[E_AXIS], min_feedrate_edit_values.e, max_feedrate_edit_values.e, FEEDRATE_UNIT); break; #endif } @@ -2425,42 +2409,42 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case ACCEL_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else - Draw_Menu(Motion, MOTION_ACCEL); + drawMenu(Motion, MOTION_ACCEL); break; case ACCEL_X: if (draw) { - Draw_Menu_Item(row, ICON_MaxAccX, F("X Axis")); - Draw_Float(planner.settings.max_acceleration_mm_per_s2[X_AXIS], row, false, ACCELERATION_UNIT); + drawMenuItem(row, ICON_MaxAccX, F("X Axis")); + drawFloat(planner.settings.max_acceleration_mm_per_s2[X_AXIS], row, false, ACCELERATION_UNIT); } else - Modify_Value(planner.settings.max_acceleration_mm_per_s2[X_AXIS], min_acceleration_edit_values.x, max_acceleration_edit_values.x, ACCELERATION_UNIT); + modifyValue(planner.settings.max_acceleration_mm_per_s2[X_AXIS], min_acceleration_edit_values.x, max_acceleration_edit_values.x, ACCELERATION_UNIT); break; case ACCEL_Y: if (draw) { - Draw_Menu_Item(row, ICON_MaxAccY, F("Y Axis")); - Draw_Float(planner.settings.max_acceleration_mm_per_s2[Y_AXIS], row, false, ACCELERATION_UNIT); + drawMenuItem(row, ICON_MaxAccY, F("Y Axis")); + drawFloat(planner.settings.max_acceleration_mm_per_s2[Y_AXIS], row, false, ACCELERATION_UNIT); } else - Modify_Value(planner.settings.max_acceleration_mm_per_s2[Y_AXIS], min_acceleration_edit_values.y, max_acceleration_edit_values.y, ACCELERATION_UNIT); + modifyValue(planner.settings.max_acceleration_mm_per_s2[Y_AXIS], min_acceleration_edit_values.y, max_acceleration_edit_values.y, ACCELERATION_UNIT); break; case ACCEL_Z: if (draw) { - Draw_Menu_Item(row, ICON_MaxAccZ, F("Z Axis")); - Draw_Float(planner.settings.max_acceleration_mm_per_s2[Z_AXIS], row, false, ACCELERATION_UNIT); + drawMenuItem(row, ICON_MaxAccZ, F("Z Axis")); + drawFloat(planner.settings.max_acceleration_mm_per_s2[Z_AXIS], row, false, ACCELERATION_UNIT); } else - Modify_Value(planner.settings.max_acceleration_mm_per_s2[Z_AXIS], min_acceleration_edit_values.z, max_acceleration_edit_values.z, ACCELERATION_UNIT); + modifyValue(planner.settings.max_acceleration_mm_per_s2[Z_AXIS], min_acceleration_edit_values.z, max_acceleration_edit_values.z, ACCELERATION_UNIT); break; #if HAS_HOTEND case ACCEL_E: if (draw) { - Draw_Menu_Item(row, ICON_MaxAccE, F("Extruder")); - Draw_Float(planner.settings.max_acceleration_mm_per_s2[E_AXIS], row, false, ACCELERATION_UNIT); + drawMenuItem(row, ICON_MaxAccE, F("Extruder")); + drawFloat(planner.settings.max_acceleration_mm_per_s2[E_AXIS], row, false, ACCELERATION_UNIT); } else - Modify_Value(planner.settings.max_acceleration_mm_per_s2[E_AXIS], min_acceleration_edit_values.e, max_acceleration_edit_values.e, ACCELERATION_UNIT); + modifyValue(planner.settings.max_acceleration_mm_per_s2[E_AXIS], min_acceleration_edit_values.e, max_acceleration_edit_values.e, ACCELERATION_UNIT); break; #endif } @@ -2478,48 +2462,48 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case JERK_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else - Draw_Menu(Motion, MOTION_JERK); + drawMenu(Motion, MOTION_JERK); break; #if HAS_X_AXIS case JERK_X: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedJerkX, F("X Axis")); - Draw_Float(planner.max_jerk.x, row, false, JERK_UNIT); + drawMenuItem(row, ICON_MaxSpeedJerkX, F("X Axis")); + drawFloat(planner.max_jerk.x, row, false, JERK_UNIT); } else - Modify_Value(planner.max_jerk.x, min_jerk_edit_values.x, max_jerk_edit_values.x, JERK_UNIT); + modifyValue(planner.max_jerk.x, min_jerk_edit_values.x, max_jerk_edit_values.x, JERK_UNIT); break; #endif #if HAS_Y_AXIS case JERK_Y: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedJerkY, F("Y Axis")); - Draw_Float(planner.max_jerk.y, row, false, JERK_UNIT); + drawMenuItem(row, ICON_MaxSpeedJerkY, F("Y Axis")); + drawFloat(planner.max_jerk.y, row, false, JERK_UNIT); } else - Modify_Value(planner.max_jerk.y, min_jerk_edit_values.y, max_jerk_edit_values.y, JERK_UNIT); + modifyValue(planner.max_jerk.y, min_jerk_edit_values.y, max_jerk_edit_values.y, JERK_UNIT); break; #endif #if HAS_Z_AXIS case JERK_Z: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedJerkZ, F("Z Axis")); - Draw_Float(planner.max_jerk.z, row, false, JERK_UNIT); + drawMenuItem(row, ICON_MaxSpeedJerkZ, F("Z Axis")); + drawFloat(planner.max_jerk.z, row, false, JERK_UNIT); } else - Modify_Value(planner.max_jerk.z, min_jerk_edit_values.z, max_jerk_edit_values.z, JERK_UNIT); + modifyValue(planner.max_jerk.z, min_jerk_edit_values.z, max_jerk_edit_values.z, JERK_UNIT); break; #endif #if HAS_HOTEND case JERK_E: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedJerkE, F("Extruder")); - Draw_Float(planner.max_jerk.e, row, false, JERK_UNIT); + drawMenuItem(row, ICON_MaxSpeedJerkE, F("Extruder")); + drawFloat(planner.max_jerk.e, row, false, JERK_UNIT); } else - Modify_Value(planner.max_jerk.e, min_jerk_edit_values.e, max_jerk_edit_values.e, JERK_UNIT); + modifyValue(planner.max_jerk.e, min_jerk_edit_values.e, max_jerk_edit_values.e, JERK_UNIT); break; #endif } @@ -2537,48 +2521,48 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case STEPS_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else - Draw_Menu(Motion, MOTION_STEPS); + drawMenu(Motion, MOTION_STEPS); break; #if HAS_X_AXIS case STEPS_X: if (draw) { - Draw_Menu_Item(row, ICON_StepX, F("X Axis")); - Draw_Float(planner.settings.axis_steps_per_mm[X_AXIS], row, false, STEPS_UNIT); + drawMenuItem(row, ICON_StepX, F("X Axis")); + drawFloat(planner.settings.axis_steps_per_mm[X_AXIS], row, false, STEPS_UNIT); } else - Modify_Value(planner.settings.axis_steps_per_mm[X_AXIS], min_steps_edit_values.x, max_steps_edit_values.x, STEPS_UNIT); + modifyValue(planner.settings.axis_steps_per_mm[X_AXIS], min_steps_edit_values.x, max_steps_edit_values.x, STEPS_UNIT); break; #endif #if HAS_Y_AXIS case STEPS_Y: if (draw) { - Draw_Menu_Item(row, ICON_StepY, F("Y Axis")); - Draw_Float(planner.settings.axis_steps_per_mm[Y_AXIS], row, false, STEPS_UNIT); + drawMenuItem(row, ICON_StepY, F("Y Axis")); + drawFloat(planner.settings.axis_steps_per_mm[Y_AXIS], row, false, STEPS_UNIT); } else - Modify_Value(planner.settings.axis_steps_per_mm[Y_AXIS], min_steps_edit_values.y, max_steps_edit_values.y, STEPS_UNIT); + modifyValue(planner.settings.axis_steps_per_mm[Y_AXIS], min_steps_edit_values.y, max_steps_edit_values.y, STEPS_UNIT); break; #endif #if HAS_Z_AXIS case STEPS_Z: if (draw) { - Draw_Menu_Item(row, ICON_StepZ, F("Z Axis")); - Draw_Float(planner.settings.axis_steps_per_mm[Z_AXIS], row, false, STEPS_UNIT); + drawMenuItem(row, ICON_StepZ, F("Z Axis")); + drawFloat(planner.settings.axis_steps_per_mm[Z_AXIS], row, false, STEPS_UNIT); } else - Modify_Value(planner.settings.axis_steps_per_mm[Z_AXIS], min_steps_edit_values.z, max_steps_edit_values.z, STEPS_UNIT); + modifyValue(planner.settings.axis_steps_per_mm[Z_AXIS], min_steps_edit_values.z, max_steps_edit_values.z, STEPS_UNIT); break; #endif #if HAS_HOTEND case STEPS_E: if (draw) { - Draw_Menu_Item(row, ICON_StepE, F("Extruder")); - Draw_Float(planner.settings.axis_steps_per_mm[E_AXIS], row, false, STEPS_UNIT); + drawMenuItem(row, ICON_StepE, F("Extruder")); + drawFloat(planner.settings.axis_steps_per_mm[E_AXIS], row, false, STEPS_UNIT); } else - Modify_Value(planner.settings.axis_steps_per_mm[E_AXIS], min_steps_edit_values.e, max_steps_edit_values.e, STEPS_UNIT); + modifyValue(planner.settings.axis_steps_per_mm[E_AXIS], min_steps_edit_values.e, max_steps_edit_values.e, STEPS_UNIT); break; #endif } @@ -2596,39 +2580,39 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case VISUAL_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else - Draw_Menu(Control, CONTROL_VISUAL); + drawMenu(Control, CONTROL_VISUAL); break; case VISUAL_BACKLIGHT: if (draw) - Draw_Menu_Item(row, ICON_Brightness, F("Display Off")); + drawMenuItem(row, ICON_Brightness, F("Display Off")); else ui.set_brightness(0); break; case VISUAL_BRIGHTNESS: if (draw) { - Draw_Menu_Item(row, ICON_Brightness, F("LCD Brightness")); - Draw_Float(ui.brightness, row, false, 1); + drawMenuItem(row, ICON_Brightness, F("LCD Brightness")); + drawFloat(ui.brightness, row, false, 1); } else - Modify_Value(ui.brightness, LCD_BRIGHTNESS_MIN, LCD_BRIGHTNESS_MAX, 1, ui.refresh_brightness); + modifyValue(ui.brightness, LCD_BRIGHTNESS_MIN, LCD_BRIGHTNESS_MAX, 1, ui.refresh_brightness); break; case VISUAL_TIME_FORMAT: if (draw) { - Draw_Menu_Item(row, ICON_PrintTime, F("Progress as __h__m")); - Draw_Checkbox(row, eeprom_settings.time_format_textual); + drawMenuItem(row, ICON_PrintTime, F("Progress as __h__m")); + drawCheckbox(row, eeprom_settings.time_format_textual); } else { eeprom_settings.time_format_textual = !eeprom_settings.time_format_textual; - Draw_Checkbox(row, eeprom_settings.time_format_textual); + drawCheckbox(row, eeprom_settings.time_format_textual); } break; case VISUAL_COLOR_THEMES: if (draw) - Draw_Menu_Item(row, ICON_MaxSpeed, F("UI Color Settings"), nullptr, true); + drawMenuItem(row, ICON_MaxSpeed, F("UI Color Settings"), nullptr, true); else - Draw_Menu(ColorSettings); + drawMenu(ColorSettings); break; } break; @@ -2652,97 +2636,97 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case COLORSETTINGS_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else - Draw_Menu(Visual, VISUAL_COLOR_THEMES); + drawMenu(Visual, VISUAL_COLOR_THEMES); break; case COLORSETTINGS_CURSOR: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, F("Cursor")); - Draw_Option(eeprom_settings.cursor_color, color_names, row, false, true); + drawMenuItem(row, ICON_MaxSpeed, F("Cursor")); + drawOption(eeprom_settings.cursor_color, color_names, row, false, true); } else - Modify_Option(eeprom_settings.cursor_color, color_names, Custom_Colors); + modifyOption(eeprom_settings.cursor_color, color_names, Custom_Colors); break; case COLORSETTINGS_SPLIT_LINE: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, F("Menu Split Line")); - Draw_Option(eeprom_settings.menu_split_line, color_names, row, false, true); + drawMenuItem(row, ICON_MaxSpeed, F("Menu Split Line")); + drawOption(eeprom_settings.menu_split_line, color_names, row, false, true); } else - Modify_Option(eeprom_settings.menu_split_line, color_names, Custom_Colors); + modifyOption(eeprom_settings.menu_split_line, color_names, Custom_Colors); break; case COLORSETTINGS_MENU_TOP_TXT: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, F("Menu Header Text")); - Draw_Option(eeprom_settings.menu_top_txt, color_names, row, false, true); + drawMenuItem(row, ICON_MaxSpeed, F("Menu Header Text")); + drawOption(eeprom_settings.menu_top_txt, color_names, row, false, true); } else - Modify_Option(eeprom_settings.menu_top_txt, color_names, Custom_Colors); + modifyOption(eeprom_settings.menu_top_txt, color_names, Custom_Colors); break; case COLORSETTINGS_MENU_TOP_BG: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, F("Menu Header Bg")); - Draw_Option(eeprom_settings.menu_top_bg, color_names, row, false, true); + drawMenuItem(row, ICON_MaxSpeed, F("Menu Header Bg")); + drawOption(eeprom_settings.menu_top_bg, color_names, row, false, true); } else - Modify_Option(eeprom_settings.menu_top_bg, color_names, Custom_Colors); + modifyOption(eeprom_settings.menu_top_bg, color_names, Custom_Colors); break; case COLORSETTINGS_HIGHLIGHT_BORDER: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, F("Highlight Box")); - Draw_Option(eeprom_settings.highlight_box, color_names, row, false, true); + drawMenuItem(row, ICON_MaxSpeed, F("Highlight Box")); + drawOption(eeprom_settings.highlight_box, color_names, row, false, true); } else - Modify_Option(eeprom_settings.highlight_box, color_names, Custom_Colors); + modifyOption(eeprom_settings.highlight_box, color_names, Custom_Colors); break; case COLORSETTINGS_PROGRESS_PERCENT: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, F("Progress Percent")); - Draw_Option(eeprom_settings.progress_percent, color_names, row, false, true); + drawMenuItem(row, ICON_MaxSpeed, F("Progress Percent")); + drawOption(eeprom_settings.progress_percent, color_names, row, false, true); } else - Modify_Option(eeprom_settings.progress_percent, color_names, Custom_Colors); + modifyOption(eeprom_settings.progress_percent, color_names, Custom_Colors); break; case COLORSETTINGS_PROGRESS_TIME: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, F("Progress Time")); - Draw_Option(eeprom_settings.progress_time, color_names, row, false, true); + drawMenuItem(row, ICON_MaxSpeed, F("Progress Time")); + drawOption(eeprom_settings.progress_time, color_names, row, false, true); } else - Modify_Option(eeprom_settings.progress_time, color_names, Custom_Colors); + modifyOption(eeprom_settings.progress_time, color_names, Custom_Colors); break; case COLORSETTINGS_PROGRESS_STATUS_BAR: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, F("Status Bar Text")); - Draw_Option(eeprom_settings.status_bar_text, color_names, row, false, true); + drawMenuItem(row, ICON_MaxSpeed, F("Status Bar Text")); + drawOption(eeprom_settings.status_bar_text, color_names, row, false, true); } else - Modify_Option(eeprom_settings.status_bar_text, color_names, Custom_Colors); + modifyOption(eeprom_settings.status_bar_text, color_names, Custom_Colors); break; case COLORSETTINGS_PROGRESS_STATUS_AREA: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, F("Status Area Text")); - Draw_Option(eeprom_settings.status_area_text, color_names, row, false, true); + drawMenuItem(row, ICON_MaxSpeed, F("Status Area Text")); + drawOption(eeprom_settings.status_area_text, color_names, row, false, true); } else - Modify_Option(eeprom_settings.status_area_text, color_names, Custom_Colors); + modifyOption(eeprom_settings.status_area_text, color_names, Custom_Colors); break; case COLORSETTINGS_PROGRESS_COORDINATES: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, F("Coordinates Text")); - Draw_Option(eeprom_settings.coordinates_text, color_names, row, false, true); + drawMenuItem(row, ICON_MaxSpeed, F("Coordinates Text")); + drawOption(eeprom_settings.coordinates_text, color_names, row, false, true); } else - Modify_Option(eeprom_settings.coordinates_text, color_names, Custom_Colors); + modifyOption(eeprom_settings.coordinates_text, color_names, Custom_Colors); break; case COLORSETTINGS_PROGRESS_COORDINATES_LINE: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, F("Coordinates Line")); - Draw_Option(eeprom_settings.coordinates_split_line, color_names, row, false, true); + drawMenuItem(row, ICON_MaxSpeed, F("Coordinates Line")); + drawOption(eeprom_settings.coordinates_split_line, color_names, row, false, true); } else - Modify_Option(eeprom_settings.coordinates_split_line, color_names, Custom_Colors); + modifyOption(eeprom_settings.coordinates_split_line, color_names, Custom_Colors); break; } // switch (item) break; @@ -2766,20 +2750,20 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case ADVANCED_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else - Draw_Menu(Control, CONTROL_ADVANCED); + drawMenu(Control, CONTROL_ADVANCED); break; #if ENABLED(SOUND_MENU_ITEM) case ADVANCED_BEEPER: if (draw) { - Draw_Menu_Item(row, ICON_Version, F("LCD Beeper")); - Draw_Checkbox(row, ui.sound_on); + drawMenuItem(row, ICON_Version, F("LCD Beeper")); + drawCheckbox(row, ui.sound_on); } else { ui.sound_on = !ui.sound_on; - Draw_Checkbox(row, ui.sound_on); + drawCheckbox(row, ui.sound_on); } break; #endif @@ -2787,68 +2771,68 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item #if HAS_BED_PROBE case ADVANCED_PROBE: if (draw) - Draw_Menu_Item(row, ICON_StepX, F("Probe"), nullptr, true); + drawMenuItem(row, ICON_StepX, F("Probe"), nullptr, true); else - Draw_Menu(ProbeMenu); + drawMenu(ProbeMenu); break; #endif #if HAS_TRINAMIC_CONFIG case ADVANCED_TMC: if (draw) - Draw_Menu_Item(row, ICON_Motion, F("TMC Drivers"), nullptr, true); + drawMenuItem(row, ICON_Motion, F("TMC Drivers"), nullptr, true); else - Draw_Menu(TMCMenu); + drawMenu(TMCMenu); break; #endif case ADVANCED_CORNER: if (draw) { - Draw_Menu_Item(row, ICON_MaxAccelerated, F("Bed Screw Inset")); - Draw_Float(corner_pos, row, false, 10); + drawMenuItem(row, ICON_MaxAccelerated, F("Bed Screw Inset")); + drawFloat(corner_pos, row, false, 10); } else - Modify_Value(corner_pos, 1, 100, 10); + modifyValue(corner_pos, 1, 100, 10); break; #if ENABLED(LIN_ADVANCE) case ADVANCED_LA: if (draw) { - Draw_Menu_Item(row, ICON_MaxAccelerated, F("Lin Advance K")); - Draw_Float(planner.extruder_advance_K[0], row, false, 100); + drawMenuItem(row, ICON_MaxAccelerated, F("Lin Advance K")); + drawFloat(planner.extruder_advance_K[0], row, false, 100); } else - Modify_Value(planner.extruder_advance_K[0], 0, 10, 100); + modifyValue(planner.extruder_advance_K[0], 0, 10, 100); break; #endif #if ENABLED(ADVANCED_PAUSE_FEATURE) case ADVANCED_LOAD: if (draw) { - Draw_Menu_Item(row, ICON_WriteEEPROM, F("Load Length")); - Draw_Float(fc_settings[0].load_length, row, false, 1); + drawMenuItem(row, ICON_WriteEEPROM, F("Load Length")); + drawFloat(fc_settings[0].load_length, row, false, 1); } else - Modify_Value(fc_settings[0].load_length, 0, EXTRUDE_MAXLENGTH, 1); + modifyValue(fc_settings[0].load_length, 0, EXTRUDE_MAXLENGTH, 1); break; case ADVANCED_UNLOAD: if (draw) { - Draw_Menu_Item(row, ICON_ReadEEPROM, F("Unload Length")); - Draw_Float(fc_settings[0].unload_length, row, false, 1); + drawMenuItem(row, ICON_ReadEEPROM, F("Unload Length")); + drawFloat(fc_settings[0].unload_length, row, false, 1); } else - Modify_Value(fc_settings[0].unload_length, 0, EXTRUDE_MAXLENGTH, 1); + modifyValue(fc_settings[0].unload_length, 0, EXTRUDE_MAXLENGTH, 1); break; #endif // ADVANCED_PAUSE_FEATURE #if ENABLED(PREVENT_COLD_EXTRUSION) case ADVANCED_COLD_EXTRUDE: if (draw) { - Draw_Menu_Item(row, ICON_Cool, F("Min Extrusion T")); - Draw_Float(thermalManager.extrude_min_temp, row, false, 1); + drawMenuItem(row, ICON_Cool, F("Min Extrusion T")); + drawFloat(thermalManager.extrude_min_temp, row, false, 1); } else { - Modify_Value(thermalManager.extrude_min_temp, 0, MAX_E_TEMP, 1); + modifyValue(thermalManager.extrude_min_temp, 0, MAX_E_TEMP, 1); thermalManager.allow_cold_extrude = (thermalManager.extrude_min_temp == 0); } break; @@ -2857,23 +2841,23 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item #if ENABLED(FILAMENT_RUNOUT_SENSOR) case ADVANCED_FILSENSORENABLED: if (draw) { - Draw_Menu_Item(row, ICON_Extruder, F("Filament Sensor")); - Draw_Checkbox(row, runout.enabled); + drawMenuItem(row, ICON_Extruder, F("Filament Sensor")); + drawCheckbox(row, runout.enabled); } else { runout.enabled = !runout.enabled; - Draw_Checkbox(row, runout.enabled); + drawCheckbox(row, runout.enabled); } break; #if ENABLED(HAS_FILAMENT_RUNOUT_DISTANCE) case ADVANCED_FILSENSORDISTANCE: if (draw) { - Draw_Menu_Item(row, ICON_MaxAccE, F("Runout Distance")); - Draw_Float(runout.runout_distance(), row, false, 10); + drawMenuItem(row, ICON_MaxAccE, F("Runout Distance")); + drawFloat(runout.runout_distance(), row, false, 10); } else - Modify_Value(runout.runout_distance(), 0, 999, 10); + modifyValue(runout.runout_distance(), 0, 999, 10); break; #endif #endif // FILAMENT_RUNOUT_SENSOR @@ -2881,12 +2865,12 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item #if ENABLED(POWER_LOSS_RECOVERY) case ADVANCED_POWER_LOSS: if (draw) { - Draw_Menu_Item(row, ICON_Motion, F("Power-loss recovery")); - Draw_Checkbox(row, recovery.enabled); + drawMenuItem(row, ICON_Motion, F("Power-loss recovery")); + drawCheckbox(row, recovery.enabled); } else { recovery.enable(!recovery.enabled); - Draw_Checkbox(row, recovery.enabled); + drawCheckbox(row, recovery.enabled); } break; #endif @@ -2908,30 +2892,30 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case PROBE_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else - Draw_Menu(Advanced, ADVANCED_PROBE); + drawMenu(Advanced, ADVANCED_PROBE); break; case PROBE_XOFFSET: if (draw) { - Draw_Menu_Item(row, ICON_StepX, F("Probe X Offset")); - Draw_Float(probe.offset.x, row, false, 10); + drawMenuItem(row, ICON_StepX, F("Probe X Offset")); + drawFloat(probe.offset.x, row, false, 10); } else - Modify_Value(probe.offset.x, -MAX_XY_OFFSET, MAX_XY_OFFSET, 10); + modifyValue(probe.offset.x, -MAX_XY_OFFSET, MAX_XY_OFFSET, 10); break; case PROBE_YOFFSET: if (draw) { - Draw_Menu_Item(row, ICON_StepY, F("Probe Y Offset")); - Draw_Float(probe.offset.y, row, false, 10); + drawMenuItem(row, ICON_StepY, F("Probe Y Offset")); + drawFloat(probe.offset.y, row, false, 10); } else - Modify_Value(probe.offset.y, -MAX_XY_OFFSET, MAX_XY_OFFSET, 10); + modifyValue(probe.offset.y, -MAX_XY_OFFSET, MAX_XY_OFFSET, 10); break; case PROBE_TEST: if (draw) - Draw_Menu_Item(row, ICON_StepY, F("M48 Probe Test")); + drawMenuItem(row, ICON_StepY, F("M48 Probe Test")); else { sprintf_P(cmd, PSTR("G28O\nM48 X%s Y%s P%i"), dtostrf((X_BED_SIZE + X_MIN_POS) / 2.0f, 1, 3, str_1), dtostrf((Y_BED_SIZE + Y_MIN_POS) / 2.0f, 1, 3, str_2), testcount); gcode.process_subcommands_now(cmd); @@ -2939,11 +2923,11 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item break; case PROBE_TEST_COUNT: if (draw) { - Draw_Menu_Item(row, ICON_StepY, F("Probe Test Count")); - Draw_Float(testcount, row, false, 1); + drawMenuItem(row, ICON_StepY, F("Probe Test Count")); + drawFloat(testcount, row, false, 1); } else - Modify_Value(testcount, 4, 50, 1); + modifyValue(testcount, 4, 50, 1); break; } break; @@ -2963,9 +2947,9 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item case TMC_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else - Draw_Menu(Advanced, ADVANCED_TMC); + drawMenu(Advanced, ADVANCED_TMC); break; #if AXIS_IS_TMC(X) @@ -2974,12 +2958,12 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item static float stepper_current_x; if (draw) { - Draw_Menu_Item(row, ICON_StepX, F("Stepper X current")); + drawMenuItem(row, ICON_StepX, F("Stepper X current")); stepper_current_x = stepperX.getMilliamps(); - Draw_Float(stepper_current_x, row, false, 1); + drawFloat(stepper_current_x, row, false, 1); } else { - Modify_Value(stepper_current_x, TMC_MIN_CURRENT, TMC_MAX_CURRENT, 1, []{ stepperX.rms_current(stepper_current_x); }); + modifyValue(stepper_current_x, TMC_MIN_CURRENT, TMC_MAX_CURRENT, 1, []{ stepperX.rms_current(stepper_current_x); }); } break; #endif @@ -2990,12 +2974,12 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item static float stepper_current_y; if (draw) { - Draw_Menu_Item(row, ICON_StepY, F("Stepper Y current")); + drawMenuItem(row, ICON_StepY, F("Stepper Y current")); stepper_current_y = stepperY.getMilliamps(); - Draw_Float(stepper_current_y, row, false, 1); + drawFloat(stepper_current_y, row, false, 1); } else { - Modify_Value(stepper_current_y, TMC_MIN_CURRENT, TMC_MAX_CURRENT, 1, []{ stepperY.rms_current(stepper_current_y); }); + modifyValue(stepper_current_y, TMC_MIN_CURRENT, TMC_MAX_CURRENT, 1, []{ stepperY.rms_current(stepper_current_y); }); } break; #endif @@ -3006,12 +2990,12 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item static float stepper_current_z; if (draw) { - Draw_Menu_Item(row, ICON_StepZ, F("Stepper Z current")); + drawMenuItem(row, ICON_StepZ, F("Stepper Z current")); stepper_current_z = stepperZ.getMilliamps(); - Draw_Float(stepper_current_z, row, false, 1); + drawFloat(stepper_current_z, row, false, 1); } else { - Modify_Value(stepper_current_z, TMC_MIN_CURRENT, TMC_MAX_CURRENT, 1, []{ stepperZ.rms_current(stepper_current_z); }); + modifyValue(stepper_current_z, TMC_MIN_CURRENT, TMC_MAX_CURRENT, 1, []{ stepperZ.rms_current(stepper_current_z); }); } break; #endif @@ -3022,12 +3006,12 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item static float stepper_current_e; if (draw) { - Draw_Menu_Item(row, ICON_StepE, F("Stepper E current")); + drawMenuItem(row, ICON_StepE, F("Stepper E current")); stepper_current_e = stepperE0.getMilliamps(); - Draw_Float(stepper_current_e, row, false, 1); + drawFloat(stepper_current_e, row, false, 1); } else { - Modify_Value(stepper_current_e, TMC_MIN_CURRENT, TMC_MAX_CURRENT, 1, []{ stepperE0.rms_current(stepper_current_e); }); + modifyValue(stepper_current_e, TMC_MIN_CURRENT, TMC_MAX_CURRENT, 1, []{ stepperE0.rms_current(stepper_current_e); }); } break; #endif @@ -3049,7 +3033,7 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case INFO_BACK: if (draw) { - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); #if ENABLED(PRINTCOUNTER) char row1[50], row2[50], buf[32]; @@ -3057,24 +3041,24 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item sprintf_P(row1, PSTR("%i prints, %i finished"), ps.totalPrints, ps.finishedPrints); sprintf_P(row2, PSTR("%s m filament used"), dtostrf(ps.filamentUsed / 1000, 1, 2, str_1)); - Draw_Menu_Item(INFO_PRINTCOUNT, ICON_HotendTemp, row1, row2, false, true); + drawMenuItem(INFO_PRINTCOUNT, ICON_HotendTemp, row1, row2, false, true); duration_t(print_job_timer.getStats().printTime).toString(buf); sprintf_P(row1, PSTR("Printed: %s"), buf); duration_t(print_job_timer.getStats().longestPrint).toString(buf); sprintf_P(row2, PSTR("Longest: %s"), buf); - Draw_Menu_Item(INFO_PRINTTIME, ICON_PrintTime, row1, row2, false, true); + drawMenuItem(INFO_PRINTTIME, ICON_PrintTime, row1, row2, false, true); #endif - Draw_Menu_Item(INFO_SIZE, ICON_PrintSize, F(MACHINE_SIZE), nullptr, false, true); - Draw_Menu_Item(INFO_VERSION, ICON_Version, F(SHORT_BUILD_VERSION), nullptr, false, true); - Draw_Menu_Item(INFO_CONTACT, ICON_Contact, F(CORP_WEBSITE), nullptr, false, true); + drawMenuItem(INFO_SIZE, ICON_PrintSize, F(MACHINE_SIZE), nullptr, false, true); + drawMenuItem(INFO_VERSION, ICON_Version, F(SHORT_BUILD_VERSION), nullptr, false, true); + drawMenuItem(INFO_CONTACT, ICON_Contact, F(CORP_WEBSITE), nullptr, false, true); } else { if (menu == Info) - Draw_Menu(Control, CONTROL_INFO); + drawMenu(Control, CONTROL_INFO); else - Draw_Main_Menu(3); + drawMainMenu(3); } break; } @@ -3098,40 +3082,40 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case LEVELING_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else - Draw_Main_Menu(3); + drawMainMenu(3); break; case LEVELING_ACTIVE: if (draw) { - Draw_Menu_Item(row, ICON_StockConfiguration, F("Leveling Active")); - Draw_Checkbox(row, planner.leveling_active); + drawMenuItem(row, ICON_StockConfiguration, F("Leveling Active")); + drawCheckbox(row, planner.leveling_active); } else { if (!planner.leveling_active) { set_bed_leveling_enabled(!planner.leveling_active); if (!planner.leveling_active) { - Confirm_Handler(LevelError); + confirmHandler(LevelError); break; } } else set_bed_leveling_enabled(!planner.leveling_active); - Draw_Checkbox(row, planner.leveling_active); + drawCheckbox(row, planner.leveling_active); } break; #if ALL(HAS_BED_PROBE, AUTO_BED_LEVELING_UBL) case LEVELING_GET_TILT: if (draw) - Draw_Menu_Item(row, ICON_Tilt, F("Autotilt Current Mesh")); + drawMenuItem(row, ICON_Tilt, F("Autotilt Current Mesh")); else { if (bedlevel.storage_slot < 0) { - Popup_Handler(MeshSlot); + popupHandler(MeshSlot); break; } - Popup_Handler(Home); + popupHandler(Home); gcode.home_all_axes(true); - Popup_Handler(Level); + popupHandler(Level); if (mesh_conf.tilt_grid > 1) { sprintf_P(cmd, PSTR("G29 J%i"), mesh_conf.tilt_grid); gcode.process_subcommands_now(cmd); @@ -3139,78 +3123,78 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item else gcode.process_subcommands_now(F("G29 J")); planner.synchronize(); - Redraw_Menu(); + redrawMenu(); } break; #endif case LEVELING_GET_MESH: if (draw) - Draw_Menu_Item(row, ICON_Mesh, F("Create New Mesh")); + drawMenuItem(row, ICON_Mesh, F("Create New Mesh")); else { - Popup_Handler(Home); + popupHandler(Home); gcode.home_all_axes(true); #if ENABLED(AUTO_BED_LEVELING_UBL) #if ENABLED(PREHEAT_BEFORE_LEVELING) - Popup_Handler(Heating); + popupHandler(Heating); probe.preheat_for_probing(LEVELING_NOZZLE_TEMP, LEVELING_BED_TEMP); #endif #if HAS_BED_PROBE - Popup_Handler(Level); + popupHandler(Level); gcode.process_subcommands_now(F("G29 P0\nG29 P1")); gcode.process_subcommands_now(F("G29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nG29 P3\nM420 S1")); planner.synchronize(); - Update_Status("Probed all reachable points"); - Popup_Handler(SaveLevel); + updateStatus("Probed all reachable points"); + popupHandler(SaveLevel); #else level_state = planner.leveling_active; set_bed_leveling_enabled(false); mesh_conf.goto_mesh_value = true; mesh_conf.mesh_x = mesh_conf.mesh_y = 0; - Popup_Handler(MoveWait); + popupHandler(MoveWait); mesh_conf.manual_mesh_move(); - Draw_Menu(UBLMesh); + drawMenu(UBLMesh); #endif #elif HAS_BED_PROBE - Popup_Handler(Level); + popupHandler(Level); gcode.process_subcommands_now(F("G29")); planner.synchronize(); - Popup_Handler(SaveLevel); + popupHandler(SaveLevel); #else level_state = planner.leveling_active; set_bed_leveling_enabled(false); gridpoint = 1; - Popup_Handler(MoveWait); + popupHandler(MoveWait); gcode.process_subcommands_now(F("G29")); planner.synchronize(); - Draw_Menu(ManualMesh); + drawMenu(ManualMesh); #endif } break; case LEVELING_MANUAL: if (draw) - Draw_Menu_Item(row, ICON_Mesh, F("Manual Tuning"), nullptr, true); + drawMenuItem(row, ICON_Mesh, F("Manual Tuning"), nullptr, true); else { #if ENABLED(AUTO_BED_LEVELING_BILINEAR) if (!leveling_is_valid()) { - Confirm_Handler(InvalidMesh); + confirmHandler(InvalidMesh); break; } #endif #if ENABLED(AUTO_BED_LEVELING_UBL) if (bedlevel.storage_slot < 0) { - Popup_Handler(MeshSlot); + popupHandler(MeshSlot); break; } #endif if (axes_should_home()) { - Popup_Handler(Home); + popupHandler(Home); gcode.home_all_axes(true); } level_state = planner.leveling_active; set_bed_leveling_enabled(false); mesh_conf.goto_mesh_value = false; #if ENABLED(PREHEAT_BEFORE_LEVELING) - Popup_Handler(Heating); + popupHandler(Heating); #if HAS_HOTEND if (thermalManager.degTargetHotend(0) < LEVELING_NOZZLE_TEMP) thermalManager.setTargetHotend(LEVELING_NOZZLE_TEMP, 0); @@ -3222,63 +3206,63 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item TERN_(HAS_HOTEND, thermalManager.wait_for_hotend(0)); TERN_(HAS_HEATED_BED, thermalManager.wait_for_bed_heating()); #endif - Popup_Handler(MoveWait); + popupHandler(MoveWait); mesh_conf.manual_mesh_move(); - Draw_Menu(LevelManual); + drawMenu(LevelManual); } break; case LEVELING_VIEW: if (draw) - Draw_Menu_Item(row, ICON_Mesh, GET_TEXT_F(MSG_MESH_VIEW), nullptr, true); + drawMenuItem(row, ICON_Mesh, GET_TEXT_F(MSG_MESH_VIEW), nullptr, true); else { #if ENABLED(AUTO_BED_LEVELING_UBL) if (bedlevel.storage_slot < 0) { - Popup_Handler(MeshSlot); + popupHandler(MeshSlot); break; } #endif - Draw_Menu(LevelView); + drawMenu(LevelView); } break; case LEVELING_SETTINGS: if (draw) - Draw_Menu_Item(row, ICON_Step, F("Leveling Settings"), nullptr, true); + drawMenuItem(row, ICON_Step, F("Leveling Settings"), nullptr, true); else - Draw_Menu(LevelSettings); + drawMenu(LevelSettings); break; #if ENABLED(AUTO_BED_LEVELING_UBL) case LEVELING_SLOT: if (draw) { - Draw_Menu_Item(row, ICON_PrintSize, F("Mesh Slot")); - Draw_Float(bedlevel.storage_slot, row, false, 1); + drawMenuItem(row, ICON_PrintSize, F("Mesh Slot")); + drawFloat(bedlevel.storage_slot, row, false, 1); } else - Modify_Value(bedlevel.storage_slot, 0, settings.calc_num_meshes() - 1, 1); + modifyValue(bedlevel.storage_slot, 0, settings.calc_num_meshes() - 1, 1); break; case LEVELING_LOAD: if (draw) - Draw_Menu_Item(row, ICON_ReadEEPROM, F("Load Mesh")); + drawMenuItem(row, ICON_ReadEEPROM, F("Load Mesh")); else { if (bedlevel.storage_slot < 0) { - Popup_Handler(MeshSlot); + popupHandler(MeshSlot); break; } gcode.process_subcommands_now(F("G29 L")); planner.synchronize(); - AudioFeedback(true); + audioFeedback(true); } break; case LEVELING_SAVE: if (draw) - Draw_Menu_Item(row, ICON_WriteEEPROM, F("Save Mesh")); + drawMenuItem(row, ICON_WriteEEPROM, F("Save Mesh")); else { if (bedlevel.storage_slot < 0) { - Popup_Handler(MeshSlot); + popupHandler(MeshSlot); break; } gcode.process_subcommands_now(F("G29 S")); planner.synchronize(); - AudioFeedback(true); + audioFeedback(true); } break; #endif @@ -3296,34 +3280,34 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case LEVELING_VIEW_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else - Draw_Menu(Leveling, LEVELING_VIEW); + drawMenu(Leveling, LEVELING_VIEW); break; case LEVELING_VIEW_MESH: if (draw) - Draw_Menu_Item(row, ICON_PrintSize, GET_TEXT_F(MSG_MESH_VIEW), nullptr, true); + drawMenuItem(row, ICON_PrintSize, GET_TEXT_F(MSG_MESH_VIEW), nullptr, true); else - Draw_Menu(MeshViewer); + drawMenu(MeshViewer); break; case LEVELING_VIEW_TEXT: if (draw) { - Draw_Menu_Item(row, ICON_Contact, F("Viewer Show Values")); - Draw_Checkbox(row, mesh_conf.viewer_print_value); + drawMenuItem(row, ICON_Contact, F("Viewer Show Values")); + drawCheckbox(row, mesh_conf.viewer_print_value); } else { mesh_conf.viewer_print_value = !mesh_conf.viewer_print_value; - Draw_Checkbox(row, mesh_conf.viewer_print_value); + drawCheckbox(row, mesh_conf.viewer_print_value); } break; case LEVELING_VIEW_ASYMMETRIC: if (draw) { - Draw_Menu_Item(row, ICON_Axis, F("Viewer Asymmetric")); - Draw_Checkbox(row, mesh_conf.viewer_asymmetric_range); + drawMenuItem(row, ICON_Axis, F("Viewer Asymmetric")); + drawCheckbox(row, mesh_conf.viewer_asymmetric_range); } else { mesh_conf.viewer_asymmetric_range = !mesh_conf.viewer_asymmetric_range; - Draw_Checkbox(row, mesh_conf.viewer_asymmetric_range); + drawCheckbox(row, mesh_conf.viewer_asymmetric_range); } break; } @@ -3342,17 +3326,17 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case LEVELING_SETTINGS_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else - Draw_Menu(Leveling, LEVELING_SETTINGS); + drawMenu(Leveling, LEVELING_SETTINGS); break; case LEVELING_SETTINGS_FADE: if (draw) { - Draw_Menu_Item(row, ICON_Fade, F("Fade Mesh within")); - Draw_Float(planner.z_fade_height, row, false, 1); + drawMenuItem(row, ICON_Fade, F("Fade Mesh within")); + drawFloat(planner.z_fade_height, row, false, 1); } else { - Modify_Value(planner.z_fade_height, 0, Z_MAX_POS, 1); + modifyValue(planner.z_fade_height, 0, Z_MAX_POS, 1); planner.z_fade_height = -1; set_z_fade_height(planner.z_fade_height); } @@ -3361,31 +3345,31 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item #if ENABLED(AUTO_BED_LEVELING_UBL) case LEVELING_SETTINGS_TILT: if (draw) { - Draw_Menu_Item(row, ICON_Tilt, F("Tilting Grid Size")); - Draw_Float(mesh_conf.tilt_grid, row, false, 1); + drawMenuItem(row, ICON_Tilt, F("Tilting Grid Size")); + drawFloat(mesh_conf.tilt_grid, row, false, 1); } else - Modify_Value(mesh_conf.tilt_grid, 1, 8, 1); + modifyValue(mesh_conf.tilt_grid, 1, 8, 1); break; case LEVELING_SETTINGS_PLANE: if (draw) - Draw_Menu_Item(row, ICON_ResumeEEPROM, F("Convert Mesh to Plane")); + drawMenuItem(row, ICON_ResumeEEPROM, F("Convert Mesh to Plane")); else { if (mesh_conf.create_plane_from_mesh()) break; gcode.process_subcommands_now(F("M420 S1")); planner.synchronize(); - AudioFeedback(true); + audioFeedback(true); } break; case LEVELING_SETTINGS_ZERO: if (draw) - Draw_Menu_Item(row, ICON_Mesh, F("Zero Current Mesh")); + drawMenuItem(row, ICON_Mesh, F("Zero Current Mesh")); else ZERO(bedlevel.z_values); break; case LEVELING_SETTINGS_UNDEF: if (draw) - Draw_Menu_Item(row, ICON_Mesh, F("Clear Current Mesh")); + drawMenuItem(row, ICON_Mesh, F("Clear Current Mesh")); else bedlevel.invalidate(); break; @@ -3399,13 +3383,13 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item if (item == MESHVIEW_BACK) { if (draw) { - Draw_Menu_Item(0, ICON_Back, F("Back")); - mesh_conf.Draw_Bed_Mesh(); - mesh_conf.Set_Mesh_Viewer_Status(); + drawMenuItem(0, ICON_Back, F("Back")); + mesh_conf.drawBedMesh(); + mesh_conf.setMeshViewerStatus(); } else if (!mesh_conf.drawing_mesh) { - Draw_Menu(LevelView, LEVELING_VIEW_MESH); - Update_Status(""); + drawMenu(LevelView, LEVELING_VIEW_MESH); + updateStatus(""); } } break; @@ -3426,32 +3410,32 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case LEVELING_M_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else { set_bed_leveling_enabled(level_state); TERN_(AUTO_BED_LEVELING_BILINEAR, bedlevel.refresh_bed_level()); - Draw_Menu(Leveling, LEVELING_MANUAL); + drawMenu(Leveling, LEVELING_MANUAL); } break; case LEVELING_M_X: if (draw) { - Draw_Menu_Item(row, ICON_MoveX, F("Mesh Point X")); - Draw_Float(mesh_conf.mesh_x, row, 0, 1); + drawMenuItem(row, ICON_MoveX, F("Mesh Point X")); + drawFloat(mesh_conf.mesh_x, row, 0, 1); } else - Modify_Value(mesh_conf.mesh_x, 0, GRID_MAX_POINTS_X - 1, 1); + modifyValue(mesh_conf.mesh_x, 0, GRID_MAX_POINTS_X - 1, 1); break; case LEVELING_M_Y: if (draw) { - Draw_Menu_Item(row, ICON_MoveY, F("Mesh Point Y")); - Draw_Float(mesh_conf.mesh_y, row, 0, 1); + drawMenuItem(row, ICON_MoveY, F("Mesh Point Y")); + drawFloat(mesh_conf.mesh_y, row, 0, 1); } else - Modify_Value(mesh_conf.mesh_y, 0, GRID_MAX_POINTS_Y - 1, 1); + modifyValue(mesh_conf.mesh_y, 0, GRID_MAX_POINTS_Y - 1, 1); break; case LEVELING_M_NEXT: if (draw) - Draw_Menu_Item(row, ICON_More, F("Next Point")); + drawMenuItem(row, ICON_More, F("Next Point")); else { if (mesh_conf.mesh_x != (GRID_MAX_POINTS_X - 1) || mesh_conf.mesh_y != (GRID_MAX_POINTS_Y - 1)) { if ((mesh_conf.mesh_x == (GRID_MAX_POINTS_X - 1) && mesh_conf.mesh_y % 2 == 0) || (mesh_conf.mesh_x == 0 && mesh_conf.mesh_y % 2 == 1)) @@ -3466,58 +3450,58 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item break; case LEVELING_M_OFFSET: if (draw) { - Draw_Menu_Item(row, ICON_SetZOffset, F("Point Z Offset")); - Draw_Float(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], row, false, 100); + drawMenuItem(row, ICON_SetZOffset, F("Point Z Offset")); + drawFloat(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], row, false, 100); } else { if (isnan(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y])) bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y] = 0; - Modify_Value(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], MIN_Z_OFFSET, MAX_Z_OFFSET, 100); + modifyValue(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], MIN_Z_OFFSET, MAX_Z_OFFSET, 100); } break; case LEVELING_M_UP: if (draw) - Draw_Menu_Item(row, ICON_Axis, F("Microstep Up")); + drawMenuItem(row, ICON_Axis, F("Microstep Up")); else if (bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y] < MAX_Z_OFFSET) { bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y] += 0.01; gcode.process_subcommands_now(F("M290 Z0.01")); planner.synchronize(); current_position.z += 0.01f; sync_plan_position(); - Draw_Float(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], row - 1, false, 100); + drawFloat(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], row - 1, false, 100); } break; case LEVELING_M_DOWN: if (draw) - Draw_Menu_Item(row, ICON_AxisD, F("Microstep Down")); + drawMenuItem(row, ICON_AxisD, F("Microstep Down")); else if (bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y] > MIN_Z_OFFSET) { bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y] -= 0.01; gcode.process_subcommands_now(F("M290 Z-0.01")); planner.synchronize(); current_position.z -= 0.01f; sync_plan_position(); - Draw_Float(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], row - 2, false, 100); + drawFloat(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], row - 2, false, 100); } break; case LEVELING_M_GOTO_VALUE: if (draw) { - Draw_Menu_Item(row, ICON_StockConfiguration, F("Go to Mesh Z Value")); - Draw_Checkbox(row, mesh_conf.goto_mesh_value); + drawMenuItem(row, ICON_StockConfiguration, F("Go to Mesh Z Value")); + drawCheckbox(row, mesh_conf.goto_mesh_value); } else { mesh_conf.goto_mesh_value = !mesh_conf.goto_mesh_value; current_position.z = 0; mesh_conf.manual_mesh_move(true); - Draw_Checkbox(row, mesh_conf.goto_mesh_value); + drawCheckbox(row, mesh_conf.goto_mesh_value); } break; #if ENABLED(AUTO_BED_LEVELING_UBL) case LEVELING_M_UNDEF: if (draw) - Draw_Menu_Item(row, ICON_ResumeEEPROM, F("Clear Point Value")); + drawMenuItem(row, ICON_ResumeEEPROM, F("Clear Point Value")); else { mesh_conf.manual_value_update(true); - Redraw_Menu(false); + redrawMenu(false); } break; #endif @@ -3539,18 +3523,18 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case UBL_M_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else { set_bed_leveling_enabled(level_state); - Draw_Menu(Leveling, LEVELING_GET_MESH); + drawMenu(Leveling, LEVELING_GET_MESH); } break; case UBL_M_NEXT: if (draw) { if (mesh_conf.mesh_x != (GRID_MAX_POINTS_X - 1) || mesh_conf.mesh_y != (GRID_MAX_POINTS_Y - 1)) - Draw_Menu_Item(row, ICON_More, F("Next Point")); + drawMenuItem(row, ICON_More, F("Next Point")); else - Draw_Menu_Item(row, ICON_More, F("Save Mesh")); + drawMenuItem(row, ICON_More, F("Save Mesh")); } else { if (mesh_conf.mesh_x != (GRID_MAX_POINTS_X - 1) || mesh_conf.mesh_y != (GRID_MAX_POINTS_Y - 1)) { @@ -3565,14 +3549,14 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item else { gcode.process_subcommands_now(F("G29 S")); planner.synchronize(); - AudioFeedback(true); - Draw_Menu(Leveling, LEVELING_GET_MESH); + audioFeedback(true); + drawMenu(Leveling, LEVELING_GET_MESH); } } break; case UBL_M_PREV: if (draw) - Draw_Menu_Item(row, ICON_More, F("Previous Point")); + drawMenuItem(row, ICON_More, F("Previous Point")); else { if (mesh_conf.mesh_x != 0 || mesh_conf.mesh_y != 0) { if ((mesh_conf.mesh_x == (GRID_MAX_POINTS_X - 1) && mesh_conf.mesh_y % 2 == 1) || (mesh_conf.mesh_x == 0 && mesh_conf.mesh_y % 2 == 0)) @@ -3587,37 +3571,37 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item break; case UBL_M_OFFSET: if (draw) { - Draw_Menu_Item(row, ICON_SetZOffset, F("Point Z Offset")); - Draw_Float(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], row, false, 100); + drawMenuItem(row, ICON_SetZOffset, F("Point Z Offset")); + drawFloat(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], row, false, 100); } else { if (isnan(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y])) bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y] = 0; - Modify_Value(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], MIN_Z_OFFSET, MAX_Z_OFFSET, 100); + modifyValue(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], MIN_Z_OFFSET, MAX_Z_OFFSET, 100); } break; case UBL_M_UP: if (draw) - Draw_Menu_Item(row, ICON_Axis, F("Microstep Up")); + drawMenuItem(row, ICON_Axis, F("Microstep Up")); else if (bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y] < MAX_Z_OFFSET) { bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y] += 0.01; gcode.process_subcommands_now(F("M290 Z0.01")); planner.synchronize(); current_position.z += 0.01f; sync_plan_position(); - Draw_Float(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], row - 1, false, 100); + drawFloat(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], row - 1, false, 100); } break; case UBL_M_DOWN: if (draw) - Draw_Menu_Item(row, ICON_Axis, F("Microstep Down")); + drawMenuItem(row, ICON_Axis, F("Microstep Down")); else if (bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y] > MIN_Z_OFFSET) { bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y] -= 0.01; gcode.process_subcommands_now(F("M290 Z-0.01")); planner.synchronize(); current_position.z -= 0.01f; sync_plan_position(); - Draw_Float(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], row - 2, false, 100); + drawFloat(bedlevel.z_values[mesh_conf.mesh_x][mesh_conf.mesh_y], row - 2, false, 100); } break; } @@ -3638,64 +3622,64 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case MMESH_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Cancel")); + drawMenuItem(row, ICON_Back, F("Cancel")); else { gcode.process_subcommands_now(F("G29 A")); planner.synchronize(); set_bed_leveling_enabled(level_state); - Draw_Menu(Leveling, LEVELING_GET_MESH); + drawMenu(Leveling, LEVELING_GET_MESH); } break; case MMESH_NEXT: if (draw) { if (gridpoint < GRID_MAX_POINTS) - Draw_Menu_Item(row, ICON_More, F("Next Point")); + drawMenuItem(row, ICON_More, F("Next Point")); else - Draw_Menu_Item(row, ICON_More, F("Save Mesh")); + drawMenuItem(row, ICON_More, F("Save Mesh")); } else if (gridpoint < GRID_MAX_POINTS) { - Popup_Handler(MoveWait); + popupHandler(MoveWait); gcode.process_subcommands_now(F("G29")); planner.synchronize(); gridpoint++; - Redraw_Menu(); + redrawMenu(); } else { gcode.process_subcommands_now(F("G29")); planner.synchronize(); - AudioFeedback(settings.save()); - Draw_Menu(Leveling, LEVELING_GET_MESH); + audioFeedback(settings.save()); + drawMenu(Leveling, LEVELING_GET_MESH); } break; case MMESH_OFFSET: if (draw) { - Draw_Menu_Item(row, ICON_SetZOffset, F("Z Position")); + drawMenuItem(row, ICON_SetZOffset, F("Z Position")); current_position.z = MANUAL_PROBE_START_Z; - Draw_Float(current_position.z, row, false, 100); + drawFloat(current_position.z, row, false, 100); } else - Modify_Value(current_position.z, MIN_Z_OFFSET, MAX_Z_OFFSET, 100); + modifyValue(current_position.z, MIN_Z_OFFSET, MAX_Z_OFFSET, 100); break; case MMESH_UP: if (draw) - Draw_Menu_Item(row, ICON_Axis, F("Microstep Up")); + drawMenuItem(row, ICON_Axis, F("Microstep Up")); else if (current_position.z < MAX_Z_OFFSET) { gcode.process_subcommands_now(F("M290 Z0.01")); planner.synchronize(); current_position.z += 0.01f; sync_plan_position(); - Draw_Float(current_position.z, row - 1, false, 100); + drawFloat(current_position.z, row - 1, false, 100); } break; case MMESH_DOWN: if (draw) - Draw_Menu_Item(row, ICON_AxisD, F("Microstep Down")); + drawMenuItem(row, ICON_AxisD, F("Microstep Down")); else if (current_position.z > MIN_Z_OFFSET) { gcode.process_subcommands_now(F("M290 Z-0.01")); planner.synchronize(); current_position.z -= 0.01f; sync_plan_position(); - Draw_Float(current_position.z, row - 2, false, 100); + drawFloat(current_position.z, row - 2, false, 100); } break; case MMESH_OLD: @@ -3710,15 +3694,15 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item const float currval = bedlevel.z_values[mesh_x][mesh_y]; if (draw) { - Draw_Menu_Item(row, ICON_Zoffset, F("Goto Mesh Value")); - Draw_Float(currval, row, false, 100); + drawMenuItem(row, ICON_Zoffset, F("Goto Mesh Value")); + drawFloat(currval, row, false, 100); } else if (!isnan(currval)) { current_position.z = currval; planner.synchronize(); planner.buffer_line(current_position, homing_feedrate(Z_AXIS), active_extruder); planner.synchronize(); - Draw_Float(current_position.z, row - 3, false, 100); + drawFloat(current_position.z, row - 3, false, 100); } break; } @@ -3745,85 +3729,85 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case TUNE_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Back")); + drawMenuItem(row, ICON_Back, F("Back")); else - Draw_Print_Screen(); + drawPrintScreen(); break; case TUNE_SPEED: if (draw) { - Draw_Menu_Item(row, ICON_Speed, F("Print Speed")); - Draw_Float(feedrate_percentage, row, false, 1); + drawMenuItem(row, ICON_Speed, F("Print Speed")); + drawFloat(feedrate_percentage, row, false, 1); } else - Modify_Value(feedrate_percentage, MIN_PRINT_SPEED, MAX_PRINT_SPEED, 1); + modifyValue(feedrate_percentage, MIN_PRINT_SPEED, MAX_PRINT_SPEED, 1); break; #if HAS_HOTEND case TUNE_FLOW: if (draw) { - Draw_Menu_Item(row, ICON_Speed, F("Flow Rate")); - Draw_Float(planner.flow_percentage[0], row, false, 1); + drawMenuItem(row, ICON_Speed, F("Flow Rate")); + drawFloat(planner.flow_percentage[0], row, false, 1); } else - Modify_Value(planner.flow_percentage[0], MIN_FLOW_RATE, MAX_FLOW_RATE, 1, []{ planner.refresh_e_factor(0); }); + modifyValue(planner.flow_percentage[0], MIN_FLOW_RATE, MAX_FLOW_RATE, 1, []{ planner.refresh_e_factor(0); }); break; case TUNE_HOTEND: if (draw) { - Draw_Menu_Item(row, ICON_SetEndTemp, F("Hotend")); - Draw_Float(thermalManager.temp_hotend[0].target, row, false, 1); + drawMenuItem(row, ICON_SetEndTemp, F("Hotend")); + drawFloat(thermalManager.temp_hotend[0].target, row, false, 1); } else - Modify_Value(thermalManager.temp_hotend[0].target, MIN_E_TEMP, MAX_E_TEMP, 1); + modifyValue(thermalManager.temp_hotend[0].target, MIN_E_TEMP, MAX_E_TEMP, 1); break; #endif #if HAS_HEATED_BED case TUNE_BED: if (draw) { - Draw_Menu_Item(row, ICON_SetBedTemp, F("Bed")); - Draw_Float(thermalManager.temp_bed.target, row, false, 1); + drawMenuItem(row, ICON_SetBedTemp, F("Bed")); + drawFloat(thermalManager.temp_bed.target, row, false, 1); } else - Modify_Value(thermalManager.temp_bed.target, MIN_BED_TEMP, MAX_BED_TEMP, 1); + modifyValue(thermalManager.temp_bed.target, MIN_BED_TEMP, MAX_BED_TEMP, 1); break; #endif #if HAS_FAN case TUNE_FAN: if (draw) { - Draw_Menu_Item(row, ICON_FanSpeed, F("Fan")); - Draw_Float(thermalManager.fan_speed[0], row, false, 1); + drawMenuItem(row, ICON_FanSpeed, F("Fan")); + drawFloat(thermalManager.fan_speed[0], row, false, 1); } else - Modify_Value(thermalManager.fan_speed[0], MIN_FAN_SPEED, MAX_FAN_SPEED, 1); + modifyValue(thermalManager.fan_speed[0], MIN_FAN_SPEED, MAX_FAN_SPEED, 1); break; #endif #if HAS_ZOFFSET_ITEM case TUNE_ZOFFSET: if (draw) { - Draw_Menu_Item(row, ICON_FanSpeed, F("Z-Offset")); - Draw_Float(zoffsetvalue, row, false, 100); + drawMenuItem(row, ICON_FanSpeed, F("Z-Offset")); + drawFloat(zoffsetvalue, row, false, 100); } else - Modify_Value(zoffsetvalue, MIN_Z_OFFSET, MAX_Z_OFFSET, 100); + modifyValue(zoffsetvalue, MIN_Z_OFFSET, MAX_Z_OFFSET, 100); break; case TUNE_ZUP: if (draw) - Draw_Menu_Item(row, ICON_Axis, F("Z-Offset Up")); + drawMenuItem(row, ICON_Axis, F("Z-Offset Up")); else if (zoffsetvalue < MAX_Z_OFFSET) { gcode.process_subcommands_now(F("M290 Z0.01")); zoffsetvalue += 0.01; - Draw_Float(zoffsetvalue, row - 1, false, 100); + drawFloat(zoffsetvalue, row - 1, false, 100); } break; case TUNE_ZDOWN: if (draw) - Draw_Menu_Item(row, ICON_AxisD, F("Z-Offset Down")); + drawMenuItem(row, ICON_AxisD, F("Z-Offset Down")); else if (zoffsetvalue > MIN_Z_OFFSET) { gcode.process_subcommands_now(F("M290 Z-0.01")); zoffsetvalue -= 0.01; - Draw_Float(zoffsetvalue, row - 2, false, 100); + drawFloat(zoffsetvalue, row - 2, false, 100); } break; #endif @@ -3831,38 +3815,38 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) case TUNE_CHANGEFIL: if (draw) - Draw_Menu_Item(row, ICON_ResumeEEPROM, GET_TEXT_F(MSG_FILAMENTCHANGE)); + drawMenuItem(row, ICON_ResumeEEPROM, GET_TEXT_F(MSG_FILAMENTCHANGE)); else - Popup_Handler(ConfFilChange); + popupHandler(ConfFilChange); break; #endif #if ENABLED(FILAMENT_RUNOUT_SENSOR) case TUNE_FILSENSORENABLED: if (draw) { - Draw_Menu_Item(row, ICON_Extruder, F("Filament Sensor")); - Draw_Checkbox(row, runout.enabled); + drawMenuItem(row, ICON_Extruder, F("Filament Sensor")); + drawCheckbox(row, runout.enabled); } else { runout.enabled = !runout.enabled; - Draw_Checkbox(row, runout.enabled); + drawCheckbox(row, runout.enabled); } break; #endif case TUNE_BACKLIGHT_OFF: if (draw) - Draw_Menu_Item(row, ICON_Brightness, F("Display Off")); + drawMenuItem(row, ICON_Brightness, F("Display Off")); else ui.set_brightness(0); break; case TUNE_BACKLIGHT: if (draw) { - Draw_Menu_Item(row, ICON_Brightness, F("LCD Brightness")); - Draw_Float(ui.brightness, row, false, 1); + drawMenuItem(row, ICON_Brightness, F("LCD Brightness")); + drawFloat(ui.brightness, row, false, 1); } else - Modify_Value(ui.brightness, LCD_BRIGHTNESS_MIN, LCD_BRIGHTNESS_MAX, 1, ui.refresh_brightness); + modifyValue(ui.brightness, LCD_BRIGHTNESS_MIN, LCD_BRIGHTNESS_MAX, 1, ui.refresh_brightness); break; } break; @@ -3884,22 +3868,22 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item switch (item) { case PREHEATHOTEND_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, F("Cancel")); + drawMenuItem(row, ICON_Back, F("Cancel")); else { thermalManager.setTargetHotend(0, 0); TERN_(HAS_FAN, thermalManager.set_fan_speed(0, 0)); - Redraw_Menu(false, true, true); + redrawMenu(false, true, true); } break; case PREHEATHOTEND_CONTINUE: if (draw) - Draw_Menu_Item(row, ICON_SetEndTemp, F("Continue")); + drawMenuItem(row, ICON_SetEndTemp, F("Continue")); else { - Popup_Handler(Heating); + popupHandler(Heating); thermalManager.wait_for_hotend(0); switch (last_menu) { case Prepare: - Popup_Handler(FilChange); + popupHandler(FilChange); sprintf_P(cmd, PSTR("M600 B1 R%i"), thermalManager.temp_hotend[0].target); gcode.process_subcommands_now(cmd); break; @@ -3907,19 +3891,19 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item case ChangeFilament: switch (last_selection) { case CHANGEFIL_LOAD: - Popup_Handler(FilLoad); + popupHandler(FilLoad); gcode.process_subcommands_now(F("M701")); planner.synchronize(); - Redraw_Menu(true, true, true); + redrawMenu(true, true, true); break; case CHANGEFIL_UNLOAD: - Popup_Handler(FilLoad, true); + popupHandler(FilLoad, true); gcode.process_subcommands_now(F("M702")); planner.synchronize(); - Redraw_Menu(true, true, true); + redrawMenu(true, true, true); break; case CHANGEFIL_CHANGE: - Popup_Handler(FilChange); + popupHandler(FilChange); sprintf_P(cmd, PSTR("M600 B1 R%i"), thermalManager.temp_hotend[0].target); gcode.process_subcommands_now(cmd); break; @@ -3927,7 +3911,7 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item break; #endif default: - Redraw_Menu(true, true, true); + redrawMenu(true, true, true); break; } } @@ -3936,7 +3920,7 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item #define _PREHEAT_HOTEND_CASE(N) \ case PREHEATHOTEND_##N: \ - if (draw) Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_## N ##_LABEL)); \ + if (draw) drawMenuItem(row, ICON_Temperature, F(PREHEAT_## N ##_LABEL)); \ else ui.preheat_hotend_and_fan((N) - 1); \ break; @@ -3944,11 +3928,11 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item case PREHEATHOTEND_CUSTOM: if (draw) { - Draw_Menu_Item(row, ICON_Temperature, F("Custom")); - Draw_Float(thermalManager.temp_hotend[0].target, row, false, 1); + drawMenuItem(row, ICON_Temperature, F("Custom")); + drawFloat(thermalManager.temp_hotend[0].target, row, false, 1); } else - Modify_Value(thermalManager.temp_hotend[0].target, EXTRUDE_MINTEMP, MAX_E_TEMP, 1); + modifyValue(thermalManager.temp_hotend[0].target, EXTRUDE_MINTEMP, MAX_E_TEMP, 1); break; } break; @@ -3957,7 +3941,7 @@ void CrealityDWINClass::Menu_Item_Handler(const uint8_t menu, const uint8_t item } } -FSTR_P CrealityDWINClass::Get_Menu_Title(const uint8_t menu) { +FSTR_P CrealityDWIN::getMenuTitle(const uint8_t menu) { switch (menu) { case MainMenu: return GET_TEXT_F(MSG_MAIN_MENU); case Prepare: return GET_TEXT_F(MSG_PREPARE); @@ -4034,7 +4018,7 @@ FSTR_P CrealityDWINClass::Get_Menu_Title(const uint8_t menu) { return F(""); } -uint8_t CrealityDWINClass::Get_Menu_Size(const uint8_t menu) { +uint8_t CrealityDWIN::getMenuSize(const uint8_t menu) { switch (menu) { case Prepare: return PREPARE_TOTAL; case HomeMenu: return HOME_TOTAL; @@ -4111,108 +4095,108 @@ uint8_t CrealityDWINClass::Get_Menu_Size(const uint8_t menu) { /* Popup Config */ -void CrealityDWINClass::Popup_Handler(const PopupID popupid, const bool option/*=false*/) { +void CrealityDWIN::popupHandler(const PopupID popupid, const bool option/*=false*/) { popup = last_popup = popupid; switch (popupid) { - case Pause: Draw_Popup(F("Pause Print"), F(""), F(""), Popup); break; - case Stop: Draw_Popup(F("Stop Print"), F(""), F(""), Popup); break; - case Resume: Draw_Popup(F("Resume Print?"), F("Looks Like the last"), F("print was interrupted."), Popup); break; - case ConfFilChange: Draw_Popup(F("Confirm Filament Change"), F(""), F(""), Popup); break; - case PurgeMore: Draw_Popup(F("Purge more filament?"), F("(Cancel to finish process)"), F(""), Popup); break; - case SaveLevel: Draw_Popup(F("Leveling Complete"), F("Save to EEPROM?"), F(""), Popup); break; - case MeshSlot: Draw_Popup(F("Mesh slot not selected"), F("(Confirm to select slot 0)"), F(""), Popup); break; - case ETemp: Draw_Popup(F("Nozzle is too cold"), F("Open Preheat Menu?"), F(""), Popup); break; - case ManualProbing: Draw_Popup(F("Manual Probing"), F("(Confirm to probe)"), F("(cancel to exit)"), Popup); break; - case Level: Draw_Popup(F("Auto Bed Leveling"), F("Please wait until done."), F(""), Wait, ICON_AutoLeveling); break; - case Home: Draw_Popup(option ? F("Parking") : F("Homing"), F("Please wait until done."), F(""), Wait, ICON_BLTouch); break; - case MoveWait: Draw_Popup(F("Moving to Point"), F("Please wait until done."), F(""), Wait, ICON_BLTouch); break; - case Heating: Draw_Popup(F("Heating"), F("Please wait until done."), F(""), Wait, ICON_BLTouch); break; - case FilLoad: Draw_Popup(option ? F("Unloading Filament") : F("Loading Filament"), F("Please wait until done."), F(""), Wait, ICON_BLTouch); break; - case FilChange: Draw_Popup(F("Filament Change"), F("Please wait for prompt."), F(""), Wait, ICON_BLTouch); break; - case TempWarn: Draw_Popup(option ? F("Nozzle temp too low!") : F("Nozzle temp too high!"), F(""), F(""), Wait, option ? ICON_TempTooLow : ICON_TempTooHigh); break; - case Runout: Draw_Popup(F("Filament Runout"), F(""), F(""), Wait, ICON_BLTouch); break; - case PIDWait: Draw_Popup(F("PID Autotune"), F("in process"), F("Please wait until done."), Wait, ICON_BLTouch); break; - case Resuming: Draw_Popup(F("Resuming Print"), F("Please wait until done."), F(""), Wait, ICON_BLTouch); break; - case Custom: Draw_Popup(F("Running Custom GCode"), F("Please wait until done."), F(""), Wait, ICON_BLTouch); break; + case Pause: drawPopup(F("Pause Print"), F(""), F(""), Popup); break; + case Stop: drawPopup(F("Stop Print"), F(""), F(""), Popup); break; + case Resume: drawPopup(F("Resume Print?"), F("Looks Like the last"), F("print was interrupted."), Popup); break; + case ConfFilChange: drawPopup(F("Confirm Filament Change"), F(""), F(""), Popup); break; + case PurgeMore: drawPopup(F("Purge more filament?"), F("(Cancel to finish process)"), F(""), Popup); break; + case SaveLevel: drawPopup(F("Leveling Complete"), F("Save to EEPROM?"), F(""), Popup); break; + case MeshSlot: drawPopup(F("Mesh slot not selected"), F("(Confirm to select slot 0)"), F(""), Popup); break; + case ETemp: drawPopup(F("Nozzle is too cold"), F("Open Preheat Menu?"), F(""), Popup); break; + case ManualProbing: drawPopup(F("Manual Probing"), F("(Confirm to probe)"), F("(cancel to exit)"), Popup); break; + case Level: drawPopup(F("Auto Bed Leveling"), F("Please wait until done."), F(""), Wait, ICON_AutoLeveling); break; + case Home: drawPopup(option ? F("Parking") : F("Homing"), F("Please wait until done."), F(""), Wait, ICON_BLTouch); break; + case MoveWait: drawPopup(F("Moving to Point"), F("Please wait until done."), F(""), Wait, ICON_BLTouch); break; + case Heating: drawPopup(F("Heating"), F("Please wait until done."), F(""), Wait, ICON_BLTouch); break; + case FilLoad: drawPopup(option ? F("Unloading Filament") : F("Loading Filament"), F("Please wait until done."), F(""), Wait, ICON_BLTouch); break; + case FilChange: drawPopup(F("Filament Change"), F("Please wait for prompt."), F(""), Wait, ICON_BLTouch); break; + case TempWarn: drawPopup(option ? F("Nozzle temp too low!") : F("Nozzle temp too high!"), F(""), F(""), Wait, option ? ICON_TempTooLow : ICON_TempTooHigh); break; + case Runout: drawPopup(F("Filament Runout"), F(""), F(""), Wait, ICON_BLTouch); break; + case PIDWait: drawPopup(F("PID Autotune"), F("in process"), F("Please wait until done."), Wait, ICON_BLTouch); break; + case Resuming: drawPopup(F("Resuming Print"), F("Please wait until done."), F(""), Wait, ICON_BLTouch); break; + case Custom: drawPopup(F("Running Custom GCode"), F("Please wait until done."), F(""), Wait, ICON_BLTouch); break; default: break; } } -void CrealityDWINClass::Confirm_Handler(PopupID popupid) { +void CrealityDWIN::confirmHandler(PopupID popupid) { popup = popupid; switch (popupid) { - case FilInsert: Draw_Popup(F("Insert Filament"), F("Press to Continue"), F(""), Confirm); break; - case HeaterTime: Draw_Popup(F("Heater Timed Out"), F("Press to Reheat"), F(""), Confirm); break; - case UserInput: Draw_Popup(F("Waiting for Input"), F("Press to Continue"), F(""), Confirm); break; - case LevelError: Draw_Popup(F("Couldn't enable Leveling"), F("(Valid mesh must exist)"), F(""), Confirm); break; - case InvalidMesh: Draw_Popup(F("Valid mesh must exist"), F("before tuning can be"), F("performed"), Confirm); break; + case FilInsert: drawPopup(F("Insert Filament"), F("Press to Continue"), F(""), Confirm); break; + case HeaterTime: drawPopup(F("Heater Timed Out"), F("Press to Reheat"), F(""), Confirm); break; + case UserInput: drawPopup(F("Waiting for Input"), F("Press to Continue"), F(""), Confirm); break; + case LevelError: drawPopup(F("Couldn't enable Leveling"), F("(Valid mesh must exist)"), F(""), Confirm); break; + case InvalidMesh: drawPopup(F("Valid mesh must exist"), F("before tuning can be"), F("performed"), Confirm); break; default: break; } } /* Navigation and Control */ -void CrealityDWINClass::Main_Menu_Control() { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); +void CrealityDWIN::mainMenuControl() { + EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; if (encoder_diffState == ENCODER_DIFF_CW && selection < PAGE_COUNT - 1) { selection++; // Select Down - Main_Menu_Icons(); + mainMenuIcons(); } else if (encoder_diffState == ENCODER_DIFF_CCW && selection > 0) { selection--; // Select Up - Main_Menu_Icons(); + mainMenuIcons(); } else if (encoder_diffState == ENCODER_DIFF_ENTER) switch (selection) { - case PAGE_PRINT: card.mount(); Draw_SD_List(); break; - case PAGE_PREPARE: Draw_Menu(Prepare); break; - case PAGE_CONTROL: Draw_Menu(Control); break; - case PAGE_INFO_LEVELING: Draw_Menu(TERN(HAS_MESH, Leveling, InfoMain)); break; + case PAGE_PRINT: card.mount(); drawSDList(); break; + case PAGE_PREPARE: drawMenu(Prepare); break; + case PAGE_CONTROL: drawMenu(Control); break; + case PAGE_INFO_LEVELING: drawMenu(TERN(HAS_MESH, Leveling, InfoMain)); break; } - DWIN_UpdateLCD(); + dwinUpdateLCD(); } -void CrealityDWINClass::Menu_Control() { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); +void CrealityDWIN::menuControl() { + EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; - if (encoder_diffState == ENCODER_DIFF_CW && selection < Get_Menu_Size(active_menu)) { - DWIN_Draw_Rectangle(1, Color_Bg_Black, 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); + if (encoder_diffState == ENCODER_DIFF_CW && selection < getMenuSize(active_menu)) { + dwinDrawRectangle(1, Color_Bg_Black, 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); selection++; // Select Down if (selection > scrollpos+MROWS) { scrollpos++; - DWIN_Frame_AreaMove(1, 2, MLINE, Color_Bg_Black, 0, 31, DWIN_WIDTH, 349); - Menu_Item_Handler(active_menu, selection); + dwinFrameAreaMove(1, 2, MLINE, Color_Bg_Black, 0, 31, DWIN_WIDTH, 349); + menuItemHandler(active_menu, selection); } - DWIN_Draw_Rectangle(1, GetColor(eeprom_settings.cursor_color, Rectangle_Color), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); + dwinDrawRectangle(1, getColor(eeprom_settings.cursor_color, Rectangle_Color), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); } else if (encoder_diffState == ENCODER_DIFF_CCW && selection > 0) { - DWIN_Draw_Rectangle(1, Color_Bg_Black, 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); + dwinDrawRectangle(1, Color_Bg_Black, 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); selection--; // Select Up if (selection < scrollpos) { scrollpos--; - DWIN_Frame_AreaMove(1, 3, MLINE, Color_Bg_Black, 0, 31, DWIN_WIDTH, 349); - Menu_Item_Handler(active_menu, selection); + dwinFrameAreaMove(1, 3, MLINE, Color_Bg_Black, 0, 31, DWIN_WIDTH, 349); + menuItemHandler(active_menu, selection); } - DWIN_Draw_Rectangle(1, GetColor(eeprom_settings.cursor_color, Rectangle_Color), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); + dwinDrawRectangle(1, getColor(eeprom_settings.cursor_color, Rectangle_Color), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); } else if (encoder_diffState == ENCODER_DIFF_ENTER) - Menu_Item_Handler(active_menu, selection, false); - DWIN_UpdateLCD(); + menuItemHandler(active_menu, selection, false); + dwinUpdateLCD(); } -void CrealityDWINClass::Value_Control() { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); +void CrealityDWIN::valueControl() { + EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; if (encoder_diffState == ENCODER_DIFF_CW) - tempvalue += EncoderRate.encoderMoveValue; + tempvalue += encoderRate.encoderMoveValue; else if (encoder_diffState == ENCODER_DIFF_CCW) - tempvalue -= EncoderRate.encoderMoveValue; + tempvalue -= encoderRate.encoderMoveValue; else if (encoder_diffState == ENCODER_DIFF_ENTER) { process = Menu; - EncoderRate.enabled = false; - Draw_Float(tempvalue / valueunit, selection - scrollpos, false, valueunit); - DWIN_UpdateLCD(); + encoderRate.enabled = false; + drawFloat(tempvalue / valueunit, selection - scrollpos, false, valueunit); + dwinUpdateLCD(); if (active_menu == ZOffset && liveadjust) { planner.synchronize(); current_position.z += (tempvalue / valueunit - zoffsetvalue); @@ -4255,24 +4239,24 @@ void CrealityDWINClass::Value_Control() { return; } LIMIT(tempvalue, valuemin * valueunit, valuemax * valueunit); - Draw_Float(tempvalue / valueunit, selection - scrollpos, true, valueunit); - DWIN_UpdateLCD(); + drawFloat(tempvalue / valueunit, selection - scrollpos, true, valueunit); + dwinUpdateLCD(); if (active_menu == Move && livemove) { *(float*)valuepointer = tempvalue / valueunit; planner.buffer_line(current_position, manual_feedrate_mm_s[selection - 1], active_extruder); } } -void CrealityDWINClass::Option_Control() { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); +void CrealityDWIN::optionControl() { + EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; if (encoder_diffState == ENCODER_DIFF_CW) - tempvalue += EncoderRate.encoderMoveValue; + tempvalue += encoderRate.encoderMoveValue; else if (encoder_diffState == ENCODER_DIFF_CCW) - tempvalue -= EncoderRate.encoderMoveValue; + tempvalue -= encoderRate.encoderMoveValue; else if (encoder_diffState == ENCODER_DIFF_ENTER) { process = Menu; - EncoderRate.enabled = false; + encoderRate.enabled = false; if (valuepointer == &color_names) { switch (selection) { case COLORSETTINGS_CURSOR: eeprom_settings.cursor_color = tempvalue; break; @@ -4287,24 +4271,24 @@ void CrealityDWINClass::Option_Control() { case COLORSETTINGS_PROGRESS_COORDINATES: eeprom_settings.coordinates_text = tempvalue; break; case COLORSETTINGS_PROGRESS_COORDINATES_LINE: eeprom_settings.coordinates_split_line = tempvalue; break; } - Redraw_Screen(); + redrawScreen(); } else if (valuepointer == &preheat_modes) preheatmode = tempvalue; - Draw_Option(tempvalue, static_cast(valuepointer), selection - scrollpos, false, (valuepointer == &color_names)); - DWIN_UpdateLCD(); + drawOption(tempvalue, static_cast(valuepointer), selection - scrollpos, false, (valuepointer == &color_names)); + dwinUpdateLCD(); return; } LIMIT(tempvalue, valuemin, valuemax); - Draw_Option(tempvalue, static_cast(valuepointer), selection - scrollpos, true); - DWIN_UpdateLCD(); + drawOption(tempvalue, static_cast(valuepointer), selection - scrollpos, true); + dwinUpdateLCD(); } -void CrealityDWINClass::File_Control() { +void CrealityDWIN::fileControl() { typedef TextScroller Scroller; static Scroller scroller; - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); + EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) { if (selection > 0) { card.selectFileByIndexSorted(selection - 1); @@ -4319,82 +4303,82 @@ void CrealityDWINClass::File_Control() { time = millis() + 200; Scroller::Buffer buf; const char* const name = scroller.scroll(pos, buf, filename); - DWIN_Draw_Rectangle(1, Color_Bg_Black, LBLX, MBASE(selection - scrollpos) - 14, 271, MBASE(selection - scrollpos) + 28); - Draw_Menu_Item(selection - scrollpos, card.flag.filenameIsDir ? ICON_More : ICON_File, name); - DWIN_UpdateLCD(); + dwinDrawRectangle(1, Color_Bg_Black, LBLX, MBASE(selection - scrollpos) - 14, 271, MBASE(selection - scrollpos) + 28); + drawMenuItem(selection - scrollpos, card.flag.filenameIsDir ? ICON_More : ICON_File, name); + dwinUpdateLCD(); } } return; } if (encoder_diffState == ENCODER_DIFF_CW && selection < card.get_num_items()) { - DWIN_Draw_Rectangle(1, Color_Bg_Black, 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); + dwinDrawRectangle(1, Color_Bg_Black, 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); if (selection > 0) { - DWIN_Draw_Rectangle(1, Color_Bg_Black, LBLX, MBASE(selection - scrollpos) - 14, 271, MBASE(selection - scrollpos) + 28); - Draw_SD_Item(selection, selection - scrollpos); + dwinDrawRectangle(1, Color_Bg_Black, LBLX, MBASE(selection - scrollpos) - 14, 271, MBASE(selection - scrollpos) + 28); + drawSDItem(selection, selection - scrollpos); } scroller.reset(); selection++; // Select Down if (selection > scrollpos + MROWS) { scrollpos++; - DWIN_Frame_AreaMove(1, 2, MLINE, Color_Bg_Black, 0, 31, DWIN_WIDTH, 349); - Draw_SD_Item(selection, selection - scrollpos); + dwinFrameAreaMove(1, 2, MLINE, Color_Bg_Black, 0, 31, DWIN_WIDTH, 349); + drawSDItem(selection, selection - scrollpos); } - DWIN_Draw_Rectangle(1, GetColor(eeprom_settings.cursor_color, Rectangle_Color), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); + dwinDrawRectangle(1, getColor(eeprom_settings.cursor_color, Rectangle_Color), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); } else if (encoder_diffState == ENCODER_DIFF_CCW && selection > 0) { - DWIN_Draw_Rectangle(1, Color_Bg_Black, 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); - DWIN_Draw_Rectangle(1, Color_Bg_Black, LBLX, MBASE(selection - scrollpos) - 14, 271, MBASE(selection - scrollpos) + 28); - Draw_SD_Item(selection, selection - scrollpos); + dwinDrawRectangle(1, Color_Bg_Black, 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); + dwinDrawRectangle(1, Color_Bg_Black, LBLX, MBASE(selection - scrollpos) - 14, 271, MBASE(selection - scrollpos) + 28); + drawSDItem(selection, selection - scrollpos); scroller.reset(); selection--; // Select Up if (selection < scrollpos) { scrollpos--; - DWIN_Frame_AreaMove(1, 3, MLINE, Color_Bg_Black, 0, 31, DWIN_WIDTH, 349); - Draw_SD_Item(selection, selection - scrollpos); + dwinFrameAreaMove(1, 3, MLINE, Color_Bg_Black, 0, 31, DWIN_WIDTH, 349); + drawSDItem(selection, selection - scrollpos); } - DWIN_Draw_Rectangle(1, GetColor(eeprom_settings.cursor_color, Rectangle_Color), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); + dwinDrawRectangle(1, getColor(eeprom_settings.cursor_color, Rectangle_Color), 0, MBASE(selection - scrollpos) - 18, 14, MBASE(selection - scrollpos) + 33); } else if (encoder_diffState == ENCODER_DIFF_ENTER) { if (selection == 0) { if (card.flag.workDirIsRoot) { process = Main; - Draw_Main_Menu(); + drawMainMenu(); } else { card.cdup(); - Draw_SD_List(); + drawSDList(); } } else { card.selectFileByIndexSorted(selection - 1); if (card.flag.filenameIsDir) { card.cd(card.filename); - Draw_SD_List(); + drawSDList(); } else { card.openAndPrintFile(card.filename); } } } - DWIN_UpdateLCD(); + dwinUpdateLCD(); } -void CrealityDWINClass::Print_Screen_Control() { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); +void CrealityDWIN::printScreenControl() { + EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; if (encoder_diffState == ENCODER_DIFF_CW && selection < PRINT_COUNT - 1) { selection++; // Select Down - Print_Screen_Icons(); + printScreenIcons(); } else if (encoder_diffState == ENCODER_DIFF_CCW && selection > 0) { selection--; // Select Up - Print_Screen_Icons(); + printScreenIcons(); } else if (encoder_diffState == ENCODER_DIFF_ENTER) { switch (selection) { case PRINT_SETUP: - Draw_Menu(Tune); - Update_Status_Bar(true); + drawMenu(Tune); + updateStatusBar(true); break; case PRINT_PAUSE_RESUME: if (paused) { @@ -4421,27 +4405,27 @@ void CrealityDWINClass::Print_Screen_Control() { else { TERN_(HOST_ACTION_COMMANDS, hostui.resume()); } - Draw_Print_Screen(); + drawPrintScreen(); } else - Popup_Handler(Pause); + popupHandler(Pause); break; - case PRINT_STOP: Popup_Handler(Stop); break; + case PRINT_STOP: popupHandler(Stop); break; } } - DWIN_UpdateLCD(); + dwinUpdateLCD(); } -void CrealityDWINClass::Popup_Control() { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); +void CrealityDWIN::popupControl() { + EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; if (encoder_diffState == ENCODER_DIFF_CW && selection < 1) { selection++; - Popup_Select(); + popupSelect(); } else if (encoder_diffState == ENCODER_DIFF_CCW && selection > 0) { selection--; - Popup_Select(); + popupSelect(); } else if (encoder_diffState == ENCODER_DIFF_ENTER) { switch (popup) { @@ -4452,7 +4436,7 @@ void CrealityDWINClass::Popup_Control() { if (recovery.enabled) recovery.save(true); #endif #if ENABLED(PARK_HEAD_ON_PAUSE) - Popup_Handler(Home, true); + popupHandler(Home, true); #if HAS_MEDIA if (IS_SD_PRINTING()) card.pauseSDPrint(); #endif @@ -4471,7 +4455,7 @@ void CrealityDWINClass::Popup_Control() { TERN_(HOST_ACTION_COMMANDS, hostui.pause()); } } - Draw_Print_Screen(); + drawPrintScreen(); break; case Stop: if (selection == 0) { @@ -4484,14 +4468,14 @@ void CrealityDWINClass::Popup_Control() { } } else - Draw_Print_Screen(); + drawPrintScreen(); break; case Resume: if (selection == 0) queue.inject(F("M1000")); else { queue.inject(F("M1000 C")); - Draw_Main_Menu(); + drawMainMenu(); } break; @@ -4500,10 +4484,10 @@ void CrealityDWINClass::Popup_Control() { if (selection == 0) { thermalManager.setTargetHotend(EXTRUDE_MINTEMP, 0); TERN_(HAS_FAN, thermalManager.set_fan_speed(0, MAX_FAN_SPEED)); - Draw_Menu(PreheatHotend); + drawMenu(PreheatHotend); } else - Redraw_Menu(true, true, false); + redrawMenu(true, true, false); break; #endif @@ -4513,11 +4497,11 @@ void CrealityDWINClass::Popup_Control() { char buf[80]; const float dif = probe.probe_at_point(current_position.x, current_position.y, PROBE_PT_STOW, 0, false) - corner_avg; sprintf_P(buf, dif > 0 ? PSTR("Corner is %smm high") : PSTR("Corner is %smm low"), dtostrf(abs(dif), 1, 3, str_1)); - Update_Status(buf); + updateStatus(buf); } else { - Redraw_Menu(true, true, false); - Update_Status(""); + redrawMenu(true, true, false); + updateStatus(""); } break; #endif @@ -4526,29 +4510,29 @@ void CrealityDWINClass::Popup_Control() { case ConfFilChange: if (selection == 0) { if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp) - Popup_Handler(ETemp); + popupHandler(ETemp); else { if (thermalManager.temp_hotend[0].is_below_target(2)) { - Popup_Handler(Heating); + popupHandler(Heating); thermalManager.wait_for_hotend(0); } - Popup_Handler(FilChange); + popupHandler(FilChange); sprintf_P(cmd, PSTR("M600 B1 R%i"), thermalManager.temp_hotend[0].target); gcode.process_subcommands_now(cmd); } } else - Redraw_Menu(true, true, false); + redrawMenu(true, true, false); break; case PurgeMore: if (selection == 0) { pause_menu_response = PAUSE_RESPONSE_EXTRUDE_MORE; - Popup_Handler(FilChange); + popupHandler(FilChange); } else { pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT; - if (printing) Popup_Handler(Resuming); - else Redraw_Menu(true, true, active_menu == PreheatHotend); + if (printing) popupHandler(Resuming); + else redrawMenu(true, true, active_menu == PreheatHotend); } break; #endif // ADVANCED_PAUSE_FEATURE @@ -4559,55 +4543,55 @@ void CrealityDWINClass::Popup_Control() { #if ENABLED(AUTO_BED_LEVELING_UBL) gcode.process_subcommands_now(F("G29 S")); planner.synchronize(); - AudioFeedback(true); + audioFeedback(true); #else - AudioFeedback(settings.save()); + audioFeedback(settings.save()); #endif } - Draw_Menu(Leveling, LEVELING_GET_MESH); + drawMenu(Leveling, LEVELING_GET_MESH); break; #endif #if ENABLED(AUTO_BED_LEVELING_UBL) case MeshSlot: if (selection == 0) bedlevel.storage_slot = 0; - Redraw_Menu(true, true); + redrawMenu(true, true); break; #endif default: break; } } - DWIN_UpdateLCD(); + dwinUpdateLCD(); } -void CrealityDWINClass::Confirm_Control() { - EncoderState encoder_diffState = Encoder_ReceiveAnalyze(); +void CrealityDWIN::confirmControl() { + EncoderState encoder_diffState = encoderReceiveAnalyze(); if (encoder_diffState == ENCODER_DIFF_NO) return; if (encoder_diffState == ENCODER_DIFF_ENTER) { switch (popup) { case Complete: - Draw_Main_Menu(); + drawMainMenu(); break; case FilInsert: - Popup_Handler(FilChange); + popupHandler(FilChange); wait_for_user = false; break; case HeaterTime: - Popup_Handler(Heating); + popupHandler(Heating); wait_for_user = false; break; default: - Redraw_Menu(true, true, false); + redrawMenu(true, true, false); wait_for_user = false; break; } } - DWIN_UpdateLCD(); + dwinUpdateLCD(); } /* In-Menu Value Modification */ -void CrealityDWINClass::Setup_Value(const_float_t value, const_float_t min, const_float_t max, const_float_t unit, const uint8_t type) { +void CrealityDWIN::setupValue(const_float_t value, const_float_t min, const_float_t max, const_float_t unit, const uint8_t type) { if (TERN0(HAS_HOTEND, valuepointer == &thermalManager.temp_hotend[0].pid.Ki) || TERN0(HAS_HEATED_BED, valuepointer == &thermalManager.temp_bed.pid.Ki)) tempvalue = unscalePID_i(value) * unit; else if (TERN0(HAS_HOTEND, valuepointer == &thermalManager.temp_hotend[0].pid.Kd) || TERN0(HAS_HEATED_BED, valuepointer == &thermalManager.temp_bed.pid.Kd)) @@ -4619,58 +4603,58 @@ void CrealityDWINClass::Setup_Value(const_float_t value, const_float_t min, cons valueunit = unit; valuetype = type; process = Value; - EncoderRate.enabled = true; - Draw_Float(tempvalue / unit, selection - scrollpos, true, valueunit); + encoderRate.enabled = true; + drawFloat(tempvalue / unit, selection - scrollpos, true, valueunit); } -void CrealityDWINClass::Modify_Value(float &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()/*=nullptr*/) { +void CrealityDWIN::modifyValue(float &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()/*=nullptr*/) { valuepointer = &value; funcpointer = f; - Setup_Value((float)value, min, max, unit, 0); + setupValue((float)value, min, max, unit, 0); } -void CrealityDWINClass::Modify_Value(uint8_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()/*=nullptr*/) { +void CrealityDWIN::modifyValue(uint8_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()/*=nullptr*/) { valuepointer = &value; funcpointer = f; - Setup_Value((float)value, min, max, unit, 1); + setupValue((float)value, min, max, unit, 1); } -void CrealityDWINClass::Modify_Value(uint16_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()/*=nullptr*/) { +void CrealityDWIN::modifyValue(uint16_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()/*=nullptr*/) { valuepointer = &value; funcpointer = f; - Setup_Value((float)value, min, max, unit, 2); + setupValue((float)value, min, max, unit, 2); } -void CrealityDWINClass::Modify_Value(int16_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()/*=nullptr*/) { +void CrealityDWIN::modifyValue(int16_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()/*=nullptr*/) { valuepointer = &value; funcpointer = f; - Setup_Value((float)value, min, max, unit, 3); + setupValue((float)value, min, max, unit, 3); } -void CrealityDWINClass::Modify_Value(uint32_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()/*=nullptr*/) { +void CrealityDWIN::modifyValue(uint32_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()/*=nullptr*/) { valuepointer = &value; funcpointer = f; - Setup_Value((float)value, min, max, unit, 4); + setupValue((float)value, min, max, unit, 4); } -void CrealityDWINClass::Modify_Value(int8_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()/*=nullptr*/) { +void CrealityDWIN::modifyValue(int8_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()/*=nullptr*/) { valuepointer = &value; funcpointer = f; - Setup_Value((float)value, min, max, unit, 5); + setupValue((float)value, min, max, unit, 5); } -void CrealityDWINClass::Modify_Option(const uint8_t value, const char * const * options, const uint8_t max) { +void CrealityDWIN::modifyOption(const uint8_t value, const char * const * options, const uint8_t max) { tempvalue = value; valuepointer = const_cast(options); valuemin = 0; valuemax = max; process = Option; - EncoderRate.enabled = true; - Draw_Option(value, options, selection - scrollpos, true); + encoderRate.enabled = true; + drawOption(value, options, selection - scrollpos, true); } /* Main Functions */ -void CrealityDWINClass::Update_Status(const char * const text) { +void CrealityDWIN::updateStatus(const char * const text) { if (strncmp_P(text, PSTR(""), 3) == 0) { for (uint8_t i = 0; i < _MIN((size_t)LONG_FILENAME_LENGTH, strlen(text)); ++i) filename[i] = text[i + 3]; filename[_MIN((size_t)LONG_FILENAME_LENGTH - 1, strlen(text))] = '\0'; - Draw_Print_Filename(true); + drawPrintFilename(true); } else { for (uint8_t i = 0; i < _MIN((size_t)64, strlen(text)); ++i) statusmsg[i] = text[i]; @@ -4678,7 +4662,7 @@ void CrealityDWINClass::Update_Status(const char * const text) { } } -void CrealityDWINClass::Start_Print(const bool sd) { +void CrealityDWIN::startPrint(const bool sd) { sdprint = sd; if (!printing) { printing = true; @@ -4697,59 +4681,59 @@ void CrealityDWINClass::Start_Print(const bool sd) { strcpy_P(filename, PSTR("Host Print")); TERN_(SET_PROGRESS_PERCENT, ui.set_progress(0)); TERN_(SET_REMAINING_TIME, ui.set_remaining_time(0)); - Draw_Print_Screen(); + drawPrintScreen(); } } -void CrealityDWINClass::Stop_Print() { +void CrealityDWIN::stopPrint() { printing = false; sdprint = false; thermalManager.cooldown(); TERN_(SET_PROGRESS_PERCENT, ui.set_progress(100 * (PROGRESS_SCALE))); TERN_(SET_REMAINING_TIME, ui.set_remaining_time(0)); - Draw_Print_confirm(); + drawPrintConfirm(); } -void CrealityDWINClass::Update() { - State_Update(); - Screen_Update(); +void CrealityDWIN::update() { + stateUpdate(); + screenUpdate(); switch (process) { - case Main: Main_Menu_Control(); break; - case Menu: Menu_Control(); break; - case Value: Value_Control(); break; - case Option: Option_Control(); break; - case File: File_Control(); break; - case Print: Print_Screen_Control(); break; - case Popup: Popup_Control(); break; - case Confirm: Confirm_Control(); break; + case Main: mainMenuControl(); break; + case Menu: menuControl(); break; + case Value: valueControl(); break; + case Option: optionControl(); break; + case File: fileControl(); break; + case Print: printScreenControl(); break; + case Popup: popupControl(); break; + case Confirm: confirmControl(); break; } } -void MarlinUI::update() { CrealityDWIN.Update(); } +void MarlinUI::update() { crealityDWIN.update(); } #if HAS_LCD_BRIGHTNESS - void MarlinUI::_set_brightness() { DWIN_LCD_Brightness(backlight ? brightness : 0); } + void MarlinUI::_set_brightness() { dwinLCDBrightness(backlight ? brightness : 0); } #endif -void CrealityDWINClass::State_Update() { +void CrealityDWIN::stateUpdate() { if ((print_job_timer.isRunning() || print_job_timer.isPaused()) != printing) { - if (!printing) Start_Print(card.isFileOpen() || TERN0(POWER_LOSS_RECOVERY, recovery.valid())); - else Stop_Print(); + if (!printing) startPrint(card.isFileOpen() || TERN0(POWER_LOSS_RECOVERY, recovery.valid())); + else stopPrint(); } if (print_job_timer.isPaused() != paused) { paused = print_job_timer.isPaused(); - if (process == Print) Print_Screen_Icons(); - if (process == Wait && !paused) Redraw_Menu(true, true); + if (process == Print) printScreenIcons(); + if (process == Wait && !paused) redrawMenu(true, true); } if (wait_for_user && !(process == Confirm) && !print_job_timer.isPaused()) - Confirm_Handler(UserInput); + confirmHandler(UserInput); #if ENABLED(ADVANCED_PAUSE_FEATURE) if (process == Popup && popup == PurgeMore) { if (pause_menu_response == PAUSE_RESPONSE_EXTRUDE_MORE) - Popup_Handler(FilChange); + popupHandler(FilChange); else if (pause_menu_response == PAUSE_RESPONSE_RESUME_PRINT) { - if (printing) Popup_Handler(Resuming); - else Redraw_Menu(true, true, active_menu == PreheatHotend); + if (printing) popupHandler(Resuming); + else redrawMenu(true, true, active_menu == PreheatHotend); } } #endif @@ -4757,33 +4741,33 @@ void CrealityDWINClass::State_Update() { static bool ranout = false; if (runout.filament_ran_out != ranout) { ranout = runout.filament_ran_out; - if (ranout) Popup_Handler(Runout); + if (ranout) popupHandler(Runout); } #endif } -void CrealityDWINClass::Screen_Update() { +void CrealityDWIN::screenUpdate() { const millis_t ms = millis(); static millis_t scrltime = 0; if (ELAPSED(ms, scrltime)) { scrltime = ms + 200; - Update_Status_Bar(); - if (process == Print) Draw_Print_Filename(); + updateStatusBar(); + if (process == Print) drawPrintFilename(); } static millis_t statustime = 0; if (ELAPSED(ms, statustime)) { statustime = ms + 500; - Draw_Status_Area(); + drawStatusArea(); } static millis_t printtime = 0; if (ELAPSED(ms, printtime)) { printtime = ms + 1000; if (process == Print) { - Draw_Print_ProgressBar(); - Draw_Print_ProgressElapsed(); - TERN_(SET_REMAINING_TIME, Draw_Print_ProgressRemain()); + drawPrintProgressBar(); + drawPrintProgressElapsed(); + TERN_(SET_REMAINING_TIME, drawPrintProgressRemain()); } } @@ -4791,7 +4775,7 @@ void CrealityDWINClass::Screen_Update() { if (mounted != card.isMounted()) { mounted = card.isMounted(); if (process == File) - Draw_SD_List(); + drawSDList(); } #if HAS_HOTEND @@ -4832,7 +4816,7 @@ void CrealityDWINClass::Screen_Update() { hotendtarget = thermalManager.temp_hotend[0].target; if (scrollpos <= TEMP_HOTEND && TEMP_HOTEND <= scrollpos + MROWS) { if (process != Value || selection != TEMP_HOTEND - scrollpos) - Draw_Float(thermalManager.temp_hotend[0].target, TEMP_HOTEND - scrollpos, false, 1); + drawFloat(thermalManager.temp_hotend[0].target, TEMP_HOTEND - scrollpos, false, 1); } } #endif @@ -4841,7 +4825,7 @@ void CrealityDWINClass::Screen_Update() { bedtarget = thermalManager.temp_bed.target; if (scrollpos <= TEMP_BED && TEMP_BED <= scrollpos + MROWS) { if (process != Value || selection != TEMP_HOTEND - scrollpos) - Draw_Float(thermalManager.temp_bed.target, TEMP_BED - scrollpos, false, 1); + drawFloat(thermalManager.temp_bed.target, TEMP_BED - scrollpos, false, 1); } } #endif @@ -4850,7 +4834,7 @@ void CrealityDWINClass::Screen_Update() { fanspeed = thermalManager.fan_speed[0]; if (scrollpos <= TEMP_FAN && TEMP_FAN <= scrollpos + MROWS) { if (process != Value || selection != TEMP_HOTEND - scrollpos) - Draw_Float(thermalManager.fan_speed[0], TEMP_FAN - scrollpos, false, 1); + drawFloat(thermalManager.fan_speed[0], TEMP_FAN - scrollpos, false, 1); } } #endif @@ -4861,7 +4845,7 @@ void CrealityDWINClass::Screen_Update() { hotendtarget = thermalManager.temp_hotend[0].target; if (scrollpos <= TUNE_HOTEND && TUNE_HOTEND <= scrollpos + MROWS) { if (process != Value || selection != TEMP_HOTEND - scrollpos) - Draw_Float(thermalManager.temp_hotend[0].target, TUNE_HOTEND - scrollpos, false, 1); + drawFloat(thermalManager.temp_hotend[0].target, TUNE_HOTEND - scrollpos, false, 1); } } #endif @@ -4870,7 +4854,7 @@ void CrealityDWINClass::Screen_Update() { bedtarget = thermalManager.temp_bed.target; if (scrollpos <= TUNE_BED && TUNE_BED <= scrollpos + MROWS) { if (process != Value || selection != TEMP_HOTEND - scrollpos) - Draw_Float(thermalManager.temp_bed.target, TUNE_BED - scrollpos, false, 1); + drawFloat(thermalManager.temp_bed.target, TUNE_BED - scrollpos, false, 1); } } #endif @@ -4879,7 +4863,7 @@ void CrealityDWINClass::Screen_Update() { fanspeed = thermalManager.fan_speed[0]; if (scrollpos <= TUNE_FAN && TUNE_FAN <= scrollpos + MROWS) { if (process != Value || selection != TEMP_HOTEND - scrollpos) - Draw_Float(thermalManager.fan_speed[0], TUNE_FAN - scrollpos, false, 1); + drawFloat(thermalManager.fan_speed[0], TUNE_FAN - scrollpos, false, 1); } } #endif @@ -4888,25 +4872,25 @@ void CrealityDWINClass::Screen_Update() { } } -void CrealityDWINClass::AudioFeedback(const bool success/*=true*/) { +void CrealityDWIN::audioFeedback(const bool success/*=true*/) { if (ui.sound_on) DONE_BUZZ(success); else - Update_Status(success ? "Success" : "Failed"); + updateStatus(success ? "Success" : "Failed"); } -void CrealityDWINClass::Save_Settings(char * const buff) { +void CrealityDWIN::saveSettings(char * const buff) { TERN_(AUTO_BED_LEVELING_UBL, eeprom_settings.tilt_grid_size = mesh_conf.tilt_grid - 1); eeprom_settings.corner_pos = corner_pos * 10; memcpy(buff, &eeprom_settings, _MIN(sizeof(eeprom_settings), eeprom_data_size)); } -void CrealityDWINClass::Load_Settings(const char * const buff) { +void CrealityDWIN::loadSettings(const char * const buff) { memcpy(&eeprom_settings, buff, _MIN(sizeof(eeprom_settings), eeprom_data_size)); TERN_(AUTO_BED_LEVELING_UBL, mesh_conf.tilt_grid = eeprom_settings.tilt_grid_size + 1); if (eeprom_settings.corner_pos == 0) eeprom_settings.corner_pos = 325; corner_pos = eeprom_settings.corner_pos / 10.0f; - Redraw_Screen(); + redrawScreen(); #if ENABLED(POWER_LOSS_RECOVERY) static bool init = true; if (init) { @@ -4916,7 +4900,7 @@ void CrealityDWINClass::Load_Settings(const char * const buff) { #endif } -void CrealityDWINClass::Reset_Settings() { +void CrealityDWIN::resetSettings() { eeprom_settings.time_format_textual = false; TERN_(AUTO_BED_LEVELING_UBL, eeprom_settings.tilt_grid_size = 0); eeprom_settings.corner_pos = 325; @@ -4934,36 +4918,36 @@ void CrealityDWINClass::Reset_Settings() { TERN_(AUTO_BED_LEVELING_UBL, mesh_conf.tilt_grid = eeprom_settings.tilt_grid_size + 1); corner_pos = eeprom_settings.corner_pos / 10.0f; TERN_(SOUND_MENU_ITEM, ui.sound_on = ENABLED(SOUND_ON_DEFAULT)); - Redraw_Screen(); + redrawScreen(); } void MarlinUI::init_lcd() { delay(800); SERIAL_ECHOPGM("\nDWIN handshake "); - if (DWIN_Handshake()) SERIAL_ECHOLNPGM("ok."); else SERIAL_ECHOLNPGM("error."); - DWIN_Frame_SetDir(1); // Orientation 90Β° - DWIN_UpdateLCD(); // Show bootscreen (first image) - Encoder_Configuration(); + if (dwinHandshake()) SERIAL_ECHOLNPGM("ok."); else SERIAL_ECHOLNPGM("error."); + dwinFrameSetDir(1); // Orientation 90Β° + dwinUpdateLCD(); // Show bootscreen (first image) + encoderConfiguration(); for (uint16_t t = 0; t <= 100; t += 2) { - DWIN_ICON_Show(ICON, ICON_Bar, 15, 260); - DWIN_Draw_Rectangle(1, Color_Bg_Black, 15 + t * 242 / 100, 260, 257, 280); - DWIN_UpdateLCD(); + dwinIconShow(ICON, ICON_Bar, 15, 260); + dwinDrawRectangle(1, Color_Bg_Black, 15 + t * 242 / 100, 260, 257, 280); + dwinUpdateLCD(); delay(20); } - DWIN_JPG_ShowAndCache(3); - DWIN_JPG_CacheTo1(Language_English); - CrealityDWIN.Redraw_Screen(); + dwinJPGShowAndCache(3); + dwinJPGCacheTo1(Language_English); + crealityDWIN.redrawScreen(); } #if ENABLED(ADVANCED_PAUSE_FEATURE) void MarlinUI::pause_show_message(const PauseMessage message, const PauseMode mode/*=PAUSE_MODE_SAME*/, const uint8_t extruder/*=active_extruder*/) { switch (message) { - case PAUSE_MESSAGE_INSERT: CrealityDWIN.Confirm_Handler(FilInsert); break; + case PAUSE_MESSAGE_INSERT: crealityDWIN.confirmHandler(FilInsert); break; case PAUSE_MESSAGE_PURGE: - case PAUSE_MESSAGE_OPTION: CrealityDWIN.Popup_Handler(PurgeMore); break; - case PAUSE_MESSAGE_HEAT: CrealityDWIN.Confirm_Handler(HeaterTime); break; - case PAUSE_MESSAGE_WAITING: CrealityDWIN.Draw_Print_Screen(); break; + case PAUSE_MESSAGE_OPTION: crealityDWIN.popupHandler(PurgeMore); break; + case PAUSE_MESSAGE_HEAT: crealityDWIN.confirmHandler(HeaterTime); break; + case PAUSE_MESSAGE_WAITING: crealityDWIN.drawPrintScreen(); break; default: break; } } diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.h b/Marlin/src/lcd/e3v2/jyersui/dwin.h index 2f5369d4a6488..450345d1a2f3f 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.h +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.h @@ -148,7 +148,7 @@ enum colorID : uint8_t { #define Confirm_Color 0x34B9 #define Cancel_Color 0x3186 -class CrealityDWINClass { +class CrealityDWIN { public: static constexpr size_t eeprom_data_size = 48; static struct EEPROM_Settings { // use bit fields to save space, max 48 bytes @@ -173,76 +173,76 @@ class CrealityDWINClass { static constexpr const char * const color_names[11] = { "Default", "White", "Green", "Cyan", "Blue", "Magenta", "Red", "Orange", "Yellow", "Brown", "Black" }; static constexpr const char * const preheat_modes[3] = { "Both", "Hotend", "Bed" }; - static void Clear_Screen(const uint8_t e=3); - static void Draw_Float(const_float_t value, const uint8_t row, const bool selected=false, const uint8_t minunit=10); - static void Draw_Option(const uint8_t value, const char * const * options, const uint8_t row, const bool selected=false, const bool color=false); - static uint16_t GetColor(const uint8_t color, const uint16_t original, const bool light=false); - static void Draw_Checkbox(const uint8_t row, const bool value); - static void Draw_Title(const char * const title); - static void Draw_Title(FSTR_P const title); - static void Draw_Menu_Item(const uint8_t row, uint8_t icon=0, const char * const label1=nullptr, const char * const label2=nullptr, const bool more=false, const bool centered=false); - static void Draw_Menu_Item(const uint8_t row, uint8_t icon=0, FSTR_P const flabel1=nullptr, FSTR_P const flabel2=nullptr, const bool more=false, const bool centered=false); - static void Draw_Menu(const uint8_t menu, const uint8_t select=0, const uint8_t scroll=0); - static void Redraw_Menu(const bool lastproc=true, const bool lastsel=false, const bool lastmenu=false); - static void Redraw_Screen(); - - static void Main_Menu_Icons(); - static void Draw_Main_Menu(uint8_t select=0); - static void Print_Screen_Icons(); - static void Draw_Print_Screen(); - static void Draw_Print_Filename(const bool reset=false); - static void Draw_Print_ProgressBar(); + static void clearScreen(const uint8_t e=3); + static void drawFloat(const_float_t value, const uint8_t row, const bool selected=false, const uint8_t minunit=10); + static void drawOption(const uint8_t value, const char * const * options, const uint8_t row, const bool selected=false, const bool color=false); + static uint16_t getColor(const uint8_t color, const uint16_t original, const bool light=false); + static void drawCheckbox(const uint8_t row, const bool value); + static void drawTitle(const char * const title); + static void drawTitle(FSTR_P const title); + static void drawMenuItem(const uint8_t row, uint8_t icon=0, const char * const label1=nullptr, const char * const label2=nullptr, const bool more=false, const bool centered=false); + static void drawMenuItem(const uint8_t row, uint8_t icon=0, FSTR_P const flabel1=nullptr, FSTR_P const flabel2=nullptr, const bool more=false, const bool centered=false); + static void drawMenu(const uint8_t menu, const uint8_t select=0, const uint8_t scroll=0); + static void redrawMenu(const bool lastproc=true, const bool lastsel=false, const bool lastmenu=false); + static void redrawScreen(); + + static void mainMenuIcons(); + static void drawMainMenu(uint8_t select=0); + static void printScreenIcons(); + static void drawPrintScreen(); + static void drawPrintFilename(const bool reset=false); + static void drawPrintProgressBar(); #if ENABLED(SET_REMAINING_TIME) - static void Draw_Print_ProgressRemain(); + static void drawPrintProgressRemain(); #endif - static void Draw_Print_ProgressElapsed(); - static void Draw_Print_confirm(); - static void Draw_SD_Item(const uint8_t item, const uint8_t row); - static void Draw_SD_List(const bool removed=false); - static void Draw_Status_Area(const bool icons=false); - static void Draw_Popup(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, uint8_t mode, uint8_t icon=0); - static void Popup_Select(); - static void Update_Status_Bar(const bool refresh=false); + static void drawPrintProgressElapsed(); + static void drawPrintConfirm(); + static void drawSDItem(const uint8_t item, const uint8_t row); + static void drawSDList(const bool removed=false); + static void drawStatusArea(const bool icons=false); + static void drawPopup(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, uint8_t mode, uint8_t icon=0); + static void popupSelect(); + static void updateStatusBar(const bool refresh=false); #if HAS_MESH - static void Set_Mesh_Viewer_Status(); + static void setMeshViewerStatus(); #endif - static FSTR_P Get_Menu_Title(const uint8_t menu); - static uint8_t Get_Menu_Size(const uint8_t menu); - static void Menu_Item_Handler(const uint8_t menu, const uint8_t item, bool draw=true); - - static void Popup_Handler(const PopupID popupid, bool option=false); - static void Confirm_Handler(const PopupID popupid); - - static void Main_Menu_Control(); - static void Menu_Control(); - static void Value_Control(); - static void Option_Control(); - static void File_Control(); - static void Print_Screen_Control(); - static void Popup_Control(); - static void Confirm_Control(); - - static void Setup_Value(const_float_t value, const_float_t min, const_float_t max, const_float_t unit, const uint8_t type); - static void Modify_Value(float &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()=nullptr); - static void Modify_Value(uint8_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()=nullptr); - static void Modify_Value(uint16_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()=nullptr); - static void Modify_Value(int16_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()=nullptr); - static void Modify_Value(uint32_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()=nullptr); - static void Modify_Value(int8_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()=nullptr); - static void Modify_Option(const uint8_t value, const char * const * options, const uint8_t max); - - static void Update_Status(const char * const text); - static void Start_Print(const bool sd); - static void Stop_Print(); - static void Update(); - static void State_Update(); - static void Screen_Update(); - static void AudioFeedback(const bool success=true); - static void Save_Settings(char * const buff); - static void Load_Settings(const char * const buff); - static void Reset_Settings(); + static FSTR_P getMenuTitle(const uint8_t menu); + static uint8_t getMenuSize(const uint8_t menu); + static void menuItemHandler(const uint8_t menu, const uint8_t item, bool draw=true); + + static void popupHandler(const PopupID popupid, bool option=false); + static void confirmHandler(const PopupID popupid); + + static void mainMenuControl(); + static void menuControl(); + static void valueControl(); + static void optionControl(); + static void fileControl(); + static void printScreenControl(); + static void popupControl(); + static void confirmControl(); + + static void setupValue(const_float_t value, const_float_t min, const_float_t max, const_float_t unit, const uint8_t type); + static void modifyValue(float &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()=nullptr); + static void modifyValue(uint8_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()=nullptr); + static void modifyValue(uint16_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()=nullptr); + static void modifyValue(int16_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()=nullptr); + static void modifyValue(uint32_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()=nullptr); + static void modifyValue(int8_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()=nullptr); + static void modifyOption(const uint8_t value, const char * const * options, const uint8_t max); + + static void updateStatus(const char * const text); + static void startPrint(const bool sd); + static void stopPrint(); + static void update(); + static void stateUpdate(); + static void screenUpdate(); + static void audioFeedback(const bool success=true); + static void saveSettings(char * const buff); + static void loadSettings(const char * const buff); + static void resetSettings(); }; -extern CrealityDWINClass CrealityDWIN; +extern CrealityDWIN crealityDWIN; diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin_lcd.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin_lcd.cpp index 04889e92b0387..96518b8c2100d 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin_lcd.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin_lcd.cpp @@ -33,22 +33,22 @@ /*-------------------------------------- System variable function --------------------------------------*/ -void DWIN_Startup() {} +void dwinStartup() {} /*---------------------------------------- Drawing functions ----------------------------------------*/ // Draw the degree (Β°) symbol -// Color: color +// color: color // x/y: Upper-left coordinate of the first pixel -void DWIN_Draw_DegreeSymbol(uint16_t Color, uint16_t x, uint16_t y) { - DWIN_Draw_Point(Color, 1, 1, x + 1, y); - DWIN_Draw_Point(Color, 1, 1, x + 2, y); - DWIN_Draw_Point(Color, 1, 1, x, y + 1); - DWIN_Draw_Point(Color, 1, 1, x + 3, y + 1); - DWIN_Draw_Point(Color, 1, 1, x, y + 2); - DWIN_Draw_Point(Color, 1, 1, x + 3, y + 2); - DWIN_Draw_Point(Color, 1, 1, x + 1, y + 3); - DWIN_Draw_Point(Color, 1, 1, x + 2, y + 3); +void dwinDrawDegreeSymbol(uint16_t color, uint16_t x, uint16_t y) { + dwinDrawPoint(color, 1, 1, x + 1, y); + dwinDrawPoint(color, 1, 1, x + 2, y); + dwinDrawPoint(color, 1, 1, x, y + 1); + dwinDrawPoint(color, 1, 1, x + 3, y + 1); + dwinDrawPoint(color, 1, 1, x, y + 2); + dwinDrawPoint(color, 1, 1, x + 3, y + 2); + dwinDrawPoint(color, 1, 1, x + 1, y + 3); + dwinDrawPoint(color, 1, 1, x + 2, y + 3); } /*---------------------------------------- Picture related functions ----------------------------------------*/ @@ -57,8 +57,8 @@ void DWIN_Draw_DegreeSymbol(uint16_t Color, uint16_t x, uint16_t y) { // libID: Icon library ID // picID: Icon ID // x/y: Upper-left point -void DWIN_ICON_Show(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) { - DWIN_ICON_Show(true, false, false, libID, picID, x, y); +void dwinIconShow(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) { + dwinIconShow(true, false, false, libID, picID, x, y); } #endif // DWIN_CREALITY_LCD_JYERSUI diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin_lcd.h b/Marlin/src/lcd/e3v2/jyersui/dwin_lcd.h index f76cfb5d3e5fa..a9335a4f23f13 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin_lcd.h +++ b/Marlin/src/lcd/e3v2/jyersui/dwin_lcd.h @@ -29,6 +29,6 @@ #include "../common/dwin_api.h" // Draw the degree (Β°) symbol -// Color: color +// color: color // x/y: Upper-left coordinate of the first pixel -void DWIN_Draw_DegreeSymbol(uint16_t Color, uint16_t x, uint16_t y); +void dwinDrawDegreeSymbol(uint16_t color, uint16_t x, uint16_t y); diff --git a/Marlin/src/lcd/e3v2/marlinui/dwin_lcd.cpp b/Marlin/src/lcd/e3v2/marlinui/dwin_lcd.cpp index 7154270bffc6f..b6c26d4fe1ae1 100644 --- a/Marlin/src/lcd/e3v2/marlinui/dwin_lcd.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/dwin_lcd.cpp @@ -39,15 +39,15 @@ /*-------------------------------------- System variable function --------------------------------------*/ -void DWIN_Startup() { +void dwinStartup() { DEBUG_ECHOPGM("\r\nDWIN handshake "); delay(750); // Delay here or init later in the boot process - const bool success = DWIN_Handshake(); + const bool success = dwinHandshake(); if (success) DEBUG_ECHOLNPGM("ok."); else DEBUG_ECHOLNPGM("error."); - DWIN_Frame_SetDir(TERN(DWIN_MARLINUI_LANDSCAPE, 0, 1)); - DWIN_Frame_Clear(Color_Bg_Black); // MarlinUI handles the bootscreen so just clear here - DWIN_JPG_ShowAndCache(3); - DWIN_UpdateLCD(); + dwinFrameSetDir(TERN(DWIN_MARLINUI_LANDSCAPE, 0, 1)); + dwinFrameClear(Color_Bg_Black); // MarlinUI handles the bootscreen so just clear here + dwinJPGShowAndCache(3); + dwinUpdateLCD(); } /*---------------------------------------- Picture related functions ----------------------------------------*/ @@ -56,8 +56,8 @@ void DWIN_Startup() { // libID: Icon library ID // picID: Icon ID // x/y: Upper-left point -void DWIN_ICON_Show(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) { - DWIN_ICON_Show(true, false, false, libID, picID, x, y); +void dwinIconShow(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) { + dwinIconShow(true, false, false, libID, picID, x, y); } #endif // IS_DWIN_MARLINUI diff --git a/Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp b/Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp index 10a478f75650b..7830d5a37cd25 100644 --- a/Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/dwin_string.cpp @@ -133,7 +133,7 @@ void DWIN_String::add_character(const char character) { if (length < MAX_STRING_LENGTH) { data[length] = character; length++; - //span += glyph(character)->DWidth; + //span += glyph(character)->dWidth; } } @@ -141,7 +141,7 @@ void DWIN_String::rtrim(const char character) { while (length) { if (data[length - 1] == 0x20 || data[length - 1] == character) { length--; - //span -= glyph(data[length])->DWidth; + //span -= glyph(data[length])->dWidth; eol(); } else @@ -152,7 +152,7 @@ void DWIN_String::rtrim(const char character) { void DWIN_String::ltrim(const char character) { uint16_t i, j; for (i = 0; (i < length) && (data[i] == 0x20 || data[i] == character); i++) { - //span -= glyph(data[i])->DWidth; + //span -= glyph(data[i])->dWidth; } if (i == 0) return; for (j = 0; i < length; data[j++] = data[i++]); diff --git a/Marlin/src/lcd/e3v2/marlinui/dwin_string.h b/Marlin/src/lcd/e3v2/marlinui/dwin_string.h index 4224b264589b1..5d3813101455f 100644 --- a/Marlin/src/lcd/e3v2/marlinui/dwin_string.h +++ b/Marlin/src/lcd/e3v2/marlinui/dwin_string.h @@ -55,7 +55,7 @@ class DWIN_String { //static void add_glyphs(const uint8_t *font); //static font_t *font() { return font_header; }; - //static uint16_t font_height() { return font_header->FontAscent - font_header->FontDescent; } + //static uint16_t font_height() { return font_header->fontAscent - font_header->fontDescent; } //static glyph_t *glyph(uint8_t character) { return glyphs[character] ?: glyphs[0x3F]; } /* Use '?' for unknown glyphs */ //static glyph_t *glyph(uint8_t *character) { return glyph(*character); } diff --git a/Marlin/src/lcd/e3v2/marlinui/lcdprint_dwin.cpp b/Marlin/src/lcd/e3v2/marlinui/lcdprint_dwin.cpp index e603882e0cfda..f689a6ff698d4 100644 --- a/Marlin/src/lcd/e3v2/marlinui/lcdprint_dwin.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/lcdprint_dwin.cpp @@ -56,7 +56,7 @@ void lcd_put_int(const int i) { } int lcd_put_dwin_string() { - DWIN_Draw_String(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, dwin_string.string()); + dwinDrawString(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, dwin_string.string()); lcd_advance_cursor(dwin_string.length); return dwin_string.length; } @@ -67,7 +67,7 @@ int lcd_put_lchar_max(const lchar_t &c, const pixel_len_t max_length) { dwin_string.set(c); dwin_string.truncate(max_length); // Draw the char(s) at the cursor and advance the cursor - DWIN_Draw_String(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, dwin_string.string()); + dwinDrawString(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, dwin_string.string()); lcd_advance_cursor(dwin_string.length); return dwin_string.length; } @@ -92,7 +92,7 @@ static int lcd_put_u8str_max_cb(const char * utf8_str, read_byte_cb_t cb_read_by if (!wc) break; dwin_string.add(wc); } - DWIN_Draw_String(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, dwin_string.string()); + dwinDrawString(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, dwin_string.string()); lcd_advance_cursor(dwin_string.length); return dwin_string.length; } @@ -108,7 +108,7 @@ int lcd_put_u8str_max_P(PGM_P utf8_pstr, const pixel_len_t max_length) { lcd_uint_t lcd_put_u8str_P(PGM_P const ptpl, const int8_t ind, const char * const cstr/*=nullptr*/, FSTR_P const fstr/*=nullptr*/, const lcd_uint_t maxlen/*=LCD_WIDTH*/) { dwin_string.set(ptpl, ind, cstr, fstr); dwin_string.truncate(maxlen); - DWIN_Draw_String(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, dwin_string.string()); + dwinDrawString(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, dwin_string.string()); lcd_advance_cursor(dwin_string.length); return dwin_string.length; } diff --git a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp index 5d6e238fe1d20..817699fd8a97a 100644 --- a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp @@ -78,14 +78,14 @@ void MarlinUI::set_font(const uint8_t font_nr) { bool MarlinUI::detected() { return true; } // Initialize or re-initialize the LCD -void MarlinUI::init_lcd() { DWIN_Startup(); } +void MarlinUI::init_lcd() { dwinStartup(); } // This LCD should clear where it will draw anew void MarlinUI::clear_lcd() { - DWIN_ICON_AnimationControl(0x0000); // disable all icon animations - DWIN_JPG_ShowAndCache(3); - DWIN_Frame_Clear(Color_Bg_Black); - DWIN_UpdateLCD(); + dwinIconAnimationControl(0x0000); // disable all icon animations + dwinJPGShowAndCache(3); + dwinFrameClear(Color_Bg_Black); + dwinUpdateLCD(); did_first_redraw = false; } @@ -109,25 +109,25 @@ void MarlinUI::clear_lcd() { #define VERSION_Y 84 #endif - DWIN_Draw_String(false, font10x20, Color_Yellow, Color_Bg_Black, INFO_CENTER - (dwin_string.length * 10) / 2, VERSION_Y, S(dwin_string.string())); + dwinDrawString(false, font10x20, Color_Yellow, Color_Bg_Black, INFO_CENTER - (dwin_string.length * 10) / 2, VERSION_Y, S(dwin_string.string())); TERN_(SHOW_CUSTOM_BOOTSCREEN, safe_delay(CUSTOM_BOOTSCREEN_TIMEOUT)); clear_lcd(); - DWIN_ICON_Show(BOOT_ICON, ICON_MarlinBoot, LOGO_CENTER - 266 / 2, 15); + dwinIconShow(BOOT_ICON, ICON_MarlinBoot, LOGO_CENTER - 266 / 2, 15); #if ENABLED(DWIN_MARLINUI_PORTRAIT) - DWIN_ICON_Show(BOOT_ICON, ICON_OpenSource, LOGO_CENTER - 174 / 2, 280); - DWIN_ICON_Show(BOOT_ICON, ICON_GitHubURL, LOGO_CENTER - 180 / 2, 420); - DWIN_ICON_Show(BOOT_ICON, ICON_MarlinURL, LOGO_CENTER - 100 / 2, 440); - DWIN_ICON_Show(BOOT_ICON, ICON_Copyright, LOGO_CENTER - 126 / 2, 460); + dwinIconShow(BOOT_ICON, ICON_OpenSource, LOGO_CENTER - 174 / 2, 280); + dwinIconShow(BOOT_ICON, ICON_GitHubURL, LOGO_CENTER - 180 / 2, 420); + dwinIconShow(BOOT_ICON, ICON_MarlinURL, LOGO_CENTER - 100 / 2, 440); + dwinIconShow(BOOT_ICON, ICON_Copyright, LOGO_CENTER - 126 / 2, 460); #else - DWIN_ICON_Show(BOOT_ICON, ICON_MarlinBoot, LOGO_CENTER - 266 / 2, 15); - DWIN_ICON_Show(BOOT_ICON, ICON_OpenSource, INFO_CENTER - 174 / 2, 60); - DWIN_ICON_Show(BOOT_ICON, ICON_GitHubURL, INFO_CENTER - 180 / 2, 130); - DWIN_ICON_Show(BOOT_ICON, ICON_MarlinURL, INFO_CENTER - 100 / 2, 152); - DWIN_ICON_Show(BOOT_ICON, ICON_Copyright, INFO_CENTER - 126 / 2, 200); + dwinIconShow(BOOT_ICON, ICON_MarlinBoot, LOGO_CENTER - 266 / 2, 15); + dwinIconShow(BOOT_ICON, ICON_OpenSource, INFO_CENTER - 174 / 2, 60); + dwinIconShow(BOOT_ICON, ICON_GitHubURL, INFO_CENTER - 180 / 2, 130); + dwinIconShow(BOOT_ICON, ICON_MarlinURL, INFO_CENTER - 100 / 2, 152); + dwinIconShow(BOOT_ICON, ICON_Copyright, INFO_CENTER - 126 / 2, 200); #endif - DWIN_Draw_String(false, font10x20, Color_Yellow, Color_Bg_Black, INFO_CENTER - (dwin_string.length * 10) / 2, VERSION_Y, S(dwin_string.string())); - DWIN_UpdateLCD(); + dwinDrawString(false, font10x20, Color_Yellow, Color_Bg_Black, INFO_CENTER - (dwin_string.length * 10) / 2, VERSION_Y, S(dwin_string.string())); + dwinUpdateLCD(); } void MarlinUI::bootscreen_completion(const millis_t sofar) { @@ -140,23 +140,23 @@ void MarlinUI::clear_lcd() { // The kill screen is displayed for unrecoverable conditions void MarlinUI::draw_kill_screen() { set_font(DWIN_FONT_ALERT); - DWIN_Frame_Clear(Color_Bg_Black); + dwinFrameClear(Color_Bg_Black); dwin_font.fg = Color_Error_Red; dwin_font.solid = false; - DWIN_Draw_Rectangle(1, Color_Bg_Window, 20, 20, LCD_PIXEL_WIDTH - 20, LCD_PIXEL_HEIGHT - 20); + dwinDrawRectangle(1, Color_Bg_Window, 20, 20, LCD_PIXEL_WIDTH - 20, LCD_PIXEL_HEIGHT - 20); // make the frame a few pixels thick - DWIN_Draw_Rectangle(0, Color_Yellow, 20, 20, LCD_PIXEL_WIDTH - 20, LCD_PIXEL_HEIGHT - 20); - DWIN_Draw_Rectangle(0, Color_Yellow, 21, 21, LCD_PIXEL_WIDTH - 21, LCD_PIXEL_HEIGHT - 21); - DWIN_Draw_Rectangle(0, Color_Yellow, 22, 22, LCD_PIXEL_WIDTH - 22, LCD_PIXEL_HEIGHT - 22); + dwinDrawRectangle(0, Color_Yellow, 20, 20, LCD_PIXEL_WIDTH - 20, LCD_PIXEL_HEIGHT - 20); + dwinDrawRectangle(0, Color_Yellow, 21, 21, LCD_PIXEL_WIDTH - 21, LCD_PIXEL_HEIGHT - 21); + dwinDrawRectangle(0, Color_Yellow, 22, 22, LCD_PIXEL_WIDTH - 22, LCD_PIXEL_HEIGHT - 22); uint8_t cx = (LCD_PIXEL_WIDTH / dwin_font.width / 2), cy = (LCD_PIXEL_HEIGHT / dwin_font.height / 2); #if ENABLED(DWIN_MARLINUI_LANDSCAPE) cx += (96 / 2 / dwin_font.width); - DWIN_ICON_Show(ICON, ICON_Halted, 40, (LCD_PIXEL_HEIGHT - 96) / 2); + dwinIconShow(ICON, ICON_Halted, 40, (LCD_PIXEL_HEIGHT - 96) / 2); #else - DWIN_ICON_Show(ICON, ICON_Halted, (LCD_PIXEL_WIDTH - 96) / 2, 40); + dwinIconShow(ICON, ICON_Halted, (LCD_PIXEL_WIDTH - 96) / 2, 40); #endif uint8_t slen = utf8_strlen(status_message); @@ -260,7 +260,7 @@ void MarlinUI::draw_status_message(const bool blink) { } #if HAS_LCD_BRIGHTNESS - void MarlinUI::_set_brightness() { DWIN_LCD_Brightness(backlight ? brightness : 0); } + void MarlinUI::_set_brightness() { dwinLCDBrightness(backlight ? brightness : 0); } #endif #if HAS_MARLINUI_MENU @@ -295,13 +295,13 @@ void MarlinUI::draw_status_message(const bool blink) { if (y >= LCD_PIXEL_HEIGHT) return false; if (is_static && sel) - DWIN_Draw_Box(1, Color_Bg_Heading, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1); + dwinDrawBox(1, Color_Bg_Heading, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1); else { #if ENABLED(MENU_HOLLOW_FRAME) - DWIN_Draw_Box(1, Color_Bg_Black, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1); - if (sel) DWIN_Draw_Box(0, Select_Color, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1); + dwinDrawBox(1, Color_Bg_Black, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1); + if (sel) dwinDrawBox(0, Select_Color, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1); #else - DWIN_Draw_Box(1, sel ? Select_Color : Color_Bg_Black, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1); + dwinDrawBox(1, sel ? Select_Color : Color_Bg_Black, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1); #endif } @@ -425,7 +425,7 @@ void MarlinUI::draw_status_message(const bool blink) { dwin_string.set(value); const dwin_coord_t by = (row * MENU_LINE_HEIGHT) + MENU_FONT_HEIGHT + EXTRA_ROW_HEIGHT / 2; - DWIN_Draw_String(true, font16x32, Color_Yellow, Color_Bg_Black, (LCD_PIXEL_WIDTH - vallen * 16) / 2, by, S(dwin_string.string())); + dwinDrawString(true, font16x32, Color_Yellow, Color_Bg_Black, (LCD_PIXEL_WIDTH - vallen * 16) / 2, by, S(dwin_string.string())); if (ui.can_show_slider()) { @@ -435,11 +435,11 @@ void MarlinUI::draw_status_message(const bool blink) { slider_y = by + 32 + 4, amount = ui.encoderPosition * slider_length / maxEditValue; - DWIN_Draw_Rectangle(1, Color_Bg_Window, slider_x - 1, slider_y - 1, slider_x - 1 + slider_length + 2 - 1, slider_y - 1 + slider_height + 2 - 1); + dwinDrawRectangle(1, Color_Bg_Window, slider_x - 1, slider_y - 1, slider_x - 1 + slider_length + 2 - 1, slider_y - 1 + slider_height + 2 - 1); if (amount > 0) - DWIN_Draw_Box(1, BarFill_Color, slider_x, slider_y, amount, slider_height); + dwinDrawBox(1, BarFill_Color, slider_x, slider_y, amount, slider_height); if (amount < slider_length) - DWIN_Draw_Box(1, Color_Bg_Black, slider_x + amount, slider_y, slider_length - amount, slider_height); + dwinDrawBox(1, Color_Bg_Black, slider_x + amount, slider_y, slider_length - amount, slider_height); } } } @@ -450,7 +450,7 @@ void MarlinUI::draw_status_message(const bool blink) { col = yesopt ? LCD_WIDTH - mar - len : mar, row = (LCD_HEIGHT >= 8 ? LCD_HEIGHT / 2 + 3 : LCD_HEIGHT - 1); lcd_moveto(col, row); - DWIN_Draw_Box(1, inv ? Select_Color : Color_Bg_Black, cursor.x - dwin_font.width, cursor.y + 1, dwin_font.width * (len + 2), dwin_font.height + 2); + dwinDrawBox(1, inv ? Select_Color : Color_Bg_Black, cursor.x - dwin_font.width, cursor.y + 1, dwin_font.width * (len + 2), dwin_font.height + 2); lcd_put_u8str(col, row, fstr); } @@ -512,9 +512,9 @@ void MarlinUI::draw_status_message(const bool blink) { // Clear the Mesh Map // First draw the bigger box in White so we have a border around the mesh map box - DWIN_Draw_Rectangle(1, Color_White, x_offset - 2, y_offset - 2, x_offset + 2 + x_map_pixels, y_offset + 2 + y_map_pixels); + dwinDrawRectangle(1, Color_White, x_offset - 2, y_offset - 2, x_offset + 2 + x_map_pixels, y_offset + 2 + y_map_pixels); // Now actually clear the mesh map box - DWIN_Draw_Rectangle(1, Color_Bg_Black, x_offset, y_offset, x_offset + x_map_pixels, y_offset + y_map_pixels); + dwinDrawRectangle(1, Color_Bg_Black, x_offset, y_offset, x_offset + x_map_pixels, y_offset + y_map_pixels); // Fill in the Specified Mesh Point @@ -522,7 +522,7 @@ void MarlinUI::draw_status_message(const bool blink) { // invert the Y to get it to plot in the right location. const dwin_coord_t by = y_offset + y_plot_inv * pixels_per_y_mesh_pnt; - DWIN_Draw_Rectangle(1, Select_Color, + dwinDrawRectangle(1, Select_Color, x_offset + (x_plot * pixels_per_x_mesh_pnt), by, x_offset + (x_plot * pixels_per_x_mesh_pnt) + pixels_per_x_mesh_pnt, by + pixels_per_y_mesh_pnt ); @@ -532,7 +532,7 @@ void MarlinUI::draw_status_message(const bool blink) { dwin_coord_t y = y_offset + pixels_per_y_mesh_pnt / 2; for (uint8_t j = 0; j < (GRID_MAX_POINTS_Y); j++, y += pixels_per_y_mesh_pnt) for (uint8_t i = 0, x = sx; i < (GRID_MAX_POINTS_X); i++, x += pixels_per_x_mesh_pnt) - DWIN_Draw_Point(Color_White, 1, 1, x, y); + dwinDrawPoint(Color_White, 1, 1, x, y); // Put Relevant Text on Display @@ -591,17 +591,17 @@ void MarlinUI::draw_status_message(const bool blink) { const int nozzle = (LCD_PIXEL_WIDTH / 2) - 20; // Draw a representation of the nozzle - DWIN_Draw_Box(1, Color_Bg_Black, nozzle + 3, 8, 48, 52); // 'clear' the area where the nozzle is drawn in case it was moved up/down - DWIN_ICON_Show(ICON, ICON_HotendOff, nozzle + 3, 10 - dir); - DWIN_ICON_Show(ICON, ICON_BedLine, nozzle, 10 + 36); + dwinDrawBox(1, Color_Bg_Black, nozzle + 3, 8, 48, 52); // 'clear' the area where the nozzle is drawn in case it was moved up/down + dwinIconShow(ICON, ICON_HotendOff, nozzle + 3, 10 - dir); + dwinIconShow(ICON, ICON_BedLine, nozzle, 10 + 36); // Draw cw/ccw indicator and up/down arrows const int arrow_y = LCD_PIXEL_HEIGHT / 2 - 24; - DWIN_ICON_Show(ICON, ICON_DownArrow, 0, arrow_y - dir); - DWIN_ICON_Show(ICON, rot_down, 48, arrow_y); + dwinIconShow(ICON, ICON_DownArrow, 0, arrow_y - dir); + dwinIconShow(ICON, rot_down, 48, arrow_y); - DWIN_ICON_Show(ICON, ICON_UpArrow, LCD_PIXEL_WIDTH - 10 - (48*2), arrow_y - dir); - DWIN_ICON_Show(ICON, rot_up, LCD_PIXEL_WIDTH - 10 - 48, arrow_y); + dwinIconShow(ICON, ICON_UpArrow, LCD_PIXEL_WIDTH - 10 - (48*2), arrow_y - dir); + dwinIconShow(ICON, rot_up, LCD_PIXEL_WIDTH - 10 - 48, arrow_y); } #endif // BABYSTEP_GFX_OVERLAY || MESH_EDIT_GFX_OVERLAY diff --git a/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp b/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp index b66750bd88123..381aea6b17daa 100644 --- a/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp @@ -72,7 +72,7 @@ void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink, const bool x_redraw = !ui.did_first_redraw || old_is_printing != print_job_timer.isRunning(); if (x_redraw) { dwin_string.set('X' + axis); - DWIN_Draw_String(true, font16x32, Color_IconBlue, Color_Bg_Black, + dwinDrawString(true, font16x32, Color_IconBlue, Color_Bg_Black, #if ENABLED(DWIN_MARLINUI_PORTRAIT) x + (utf8_strlen(value) * 14 - 14) / 2, y + 2 #else @@ -96,7 +96,7 @@ void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink, if (TERN0(LCD_SHOW_E_TOTAL, x_redraw && axis == X_AXIS)) dwin_string.add(F(" ")); - DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, + dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, #if ENABLED(DWIN_MARLINUI_PORTRAIT) x, y + 32 #else @@ -117,26 +117,26 @@ void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink, if (e_redraw) { // Extra spaces to erase previous value dwin_string.set(F("E ")); - DWIN_Draw_String(true, font16x32, Color_IconBlue, Color_Bg_Black, x + (4 * 14 / 2) - 7, y + 2, S(dwin_string.string())); + dwinDrawString(true, font16x32, Color_IconBlue, Color_Bg_Black, x + (4 * 14 / 2) - 7, y + 2, S(dwin_string.string())); } dwin_string.set(ui16tostr5rj(value / scale)); - DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + 32, S(dwin_string.string())); + dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, x, y + 32, S(dwin_string.string())); // Extra spaces to erase previous value - DWIN_Draw_String(true, font14x28, Color_IconBlue, Color_Bg_Black, x + (5 * 14), y + 32, S(scale == 1 ? "mm " : "cm ")); + dwinDrawString(true, font14x28, Color_IconBlue, Color_Bg_Black, x + (5 * 14), y + 32, S(scale == 1 ? "mm " : "cm ")); #else // !DWIN_MARLINUI_PORTRAIT if (e_redraw) { dwin_string.set(F("E ")); - DWIN_Draw_String(true, font16x32, Color_IconBlue, Color_Bg_Black, x, y, S(dwin_string.string())); + dwinDrawString(true, font16x32, Color_IconBlue, Color_Bg_Black, x, y, S(dwin_string.string())); } dwin_string.set(ui16tostr5rj(value / scale)); - DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x + 32, y + 4, S(dwin_string.string())); + dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, x + 32, y + 4, S(dwin_string.string())); - DWIN_Draw_String(true, font14x28, Color_IconBlue, Color_Bg_Black, x + (32 + 70), y + 4, S(scale == 1 ? "mm " : "cm ")); + dwinDrawString(true, font14x28, Color_IconBlue, Color_Bg_Black, x + (32 + 70), y + 4, S(scale == 1 ? "mm " : "cm ")); #endif // !DWIN_MARLINUI_PORTRAIT } @@ -151,16 +151,16 @@ void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink, const uint16_t fanx = (4 * STATUS_CHR_WIDTH - STATUS_FAN_WIDTH) / 2; const bool fan_on = !!thermalManager.scaledFanSpeed(0); if (fan_on) { - DWIN_ICON_Animation(0, fan_on, ICON, ICON_Fan0, ICON_Fan3, x + fanx, y, 25); + dwinIconAnimation(0, fan_on, ICON, ICON_Fan0, ICON_Fan3, x + fanx, y, 25); dwin_string.set(i8tostr3rj(thermalManager.scaledFanSpeedPercent(0))); dwin_string.add('%'); - DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string())); + dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string())); } else { - DWIN_ICON_AnimationControl(0x0000); // disable all icon animations (this is the only one) - DWIN_ICON_Show(ICON, ICON_Fan0, x + fanx, y); + dwinIconAnimationControl(0x0000); // disable all icon animations (this is the only one) + dwinIconShow(ICON, ICON_Fan0, x + fanx, y); dwin_string.set(F(" ")); - DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string())); + dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string())); } } #endif @@ -230,20 +230,20 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater, const uint16_t x if (t_draw) { dwin_string.set(i16tostr3rj(tt + 0.5)); dwin_string.add(LCD_STR_DEGREE); - DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y, S(dwin_string.string())); + dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, x, y, S(dwin_string.string())); } // Draw heater icon with on / off / leveled states if (i_draw) { const uint8_t ico = isBed ? (TERN0(HAS_LEVELING, planner.leveling_active) ? ICON_BedLevelOff : ICON_BedOff) : ICON_HotendOff; - DWIN_ICON_Show(ICON, ico + ta, x, y + STATUS_CHR_HEIGHT + 2); + dwinIconShow(ICON, ico + ta, x, y + STATUS_CHR_HEIGHT + 2); } // Draw current temperature, if needed if (c_draw) { dwin_string.set(i16tostr3rj(tc + 0.5)); dwin_string.add(LCD_STR_DEGREE); - DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + 70, S(dwin_string.string())); + dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, x, y + 70, S(dwin_string.string())); } } @@ -253,12 +253,12 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater, const uint16_t x FORCE_INLINE void _draw_feedrate_status(const char *value, uint16_t x, uint16_t y) { if (!ui.did_first_redraw) { dwin_string.set(LCD_STR_FEEDRATE); - DWIN_Draw_String(true, font14x28, Color_IconBlue, Color_Bg_Black, x, y, S(dwin_string.string())); + dwinDrawString(true, font14x28, Color_IconBlue, Color_Bg_Black, x, y, S(dwin_string.string())); } dwin_string.set(value); dwin_string.add('%'); - DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x + 14, y, S(dwin_string.string())); + dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, x + 14, y, S(dwin_string.string())); } /** @@ -272,7 +272,7 @@ void MarlinUI::draw_status_screen() { // Logo/Status Icon #define STATUS_LOGO_WIDTH 128 #define STATUS_LOGO_HEIGHT 40 - DWIN_ICON_Show(ICON, ICON_LOGO_Marlin, + dwinIconShow(ICON, ICON_LOGO_Marlin, #if ENABLED(DWIN_MARLINUI_PORTRAIT) (LCD_PIXEL_WIDTH - (STATUS_LOGO_WIDTH)) / 2, ((STATUS_HEATERS_Y - 4) - (STATUS_LOGO_HEIGHT)) / 2 #else @@ -281,7 +281,7 @@ void MarlinUI::draw_status_screen() { ); // Draw a frame around the x/y/z values - DWIN_Draw_Rectangle(0, Select_Color, + dwinDrawRectangle(0, Select_Color, #if ENABLED(DWIN_MARLINUI_PORTRAIT) 0, 193, LCD_PIXEL_WIDTH - 1, 260 #else @@ -358,7 +358,7 @@ void MarlinUI::draw_status_screen() { time.toDigital(buffer); dwin_string.add(prefix); dwin_string.add(buffer); - DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, (LCD_PIXEL_WIDTH - ((dwin_string.length + 1) * 14)), 290, S(dwin_string.string())); + dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, (LCD_PIXEL_WIDTH - ((dwin_string.length + 1) * 14)), 290, S(dwin_string.string())); #else @@ -367,23 +367,23 @@ void MarlinUI::draw_status_screen() { time.toDigital(buffer); dwin_string.set(' '); dwin_string.add(buffer); - DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, 230, 170, S(dwin_string.string())); + dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, 230, 170, S(dwin_string.string())); #if ENABLED(SHOW_REMAINING_TIME) if (print_job_timer.isRunning()) { time = get_remaining_time(); - DWIN_Draw_String(true, font14x28, Color_IconBlue, Color_Bg_Black, 336, 170, S(" R ")); + dwinDrawString(true, font14x28, Color_IconBlue, Color_Bg_Black, 336, 170, S(" R ")); if (print_job_timer.isPaused() && blink) dwin_string.set(F(" ")); else { time.toDigital(buffer); dwin_string.set(buffer); } - DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, 378, 170, S(dwin_string.string())); + dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, 378, 170, S(dwin_string.string())); } else if (!ui.did_first_redraw || old_is_printing != print_job_timer.isRunning()) { dwin_string.set(F(" ")); - DWIN_Draw_String(true, font14x28, Color_IconBlue, Color_Bg_Black, 336, 170, S(dwin_string.string())); + dwinDrawString(true, font14x28, Color_IconBlue, Color_Bg_Black, 336, 170, S(dwin_string.string())); } #endif #endif @@ -403,7 +403,7 @@ void MarlinUI::draw_status_screen() { const progress_t progress = TERN(HAS_PRINT_PROGRESS_PERMYRIAD, get_progress_permyriad, get_progress_percent)(); if (!ui.did_first_redraw) - DWIN_Draw_Rectangle(0, Select_Color, pb_left, pb_top, pb_right, pb_bottom); // Outline + dwinDrawRectangle(0, Select_Color, pb_left, pb_top, pb_right, pb_bottom); // Outline static uint16_t old_solid = 50; const uint16_t pb_solid = (pb_width - 2) * (progress / (PROGRESS_SCALE)) * 0.01f; @@ -411,15 +411,15 @@ void MarlinUI::draw_status_screen() { if (p_draw) { //if (pb_solid) - DWIN_Draw_Rectangle(1, Select_Color, pb_left + 1, pb_top + 1, pb_left + pb_solid, pb_bottom - 1); // Fill the solid part + dwinDrawRectangle(1, Select_Color, pb_left + 1, pb_top + 1, pb_left + pb_solid, pb_bottom - 1); // Fill the solid part //if (pb_solid < old_solid) - DWIN_Draw_Rectangle(1, Color_Bg_Black, pb_left + 1 + pb_solid, pb_top + 1, pb_right - 1, pb_bottom - 1); // Erase the rest + dwinDrawRectangle(1, Color_Bg_Black, pb_left + 1 + pb_solid, pb_top + 1, pb_right - 1, pb_bottom - 1); // Erase the rest #if ENABLED(SHOW_PROGRESS_PERCENT) dwin_string.set(TERN(PRINT_PROGRESS_SHOW_DECIMALS, permyriadtostr4(progress), ui8tostr3rj(progress / (PROGRESS_SCALE)))); dwin_string.add('%'); - DWIN_Draw_String( + dwinDrawString( false, font16x32, Percent_Color, Color_Bg_Black, pb_left + (pb_width - dwin_string.length * 16) / 2, pb_top + (pb_height - 32) / 2 - 1, diff --git a/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp b/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp index 48e07cc207938..69721e4e7751f 100644 --- a/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp +++ b/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp @@ -104,29 +104,17 @@ char cmd[MAX_CMD_SIZE+16], str_1[16], str_2[16], str_3[16]; matrix_3x3 rotation = matrix_3x3::create_look_at(vector_3(lsf_results.A, lsf_results.B, 1)); GRID_LOOP(i, j) { - float mx = bedlevel.get_mesh_x(i), - my = bedlevel.get_mesh_y(j), - mz = bedlevel.z_values[i][j]; + float mx = bedlevel.get_mesh_x(i), my = bedlevel.get_mesh_y(j), mz = bedlevel.z_values[i][j]; if (DEBUGGING(LEVELING)) { - DEBUG_ECHOPAIR_F("before rotation = [", mx, 7); - DEBUG_CHAR(','); - DEBUG_ECHO_F(my, 7); - DEBUG_CHAR(','); - DEBUG_ECHO_F(mz, 7); - DEBUG_ECHOPGM("] ---> "); + DEBUG_ECHOLN(F("before rotation = ["), p_float_t(mx, 7), AS_CHAR(','), p_float_t(my, 7), AS_CHAR(','), p_float_t(mz, 7), F("] ---> ")); DEBUG_DELAY(20); } rotation.apply_rotation_xyz(mx, my, mz); if (DEBUGGING(LEVELING)) { - DEBUG_ECHOPAIR_F("after rotation = [", mx, 7); - DEBUG_CHAR(','); - DEBUG_ECHO_F(my, 7); - DEBUG_CHAR(','); - DEBUG_ECHO_F(mz, 7); - DEBUG_ECHOLNPGM("]"); + DEBUG_ECHOLN(F("after rotation = ["), p_float_t(mx, 7), AS_CHAR(','), p_float_t(my, 7), AS_CHAR(','), p_float_t(mz, 7), F("] ---> ")); DEBUG_DELAY(20); } diff --git a/Marlin/src/lcd/extui/anycubic/Tunes.cpp b/Marlin/src/lcd/extui/anycubic/Tunes.cpp index 8a9e84f0001df..6e7aecefa9cb7 100644 --- a/Marlin/src/lcd/extui/anycubic/Tunes.cpp +++ b/Marlin/src/lcd/extui/anycubic/Tunes.cpp @@ -39,7 +39,7 @@ namespace Anycubic { - void PlayTune(const uint16_t *tune, const uint8_t speed/*=1*/) { + void playTune(const uint16_t *tune, const uint8_t speed/*=1*/) { const uint16_t wholenotelen = tune[0] / speed; for (uint8_t pos = 1; pos < MAX_TUNE_LENGTH; pos += 2) { const uint16_t freq = tune[pos]; diff --git a/Marlin/src/lcd/extui/anycubic/Tunes.h b/Marlin/src/lcd/extui/anycubic/Tunes.h index 8b99f1f863e9b..73483a9bdd9ca 100644 --- a/Marlin/src/lcd/extui/anycubic/Tunes.h +++ b/Marlin/src/lcd/extui/anycubic/Tunes.h @@ -61,7 +61,7 @@ n_END=10000 // end of tune marker namespace Anycubic { - void PlayTune(const uint16_t *tune, const uint8_t speed=1); + void playTune(const uint16_t *tune, const uint8_t speed=1); // Only uncomment the tunes you are using to save memory // This will help you write tunes! diff --git a/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp b/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp index bcf78746a2407..6c8c3aa3a5aa0 100644 --- a/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp +++ b/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp @@ -88,14 +88,9 @@ void ChironTFT::startup() { // So we need to know what we are working with. // Panel type can be defined otherwise detect it automatically switch (panel_type) { - case AC_panel_new: - SERIAL_ECHOLNF(AC_msg_new_panel_set); - break; - case AC_panel_standard: - SERIAL_ECHOLNF(AC_msg_old_panel_set); - break; - default: - SERIAL_ECHOLNF(AC_msg_auto_panel_detection); + case AC_panel_new: SERIAL_ECHOLN(AC_msg_new_panel_set); break; + case AC_panel_standard: SERIAL_ECHOLN(AC_msg_old_panel_set); break; + default: SERIAL_ECHOLN(AC_msg_auto_panel_detection); detectPanelType(); break; } @@ -108,7 +103,7 @@ void ChironTFT::startup() { injectCommands(AC_cmnd_enable_leveling); // startup tunes are defined in Tunes.h - PlayTune(TERN(AC_DEFAULT_STARTUP_TUNE, Anycubic_PowerOn, GB_PowerOn)); + playTune(TERN(AC_DEFAULT_STARTUP_TUNE, Anycubic_PowerOn, GB_PowerOn)); #if ACDEBUGLEVEL DEBUG_ECHOLNPGM("AC Debug Level ", ACDEBUGLEVEL); @@ -196,7 +191,7 @@ void ChironTFT::filamentRunout() { // 1 Signal filament out last_error = AC_error_filament_runout; tftSendLn(isPrintingFromMedia() ? AC_msg_filament_out_alert : AC_msg_filament_out_block); - PlayTune(FilamentOut); + playTune(FilamentOut); } void ChironTFT::confirmationRequest(const char * const msg) { @@ -219,7 +214,7 @@ void ChironTFT::confirmationRequest(const char * const msg) { if (strcmp_P(msg, MARLIN_msg_heater_timeout) == 0) { pause_state = AC_paused_heater_timed_out; tftSendLn(AC_msg_paused); // enable continue button - PlayTune(HeaterTimeout); + playTune(HeaterTimeout); } // Reheat finished, send acknowledgement else if (strcmp_P(msg, MARLIN_msg_reheat_done) == 0) { @@ -257,7 +252,7 @@ void ChironTFT::statusChange(const char * const msg) { } // If probing fails don't save the mesh raise the probe above the bad point if (strcmp_P(msg, MARLIN_msg_probing_failed) == 0) { - PlayTune(BeepBeepBeeep); + playTune(BeepBeepBeeep); injectCommands(F("G1 Z50 F500")); tftSendLn(AC_msg_probing_complete); printer_state = AC_printer_idle; @@ -311,8 +306,8 @@ void ChironTFT::statusChange(const char * const msg) { void ChironTFT::powerLossRecovery() { printer_state = AC_printer_resuming_from_power_outage; // Play tune to notify user we can recover. last_error = AC_error_powerloss; - PlayTune(SOS); - SERIAL_ECHOLNF(AC_msg_powerloss_recovery); + playTune(SOS); + SERIAL_ECHOLN(AC_msg_powerloss_recovery); } void ChironTFT::printComplete() { @@ -323,7 +318,7 @@ void ChironTFT::printComplete() { void ChironTFT::tftSend(FSTR_P const fstr/*=nullptr*/) { // A helper to print PROGMEM string to the panel #if ACDEBUG(AC_SOME) - DEBUG_ECHOF(fstr); + DEBUG_ECHO(fstr); #endif PGM_P str = FTOP(fstr); while (const char c = pgm_read_byte(str++)) TFTSer.write(c); @@ -447,7 +442,7 @@ void ChironTFT::selectFile() { selectedfile[command_len - 5] = '\0'; } #if ACDEBUG(AC_FILE) - DEBUG_ECHOLNPGM(" Selected File: ",selectedfile); + DEBUG_ECHOLNPGM(" Selected File: ", selectedfile); #endif switch (selectedfile[0]) { case '/': // Valid file selected @@ -494,7 +489,7 @@ void ChironTFT::processPanelRequest() { if (tpos >= 0) { if (panel_command[tpos + 1] == 'X' && panel_command[tpos + 2] =='Y') { panel_type = AC_panel_standard; - SERIAL_ECHOLNF(AC_msg_old_panel_detected); + SERIAL_ECHOLN(AC_msg_old_panel_detected); } } else { @@ -504,7 +499,7 @@ void ChironTFT::processPanelRequest() { if (tpos >= 0) { if (panel_command[tpos + 1] == '0' && panel_command[tpos + 2] ==']') { panel_type = AC_panel_new; - SERIAL_ECHOLNF(AC_msg_new_panel_detected); + SERIAL_ECHOLN(AC_msg_new_panel_detected); } } } @@ -828,7 +823,7 @@ void ChironTFT::panelProcess(uint8_t req) { if (!isPrinting()) { injectCommands(F("M501\nM420 S1")); selectedmeshpoint.x = selectedmeshpoint.y = 99; - SERIAL_ECHOLNF(AC_msg_mesh_changes_abandoned); + SERIAL_ECHOLN(AC_msg_mesh_changes_abandoned); } } @@ -836,7 +831,7 @@ void ChironTFT::panelProcess(uint8_t req) { if (!isPrinting()) { setAxisPosition_mm(1.0,Z); // Lift nozzle before any further movements are made injectCommands(F("M500")); - SERIAL_ECHOLNF(AC_msg_mesh_changes_saved); + SERIAL_ECHOLN(AC_msg_mesh_changes_saved); selectedmeshpoint.x = selectedmeshpoint.y = 99; } } diff --git a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp index a560e5e9a0788..8b073652b0447 100644 --- a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp +++ b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp @@ -24,7 +24,7 @@ #if ENABLED(ANYCUBIC_LCD_I3MEGA) //#define ANYCUBIC_LCD_DEBUG -#define DEBUG_OUT ANYCUBIC_LCD_DEBUG +#define DEBUG_OUT ENABLED(ANYCUBIC_LCD_DEBUG) #include "../../../core/debug_out.h" #include "anycubic_i3mega_lcd.h" @@ -51,20 +51,19 @@ #define SPECIAL_MENU_FILENAME(A) A TERN_(ANYCUBIC_LCD_GCODE_EXT, ".gcode") #define SPECIAL_MENU_ALTNAME(A, B) TERN(ANYCUBIC_LCD_GCODE_EXT, A ".gcode", B) -AnycubicTFTClass anycubicTFT; +AnycubicTFT anycubicTFT; -char AnycubicTFTClass::tftCommands[TFTBUFSIZE][TFT_MAX_CMD_SIZE]; -int AnycubicTFTClass::tftBufLen = 0, - AnycubicTFTClass::tftBufIndR = 0, - AnycubicTFTClass::tftBufIndW = 0; -char AnycubicTFTClass::serial3_char; -char* AnycubicTFTClass::tftStrchrPtr; -uint8_t AnycubicTFTClass::specialMenu = false; -AnycubicMediaPrintState AnycubicTFTClass::mediaPrintingState = AMPRINTSTATE_NOT_PRINTING; -AnycubicMediaPauseState AnycubicTFTClass::mediaPauseState = AMPAUSESTATE_NOT_PAUSED; +char AnycubicTFT::tftCommands[TFTBUFSIZE][TFT_MAX_CMD_SIZE]; +int AnycubicTFT::tftBufLen = 0, + AnycubicTFT::tftBufIndR = 0, + AnycubicTFT::tftBufIndW = 0; +char* AnycubicTFT::tftStrchrPtr; +uint8_t AnycubicTFT::specialMenu = false; +AnycubicMediaPrintState AnycubicTFT::mediaPrintingState = AMPRINTSTATE_NOT_PRINTING; +AnycubicMediaPauseState AnycubicTFT::mediaPauseState = AMPAUSESTATE_NOT_PAUSED; -char AnycubicTFTClass::selectedDirectory[30]; -char AnycubicTFTClass::selectedFile[FILENAME_LENGTH]; +char AnycubicTFT::selectedDirectory[30]; +char AnycubicTFT::selectedFile[FILENAME_LENGTH]; // Serial helpers static void sendNewLine() { LCD_SERIAL.write('\r'); LCD_SERIAL.write('\n'); } @@ -78,9 +77,9 @@ static void sendLine_P(PGM_P str) { send_P(str); sendNewLine(); } using namespace ExtUI; -AnycubicTFTClass::AnycubicTFTClass() {} +AnycubicTFT::AnycubicTFT() {} -void AnycubicTFTClass::onSetup() { +void AnycubicTFT::onSetup() { #ifndef LCD_BAUDRATE #define LCD_BAUDRATE 115200 #endif @@ -110,7 +109,7 @@ void AnycubicTFTClass::onSetup() { DEBUG_ECHOLNPGM("TFT Serial Debug: Finished startup"); } -void AnycubicTFTClass::onCommandScan() { +void AnycubicTFT::onCommandScan() { static millis_t nextStopCheck = 0; // used to slow the stopped print check down to reasonable times const millis_t ms = millis(); if (ELAPSED(ms, nextStopCheck)) { @@ -135,26 +134,26 @@ void AnycubicTFTClass::onCommandScan() { } } -void AnycubicTFTClass::onKillTFT() { +void AnycubicTFT::onKillTFT() { SENDLINE_DBG_PGM("J11", "TFT Serial Debug: Kill command... J11"); } -void AnycubicTFTClass::onSDCardStateChange(bool isInserted) { +void AnycubicTFT::onSDCardStateChange(bool isInserted) { DEBUG_ECHOLNPGM("TFT Serial Debug: onSDCardStateChange event triggered...", isInserted); doSDCardStateCheck(); } -void AnycubicTFTClass::onSDCardError() { +void AnycubicTFT::onSDCardError() { DEBUG_ECHOLNPGM("TFT Serial Debug: onSDCardError event triggered..."); SENDLINE_DBG_PGM("J21", "TFT Serial Debug: On SD Card Error ... J21"); } -void AnycubicTFTClass::onFilamentRunout() { +void AnycubicTFT::onFilamentRunout() { DEBUG_ECHOLNPGM("TFT Serial Debug: onFilamentRunout triggered..."); doFilamentRunoutCheck(); } -void AnycubicTFTClass::onUserConfirmRequired(const char * const msg) { +void AnycubicTFT::onUserConfirmRequired(const char * const msg) { DEBUG_ECHOLNPGM("TFT Serial Debug: onUserConfirmRequired triggered... ", msg); #if HAS_MEDIA @@ -206,23 +205,23 @@ void AnycubicTFTClass::onUserConfirmRequired(const char * const msg) { #endif } -float AnycubicTFTClass::codeValue() { +float AnycubicTFT::codeValue() { return (strtod(&tftCommands[tftBufIndR][tftStrchrPtr - tftCommands[tftBufIndR] + 1], nullptr)); } -bool AnycubicTFTClass::codeSeen(char code) { +bool AnycubicTFT::codeSeen(char code) { tftStrchrPtr = strchr(tftCommands[tftBufIndR], code); return !!tftStrchrPtr; // Return True if a character was found } -bool AnycubicTFTClass::isNozzleHomed() { +bool AnycubicTFT::isNozzleHomed() { const float xPosition = getAxisPosition_mm((axis_t) X); const float yPosition = getAxisPosition_mm((axis_t) Y); return WITHIN(xPosition, X_MIN_POS - 0.1, X_MIN_POS + 0.1) && WITHIN(yPosition, Y_MIN_POS - 0.1, Y_MIN_POS + 0.1); } -void AnycubicTFTClass::handleSpecialMenu() { +void AnycubicTFT::handleSpecialMenu() { /** * NOTE: that the file selection command actual lowercases the entire selected file/foldername, so charracter comparisons need to be lowercase. */ @@ -355,7 +354,7 @@ void AnycubicTFTClass::handleSpecialMenu() { } -void AnycubicTFTClass::renderCurrentFileList() { +void AnycubicTFT::renderCurrentFileList() { #if HAS_MEDIA uint16_t selectedNumber = 0; selectedDirectory[0] = 0; @@ -383,7 +382,7 @@ void AnycubicTFTClass::renderCurrentFileList() { #endif // HAS_MEDIA } -void AnycubicTFTClass::renderSpecialMenu(uint16_t selectedNumber) { +void AnycubicTFT::renderSpecialMenu(uint16_t selectedNumber) { switch (selectedNumber) { default: break; @@ -450,7 +449,7 @@ void AnycubicTFTClass::renderSpecialMenu(uint16_t selectedNumber) { } } -void AnycubicTFTClass::renderCurrentFolder(uint16_t selectedNumber) { +void AnycubicTFT::renderCurrentFolder(uint16_t selectedNumber) { FileList currentFileList; const uint16_t dir_files = currentFileList.count(), max_files = (dir_files - selectedNumber) < 4 ? dir_files : selectedNumber + 3; @@ -485,14 +484,14 @@ void AnycubicTFTClass::renderCurrentFolder(uint16_t selectedNumber) { } } -void AnycubicTFTClass::onPrintTimerStarted() { +void AnycubicTFT::onPrintTimerStarted() { #if HAS_MEDIA if (mediaPrintingState == AMPRINTSTATE_PRINTING) SENDLINE_DBG_PGM("J04", "TFT Serial Debug: Starting SD Print... J04"); // J04 Starting Print #endif } -void AnycubicTFTClass::onPrintTimerPaused() { +void AnycubicTFT::onPrintTimerPaused() { #if HAS_MEDIA if (isPrintingFromMedia()) { mediaPrintingState = AMPRINTSTATE_PAUSED; @@ -501,7 +500,7 @@ void AnycubicTFTClass::onPrintTimerPaused() { #endif } -void AnycubicTFTClass::onPrintTimerStopped() { +void AnycubicTFT::onPrintTimerStopped() { #if HAS_MEDIA if (mediaPrintingState == AMPRINTSTATE_PRINTING) { mediaPrintingState = AMPRINTSTATE_NOT_PRINTING; @@ -514,7 +513,7 @@ void AnycubicTFTClass::onPrintTimerStopped() { #define ROUND(val) int((val)+0.5f) -void AnycubicTFTClass::getCommandFromTFT() { +void AnycubicTFT::getCommandFromTFT() { static int serial_count = 0; char *starpos = nullptr; @@ -884,7 +883,7 @@ void AnycubicTFTClass::getCommandFromTFT() { } // while } -void AnycubicTFTClass::doSDCardStateCheck() { +void AnycubicTFT::doSDCardStateCheck() { #if ALL(HAS_MEDIA, HAS_SD_DETECT) bool isInserted = isMediaInserted(); if (isInserted) @@ -895,7 +894,7 @@ void AnycubicTFTClass::doSDCardStateCheck() { #endif } -void AnycubicTFTClass::doFilamentRunoutCheck() { +void AnycubicTFT::doFilamentRunoutCheck() { #if ENABLED(FILAMENT_RUNOUT_SENSOR) // NOTE: getFilamentRunoutState() only returns the runout state if the job is printing // we want to actually check the status of the pin here, regardless of printstate @@ -914,7 +913,7 @@ void AnycubicTFTClass::doFilamentRunoutCheck() { #endif // FILAMENT_RUNOUT_SENSOR } -void AnycubicTFTClass::startPrint() { +void AnycubicTFT::startPrint() { #if HAS_MEDIA if (!isPrinting() && strlen(selectedFile) > 0) { DEBUG_ECHOLNPGM("TFT Serial Debug: About to print file ... ", isPrinting(), " ", selectedFile); @@ -925,7 +924,7 @@ void AnycubicTFTClass::startPrint() { #endif // SDUPPORT } -void AnycubicTFTClass::pausePrint() { +void AnycubicTFT::pausePrint() { #if HAS_MEDIA if (isPrintingFromMedia() && mediaPrintingState != AMPRINTSTATE_STOP_REQUESTED && mediaPauseState == AMPAUSESTATE_NOT_PAUSED) { mediaPrintingState = AMPRINTSTATE_PAUSE_REQUESTED; @@ -939,7 +938,7 @@ void AnycubicTFTClass::pausePrint() { #endif } -void AnycubicTFTClass::resumePrint() { +void AnycubicTFT::resumePrint() { #if HAS_MEDIA #if ENABLED(FILAMENT_RUNOUT_SENSOR) if (READ(FIL_RUNOUT1_PIN)) { @@ -973,7 +972,7 @@ void AnycubicTFTClass::resumePrint() { #endif } -void AnycubicTFTClass::stopPrint() { +void AnycubicTFT::stopPrint() { #if HAS_MEDIA mediaPrintingState = AMPRINTSTATE_STOP_REQUESTED; mediaPauseState = AMPAUSESTATE_NOT_PAUSED; diff --git a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.h b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.h index 7316c5fc04fce..78eae62326545 100644 --- a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.h +++ b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.h @@ -45,9 +45,9 @@ enum AnycubicMediaPauseState { AMPAUSESTATE_REHEAT_FINISHED }; -class AnycubicTFTClass { +class AnycubicTFT { public: - AnycubicTFTClass(); + AnycubicTFT(); static void onSetup(); static void onCommandScan(); static void onKillTFT(); @@ -88,5 +88,5 @@ class AnycubicTFTClass { static char selectedFile[FILENAME_LENGTH]; }; -extern AnycubicTFTClass anycubicTFT; +extern AnycubicTFT anycubicTFT; extern const char G28_STR[]; diff --git a/Marlin/src/lcd/extui/anycubic_vyper/FileNavigator.cpp b/Marlin/src/lcd/extui/anycubic_vyper/FileNavigator.cpp index da88acc725c16..e3cd68fd9d482 100644 --- a/Marlin/src/lcd/extui/anycubic_vyper/FileNavigator.cpp +++ b/Marlin/src/lcd/extui/anycubic_vyper/FileNavigator.cpp @@ -91,7 +91,7 @@ namespace Anycubic { if (filelist.seek(_seek)) { //sendFile(); - DgusTFT::SendTxtToTFT(filelist.longFilename(), TXT_FILE_0 + file_num*0x30); + DgusTFT::sendTxtToTFT(filelist.longFilename(), TXT_FILE_0 + file_num*0x30); #if ACDEBUG(AC_FILE) SERIAL_ECHOLNPGM("seek: ", _seek, " '", filelist.longFilename(), "' '", currentDirPath, "", filelist.shortFilename(), "'\n"); @@ -102,7 +102,7 @@ namespace Anycubic { SERIAL_ECHOLNPGM("over seek: ", _seek); #endif - DgusTFT::SendTxtToTFT("\0", TXT_FILE_0 + file_num*0x30); + DgusTFT::sendTxtToTFT("\0", TXT_FILE_0 + file_num*0x30); } file_num++; @@ -115,7 +115,7 @@ namespace Anycubic { // Permitted special characters in file name: -_*#~ // Panel can display 22 characters per line. if (!filelist.isDir()) - DgusTFT::SendTxtToTFT(filelist.longFilename(), TXT_FILE_0); + DgusTFT::sendTxtToTFT(filelist.longFilename(), TXT_FILE_0); } void FileNavigator::changeDIR(char *folder) { diff --git a/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp b/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp index 518bda73f3f61..f27e638b32801 100644 --- a/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp +++ b/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp @@ -116,7 +116,7 @@ namespace Anycubic { void DEBUG_PRINT_TIMER_EVENT(const timer_event_t event, FSTR_P const msg=nullptr); void DEBUG_PRINT_MEDIA_EVENT(const media_event_t event, FSTR_P const msg=nullptr); - DgusTFT Dgus; + DgusTFT dgus; DgusTFT::DgusTFT() { data_buf[0] = '\0'; @@ -163,7 +163,7 @@ namespace Anycubic { void DgusTFT::paramInit() { #if ACDEBUG(AC_MARLIN) - DEBUG_ECHOLNPGM("DgusTFT::ParamInit()"); + DEBUG_ECHOLNPGM("DgusTFT::paramInit()"); #endif if (lcd_info.language == CHS) @@ -171,21 +171,21 @@ namespace Anycubic { else if (lcd_info.language == ENG) page_index_now = 121; - LcdAudioSet(lcd_info.audio_on); + lcdAudioSet(lcd_info.audio_on); #if ACDEBUG(AC_MARLIN) if (lcd_info.language == CHS) - DEBUG_ECHOLNPGM("ParamInit lcd language: CHS"); + DEBUG_ECHOLNPGM("paramInit lcd language: CHS"); else if (lcd_info.language == ENG) - DEBUG_ECHOLNPGM("ParamInit lcd language: ENG"); + DEBUG_ECHOLNPGM("paramInit lcd language: ENG"); if (lcd_info.audio_on) - DEBUG_ECHOLNPGM("ParamInit lcd audio: ON"); + DEBUG_ECHOLNPGM("paramInit lcd audio: ON"); else - DEBUG_ECHOLNPGM("ParamInit lcd audio: OFF"); + DEBUG_ECHOLNPGM("paramInit lcd audio: OFF"); #endif - RequestValueFromTFT(0x14); // get page ID + requestValueFromTFT(0x14); // get page ID } void DgusTFT::idleLoop() { @@ -296,11 +296,11 @@ namespace Anycubic { if (strcmp_P(error, PSTR("Heating Failed")) == 0) { if (strcmp_P(component, PSTR("Bed")) == 0) { - ChangePageOfTFT(PAGE_CHS_ABNORMAL_BED_HEATER); + changePageOfTFT(PAGE_CHS_ABNORMAL_BED_HEATER); SERIAL_ECHOLNPGM("Check Bed heater"); } else if (strcmp_P(component, PSTR("E1")) == 0) { - ChangePageOfTFT(PAGE_CHS_ABNORMAL_HOTEND_HEATER); + changePageOfTFT(PAGE_CHS_ABNORMAL_HOTEND_HEATER); SERIAL_ECHOLNPGM("Check E1 heater"); } @@ -308,11 +308,11 @@ namespace Anycubic { else if (strcmp_P(error, PSTR("Err: MINTEMP")) == 0) { if (strcmp_P(component, PSTR("Bed")) == 0) { - ChangePageOfTFT(PAGE_CHS_ABNORMAL_BED_NTC); + changePageOfTFT(PAGE_CHS_ABNORMAL_BED_NTC); SERIAL_ECHOLNPGM("Check Bed thermistor"); } else if (strcmp_P(component, PSTR("E1")) == 0) { - ChangePageOfTFT(PAGE_CHS_ABNORMAL_HOTEND_NTC); + changePageOfTFT(PAGE_CHS_ABNORMAL_HOTEND_NTC); SERIAL_ECHOLNPGM("Check E1 thermistor"); } @@ -320,11 +320,11 @@ namespace Anycubic { else if (strcmp_P(error, PSTR("Err: MAXTEMP")) == 0) { if (strcmp_P(component, PSTR("Bed")) == 0) { - ChangePageOfTFT(PAGE_CHS_ABNORMAL_BED_NTC); + changePageOfTFT(PAGE_CHS_ABNORMAL_BED_NTC); SERIAL_ECHOLNPGM("Check Bed thermistor"); } else if (strcmp_P(component, PSTR("E1")) == 0) { - ChangePageOfTFT(PAGE_CHS_ABNORMAL_HOTEND_NTC); + changePageOfTFT(PAGE_CHS_ABNORMAL_HOTEND_NTC); SERIAL_ECHOLNPGM("Check E1 thermistor"); } @@ -332,11 +332,11 @@ namespace Anycubic { else if (strcmp_P(error, PSTR("THERMAL RUNAWAY")) == 0) { if (strcmp_P(component, PSTR("Bed")) == 0) { - ChangePageOfTFT(PAGE_CHS_ABNORMAL_BED_HEATER); + changePageOfTFT(PAGE_CHS_ABNORMAL_BED_HEATER); SERIAL_ECHOLNPGM("Check Bed thermal runaway"); } else if (strcmp_P(component, PSTR("E1")) == 0) { - ChangePageOfTFT(PAGE_CHS_ABNORMAL_HOTEND_HEATER); + changePageOfTFT(PAGE_CHS_ABNORMAL_HOTEND_HEATER); SERIAL_ECHOLNPGM("Check E1 thermal runaway"); } @@ -344,15 +344,15 @@ namespace Anycubic { else if (strcmp_P(error, PSTR("Homing Failed")) == 0) { if (strcmp_P(component, PSTR("X")) == 0) { - ChangePageOfTFT(PAGE_CHS_ABNORMAL_X_ENDSTOP); + changePageOfTFT(PAGE_CHS_ABNORMAL_X_ENDSTOP); SERIAL_ECHOLNPGM("Check X endstop"); } else if (strcmp_P(component, PSTR("Y")) == 0) { - ChangePageOfTFT(PAGE_CHS_ABNORMAL_Y_ENDSTOP); + changePageOfTFT(PAGE_CHS_ABNORMAL_Y_ENDSTOP); SERIAL_ECHOLNPGM("Check Y endstop"); } else if (strcmp_P(component, PSTR("Z")) == 0) { - ChangePageOfTFT(PAGE_CHS_ABNORMAL_Z_ENDSTOP); + changePageOfTFT(PAGE_CHS_ABNORMAL_Z_ENDSTOP); SERIAL_ECHOLNPGM("Check Z endstop"); } @@ -361,7 +361,7 @@ namespace Anycubic { } void DgusTFT::set_descript_color(const uint16_t color, const uint8_t index/*=lcd_txtbox_index*/) { - SendColorToTFT(color, TXT_DESCRIPT_0 + 0x30 * (index - 1)); + sendColorToTFT(color, TXT_DESCRIPT_0 + 0x30 * (index - 1)); } void DgusTFT::mediaEvent(media_event_t event) { @@ -426,7 +426,7 @@ namespace Anycubic { case AC_timer_stopped: if (printer_state != AC_printer_idle) { if (printer_state == AC_printer_stopping_from_media_remove) { - ChangePageOfTFT(PAGE_NO_SD); + changePageOfTFT(PAGE_NO_SD); } else { printer_state = AC_printer_stopping; @@ -436,8 +436,8 @@ namespace Anycubic { char str_buf[20]; sprintf(str_buf, "%s H ", utostr3(time / 60)); sprintf(str_buf + strlen(str_buf), "%s M", utostr3(time % 60)); - SendTxtToTFT(str_buf, TXT_FINISH_TIME); - ChangePageOfTFT(PAGE_PRINT_FINISH); + sendTxtToTFT(str_buf, TXT_FINISH_TIME); + changePageOfTFT(PAGE_PRINT_FINISH); tftSendLn(AC_msg_print_complete); pop_up_index = 100; } @@ -463,7 +463,7 @@ namespace Anycubic { pop_up_index = 15; // show filament lack. if (READ(FIL_RUNOUT_PIN) == FIL_RUNOUT_STATE) { - PlayTune(FilamentOut); + playTune(FilamentOut); feedrate_back = getFeedrate_percent(); @@ -490,7 +490,7 @@ namespace Anycubic { case AC_printer_pausing: { if (strcmp_P(msg, MARLIN_msg_print_paused) == 0 || strcmp_P(msg, MARLIN_msg_nozzle_parked) == 0) { if (pause_state != AC_paused_filament_lack) - ChangePageOfTFT(PAGE_STATUS1); // enable continue button + changePageOfTFT(PAGE_STATUS1); // enable continue button printer_state = AC_printer_paused; } } @@ -505,7 +505,7 @@ namespace Anycubic { if (strcmp_P(msg, MARLIN_msg_heater_timeout) == 0) { pause_state = AC_paused_heater_timed_out; tftSendLn(AC_msg_paused); // enable continue button - PlayTune(HeaterTimeout); + playTune(HeaterTimeout); } // Reheat finished, send acknowledgement else if (strcmp_P(msg, MARLIN_msg_reheat_done) == 0) { @@ -567,8 +567,8 @@ namespace Anycubic { if (probe_cnt == GRID_MAX_POINTS) { probe_cnt = 0; injectCommands(F("M500")); // G27 park nozzle - //ChangePageOfTFT(PAGE_PreLEVEL); - FakeChangePageOfTFT(PAGE_PreLEVEL); // Prevent UI refreshing too quickly when probing is done + //changePageOfTFT(PAGE_PreLEVEL); + fakeChangePageOfTFT(PAGE_PreLEVEL); // Prevent UI refreshing too quickly when probing is done printer_state = AC_printer_idle; msg_matched = true; } @@ -576,19 +576,19 @@ namespace Anycubic { // If probing fails don't save the mesh raise the probe above the bad point if (strcmp_P(msg, MARLIN_msg_probing_failed) == 0) { - PlayTune(BeepBeepBeeep); + playTune(BeepBeepBeeep); injectCommands(F("G1 Z50 F500")); - ChangePageOfTFT(PAGE_CHS_ABNORMAL_LEVELING_SENSOR); + changePageOfTFT(PAGE_CHS_ABNORMAL_LEVELING_SENSOR); tftSendLn(AC_msg_probing_complete); printer_state = AC_printer_idle; msg_matched = true; } if (strcmp_P(msg, MARLIN_msg_probe_preheat_start) == 0) - ChangePageOfTFT(PAGE_CHS_PROBE_PREHEATING); + changePageOfTFT(PAGE_CHS_PROBE_PREHEATING); if (strcmp_P(msg, MARLIN_msg_probe_preheat_stop) == 0) - ChangePageOfTFT(PAGE_LEVELING); + changePageOfTFT(PAGE_LEVELING); break; #endif @@ -596,7 +596,7 @@ namespace Anycubic { case AC_printer_printing: if (strcmp_P(msg, MARLIN_msg_reheating) == 0) { tftSendLn(AC_msg_paused); // enable continue button - ChangePageOfTFT(PAGE_STATUS2); + changePageOfTFT(PAGE_STATUS2); msg_matched = true; } else if (strcmp_P(msg, MARLIN_msg_media_removed) == 0) { @@ -616,7 +616,7 @@ namespace Anycubic { case AC_printer_pausing: if (strcmp_P(msg, MARLIN_msg_print_paused) == 0) { if (pause_state != AC_paused_filament_lack) { - ChangePageOfTFT(PAGE_STATUS1); // show resume + changePageOfTFT(PAGE_STATUS1); // show resume pause_state = AC_paused_idle; } @@ -628,7 +628,7 @@ namespace Anycubic { case AC_printer_paused: if (strcmp_P(msg, MARLIN_msg_print_paused) == 0) { if (pause_state != AC_paused_filament_lack) { - ChangePageOfTFT(PAGE_STATUS1); // show resume + changePageOfTFT(PAGE_STATUS1); // show resume pause_state = AC_paused_idle; } @@ -639,7 +639,7 @@ namespace Anycubic { case AC_printer_stopping: if (strcmp_P(msg, MARLIN_msg_print_aborted) == 0) { - ChangePageOfTFT(PAGE_MAIN); + changePageOfTFT(PAGE_MAIN); printer_state = AC_printer_idle; msg_matched = true; } @@ -683,7 +683,7 @@ namespace Anycubic { void DgusTFT::homingStart() { if (!isPrintingFromMedia()) - ChangePageOfTFT(PAGE_CHS_HOMING); + changePageOfTFT(PAGE_CHS_HOMING); } void DgusTFT::homingComplete() { @@ -696,12 +696,12 @@ namespace Anycubic { #endif if (!isPrintingFromMedia()) - ChangePageOfTFT(page_index_last); + changePageOfTFT(page_index_last); } void DgusTFT::tftSend(FSTR_P const fstr/*=nullptr*/) { // A helper to print PROGMEM string to the panel #if ACDEBUG(AC_SOME) - DEBUG_ECHOF(fstr); + DEBUG_ECHO(fstr); #endif PGM_P str = FTOP(fstr); while (const char c = pgm_read_byte(str++)) TFTSer.write(c); @@ -750,7 +750,7 @@ namespace Anycubic { void DgusTFT::changePageOfTFT(const uint16_t page_index, const bool no_send/*=false*/) { #if ACDEBUG(AC_MARLIN) - DEBUG_ECHOLNPGM("ChangePageOfTFT: ", page_index); + DEBUG_ECHOLNPGM("changePageOfTFT: ", page_index); #endif uint32_t data_temp = 0; @@ -792,9 +792,9 @@ namespace Anycubic { void DgusTFT::fakeChangePageOfTFT(const uint16_t page_index) { #if ACDEBUG(AC_MARLIN) if (page_index_saved != page_index_now) - DEBUG_ECHOLNPGM("FakeChangePageOfTFT: ", page_index); + DEBUG_ECHOLNPGM("fakeChangePageOfTFT: ", page_index); #endif - ChangePageOfTFT(page_index, true); + changePageOfTFT(page_index, true); } void DgusTFT::lcdAudioSet(const bool audio_on) { @@ -896,7 +896,7 @@ namespace Anycubic { } #endif - int8_t DgusTFT::Findcmndpos(const char * buff, const char q) { + int8_t DgusTFT::findCmdPos(const char * buff, const char q) { for (int8_t pos = 0; pos < MAX_CMND_LEN; ++pos) if (buff[pos] == q) return pos; return -1; @@ -1012,7 +1012,7 @@ namespace Anycubic { temp = constrain(uint16_t(control_value), 0, HEATER_0_MAXTEMP); setTargetTemp_celsius(temp, E0); //sprintf(str_buf,"%u/%u", (uint16_t)thermalManager.degHotend(0), uint16_t(control_value)); - //SendTxtToTFT(str_buf, TXT_PRINT_HOTEND); + //sendTxtToTFT(str_buf, TXT_PRINT_HOTEND); } #endif @@ -1022,7 +1022,7 @@ namespace Anycubic { temp = constrain(uint16_t(control_value), 0, BED_MAXTEMP); setTargetTemp_celsius(temp, BED); //sprintf(str_buf,"%u/%u", uint16_t(thermalManager.degBed()), uint16_t(control_value)); - //SendTxtToTFT(str_buf, TXT_PRINT_BED); + //sendTxtToTFT(str_buf, TXT_PRINT_BED); } #endif @@ -1030,8 +1030,8 @@ namespace Anycubic { else if (control_index == TXT_FAN_SPEED_TARGET) { // fan speed control_value = (uint16_t(data_buf[4]) << 8) | uint16_t(data_buf[5]); temp = constrain(uint16_t(control_value), 0, 100); - SendValueToTFT(temp, TXT_FAN_SPEED_NOW); - SendValueToTFT(temp, TXT_FAN_SPEED_TARGET); + sendValueToTFT(temp, TXT_FAN_SPEED_NOW); + sendValueToTFT(temp, TXT_FAN_SPEED_TARGET); setTargetFan_percent(temp, FAN0); } #endif @@ -1041,47 +1041,47 @@ namespace Anycubic { const uint16_t feedrate = constrain(uint16_t(control_value), 40, 999); //feedrate_percentage=constrain(control_value,40,999); sprintf(str_buf, "%u", feedrate); - SendTxtToTFT(str_buf, TXT_PRINT_SPEED); - SendValueToTFT(feedrate, TXT_PRINT_SPEED_NOW); - SendValueToTFT(feedrate, TXT_PRINT_SPEED_TARGET); + sendTxtToTFT(str_buf, TXT_PRINT_SPEED); + sendValueToTFT(feedrate, TXT_PRINT_SPEED_NOW); + sendValueToTFT(feedrate, TXT_PRINT_SPEED_TARGET); setFeedrate_percent(feedrate); } else if (control_index == REG_LCD_READY) { control_value = (uint32_t(data_buf[3]) << 16) | (uint32_t(data_buf[4]) << 8) | uint32_t(data_buf[5]); if (control_value == 0x010072) { // startup last gif - LcdAudioSet(lcd_info.audio_on); + lcdAudioSet(lcd_info.audio_on); - SendValueToTFT(2, ADDRESS_MOVE_DISTANCE); + sendValueToTFT(2, ADDRESS_MOVE_DISTANCE); #if ENABLED(CASE_LIGHT_ENABLE) - SendValueToTFT(getCaseLightState(), ADDRESS_SYSTEM_LED_STATUS); - SendValueToTFT(getCaseLightState(), ADDRESS_PRINT_SETTING_LED_STATUS); + sendValueToTFT(getCaseLightState(), ADDRESS_SYSTEM_LED_STATUS); + sendValueToTFT(getCaseLightState(), ADDRESS_PRINT_SETTING_LED_STATUS); #endif #if ENABLED(POWER_LOSS_RECOVERY) const bool is_outage = AC_printer_resuming_from_power_outage == printer_state; if (is_outage) { - ChangePageOfTFT(PAGE_OUTAGE_RECOVERY); + changePageOfTFT(PAGE_OUTAGE_RECOVERY); #if ENABLED(LONG_FILENAME_HOST_SUPPORT) char filename[64] = { '\0' }; card.getLongPath(filename, recovery.info.sd_filename); - SendTxtToTFT(filename, TXT_OUTAGE_RECOVERY_FILE); + sendTxtToTFT(filename, TXT_OUTAGE_RECOVERY_FILE); #else - SendTxtToTFT(recovery.info.sd_filename, TXT_OUTAGE_RECOVERY_FILE); + sendTxtToTFT(recovery.info.sd_filename, TXT_OUTAGE_RECOVERY_FILE); #endif - PlayTune(SOS); + playTune(SOS); } #else constexpr bool is_outage = false; #endif - if (!is_outage) ChangePageOfTFT(PAGE_MAIN); + if (!is_outage) changePageOfTFT(PAGE_MAIN); } else if (control_value == 0x010000) { // startup first gif // startup tunes are defined in Tunes.h - PlayTune(Anycubic_PowerOn); // takes 3500 ms + playTune(Anycubic_PowerOn); // takes 3500 ms } } @@ -1133,7 +1133,7 @@ namespace Anycubic { } void DgusTFT::goto_system_page() { - ChangePageOfTFT(lcd_info.language == CHS + changePageOfTFT(lcd_info.language == CHS ? (lcd_info.audio_on ? PAGE_SYSTEM_CHS_AUDIO_ON : PAGE_SYSTEM_CHS_AUDIO_OFF) : (lcd_info.audio_on ? 11 : 50) // PAGE_SYSTEM_ENG_AUDIO_ON/OFF - 120 ); @@ -1142,7 +1142,7 @@ namespace Anycubic { void DgusTFT::toggle_audio() { lcd_info.audio_on = !lcd_info.audio_on; goto_system_page(); - LcdAudioSet(lcd_info.audio_on); + lcdAudioSet(lcd_info.audio_on); } void DgusTFT::store_changes() { @@ -1156,7 +1156,7 @@ namespace Anycubic { void DgusTFT::send_temperature_hotend(uint32_t addr) { char str_buf[16]; sprintf(str_buf, "%u/%u", uint16_t(getActualTemp_celsius(E0)), uint16_t(getTargetTemp_celsius(E0))); - SendTxtToTFT(str_buf, addr); + sendTxtToTFT(str_buf, addr); } #endif @@ -1164,7 +1164,7 @@ namespace Anycubic { void DgusTFT::send_temperature_bed(uint32_t addr) { char str_buf[16]; sprintf(str_buf, "%u/%u", uint16_t(getActualTemp_celsius(BED)), uint16_t(getTargetTemp_celsius(BED))); - SendTxtToTFT(str_buf, addr); + sendTxtToTFT(str_buf, addr); } #endif @@ -1186,19 +1186,19 @@ namespace Anycubic { set_descript_color(COLOR_BLUE); lcd_txtbox_index = 0; } - ChangePageOfTFT(PAGE_FILE); + changePageOfTFT(PAGE_FILE); sendFileList(0); } break; case 2: { // tool - ChangePageOfTFT(PAGE_TOOL); + changePageOfTFT(PAGE_TOOL); #if ENABLED(CASE_LIGHT_ENABLE) - SendValueToTFT(getCaseLightState(), ADDRESS_SYSTEM_LED_STATUS); + sendValueToTFT(getCaseLightState(), ADDRESS_SYSTEM_LED_STATUS); #endif } break; case 3: // prepare - ChangePageOfTFT(PAGE_PREPARE); + changePageOfTFT(PAGE_PREPARE); break; case 4: // system @@ -1208,7 +1208,7 @@ namespace Anycubic { #if 0 if (message_index < 30) { - SendTxtToTFT(p_mesage[message_index], TXT_MAIN_MESSAGE); + sendTxtToTFT(p_mesage[message_index], TXT_MAIN_MESSAGE); message_index = 30; } #endif @@ -1238,7 +1238,7 @@ namespace Anycubic { case 0: break; case 1: // return - ChangePageOfTFT(PAGE_MAIN); + changePageOfTFT(PAGE_MAIN); set_descript_color(COLOR_BLUE); break; @@ -1292,14 +1292,14 @@ namespace Anycubic { char str_buf[20]; strncpy_P(str_buf, filenavigator.filelist.longFilename(), 17); str_buf[17] = '\0'; - SendTxtToTFT(str_buf, TXT_PRINT_NAME); + sendTxtToTFT(str_buf, TXT_PRINT_NAME); #if ENABLED(POWER_LOSS_RECOVERY) if (printer_state == AC_printer_resuming_from_power_outage) { // Need to home here to restore the Z position //injectCommands(AC_cmnd_power_loss_recovery); //SERIAL_ECHOLNPGM("start resuming from power outage: ", AC_cmnd_power_loss_recovery); - ChangePageOfTFT(PAGE_STATUS2); // show pause + changePageOfTFT(PAGE_STATUS2); // show pause injectCommands(F("M1000")); // home and start recovery } #endif @@ -1331,20 +1331,20 @@ namespace Anycubic { char str_buf[20]; strncpy_P(str_buf, filenavigator.filelist.longFilename(), 17); str_buf[17] = '\0'; - SendTxtToTFT(str_buf, TXT_PRINT_NAME); + sendTxtToTFT(str_buf, TXT_PRINT_NAME); sprintf(str_buf, "%5.2f", getFeedrate_percent()); - SendTxtToTFT(str_buf, TXT_PRINT_SPEED); + sendTxtToTFT(str_buf, TXT_PRINT_SPEED); sprintf(str_buf, "%u", uint16_t(getProgress_percent())); - SendTxtToTFT(str_buf, TXT_PRINT_PROGRESS); + sendTxtToTFT(str_buf, TXT_PRINT_PROGRESS); uint32_t time = 0; sprintf(str_buf, "%s H ", utostr3(time / 60)); sprintf(str_buf + strlen(str_buf), "%s M", utostr3(time % 60)); - SendTxtToTFT(str_buf, TXT_PRINT_TIME); + sendTxtToTFT(str_buf, TXT_PRINT_TIME); - ChangePageOfTFT(PAGE_STATUS2); + changePageOfTFT(PAGE_STATUS2); } } break; @@ -1393,7 +1393,7 @@ namespace Anycubic { case 1: // return if (!isPrintingFromMedia()) // only idle status can return - ChangePageOfTFT(PAGE_FILE); + changePageOfTFT(PAGE_FILE); break; case 2: // resume print @@ -1408,7 +1408,7 @@ namespace Anycubic { printer_state = AC_printer_idle; pause_state = AC_paused_idle; resumePrint(); - ChangePageOfTFT(PAGE_STATUS2); // show pause print + changePageOfTFT(PAGE_STATUS2); // show pause print flash_time = ms + 1500; } else @@ -1417,16 +1417,16 @@ namespace Anycubic { case 3: // print stop if (isPrintingFromMedia()) - ChangePageOfTFT(PAGE_STOP_CONF); + changePageOfTFT(PAGE_STOP_CONF); break; case 4: // print change param - ChangePageOfTFT(PAGE_ADJUST); - TERN_(CASE_LIGHT_ENABLE, SendValueToTFT(getCaseLightState(), ADDRESS_PRINT_SETTING_LED_STATUS)); - TERN_(HAS_HOTEND, SendValueToTFT(uint16_t(getTargetTemp_celsius(E0)), TXT_ADJUST_HOTEND)); - TERN_(HAS_HEATED_BED, SendValueToTFT(uint16_t(getTargetTemp_celsius(BED)), TXT_ADJUST_BED)); + changePageOfTFT(PAGE_ADJUST); + TERN_(CASE_LIGHT_ENABLE, sendValueToTFT(getCaseLightState(), ADDRESS_PRINT_SETTING_LED_STATUS)); + TERN_(HAS_HOTEND, sendValueToTFT(uint16_t(getTargetTemp_celsius(E0)), TXT_ADJUST_HOTEND)); + TERN_(HAS_HEATED_BED, sendValueToTFT(uint16_t(getTargetTemp_celsius(BED)), TXT_ADJUST_BED)); feedrate_back = getFeedrate_percent(); - SendValueToTFT(uint16_t(feedrate_back), TXT_ADJUST_SPEED); + sendValueToTFT(uint16_t(feedrate_back), TXT_ADJUST_SPEED); flash_time = ms + 1500; break; } @@ -1444,13 +1444,13 @@ namespace Anycubic { DEBUG_ECHOLNPGM("print speed: ", str_buf); DEBUG_ECHOLNPGM("feedrate_back: ", feedrate_back); #endif - SendTxtToTFT(str_buf, TXT_PRINT_SPEED); + sendTxtToTFT(str_buf, TXT_PRINT_SPEED); feedrate_back = getFeedrate_percent(); } if (progress_last != getProgress_percent()) { sprintf(str_buf, "%u", getProgress_percent()); - SendTxtToTFT(str_buf, TXT_PRINT_PROGRESS); + sendTxtToTFT(str_buf, TXT_PRINT_PROGRESS); progress_last = getProgress_percent(); } @@ -1458,7 +1458,7 @@ namespace Anycubic { uint32_t time = getProgress_seconds_elapsed() / 60; sprintf(str_buf, "%s H ", utostr3(time / 60)); sprintf(str_buf + strlen(str_buf), "%s M", utostr3(time % 60)); - SendTxtToTFT(str_buf, TXT_PRINT_TIME); + sendTxtToTFT(str_buf, TXT_PRINT_TIME); TERN_(HAS_HOTEND, send_temperature_hotend(TXT_PRINT_HOTEND)); TERN_(HAS_HEATED_BED, send_temperature_bed(TXT_PRINT_BED)); @@ -1481,7 +1481,7 @@ namespace Anycubic { case 1: // return if (!isPrintingFromMedia()) // only is idle status can return - ChangePageOfTFT(PAGE_FILE); + changePageOfTFT(PAGE_FILE); break; case 2: // print pause @@ -1489,29 +1489,29 @@ namespace Anycubic { pausePrint(); printer_state = AC_printer_pausing; pause_state = AC_paused_idle; - ChangePageOfTFT(PAGE_WAIT_PAUSE); + changePageOfTFT(PAGE_WAIT_PAUSE); //injectCommands(F("M108")); // stop waiting temperature M109 } break; case 3: // print stop if (isPrintingFromMedia()) - ChangePageOfTFT(PAGE_STOP_CONF); + changePageOfTFT(PAGE_STOP_CONF); break; case 4: // print settings - ChangePageOfTFT(PAGE_ADJUST); - TERN_(CASE_LIGHT_ENABLE, SendValueToTFT(getCaseLightState(), ADDRESS_PRINT_SETTING_LED_STATUS)); - TERN_(HAS_HOTEND, SendValueToTFT(uint16_t(getTargetTemp_celsius(E0)), TXT_ADJUST_HOTEND)); - TERN_(HAS_HEATED_BED, SendValueToTFT(uint16_t(getTargetTemp_celsius(BED)), TXT_ADJUST_BED)); + changePageOfTFT(PAGE_ADJUST); + TERN_(CASE_LIGHT_ENABLE, sendValueToTFT(getCaseLightState(), ADDRESS_PRINT_SETTING_LED_STATUS)); + TERN_(HAS_HOTEND, sendValueToTFT(uint16_t(getTargetTemp_celsius(E0)), TXT_ADJUST_HOTEND)); + TERN_(HAS_HEATED_BED, sendValueToTFT(uint16_t(getTargetTemp_celsius(BED)), TXT_ADJUST_BED)); feedrate_back = getFeedrate_percent(); - SendValueToTFT((uint16_t)feedrate_back, TXT_ADJUST_SPEED); - TERN_(HAS_FAN, SendValueToTFT(uint16_t(getActualFan_percent(FAN0)), TXT_FAN_SPEED_TARGET)); + sendValueToTFT((uint16_t)feedrate_back, TXT_ADJUST_SPEED); + TERN_(HAS_FAN, sendValueToTFT(uint16_t(getActualFan_percent(FAN0)), TXT_FAN_SPEED_TARGET)); str_buf[0] = 0; strcat(str_buf, ftostr52sprj(getZOffset_mm()) + 3); - SendTxtToTFT(str_buf, TXT_LEVEL_OFFSET); - //SendTxtToTFT(ftostr52sprj(getZOffset_mm()), TXT_LEVEL_OFFSET); - RequestValueFromTFT(TXT_ADJUST_SPEED); // attempt to make feedrate visible on visit to this page + sendTxtToTFT(str_buf, TXT_LEVEL_OFFSET); + //sendTxtToTFT(ftostr52sprj(getZOffset_mm()), TXT_LEVEL_OFFSET); + requestValueFromTFT(TXT_ADJUST_SPEED); // attempt to make feedrate visible on visit to this page break; } @@ -1526,20 +1526,20 @@ namespace Anycubic { else sprintf(str_buf, "%d", feedrate_back); - SendTxtToTFT(str_buf, TXT_PRINT_SPEED); + sendTxtToTFT(str_buf, TXT_PRINT_SPEED); feedrate_back = getFeedrate_percent(); } if (progress_last != getProgress_percent()) { sprintf(str_buf, "%u", getProgress_percent()); - SendTxtToTFT(str_buf, TXT_PRINT_PROGRESS); + sendTxtToTFT(str_buf, TXT_PRINT_PROGRESS); progress_last = getProgress_percent(); } uint32_t time = getProgress_seconds_elapsed() / 60; sprintf(str_buf, "%s H ", utostr3(time / 60)); sprintf(str_buf + strlen(str_buf), "%s M", utostr3(time % 60)); - SendTxtToTFT(str_buf, TXT_PRINT_TIME); + sendTxtToTFT(str_buf, TXT_PRINT_TIME); TERN_(HAS_HOTEND, send_temperature_hotend(TXT_PRINT_HOTEND)); TERN_(HAS_HEATED_BED, send_temperature_bed(TXT_PRINT_BED)); @@ -1560,9 +1560,9 @@ namespace Anycubic { case 1: // return if (AC_printer_printing == printer_state) - ChangePageOfTFT(PAGE_STATUS2); // show pause + changePageOfTFT(PAGE_STATUS2); // show pause else if (AC_printer_paused == printer_state) - ChangePageOfTFT(PAGE_STATUS1); // show print + changePageOfTFT(PAGE_STATUS1); // show print break; #if ENABLED(MESH_EDIT_MENU) @@ -1578,8 +1578,8 @@ namespace Anycubic { char str_buf[10]; str_buf[0] = 0; strcat(str_buf, ftostr52sprj(getZOffset_mm()) + 2); - SendTxtToTFT(str_buf, TXT_LEVEL_OFFSET); - //SendTxtToTFT(ftostr52sprj(getZOffset_mm()), TXT_LEVEL_OFFSET); + sendTxtToTFT(str_buf, TXT_LEVEL_OFFSET); + //sendTxtToTFT(ftostr52sprj(getZOffset_mm()), TXT_LEVEL_OFFSET); //if (isAxisPositionKnown(Z)) { // Move Z axis // SERIAL_ECHOLNPGM("Z now:", getAxisPosition_mm(Z)); @@ -1619,8 +1619,8 @@ namespace Anycubic { char str_buf[10]; str_buf[0] = '\0'; strcat(str_buf, ftostr52sprj(getZOffset_mm()) + 2); - SendTxtToTFT(str_buf, TXT_LEVEL_OFFSET); - //SendTxtToTFT(ftostr52sprj(getZOffset_mm()), TXT_LEVEL_OFFSET); + sendTxtToTFT(str_buf, TXT_LEVEL_OFFSET); + //sendTxtToTFT(ftostr52sprj(getZOffset_mm()), TXT_LEVEL_OFFSET); //int16_t steps = mmToWholeSteps(constrain(Zshift,-0.05,0.05), Z); @@ -1655,22 +1655,22 @@ namespace Anycubic { #if ENABLED(CASE_LIGHT_ENABLE) case 4: { // light control const bool cls = !getCaseLightState(); - SendValueToTFT(cls, ADDRESS_PRINT_SETTING_LED_STATUS); + sendValueToTFT(cls, ADDRESS_PRINT_SETTING_LED_STATUS); setCaseLightState(cls); } break; #endif case 5: - ChangePageOfTFT(PAGE_DONE); + changePageOfTFT(PAGE_DONE); break; case 6: break; case 7: - TERN_(HAS_HEATED_BED, RequestValueFromTFT(TXT_ADJUST_BED)); - RequestValueFromTFT(TXT_ADJUST_SPEED); - TERN_(HAS_HOTEND, RequestValueFromTFT(TXT_ADJUST_HOTEND)); - TERN_(HAS_FAN, RequestValueFromTFT(TXT_FAN_SPEED_TARGET)); + TERN_(HAS_HEATED_BED, requestValueFromTFT(TXT_ADJUST_BED)); + requestValueFromTFT(TXT_ADJUST_SPEED); + TERN_(HAS_HOTEND, requestValueFromTFT(TXT_ADJUST_HOTEND)); + TERN_(HAS_FAN, requestValueFromTFT(TXT_FAN_SPEED_TARGET)); if (z_change == true) { injectCommands(F("M500")); @@ -1678,9 +1678,9 @@ namespace Anycubic { } if (AC_printer_printing == printer_state) - ChangePageOfTFT(PAGE_STATUS2); // show pause + changePageOfTFT(PAGE_STATUS2); // show pause else if (AC_printer_paused == printer_state) - ChangePageOfTFT(PAGE_STATUS1); // show print + changePageOfTFT(PAGE_STATUS1); // show print break; } @@ -1712,33 +1712,33 @@ namespace Anycubic { case 0: break; case 1: // return - ChangePageOfTFT(PAGE_MAIN); + changePageOfTFT(PAGE_MAIN); break; case 2: - ChangePageOfTFT(PAGE_MOVE); + changePageOfTFT(PAGE_MOVE); break; case 3: // set temperature - ChangePageOfTFT(PAGE_TEMP); + changePageOfTFT(PAGE_TEMP); #if HAS_HOTEND - SendValueToTFT(uint16_t(getActualTemp_celsius(E0)), TXT_HOTEND_NOW); - SendValueToTFT(uint16_t(getTargetTemp_celsius(E0)), TXT_HOTEND_TARGET); + sendValueToTFT(uint16_t(getActualTemp_celsius(E0)), TXT_HOTEND_NOW); + sendValueToTFT(uint16_t(getTargetTemp_celsius(E0)), TXT_HOTEND_TARGET); #endif #if HAS_HEATED_BED - SendValueToTFT(uint16_t(getActualTemp_celsius(BED)), TXT_BED_NOW); - SendValueToTFT(uint16_t(getTargetTemp_celsius(BED)), TXT_BED_TARGET); + sendValueToTFT(uint16_t(getActualTemp_celsius(BED)), TXT_BED_NOW); + sendValueToTFT(uint16_t(getTargetTemp_celsius(BED)), TXT_BED_TARGET); #endif break; case 4: - ChangePageOfTFT(PAGE_SPEED); + changePageOfTFT(PAGE_SPEED); #if HAS_FAN - SendValueToTFT(uint16_t(getActualFan_percent(FAN0)), TXT_FAN_SPEED_NOW); - SendValueToTFT(uint16_t(getTargetFan_percent(FAN0)), TXT_FAN_SPEED_TARGET); + sendValueToTFT(uint16_t(getActualFan_percent(FAN0)), TXT_FAN_SPEED_NOW); + sendValueToTFT(uint16_t(getTargetFan_percent(FAN0)), TXT_FAN_SPEED_TARGET); #endif - SendValueToTFT(uint16_t(getFeedrate_percent()), TXT_PRINT_SPEED_NOW); - SendValueToTFT(uint16_t(getFeedrate_percent()), TXT_PRINT_SPEED_TARGET); + sendValueToTFT(uint16_t(getFeedrate_percent()), TXT_PRINT_SPEED_NOW); + sendValueToTFT(uint16_t(getFeedrate_percent()), TXT_PRINT_SPEED_TARGET); break; case 5: // turn off the xyz motor @@ -1749,7 +1749,7 @@ namespace Anycubic { #if ENABLED(CASE_LIGHT_ENABLE) case 6: { // light control const bool cls = !getCaseLightState(); - SendValueToTFT(cls, ADDRESS_SYSTEM_LED_STATUS); + sendValueToTFT(cls, ADDRESS_SYSTEM_LED_STATUS); setCaseLightState(cls); } break; #endif @@ -1780,7 +1780,7 @@ namespace Anycubic { break; case 1: // return - ChangePageOfTFT(PAGE_TOOL); + changePageOfTFT(PAGE_TOOL); break; case 5: @@ -1835,17 +1835,17 @@ namespace Anycubic { case 3: move_dis = 0.1f; - SendValueToTFT(1, ADDRESS_MOVE_DISTANCE); + sendValueToTFT(1, ADDRESS_MOVE_DISTANCE); break; case 7: move_dis = 1.0f; - SendValueToTFT(2, ADDRESS_MOVE_DISTANCE); + sendValueToTFT(2, ADDRESS_MOVE_DISTANCE); break; case 11: move_dis = 10.0f; - SendValueToTFT(3, ADDRESS_MOVE_DISTANCE); + sendValueToTFT(3, ADDRESS_MOVE_DISTANCE); break; //case 14: @@ -1875,7 +1875,7 @@ namespace Anycubic { case 0: break; case 1: // return - ChangePageOfTFT(PAGE_TOOL); + changePageOfTFT(PAGE_TOOL); break; case 2: break; @@ -1886,13 +1886,13 @@ namespace Anycubic { case 6: // cooling setTargetTemp_celsius(0, E0); setTargetTemp_celsius(0, BED); - ChangePageOfTFT(PAGE_TOOL); + changePageOfTFT(PAGE_TOOL); break; case 7: // send target temp - RequestValueFromTFT(TXT_HOTEND_TARGET); - RequestValueFromTFT(TXT_BED_TARGET); - ChangePageOfTFT(PAGE_TOOL); + requestValueFromTFT(TXT_HOTEND_TARGET); + requestValueFromTFT(TXT_BED_TARGET); + changePageOfTFT(PAGE_TOOL); break; } @@ -1901,8 +1901,8 @@ namespace Anycubic { if (PENDING(ms, flash_time)) return; flash_time = ms + 1500; - SendValueToTFT(uint16_t(getActualTemp_celsius(E0)), TXT_HOTEND_NOW); - SendValueToTFT(uint16_t(getActualTemp_celsius(BED)), TXT_BED_NOW); + sendValueToTFT(uint16_t(getActualTemp_celsius(E0)), TXT_HOTEND_NOW); + sendValueToTFT(uint16_t(getActualTemp_celsius(BED)), TXT_BED_NOW); } void DgusTFT::page10() { @@ -1917,7 +1917,7 @@ namespace Anycubic { switch (key_value) { case 0: break; case 1: // return - ChangePageOfTFT(PAGE_TOOL); + changePageOfTFT(PAGE_TOOL); break; case 2: break; @@ -1926,9 +1926,9 @@ namespace Anycubic { case 5: break; case 6: // ok - RequestValueFromTFT(TXT_FAN_SPEED_TARGET); - RequestValueFromTFT(TXT_PRINT_SPEED_TARGET); - ChangePageOfTFT(PAGE_TOOL); + requestValueFromTFT(TXT_FAN_SPEED_TARGET); + requestValueFromTFT(TXT_PRINT_SPEED_TARGET); + changePageOfTFT(PAGE_TOOL); break; } @@ -1937,8 +1937,8 @@ namespace Anycubic { if (PENDING(ms, flash_time)) return; flash_time = ms + 1500; - SendValueToTFT(uint16_t(getActualFan_percent(FAN0)), TXT_FAN_SPEED_NOW); - SendValueToTFT(uint16_t(getFeedrate_percent()), TXT_PRINT_SPEED_NOW); + sendValueToTFT(uint16_t(getActualFan_percent(FAN0)), TXT_FAN_SPEED_NOW); + sendValueToTFT(uint16_t(getFeedrate_percent()), TXT_PRINT_SPEED_NOW); } void DgusTFT::page11() { @@ -1953,7 +1953,7 @@ namespace Anycubic { case 0: break; case 1: // return - ChangePageOfTFT(PAGE_MAIN); + changePageOfTFT(PAGE_MAIN); store_changes(); break; @@ -1972,12 +1972,12 @@ namespace Anycubic { char str_ver[32]; //sprintf(str_ver, "%04d-%02d-%02d %02d:%02d:%02d\n", BUILD_YEAR, BUILD_MONTH, BUILD_DAY, BUILD_HOUR, BUILD_MIN, BUILD_SEC); sprintf(str_ver, MAIN_BOARD_FIRMWARE_VER); - SendTxtToTFT(str_ver, TXT_VERSION); - ChangePageOfTFT(PAGE_ABOUT); + sendTxtToTFT(str_ver, TXT_VERSION); + changePageOfTFT(PAGE_ABOUT); } break; case 6: - ChangePageOfTFT(PAGE_RECORD); + changePageOfTFT(PAGE_RECORD); break; } } @@ -1993,7 +1993,7 @@ namespace Anycubic { switch (key_value) { case 0: break; case 1: // return - ChangePageOfTFT(PAGE_SYSTEM_CHS_AUDIO_ON); + changePageOfTFT(PAGE_SYSTEM_CHS_AUDIO_ON); break; } } @@ -2047,16 +2047,16 @@ namespace Anycubic { case 0: break; case 1: // return - ChangePageOfTFT(PAGE_MAIN); + changePageOfTFT(PAGE_MAIN); break; case 2: - ChangePageOfTFT(PAGE_PreLEVEL); + changePageOfTFT(PAGE_PreLEVEL); break; #if HAS_HOTEND || HAS_HEATED_BED case 3: { - ChangePageOfTFT(PAGE_PREHEAT); + changePageOfTFT(PAGE_PREHEAT); TERN_(HAS_HOTEND, send_temperature_hotend(TXT_PREHEAT_HOTEND)); TERN_(HAS_HEATED_BED, send_temperature_bed(TXT_PREHEAT_BED)); } break; @@ -2065,7 +2065,7 @@ namespace Anycubic { #if HAS_EXTRUDERS case 4: { send_temperature_hotend(TXT_FILAMENT_TEMP); - ChangePageOfTFT(PAGE_FILAMENT); + changePageOfTFT(PAGE_FILAMENT); } break; #endif } @@ -2082,13 +2082,13 @@ namespace Anycubic { switch (key_value) { case 0: break; case 1: // return - ChangePageOfTFT(PAGE_PREPARE); + changePageOfTFT(PAGE_PREPARE); break; case 2: if (!isPrinting()) { - //ChangePageOfTFT(PAGE_LEVEL_ENSURE); - ChangePageOfTFT(PAGE_CHS_PROBE_PRECHECK); + //changePageOfTFT(PAGE_LEVEL_ENSURE); + changePageOfTFT(PAGE_CHS_PROBE_PRECHECK); } break; @@ -2096,13 +2096,13 @@ namespace Anycubic { char str_buf[10]; str_buf[0] = '\0'; strcat(str_buf, ftostr52sprj(getZOffset_mm()) + 2); - SendTxtToTFT(str_buf, TXT_LEVEL_OFFSET); - //SendTxtToTFT(ftostr52sprj(getZOffset_mm()), TXT_LEVEL_OFFSET); - ChangePageOfTFT(PAGE_LEVEL_ADVANCE); + sendTxtToTFT(str_buf, TXT_LEVEL_OFFSET); + //sendTxtToTFT(ftostr52sprj(getZOffset_mm()), TXT_LEVEL_OFFSET); + changePageOfTFT(PAGE_LEVEL_ADVANCE); } break; case 4: - ChangePageOfTFT(PAGE_AUTO_OFFSET); + changePageOfTFT(PAGE_AUTO_OFFSET); break; } } @@ -2120,7 +2120,7 @@ namespace Anycubic { case 0: break; case 1: // return - ChangePageOfTFT(PAGE_PreLEVEL); + changePageOfTFT(PAGE_PreLEVEL); break; case 2: { @@ -2131,8 +2131,8 @@ namespace Anycubic { char str_buf[10]; strcat(str_buf, ftostr52sprj(getZOffset_mm()) + 2); - SendTxtToTFT(str_buf, TXT_LEVEL_OFFSET); - //SendTxtToTFT(ftostr52sprj(getZOffset_mm()), TXT_LEVEL_OFFSET); + sendTxtToTFT(str_buf, TXT_LEVEL_OFFSET); + //sendTxtToTFT(ftostr52sprj(getZOffset_mm()), TXT_LEVEL_OFFSET); if (isAxisPositionKnown(Z)) { const float currZpos = getAxisPosition_mm(Z); @@ -2150,8 +2150,8 @@ namespace Anycubic { char str_buf[10]; strcat(str_buf, ftostr52sprj(getZOffset_mm()) + 2); - SendTxtToTFT(str_buf, TXT_LEVEL_OFFSET); - //SendTxtToTFT(ftostr52sprj(getZOffset_mm()), TXT_LEVEL_OFFSET); + sendTxtToTFT(str_buf, TXT_LEVEL_OFFSET); + //sendTxtToTFT(ftostr52sprj(getZOffset_mm()), TXT_LEVEL_OFFSET); if (isAxisPositionKnown(Z)) { // Move Z axis const float currZpos = getAxisPosition_mm(Z); @@ -2173,7 +2173,7 @@ namespace Anycubic { } injectCommands(F("M500")); #endif - ChangePageOfTFT(PAGE_PREPARE); + changePageOfTFT(PAGE_PREPARE); break; } } @@ -2193,19 +2193,19 @@ namespace Anycubic { case 0: break; case 1: // return - ChangePageOfTFT(PAGE_PREPARE); + changePageOfTFT(PAGE_PREPARE); break; case 2: // PLA TERN_(HAS_HOTEND, setTargetTemp_celsius(190, E0)); TERN_(HAS_HEATED_BED, setTargetTemp_celsius(60, BED)); - ChangePageOfTFT(PAGE_PREHEAT); + changePageOfTFT(PAGE_PREHEAT); break; case 3: // ABS TERN_(HAS_HOTEND, setTargetTemp_celsius(240, E0)); TERN_(HAS_HEATED_BED, setTargetTemp_celsius(100, BED)); - ChangePageOfTFT(PAGE_PREHEAT); + changePageOfTFT(PAGE_PREHEAT); break; } @@ -2238,13 +2238,13 @@ namespace Anycubic { case 1: // return filament_status = 0; injectCommands(F("G90")); - ChangePageOfTFT(PAGE_PREPARE); + changePageOfTFT(PAGE_PREPARE); break; case 2: // Filament in if (getActualTemp_celsius(E0) < 220) { filament_status = 0; - ChangePageOfTFT(PAGE_FILAMENT_HEAT); + changePageOfTFT(PAGE_FILAMENT_HEAT); } else { filament_status = 1; @@ -2255,7 +2255,7 @@ namespace Anycubic { case 3: // filament out if (getActualTemp_celsius(E0) < 220) { filament_status = 0; - ChangePageOfTFT(PAGE_FILAMENT_HEAT); + changePageOfTFT(PAGE_FILAMENT_HEAT); } else { filament_status = 2; @@ -2301,7 +2301,7 @@ namespace Anycubic { switch (key_value) { case 0: break; case 1: // return - ChangePageOfTFT(page_index_last); + changePageOfTFT(page_index_last); break; } @@ -2324,7 +2324,7 @@ namespace Anycubic { case 0: break; case 1: // return - ChangePageOfTFT(page_index_last); + changePageOfTFT(page_index_last); break; case 2: break; @@ -2350,7 +2350,7 @@ namespace Anycubic { case 1: // OK to finish TERN_(CASE_LIGHT_ENABLE, setCaseLightState(false)); - ChangePageOfTFT(PAGE_MAIN); + changePageOfTFT(PAGE_MAIN); break; case 2: break; @@ -2373,8 +2373,8 @@ namespace Anycubic { switch (key_value) { case 0: break; - case 1: ChangePageOfTFT(page_index_last); break; // return - case 2: ChangePageOfTFT(page_index_last); break; + case 1: changePageOfTFT(page_index_last); break; // return + case 2: changePageOfTFT(page_index_last); break; } static millis_t flash_time = 0; @@ -2394,8 +2394,8 @@ namespace Anycubic { switch (key_value) { case 0: break; - case 1: ChangePageOfTFT(page_index_last); break; // return - case 2: ChangePageOfTFT(page_index_last); break; + case 1: changePageOfTFT(page_index_last); break; // return + case 2: changePageOfTFT(page_index_last); break; } static millis_t flash_time = 0; @@ -2422,10 +2422,10 @@ namespace Anycubic { DEBUG_PRINT_PAUSED_STATE(pause_state); #endif if (AC_printer_printing == printer_state) - ChangePageOfTFT(PAGE_STATUS2); // show pause + changePageOfTFT(PAGE_STATUS2); // show pause else if (AC_printer_paused == printer_state) { //injectCommands(F("M108")); - ChangePageOfTFT(PAGE_STATUS1); // show resume + changePageOfTFT(PAGE_STATUS1); // show resume } break; } @@ -2447,7 +2447,7 @@ namespace Anycubic { switch (key_value) { case 0: break; - case 1: ChangePageOfTFT(page_index_last); break; // return + case 1: changePageOfTFT(page_index_last); break; // return case 2: break; } @@ -2474,7 +2474,7 @@ namespace Anycubic { printer_state = AC_printer_stopping; stopPrint(); message_index = 6; - ChangePageOfTFT(PAGE_MAIN); + changePageOfTFT(PAGE_MAIN); } else { if (printer_state == AC_printer_resuming_from_power_outage) @@ -2485,9 +2485,9 @@ namespace Anycubic { case 2: // return if (AC_printer_printing == printer_state) - ChangePageOfTFT(PAGE_STATUS2); // show pause + changePageOfTFT(PAGE_STATUS2); // show pause else if (AC_printer_paused == printer_state) - ChangePageOfTFT(PAGE_STATUS1); // show print + changePageOfTFT(PAGE_STATUS1); // show print break; } @@ -2508,7 +2508,7 @@ namespace Anycubic { switch (key_value) { case 0: break; - case 1: ChangePageOfTFT(page_index_last); break; // return + case 1: changePageOfTFT(page_index_last); break; // return case 2: break; } @@ -2532,7 +2532,7 @@ namespace Anycubic { case 1: // return TERN_(CASE_LIGHT_ENABLE, setCaseLightState(false)); - ChangePageOfTFT(PAGE_MAIN); + changePageOfTFT(PAGE_MAIN); break; case 2: break; @@ -2558,7 +2558,7 @@ namespace Anycubic { case 1: // return setTargetTemp_celsius(230, E0); - ChangePageOfTFT(PAGE_FILAMENT); + changePageOfTFT(PAGE_FILAMENT); break; } @@ -2629,21 +2629,21 @@ namespace Anycubic { ) { setTargetTemp_celsius(LEVELING_NOZZLE_TEMP, E0); setTargetTemp_celsius(LEVELING_BED_TEMP, BED); - ChangePageOfTFT(PAGE_CHS_PROBE_PREHEATING); + changePageOfTFT(PAGE_CHS_PROBE_PREHEATING); } else - ChangePageOfTFT(PAGE_LEVELING); + changePageOfTFT(PAGE_LEVELING); #else - ChangePageOfTFT(PAGE_LEVELING); + changePageOfTFT(PAGE_LEVELING); #endif #endif - ChangePageOfTFT(PAGE_LEVELING); + changePageOfTFT(PAGE_LEVELING); break; case 2: - ChangePageOfTFT(PAGE_PreLEVEL); + changePageOfTFT(PAGE_PreLEVEL); break; } @@ -2674,7 +2674,7 @@ namespace Anycubic { if (pop_up_index == 25) { pop_up_index = 100; - ChangePageOfTFT(PAGE_PreLEVEL); + changePageOfTFT(PAGE_PreLEVEL); } } @@ -2692,7 +2692,7 @@ namespace Anycubic { switch (key_value) { case 0: break; - case 1: ChangePageOfTFT(PAGE_PreLEVEL); break; + case 1: changePageOfTFT(PAGE_PreLEVEL); break; case 2: { injectCommands(F("M1024 S3")); // -1 @@ -2725,7 +2725,7 @@ namespace Anycubic { case 0: break; case 1: - ChangePageOfTFT(PAGE_MAIN); + changePageOfTFT(PAGE_MAIN); store_changes(); break; @@ -2744,12 +2744,12 @@ namespace Anycubic { char str_ver[32]; //sprintf(str_ver, "%04d-%02d-%02d %02d:%02d:%02d\n", BUILD_YEAR, BUILD_MONTH, BUILD_DAY, BUILD_HOUR, BUILD_MIN, BUILD_SEC); sprintf(str_ver, MAIN_BOARD_FIRMWARE_VER); - SendTxtToTFT(str_ver, TXT_VERSION); - ChangePageOfTFT(PAGE_ABOUT); + sendTxtToTFT(str_ver, TXT_VERSION); + changePageOfTFT(PAGE_ABOUT); break; case 6: - ChangePageOfTFT(PAGE_RECORD); + changePageOfTFT(PAGE_RECORD); break; } } @@ -2763,7 +2763,7 @@ namespace Anycubic { //DEBUG_ECHOLNPGM("update feedrate percent"); } #endif - SendValueToTFT(uint16_t(getFeedrate_percent()), TXT_PRINT_SPEED_NOW); + sendValueToTFT(uint16_t(getFeedrate_percent()), TXT_PRINT_SPEED_NOW); } void DgusTFT::page125() { // first time into page 125 the feedrate percent is not set @@ -2775,7 +2775,7 @@ namespace Anycubic { //DEBUG_ECHOLNPGM("update feedrate percent"); } #endif - SendValueToTFT(uint16_t(getFeedrate_percent()), TXT_PRINT_SPEED_NOW); + sendValueToTFT(uint16_t(getFeedrate_percent()), TXT_PRINT_SPEED_NOW); } void DgusTFT::page170() { // ENG Mute handler @@ -2790,7 +2790,7 @@ namespace Anycubic { case 0: break; case 1: - ChangePageOfTFT(PAGE_MAIN); + changePageOfTFT(PAGE_MAIN); store_changes(); break; @@ -2809,12 +2809,12 @@ namespace Anycubic { char str_ver[32]; //sprintf(str_ver, "%04d-%02d-%02d %02d:%02d:%02d\n", BUILD_YEAR, BUILD_MONTH, BUILD_DAY, BUILD_HOUR, BUILD_MIN, BUILD_SEC); sprintf(str_ver, MAIN_BOARD_FIRMWARE_VER); - SendTxtToTFT(str_ver, TXT_VERSION); - ChangePageOfTFT(PAGE_ABOUT); + sendTxtToTFT(str_ver, TXT_VERSION); + changePageOfTFT(PAGE_ABOUT); break; case 6: - ChangePageOfTFT(PAGE_RECORD); + changePageOfTFT(PAGE_RECORD); break; } } @@ -2836,29 +2836,29 @@ namespace Anycubic { case 0: break; case 1: { // resume - ChangePageOfTFT(PAGE_OUTAGE_RECOVERY); + changePageOfTFT(PAGE_OUTAGE_RECOVERY); #if ENABLED(LONG_FILENAME_HOST_SUPPORT) card.getLongPath(filename, recovery.info.sd_filename); filename[17] = '\0'; - SendTxtToTFT(filename, TXT_OUTAGE_RECOVERY_FILE); + sendTxtToTFT(filename, TXT_OUTAGE_RECOVERY_FILE); #else - SendTxtToTFT(recovery.info.sd_filename, TXT_OUTAGE_RECOVERY_FILE); + sendTxtToTFT(recovery.info.sd_filename, TXT_OUTAGE_RECOVERY_FILE); #endif char str_buf[20] = { '\0' }; sprintf(str_buf, "%u", uint16_t(getFeedrate_percent())); - SendTxtToTFT(str_buf, TXT_PRINT_SPEED); + sendTxtToTFT(str_buf, TXT_PRINT_SPEED); sprintf(str_buf, "%u", uint16_t(getProgress_percent())); - SendTxtToTFT(str_buf, TXT_PRINT_PROGRESS); + sendTxtToTFT(str_buf, TXT_PRINT_PROGRESS); - ChangePageOfTFT(PAGE_STATUS2); // show pause + changePageOfTFT(PAGE_STATUS2); // show pause injectCommands(F("M355 S1\nM1000")); // case light on, home and start recovery } break; case 2: // cancel printer_state = AC_printer_idle; - ChangePageOfTFT(PAGE_MAIN); + changePageOfTFT(PAGE_MAIN); injectCommands(F("M355 S0\nM1000 C")); // cancel recovery break; } @@ -2879,29 +2879,29 @@ namespace Anycubic { case 0: break; case 1: { // resume - ChangePageOfTFT(PAGE_OUTAGE_RECOVERY); + changePageOfTFT(PAGE_OUTAGE_RECOVERY); #if ENABLED(LONG_FILENAME_HOST_SUPPORT) card.getLongPath(filename, recovery.info.sd_filename); filename[17] = '\0'; - SendTxtToTFT(filename, TXT_OUTAGE_RECOVERY_FILE); + sendTxtToTFT(filename, TXT_OUTAGE_RECOVERY_FILE); #else - SendTxtToTFT(recovery.info.sd_filename, TXT_OUTAGE_RECOVERY_FILE); + sendTxtToTFT(recovery.info.sd_filename, TXT_OUTAGE_RECOVERY_FILE); #endif char str_buf[20] = { '\0' }; sprintf(str_buf, "%u", uint16_t(getFeedrate_percent())); - SendTxtToTFT(str_buf, TXT_PRINT_SPEED); + sendTxtToTFT(str_buf, TXT_PRINT_SPEED); sprintf(str_buf, "%u", uint16_t(getProgress_percent())); - SendTxtToTFT(str_buf, TXT_PRINT_PROGRESS); + sendTxtToTFT(str_buf, TXT_PRINT_PROGRESS); - ChangePageOfTFT(PAGE_STATUS2); // show pause + changePageOfTFT(PAGE_STATUS2); // show pause injectCommands(F("M355 S1\nM1000")); // case light on, home and start recovery } break; case 2: // cancel printer_state = AC_printer_idle; - ChangePageOfTFT(PAGE_MAIN); + changePageOfTFT(PAGE_MAIN); injectCommands(F("M355 S0\nM1000 C")); // cancel recovery break; } @@ -2976,14 +2976,14 @@ namespace Anycubic { } if (PAGE_STATUS1 == page_index_last_2 || PAGE_STATUS2 == page_index_last_2 || PAGE_PRINT_FINISH == page_index_last) - ChangePageOfTFT(PAGE_MAIN); + changePageOfTFT(PAGE_MAIN); else - ChangePageOfTFT(page_index_last_2); + changePageOfTFT(page_index_last_2); } else { if (lcd_info.language == ENG && page_index_last > 120) page_index_last -= 120; - ChangePageOfTFT(page_index_last); + changePageOfTFT(page_index_last); } onSurviveInKilled(); @@ -3012,10 +3012,10 @@ namespace Anycubic { if (isPrinting() || isPrintingPaused() || isPrintingFromMedia()) { printer_state = AC_printer_stopping; stopPrint(); - ChangePageOfTFT(PAGE_MAIN); + changePageOfTFT(PAGE_MAIN); } else - ChangePageOfTFT(page_index_last); + changePageOfTFT(page_index_last); onSurviveInKilled(); break; @@ -3041,7 +3041,7 @@ namespace Anycubic { //DEBUG_ECHOLNPGM("page_index_last_2: ", page_index_last_2); #endif onSurviveInKilled(); - ChangePageOfTFT(PAGE_PreLEVEL); + changePageOfTFT(PAGE_PreLEVEL); break; default: break; @@ -3081,7 +3081,7 @@ namespace Anycubic { if (getProbeState()) { // triggered too early probe_check_counter = 0; probe_tare_flag = 0; - ChangePageOfTFT(PAGE_CHS_PROBE_PRECHECK_FAILED); + changePageOfTFT(PAGE_CHS_PROBE_PRECHECK_FAILED); } probe_tare_flag = 1; } @@ -3090,7 +3090,7 @@ namespace Anycubic { case 1: // cancel probe_check_counter = 0; probe_tare_flag = 0; - ChangePageOfTFT(PAGE_PreLEVEL); + changePageOfTFT(PAGE_PreLEVEL); break; default: break; @@ -3102,7 +3102,7 @@ namespace Anycubic { if (!probe_state_last && getProbeState()) { probe_check_counter = 0; probe_tare_flag = 0; - ChangePageOfTFT(PAGE_CHS_PROBE_PRECHECK_OK); + changePageOfTFT(PAGE_CHS_PROBE_PRECHECK_OK); } probe_state_last = getProbeState(); @@ -3110,7 +3110,7 @@ namespace Anycubic { if (probe_check_counter++ >= 200) { // waiting for 1 min probe_check_counter = 0; probe_tare_flag = 0; - ChangePageOfTFT(PAGE_CHS_PROBE_PRECHECK_FAILED); + changePageOfTFT(PAGE_CHS_PROBE_PRECHECK_FAILED); } } @@ -3138,7 +3138,7 @@ namespace Anycubic { injectCommands(F("G28\nG29")); printer_state = AC_printer_probing; - ChangePageOfTFT(PAGE_LEVELING); + changePageOfTFT(PAGE_LEVELING); } void DgusTFT::page203() { // probe precheck failed @@ -3174,24 +3174,24 @@ namespace Anycubic { switch (pop_up_index) { case 10: // T0 error if (page_index_now != PAGE_ABNORMAL) - ChangePageOfTFT(PAGE_ABNORMAL); + changePageOfTFT(PAGE_ABNORMAL); pop_up_index = 100; break; case 15: // filament lack case 23: if (page_index_now != PAGE_FILAMENT_LACK) - ChangePageOfTFT(PAGE_FILAMENT_LACK); + changePageOfTFT(PAGE_FILAMENT_LACK); pop_up_index = 100; break; case 16: // stop wait - ChangePageOfTFT(PAGE_WAIT_STOP); + changePageOfTFT(PAGE_WAIT_STOP); pop_up_index = 100; break; case 18: - ChangePageOfTFT(PAGE_STATUS1); + changePageOfTFT(PAGE_STATUS1); pop_up_index = 100; break; @@ -3200,21 +3200,21 @@ namespace Anycubic { char str_buf[20]; sprintf(str_buf, "%s H ", utostr3(time / 60)); sprintf(str_buf + strlen(str_buf), "%s M", utostr3(time % 60)); - SendTxtToTFT(str_buf, TXT_FINISH_TIME); - ChangePageOfTFT(PAGE_PRINT_FINISH); + sendTxtToTFT(str_buf, TXT_FINISH_TIME); + changePageOfTFT(PAGE_PRINT_FINISH); //tftSendLn(AC_msg_print_complete); // no idea why this causes a compile error pop_up_index = 100; } break; case 25: // LEVEL DONE - ChangePageOfTFT(PAGE_PreLEVEL); + changePageOfTFT(PAGE_PreLEVEL); pop_up_index = 100; break; } } void DEBUG_PRINT_PAUSED_STATE(const paused_state_t state, FSTR_P const msg/*=nullptr*/) { - if (msg) DEBUG_ECHOF(msg); + if (msg) DEBUG_ECHO(msg); DEBUG_ECHOPGM("Paused state: ", state, " "); switch (state) { case AC_paused_heater_timed_out: DEBUG_ECHOPGM("AC_paused_heater_timed_out"); break; @@ -3228,7 +3228,7 @@ namespace Anycubic { // Human-readable debugging void DEBUG_PRINT_PRINTER_STATE(const printer_state_t state, FSTR_P const msg/*=nullptr*/) { - if (msg) DEBUG_ECHOF(msg); + if (msg) DEBUG_ECHO(msg); DEBUG_ECHOPGM("Printer State: ", state, " "); switch (state) { case AC_printer_idle: DEBUG_ECHOPGM("AC_printer_idle"); break; diff --git a/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.h b/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.h index 63803d209fbac..371066a569001 100644 --- a/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.h +++ b/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.h @@ -453,7 +453,7 @@ namespace Anycubic { static void tftSend(FSTR_P const=nullptr); static void tftSendLn(FSTR_P const=nullptr); static bool readTFTCommand(); - static int8_t Findcmndpos(const char *, const char); + static int8_t findCmdPos(const char *, const char); static void checkHeaters(); static void sendFileList(int8_t); static void selectFile(); @@ -475,5 +475,5 @@ namespace Anycubic { }; - extern DgusTFT Dgus; + extern DgusTFT dgus; } diff --git a/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp b/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp index 6990a23f7b726..cf87bacf3be7c 100644 --- a/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp +++ b/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp @@ -37,17 +37,17 @@ using namespace Anycubic; namespace ExtUI { - void onStartup() { Dgus.startup(); } + void onStartup() { dgus.startup(); } - void onIdle() { Dgus.idleLoop(); } + void onIdle() { dgus.idleLoop(); } void onPrinterKilled(FSTR_P const error, FSTR_P const component) { - Dgus.printerKilled(error, component); + dgus.printerKilled(error, component); } - void onMediaInserted() { Dgus.mediaEvent(AC_media_inserted); } - void onMediaError() { Dgus.mediaEvent(AC_media_error); } - void onMediaRemoved() { Dgus.mediaEvent(AC_media_removed); } + void onMediaInserted() { dgus.mediaEvent(AC_media_inserted); } + void onMediaError() { dgus.mediaEvent(AC_media_error); } + void onMediaRemoved() { dgus.mediaEvent(AC_media_removed); } void onPlayTone(const uint16_t frequency, const uint16_t duration) { #if ENABLED(SPEAKER) @@ -55,22 +55,22 @@ namespace ExtUI { #endif } - void onPrintTimerStarted() { Dgus.timerEvent(AC_timer_started); } - void onPrintTimerPaused() { Dgus.timerEvent(AC_timer_paused); } - void onPrintTimerStopped() { Dgus.timerEvent(AC_timer_stopped); } + void onPrintTimerStarted() { dgus.timerEvent(AC_timer_started); } + void onPrintTimerPaused() { dgus.timerEvent(AC_timer_paused); } + void onPrintTimerStopped() { dgus.timerEvent(AC_timer_stopped); } void onPrintDone() {} - void onFilamentRunout(const extruder_t) { Dgus.filamentRunout(); } + void onFilamentRunout(const extruder_t) { dgus.filamentRunout(); } - void onUserConfirmRequired(const char * const msg) { Dgus.confirmationRequest(msg); } - void onStatusChanged(const char * const msg) { Dgus.statusChange(msg); } + void onUserConfirmRequired(const char * const msg) { dgus.confirmationRequest(msg); } + void onStatusChanged(const char * const msg) { dgus.statusChange(msg); } - void onHomingStart() { Dgus.HomingStart(); } - void onHomingDone() { Dgus.HomingComplete(); } + void onHomingStart() { dgus.homingStart(); } + void onHomingDone() { dgus.homingComplete(); } void onFactoryReset() { - Dgus.page_index_now = 121; - Dgus.lcd_info.audio_on = DISABLED(SPEAKER); + dgus.page_index_now = 121; + dgus.lcd_info.audio_on = DISABLED(SPEAKER); } void onStoreSettings(char *buff) { @@ -78,8 +78,8 @@ namespace ExtUI { // permanent data to be stored, it can write up to eeprom_data_size bytes // into buff. - static_assert(sizeof(Dgus.lcd_info) <= ExtUI::eeprom_data_size); - memcpy(buff, &Dgus.lcd_info, sizeof(Dgus.lcd_info)); + static_assert(sizeof(dgus.lcd_info) <= ExtUI::eeprom_data_size); + memcpy(buff, &dgus.lcd_info, sizeof(dgus.lcd_info)); } void onLoadSettings(const char *buff) { @@ -87,15 +87,15 @@ namespace ExtUI { // needs to retrieve data, it should copy up to eeprom_data_size bytes // from buff - static_assert(sizeof(Dgus.lcd_info) <= ExtUI::eeprom_data_size); - memcpy(&Dgus.lcd_info, buff, sizeof(Dgus.lcd_info)); - memcpy(&Dgus.lcd_info_back, buff, sizeof(Dgus.lcd_info_back)); + static_assert(sizeof(dgus.lcd_info) <= ExtUI::eeprom_data_size); + memcpy(&dgus.lcd_info, buff, sizeof(dgus.lcd_info)); + memcpy(&dgus.lcd_info_back, buff, sizeof(dgus.lcd_info_back)); } void onPostprocessSettings() { // Called after loading or resetting stored settings - Dgus.ParamInit(); - Dgus.PowerLoss(); + dgus.paramInit(); + dgus.powerLoss(); } void onSettingsStored(const bool success) { @@ -127,11 +127,11 @@ namespace ExtUI { #if ENABLED(POWER_LOSS_RECOVERY) // Called when power-loss is enabled/disabled - void onSetPowerLoss(const bool) { Dgus.PowerLoss(); } + void onSetPowerLoss(const bool) { dgus.powerLoss(); } // Called when power-loss state is detected void onPowerLoss() { /* handled internally */ } // Called on resume from power-loss - void onPowerLossResume() { Dgus.powerLossRecovery(); } + void onPowerLossResume() { dgus.powerLossRecovery(); } #endif #if HAS_PID_HEATING diff --git a/Marlin/src/lcd/extui/dgus/DGUSScreenHandlerBase.h b/Marlin/src/lcd/extui/dgus/DGUSScreenHandlerBase.h index c6dd270edf900..163a095d08197 100644 --- a/Marlin/src/lcd/extui/dgus/DGUSScreenHandlerBase.h +++ b/Marlin/src/lcd/extui/dgus/DGUSScreenHandlerBase.h @@ -207,7 +207,7 @@ class DGUSScreenHandler { static void sendFloatAsIntValueToDisplay(DGUS_VP_Variable &var) { if (var.memadr) { float f = *(float *)var.memadr; - DEBUG_ECHOLNPAIR_F(" >> ", f, 6); + DEBUG_ECHOLNPGM(" >> ", p_float_t(f, 6)); f *= cpow(10, decimals); dgus.writeVariable(var.VP, (int16_t)f); } diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.cpp index b0aeacbfdffef..d813cc7a450d6 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.cpp @@ -32,7 +32,7 @@ #include "../../../gcode/queue.h" #if HAS_MEDIA - bool DGUSSetupHandler::Print() { + bool DGUSSetupHandler::print() { screen.filelist.refresh(); while (!screen.filelist.isAtRootDir()) { @@ -46,7 +46,7 @@ } #endif -bool DGUSSetupHandler::PrintStatus() { +bool DGUSSetupHandler::printStatus() { if (ExtUI::isPrinting() || ExtUI::isPrintingPaused()) { return true; } @@ -55,7 +55,7 @@ bool DGUSSetupHandler::PrintStatus() { return false; } -bool DGUSSetupHandler::PrintAdjust() { +bool DGUSSetupHandler::printAdjust() { if (ExtUI::isPrinting() || ExtUI::isPrintingPaused()) { return true; } @@ -64,7 +64,7 @@ bool DGUSSetupHandler::PrintAdjust() { return false; } -bool DGUSSetupHandler::LevelingMenu() { +bool DGUSSetupHandler::levelingMenu() { ExtUI::setLevelingActive(screen.leveling_active); if (!screen.isPrinterIdle()) { @@ -87,7 +87,7 @@ bool DGUSSetupHandler::LevelingMenu() { return false; } -bool DGUSSetupHandler::LevelingManual() { +bool DGUSSetupHandler::levelingManual() { ExtUI::setLevelingActive(false); if (ExtUI::isPositionKnown()) { @@ -106,7 +106,7 @@ bool DGUSSetupHandler::LevelingManual() { return false; } -bool DGUSSetupHandler::LevelingOffset() { +bool DGUSSetupHandler::levelingOffset() { screen.offset_steps = DGUS_Data::StepSize::MMP1; if (!screen.isPrinterIdle()) { @@ -135,7 +135,7 @@ bool DGUSSetupHandler::LevelingOffset() { return false; } -bool DGUSSetupHandler::LevelingAutomatic() { +bool DGUSSetupHandler::levelingAutomatic() { if (ExtUI::getLevelingIsValid()) { screen.leveling_active = true; @@ -145,21 +145,22 @@ bool DGUSSetupHandler::LevelingAutomatic() { return true; } -bool DGUSSetupHandler::LevelingProbing() { +bool DGUSSetupHandler::levelingProbing() { screen.probing_icons[0] = 0; screen.probing_icons[1] = 0; return true; } -bool DGUSSetupHandler::Filament() { + +bool DGUSSetupHandler::filament() { screen.filament_extruder = DGUS_Data::Extruder::CURRENT; screen.filament_length = DGUS_DEFAULT_FILAMENT_LEN; return true; } -bool DGUSSetupHandler::Move() { +bool DGUSSetupHandler::move() { screen.move_steps = DGUS_Data::StepSize::MM10; if (!screen.isPrinterIdle()) { @@ -170,7 +171,7 @@ bool DGUSSetupHandler::Move() { return true; } -bool DGUSSetupHandler::Gcode() { +bool DGUSSetupHandler::gcode() { ZERO(screen.gcode); if (dgus.gui_version < 0x30 || dgus.os_version < 0x21) { @@ -181,14 +182,14 @@ bool DGUSSetupHandler::Gcode() { return true; } -bool DGUSSetupHandler::PID() { +bool DGUSSetupHandler::pid() { screen.pid_heater = DGUS_Data::Heater::H0; screen.pid_temp = DGUS_PLA_TEMP_HOTEND; return true; } -bool DGUSSetupHandler::Infos() { +bool DGUSSetupHandler::infos() { screen.debug_count = 0; return true; diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.h b/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.h index 10063446b7702..67edfee48487b 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.h @@ -24,19 +24,19 @@ namespace DGUSSetupHandler { #if HAS_MEDIA - bool Print(); + bool print(); #endif - bool PrintStatus(); - bool PrintAdjust(); - bool LevelingMenu(); - bool LevelingOffset(); - bool LevelingManual(); - bool LevelingAutomatic(); - bool LevelingProbing(); - bool Filament(); - bool Move(); - bool Gcode(); - bool PID(); - bool Infos(); + bool printStatus(); + bool printAdjust(); + bool levelingMenu(); + bool levelingOffset(); + bool levelingManual(); + bool levelingAutomatic(); + bool levelingProbing(); + bool filament(); + bool move(); + bool gcode(); + bool pid(); + bool infos(); } diff --git a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenSetup.cpp b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenSetup.cpp index e01f6ab3a6bba..502ac2a6af906 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenSetup.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenSetup.cpp @@ -34,20 +34,20 @@ const struct DGUS_ScreenSetup screen_setup_list[] PROGMEM = { #if HAS_MEDIA - SETUP_HELPER(DGUS_ScreenID::PRINT, &DGUSSetupHandler::Print), + SETUP_HELPER(DGUS_ScreenID::PRINT, &DGUSSetupHandler::print), #endif - SETUP_HELPER(DGUS_ScreenID::PRINT_STATUS, &DGUSSetupHandler::PrintStatus), - SETUP_HELPER(DGUS_ScreenID::PRINT_ADJUST, &DGUSSetupHandler::PrintAdjust), - SETUP_HELPER(DGUS_ScreenID::LEVELING_MENU, &DGUSSetupHandler::LevelingMenu), - SETUP_HELPER(DGUS_ScreenID::LEVELING_OFFSET, &DGUSSetupHandler::LevelingOffset), - SETUP_HELPER(DGUS_ScreenID::LEVELING_MANUAL, &DGUSSetupHandler::LevelingManual), - SETUP_HELPER(DGUS_ScreenID::LEVELING_AUTOMATIC, &DGUSSetupHandler::LevelingAutomatic), - SETUP_HELPER(DGUS_ScreenID::LEVELING_PROBING, &DGUSSetupHandler::LevelingProbing), - SETUP_HELPER(DGUS_ScreenID::FILAMENT, &DGUSSetupHandler::Filament), - SETUP_HELPER(DGUS_ScreenID::MOVE, &DGUSSetupHandler::Move), - SETUP_HELPER(DGUS_ScreenID::GCODE, &DGUSSetupHandler::Gcode), - SETUP_HELPER(DGUS_ScreenID::PID, &DGUSSetupHandler::PID), - SETUP_HELPER(DGUS_ScreenID::INFOS, &DGUSSetupHandler::Infos), + SETUP_HELPER(DGUS_ScreenID::PRINT_STATUS, &DGUSSetupHandler::printStatus), + SETUP_HELPER(DGUS_ScreenID::PRINT_ADJUST, &DGUSSetupHandler::printAdjust), + SETUP_HELPER(DGUS_ScreenID::LEVELING_MENU, &DGUSSetupHandler::levelingMenu), + SETUP_HELPER(DGUS_ScreenID::LEVELING_OFFSET, &DGUSSetupHandler::levelingOffset), + SETUP_HELPER(DGUS_ScreenID::LEVELING_MANUAL, &DGUSSetupHandler::levelingManual), + SETUP_HELPER(DGUS_ScreenID::LEVELING_AUTOMATIC, &DGUSSetupHandler::levelingAutomatic), + SETUP_HELPER(DGUS_ScreenID::LEVELING_PROBING, &DGUSSetupHandler::levelingProbing), + SETUP_HELPER(DGUS_ScreenID::FILAMENT, &DGUSSetupHandler::filament), + SETUP_HELPER(DGUS_ScreenID::MOVE, &DGUSSetupHandler::move), + SETUP_HELPER(DGUS_ScreenID::GCODE, &DGUSSetupHandler::gcode), + SETUP_HELPER(DGUS_ScreenID::PID, &DGUSSetupHandler::pid), + SETUP_HELPER(DGUS_ScreenID::INFOS, &DGUSSetupHandler::infos), SETUP_HELPER((DGUS_ScreenID)0, nullptr) }; diff --git a/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp b/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp index e9e3940a08057..68e405776e9d5 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp @@ -50,7 +50,7 @@ namespace ExtUI { screen.printerKilled(error, component); } - void onMediaInserted() { TERN_(HAS_MEDIA, screen.sDCardInserted()); } + void onMediaInserted() { TERN_(HAS_MEDIA, screen.sdCardInserted()); } void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); } void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); } diff --git a/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp b/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp index 3eac438bb1b70..a64fa2ef20b92 100644 --- a/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp +++ b/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp @@ -674,7 +674,7 @@ void RTS::handleData() { case DisplayStandbyBrightness: Checkkey = DisplayStandbyBrightness; break; case DisplayStandbySeconds: Checkkey = DisplayStandbySeconds; break; default: - if (WITHIN(recdat.addr, AutolevelVal, 4400)) // (int16_t(AutolevelVal) + GRID_MAX_POINTS * 2) = 4400 with 5x5 mesh + if (WITHIN(recdat.addr, AutolevelVal, AutolevelVal + 2 * (5 * 5 - 1))) // Assuming 5x5 mesh or smaller Checkkey = AutolevelVal; else if (WITHIN(recdat.addr, SDFILE_ADDR, SDFILE_ADDR + 10 * (FileNum + 1))) Checkkey = Filename; diff --git a/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.h b/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.h index 9ec7d7872f96d..3b467f4d252a3 100644 --- a/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.h +++ b/Marlin/src/lcd/extui/ia_creality/ia_creality_rts.h @@ -279,7 +279,7 @@ enum PROC_COM { }; const uint16_t Addrbuf[] = { - 0x1002, 0x1004, 0x1006, 0x1008, 0x100A, 0x100C, 0x1026, 0x1030, 0x1032, 0x1034, 0x103A, + 0x1002, 0x1004, 0x1006, 0x1008, 0x100A, 0x100C, 0x1026, 0x1030, 0x1032, 0x1034, 0x103A, 0x103E, 0x1040, 0x1044, 0x1046, 0x1048, 0x104A, 0x104C, 0x1054, 0x1056, 0x1058, 0x105C, 0x105E, 0x105F, 0x1088, 0 }; diff --git a/Marlin/src/lcd/extui/mks_ui/SPI_TFT.cpp b/Marlin/src/lcd/extui/mks_ui/SPI_TFT.cpp index 42abd4bf64538..6cbe13e9fddbd 100644 --- a/Marlin/src/lcd/extui/mks_ui/SPI_TFT.cpp +++ b/Marlin/src/lcd/extui/mks_ui/SPI_TFT.cpp @@ -37,29 +37,29 @@ TFT SPI_TFT; // use SPI1 for the spi tft. -void TFT::spi_init(uint8_t spiRate) { - tftio.Init(); +void TFT::spiInit(uint8_t spiRate) { + tftio.init(); } -void TFT::SetPoint(uint16_t x, uint16_t y, uint16_t point) { +void TFT::setPoint(uint16_t x, uint16_t y, uint16_t point) { if ((x > 480) || (y > 320)) return; setWindow(x, y, 1, 1); - tftio.WriteMultiple(point, (uint16_t)1); + tftio.writeMultiple(point, (uint16_t)1); } void TFT::setWindow(uint16_t x, uint16_t y, uint16_t with, uint16_t height) { tftio.set_window(x, y, (x + with - 1), (y + height - 1)); } -void TFT::LCD_init() { - tftio.InitTFT(); +void TFT::lcdInit() { + tftio.initTFT(); #if PIN_EXISTS(TFT_BACKLIGHT) OUT_WRITE(TFT_BACKLIGHT_PIN, LOW); #endif delay(100); - LCD_clear(0x0000); - LCD_Draw_Logo(); + lcdClear(0x0000); + lcdDrawLogo(); #if PIN_EXISTS(TFT_BACKLIGHT) OUT_WRITE(TFT_BACKLIGHT_PIN, HIGH); #endif @@ -68,17 +68,17 @@ void TFT::LCD_init() { #endif } -void TFT::LCD_clear(uint16_t color) { +void TFT::lcdClear(uint16_t color) { setWindow(0, 0, TFT_WIDTH, TFT_HEIGHT); - tftio.WriteMultiple(color, uint32_t(TFT_WIDTH) * uint32_t(TFT_HEIGHT)); + tftio.writeMultiple(color, uint32_t(TFT_WIDTH) * uint32_t(TFT_HEIGHT)); } -void TFT::LCD_Draw_Logo() { +void TFT::lcdDrawLogo() { #if HAS_LOGO_IN_FLASH setWindow(0, 0, TFT_WIDTH, TFT_HEIGHT); for (uint16_t i = 0; i < (TFT_HEIGHT); i++) { - Pic_Logo_Read((uint8_t *)"", (uint8_t *)bmp_public_buf, (TFT_WIDTH) * 2); - tftio.WriteSequence((uint16_t *)bmp_public_buf, TFT_WIDTH); + picLogoRead((uint8_t *)"", (uint8_t *)bmp_public_buf, (TFT_WIDTH) * 2); + tftio.writeSequence((uint16_t *)bmp_public_buf, TFT_WIDTH); } #endif } diff --git a/Marlin/src/lcd/extui/mks_ui/SPI_TFT.h b/Marlin/src/lcd/extui/mks_ui/SPI_TFT.h index 62a084fb11962..56576c8c16a57 100644 --- a/Marlin/src/lcd/extui/mks_ui/SPI_TFT.h +++ b/Marlin/src/lcd/extui/mks_ui/SPI_TFT.h @@ -27,12 +27,12 @@ class TFT { public: TFT_IO tftio; - void spi_init(uint8_t spiRate); - void SetPoint(uint16_t x, uint16_t y, uint16_t point); + void spiInit(uint8_t spiRate); + void setPoint(uint16_t x, uint16_t y, uint16_t point); void setWindow(uint16_t x, uint16_t y, uint16_t with, uint16_t height); - void LCD_init(); - void LCD_clear(uint16_t color); - void LCD_Draw_Logo(); + void lcdInit(); + void lcdClear(uint16_t color); + void lcdDrawLogo(); }; extern TFT SPI_TFT; diff --git a/Marlin/src/lcd/extui/mks_ui/draw_error_message.cpp b/Marlin/src/lcd/extui/mks_ui/draw_error_message.cpp index bc151001531f9..2c9928f3879fe 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_error_message.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_error_message.cpp @@ -35,7 +35,7 @@ static lv_obj_t *scr; void lv_draw_error_message(FSTR_P const fmsg) { FSTR_P fhalted = F("PRINTER HALTED"), fplease = F("Please Reset"); - SPI_TFT.LCD_clear(0x0000); + SPI_TFT.lcdClear(0x0000); if (fmsg) disp_string((TFT_WIDTH - strlen_P(FTOP(fmsg)) * 16) / 2, 100, fmsg, 0xFFFF, 0x0000); disp_string((TFT_WIDTH - strlen_P(FTOP(fhalted)) * 16) / 2, 140, fhalted, 0xFFFF, 0x0000); disp_string((TFT_WIDTH - strlen_P(FTOP(fplease)) * 16) / 2, 180, fplease, 0xFFFF, 0x0000); diff --git a/Marlin/src/lcd/extui/mks_ui/draw_touch_calibration.cpp b/Marlin/src/lcd/extui/mks_ui/draw_touch_calibration.cpp index 74902a30ddc83..dda9ee1c29a2a 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_touch_calibration.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_touch_calibration.cpp @@ -47,9 +47,9 @@ enum { static void drawCross(uint16_t x, uint16_t y, uint16_t color) { SPI_TFT.tftio.set_window(x - 15, y, x + 15, y); - SPI_TFT.tftio.WriteMultiple(color, 31); + SPI_TFT.tftio.writeMultiple(color, 31); SPI_TFT.tftio.set_window(x, y - 15, x, y + 15); - SPI_TFT.tftio.WriteMultiple(color, 31); + SPI_TFT.tftio.writeMultiple(color, 31); } void lv_update_touch_calibration_screen() { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp b/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp index 708ad77fca8c9..5d44090a775c9 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp @@ -631,7 +631,7 @@ char *creat_title_text() { p_index = (uint16_t *)(&bmp_public_buf[i]); if (*p_index == 0x0000) *p_index = LV_COLOR_BACKGROUND.full; } - SPI_TFT.tftio.WriteSequence((uint16_t*)bmp_public_buf, 200); + SPI_TFT.tftio.writeSequence((uint16_t*)bmp_public_buf, 200); #if HAS_BAK_VIEW_IN_FLASH W25QXX.init(SPI_QUARTER_SPEED); if (row < 20) W25QXX.SPI_FLASH_SectorErase(BAK_VIEW_ADDR_TFT35 + row * 4096); @@ -692,7 +692,7 @@ char *creat_title_text() { #endif SPI_TFT.setWindow(xpos_pixel, y_off * 20 + ypos_pixel, 200, 20); // 200*200 - SPI_TFT.tftio.WriteSequence((uint16_t*)(bmp_public_buf), DEFAULT_VIEW_MAX_SIZE / 20); + SPI_TFT.tftio.writeSequence((uint16_t*)(bmp_public_buf), DEFAULT_VIEW_MAX_SIZE / 20); y_off++; } diff --git a/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp b/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp index 53f31b1c4042d..c46a532d9a936 100644 --- a/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp +++ b/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp @@ -648,7 +648,7 @@ void disp_char_1624(uint16_t x, uint16_t y, uint8_t c, uint16_t charColor, uint1 for (uint16_t i = 0; i < 24; i++) { const uint16_t tmp_char = pgm_read_word(&ASCII_Table_16x24[((c - 0x20) * 24) + i]); for (uint16_t j = 0; j < 16; j++) - SPI_TFT.SetPoint(x + j, y + i, ((tmp_char >> j) & 0x01) ? charColor : bkColor); + SPI_TFT.setPoint(x + j, y + i, ((tmp_char >> j) & 0x01) ? charColor : bkColor); } } @@ -664,7 +664,7 @@ void disp_string(uint16_t x, uint16_t y, FSTR_P const fstr, uint16_t charColor, } void disp_assets_update() { - SPI_TFT.LCD_clear(0x0000); + SPI_TFT.lcdClear(0x0000); disp_string(100, 140, F("Assets Updating..."), 0xFFFF, 0x0000); } diff --git a/Marlin/src/lcd/extui/mks_ui/pic_manager.cpp b/Marlin/src/lcd/extui/mks_ui/pic_manager.cpp index 7c0ec802c306d..06d47d949bf24 100644 --- a/Marlin/src/lcd/extui/mks_ui/pic_manager.cpp +++ b/Marlin/src/lcd/extui/mks_ui/pic_manager.cpp @@ -291,7 +291,7 @@ void spiFlashErase_PIC() { uint32_t LogoWrite_Addroffset = 0; -uint8_t Pic_Logo_Write(uint8_t *LogoName, uint8_t *Logo_Wbuff, uint32_t LogoWriteSize) { +uint8_t picLogoWrite(uint8_t *LogoName, uint8_t *Logo_Wbuff, uint32_t LogoWriteSize) { if (LogoWriteSize <= 0) return 0; W25QXX.SPI_FLASH_BufferWrite(Logo_Wbuff, PIC_LOGO_ADDR + LogoWrite_Addroffset, LogoWriteSize); @@ -308,7 +308,7 @@ uint8_t Pic_Logo_Write(uint8_t *LogoName, uint8_t *Logo_Wbuff, uint32_t LogoWrit } uint32_t TitleLogoWrite_Addroffset = 0; -uint8_t Pic_TitleLogo_Write(uint8_t *TitleLogoName, uint8_t *TitleLogo_Wbuff, uint32_t TitleLogoWriteSize) { +uint8_t picTitleLogoWrite(uint8_t *TitleLogoName, uint8_t *TitleLogo_Wbuff, uint32_t TitleLogoWriteSize) { if (TitleLogoWriteSize <= 0) return 0; if ((DeviceCode == 0x9488) || (DeviceCode == 0x5761)) @@ -329,15 +329,15 @@ void default_view_Write(uint8_t *default_view__Rbuff, uint32_t default_view_Writ default_view_addroffset_r = 0; } -uint32_t Pic_Info_Write(uint8_t *P_name, uint32_t P_size) { +uint32_t picInfoWrite(uint8_t *P_name, uint32_t P_size) { uint8_t pic_counter = 0; - uint32_t Pic_SaveAddr; + uint32_t picSaveAddr; uint32_t Pic_SizeSaveAddr; - uint32_t Pic_NameSaveAddr; - uint8_t Pname_temp; + uint32_t picNameSaveAddr; + uint8_t pNameTemp; uint32_t i, j; uint32_t name_len = 0; - uint32_t SaveName_len = 0; + uint32_t saveNameLen = 0; union union32 size_tmp; W25QXX.SPI_FLASH_BufferRead(&pic_counter, PIC_COUNTER_ADDR, 1); @@ -346,15 +346,15 @@ uint32_t Pic_Info_Write(uint8_t *P_name, uint32_t P_size) { pic_counter = 0; if ((DeviceCode == 0x9488) || (DeviceCode == 0x5761)) - Pic_SaveAddr = PIC_DATA_ADDR_TFT35 + pic_counter * PER_PIC_MAX_SPACE_TFT35; + picSaveAddr = PIC_DATA_ADDR_TFT35 + pic_counter * PER_PIC_MAX_SPACE_TFT35; else - Pic_SaveAddr = PIC_DATA_ADDR_TFT32 + pic_counter * PER_PIC_MAX_SPACE_TFT32; + picSaveAddr = PIC_DATA_ADDR_TFT32 + pic_counter * PER_PIC_MAX_SPACE_TFT32; for (j = 0; j < pic_counter; j++) { do { - W25QXX.SPI_FLASH_BufferRead(&Pname_temp, PIC_NAME_ADDR + SaveName_len, 1); - SaveName_len++; - } while (Pname_temp != '\0'); + W25QXX.SPI_FLASH_BufferRead(&pNameTemp, PIC_NAME_ADDR + saveNameLen, 1); + saveNameLen++; + } while (pNameTemp != '\0'); } i = 0; while ((*(P_name + i) != '\0')) { @@ -362,8 +362,8 @@ uint32_t Pic_Info_Write(uint8_t *P_name, uint32_t P_size) { name_len++; } - Pic_NameSaveAddr = PIC_NAME_ADDR + SaveName_len; - W25QXX.SPI_FLASH_BufferWrite(P_name, Pic_NameSaveAddr, name_len + 1); + picNameSaveAddr = PIC_NAME_ADDR + saveNameLen; + W25QXX.SPI_FLASH_BufferWrite(P_name, picNameSaveAddr, name_len + 1); Pic_SizeSaveAddr = PIC_SIZE_ADDR + 4 * pic_counter; size_tmp.dwords = P_size; W25QXX.SPI_FLASH_BufferWrite(size_tmp.bytes, Pic_SizeSaveAddr, 4); @@ -372,7 +372,7 @@ uint32_t Pic_Info_Write(uint8_t *P_name, uint32_t P_size) { W25QXX.SPI_FLASH_SectorErase(PIC_COUNTER_ADDR); W25QXX.SPI_FLASH_BufferWrite(&pic_counter, PIC_COUNTER_ADDR, 1); - return Pic_SaveAddr; + return picSaveAddr; } #if HAS_MEDIA @@ -430,14 +430,14 @@ uint32_t Pic_Info_Write(uint8_t *P_name, uint32_t P_size) { do { hal.watchdog_refresh(); pbr = file.read(public_buf, BMP_WRITE_BUF_LEN); - Pic_Logo_Write((uint8_t*)fn, public_buf, pbr); + picLogoWrite((uint8_t*)fn, public_buf, pbr); } while (pbr >= BMP_WRITE_BUF_LEN); } else if (assetType == ASSET_TYPE_TITLE_LOGO) { do { hal.watchdog_refresh(); pbr = file.read(public_buf, BMP_WRITE_BUF_LEN); - Pic_TitleLogo_Write((uint8_t*)fn, public_buf, pbr); + picTitleLogoWrite((uint8_t*)fn, public_buf, pbr); } while (pbr >= BMP_WRITE_BUF_LEN); } else if (assetType == ASSET_TYPE_G_PREVIEW) { @@ -448,7 +448,7 @@ uint32_t Pic_Info_Write(uint8_t *P_name, uint32_t P_size) { } while (pbr >= BMP_WRITE_BUF_LEN); } else if (assetType == ASSET_TYPE_ICON) { - Pic_Write_Addr = Pic_Info_Write((uint8_t*)fn, pfileSize); + Pic_Write_Addr = picInfoWrite((uint8_t*)fn, pfileSize); SPIFlash.beginWrite(Pic_Write_Addr); #if HAS_SPI_FLASH_COMPRESSION do { @@ -550,7 +550,7 @@ uint32_t Pic_Info_Write(uint8_t *P_name, uint32_t P_size) { #endif // HAS_MEDIA -void Pic_Read(uint8_t *Pname, uint8_t *P_Rbuff) { +void picRead(uint8_t *Pname, uint8_t *P_Rbuff) { uint8_t i, j; uint8_t Pic_cnt; uint32_t tmp_cnt = 0; @@ -596,7 +596,7 @@ void lv_pic_test(uint8_t *P_Rbuff, uint32_t addr, uint32_t size) { #endif uint32_t logo_addroffset = 0; -void Pic_Logo_Read(uint8_t *LogoName, uint8_t *Logo_Rbuff, uint32_t LogoReadsize) { +void picLogoRead(uint8_t *LogoName, uint8_t *Logo_Rbuff, uint32_t LogoReadsize) { W25QXX.init(SPI_QUARTER_SPEED); W25QXX.SPI_FLASH_BufferRead(Logo_Rbuff, PIC_LOGO_ADDR + logo_addroffset, LogoReadsize); logo_addroffset += LogoReadsize; diff --git a/Marlin/src/lcd/extui/mks_ui/pic_manager.h b/Marlin/src/lcd/extui/mks_ui/pic_manager.h index cdcc5b76b8a91..1483b96461e4c 100644 --- a/Marlin/src/lcd/extui/mks_ui/pic_manager.h +++ b/Marlin/src/lcd/extui/mks_ui/pic_manager.h @@ -154,8 +154,8 @@ typedef struct pic_msg PIC_MSG; #define PIC_SIZE_xM 6 #define FONT_SIZE_xM 2 -void Pic_Read(uint8_t *Pname, uint8_t *P_Rbuff); -void Pic_Logo_Read(uint8_t *LogoName, uint8_t *Logo_Rbuff, uint32_t LogoReadsize); +void picRead(uint8_t *Pname, uint8_t *P_Rbuff); +void picLogoRead(uint8_t *LogoName, uint8_t *Logo_Rbuff, uint32_t LogoReadsize); void lv_pic_test(uint8_t *P_Rbuff, uint32_t addr, uint32_t size); uint32_t lv_get_pic_addr(uint8_t *Pname); void get_spi_flash_data(const char *rec_buf, int offset, int size); diff --git a/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp b/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp index 5dfb02bfaca46..09b9c7a53e191 100644 --- a/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp +++ b/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp @@ -129,8 +129,8 @@ void tft_lvgl_init() { hal.watchdog_refresh(); // LVGL init takes time // Init TFT first! - SPI_TFT.spi_init(SPI_FULL_SPEED); - SPI_TFT.LCD_init(); + SPI_TFT.spiInit(SPI_FULL_SPEED); + SPI_TFT.lcdInit(); hal.watchdog_refresh(); // LVGL init takes time @@ -162,7 +162,7 @@ void tft_lvgl_init() { TERN_(MKS_TEST, mks_test_get()); #endif - touch.Init(); + touch.init(); lv_init(); @@ -264,7 +264,7 @@ void dmc_tc_handler(struct __DMA_HandleTypeDef * hdma) { #if ENABLED(USE_SPI_DMA_TC) lv_disp_flush_ready(disp_drv_p); lcd_dma_trans_lock = false; - TFT_SPI::Abort(); + TFT_SPI::abort(); #endif } @@ -278,10 +278,10 @@ void my_disp_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * co #if ENABLED(USE_SPI_DMA_TC) lcd_dma_trans_lock = true; - SPI_TFT.tftio.WriteSequenceIT((uint16_t*)color_p, width * height); + SPI_TFT.tftio.writeSequenceIT((uint16_t*)color_p, width * height); TFT_SPI::DMAtx.XferCpltCallback = dmc_tc_handler; #else - SPI_TFT.tftio.WriteSequence((uint16_t*)color_p, width * height); + SPI_TFT.tftio.writeSequence((uint16_t*)color_p, width * height); lv_disp_flush_ready(disp_drv_p); // Indicate you are ready with the flushing #endif @@ -297,7 +297,7 @@ void lv_fill_rect(lv_coord_t x1, lv_coord_t y1, lv_coord_t x2, lv_coord_t y2, lv width = x2 - x1 + 1; height = y2 - y1 + 1; SPI_TFT.setWindow((uint16_t)x1, (uint16_t)y1, width, height); - SPI_TFT.tftio.WriteMultiple(bk_color.full, width * height); + SPI_TFT.tftio.writeMultiple(bk_color.full, width * height); W25QXX.init(SPI_QUARTER_SPEED); } diff --git a/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.h b/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.h index a71bdc9db7667..80335b7370f78 100644 --- a/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.h +++ b/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.h @@ -40,7 +40,7 @@ void my_disp_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * co bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data); bool my_mousewheel_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data); -void LCD_Clear(uint16_t Color); +void LCD_Clear(uint16_t color); void tft_set_point(uint16_t x, uint16_t y, uint16_t point); void LCD_setWindowArea(uint16_t StartX, uint16_t StartY, uint16_t width, uint16_t height); void LCD_WriteRAM_Prepare(); diff --git a/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp b/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp index f3967a3ec38af..122712e9e1148 100644 --- a/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp +++ b/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp @@ -55,7 +55,7 @@ #define WIFI_IO1_SET() WRITE(WIFI_IO1_PIN, HIGH); #define WIFI_IO1_RESET() WRITE(WIFI_IO1_PIN, LOW); -uint8_t Explore_Disk(const char * const path, const uint8_t recu_level, const bool with_longnames); +uint8_t exploreDisk(const char * const path, const uint8_t recu_level, const bool with_longnames); extern uint8_t commands_in_queue; extern uint8_t sel_id; @@ -723,7 +723,7 @@ void get_file_list(const char * const path, const bool with_longnames) { else if (gCfgItems.fileSysType == FILE_SYS_USB) { // udisk } - Explore_Disk(path, 0, with_longnames); + exploreDisk(path, 0, with_longnames); } char wait_ip_back_flag = 0; @@ -818,7 +818,7 @@ static int cut_msg_head(uint8_t * const msg, const uint16_t msgLen, uint16_t cut return msgLen - cutLen; } -uint8_t Explore_Disk(const char * const path, const uint8_t recu_level, const bool with_longnames) { +uint8_t exploreDisk(const char * const path, const uint8_t recu_level, const bool with_longnames) { char Fstream[200]; if (!path) return 0; @@ -1805,7 +1805,7 @@ void stopEspTransfer() { W25QXX.init(SPI_QUARTER_SPEED); // ?? Workaround for SPI / Servo issues ?? - TERN_(HAS_TFT_LVGL_UI_SPI, SPI_TFT.spi_init(SPI_FULL_SPEED)); + TERN_(HAS_TFT_LVGL_UI_SPI, SPI_TFT.spiInit(SPI_FULL_SPEED)); TERN_(HAS_SERVOS, servo_init()); TERN_(HAS_Z_SERVO_PROBE, probe.servo_probe_init()); diff --git a/Marlin/src/lcd/extui/nextion/nextion_tft.cpp b/Marlin/src/lcd/extui/nextion/nextion_tft.cpp index e5e3a74be2c53..0327a2f137c8b 100644 --- a/Marlin/src/lcd/extui/nextion/nextion_tft.cpp +++ b/Marlin/src/lcd/extui/nextion/nextion_tft.cpp @@ -112,7 +112,7 @@ void NextionTFT::statusChange(const char * const msg) { void NextionTFT::tftSend(FSTR_P const fstr/*=nullptr*/) { // A helper to print PROGMEM string to the panel #if NEXDEBUG(N_SOME) - DEBUG_ECHOF(fstr); + DEBUG_ECHO(fstr); #endif PGM_P str = FTOP(fstr); while (const char c = pgm_read_byte(str++)) LCD_SERIAL.write(c); @@ -161,20 +161,20 @@ void NextionTFT::selectFile() { strncpy(selectedfile, nextion_command + 4, command_len - 4); selectedfile[command_len - 5] = '\0'; #if NEXDEBUG(N_FILE) - DEBUG_ECHOLNPAIR_F(" Selected File: ", selectedfile); + DEBUG_ECHOLNPGM(" Selected File: ", selectedfile); #endif switch (selectedfile[0]) { - case '/': // Valid file selected - //SEND_TXT("tmppage.M117", msg_sd_file_open_success); - break; - case '<': // .. (go up folder level) - filenavigator.upDIR(); - sendFileList(0); - break; - default: // enter sub folder - filenavigator.changeDIR(selectedfile); - sendFileList(0); - break; + case '/': // Valid file selected + //SEND_TXT("tmppage.M117", msg_sd_file_open_success); + break; + case '<': // .. (go up folder level) + filenavigator.upDIR(); + sendFileList(0); + break; + default: // enter sub folder + filenavigator.changeDIR(selectedfile); + sendFileList(0); + break; } } diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index d9a9340762df1..55f1ac3b48c6c 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -69,6 +69,8 @@ namespace Language_it { LSTR MSG_DISABLE_STEPPERS = _UxGT("Disabilita Motori"); LSTR MSG_DEBUG_MENU = _UxGT("Menu di debug"); LSTR MSG_PROGRESS_BAR_TEST = _UxGT("Test barra avanzam."); + LSTR MSG_ENDSTOP_TEST = _UxGT("Test Finecorsa"); + LSTR MSG_Z_PROBE = _UxGT("Sonda Z"); LSTR MSG_HOMING = _UxGT("Azzeramento"); LSTR MSG_AUTO_HOME = _UxGT("Auto Home"); LSTR MSG_AUTO_HOME_A = _UxGT("Home @"); @@ -425,6 +427,7 @@ namespace Language_it { LSTR MSG_TEMPERATURE = _UxGT("Temperatura"); LSTR MSG_MOTION = _UxGT("Movimento"); LSTR MSG_FILAMENT = _UxGT("Filamento"); + LSTR MSG_FILAMENT_EN = _UxGT("Filamento *"); LSTR MSG_VOLUMETRIC_ENABLED = _UxGT("E in mm") SUPERSCRIPT_THREE; LSTR MSG_VOLUMETRIC_LIMIT = _UxGT("Limite E in mm") SUPERSCRIPT_THREE; LSTR MSG_VOLUMETRIC_LIMIT_E = _UxGT("Limite E *"); @@ -438,6 +441,7 @@ namespace Language_it { LSTR MSG_DRAW_MIN_Y = _UxGT("Min Y area disegno"); LSTR MSG_DRAW_MAX_Y = _UxGT("Max Y area disegno"); LSTR MSG_MAX_BELT_LEN = _UxGT("Lungh.max cinghia"); + LSTR MSG_LINEAR_ADVANCE = _UxGT("Avanzam.Lineare"); LSTR MSG_ADVANCE_K = _UxGT("K Avanzamento"); LSTR MSG_ADVANCE_K_E = _UxGT("K Avanzamento *"); LSTR MSG_CONTRAST = _UxGT("Contrasto LCD"); @@ -449,8 +453,9 @@ namespace Language_it { LSTR MSG_RESTORE_DEFAULTS = _UxGT("Ripristina imp."); LSTR MSG_INIT_EEPROM = _UxGT("Inizializza EEPROM"); LSTR MSG_ERR_EEPROM_CRC = _UxGT("Err: CRC EEPROM"); - LSTR MSG_ERR_EEPROM_SIZE = _UxGT("Err: Taglia EEPROM"); + LSTR MSG_ERR_EEPROM_SIZE = _UxGT("Err: Dimens.EEPROM"); LSTR MSG_ERR_EEPROM_VERSION = _UxGT("Err: Versione EEPROM"); + LSTR MSG_ERR_EEPROM_CORRUPT = _UxGT("Err: EEPROM corrotta"); LSTR MSG_SETTINGS_STORED = _UxGT("Impostazioni mem."); LSTR MSG_MEDIA_UPDATE = _UxGT("Aggiorna media"); LSTR MSG_RESET_PRINTER = _UxGT("Resetta stampante"); @@ -619,6 +624,7 @@ namespace Language_it { LSTR MSG_CHAMBER_COOLING = _UxGT("Raffr. camera..."); LSTR MSG_LASER_COOLING = _UxGT("Raffr. laser..."); LSTR MSG_DELTA_CALIBRATE = _UxGT("Calibraz. Delta"); + LSTR MSG_DELTA_CALIBRATION_IN_PROGRESS = _UxGT("Calibrazione Delta in corso"); LSTR MSG_DELTA_CALIBRATE_X = _UxGT("Calibra X"); LSTR MSG_DELTA_CALIBRATE_Y = _UxGT("Calibra Y"); LSTR MSG_DELTA_CALIBRATE_Z = _UxGT("Calibra Z"); @@ -729,7 +735,8 @@ namespace Language_it { LSTR MSG_MMU2_FILAMENT_N = _UxGT("Filamento ~"); LSTR MSG_MMU2_RESET = _UxGT("Azzera MMU"); LSTR MSG_MMU2_RESETTING = _UxGT("Azzeramento MMU..."); - LSTR MSG_MMU2_EJECT_RECOVER = _UxGT("Rimuovi, click"); + LSTR MSG_MMU2_EJECT_RECOVER = _UxGT("Espelli, click"); + LSTR MSG_MMU2_REMOVE_AND_CLICK = _UxGT("Rimuovi e click..."); LSTR MSG_MIX = _UxGT("Miscela"); LSTR MSG_MIX_COMPONENT_N = _UxGT("Componente {"); @@ -813,6 +820,22 @@ namespace Language_it { LSTR MSG_BACKLASH_CORRECTION = _UxGT("Correzione"); LSTR MSG_BACKLASH_SMOOTHING = _UxGT("Appianamento"); + LSTR MSG_FIXED_TIME_MOTION = _UxGT("Movimento a Tempo-Fisso"); + LSTR MSG_FTM_MODE = _UxGT("Modo Movimento:"); + LSTR MSG_FTM_ZV = _UxGT("ZV"); + LSTR MSG_FTM_ZVD = _UxGT("ZVD"); + LSTR MSG_FTM_EI = _UxGT("EI"); + LSTR MSG_FTM_2HEI = _UxGT("2HEI"); + LSTR MSG_FTM_3HEI = _UxGT("3HEI"); + LSTR MSG_FTM_MZV = _UxGT("MZV"); + //LSTR MSG_FTM_ULENDO_FBS = _UxGT("Ulendo FBS"); + //LSTR MSG_FTM_DISCTF = _UxGT("DISCTF"); + LSTR MSG_FTM_DYN_MODE = _UxGT("Modo DF:"); + LSTR MSG_FTM_Z_BASED = _UxGT("Base-Z"); + LSTR MSG_FTM_MASS_BASED = _UxGT("Base-Massa"); + LSTR MSG_FTM_BASE_FREQ_N = _UxGT("@ Freq. Base"); + LSTR MSG_FTM_DFREQ_K_N = _UxGT("@ Freq. Dinam."); + LSTR MSG_LEVEL_X_AXIS = _UxGT("Livello asse X"); LSTR MSG_AUTO_CALIBRATE = _UxGT("Auto Calibra"); #if ENABLED(TOUCH_UI_FTDI_EVE) diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 8d27ee8f7e261..b56d21ae406a3 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -1179,7 +1179,7 @@ void MarlinUI::init() { run_current_screen(); // Apply all DWIN drawing after processing - TERN_(IS_DWIN_MARLINUI, DWIN_UpdateLCD()); + TERN_(IS_DWIN_MARLINUI, dwinUpdateLCD()); #endif @@ -1609,9 +1609,9 @@ void MarlinUI::init() { #endif TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged(status_message)); - TERN_(DWIN_CREALITY_LCD, DWIN_StatusChanged(status_message)); + TERN_(DWIN_CREALITY_LCD, dwinStatusChanged(status_message)); TERN_(DWIN_LCD_PROUI, DWIN_CheckStatusMessage()); - TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWIN.Update_Status(status_message)); + TERN_(DWIN_CREALITY_LCD_JYERSUI, crealityDWIN.updateStatus(status_message)); } #if ENABLED(STATUS_MESSAGE_SCROLLING) diff --git a/Marlin/src/lcd/menu/menu_configuration.cpp b/Marlin/src/lcd/menu/menu_configuration.cpp index 6440cae033026..32b6f15995a45 100644 --- a/Marlin/src/lcd/menu/menu_configuration.cpp +++ b/Marlin/src/lcd/menu/menu_configuration.cpp @@ -307,14 +307,11 @@ void menu_advanced_settings(); #if ENABLED(BLTOUCH_LCD_VOLTAGE_MENU) void bltouch_report() { - PGMSTR(mode0, "OD"); - PGMSTR(mode1, "5V"); - DEBUG_ECHOPGM("BLTouch Mode: "); - DEBUG_ECHOPGM_P(bltouch.od_5v_mode ? mode1 : mode0); - DEBUG_ECHOLNPGM(" (Default " TERN(BLTOUCH_SET_5V_MODE, "5V", "OD") ")"); + FSTR_P const mode0 = F("OD"), mode1 = F("5V"); + DEBUG_ECHOLNPGM("BLTouch Mode: ", bltouch.od_5v_mode ? mode1 : mode0, " (Default ", TERN(BLTOUCH_SET_5V_MODE, mode1, mode0), ")"); char mess[21]; strcpy_P(mess, PSTR("BLTouch Mode: ")); - strcpy_P(&mess[15], bltouch.od_5v_mode ? mode1 : mode0); + strcpy_P(&mess[15], bltouch.od_5v_mode ? FTOP(mode1) : FTOP(mode0)); ui.set_status(mess); ui.return_to_status(); } diff --git a/Marlin/src/lcd/tft/canvas.cpp b/Marlin/src/lcd/tft/canvas.cpp index ac3a2d76c3890..04817570e1102 100644 --- a/Marlin/src/lcd/tft/canvas.cpp +++ b/Marlin/src/lcd/tft/canvas.cpp @@ -82,16 +82,16 @@ void Canvas::addText(uint16_t x, uint16_t y, uint16_t color, uint16_t *string, u } for (uint16_t i = 0 ; *(string + i) ; i++) { glyph_t *pGlyph = glyph(string + i); - if (stringWidth + pGlyph->BBXWidth > maxWidth) break; + if (stringWidth + pGlyph->bbxWidth > maxWidth) break; switch (getFontType()) { case FONT_MARLIN_GLYPHS_1BPP: - addImage(x + stringWidth + pGlyph->BBXOffsetX, y + getFontAscent() - pGlyph->BBXHeight - pGlyph->BBXOffsetY, pGlyph->BBXWidth, pGlyph->BBXHeight, GREYSCALE1, ((uint8_t *)pGlyph) + sizeof(glyph_t), &color); + addImage(x + stringWidth + pGlyph->bbxOffsetX, y + getFontAscent() - pGlyph->bbxHeight - pGlyph->bbxOffsetY, pGlyph->bbxWidth, pGlyph->bbxHeight, GREYSCALE1, ((uint8_t *)pGlyph) + sizeof(glyph_t), &color); break; case FONT_MARLIN_GLYPHS_2BPP: - addImage(x + stringWidth + pGlyph->BBXOffsetX, y + getFontAscent() - pGlyph->BBXHeight - pGlyph->BBXOffsetY, pGlyph->BBXWidth, pGlyph->BBXHeight, GREYSCALE2, ((uint8_t *)pGlyph) + sizeof(glyph_t), colors); + addImage(x + stringWidth + pGlyph->bbxOffsetX, y + getFontAscent() - pGlyph->bbxHeight - pGlyph->bbxOffsetY, pGlyph->bbxWidth, pGlyph->bbxHeight, GREYSCALE2, ((uint8_t *)pGlyph) + sizeof(glyph_t), colors); break; } - stringWidth += pGlyph->DWidth; + stringWidth += pGlyph->dWidth; } } diff --git a/Marlin/src/lcd/tft/tft.cpp b/Marlin/src/lcd/tft/tft.cpp index fa3c2c241f790..868a89d2dca4f 100644 --- a/Marlin/src/lcd/tft/tft.cpp +++ b/Marlin/src/lcd/tft/tft.cpp @@ -33,8 +33,8 @@ uint16_t TFT::buffer[]; void TFT::init() { - io.Init(); - io.InitTFT(); + io.init(); + io.initTFT(); } TFT tft; diff --git a/Marlin/src/lcd/tft/tft.h b/Marlin/src/lcd/tft/tft.h index 7dc3996148ab4..4a1d1d83044e7 100644 --- a/Marlin/src/lcd/tft/tft.h +++ b/Marlin/src/lcd/tft/tft.h @@ -69,9 +69,9 @@ class TFT { static void add_glyphs(const uint8_t *Font) { string.add_glyphs(Font); } static bool is_busy() { return io.isBusy(); } - static void abort() { io.Abort(); } - static void write_multiple(uint16_t Data, uint16_t Count) { io.WriteMultipleDMA(Data, Count); } - static void write_sequence(uint16_t *Data, uint16_t Count) { io.WriteSequenceDMA(Data, Count); } + static void abort() { io.abort(); } + static void write_multiple(uint16_t data, uint16_t count) { io.WriteMultipleDMA(data, count); } + static void write_sequence(uint16_t *data, uint16_t count) { io.writeSequenceDMA(data, count); } static void set_window(uint16_t Xmin, uint16_t Ymin, uint16_t Xmax, uint16_t Ymax) { io.set_window(Xmin, Ymin, Xmax, Ymax); } static void fill(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) { queue.fill(x, y, width, height, color); } diff --git a/Marlin/src/lcd/tft/tft_string.cpp b/Marlin/src/lcd/tft/tft_string.cpp index 19ea5b2079e9e..6ee1bab6d3f7f 100644 --- a/Marlin/src/lcd/tft/tft_string.cpp +++ b/Marlin/src/lcd/tft/tft_string.cpp @@ -59,11 +59,11 @@ void TFT_String::set_font(const uint8_t *font) { #endif DEBUG_ECHOLNPGM("Format: ", ((unifont_t *)font_header)->Format); - DEBUG_ECHOLNPGM("CapitalAHeight: ", ((unifont_t *)font_header)->CapitalAHeight); - DEBUG_ECHOLNPGM("FontStartEncoding: ", ((unifont_t *)font_header)->FontStartEncoding); - DEBUG_ECHOLNPGM("FontEndEncoding: ", ((unifont_t *)font_header)->FontEndEncoding); - DEBUG_ECHOLNPGM("FontAscent: ", ((unifont_t *)font_header)->FontAscent); - DEBUG_ECHOLNPGM("FontDescent: ", ((unifont_t *)font_header)->FontDescent); + DEBUG_ECHOLNPGM("capitalAHeight: ", ((unifont_t *)font_header)->capitalAHeight); + DEBUG_ECHOLNPGM("fontStartEncoding: ", ((unifont_t *)font_header)->fontStartEncoding); + DEBUG_ECHOLNPGM("fontEndEncoding: ", ((unifont_t *)font_header)->fontEndEncoding); + DEBUG_ECHOLNPGM("fontAscent: ", ((unifont_t *)font_header)->fontAscent); + DEBUG_ECHOLNPGM("fontDescent: ", ((unifont_t *)font_header)->fontDescent); add_glyphs(font); } @@ -72,15 +72,15 @@ void TFT_String::add_glyphs(const uint8_t *font) { uint16_t unicode, fontStartEncoding, fontEndEncoding; uint8_t *pointer; - fontStartEncoding = ((unifont_t *)font)->FontStartEncoding; - fontEndEncoding = ((unifont_t *)font)->FontEndEncoding; + fontStartEncoding = ((unifont_t *)font)->fontStartEncoding; + fontEndEncoding = ((unifont_t *)font)->fontEndEncoding; pointer = (uint8_t *)font + sizeof(unifont_t); if (fontEndEncoding < 0x0100) { // base and symbol fonts for (unicode = fontStartEncoding; unicode <= fontEndEncoding; unicode++) { if (*pointer != NO_GLYPH) { glyphs[unicode] = (glyph_t *)pointer; - pointer += sizeof(glyph_t) + ((glyph_t *)pointer)->DataSize; + pointer += sizeof(glyph_t) + ((glyph_t *)pointer)->dataSize; } else pointer++; @@ -98,7 +98,7 @@ void TFT_String::add_glyphs(const uint8_t *font) { } if (*pointer != NO_GLYPH) { glyphs_extra[unicode - fontStartEncoding] = pointer; - pointer += sizeof(glyph_t) + ((glyph_t *)pointer)->DataSize; + pointer += sizeof(glyph_t) + ((glyph_t *)pointer)->dataSize; } else pointer++; @@ -112,7 +112,7 @@ void TFT_String::add_glyphs(const uint8_t *font) { } glyphs_extra[i] = pointer; unicode = *(uint16_t *) pointer; - pointer += sizeof(uniglyph_t) + ((uniglyph_t *)pointer)->glyph.DataSize; + pointer += sizeof(uniglyph_t) + ((uniglyph_t *)pointer)->glyph.dataSize; extra_count = i + 1; if (unicode == fontEndEncoding) break; @@ -127,11 +127,11 @@ glyph_t *TFT_String::glyph(uint16_t character) { if (character < 0x00ff) return glyphs[character] ?: glyphs['?']; /* Use '?' for unknown glyphs */ #if EXTRA_GLYPHS - if (font_header_extra == nullptr || character < font_header_extra->FontStartEncoding || character > font_header_extra->FontEndEncoding) return glyphs['?']; + if (font_header_extra == nullptr || character < font_header_extra->fontStartEncoding || character > font_header_extra->fontEndEncoding) return glyphs['?']; if ((font_header_extra->Format & 0xF0) == FONT_MARLIN_GLYPHS) { - if (glyphs_extra[character - font_header_extra->FontStartEncoding]) - return (glyph_t *)glyphs_extra[character - font_header_extra->FontStartEncoding]; + if (glyphs_extra[character - font_header_extra->fontStartEncoding]) + return (glyph_t *)glyphs_extra[character - font_header_extra->fontStartEncoding]; } else { #if 0 @@ -232,7 +232,7 @@ void TFT_String::add_character(const uint16_t character) { if (length < MAX_STRING_LENGTH) { data[length] = character; length++; - span += glyph(character)->DWidth; + span += glyph(character)->dWidth; } } @@ -240,7 +240,7 @@ void TFT_String::rtrim(const uint16_t character) { while (length) { if (data[length - 1] == 0x20 || data[length - 1] == character) { length--; - span -= glyph(data[length])->DWidth; + span -= glyph(data[length])->dWidth; eol(); } else @@ -251,7 +251,7 @@ void TFT_String::rtrim(const uint16_t character) { void TFT_String::ltrim(const uint16_t character) { uint16_t i, j; for (i = 0; (i < length) && (data[i] == 0x20 || data[i] == character); i++) { - span -= glyph(data[i])->DWidth; + span -= glyph(data[i])->dWidth; } if (i == 0) return; for (j = 0; i < length; data[j++] = data[i++]); diff --git a/Marlin/src/lcd/tft/tft_string.h b/Marlin/src/lcd/tft/tft_string.h index 3df6afe49bc00..1284d282f1348 100644 --- a/Marlin/src/lcd/tft/tft_string.h +++ b/Marlin/src/lcd/tft/tft_string.h @@ -29,7 +29,7 @@ /* * Marlin fonts with optional antialiasing. Fonts use unifont_t font header and glyph_t glyphs headers. - * Number of glyphs (FontEndEncoding - FontStartEncoding) can not exceed 256 (TBD). + * Number of glyphs (fontEndEncoding - fontStartEncoding) can not exceed 256 (TBD). * Some glyphs may be left undefined with NO_GLYPH */ #define FONT_MARLIN_GLYPHS 0x80 @@ -44,7 +44,7 @@ * * IMPORTANT NOTES: * - glyphs fast search method REQUIRES glyphs to be ordered by unicode - * - last glyph's code MUST be FontEndEncoding + * - last glyph's code MUST be fontEndEncoding */ #define FONT_MARLIN_HIEROGLYPHS 0xA0 #define FONT_MARLIN_HIEROGLYPHS_1BPP 0xA1 @@ -146,22 +146,22 @@ // TFT font with unicode support typedef struct __attribute__((__packed__)) { - uint8_t Format; - uint8_t CapitalAHeight; // Not really needed, but helps with data alingment for uint16_t variables - uint16_t FontStartEncoding; - uint16_t FontEndEncoding; - int8_t FontAscent; - int8_t FontDescent; + uint8_t format; + uint8_t capitalAHeight; // Not really needed, but helps with data alignment for uint16_t variables + uint16_t fontStartEncoding; + uint16_t fontEndEncoding; + int8_t fontAscent; + int8_t fontDescent; } unifont_t; // TFT glyphs typedef struct __attribute__((__packed__)) { - uint8_t BBXWidth; - uint8_t BBXHeight; - uint8_t DataSize; - int8_t DWidth; - int8_t BBXOffsetX; - int8_t BBXOffsetY; + uint8_t bbxWidth; + uint8_t bbxHeight; + uint8_t dataSize; + int8_t dWidth; + int8_t bbxOffsetX; + int8_t bbxOffsetY; } glyph_t; // unicode-prepended TFT glyphs @@ -194,9 +194,9 @@ class TFT_String { static void set_font(const uint8_t *font); static void add_glyphs(const uint8_t *font); - static uint8_t font_type() { return font_header->Format; }; - static uint16_t font_ascent() { return font_header->FontAscent; } - static uint16_t font_height() { return font_header->FontAscent - font_header->FontDescent; } + static uint8_t font_type() { return font_header->format; }; + static uint16_t font_ascent() { return font_header->fontAscent; } + static uint16_t font_height() { return font_header->fontAscent - font_header->fontDescent; } static glyph_t *glyph(uint16_t character); static glyph_t *glyph(uint16_t *character) { return glyph(*character); } @@ -264,7 +264,7 @@ class TFT_String { static uint16_t *string() { return data; } static uint16_t width() { return span; } static uint16_t center(const uint16_t width) { return span > width ? 0 : (width - span) / 2; } - static uint16_t vcenter(const uint16_t height) { return (height + font_header->CapitalAHeight + 1) / 2 > font_header->FontAscent ? (height + font_header->CapitalAHeight + 1) / 2 - font_header->FontAscent : 0 ; } + static uint16_t vcenter(const uint16_t height) { return (height + font_header->capitalAHeight + 1) / 2 > font_header->fontAscent ? (height + font_header->capitalAHeight + 1) / 2 - font_header->fontAscent : 0 ; } }; extern TFT_String tft_string; diff --git a/Marlin/src/lcd/tft/touch.cpp b/Marlin/src/lcd/tft/touch.cpp index 1765ae0a8e09f..443a74480d410 100644 --- a/Marlin/src/lcd/tft/touch.cpp +++ b/Marlin/src/lcd/tft/touch.cpp @@ -58,7 +58,7 @@ TouchControlType Touch::touch_control_type = NONE; void Touch::init() { TERN_(TOUCH_SCREEN_CALIBRATION, touch_calibration.calibration_reset()); reset(); - io.Init(); + io.init(); TERN_(HAS_TOUCH_SLEEP, wakeUp()); enable(); } diff --git a/Marlin/src/lcd/tft/ui_1024x600.cpp b/Marlin/src/lcd/tft/ui_1024x600.cpp index e43ccf74500a1..84495fbaba98b 100644 --- a/Marlin/src/lcd/tft/ui_1024x600.cpp +++ b/Marlin/src/lcd/tft/ui_1024x600.cpp @@ -118,27 +118,26 @@ void MarlinUI::draw_kill_screen() { tft.queue.sync(); } -void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) { +void draw_heater_status(uint16_t x, uint16_t y, const int8_t heater) { MarlinImage image = imgHotEnd; - uint16_t Color; celsius_t currentTemperature, targetTemperature; - if (Heater >= 0) { // HotEnd + if (heater >= 0) { // HotEnd #if HAS_EXTRUDERS - currentTemperature = thermalManager.wholeDegHotend(Heater); - targetTemperature = thermalManager.degTargetHotend(Heater); + currentTemperature = thermalManager.wholeDegHotend(heater); + targetTemperature = thermalManager.degTargetHotend(heater); #else return; #endif } #if HAS_HEATED_BED - else if (Heater == H_BED) { + else if (heater == H_BED) { currentTemperature = thermalManager.wholeDegBed(); targetTemperature = thermalManager.degTargetBed(); } #endif #if HAS_TEMP_CHAMBER - else if (Heater == H_CHAMBER) { + else if (heater == H_CHAMBER) { currentTemperature = thermalManager.wholeDegChamber(); #if HAS_HEATED_CHAMBER targetTemperature = thermalManager.degTargetChamber(); @@ -148,54 +147,54 @@ void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) { } #endif #if HAS_TEMP_COOLER - else if (Heater == H_COOLER) { + else if (heater == H_COOLER) { currentTemperature = thermalManager.wholeDegCooler(); targetTemperature = TERN(HAS_COOLER, thermalManager.degTargetCooler(), ABSOLUTE_ZERO); } #endif else return; - TERN_(TOUCH_SCREEN, if (targetTemperature >= 0) touch.add_control(HEATER, x, y, 80, 120, Heater)); + TERN_(TOUCH_SCREEN, if (targetTemperature >= 0) touch.add_control(HEATER, x, y, 80, 120, heater)); tft.canvas(x, y, 80, 120); tft.set_background(COLOR_BACKGROUND); - Color = currentTemperature < 0 ? COLOR_INACTIVE : COLOR_COLD; + uint16_t color = currentTemperature < 0 ? COLOR_INACTIVE : COLOR_COLD; - if (Heater >= 0) { // HotEnd - if (currentTemperature >= 50) Color = COLOR_HOTEND; + if (heater >= 0) { // HotEnd + if (currentTemperature >= 50) color = COLOR_HOTEND; } #if HAS_HEATED_BED - else if (Heater == H_BED) { - if (currentTemperature >= 50) Color = COLOR_HEATED_BED; + else if (heater == H_BED) { + if (currentTemperature >= 50) color = COLOR_HEATED_BED; image = targetTemperature > 0 ? imgBedHeated : imgBed; } #endif #if HAS_TEMP_CHAMBER - else if (Heater == H_CHAMBER) { - if (currentTemperature >= 50) Color = COLOR_CHAMBER; + else if (heater == H_CHAMBER) { + if (currentTemperature >= 50) color = COLOR_CHAMBER; image = targetTemperature > 0 ? imgChamberHeated : imgChamber; } #endif #if HAS_TEMP_COOLER - else if (Heater == H_COOLER) { - if (currentTemperature <= 26) Color = COLOR_COLD; - if (currentTemperature > 26) Color = COLOR_RED; + else if (heater == H_COOLER) { + if (currentTemperature <= 26) color = COLOR_COLD; + if (currentTemperature > 26) color = COLOR_RED; image = targetTemperature > 26 ? imgCoolerHot : imgCooler; } #endif - tft.add_image(8, 28, image, Color); + tft.add_image(8, 28, image, color); tft_string.set(i16tostr3rj(currentTemperature)); tft_string.add(LCD_STR_DEGREE); tft_string.trim(); - tft.add_text(tft_string.center(80) + 2, 82, Color, tft_string); + tft.add_text(tft_string.center(80) + 2, 82, 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(80) + 2, 8, Color, tft_string); + tft.add_text(tft_string.center(80) + 2, 8, color, tft_string); } } @@ -265,7 +264,7 @@ void MarlinUI::draw_status_screen() { if (TERN0(LCD_SHOW_E_TOTAL, printingIsActive())) { #if ENABLED(LCD_SHOW_E_TOTAL) - tft.add_text(200, 3, COLOR_AXIS_HOMED , "E"); + tft.add_text(200, 3, 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'); @@ -275,7 +274,7 @@ void MarlinUI::draw_status_screen() { } else { #if HAS_X_AXIS - tft.add_text(200, 3, COLOR_AXIS_HOMED , "X"); + tft.add_text(200, 3, COLOR_AXIS_HOMED, "X"); const bool nhx = axis_should_home(X_AXIS); if (blink && nhx) tft_string.set('?'); @@ -285,7 +284,7 @@ void MarlinUI::draw_status_screen() { #endif #if HAS_Y_AXIS - tft.add_text(500, 3, COLOR_AXIS_HOMED , "Y"); + tft.add_text(500, 3, COLOR_AXIS_HOMED, "Y"); const bool nhy = axis_should_home(Y_AXIS); if (blink && nhy) tft_string.set('?'); @@ -296,7 +295,7 @@ void MarlinUI::draw_status_screen() { } #if HAS_Z_AXIS - tft.add_text(800, 3, COLOR_AXIS_HOMED , "Z"); + tft.add_text(800, 3, COLOR_AXIS_HOMED, "Z"); uint16_t offset = 32; const bool nhz = axis_should_home(Z_AXIS); if (blink && nhz) @@ -323,7 +322,7 @@ void MarlinUI::draw_status_screen() { tft.add_image(0, 0, imgFeedRate, color); tft_string.set(i16tostr3rj(feedrate_percentage)); tft_string.add('%'); - tft.add_text(36, 1, color , tft_string); + tft.add_text(36, 1, color, tft_string); TERN_(TOUCH_SCREEN, touch.add_control(FEEDRATE, 274, y, 128, 32)); // Flow rate @@ -334,7 +333,7 @@ void MarlinUI::draw_status_screen() { tft.add_image(0, 0, imgFlowRate, color); tft_string.set(i16tostr3rj(planner.flow_percentage[active_extruder])); tft_string.add('%'); - tft.add_text(36, 1, color , tft_string); + tft.add_text(36, 1, color, tft_string); TERN_(TOUCH_SCREEN, touch.add_control(FLOWRATE, 650, y, 128, 32, active_extruder)); #endif @@ -495,7 +494,7 @@ void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, con #if ENABLED(TOUCH_SCREEN) touch.clear(); draw_menu_navigation = false; - touch.add_control(RESUME_CONTINUE , 0, 0, TFT_WIDTH, TFT_HEIGHT); + touch.add_control(RESUME_CONTINUE, 0, 0, TFT_WIDTH, TFT_HEIGHT); #endif menu_line(row); @@ -654,8 +653,10 @@ static void drawCurStepValue() { tft_string.set(F("Offset")); tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y + 34, tft_string.width(), 34); tft.set_background(COLOR_BACKGROUND); - if (motionAxisState.z_selection == Z_SELECTION_Z_PROBE) - tft.add_text(0, 0, Z_BTN_COLOR, tft_string); + #if HAS_BED_PROBE + if (motionAxisState.z_selection == Z_SELECTION_Z_PROBE) + tft.add_text(0, 0, Z_BTN_COLOR, tft_string); + #endif } #endif @@ -664,7 +665,7 @@ static void drawCurStepValue() { tft.canvas(motionAxisState.eNamePos.x, motionAxisState.eNamePos.y, BTN_WIDTH, BTN_HEIGHT); tft.set_background(COLOR_BACKGROUND); tft_string.set('E'); - tft.add_text(0, 0, E_BTN_COLOR , tft_string); + tft.add_text(0, 0, E_BTN_COLOR, tft_string); tft.add_text(tft_string.width(), 0, E_BTN_COLOR, ui8tostr3rj(motionAxisState.e_selection)); } #endif @@ -717,7 +718,8 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { const float diff = motionAxisState.currentStepSize * direction; - #if HAS_Z_AXIS + #if HAS_BED_PROBE + if (axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE) { #if ENABLED(BABYSTEP_ZPROBE_OFFSET) const int16_t babystep_increment = direction * BABYSTEP_SIZE_Z; @@ -740,7 +742,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { else drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS)); - #elif HAS_BED_PROBE + #else // only change probe.offset.z probe.offset.z += diff; if (direction < 0 && current_position[axis] < Z_PROBE_OFFSET_RANGE_MIN) { @@ -758,7 +760,8 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { #endif return; } - #endif // HAS_Z_AXIS + + #endif // HAS_BED_PROBE if (!ui.manual_move.processing) { // Get motion limit from software endstops, if any @@ -852,8 +855,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, - height = Images[imgBtn52Rounded].height; + const uint16_t width = Images[imgBtn52Rounded].width, + height = Images[imgBtn52Rounded].height; if (!enabled) bgColor = COLOR_CONTROL_DISABLED; @@ -887,8 +890,9 @@ void MarlinUI::move_axis_screen() { const bool busy = printingIsActive(); // Babysteps during printing? Select babystep for Z probe offset - if (busy && ENABLED(BABYSTEP_ZPROBE_OFFSET)) - motionAxisState.z_selection = Z_SELECTION_Z_PROBE; + #if ENABLED(BABYSTEP_ZPROBE_OFFSET) + if (busy) motionAxisState.z_selection = Z_SELECTION_Z_PROBE; + #endif // ROW 1 -> E- Y- CurY Z+ int x = X_MARGIN, y = Y_MARGIN, spacing = 0; @@ -897,13 +901,16 @@ void MarlinUI::move_axis_screen() { spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2; x += BTN_WIDTH + spacing; - drawBtn(x, y, "Y+", (intptr_t)y_plus, imgUp, Y_BTN_COLOR, !busy); - // Cur Y + TERN_(HAS_Y_AXIS, drawBtn(x, y, "Y+", (intptr_t)y_plus, imgUp, Y_BTN_COLOR, !busy)); + x += BTN_WIDTH; - motionAxisState.yValuePos.x = x + 2; - motionAxisState.yValuePos.y = y; - drawAxisValue(Y_AXIS); + + // Cur Y + #if HAS_Y_AXIS + motionAxisState.yValuePos.set(x + 2, y); + drawAxisValue(Y_AXIS); + #endif x += spacing; #if HAS_Z_AXIS @@ -915,27 +922,34 @@ void MarlinUI::move_axis_screen() { x = X_MARGIN; spacing = (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4; - motionAxisState.eNamePos.x = x; - motionAxisState.eNamePos.y = y; #if HAS_EXTRUDERS + motionAxisState.eNamePos.set(x, y); drawCurESelection(); TERN_(TOUCH_SCREEN, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select)); #endif x += BTN_WIDTH + spacing; - drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy); + + TERN_(HAS_X_AXIS, drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy)); x += BTN_WIDTH + spacing; //imgHome is 64x64 - TERN_(TOUCH_SCREEN, add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy)); + + #if ALL(HAS_X_AXIS, TOUCH_SCREEN) + add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy); + #endif x += BTN_WIDTH + spacing; uint16_t xplus_x = x; - drawBtn(x, y, "X+", (intptr_t)x_plus, imgRight, X_BTN_COLOR, !busy); + + TERN_(HAS_X_AXIS, 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; - TERN_(HAS_Z_AXIS, drawCurZSelection()); + + #if HAS_Z_AXIS + motionAxisState.zTypePos.set(x, y); + drawCurZSelection(); + #endif + #if ALL(HAS_BED_PROBE, TOUCH_SCREEN) if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (intptr_t)z_select); #endif @@ -945,39 +959,35 @@ void MarlinUI::move_axis_screen() { x = X_MARGIN; spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2; - TERN_(HAS_EXTRUDERS, 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; - TERN_(HAS_EXTRUDERS, drawAxisValue(E_AXIS)); + #if HAS_EXTRUDERS + drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy); + motionAxisState.eValuePos.set(x, y + BTN_HEIGHT + 2); + TERN_(HAS_EXTRUDERS, drawAxisValue(E_AXIS)); + #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); + #if HAS_X_AXIS + motionAxisState.xValuePos.set(BTN_WIDTH + (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4, y - 10); + drawAxisValue(X_AXIS); + #endif x += BTN_WIDTH + spacing; - drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy); + TERN_(HAS_Y_AXIS, drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy)); x += BTN_WIDTH + spacing; + #if HAS_Z_AXIS - 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 + drawBtn(x, y, "Z-", (intptr_t)z_minus, imgDown, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); // Only enabled when not busy or have babystep + motionAxisState.zValuePos.set(x, y + BTN_HEIGHT + 2); + drawAxisValue(Z_AXIS); #endif - // Cur Z - motionAxisState.zValuePos.x = x; - motionAxisState.zValuePos.y = y + BTN_HEIGHT + 2; - TERN_(HAS_Z_AXIS, drawAxisValue(Z_AXIS)); - // ROW 4 -> step_size disable steppers back - y = TFT_HEIGHT - Y_MARGIN - 32; // + y = TFT_HEIGHT - Y_MARGIN - 32; x = TFT_WIDTH / 2 - CUR_STEP_VALUE_WIDTH / 2; - motionAxisState.stepValuePos.x = x; - motionAxisState.stepValuePos.y = y; + motionAxisState.stepValuePos.set(x, y); if (!busy) { drawCurStepValue(); - TERN_(TOUCH_SCREEN, touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (intptr_t)step_size)); + TERN_(TOUCH_SCREEN, touch.add_control(BUTTON, x, y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (intptr_t)step_size)); } // aligned with x+ diff --git a/Marlin/src/lcd/tft/ui_320x240.cpp b/Marlin/src/lcd/tft/ui_320x240.cpp index 0d145f10eb9d8..8409b550a1451 100644 --- a/Marlin/src/lcd/tft/ui_320x240.cpp +++ b/Marlin/src/lcd/tft/ui_320x240.cpp @@ -120,27 +120,26 @@ void MarlinUI::draw_kill_screen() { tft.queue.sync(); } -void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) { +void draw_heater_status(uint16_t x, uint16_t y, const int8_t heater) { MarlinImage image = imgHotEnd; - uint16_t Color; celsius_t currentTemperature, targetTemperature; - if (Heater >= 0) { // HotEnd + if (heater >= 0) { // HotEnd #if HAS_EXTRUDERS - currentTemperature = thermalManager.wholeDegHotend(Heater); - targetTemperature = thermalManager.degTargetHotend(Heater); + currentTemperature = thermalManager.wholeDegHotend(heater); + targetTemperature = thermalManager.degTargetHotend(heater); #else return; #endif } #if HAS_HEATED_BED - else if (Heater == H_BED) { + else if (heater == H_BED) { currentTemperature = thermalManager.wholeDegBed(); targetTemperature = thermalManager.degTargetBed(); } #endif #if HAS_TEMP_CHAMBER - else if (Heater == H_CHAMBER) { + else if (heater == H_CHAMBER) { currentTemperature = thermalManager.wholeDegChamber(); #if HAS_HEATED_CHAMBER targetTemperature = thermalManager.degTargetChamber(); @@ -150,54 +149,54 @@ void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) { } #endif #if HAS_TEMP_COOLER - else if (Heater == H_COOLER) { + else if (heater == H_COOLER) { currentTemperature = thermalManager.wholeDegCooler(); targetTemperature = TERN(HAS_COOLER, thermalManager.degTargetCooler(), ABSOLUTE_ZERO); } #endif else return; - TERN_(TOUCH_SCREEN, if (targetTemperature >= 0) touch.add_control(HEATER, x, y, 64, 100, Heater)); + TERN_(TOUCH_SCREEN, if (targetTemperature >= 0) touch.add_control(HEATER, x, y, 64, 100, heater)); tft.canvas(x, y, 64, 100); tft.set_background(COLOR_BACKGROUND); - Color = currentTemperature < 0 ? COLOR_INACTIVE : COLOR_COLD; + uint16_t color = currentTemperature < 0 ? COLOR_INACTIVE : COLOR_COLD; - if (Heater >= 0) { // HotEnd - if (currentTemperature >= 50) Color = COLOR_HOTEND; + if (heater >= 0) { // HotEnd + if (currentTemperature >= 50) color = COLOR_HOTEND; } #if HAS_HEATED_BED - else if (Heater == H_BED) { - if (currentTemperature >= 50) Color = COLOR_HEATED_BED; + else if (heater == H_BED) { + if (currentTemperature >= 50) color = COLOR_HEATED_BED; image = targetTemperature > 0 ? imgBedHeated : imgBed; } #endif #if HAS_TEMP_CHAMBER - else if (Heater == H_CHAMBER) { - if (currentTemperature >= 50) Color = COLOR_CHAMBER; + else if (heater == H_CHAMBER) { + if (currentTemperature >= 50) color = COLOR_CHAMBER; image = targetTemperature > 0 ? imgChamberHeated : imgChamber; } #endif #if HAS_TEMP_COOLER - else if (Heater == H_COOLER) { - if (currentTemperature <= 26) Color = COLOR_COLD; - if (currentTemperature > 26) Color = COLOR_RED; + else if (heater == H_COOLER) { + if (currentTemperature <= 26) color = COLOR_COLD; + if (currentTemperature > 26) color = COLOR_RED; image = targetTemperature > 26 ? imgCoolerHot : imgCooler; } #endif - tft.add_image(0, 18, image, Color); + tft.add_image(0, 18, image, color); 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(FONT_LINE_HEIGHT), 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(FONT_LINE_HEIGHT), Color, tft_string); + tft.add_text(tft_string.center(64) + 2, 5 + tft_string.vcenter(FONT_LINE_HEIGHT), color, tft_string); } } @@ -278,7 +277,7 @@ void MarlinUI::draw_status_screen() { if (TERN0(LCD_SHOW_E_TOTAL, printingIsActive())) { #if ENABLED(LCD_SHOW_E_TOTAL) - tft.add_text( 10, tft_string.vcenter(FONT_LINE_HEIGHT), 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'); @@ -288,7 +287,7 @@ void MarlinUI::draw_status_screen() { } else { #if HAS_X_AXIS - tft.add_text(TERN(TFT_COLOR_UI_PORTRAIT, 32, 10), tft_string.vcenter(FONT_LINE_HEIGHT), 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( @@ -302,7 +301,7 @@ void MarlinUI::draw_status_screen() { #endif #if HAS_Y_AXIS - tft.add_text(TERN(TFT_COLOR_UI_PORTRAIT, 110, 127), tft_string.vcenter(FONT_LINE_HEIGHT), 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( @@ -317,7 +316,7 @@ void MarlinUI::draw_status_screen() { } #if HAS_Z_AXIS - tft.add_text(TERN(TFT_COLOR_UI_PORTRAIT, 192, 219), tft_string.vcenter(FONT_LINE_HEIGHT), 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) @@ -362,7 +361,7 @@ void MarlinUI::draw_status_screen() { 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); + tft.add_text(32, tft_string.vcenter(30), color, tft_string); TERN_(TOUCH_SCREEN, touch.add_control(FEEDRATE, #if ENABLED(TFT_COLOR_UI_PORTRAIT) 30, 172, 80 @@ -387,7 +386,7 @@ void MarlinUI::draw_status_screen() { 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); + tft.add_text(32, tft_string.vcenter(30), color, tft_string); TERN_(TOUCH_SCREEN, touch.add_control(FLOWRATE, #if ENABLED(TFT_COLOR_UI_PORTRAIT) 140, 172, 80 @@ -576,7 +575,7 @@ void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, con #if ENABLED(TOUCH_SCREEN) touch.clear(); draw_menu_navigation = false; - touch.add_control(RESUME_CONTINUE , 0, 0, TFT_WIDTH, TFT_HEIGHT); + touch.add_control(RESUME_CONTINUE, 0, 0, TFT_WIDTH, TFT_HEIGHT); #endif menu_line(row); @@ -739,8 +738,10 @@ static void drawCurStepValue() { tft_string.set(F("Offset")); tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y + 34, tft_string.width(), 20); tft.set_background(COLOR_BACKGROUND); - if (motionAxisState.z_selection == Z_SELECTION_Z_PROBE) - tft.add_text(0, 0, Z_BTN_COLOR, tft_string); + #if HAS_BED_PROBE + if (motionAxisState.z_selection == Z_SELECTION_Z_PROBE) + tft.add_text(0, 0, Z_BTN_COLOR, tft_string); + #endif } #endif @@ -749,7 +750,7 @@ static void drawCurStepValue() { tft.canvas(motionAxisState.eNamePos.x, motionAxisState.eNamePos.y, BTN_WIDTH, BTN_HEIGHT); tft.set_background(COLOR_BACKGROUND); tft_string.set('E'); - tft.add_text(0, 0, E_BTN_COLOR , tft_string); + tft.add_text(0, 0, E_BTN_COLOR, tft_string); tft.add_text(tft_string.width(), 0, E_BTN_COLOR, ui8tostr3rj(motionAxisState.e_selection)); } #endif @@ -809,7 +810,8 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { const float diff = motionAxisState.currentStepSize * direction; - #if HAS_Z_AXIS + #if HAS_BED_PROBE + if (axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE) { #if ENABLED(BABYSTEP_ZPROBE_OFFSET) const int16_t babystep_increment = direction * BABYSTEP_SIZE_Z; @@ -829,10 +831,10 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { drawMessage(NUL_STR); // clear the error drawAxisValue(axis); } - else { + else drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS)); - } - #elif HAS_BED_PROBE + + #else // only change probe.offset.z probe.offset.z += diff; if (direction < 0 && current_position[axis] < Z_PROBE_OFFSET_RANGE_MIN) { @@ -843,14 +845,15 @@ 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 { + else drawMessage(NUL_STR); // clear the error - } + drawAxisValue(axis); #endif return; } - #endif // HAS_Z_AXIS + + #endif // HAS_BED_PROBE if (!ui.manual_move.processing) { // Get motion limit from software endstops, if any @@ -945,8 +948,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[imgBtn39Rounded].width; - uint16_t height = Images[imgBtn39Rounded].height; + const uint16_t width = Images[imgBtn39Rounded].width, + height = Images[imgBtn39Rounded].height; if (!enabled) bgColor = COLOR_CONTROL_DISABLED; @@ -979,23 +982,26 @@ void MarlinUI::move_axis_screen() { const bool busy = printingIsActive(); // Babysteps during printing? Select babystep for Z probe offset - if (busy && ENABLED(BABYSTEP_ZPROBE_OFFSET)) - motionAxisState.z_selection = Z_SELECTION_Z_PROBE; + #if ENABLED(BABYSTEP_ZPROBE_OFFSET) + if (busy) motionAxisState.z_selection = Z_SELECTION_Z_PROBE; + #endif #if ENABLED(TFT_COLOR_UI_PORTRAIT) // ROW 1 -> E+ Y+ Z+ int x = X_MARGIN, y = Y_MARGIN, spacing = 0; - drawBtn(x, y, "E+", (intptr_t)e_plus, imgUp, E_BTN_COLOR, !busy); + TERN_(HAS_EXTRUDERS, 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); + + TERN_(HAS_Y_AXIS, drawBtn(x, y, "Y+", (intptr_t)y_plus, imgUp, Y_BTN_COLOR, !busy)); x += BTN_WIDTH + spacing; uint16_t zplus_x = x; + #if HAS_Z_AXIS 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 #endif @@ -1004,30 +1010,31 @@ void MarlinUI::move_axis_screen() { x = X_MARGIN; y += BTN_HEIGHT + 2; - motionAxisState.eNamePos.x = x; - motionAxisState.eNamePos.y = y; #if HAS_EXTRUDERS + motionAxisState.eNamePos.set(x, y); drawCurESelection(); TERN_(TOUCH_SCREEN, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select)); #endif - motionAxisState.yValuePos.x = yplus_x; - motionAxisState.yValuePos.y = y; - drawAxisValue(Y_AXIS); + #if HAS_Y_AXIS + motionAxisState.yValuePos.set(yplus_x, y); + drawAxisValue(Y_AXIS); + #endif - motionAxisState.zTypePos.x = zplus_x; - motionAxisState.zTypePos.y = y; - TERN_(HAS_Z_AXIS, drawCurZSelection()); + #if HAS_Z_AXIS + motionAxisState.zTypePos.set(zplus_x, y); + drawCurZSelection(); + #endif // ROW 3 -> X- HOME X+ y += (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3 - 2; x = X_MARGIN; - drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy); - - TERN_(TOUCH_SCREEN, add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy)); - - drawBtn(zplus_x, y, "X+", (intptr_t)x_plus, imgRight, X_BTN_COLOR, !busy); + #if HAS_X_AXIS + drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy); + TERN_(TOUCH_SCREEN, add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy)); + drawBtn(zplus_x, y, "X+", (intptr_t)x_plus, imgRight, X_BTN_COLOR, !busy); + #endif #if ALL(HAS_BED_PROBE, TOUCH_SCREEN) if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (intptr_t)z_select); @@ -1036,9 +1043,10 @@ void MarlinUI::move_axis_screen() { // ROW 4 -> Cur X y += BTN_HEIGHT + 2; - motionAxisState.xValuePos.x = x; - motionAxisState.xValuePos.y = y; - drawAxisValue(X_AXIS); + #if HAS_X_AXIS + motionAxisState.xValuePos.set(x, y); + drawAxisValue(X_AXIS); + #endif // ROW 5 -> E- CurX Y- Z- y += (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3 - 2; @@ -1046,35 +1054,30 @@ void MarlinUI::move_axis_screen() { #if HAS_EXTRUDERS drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy); + motionAxisState.eValuePos.set(x, y + BTN_HEIGHT + 2); + TERN_(HAS_EXTRUDERS, drawAxisValue(E_AXIS)); #endif - // Cur E - motionAxisState.eValuePos.x = x; - motionAxisState.eValuePos.y = y + BTN_HEIGHT + 2; - TERN_(HAS_EXTRUDERS, drawAxisValue(E_AXIS)); - x += BTN_WIDTH + spacing; - drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy); + + TERN_(HAS_Y_AXIS, drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy)); x += BTN_WIDTH + spacing; + #if HAS_Z_AXIS 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 + motionAxisState.zValuePos.set(x, y + BTN_HEIGHT + 2); + drawAxisValue(Z_AXIS); #endif - // Cur Z - motionAxisState.zValuePos.x = x; - motionAxisState.zValuePos.y = y + BTN_HEIGHT + 2; - TERN_(HAS_Z_AXIS, drawAxisValue(Z_AXIS)); - // ROW 6 -> step_size disable steppers back - y = TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT; // + 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; + motionAxisState.stepValuePos.set(X_MARGIN + BTN_WIDTH - CUR_STEP_VALUE_WIDTH, y); if (!busy) { - drawCurStepValue(); - TERN_(TOUCH_SCREEN, touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (intptr_t)step_size)); + drawCurStepValue(); + TERN_(TOUCH_SCREEN, touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (intptr_t)step_size)); } // aligned with x+ @@ -1090,15 +1093,18 @@ void MarlinUI::move_axis_screen() { 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 + TERN_(HAS_Y_AXIS, drawBtn(x, y, "Y+", (intptr_t)y_plus, imgUp, Y_BTN_COLOR, !busy)); + x += BTN_WIDTH; - motionAxisState.yValuePos.x = x + 2; - motionAxisState.yValuePos.y = y; - drawAxisValue(Y_AXIS); + + #if HAS_Y_AXIS + motionAxisState.yValuePos.set(x + 2, y); + drawAxisValue(Y_AXIS); + #endif x += spacing; + #if HAS_Z_AXIS 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 #endif @@ -1108,27 +1114,34 @@ void MarlinUI::move_axis_screen() { x = X_MARGIN; spacing = (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4; - motionAxisState.eNamePos.x = x; - motionAxisState.eNamePos.y = y; #if HAS_EXTRUDERS + motionAxisState.eNamePos.set(x, y); drawCurESelection(); TERN_(TOUCH_SCREEN, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select)); #endif x += BTN_WIDTH + spacing; - drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy); + + TERN_(HAS_X_AXIS, drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy)); x += BTN_WIDTH + spacing; //imgHome is 64x64 - TERN_(TOUCH_SCREEN, add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy)); + + #if ALL(HAS_X_AXIS, TOUCH_SCREEN) + add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy); + #endif x += BTN_WIDTH + spacing; uint16_t xplus_x = x; - drawBtn(x, y, "X+", (intptr_t)x_plus, imgRight, X_BTN_COLOR, !busy); + + TERN_(HAS_X_AXIS, 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; - TERN_(HAS_Z_AXIS, drawCurZSelection()); + + #if HAS_Z_AXIS + motionAxisState.zTypePos.set(x, y); + drawCurZSelection(); + #endif + #if ALL(HAS_BED_PROBE, TOUCH_SCREEN) if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (intptr_t)z_select); #endif @@ -1138,39 +1151,39 @@ void MarlinUI::move_axis_screen() { x = X_MARGIN; spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2; - TERN_(HAS_EXTRUDERS, 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; - TERN_(HAS_EXTRUDERS, drawAxisValue(E_AXIS)); + #if HAS_EXTRUDERS + drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy); + motionAxisState.eValuePos.set(x, y + BTN_HEIGHT + 2); + TERN_(HAS_EXTRUDERS, drawAxisValue(E_AXIS)); + #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); + #if HAS_X_AXIS + motionAxisState.xValuePos.set(BTN_WIDTH + (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4, y - 10); + drawAxisValue(X_AXIS); + #endif x += BTN_WIDTH + spacing; - drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy); + + TERN_(HAS_Y_AXIS, drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy)); x += BTN_WIDTH + spacing; + #if HAS_Z_AXIS 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 #endif - // Cur Z - motionAxisState.zValuePos.x = x; - motionAxisState.zValuePos.y = y + BTN_HEIGHT + 2; - TERN_(HAS_Z_AXIS, drawAxisValue(Z_AXIS)); + #if HAS_Z_AXIS + motionAxisState.zValuePos.set(x, y + BTN_HEIGHT + 2); + drawAxisValue(Z_AXIS); + #endif // ROW 4 -> step_size disable steppers back - y = TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT; // + 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; + motionAxisState.stepValuePos.set(yplus_x + BTN_WIDTH - CUR_STEP_VALUE_WIDTH, y); if (!busy) { - drawCurStepValue(); - TERN_(TOUCH_SCREEN, touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (intptr_t)step_size)); + drawCurStepValue(); + TERN_(TOUCH_SCREEN, touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (intptr_t)step_size)); } // aligned with x+ diff --git a/Marlin/src/lcd/tft/ui_480x320.cpp b/Marlin/src/lcd/tft/ui_480x320.cpp index 75ec50adc284d..02a694b08804b 100644 --- a/Marlin/src/lcd/tft/ui_480x320.cpp +++ b/Marlin/src/lcd/tft/ui_480x320.cpp @@ -118,27 +118,26 @@ void MarlinUI::draw_kill_screen() { tft.queue.sync(); } -void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) { +void draw_heater_status(uint16_t x, uint16_t y, const int8_t heater) { MarlinImage image = imgHotEnd; - uint16_t Color; celsius_t currentTemperature, targetTemperature; - if (Heater >= 0) { // HotEnd + if (heater >= 0) { // HotEnd #if HAS_EXTRUDERS - currentTemperature = thermalManager.wholeDegHotend(Heater); - targetTemperature = thermalManager.degTargetHotend(Heater); + currentTemperature = thermalManager.wholeDegHotend(heater); + targetTemperature = thermalManager.degTargetHotend(heater); #else return; #endif } #if HAS_HEATED_BED - else if (Heater == H_BED) { + else if (heater == H_BED) { currentTemperature = thermalManager.wholeDegBed(); targetTemperature = thermalManager.degTargetBed(); } #endif #if HAS_TEMP_CHAMBER - else if (Heater == H_CHAMBER) { + else if (heater == H_CHAMBER) { currentTemperature = thermalManager.wholeDegChamber(); #if HAS_HEATED_CHAMBER targetTemperature = thermalManager.degTargetChamber(); @@ -148,54 +147,54 @@ void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) { } #endif #if HAS_TEMP_COOLER - else if (Heater == H_COOLER) { + else if (heater == H_COOLER) { currentTemperature = thermalManager.wholeDegCooler(); targetTemperature = TERN(HAS_COOLER, thermalManager.degTargetCooler(), ABSOLUTE_ZERO); } #endif else return; - TERN_(TOUCH_SCREEN, if (targetTemperature >= 0) touch.add_control(HEATER, x, y, 80, 120, Heater)); + TERN_(TOUCH_SCREEN, if (targetTemperature >= 0) touch.add_control(HEATER, x, y, 80, 120, heater)); tft.canvas(x, y, 80, 120); tft.set_background(COLOR_BACKGROUND); - Color = currentTemperature < 0 ? COLOR_INACTIVE : COLOR_COLD; + uint16_t color = currentTemperature < 0 ? COLOR_INACTIVE : COLOR_COLD; - if (Heater >= 0) { // HotEnd - if (currentTemperature >= 50) Color = COLOR_HOTEND; + if (heater >= 0) { // HotEnd + if (currentTemperature >= 50) color = COLOR_HOTEND; } #if HAS_HEATED_BED - else if (Heater == H_BED) { - if (currentTemperature >= 50) Color = COLOR_HEATED_BED; + else if (heater == H_BED) { + if (currentTemperature >= 50) color = COLOR_HEATED_BED; image = targetTemperature > 0 ? imgBedHeated : imgBed; } #endif #if HAS_TEMP_CHAMBER - else if (Heater == H_CHAMBER) { - if (currentTemperature >= 50) Color = COLOR_CHAMBER; + else if (heater == H_CHAMBER) { + if (currentTemperature >= 50) color = COLOR_CHAMBER; image = targetTemperature > 0 ? imgChamberHeated : imgChamber; } #endif #if HAS_TEMP_COOLER - else if (Heater == H_COOLER) { - if (currentTemperature <= 26) Color = COLOR_COLD; - if (currentTemperature > 26) Color = COLOR_RED; + else if (heater == H_COOLER) { + if (currentTemperature <= 26) color = COLOR_COLD; + if (currentTemperature > 26) color = COLOR_RED; image = targetTemperature > 26 ? imgCoolerHot : imgCooler; } #endif - tft.add_image(8, 28, image, Color); + tft.add_image(8, 28, image, color); tft_string.set(i16tostr3rj(currentTemperature)); tft_string.add(LCD_STR_DEGREE); tft_string.trim(); - tft.add_text(tft_string.center(80) + 2, 80 + tft_string.vcenter(FONT_LINE_HEIGHT), Color, tft_string); + tft.add_text(tft_string.center(80) + 2, 80 + 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(80) + 2, 6 + tft_string.vcenter(FONT_LINE_HEIGHT) , Color, tft_string); + tft.add_text(tft_string.center(80) + 2, 6 + tft_string.vcenter(FONT_LINE_HEIGHT), color, tft_string); } } @@ -265,7 +264,7 @@ void MarlinUI::draw_status_screen() { if (TERN0(LCD_SHOW_E_TOTAL, printingIsActive())) { #if ENABLED(LCD_SHOW_E_TOTAL) - tft.add_text( 16, tft_string.vcenter(FONT_LINE_HEIGHT), COLOR_AXIS_HOMED , "E"); + tft.add_text( 16, 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'); @@ -322,7 +321,7 @@ void MarlinUI::draw_status_screen() { tft.canvas(x, y, component_width, 32); tft.set_background(COLOR_BACKGROUND); tft.add_image(0, 0, imgFeedRate, color); - tft.add_text(36, tft_string.vcenter(30), color , tft_string); + tft.add_text(36, tft_string.vcenter(30), color, tft_string); TERN_(TOUCH_SCREEN, touch.add_control(FEEDRATE, x, y, component_width, 32)); #if HAS_EXTRUDERS @@ -337,7 +336,7 @@ void MarlinUI::draw_status_screen() { tft.canvas(x, y, component_width, 32); tft.set_background(COLOR_BACKGROUND); tft.add_image(0, 0, imgFlowRate, color); - tft.add_text(36, tft_string.vcenter(30), color , tft_string); + tft.add_text(36, tft_string.vcenter(30), color, tft_string); TERN_(TOUCH_SCREEN, touch.add_control(FLOWRATE, x, y, component_width, 32, active_extruder)); #endif @@ -495,7 +494,7 @@ void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, con #if ENABLED(TOUCH_SCREEN) touch.clear(); draw_menu_navigation = false; - touch.add_control(RESUME_CONTINUE , 0, 0, TFT_WIDTH, TFT_HEIGHT); + touch.add_control(RESUME_CONTINUE, 0, 0, TFT_WIDTH, TFT_HEIGHT); #endif menu_line(row); @@ -623,6 +622,7 @@ struct { #define BTN_HEIGHT 52 #define X_MARGIN 20 #define Y_MARGIN 15 +#define Y_OFFSET TERN(HAS_UI_480x272, 28, 34) static void quick_feedback() { #if HAS_CHIRP @@ -638,24 +638,29 @@ static void quick_feedback() { #define CUR_STEP_VALUE_WIDTH 104 static void drawCurStepValue() { tft_string.set(ftostr52sp(motionAxisState.currentStepSize)); + tft_string.trim(); tft_string.add(F("mm")); tft.canvas(motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT); tft.set_background(COLOR_BACKGROUND); - tft.add_text(tft_string.center(CUR_STEP_VALUE_WIDTH), 0, COLOR_AXIS_HOMED, tft_string); + tft.add_text(0, 0, COLOR_AXIS_HOMED, tft_string); } #if HAS_Z_AXIS static void drawCurZSelection() { tft_string.set('Z'); - tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y, tft_string.width(), 34); + tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y, tft_string.width(), FONT_LINE_HEIGHT); tft.set_background(COLOR_BACKGROUND); tft.add_text(0, 0, Z_BTN_COLOR, tft_string); + tft.queue.sync(); + tft_string.set(F("Offset")); - tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y + 34, tft_string.width(), 34); + tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y + Y_OFFSET, tft_string.width(), Y_OFFSET TERN_(HAS_UI_480x272, - 10)); tft.set_background(COLOR_BACKGROUND); - if (motionAxisState.z_selection == Z_SELECTION_Z_PROBE) - tft.add_text(0, 0, Z_BTN_COLOR, tft_string); + #if HAS_BED_PROBE + if (motionAxisState.z_selection == Z_SELECTION_Z_PROBE) + tft.add_text(0, 0, Z_BTN_COLOR, tft_string); + #endif } #endif @@ -664,13 +669,17 @@ static void drawCurStepValue() { tft.canvas(motionAxisState.eNamePos.x, motionAxisState.eNamePos.y, BTN_WIDTH, BTN_HEIGHT); tft.set_background(COLOR_BACKGROUND); tft_string.set('E'); - tft.add_text(0, 0, E_BTN_COLOR , tft_string); - tft.add_text(tft_string.width(), 0, E_BTN_COLOR, ui8tostr3rj(motionAxisState.e_selection)); + tft_string.add(utostr3(motionAxisState.e_selection)); + tft.add_text(tft_string.center(BTN_WIDTH), 0, E_BTN_COLOR, tft_string); } #endif static void drawMessage(PGM_P const msg) { - tft.canvas(X_MARGIN, TFT_HEIGHT - Y_MARGIN - 34, TFT_HEIGHT / 2, 34); + #if ENABLED(TFT_COLOR_UI_PORTRAIT) + tft.canvas(X_MARGIN, TFT_HEIGHT - 2 * MOVE_AXIS_MARGIN_SIZE - BTN_HEIGHT - FONT_LINE_HEIGHT, TFT_WIDTH - X_MARGIN * 2, FONT_LINE_HEIGHT); + #else + tft.canvas(X_MARGIN, TFT_HEIGHT - Y_MARGIN - Y_OFFSET, TFT_HEIGHT / 2, Y_OFFSET); + #endif tft.set_background(COLOR_BACKGROUND); tft.add_text(0, 0, COLOR_YELLOW, msg); } @@ -699,10 +708,11 @@ static void drawAxisValue(const AxisEnum axis) { #endif default: return; } - tft.canvas(pos.x, pos.y, BTN_WIDTH + X_MARGIN, BTN_HEIGHT); + tft.canvas(pos.x, pos.y, BTN_WIDTH + X_MARGIN, BTN_HEIGHT TERN_(HAS_UI_480x272, / 2)); tft.set_background(COLOR_BACKGROUND); tft_string.set(ftostr52sp(value)); - tft.add_text(0, 0, color, tft_string); + tft_string.trim(); + tft.add_text(tft_string.center(BTN_WIDTH + X_MARGIN), 0, color, tft_string); } static void moveAxis(const AxisEnum axis, const int8_t direction) { @@ -717,7 +727,8 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { const float diff = motionAxisState.currentStepSize * direction; - #if HAS_Z_AXIS + #if HAS_BED_PROBE + if (axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE) { #if ENABLED(BABYSTEP_ZPROBE_OFFSET) const int16_t babystep_increment = direction * BABYSTEP_SIZE_Z; @@ -737,10 +748,10 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) { drawMessage(NUL_STR); // clear the error drawAxisValue(axis); } - else { + else drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS)); - } - #elif HAS_BED_PROBE + + #else // only change probe.offset.z probe.offset.z += diff; if (direction < 0 && current_position[axis] < Z_PROBE_OFFSET_RANGE_MIN) { @@ -751,14 +762,15 @@ 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 { + else drawMessage(NUL_STR); // clear the error - } + drawAxisValue(axis); #endif return; } - #endif // HAS_Z_AXIS + + #endif // HAS_BED_PROBE if (!ui.manual_move.processing) { // Get motion limit from software endstops, if any @@ -852,8 +864,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, - height = Images[imgBtn52Rounded].height; + const uint16_t width = Images[imgBtn52Rounded].width, + height = Images[imgBtn52Rounded].height; if (!enabled) bgColor = COLOR_CONTROL_DISABLED; @@ -887,107 +899,232 @@ void MarlinUI::move_axis_screen() { const bool busy = printingIsActive(); // Babysteps during printing? Select babystep for Z probe offset - if (busy && ENABLED(BABYSTEP_ZPROBE_OFFSET)) + #if ENABLED(BABYSTEP_ZPROBE_OFFSET) + if (busy) motionAxisState.z_selection = Z_SELECTION_Z_PROBE; + #endif - TERN_(HAS_Z_AXIS, motionAxisState.z_selection = Z_SELECTION_Z_PROBE); + #if ENABLED(TFT_COLOR_UI_PORTRAIT) - // ROW 1 -> E- Y- CurY Z+ - int x = X_MARGIN, y = Y_MARGIN, spacing = 0; + int y = MOVE_AXIS_MARGIN_SIZE; - TERN_(HAS_EXTRUDERS, drawBtn(x, y, "E+", (intptr_t)e_plus, imgUp, E_BTN_COLOR, !busy)); + /************************************************************************** + * 1st: | Button "E+" | Button "Y+" | Button "Z+" | + *************************************************************************/ - spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2; - x += BTN_WIDTH + spacing; + TERN_(HAS_EXTRUDERS, drawBtn(TFT_WIDTH / 6 - BTN_WIDTH / 2, y, "E+", (intptr_t)e_plus, imgUp, E_BTN_COLOR, !busy)); + TERN_(HAS_Y_AXIS, drawBtn(TFT_WIDTH / 2 - BTN_WIDTH / 2, y, "Y+", (intptr_t)y_plus, imgUp, Y_BTN_COLOR, !busy)); + TERN_(HAS_Z_AXIS, drawBtn(TFT_WIDTH * 5 / 6 - BTN_WIDTH / 2, y, "Z+", (intptr_t)z_plus, imgUp, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET))); - TERN_(HAS_Y_AXIS, drawBtn(x, y, "Y+", (intptr_t)y_plus, imgUp, Y_BTN_COLOR, !busy)); + y += BTN_HEIGHT + 4; - // Cur Y - x += BTN_WIDTH; - #if HAS_Y_AXIS - motionAxisState.yValuePos.x = x + 2; - motionAxisState.yValuePos.y = y; - drawAxisValue(Y_AXIS); - #endif + /************************************************************************** + * 2nd: | Label "Ex" (E0, E1, etc.) | Y value | Label "Z" | + *************************************************************************/ - x += spacing; - #if HAS_Z_AXIS - 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 - #endif + // Label "Ex" (E0, E1, etc.) + #if HAS_EXTRUDERS + motionAxisState.eNamePos.set(TFT_WIDTH / 6 - BTN_WIDTH / 2, y); + drawCurESelection(); + #if ENABLED(TOUCH_SCREEN) + if (!busy) touch.add_control(BUTTON, motionAxisState.eNamePos.x, motionAxisState.eNamePos.y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select); + #endif + #endif + + // Y value + #if HAS_Y_AXIS + motionAxisState.yValuePos.set(TFT_WIDTH / 2 - (BTN_WIDTH + X_MARGIN) / 2, y); + drawAxisValue(Y_AXIS); + #endif - // 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; + // Label "Z" + #ifdef HAS_Z_AXIS + motionAxisState.zTypePos.set(TFT_WIDTH * 5 / 6 - BTN_WIDTH / 2, y); + drawCurZSelection(); + #if ALL(HAS_BED_PROBE, TOUCH_SCREEN) + if (!busy) touch.add_control(BUTTON, motionAxisState.zTypePos.x, motionAxisState.zTypePos.y, BTN_WIDTH, FONT_LINE_HEIGHT * 2, (intptr_t)z_select); + #endif + #endif - motionAxisState.eNamePos.x = x; - motionAxisState.eNamePos.y = y; - #if HAS_EXTRUDERS - drawCurESelection(); - TERN_(TOUCH_SCREEN, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select)); - #endif + y += BTN_HEIGHT + MOVE_AXIS_MARGIN_SIZE; - x += BTN_WIDTH + spacing; - drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy); + /************************************************************************** + * 3rd: | Button "X-" | Button "Homing" | Button "X+" | + *************************************************************************/ - x += BTN_WIDTH + spacing; //imgHome is 64x64 - TERN_(TOUCH_SCREEN, add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy)); + #if HAS_X_AXIS + drawBtn(TFT_WIDTH / 6 - BTN_WIDTH / 2, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy); + TERN_(TOUCH_SCREEN, add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy)); + drawBtn(TFT_WIDTH * 5 / 6 - BTN_WIDTH / 2, y, "X+", (intptr_t)x_plus, imgRight, X_BTN_COLOR, !busy); + #endif + y += BTN_HEIGHT + 4; - x += BTN_WIDTH + spacing; - uint16_t xplus_x = x; - drawBtn(x, y, "X+", (intptr_t)x_plus, imgRight, X_BTN_COLOR, !busy); + /************************************************************************** + * 4th: | X value | + *************************************************************************/ - x += BTN_WIDTH + spacing; - motionAxisState.zTypePos.x = x; - motionAxisState.zTypePos.y = y; - TERN_(HAS_Z_AXIS, drawCurZSelection()); - #if ALL(HAS_BED_PROBE, TOUCH_SCREEN) - if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (intptr_t)z_select); - #endif + #ifdef HAS_X_AXIS + motionAxisState.xValuePos.set(TFT_WIDTH / 6 - (BTN_WIDTH + X_MARGIN) / 2, y); + drawAxisValue(X_AXIS); + #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; + y += BTN_HEIGHT + MOVE_AXIS_MARGIN_SIZE; - TERN_(HAS_EXTRUDERS, drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy)); + /************************************************************************** + * 5th: | Button "E-" | Button "Y-" | Button "Z-" + *************************************************************************/ - // Cur E - motionAxisState.eValuePos.x = x; - motionAxisState.eValuePos.y = y + BTN_HEIGHT + 2; - TERN_(HAS_EXTRUDERS, drawAxisValue(E_AXIS)); + TERN_(HAS_EXTRUDERS, drawBtn(TFT_WIDTH / 6 - BTN_WIDTH / 2, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy)); + TERN_(HAS_Y_AXIS, drawBtn(TFT_WIDTH / 2 - BTN_WIDTH / 2, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy)); + TERN_(HAS_Z_AXIS, drawBtn(TFT_WIDTH * 5 / 6 - BTN_WIDTH / 2, y, "Z-", (intptr_t)z_minus, imgDown, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET))); - // Cur X - motionAxisState.xValuePos.x = BTN_WIDTH + (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4; //X- pos - motionAxisState.xValuePos.y = y - 10; - TERN_(HAS_X_AXIS, drawAxisValue(X_AXIS)); + y += BTN_HEIGHT + 4; - x += BTN_WIDTH + spacing; - drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy); + /************************************************************************** + * 6th: | Current Ex value | Z value | + *************************************************************************/ - x += BTN_WIDTH + spacing; - #if HAS_Z_AXIS - 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 - #endif + // Current Ex value + #ifdef HAS_EXTRUDERS + motionAxisState.eValuePos.set(TFT_WIDTH / 6 - (BTN_WIDTH + X_MARGIN) / 2, y); + drawAxisValue(E_AXIS); + #endif - // Cur Z - motionAxisState.zValuePos.x = x; - motionAxisState.zValuePos.y = y + BTN_HEIGHT + 2; - TERN_(HAS_Z_AXIS, drawAxisValue(Z_AXIS)); - - // ROW 4 -> step_size disable steppers back - y = TFT_HEIGHT - Y_MARGIN - 32; - x = TFT_WIDTH / 2 - CUR_STEP_VALUE_WIDTH / 2; - motionAxisState.stepValuePos.x = x; - motionAxisState.stepValuePos.y = y; - if (!busy) { - drawCurStepValue(); - TERN_(TOUCH_SCREEN, touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (intptr_t)step_size)); - } + #ifdef HAS_Z_AXIS + motionAxisState.zValuePos.set(TFT_WIDTH * 5 / 6 - (BTN_WIDTH + X_MARGIN) / 2, y); + drawAxisValue(Z_AXIS); + #endif + + y += BTN_HEIGHT + MOVE_AXIS_MARGIN_SIZE; + + /************************************************************************** + * 7th: | Message - drawMessage(...) function | + *************************************************************************/ + + y += FONT_LINE_HEIGHT + MOVE_AXIS_MARGIN_SIZE; + + /************************************************************************** + * 8th: | Step size | Button "Disable steppers" | Button "Back" | + *************************************************************************/ + + // Step size + motionAxisState.stepValuePos.set(X_MARGIN, y + 12); + if (!busy) { + drawCurStepValue(); + TERN_(TOUCH_SCREEN, touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y + 12, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (intptr_t)step_size)); + } + + // Button "Disable steppers" + drawBtn(TFT_WIDTH / 2, y, "off", (intptr_t)disable_steppers, imgCancel, COLOR_WHITE, !busy); + + // Button "Back" + TERN_(TOUCH_SCREEN, add_control(TFT_WIDTH * 5 / 6 - Images[imgBack].width / 2, y + 12, BACK, imgBack)); + + #else // !TFT_COLOR_UI_PORTRAIT + + // ROW 1 -> E- Y- CurY Z+ + int x = X_MARGIN, y = Y_MARGIN, spacing = 0; + + TERN_(HAS_EXTRUDERS, 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; + + TERN_(HAS_Y_AXIS, drawBtn(x, y, "Y+", (intptr_t)y_plus, imgUp, Y_BTN_COLOR, !busy)); + + x += BTN_WIDTH; + + // Cur Y + #if HAS_Y_AXIS + motionAxisState.yValuePos.set(x + 2, y); + drawAxisValue(Y_AXIS); + #endif + + x += spacing; + #if HAS_Z_AXIS + 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 + #endif + + // 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; + + #if HAS_EXTRUDERS + motionAxisState.eNamePos.set(x, y); + drawCurESelection(); + TERN_(TOUCH_SCREEN, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select)); + #endif + + x += BTN_WIDTH + spacing; + + TERN_(HAS_X_AXIS, drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy)); + + x += BTN_WIDTH + spacing; //imgHome is 64x64 + + #if ALL(HAS_X_AXIS, TOUCH_SCREEN) + add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy); + #endif + + x += BTN_WIDTH + spacing; + uint16_t xplus_x = x; + + TERN_(HAS_X_AXIS, drawBtn(x, y, "X+", (intptr_t)x_plus, imgRight, X_BTN_COLOR, !busy)); + + x += BTN_WIDTH + spacing; + + #if HAS_Z_AXIS + motionAxisState.zTypePos.set(x, y); + drawCurZSelection(); + #if ALL(HAS_BED_PROBE, TOUCH_SCREEN) + if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, Y_OFFSET * 2, (intptr_t)z_select); + #endif + #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; + + #if HAS_EXTRUDERS + drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy); + motionAxisState.eValuePos.set(x, y + BTN_HEIGHT + 2); + drawAxisValue(E_AXIS); + #endif + + #if HAS_X_AXIS + motionAxisState.xValuePos.set(BTN_WIDTH + (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4, y - 10); + TERN_(HAS_X_AXIS, drawAxisValue(X_AXIS)); + #endif + + x += BTN_WIDTH + spacing; + TERN_(HAS_Y_AXIS, drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy)); + + x += BTN_WIDTH + spacing; + #if HAS_Z_AXIS + 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 + #endif + + // Cur Z + #if HAS_Z_AXIS + motionAxisState.zValuePos.set(x, y + BTN_HEIGHT + 2); + drawAxisValue(Z_AXIS); + #endif + + // ROW 4 -> step_size disable steppers back + y = TFT_HEIGHT - Y_MARGIN - TERN(HAS_UI_480x272, BTN_WIDTH / 2, 32); + x = TFT_WIDTH / 2 - CUR_STEP_VALUE_WIDTH / 2; + motionAxisState.stepValuePos.set(x, y); + if (!busy) { + drawCurStepValue(); + TERN_(TOUCH_SCREEN, 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, TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT, "off", (intptr_t)disable_steppers, imgCancel, COLOR_WHITE, !busy); - // aligned with x+ - drawBtn(xplus_x, TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT, "off", (intptr_t)disable_steppers, imgCancel, COLOR_WHITE, !busy); + TERN_(TOUCH_SCREEN, add_control(TFT_WIDTH - X_MARGIN - BTN_WIDTH, y, BACK, imgBack)); - TERN_(TOUCH_SCREEN, add_control(TFT_WIDTH - X_MARGIN - BTN_WIDTH, y, BACK, imgBack)); + #endif // !TFT_COLOR_UI_PORTRAIT } -#endif // HAS_UI_480x320 +#endif // HAS_UI_480x320 || HAS_UI_480x272 diff --git a/Marlin/src/lcd/tft/ui_480x320.h b/Marlin/src/lcd/tft/ui_480x320.h index 00341650c123b..d3036d098106f 100644 --- a/Marlin/src/lcd/tft/ui_480x320.h +++ b/Marlin/src/lcd/tft/ui_480x320.h @@ -103,10 +103,14 @@ * - Rows count: 6 * - Margins count: 7 */ -#ifdef TFT_COLOR_UI_PORTRAIT +#if ENABLED(TFT_COLOR_UI_PORTRAIT) #if ENABLED(TOUCH_SCREEN) #define STATUS_TOTAL_ROWS_HEIGHT (2 * FONT_LINE_HEIGHT + 120 + 32 + 64 + 29 + 7) #define STATUS_MARGINS_REGIONS 8 + + #define MOVE_AXIS_TOTAL_ROWS_HEIGHT (7 * BTN_HEIGHT + FONT_LINE_HEIGHT + 12) + #define MOVE_AXIS_MARGIN_REGIONS 6 + #define MOVE_AXIS_MARGIN_SIZE ((TFT_HEIGHT - MOVE_AXIS_TOTAL_ROWS_HEIGHT) / MOVE_AXIS_MARGIN_REGIONS) #else #define STATUS_TOTAL_ROWS_HEIGHT (2 * FONT_LINE_HEIGHT + 120 + 32 + 29 + 7) #define STATUS_MARGINS_REGIONS 7 diff --git a/Marlin/src/lcd/tft_io/tft_io.cpp b/Marlin/src/lcd/tft_io/tft_io.cpp index 294c146d5cb93..d46c2de418fb8 100644 --- a/Marlin/src/lcd/tft_io/tft_io.cpp +++ b/Marlin/src/lcd/tft_io/tft_io.cpp @@ -59,7 +59,7 @@ TFT_IO_DRIVER TFT_IO::io; uint32_t TFT_IO::lcd_id = 0xFFFFFFFF; -void TFT_IO::InitTFT() { +void TFT_IO::initTFT() { if (lcd_id != 0xFFFFFFFF) return; #if PIN_EXISTS(TFT_BACKLIGHT) @@ -81,7 +81,7 @@ void TFT_IO::InitTFT() { #endif #endif - // io.Init(); + //io.init(); delay(100); #if TFT_DRIVER != AUTO @@ -106,7 +106,7 @@ void TFT_IO::InitTFT() { write_esc_sequence(ili9488_init); #elif TFT_DRIVER == AUTO // autodetect - lcd_id = io.GetID() & 0xFFFF; + lcd_id = io.getID() & 0xFFFF; switch (lcd_id) { case LTDC_RGB: @@ -156,25 +156,25 @@ void TFT_IO::InitTFT() { #endif } -void TFT_IO::set_window(uint16_t Xmin, uint16_t Ymin, uint16_t Xmax, uint16_t Ymax) { +void TFT_IO::set_window(uint16_t xMin, uint16_t yMin, uint16_t xMax, uint16_t yMax) { #ifdef OFFSET_X - Xmin += OFFSET_X; Xmax += OFFSET_X; + xMin += OFFSET_X; xMax += OFFSET_X; #endif #ifdef OFFSET_Y - Ymin += OFFSET_Y; Ymax += OFFSET_Y; + yMin += OFFSET_Y; yMax += OFFSET_Y; #endif switch (lcd_id) { case LTDC_RGB: - io.WriteReg(0x01); - io.WriteData(Xmin); - io.WriteReg(0x02); - io.WriteData(Xmax); - io.WriteReg(0x03); - io.WriteData(Ymin); - io.WriteReg(0x04); - io.WriteData(Ymax); - io.WriteReg(0x00); + io.writeReg(0x01); + io.writeData(xMin); + io.writeReg(0x02); + io.writeData(xMax); + io.writeReg(0x03); + io.writeData(yMin); + io.writeReg(0x04); + io.writeData(yMax); + io.writeReg(0x00); break; case ST7735: // ST7735 160x128 case ST7789: // ST7789V 320x240 @@ -183,76 +183,76 @@ void TFT_IO::set_window(uint16_t Xmin, uint16_t Ymin, uint16_t Xmax, uint16_t Ym case ILI9488: // ILI9488 480x320 case SSD1963: // SSD1963 case ILI9488_ID1: // 0x8066 ILI9488 480x320 - io.DataTransferBegin(DATASIZE_8BIT); + io.dataTransferBegin(DATASIZE_8BIT); // CASET: Column Address Set - io.WriteReg(ILI9341_CASET); - io.WriteData((Xmin >> 8) & 0xFF); - io.WriteData(Xmin & 0xFF); - io.WriteData((Xmax >> 8) & 0xFF); - io.WriteData(Xmax & 0xFF); + io.writeReg(ILI9341_CASET); + io.writeData((xMin >> 8) & 0xFF); + io.writeData(xMin & 0xFF); + io.writeData((xMax >> 8) & 0xFF); + io.writeData(xMax & 0xFF); // RASET: Row Address Set - io.WriteReg(ILI9341_PASET); - io.WriteData((Ymin >> 8) & 0xFF); - io.WriteData(Ymin & 0xFF); - io.WriteData((Ymax >> 8) & 0xFF); - io.WriteData(Ymax & 0xFF); + io.writeReg(ILI9341_PASET); + io.writeData((yMin >> 8) & 0xFF); + io.writeData(yMin & 0xFF); + io.writeData((yMax >> 8) & 0xFF); + io.writeData(yMax & 0xFF); // RAMWR: Memory Write - io.WriteReg(ILI9341_RAMWR); + io.writeReg(ILI9341_RAMWR); break; case R61505: // R61505U 320x240 case ILI9328: // ILI9328 320x240 - io.DataTransferBegin(DATASIZE_16BIT); + io.dataTransferBegin(DATASIZE_16BIT); // Mind the mess: with landscape screen orientation 'Horizontal' is Y and 'Vertical' is X - io.WriteReg(ILI9328_HASTART); - io.WriteData(Ymin); - io.WriteReg(ILI9328_HAEND); - io.WriteData(Ymax); - io.WriteReg(ILI9328_VASTART); - io.WriteData(Xmin); - io.WriteReg(ILI9328_VAEND); - io.WriteData(Xmax); - - io.WriteReg(ILI9328_HASET); - io.WriteData(Ymin); - io.WriteReg(ILI9328_VASET); - io.WriteData(Xmin); - - io.WriteReg(ILI9328_RAMWR); + io.writeReg(ILI9328_HASTART); + io.writeData(yMin); + io.writeReg(ILI9328_HAEND); + io.writeData(yMax); + io.writeReg(ILI9328_VASTART); + io.writeData(xMin); + io.writeReg(ILI9328_VAEND); + io.writeData(xMax); + + io.writeReg(ILI9328_HASET); + io.writeData(yMin); + io.writeReg(ILI9328_VASET); + io.writeData(xMin); + + io.writeReg(ILI9328_RAMWR); break; default: break; } - io.DataTransferEnd(); + io.dataTransferEnd(); } -void TFT_IO::write_esc_sequence(const uint16_t *Sequence) { +void TFT_IO::write_esc_sequence(const uint16_t *sequence) { uint16_t dataWidth, data; - dataWidth = *Sequence++; - io.DataTransferBegin(dataWidth); + dataWidth = *sequence++; + io.dataTransferBegin(dataWidth); for (;;) { - data = *Sequence++; + data = *sequence++; if (data != 0xFFFF) { - io.WriteData(data); + io.writeData(data); continue; } - data = *Sequence++; + data = *sequence++; if (data == 0x7FFF) break; if (data == 0xFFFF) - io.WriteData(0xFFFF); + io.writeData(0xFFFF); else if (data & 0x8000) delay(data & 0x7FFF); else if ((data & 0xFF00) == 0) - io.WriteReg(data); + io.writeReg(data); } - io.DataTransferEnd(); + io.dataTransferEnd(); } #endif // HAS_SPI_TFT || HAS_FSMC_TFT || HAS_LTDC_TFT diff --git a/Marlin/src/lcd/tft_io/tft_io.h b/Marlin/src/lcd/tft_io/tft_io.h index 673bb07d5f9a4..cbe554436e961 100644 --- a/Marlin/src/lcd/tft_io/tft_io.h +++ b/Marlin/src/lcd/tft_io/tft_io.h @@ -50,36 +50,36 @@ class TFT_IO { public: static TFT_IO_DRIVER io; - static void InitTFT(); - static void set_window(uint16_t Xmin, uint16_t Ymin, uint16_t Xmax, uint16_t Ymax); - static void write_esc_sequence(const uint16_t *Sequence); + static void initTFT(); + static void set_window(uint16_t xMin, uint16_t yMin, uint16_t xMax, uint16_t yMax); + static void write_esc_sequence(const uint16_t *sequence); // Deletaged methods - inline static void Init() { io.Init(); } + inline static void init() { io.init(); } inline static bool isBusy() { return io.isBusy(); } - inline static void Abort() { io.Abort(); } - inline static uint32_t GetID() { return io.GetID(); } + inline static void abort() { io.abort(); } + inline static uint32_t getID() { return io.getID(); } - inline static void DataTransferBegin(uint16_t DataWidth=DATASIZE_16BIT) { io.DataTransferBegin(DataWidth); } - inline static void DataTransferEnd() { io.DataTransferEnd(); } + inline static void dataTransferBegin(uint16_t dataWidth=DATASIZE_16BIT) { io.dataTransferBegin(dataWidth); } + inline static void dataTransferEnd() { io.dataTransferEnd(); } - inline static void WriteData(uint16_t Data) { io.WriteData(Data); } - inline static void WriteReg(uint16_t Reg) { io.WriteReg(Reg); } + inline static void writeData(uint16_t data) { io.writeData(data); } + inline static void writeReg(uint16_t reg) { io.writeReg(reg); } // Blocking IO used by TFT_CLASSIC_UI and TFT_LVGL_UI // These functions start data transfer and WAIT for data transfer completion - inline static void WriteSequence(uint16_t *Data, uint16_t Count) { io.WriteSequence(Data, Count); } - inline static void WriteMultiple(uint16_t Color, uint32_t Count) { io.WriteMultiple(Color, Count); } + inline static void writeSequence(uint16_t *data, uint16_t count) { io.writeSequence(data, count); } + inline static void writeMultiple(uint16_t color, uint32_t count) { io.writeMultiple(color, count); } // Non-blocking DMA-based IO used by TFT_COLOR_UI only // These functions start data transfer using DMA and do NOT wait for data transfer completion - inline static void WriteSequenceDMA(uint16_t *Data, uint16_t Count) { io.WriteSequence_DMA(Data, Count); } - inline static void WriteMultipleDMA(uint16_t Color, uint16_t Count) { io.WriteMultiple_DMA(Color, Count); } + inline static void writeSequenceDMA(uint16_t *data, uint16_t count) { io.writeSequence_DMA(data, count); } + inline static void WriteMultipleDMA(uint16_t color, uint16_t count) { io.writeMultiple_DMA(color, count); } // Non-blocking DMA-based IO with IRQ callback used by TFT_LVGL_UI only // This function starts data transfer using DMA and does NOT wait for data transfer completion #if ENABLED(USE_SPI_DMA_TC) - inline static void WriteSequenceIT(uint16_t *Data, uint16_t Count) { io.WriteSequenceIT(Data, Count); } + inline static void writeSequenceIT(uint16_t *data, uint16_t count) { io.writeSequenceIT(data, count); } #endif protected: diff --git a/Marlin/src/lcd/touch/touch_buttons.cpp b/Marlin/src/lcd/touch/touch_buttons.cpp index 2e996f30ce5f0..856594c31a280 100644 --- a/Marlin/src/lcd/touch/touch_buttons.cpp +++ b/Marlin/src/lcd/touch/touch_buttons.cpp @@ -60,7 +60,7 @@ TouchButtons touchBt; void TouchButtons::init() { - touchIO.Init(); + touchIO.init(); TERN_(HAS_TOUCH_SLEEP, next_sleep_ms = millis() + SEC_TO_MS(ui.sleep_timeout_minutes * 60)); } diff --git a/Marlin/src/lcd/utf8.cpp b/Marlin/src/lcd/utf8.cpp index 075f8b0c7c934..6957fffc64575 100644 --- a/Marlin/src/lcd/utf8.cpp +++ b/Marlin/src/lcd/utf8.cpp @@ -177,13 +177,8 @@ static inline uint8_t utf8_strlen_cb(const char *pstart, read_byte_cb_t cb_read_ return cnt; } -uint8_t utf8_strlen(const char *pstart) { - return utf8_strlen_cb(pstart, read_byte_ram); -} - -uint8_t utf8_strlen_P(PGM_P pstart) { - return utf8_strlen_cb(pstart, read_byte_rom); -} +uint8_t utf8_strlen(const char *pstart) { return utf8_strlen_cb(pstart, read_byte_ram); } +uint8_t utf8_strlen_P(PGM_P pstart) { return utf8_strlen_cb(pstart, read_byte_rom); } static inline uint8_t utf8_byte_pos_by_char_num_cb(const char *pstart, read_byte_cb_t cb_read_byte, const uint8_t charnum) { uint8_t *p = (uint8_t *)pstart; diff --git a/Marlin/src/libs/vector_3.cpp b/Marlin/src/libs/vector_3.cpp index a222b5cc2e7e1..ab04c7f32dd16 100644 --- a/Marlin/src/libs/vector_3.cpp +++ b/Marlin/src/libs/vector_3.cpp @@ -76,10 +76,11 @@ void vector_3::apply_rotation(const matrix_3x3 &matrix) { } void vector_3::debug(FSTR_P const title) { - SERIAL_ECHOF(title); - SERIAL_ECHOPAIR_F_P(SP_X_STR, x, 6); - SERIAL_ECHOPAIR_F_P(SP_Y_STR, y, 6); - SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, z, 6); + SERIAL_ECHOLN(title, + FPSTR(SP_X_STR), p_float_t(x, 6), + FPSTR(SP_Y_STR), p_float_t(y, 6), + FPSTR(SP_Z_STR), p_float_t(z, 6) + ); } /** @@ -138,7 +139,9 @@ matrix_3x3 matrix_3x3::transpose(const matrix_3x3 &original) { } void matrix_3x3::debug(FSTR_P const title) { - if (title) SERIAL_ECHOLNF(title); + + if (title) SERIAL_ECHOLN(title); + for (uint8_t i = 0; i < 3; ++i) { for (uint8_t j = 0; j < 3; ++j) { serial_offset(vectors[i][j], 2); diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index 3031e7d694897..63689bf7ca035 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -375,9 +375,8 @@ void Endstops::event_handler() { #endif static void print_es_state(const bool is_hit, FSTR_P const flabel=nullptr) { - if (flabel) SERIAL_ECHOF(flabel); - SERIAL_ECHOPGM(": "); - SERIAL_ECHOLNF(is_hit ? F(STR_ENDSTOP_HIT) : F(STR_ENDSTOP_OPEN)); + if (flabel) SERIAL_ECHO(flabel); + SERIAL_ECHOLN(F(": "), is_hit ? F(STR_ENDSTOP_HIT) : F(STR_ENDSTOP_OPEN)); } #pragma GCC diagnostic pop diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 0bece02c15a84..204617ba83944 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -359,7 +359,7 @@ FORCE_INLINE void probe_specific_action(const bool deploy) { FSTR_P const ds_str = deploy ? GET_TEXT_F(MSG_MANUAL_DEPLOY) : GET_TEXT_F(MSG_MANUAL_STOW); ui.return_to_status(); // To display the new status message ui.set_status(ds_str, 99); - SERIAL_ECHOLNF(deploy ? GET_EN_TEXT_F(MSG_MANUAL_DEPLOY) : GET_EN_TEXT_F(MSG_MANUAL_STOW)); + SERIAL_ECHOLN(deploy ? GET_EN_TEXT_F(MSG_MANUAL_DEPLOY) : GET_EN_TEXT_F(MSG_MANUAL_STOW)); OKAY_BUZZ(); diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 1defac29771d8..1ee3932c2db7e 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -1607,8 +1607,8 @@ void MarlinSettings::postprocess() { #if ENABLED(DWIN_CREALITY_LCD_JYERSUI) { _FIELD_TEST(dwin_settings); - char dwin_settings[CrealityDWIN.eeprom_data_size] = { 0 }; - CrealityDWIN.Save_Settings(dwin_settings); + char dwin_settings[crealityDWIN.eeprom_data_size] = { 0 }; + crealityDWIN.saveSettings(dwin_settings); EEPROM_WRITE(dwin_settings); } #endif @@ -2661,10 +2661,10 @@ void MarlinSettings::postprocess() { } #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) { - const char dwin_settings[CrealityDWIN.eeprom_data_size] = { 0 }; + const char dwin_settings[crealityDWIN.eeprom_data_size] = { 0 }; _FIELD_TEST(dwin_settings); EEPROM_READ(dwin_settings); - if (!validating) CrealityDWIN.Load_Settings(dwin_settings); + if (!validating) crealityDWIN.loadSettings(dwin_settings); } #endif @@ -3147,7 +3147,7 @@ void MarlinSettings::reset() { #endif #endif - TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWIN.Reset_Settings()); + TERN_(DWIN_CREALITY_LCD_JYERSUI, crealityDWIN.resetSettings()); // // Case Light Brightness @@ -3595,7 +3595,7 @@ void MarlinSettings::reset() { #if ANY(EEPROM_CHITCHAT, DEBUG_LEVELING_FEATURE) FSTR_P const hdsl = F("Hardcoded Default Settings Loaded"); TERN_(HOST_EEPROM_CHITCHAT, hostui.notify(hdsl)); - DEBUG_ECHO_START(); DEBUG_ECHOLNF(hdsl); + DEBUG_ECHO_START(); DEBUG_ECHOLN(hdsl); #endif TERN_(EXTENSIBLE_UI, ExtUI::onFactoryReset()); @@ -3691,12 +3691,11 @@ void MarlinSettings::reset() { for (uint8_t py = 0; py < GRID_MAX_POINTS_Y; ++py) { for (uint8_t px = 0; px < GRID_MAX_POINTS_X; ++px) { CONFIG_ECHO_START(); - SERIAL_ECHOPGM(" G29 S3 I", px, " J", py); - SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, LINEAR_UNIT(bedlevel.z_values[px][py]), 5); + SERIAL_ECHOLN(F(" G29 S3 I"), px, F(" J"), py, FPSTR(SP_Z_STR), p_float_t(LINEAR_UNIT(bedlevel.z_values[px][py]), 5)); } } CONFIG_ECHO_START(); - SERIAL_ECHOLNPAIR_F(" G29 S4 Z", LINEAR_UNIT(bedlevel.z_offset), 5); + SERIAL_ECHOLNPGM(" G29 S4 Z", p_float_t(LINEAR_UNIT(bedlevel.z_offset), 5)); } #elif ENABLED(AUTO_BED_LEVELING_UBL) @@ -3717,8 +3716,7 @@ void MarlinSettings::reset() { for (uint8_t py = 0; py < GRID_MAX_POINTS_Y; ++py) { for (uint8_t px = 0; px < GRID_MAX_POINTS_X; ++px) { CONFIG_ECHO_START(); - SERIAL_ECHOPGM(" G29 W I", px, " J", py); - SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, LINEAR_UNIT(bedlevel.z_values[px][py]), 5); + SERIAL_ECHOLN(F(" G29 W I"), px, F(" J"), py, FPSTR(SP_Z_STR), p_float_t(LINEAR_UNIT(bedlevel.z_values[px][py]), 5)); } } } diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 7383f6a1c3ded..1f0e1a975582f 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -856,7 +856,7 @@ volatile bool Temperature::raw_temps_ready = false; #define MAX_CYCLE_TIME_PID_AUTOTUNE 20L #endif if ((ms - _MIN(t1, t2)) > (MAX_CYCLE_TIME_PID_AUTOTUNE * 60L * 1000L)) { - TERN_(DWIN_CREALITY_LCD, DWIN_Popup_Temperature(0)); + TERN_(DWIN_CREALITY_LCD, dwinPopupTemperature(0)); 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))); @@ -870,9 +870,9 @@ volatile bool Temperature::raw_temps_ready = false; #if ANY(PIDTEMPBED, PIDTEMPCHAMBER) FSTR_P const estring = GHV(F("chamber"), F("bed"), FPSTR(NUL_STR)); - say_default_(); SERIAL_ECHOF(estring); SERIAL_ECHOLNPGM("Kp ", tune_pid.p); - say_default_(); SERIAL_ECHOF(estring); SERIAL_ECHOLNPGM("Ki ", tune_pid.i); - say_default_(); SERIAL_ECHOF(estring); SERIAL_ECHOLNPGM("Kd ", tune_pid.d); + say_default_(); SERIAL_ECHO(estring, F("Kp "), tune_pid.p); + say_default_(); SERIAL_ECHO(estring, F("Ki "), tune_pid.i); + say_default_(); SERIAL_ECHO(estring, F("Kd "), tune_pid.d); #else say_default_(); SERIAL_ECHOLNPGM("Kp ", tune_pid.p); say_default_(); SERIAL_ECHOLNPGM("Ki ", tune_pid.i); @@ -919,7 +919,7 @@ volatile bool Temperature::raw_temps_ready = false; hal.idletask(); // Run UI update - TERN(DWIN_CREALITY_LCD, DWIN_Update(), ui.update()); + TERN(DWIN_CREALITY_LCD, dwinUpdate(), ui.update()); } wait_for_heatup = false; @@ -1183,7 +1183,7 @@ volatile bool Temperature::raw_temps_ready = false; } hal.idletask(); - TERN(DWIN_CREALITY_LCD, DWIN_Update(), ui.update()); + TERN(DWIN_CREALITY_LCD, dwinUpdate(), ui.update()); if (!wait_for_heatup) { SERIAL_ECHOLNPGM(STR_MPC_AUTOTUNE_INTERRUPTED); @@ -1244,7 +1244,7 @@ volatile bool Temperature::raw_temps_ready = false; #if ENABLED(DEBUG_MPC_AUTOTUNE) SERIAL_ECHOLNPGM("asymp_temp ", asymp_temp); - SERIAL_ECHOLNPAIR_F("block_responsiveness ", block_responsiveness, 4); + SERIAL_ECHOLNPGM("block_responsiveness ", p_float_t(block_responsiveness, 4)); #endif // Make initial guess at transfer coefficients @@ -1293,9 +1293,9 @@ volatile bool Temperature::raw_temps_ready = false; block_responsiveness = -log((t2 - asymp_temp) / (t1 - asymp_temp)) / tuner.get_sample_interval(); #if ENABLED(DEBUG_MPC_AUTOTUNE) - SERIAL_ECHOLN("Refining estimates for:"); + SERIAL_ECHOLNPGM("Refining estimates for:"); SERIAL_ECHOLNPGM("asymp_temp ", asymp_temp); - SERIAL_ECHOLNPAIR_F("block_responsiveness ", block_responsiveness, 4); + SERIAL_ECHOLNPGM("block_responsiveness ", p_float_t(block_responsiveness, 4)); #endif // Update analytic tuning values based on the above @@ -1308,9 +1308,9 @@ volatile bool Temperature::raw_temps_ready = false; TERN_(DWIN_LCD_PROUI, DWIN_MPCTuning(MPC_DONE)); 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)); + SERIAL_ECHOLNPGM("MPC_SENSOR_RESPONSIVENESS ", p_float_t(mpc.sensor_responsiveness, 4)); + SERIAL_ECHOLNPGM("MPC_AMBIENT_XFER_COEFF ", p_float_t(mpc.ambient_xfer_coeff_fan0, 4)); + TERN_(HAS_FAN, SERIAL_ECHOLNPGM("MPC_AMBIENT_XFER_COEFF_FAN255 ", p_float_t(ambient_xfer_coeff_fan255, 4))); } #endif // MPC_AUTOTUNE @@ -1477,7 +1477,7 @@ void Temperature::_temp_error(const heater_id_t heater_id, FSTR_P const serial_m if (IsRunning() && TERN1(BOGUS_TEMPERATURE_GRACE_PERIOD, killed == 2)) { SERIAL_ERROR_START(); - SERIAL_ECHOF(serial_msg); + SERIAL_ECHO(serial_msg); SERIAL_ECHOPGM(STR_STOPPED_HEATER); heater_id_t real_heater_id = heater_id; @@ -1583,7 +1583,7 @@ void Temperature::mintemp_error(const heater_id_t heater_id) { FORCE_INLINE void debug(const_celsius_float_t c, const_float_t pid_out, FSTR_P const name=nullptr, const int8_t index=-1) { if (TERN0(HAS_PID_DEBUG, thermalManager.pid_debug_flag)) { SERIAL_ECHO_START(); - if (name) SERIAL_ECHOF(name); + if (name) SERIAL_ECHO(name); if (index >= 0) SERIAL_ECHO(index); SERIAL_ECHOLNPGM( STR_PID_DEBUG_INPUT, c, @@ -2225,12 +2225,12 @@ void Temperature::task() { const user_thermistor_t &t = user_thermistor[t_index]; - SERIAL_ECHOPAIR_F(" R", t.series_res, 1); - SERIAL_ECHOPAIR_F_P(SP_T_STR, t.res_25, 1); - SERIAL_ECHOPAIR_F_P(SP_B_STR, t.beta, 1); - SERIAL_ECHOPAIR_F_P(SP_C_STR, t.sh_c_coeff, 9); - SERIAL_ECHOPGM(" ; "); - SERIAL_ECHOF( + SERIAL_ECHO( + F(" R"), p_float_t(t.series_res, 1), FPSTR(SP_T_STR), p_float_t(t.res_25, 1), + FPSTR(SP_B_STR), p_float_t(t.beta, 1), FPSTR(SP_C_STR), p_float_t(t.sh_c_coeff, 9), + F(" ; ") + ); + SERIAL_ECHOLN( TERN_(TEMP_SENSOR_0_IS_CUSTOM, t_index == CTI_HOTEND_0 ? F("HOTEND 0") :) TERN_(TEMP_SENSOR_1_IS_CUSTOM, t_index == CTI_HOTEND_1 ? F("HOTEND 1") :) TERN_(TEMP_SENSOR_2_IS_CUSTOM, t_index == CTI_HOTEND_2 ? F("HOTEND 2") :) @@ -2245,9 +2245,8 @@ void Temperature::task() { TERN_(TEMP_SENSOR_PROBE_IS_CUSTOM, t_index == CTI_PROBE ? F("PROBE") :) TERN_(TEMP_SENSOR_BOARD_IS_CUSTOM, t_index == CTI_BOARD ? F("BOARD") :) TERN_(TEMP_SENSOR_REDUNDANT_IS_CUSTOM, t_index == CTI_REDUNDANT ? F("REDUNDANT") :) - nullptr + FSTR_P(nullptr) ); - SERIAL_EOL(); } celsius_float_t Temperature::user_thermistor_to_deg_c(const uint8_t t_index, const raw_adc_t raw) { @@ -2943,7 +2942,7 @@ void Temperature::init() { temp_range[NR].raw_max -= TEMPDIR(NR) * (OVERSAMPLENR); \ }while(0) - #define _MINMAX_TEST(N,M) (HOTENDS > N && TEMP_SENSOR_##NR##_IS_THERMISTOR && defined(HEATER_##N##_##M##TEMP)) + #define _MINMAX_TEST(N,M) (!TEMP_SENSOR_##N##_IS_DUMMY && HOTENDS > N && TEMP_SENSOR_##N##_IS_THERMISTOR && defined(HEATER_##N##_##M##TEMP)) #if _MINMAX_TEST(0, MIN) _TEMP_MIN_E(0); @@ -4189,8 +4188,8 @@ void Temperature::isr() { #else #define SFP 2 #endif - SERIAL_CHAR(':'); SERIAL_PRINT(c, SFP); - if (show_t) { SERIAL_ECHOPGM(" /"); SERIAL_PRINT(t, SFP); } + SERIAL_ECHO(AS_CHAR(':'), p_float_t(c, SFP)); + if (show_t) { SERIAL_ECHOPGM(" /", p_float_t(t, SFP)); } #if ENABLED(SHOW_TEMP_ADC_VALUES) // Temperature MAX SPI boards do not have an OVERSAMPLENR defined SERIAL_ECHOPGM(" (", TERN(HAS_MAXTC_LIBRARIES, k == 'T', false) ? r : r * RECIPROCAL(OVERSAMPLENR)); diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 0ae0312daef34..7e235ca80a319 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -38,15 +38,15 @@ #define MAX_E_STEPPERS 8 #if NONE(FET_ORDER_EEF, FET_ORDER_EEB, FET_ORDER_EFF, FET_ORDER_EFB, FET_ORDER_SF) - #if MB(RAMPS_13_EFB, RAMPS_14_EFB, RAMPS_PLUS_EFB, RAMPS_14_RE_ARM_EFB, RAMPS_SMART_EFB, RAMPS_DUO_EFB, RAMPS4DUE_EFB) + #if MB(RAMPS_13_EFB, RAMPS_14_EFB, RAMPS_PLUS_EFB, RAMPS_14_RE_ARM_EFB, RAMPS_SMART_EFB, RAMPS_DUO_EFB, RAMPS4DUE_EFB, RAMPS_BTT_16_PLUS_EFB) #define FET_ORDER_EFB 1 - #elif MB(RAMPS_13_EEB, RAMPS_14_EEB, RAMPS_PLUS_EEB, RAMPS_14_RE_ARM_EEB, RAMPS_SMART_EEB, RAMPS_DUO_EEB, RAMPS4DUE_EEB) + #elif MB(RAMPS_13_EEB, RAMPS_14_EEB, RAMPS_PLUS_EEB, RAMPS_14_RE_ARM_EEB, RAMPS_SMART_EEB, RAMPS_DUO_EEB, RAMPS4DUE_EEB, RAMPS_BTT_16_PLUS_EEB) #define FET_ORDER_EEB 1 - #elif MB(RAMPS_13_EFF, RAMPS_14_EFF, RAMPS_PLUS_EFF, RAMPS_14_RE_ARM_EFF, RAMPS_SMART_EFF, RAMPS_DUO_EFF, RAMPS4DUE_EFF) + #elif MB(RAMPS_13_EFF, RAMPS_14_EFF, RAMPS_PLUS_EFF, RAMPS_14_RE_ARM_EFF, RAMPS_SMART_EFF, RAMPS_DUO_EFF, RAMPS4DUE_EFF, RAMPS_BTT_16_PLUS_EFF) #define FET_ORDER_EFF 1 - #elif MB(RAMPS_13_EEF, RAMPS_14_EEF, RAMPS_PLUS_EEF, RAMPS_14_RE_ARM_EEF, RAMPS_SMART_EEF, RAMPS_DUO_EEF, RAMPS4DUE_EEF) + #elif MB(RAMPS_13_EEF, RAMPS_14_EEF, RAMPS_PLUS_EEF, RAMPS_14_RE_ARM_EEF, RAMPS_SMART_EEF, RAMPS_DUO_EEF, RAMPS4DUE_EEF, RAMPS_BTT_16_PLUS_EEF) #define FET_ORDER_EEF 1 - #elif MB(RAMPS_13_SF, RAMPS_14_SF, RAMPS_PLUS_SF, RAMPS_14_RE_ARM_SF, RAMPS_SMART_SF, RAMPS_DUO_SF, RAMPS4DUE_SF) + #elif MB(RAMPS_13_SF, RAMPS_14_SF, RAMPS_PLUS_SF, RAMPS_14_RE_ARM_SF, RAMPS_SMART_SF, RAMPS_DUO_SF, RAMPS4DUE_SF, RAMPS_BTT_16_PLUS_SF) #define FET_ORDER_SF 1 #elif HAS_MULTI_HOTEND || (HAS_EXTRUDERS && HAS_CUTTER) #if TEMP_SENSOR_BED @@ -124,760 +124,766 @@ #endif // -// RAMPS 1.3 / 1.4 - ATmega1280, ATmega2560 +// RAMPS 1.3 / 1.4 / 1.6+ - ATmega1280, ATmega2560 // #if MB(RAMPS_OLD) - #include "ramps/pins_RAMPS_OLD.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 + #include "ramps/pins_RAMPS_OLD.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 #elif MB(RAMPS_13_EFB, RAMPS_13_EEB, RAMPS_13_EFF, RAMPS_13_EEF, RAMPS_13_SF) - #include "ramps/pins_RAMPS_13.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 + #include "ramps/pins_RAMPS_13.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 #elif MB(RAMPS_14_EFB, RAMPS_14_EEB, RAMPS_14_EFF, RAMPS_14_EEF, RAMPS_14_SF) - #include "ramps/pins_RAMPS.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 + #include "ramps/pins_RAMPS.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 #elif MB(RAMPS_PLUS_EFB, RAMPS_PLUS_EEB, RAMPS_PLUS_EFF, RAMPS_PLUS_EEF, RAMPS_PLUS_SF) - #include "ramps/pins_RAMPS_PLUS.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 + #include "ramps/pins_RAMPS_PLUS.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 +#elif MB(RAMPS_BTT_16_PLUS_EFB, RAMPS_BTT_16_PLUS_EEB, RAMPS_BTT_16_PLUS_EFF, RAMPS_BTT_16_PLUS_EEF, RAMPS_BTT_16_PLUS_SF) + #include "ramps/pins_RAMPS_BTT_16_PLUS.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 // // RAMPS Derivatives - ATmega1280, ATmega2560 // #elif MB(3DRAG) - #include "ramps/pins_3DRAG.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 + #include "ramps/pins_3DRAG.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 #elif MB(K8200) - #include "ramps/pins_K8200.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 + #include "ramps/pins_K8200.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 #elif MB(K8400) - #include "ramps/pins_K8400.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 + #include "ramps/pins_K8400.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 #elif MB(K8600) - #include "ramps/pins_K8600.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 + #include "ramps/pins_K8600.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 #elif MB(K8800) - #include "ramps/pins_K8800.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 + #include "ramps/pins_K8800.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 #elif MB(BAM_DICE) - #include "ramps/pins_RAMPS.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 + #include "ramps/pins_RAMPS.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 #elif MB(BAM_DICE_DUE) - #include "ramps/pins_BAM_DICE_DUE.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 + #include "ramps/pins_BAM_DICE_DUE.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 #elif MB(MKS_BASE) - #include "ramps/pins_MKS_BASE_10.h" // ATmega2560 env:mega2560 + #include "ramps/pins_MKS_BASE_10.h" // ATmega2560 env:mega2560 #elif MB(MKS_BASE_14) - #include "ramps/pins_MKS_BASE_14.h" // ATmega2560 env:mega2560 + #include "ramps/pins_MKS_BASE_14.h" // ATmega2560 env:mega2560 #elif MB(MKS_BASE_15) - #include "ramps/pins_MKS_BASE_15.h" // ATmega2560 env:mega2560 + #include "ramps/pins_MKS_BASE_15.h" // ATmega2560 env:mega2560 #elif MB(MKS_BASE_16) - #include "ramps/pins_MKS_BASE_16.h" // ATmega2560 env:mega2560 + #include "ramps/pins_MKS_BASE_16.h" // ATmega2560 env:mega2560 #elif MB(MKS_BASE_HEROIC) - #include "ramps/pins_MKS_BASE_HEROIC.h" // ATmega2560 env:mega2560 + #include "ramps/pins_MKS_BASE_HEROIC.h" // ATmega2560 env:mega2560 #elif MB(MKS_GEN_13) - #include "ramps/pins_MKS_GEN_13.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 + #include "ramps/pins_MKS_GEN_13.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 #elif MB(MKS_GEN_L) - #include "ramps/pins_MKS_GEN_L.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 + #include "ramps/pins_MKS_GEN_L.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 #elif MB(KFB_2) - #include "ramps/pins_BIQU_KFB_2.h" // ATmega2560 env:mega2560 + #include "ramps/pins_BIQU_KFB_2.h" // ATmega2560 env:mega2560 #elif MB(ZRIB_V20) - #include "ramps/pins_ZRIB_V20.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 + #include "ramps/pins_ZRIB_V20.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 #elif MB(ZRIB_V52) - #include "ramps/pins_ZRIB_V52.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 + #include "ramps/pins_ZRIB_V52.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 #elif MB(ZRIB_V53) - #include "ramps/pins_ZRIB_V53.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 + #include "ramps/pins_ZRIB_V53.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 #elif MB(FELIX2) - #include "ramps/pins_FELIX2.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 + #include "ramps/pins_FELIX2.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 #elif MB(RIGIDBOARD) - #include "ramps/pins_RIGIDBOARD.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 + #include "ramps/pins_RIGIDBOARD.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 #elif MB(RIGIDBOARD_V2) - #include "ramps/pins_RIGIDBOARD_V2.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 + #include "ramps/pins_RIGIDBOARD_V2.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 #elif MB(SAINSMART_2IN1) - #include "ramps/pins_SAINSMART_2IN1.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 + #include "ramps/pins_SAINSMART_2IN1.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 #elif MB(ULTIMAKER) - #include "ramps/pins_ULTIMAKER.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 + #include "ramps/pins_ULTIMAKER.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 #elif MB(ULTIMAKER_OLD) - #include "ramps/pins_ULTIMAKER_OLD.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 + #include "ramps/pins_ULTIMAKER_OLD.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 #elif MB(AZTEEG_X3) - #include "ramps/pins_AZTEEG_X3.h" // ATmega2560 env:mega2560 + #include "ramps/pins_AZTEEG_X3.h" // ATmega2560 env:mega2560 #elif MB(AZTEEG_X3_PRO) - #include "ramps/pins_AZTEEG_X3_PRO.h" // ATmega2560 env:mega2560 + #include "ramps/pins_AZTEEG_X3_PRO.h" // ATmega2560 env:mega2560 #elif MB(ULTIMAIN_2) - #include "ramps/pins_ULTIMAIN_2.h" // ATmega2560 env:mega2560ext + #include "ramps/pins_ULTIMAIN_2.h" // ATmega2560 env:mega2560ext #elif MB(FORMBOT_RAPTOR) - #include "ramps/pins_FORMBOT_RAPTOR.h" // ATmega2560 env:mega2560 + #include "ramps/pins_FORMBOT_RAPTOR.h" // ATmega2560 env:mega2560 #elif MB(FORMBOT_RAPTOR2) - #include "ramps/pins_FORMBOT_RAPTOR2.h" // ATmega2560 env:mega2560 + #include "ramps/pins_FORMBOT_RAPTOR2.h" // ATmega2560 env:mega2560 #elif MB(FORMBOT_TREX2PLUS) - #include "ramps/pins_FORMBOT_TREX2PLUS.h" // ATmega2560 env:mega2560 + #include "ramps/pins_FORMBOT_TREX2PLUS.h" // ATmega2560 env:mega2560 #elif MB(FORMBOT_TREX3) - #include "ramps/pins_FORMBOT_TREX3.h" // ATmega2560 env:mega2560 + #include "ramps/pins_FORMBOT_TREX3.h" // ATmega2560 env:mega2560 #elif MB(RUMBA) - #include "ramps/pins_RUMBA.h" // ATmega2560 env:mega2560 + #include "ramps/pins_RUMBA.h" // ATmega2560 env:mega2560 #elif MB(RUMBA_RAISE3D) - #include "ramps/pins_RUMBA_RAISE3D.h" // ATmega2560 env:mega2560 + #include "ramps/pins_RUMBA_RAISE3D.h" // ATmega2560 env:mega2560 #elif MB(RL200) - #include "ramps/pins_RL200.h" // ATmega2560 env:mega2560 + #include "ramps/pins_RL200.h" // ATmega2560 env:mega2560 #elif MB(BQ_ZUM_MEGA_3D) - #include "ramps/pins_BQ_ZUM_MEGA_3D.h" // ATmega2560 env:mega2560ext + #include "ramps/pins_BQ_ZUM_MEGA_3D.h" // ATmega2560 env:mega2560ext #elif MB(MAKEBOARD_MINI) - #include "ramps/pins_MAKEBOARD_MINI.h" // ATmega2560 env:mega2560 + #include "ramps/pins_MAKEBOARD_MINI.h" // ATmega2560 env:mega2560 #elif MB(TRIGORILLA_13) - #include "ramps/pins_TRIGORILLA_13.h" // ATmega2560 env:mega2560 + #include "ramps/pins_TRIGORILLA_13.h" // ATmega2560 env:mega2560 #elif MB(TRIGORILLA_14, TRIGORILLA_14_11) - #include "ramps/pins_TRIGORILLA_14.h" // ATmega2560 env:mega2560 + #include "ramps/pins_TRIGORILLA_14.h" // ATmega2560 env:mega2560 #elif MB(RAMPS_ENDER_4) - #include "ramps/pins_RAMPS_ENDER_4.h" // ATmega2560 env:mega2560 + #include "ramps/pins_RAMPS_ENDER_4.h" // ATmega2560 env:mega2560 #elif MB(RAMPS_CREALITY) - #include "ramps/pins_RAMPS_CREALITY.h" // ATmega2560 env:mega2560 + #include "ramps/pins_RAMPS_CREALITY.h" // ATmega2560 env:mega2560 #elif MB(DAGOMA_F5) - #include "ramps/pins_DAGOMA_F5.h" // ATmega2560 env:mega2560 + #include "ramps/pins_DAGOMA_F5.h" // ATmega2560 env:mega2560 #elif MB(FYSETC_F6_13) - #include "ramps/pins_FYSETC_F6_13.h" // ATmega2560 env:FYSETC_F6 + #include "ramps/pins_FYSETC_F6_13.h" // ATmega2560 env:FYSETC_F6 #elif MB(FYSETC_F6_14) - #include "ramps/pins_FYSETC_F6_14.h" // ATmega2560 env:FYSETC_F6 + #include "ramps/pins_FYSETC_F6_14.h" // ATmega2560 env:FYSETC_F6 #elif MB(DUPLICATOR_I3_PLUS) - #include "ramps/pins_DUPLICATOR_I3_PLUS.h" // ATmega2560 env:mega2560 + #include "ramps/pins_DUPLICATOR_I3_PLUS.h" // ATmega2560 env:mega2560 #elif MB(VORON) - #include "ramps/pins_VORON.h" // ATmega2560 env:mega2560 + #include "ramps/pins_VORON.h" // ATmega2560 env:mega2560 #elif MB(TRONXY_V3_1_0) - #include "ramps/pins_TRONXY_V3_1_0.h" // ATmega2560 env:mega2560 + #include "ramps/pins_TRONXY_V3_1_0.h" // ATmega2560 env:mega2560 #elif MB(Z_BOLT_X_SERIES) - #include "ramps/pins_Z_BOLT_X_SERIES.h" // ATmega2560 env:mega2560 + #include "ramps/pins_Z_BOLT_X_SERIES.h" // ATmega2560 env:mega2560 #elif MB(TT_OSCAR) - #include "ramps/pins_TT_OSCAR.h" // ATmega2560 env:mega2560 + #include "ramps/pins_TT_OSCAR.h" // ATmega2560 env:mega2560 #elif MB(TANGO) - #include "ramps/pins_TANGO.h" // ATmega2560 env:mega2560 + #include "ramps/pins_TANGO.h" // ATmega2560 env:mega2560 #elif MB(MKS_GEN_L_V2) - #include "ramps/pins_MKS_GEN_L_V2.h" // ATmega2560 env:mega2560 + #include "ramps/pins_MKS_GEN_L_V2.h" // ATmega2560 env:mega2560 #elif MB(COPYMASTER_3D) - #include "ramps/pins_COPYMASTER_3D.h" // ATmega2560 env:mega2560 + #include "ramps/pins_COPYMASTER_3D.h" // ATmega2560 env:mega2560 #elif MB(ORTUR_4) - #include "ramps/pins_ORTUR_4.h" // ATmega2560 env:mega2560 + #include "ramps/pins_ORTUR_4.h" // ATmega2560 env:mega2560 #elif MB(TENLOG_D3_HERO) - #include "ramps/pins_TENLOG_D3_HERO.h" // ATmega2560 env:mega2560 + #include "ramps/pins_TENLOG_D3_HERO.h" // ATmega2560 env:mega2560 #elif MB(TENLOG_MB1_V23) - #include "ramps/pins_TENLOG_MB1_V23.h" // ATmega2560 env:mega2560 + #include "ramps/pins_TENLOG_MB1_V23.h" // ATmega2560 env:mega2560 #elif MB(MKS_GEN_L_V21) - #include "ramps/pins_MKS_GEN_L_V21.h" // ATmega2560 env:mega2560 + #include "ramps/pins_MKS_GEN_L_V21.h" // ATmega2560 env:mega2560 #elif MB(RAMPS_S_12_EEFB, RAMPS_S_12_EEEB, RAMPS_S_12_EFFB) - #include "ramps/pins_RAMPS_S_12.h" // ATmega2560 env:mega2560 + #include "ramps/pins_RAMPS_S_12.h" // ATmega2560 env:mega2560 #elif MB(LONGER3D_LK1_PRO, LONGER3D_LKx_PRO) - #include "ramps/pins_LONGER3D_LKx_PRO.h" // ATmega2560 env:mega2560 + #include "ramps/pins_LONGER3D_LKx_PRO.h" // ATmega2560 env:mega2560 #elif MB(PXMALION_CORE_I3) - #include "ramps/pins_PXMALION_CORE_I3.h" // ATmega2560 env:mega2560 + #include "ramps/pins_PXMALION_CORE_I3.h" // ATmega2560 env:mega2560 #elif MB(PANOWIN_CUTLASS) - #include "ramps/pins_PANOWIN_CUTLASS.h" // ATmega2560 env:mega2560ext + #include "ramps/pins_PANOWIN_CUTLASS.h" // ATmega2560 env:mega2560ext #elif MB(KODAMA_BARDO) - #include "ramps/pins_KODAMA_BARDO.h" // ATmega2560 env:mega2560ext + #include "ramps/pins_KODAMA_BARDO.h" // ATmega2560 env:mega2560ext // // RAMBo and derivatives // #elif MB(RAMBO) - #include "rambo/pins_RAMBO.h" // ATmega2560 env:rambo + #include "rambo/pins_RAMBO.h" // ATmega2560 env:rambo #elif MB(MINIRAMBO, MINIRAMBO_10A) - #include "rambo/pins_MINIRAMBO.h" // ATmega2560 env:rambo + #include "rambo/pins_MINIRAMBO.h" // ATmega2560 env:rambo #elif MB(EINSY_RAMBO) - #include "rambo/pins_EINSY_RAMBO.h" // ATmega2560 env:rambo + #include "rambo/pins_EINSY_RAMBO.h" // ATmega2560 env:rambo #elif MB(EINSY_RETRO) - #include "rambo/pins_EINSY_RETRO.h" // ATmega2560 env:rambo + #include "rambo/pins_EINSY_RETRO.h" // ATmega2560 env:rambo #elif MB(SCOOVO_X9H) - #include "rambo/pins_SCOOVO_X9H.h" // ATmega2560 env:rambo + #include "rambo/pins_SCOOVO_X9H.h" // ATmega2560 env:rambo #elif MB(RAMBO_THINKERV2) - #include "rambo/pins_RAMBO_THINKERV2.h" // ATmega2560 env:rambo + #include "rambo/pins_RAMBO_THINKERV2.h" // ATmega2560 env:rambo // // Other ATmega1280, ATmega2560 // #elif MB(CNCONTROLS_11) - #include "mega/pins_CNCONTROLS_11.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 + #include "mega/pins_CNCONTROLS_11.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 #elif MB(CNCONTROLS_12) - #include "mega/pins_CNCONTROLS_12.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 + #include "mega/pins_CNCONTROLS_12.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 #elif MB(CNCONTROLS_15) - #include "mega/pins_CNCONTROLS_15.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 + #include "mega/pins_CNCONTROLS_15.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 #elif MB(MIGHTYBOARD_REVE) - #include "mega/pins_MIGHTYBOARD_REVE.h" // ATmega2560, ATmega1280 env:mega2560ext env:MightyBoard1280 env:MightyBoard2560 + #include "mega/pins_MIGHTYBOARD_REVE.h" // ATmega2560, ATmega1280 env:mega2560ext env:MightyBoard1280 env:MightyBoard2560 #elif MB(CHEAPTRONIC) - #include "mega/pins_CHEAPTRONIC.h" // ATmega2560 env:mega2560 + #include "mega/pins_CHEAPTRONIC.h" // ATmega2560 env:mega2560 #elif MB(CHEAPTRONIC_V2) - #include "mega/pins_CHEAPTRONICv2.h" // ATmega2560 env:mega2560 + #include "mega/pins_CHEAPTRONICv2.h" // ATmega2560 env:mega2560 #elif MB(MEGATRONICS) - #include "mega/pins_MEGATRONICS.h" // ATmega2560 env:mega2560 + #include "mega/pins_MEGATRONICS.h" // ATmega2560 env:mega2560 #elif MB(MEGATRONICS_2) - #include "mega/pins_MEGATRONICS_2.h" // ATmega2560 env:mega2560 + #include "mega/pins_MEGATRONICS_2.h" // ATmega2560 env:mega2560 #elif MB(MEGATRONICS_3, MEGATRONICS_31, MEGATRONICS_32) - #include "mega/pins_MEGATRONICS_3.h" // ATmega2560 env:mega2560 + #include "mega/pins_MEGATRONICS_3.h" // ATmega2560 env:mega2560 #elif MB(ELEFU_3) - #include "mega/pins_ELEFU_3.h" // ATmega2560 env:mega2560 + #include "mega/pins_ELEFU_3.h" // ATmega2560 env:mega2560 #elif MB(LEAPFROG) - #include "mega/pins_LEAPFROG.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 + #include "mega/pins_LEAPFROG.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 #elif MB(MEGACONTROLLER) - #include "mega/pins_MEGACONTROLLER.h" // ATmega2560 env:mega2560 + #include "mega/pins_MEGACONTROLLER.h" // ATmega2560 env:mega2560 #elif MB(GT2560_REV_A) - #include "mega/pins_GT2560_REV_A.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 + #include "mega/pins_GT2560_REV_A.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 #elif MB(GT2560_REV_A_PLUS) - #include "mega/pins_GT2560_REV_A_PLUS.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 + #include "mega/pins_GT2560_REV_A_PLUS.h" // ATmega2560, ATmega1280 env:mega2560 env:mega1280 #elif MB(GT2560_V3) - #include "mega/pins_GT2560_V3.h" // ATmega2560 env:mega2560 + #include "mega/pins_GT2560_V3.h" // ATmega2560 env:mega2560 #elif MB(GT2560_REV_B) - #include "mega/pins_GT2560_REV_B.h" // ATmega2560 env:mega2560 + #include "mega/pins_GT2560_REV_B.h" // ATmega2560 env:mega2560 #elif MB(GT2560_V4) - #include "mega/pins_GT2560_V4.h" // ATmega2560 env:mega2560 + #include "mega/pins_GT2560_V4.h" // ATmega2560 env:mega2560 #elif MB(GT2560_V4_A20) - #include "mega/pins_GT2560_V4_A20.h" // ATmega2560 env:mega2560 + #include "mega/pins_GT2560_V4_A20.h" // ATmega2560 env:mega2560 #elif MB(GT2560_V3_MC2) - #include "mega/pins_GT2560_V3_MC2.h" // ATmega2560 env:mega2560 + #include "mega/pins_GT2560_V3_MC2.h" // ATmega2560 env:mega2560 #elif MB(GT2560_V3_A20) - #include "mega/pins_GT2560_V3_A20.h" // ATmega2560 env:mega2560 + #include "mega/pins_GT2560_V3_A20.h" // ATmega2560 env:mega2560 #elif MB(EINSTART_S) - #include "mega/pins_EINSTART-S.h" // ATmega2560, ATmega1280 env:mega2560ext env:mega1280 + #include "mega/pins_EINSTART-S.h" // ATmega2560, ATmega1280 env:mega2560ext env:mega1280 #elif MB(WANHAO_ONEPLUS) - #include "mega/pins_WANHAO_ONEPLUS.h" // ATmega2560 env:mega2560 + #include "mega/pins_WANHAO_ONEPLUS.h" // ATmega2560 env:mega2560 #elif MB(OVERLORD) - #include "mega/pins_OVERLORD.h" // ATmega2560 env:mega2560 + #include "mega/pins_OVERLORD.h" // ATmega2560 env:mega2560 #elif MB(HJC2560C_REV1) - #include "mega/pins_HJC2560C_REV2.h" // ATmega2560 env:mega2560 + #include "mega/pins_HJC2560C_REV2.h" // ATmega2560 env:mega2560 #elif MB(HJC2560C_REV2) - #include "mega/pins_HJC2560C_REV2.h" // ATmega2560 env:mega2560 + #include "mega/pins_HJC2560C_REV2.h" // ATmega2560 env:mega2560 #elif MB(LEAPFROG_XEED2015) - #include "mega/pins_LEAPFROG_XEED2015.h" // ATmega2560 env:mega2560 + #include "mega/pins_LEAPFROG_XEED2015.h" // ATmega2560 env:mega2560 #elif MB(PICA) - #include "mega/pins_PICA.h" // ATmega2560 env:mega2560 + #include "mega/pins_PICA.h" // ATmega2560 env:mega2560 #elif MB(PICA_REVB) - #include "mega/pins_PICAOLD.h" // ATmega2560 env:mega2560 + #include "mega/pins_PICAOLD.h" // ATmega2560 env:mega2560 #elif MB(INTAMSYS40) - #include "mega/pins_INTAMSYS40.h" // ATmega2560 env:mega2560 + #include "mega/pins_INTAMSYS40.h" // ATmega2560 env:mega2560 #elif MB(MALYAN_M180) - #include "mega/pins_MALYAN_M180.h" // ATmega2560 env:mega2560 + #include "mega/pins_MALYAN_M180.h" // ATmega2560 env:mega2560 #elif MB(PROTONEER_CNC_SHIELD_V3) - #include "mega/pins_PROTONEER_CNC_SHIELD_V3.h"// ATmega2560 env:mega2560 + #include "mega/pins_PROTONEER_CNC_SHIELD_V3.h" // ATmega2560 env:mega2560 #elif MB(WEEDO_62A) - #include "mega/pins_WEEDO_62A.h" // ATmega2560 env:mega2560 + #include "mega/pins_WEEDO_62A.h" // ATmega2560 env:mega2560 // // ATmega1281, ATmega2561 // #elif MB(MINITRONICS) - #include "mega/pins_MINITRONICS.h" // ATmega1281 env:mega1280 + #include "mega/pins_MINITRONICS.h" // ATmega1281 env:mega1280 #elif MB(SILVER_GATE) - #include "mega/pins_SILVER_GATE.h" // ATmega2561 env:mega2560 + #include "mega/pins_SILVER_GATE.h" // ATmega2561 env:mega2560 // // Sanguinololu and Derivatives - ATmega644P, ATmega1284P // #elif MB(SANGUINOLOLU_11) - #include "sanguino/pins_SANGUINOLOLU_11.h" // ATmega644P, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p + #include "sanguino/pins_SANGUINOLOLU_11.h" // ATmega644P, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p #elif MB(SANGUINOLOLU_12) - #include "sanguino/pins_SANGUINOLOLU_12.h" // ATmega644P, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p + #include "sanguino/pins_SANGUINOLOLU_12.h" // ATmega644P, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p #elif MB(MELZI) - #include "sanguino/pins_MELZI.h" // ATmega644P, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p + #include "sanguino/pins_MELZI.h" // ATmega644P, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p #elif MB(MELZI_V2) - #include "sanguino/pins_MELZI_V2.h" // ATmega644P, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p + #include "sanguino/pins_MELZI_V2.h" // ATmega644P, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p #elif MB(MELZI_MAKR3D) - #include "sanguino/pins_MELZI_MAKR3D.h" // ATmega644P, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p + #include "sanguino/pins_MELZI_MAKR3D.h" // ATmega644P, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p #elif MB(MELZI_CREALITY) - #include "sanguino/pins_MELZI_CREALITY.h" // ATmega1284P env:melzi_optiboot_optimized env:melzi_optiboot env:melzi_optimized env:melzi + #include "sanguino/pins_MELZI_CREALITY.h" // ATmega1284P env:melzi_optiboot_optimized env:melzi_optiboot env:melzi_optimized env:melzi #elif MB(MELZI_CREALITY_ENDER2) - #include "sanguino/pins_MELZI_CREALITY_E2.h" // ATmega1284P env:melzi_optiboot_optimized env:melzi_optiboot env:melzi_optimized env:melzi + #include "sanguino/pins_MELZI_CREALITY_E2.h" // ATmega1284P env:melzi_optiboot_optimized env:melzi_optiboot env:melzi_optimized env:melzi #elif MB(MELZI_MALYAN) - #include "sanguino/pins_MELZI_MALYAN.h" // ATmega644P, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p + #include "sanguino/pins_MELZI_MALYAN.h" // ATmega644P, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p #elif MB(MELZI_TRONXY) - #include "sanguino/pins_MELZI_TRONXY.h" // ATmega644P, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p + #include "sanguino/pins_MELZI_TRONXY.h" // ATmega644P, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p #elif MB(STB_11) - #include "sanguino/pins_STB_11.h" // ATmega644P, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p + #include "sanguino/pins_STB_11.h" // ATmega644P, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p #elif MB(AZTEEG_X1) - #include "sanguino/pins_AZTEEG_X1.h" // ATmega644P, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p + #include "sanguino/pins_AZTEEG_X1.h" // ATmega644P, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p #elif MB(ZMIB_V2) - #include "sanguino/pins_ZMIB_V2.h" // ATmega644P, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p + #include "sanguino/pins_ZMIB_V2.h" // ATmega644P, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p // // Other ATmega644P, ATmega644, ATmega1284P // #elif MB(GEN3_MONOLITHIC) - #include "sanguino/pins_GEN3_MONOLITHIC.h" // ATmega644P env:sanguino644p + #include "sanguino/pins_GEN3_MONOLITHIC.h" // ATmega644P env:sanguino644p #elif MB(GEN3_PLUS) - #include "sanguino/pins_GEN3_PLUS.h" // ATmega644P, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p + #include "sanguino/pins_GEN3_PLUS.h" // ATmega644P, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p #elif MB(GEN6) - #include "sanguino/pins_GEN6.h" // ATmega644P, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p + #include "sanguino/pins_GEN6.h" // ATmega644P, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p #elif MB(GEN6_DELUXE) - #include "sanguino/pins_GEN6_DELUXE.h" // ATmega644P, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p + #include "sanguino/pins_GEN6_DELUXE.h" // ATmega644P, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p #elif MB(GEN7_CUSTOM) - #include "sanguino/pins_GEN7_CUSTOM.h" // ATmega644P, ATmega644, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p + #include "sanguino/pins_GEN7_CUSTOM.h" // ATmega644P, ATmega644, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p #elif MB(GEN7_12) - #include "sanguino/pins_GEN7_12.h" // ATmega644P, ATmega644, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p + #include "sanguino/pins_GEN7_12.h" // ATmega644P, ATmega644, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p #elif MB(GEN7_13) - #include "sanguino/pins_GEN7_13.h" // ATmega644P, ATmega644, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p + #include "sanguino/pins_GEN7_13.h" // ATmega644P, ATmega644, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p #elif MB(GEN7_14) - #include "sanguino/pins_GEN7_14.h" // ATmega644P, ATmega644, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p + #include "sanguino/pins_GEN7_14.h" // ATmega644P, ATmega644, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p #elif MB(OMCA_A) - #include "sanguino/pins_OMCA_A.h" // ATmega644 env:sanguino644p + #include "sanguino/pins_OMCA_A.h" // ATmega644 env:sanguino644p #elif MB(OMCA) - #include "sanguino/pins_OMCA.h" // ATmega644P, ATmega644 env:sanguino644p + #include "sanguino/pins_OMCA.h" // ATmega644P, ATmega644 env:sanguino644p #elif MB(ANET_10) - #include "sanguino/pins_ANET_10.h" // ATmega1284P env:sanguino1284p env:sanguino1284p_optimized env:melzi_optiboot + #include "sanguino/pins_ANET_10.h" // ATmega1284P env:sanguino1284p env:sanguino1284p_optimized env:melzi_optiboot #elif MB(SETHI) - #include "sanguino/pins_SETHI.h" // ATmega644P, ATmega644, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p + #include "sanguino/pins_SETHI.h" // ATmega644P, ATmega644, ATmega1284P env:sanguino1284p_optimized env:sanguino1284p env:sanguino644p // // Teensyduino - AT90USB1286, AT90USB1286P // #elif MB(TEENSYLU) - #include "teensy2/pins_TEENSYLU.h" // AT90USB1286, AT90USB1286P env:at90usb1286_cdc + #include "teensy2/pins_TEENSYLU.h" // AT90USB1286, AT90USB1286P env:at90usb1286_cdc #elif MB(PRINTRBOARD) - #include "teensy2/pins_PRINTRBOARD.h" // AT90USB1286 env:at90usb1286_dfu + #include "teensy2/pins_PRINTRBOARD.h" // AT90USB1286 env:at90usb1286_dfu #elif MB(PRINTRBOARD_REVF) - #include "teensy2/pins_PRINTRBOARD_REVF.h" // AT90USB1286 env:at90usb1286_dfu + #include "teensy2/pins_PRINTRBOARD_REVF.h" // AT90USB1286 env:at90usb1286_dfu #elif MB(BRAINWAVE) - #include "teensy2/pins_BRAINWAVE.h" // AT90USB646 env:at90usb1286_cdc + #include "teensy2/pins_BRAINWAVE.h" // AT90USB646 env:at90usb1286_cdc #elif MB(BRAINWAVE_PRO) - #include "teensy2/pins_BRAINWAVE_PRO.h" // AT90USB1286 env:at90usb1286_cdc + #include "teensy2/pins_BRAINWAVE_PRO.h" // AT90USB1286 env:at90usb1286_cdc #elif MB(SAV_MKI) - #include "teensy2/pins_SAV_MKI.h" // AT90USB1286 env:at90usb1286_cdc + #include "teensy2/pins_SAV_MKI.h" // AT90USB1286 env:at90usb1286_cdc #elif MB(TEENSY2) - #include "teensy2/pins_TEENSY2.h" // AT90USB1286 env:teensy20 + #include "teensy2/pins_TEENSY2.h" // AT90USB1286 env:teensy20 #elif MB(5DPRINT) - #include "teensy2/pins_5DPRINT.h" // AT90USB1286 env:at90usb1286_dfu + #include "teensy2/pins_5DPRINT.h" // AT90USB1286 env:at90usb1286_dfu // -// LPC1768 ARM Cortex M3 +// LPC1768 ARM Cortex-M3 // #elif MB(RAMPS_14_RE_ARM_EFB, RAMPS_14_RE_ARM_EEB, RAMPS_14_RE_ARM_EFF, RAMPS_14_RE_ARM_EEF, RAMPS_14_RE_ARM_SF) - #include "lpc1768/pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768 + #include "lpc1768/pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768 #elif MB(MKS_SBASE) - #include "lpc1768/pins_MKS_SBASE.h" // LPC1768 env:LPC1768 + #include "lpc1768/pins_MKS_SBASE.h" // LPC1768 env:LPC1768 #elif MB(MKS_SGEN_L) - #include "lpc1768/pins_MKS_SGEN_L.h" // LPC1768 env:LPC1768 + #include "lpc1768/pins_MKS_SGEN_L.h" // LPC1768 env:LPC1768 #elif MB(AZSMZ_MINI) - #include "lpc1768/pins_AZSMZ_MINI.h" // LPC1768 env:LPC1768 + #include "lpc1768/pins_AZSMZ_MINI.h" // LPC1768 env:LPC1768 #elif MB(BIQU_BQ111_A4) - #include "lpc1768/pins_BIQU_BQ111_A4.h" // LPC1768 env:LPC1768 + #include "lpc1768/pins_BIQU_BQ111_A4.h" // LPC1768 env:LPC1768 #elif MB(SELENA_COMPACT) - #include "lpc1768/pins_SELENA_COMPACT.h" // LPC1768 env:LPC1768 + #include "lpc1768/pins_SELENA_COMPACT.h" // LPC1768 env:LPC1768 #elif MB(BIQU_B300_V1_0) - #include "lpc1768/pins_BIQU_B300_V1.0.h" // LPC1768 env:LPC1768 + #include "lpc1768/pins_BIQU_B300_V1.0.h" // LPC1768 env:LPC1768 #elif MB(GMARSH_X6_REV1) - #include "lpc1768/pins_GMARSH_X6_REV1.h" // LPC1768 env:LPC1768 + #include "lpc1768/pins_GMARSH_X6_REV1.h" // LPC1768 env:LPC1768 #elif MB(BTT_SKR_V1_1) - #include "lpc1768/pins_BTT_SKR_V1_1.h" // LPC1768 env:LPC1768 + #include "lpc1768/pins_BTT_SKR_V1_1.h" // LPC1768 env:LPC1768 #elif MB(BTT_SKR_V1_3) - #include "lpc1768/pins_BTT_SKR_V1_3.h" // LPC1768 env:LPC1768 + #include "lpc1768/pins_BTT_SKR_V1_3.h" // LPC1768 env:LPC1768 #elif MB(BTT_SKR_V1_4) - #include "lpc1768/pins_BTT_SKR_V1_4.h" // LPC1768 env:LPC1768 + #include "lpc1768/pins_BTT_SKR_V1_4.h" // LPC1768 env:LPC1768 #elif MB(EMOTRONIC) - #include "lpc1768/pins_EMOTRONIC.h" // LPC1768 env:LPC1768 + #include "lpc1768/pins_EMOTRONIC.h" // LPC1768 env:LPC1768 // -// LPC1769 ARM Cortex M3 +// LPC1769 ARM Cortex-M3 // #elif MB(MKS_SGEN) - #include "lpc1769/pins_MKS_SGEN.h" // LPC1769 env:LPC1769 + #include "lpc1769/pins_MKS_SGEN.h" // LPC1769 env:LPC1769 #elif MB(AZTEEG_X5_GT) - #include "lpc1769/pins_AZTEEG_X5_GT.h" // LPC1769 env:LPC1769 + #include "lpc1769/pins_AZTEEG_X5_GT.h" // LPC1769 env:LPC1769 #elif MB(AZTEEG_X5_MINI) - #include "lpc1769/pins_AZTEEG_X5_MINI.h" // LPC1769 env:LPC1769 + #include "lpc1769/pins_AZTEEG_X5_MINI.h" // LPC1769 env:LPC1769 #elif MB(AZTEEG_X5_MINI_WIFI) - #include "lpc1769/pins_AZTEEG_X5_MINI_WIFI.h" // LPC1769 env:LPC1769 + #include "lpc1769/pins_AZTEEG_X5_MINI_WIFI.h" // LPC1769 env:LPC1769 #elif MB(COHESION3D_REMIX) - #include "lpc1769/pins_COHESION3D_REMIX.h" // LPC1769 env:LPC1769 + #include "lpc1769/pins_COHESION3D_REMIX.h" // LPC1769 env:LPC1769 #elif MB(COHESION3D_MINI) - #include "lpc1769/pins_COHESION3D_MINI.h" // LPC1769 env:LPC1769 + #include "lpc1769/pins_COHESION3D_MINI.h" // LPC1769 env:LPC1769 #elif MB(SMOOTHIEBOARD) - #include "lpc1769/pins_SMOOTHIEBOARD.h" // LPC1769 env:LPC1769 + #include "lpc1769/pins_SMOOTHIEBOARD.h" // LPC1769 env:LPC1769 #elif MB(TH3D_EZBOARD) - #include "lpc1769/pins_TH3D_EZBOARD.h" // LPC1769 env:LPC1769 + #include "lpc1769/pins_TH3D_EZBOARD.h" // LPC1769 env:LPC1769 #elif MB(BTT_SKR_V1_4_TURBO) - #include "lpc1769/pins_BTT_SKR_V1_4_TURBO.h" // LPC1769 env:LPC1769 + #include "lpc1769/pins_BTT_SKR_V1_4_TURBO.h" // LPC1769 env:LPC1769 #elif MB(MKS_SGEN_L_V2) - #include "lpc1769/pins_MKS_SGEN_L_V2.h" // LPC1769 env:LPC1769 + #include "lpc1769/pins_MKS_SGEN_L_V2.h" // LPC1769 env:LPC1769 #elif MB(BTT_SKR_E3_TURBO) - #include "lpc1769/pins_BTT_SKR_E3_TURBO.h" // LPC1769 env:LPC1769 + #include "lpc1769/pins_BTT_SKR_E3_TURBO.h" // LPC1769 env:LPC1769 #elif MB(FLY_CDY) - #include "lpc1769/pins_FLY_CDY.h" // LPC1769 env:LPC1769 + #include "lpc1769/pins_FLY_CDY.h" // LPC1769 env:LPC1769 // // Due (ATSAM) boards // #elif MB(DUE3DOM) - #include "sam/pins_DUE3DOM.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug + #include "sam/pins_DUE3DOM.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug #elif MB(DUE3DOM_MINI) - #include "sam/pins_DUE3DOM_MINI.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug + #include "sam/pins_DUE3DOM_MINI.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug #elif MB(RADDS) - #include "sam/pins_RADDS.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug + #include "sam/pins_RADDS.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug #elif MB(RURAMPS4D_11) - #include "sam/pins_RURAMPS4D_11.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug + #include "sam/pins_RURAMPS4D_11.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug #elif MB(RURAMPS4D_13) - #include "sam/pins_RURAMPS4D_13.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug + #include "sam/pins_RURAMPS4D_13.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug #elif MB(RAMPS_FD_V1) - #include "sam/pins_RAMPS_FD_V1.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug + #include "sam/pins_RAMPS_FD_V1.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug #elif MB(RAMPS_FD_V2) - #include "sam/pins_RAMPS_FD_V2.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug + #include "sam/pins_RAMPS_FD_V2.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug #elif MB(RAMPS_SMART_EFB, RAMPS_SMART_EEB, RAMPS_SMART_EFF, RAMPS_SMART_EEF, RAMPS_SMART_SF) - #include "sam/pins_RAMPS_SMART.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug + #include "sam/pins_RAMPS_SMART.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug #elif MB(RAMPS_DUO_EFB, RAMPS_DUO_EEB, RAMPS_DUO_EFF, RAMPS_DUO_EEF, RAMPS_DUO_SF) - #include "sam/pins_RAMPS_DUO.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug + #include "sam/pins_RAMPS_DUO.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug #elif MB(RAMPS4DUE_EFB, RAMPS4DUE_EEB, RAMPS4DUE_EFF, RAMPS4DUE_EEF, RAMPS4DUE_SF) - #include "sam/pins_RAMPS4DUE.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug + #include "sam/pins_RAMPS4DUE.h" // SAM3X8E env:DUE env:DUE_USB env:DUE_debug #elif MB(ULTRATRONICS_PRO) - #include "sam/pins_ULTRATRONICS_PRO.h" // SAM3X8E env:DUE env:DUE_debug + #include "sam/pins_ULTRATRONICS_PRO.h" // SAM3X8E env:DUE env:DUE_debug #elif MB(ARCHIM1) - #include "sam/pins_ARCHIM1.h" // SAM3X8E env:DUE_archim env:DUE_archim_debug + #include "sam/pins_ARCHIM1.h" // SAM3X8E env:DUE_archim env:DUE_archim_debug #elif MB(ARCHIM2) - #include "sam/pins_ARCHIM2.h" // SAM3X8E env:DUE_archim env:DUE_archim_debug + #include "sam/pins_ARCHIM2.h" // SAM3X8E env:DUE_archim env:DUE_archim_debug #elif MB(ALLIGATOR) - #include "sam/pins_ALLIGATOR_R2.h" // SAM3X8E env:DUE env:DUE_debug + #include "sam/pins_ALLIGATOR_R2.h" // SAM3X8E env:DUE env:DUE_debug #elif MB(CNCONTROLS_15D) - #include "sam/pins_CNCONTROLS_15D.h" // SAM3X8E env:DUE env:DUE_USB + #include "sam/pins_CNCONTROLS_15D.h" // SAM3X8E env:DUE env:DUE_USB #elif MB(KRATOS32) - #include "sam/pins_KRATOS32.h" // SAM3X8E env:DUE env:DUE_USB + #include "sam/pins_KRATOS32.h" // SAM3X8E env:DUE env:DUE_USB #elif MB(PRINTRBOARD_G2) - #include "sam/pins_PRINTRBOARD_G2.h" // SAM3X8C env:DUE_USB + #include "sam/pins_PRINTRBOARD_G2.h" // SAM3X8C env:DUE_USB #elif MB(ADSK) - #include "sam/pins_ADSK.h" // SAM3X8C env:DUE env:DUE_debug + #include "sam/pins_ADSK.h" // SAM3X8C env:DUE env:DUE_debug // // STM32 ARM Cortex-M0 // + #elif MB(MALYAN_M200_V2) - #include "stm32f0/pins_MALYAN_M200_V2.h" // STM32F0 env:STM32F070RB_malyan env:STM32F070CB_malyan + #include "stm32f0/pins_MALYAN_M200_V2.h" // STM32F0 env:STM32F070RB_malyan env:STM32F070CB_malyan #elif MB(MALYAN_M300) - #include "stm32f0/pins_MALYAN_M300.h" // STM32F070 env:malyan_M300 + #include "stm32f0/pins_MALYAN_M300.h" // STM32F0 env:malyan_M300 + +// +// STM32 ARM Cortex-M0+ +// + +#elif MB(BTT_EBB42_V1_1) + #include "stm32g0/pins_BTT_EBB42_V1_1.h" // STM32G0 env:BTT_EBB42_V1_1_filament_extruder +#elif MB(BTT_SKR_MINI_E3_V3_0) + #include "stm32g0/pins_BTT_SKR_MINI_E3_V3_0.h" // STM32G0 env:STM32G0B1RE_btt env:STM32G0B1RE_btt_xfer +#elif MB(BTT_MANTA_M4P_V1_0) + #include "stm32g0/pins_BTT_MANTA_M4P_V1_0.h" // STM32G0 env:STM32G0B1RE_manta_btt env:STM32G0B1RE_manta_btt_xfer +#elif MB(BTT_MANTA_M5P_V1_0) + #include "stm32g0/pins_BTT_MANTA_M5P_V1_0.h" // STM32G0 env:STM32G0B1RE_manta_btt env:STM32G0B1RE_manta_btt_xfer +#elif MB(BTT_MANTA_E3_EZ_V1_0) + #include "stm32g0/pins_BTT_MANTA_E3_EZ_V1_0.h" // STM32G0 env:STM32G0B1RE_manta_btt env:STM32G0B1RE_manta_btt_xfer +#elif MB(BTT_MANTA_M8P_V1_0) + #include "stm32g0/pins_BTT_MANTA_M8P_V1_0.h" // STM32G0 env:STM32G0B1VE_btt env:STM32G0B1VE_btt_xfer +#elif MB(BTT_MANTA_M8P_V1_1) + #include "stm32g0/pins_BTT_MANTA_M8P_V1_1.h" // STM32G0 env:STM32G0B1VE_btt env:STM32G0B1VE_btt_xfer // // STM32 ARM Cortex-M3 // #elif MB(STM32F103RE) - #include "stm32f1/pins_STM32F1R.h" // STM32F103RE env:STM32F103RE env:STM32F103RE_maple + #include "stm32f1/pins_STM32F1R.h" // STM32F1 env:STM32F103RE env:STM32F103RE_maple #elif MB(MALYAN_M200) - #include "stm32f1/pins_MALYAN_M200.h" // STM32F103CB env:STM32F103CB_malyan env:STM32F103CB_malyan_maple + #include "stm32f1/pins_MALYAN_M200.h" // STM32F1 env:STM32F103CB_malyan env:STM32F103CB_malyan_maple #elif MB(STM3R_MINI) - #include "stm32f1/pins_STM3R_MINI.h" // STM32F103VE? env:STM32F103VE env:STM32F103RE_maple + #include "stm32f1/pins_STM3R_MINI.h" // STM32F1 env:STM32F103VE env:STM32F103RE_maple #elif MB(GTM32_PRO_VB) - #include "stm32f1/pins_GTM32_PRO_VB.h" // STM32F103VE env:STM32F103VE env:STM32F103VE_GTM32_maple + #include "stm32f1/pins_GTM32_PRO_VB.h" // STM32F1 env:STM32F103VE env:STM32F103VE_GTM32_maple #elif MB(GTM32_PRO_VD) - #include "stm32f1/pins_GTM32_PRO_VD.h" // STM32F103VE env:STM32F103VE env:STM32F103VE_GTM32_maple + #include "stm32f1/pins_GTM32_PRO_VD.h" // STM32F1 env:STM32F103VE env:STM32F103VE_GTM32_maple #elif MB(GTM32_MINI) - #include "stm32f1/pins_GTM32_MINI.h" // STM32F103VE env:STM32F103VE env:STM32F103VE_GTM32_maple + #include "stm32f1/pins_GTM32_MINI.h" // STM32F1 env:STM32F103VE env:STM32F103VE_GTM32_maple #elif MB(GTM32_MINI_A30) - #include "stm32f1/pins_GTM32_MINI_A30.h" // STM32F103VE env:STM32F103VE env:STM32F103VE_GTM32_maple + #include "stm32f1/pins_GTM32_MINI_A30.h" // STM32F1 env:STM32F103VE env:STM32F103VE_GTM32_maple #elif MB(GTM32_REV_B) - #include "stm32f1/pins_GTM32_REV_B.h" // STM32F103VE env:STM32F103VE env:STM32F103VE_GTM32_maple + #include "stm32f1/pins_GTM32_REV_B.h" // STM32F1 env:STM32F103VE env:STM32F103VE_GTM32_maple #elif MB(MORPHEUS) - #include "stm32f1/pins_MORPHEUS.h" // STM32F103RE env:STM32F103RE env:STM32F103RE_maple + #include "stm32f1/pins_MORPHEUS.h" // STM32F1 env:STM32F103RE env:STM32F103RE_maple #elif MB(CHITU3D) - #include "stm32f1/pins_CHITU3D.h" // STM32F103ZE env:STM32F103ZE env:STM32F103RE_maple + #include "stm32f1/pins_CHITU3D.h" // STM32F1 env:STM32F103ZE env:STM32F103RE_maple #elif MB(MKS_ROBIN) - #include "stm32f1/pins_MKS_ROBIN.h" // STM32F1 env:mks_robin env:mks_robin_maple + #include "stm32f1/pins_MKS_ROBIN.h" // STM32F1 env:mks_robin env:mks_robin_maple #elif MB(MKS_ROBIN_MINI) - #include "stm32f1/pins_MKS_ROBIN_MINI.h" // STM32F1 env:mks_robin_mini env:mks_robin_mini_maple + #include "stm32f1/pins_MKS_ROBIN_MINI.h" // STM32F1 env:mks_robin_mini env:mks_robin_mini_maple #elif MB(MKS_ROBIN_NANO) - #include "stm32f1/pins_MKS_ROBIN_NANO.h" // STM32F1 env:mks_robin_nano_v1v2 env:mks_robin_nano_v1v2_maple env:mks_robin_nano_v1v2_usbmod + #include "stm32f1/pins_MKS_ROBIN_NANO.h" // STM32F1 env:mks_robin_nano_v1v2 env:mks_robin_nano_v1v2_maple env:mks_robin_nano_v1v2_usbmod #elif MB(MKS_ROBIN_NANO_V2) - #include "stm32f1/pins_MKS_ROBIN_NANO_V2.h" // STM32F1 env:mks_robin_nano_v1v2 env:mks_robin_nano_v1v2_maple + #include "stm32f1/pins_MKS_ROBIN_NANO_V2.h" // STM32F1 env:mks_robin_nano_v1v2 env:mks_robin_nano_v1v2_maple #elif MB(MKS_ROBIN_LITE) - #include "stm32f1/pins_MKS_ROBIN_LITE.h" // STM32F1 env:mks_robin_lite env:mks_robin_lite_maple + #include "stm32f1/pins_MKS_ROBIN_LITE.h" // STM32F1 env:mks_robin_lite env:mks_robin_lite_maple #elif MB(MKS_ROBIN_LITE3) - #include "stm32f1/pins_MKS_ROBIN_LITE3.h" // STM32F1 env:mks_robin_lite3 env:mks_robin_lite3_maple + #include "stm32f1/pins_MKS_ROBIN_LITE3.h" // STM32F1 env:mks_robin_lite3 env:mks_robin_lite3_maple #elif MB(MKS_ROBIN_PRO) - #include "stm32f1/pins_MKS_ROBIN_PRO.h" // STM32F1 env:mks_robin_pro env:mks_robin_pro_maple + #include "stm32f1/pins_MKS_ROBIN_PRO.h" // STM32F1 env:mks_robin_pro env:mks_robin_pro_maple #elif MB(MKS_ROBIN_E3) - #include "stm32f1/pins_MKS_ROBIN_E3.h" // STM32F1 env:mks_robin_e3 env:mks_robin_e3_maple + #include "stm32f1/pins_MKS_ROBIN_E3.h" // STM32F1 env:mks_robin_e3 env:mks_robin_e3_maple #elif MB(MKS_ROBIN_E3_V1_1) - #include "stm32f1/pins_MKS_ROBIN_E3_V1_1.h" // STM32F1 env:mks_robin_e3 + #include "stm32f1/pins_MKS_ROBIN_E3_V1_1.h" // STM32F1 env:mks_robin_e3 #elif MB(MKS_ROBIN_E3D) - #include "stm32f1/pins_MKS_ROBIN_E3D.h" // STM32F1 env:mks_robin_e3 + #include "stm32f1/pins_MKS_ROBIN_E3D.h" // STM32F1 env:mks_robin_e3 #elif MB(MKS_ROBIN_E3D_V1_1) - #include "stm32f1/pins_MKS_ROBIN_E3D_V1_1.h" // STM32F1 env:mks_robin_e3 env:mks_robin_e3_maple + #include "stm32f1/pins_MKS_ROBIN_E3D_V1_1.h" // STM32F1 env:mks_robin_e3 env:mks_robin_e3_maple #elif MB(MKS_ROBIN_E3P) - #include "stm32f1/pins_MKS_ROBIN_E3P.h" // STM32F1 env:mks_robin_e3p env:mks_robin_e3p_maple -#elif MB(BTT_EBB42_V1_1) - #include "stm32g0/pins_BTT_EBB42_V1_1.h" // STM32G0 env:BTT_EBB42_V1_1_filament_extruder + #include "stm32f1/pins_MKS_ROBIN_E3P.h" // STM32F1 env:mks_robin_e3p env:mks_robin_e3p_maple #elif MB(BTT_SKR_MINI_V1_1) - #include "stm32f1/pins_BTT_SKR_MINI_V1_1.h" // STM32F1 env:STM32F103RC_btt env:STM32F103RC_btt_USB env:STM32F103RC_btt_maple env:STM32F103RC_btt_USB_maple + #include "stm32f1/pins_BTT_SKR_MINI_V1_1.h" // STM32F1 env:STM32F103RC_btt env:STM32F103RC_btt_USB env:STM32F103RC_btt_maple env:STM32F103RC_btt_USB_maple #elif MB(BTT_SKR_MINI_E3_V1_0) - #include "stm32f1/pins_BTT_SKR_MINI_E3_V1_0.h" // STM32F1 env:STM32F103RC_btt env:STM32F103RC_btt_USB env:STM32F103RC_btt_maple env:STM32F103RC_btt_USB_maple + #include "stm32f1/pins_BTT_SKR_MINI_E3_V1_0.h" // STM32F1 env:STM32F103RC_btt env:STM32F103RC_btt_USB env:STM32F103RC_btt_maple env:STM32F103RC_btt_USB_maple #elif MB(BTT_SKR_MINI_E3_V1_2) - #include "stm32f1/pins_BTT_SKR_MINI_E3_V1_2.h" // STM32F1 env:STM32F103RC_btt env:STM32F103RC_btt_USB env:STM32F103RC_btt_maple env:STM32F103RC_btt_USB_maple + #include "stm32f1/pins_BTT_SKR_MINI_E3_V1_2.h" // STM32F1 env:STM32F103RC_btt env:STM32F103RC_btt_USB env:STM32F103RC_btt_maple env:STM32F103RC_btt_USB_maple #elif MB(BTT_SKR_MINI_E3_V2_0) - #include "stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h" // STM32F1 env:STM32F103RC_btt env:STM32F103RC_btt_USB env:STM32F103RE_btt env:STM32F103RE_btt_USB env:STM32F103RC_btt_maple env:STM32F103RC_btt_USB_maple env:STM32F103RE_btt_maple env:STM32F103RE_btt_USB_maple -#elif MB(BTT_SKR_MINI_E3_V3_0) - #include "stm32g0/pins_BTT_SKR_MINI_E3_V3_0.h" // STM32G0 env:STM32G0B1RE_btt env:STM32G0B1RE_btt_xfer -#elif MB(BTT_MANTA_M4P_V1_0) - #include "stm32g0/pins_BTT_MANTA_M4P_V1_0.h" // STM32G0 env:STM32G0B1RE_manta_btt env:STM32G0B1RE_manta_btt_xfer -#elif MB(BTT_MANTA_M5P_V1_0) - #include "stm32g0/pins_BTT_MANTA_M5P_V1_0.h" // STM32G0 env:STM32G0B1RE_manta_btt env:STM32G0B1RE_manta_btt_xfer -#elif MB(BTT_MANTA_E3_EZ_V1_0) - #include "stm32g0/pins_BTT_MANTA_E3_EZ_V1_0.h" // STM32G0 env:STM32G0B1RE_manta_btt env:STM32G0B1RE_manta_btt_xfer -#elif MB(BTT_MANTA_M8P_V1_0) - #include "stm32g0/pins_BTT_MANTA_M8P_V1_0.h" // STM32G0 env:STM32G0B1VE_btt env:STM32G0B1VE_btt_xfer -#elif MB(BTT_MANTA_M8P_V1_1) - #include "stm32g0/pins_BTT_MANTA_M8P_V1_1.h" // STM32G0 env:STM32G0B1VE_btt env:STM32G0B1VE_btt_xfer -#elif MB(BTT_SKR_MINI_E3_V3_0_1) - #include "stm32f4/pins_BTT_SKR_MINI_E3_V3_0_1.h"// STM32F4 env:STM32F401RC_btt + #include "stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h" // STM32F1 env:STM32F103RC_btt env:STM32F103RC_btt_USB env:STM32F103RE_btt env:STM32F103RE_btt_USB env:STM32F103RC_btt_maple env:STM32F103RC_btt_USB_maple env:STM32F103RE_btt_maple env:STM32F103RE_btt_USB_maple #elif MB(BTT_SKR_MINI_MZ_V1_0) - #include "stm32f1/pins_BTT_SKR_MINI_MZ_V1_0.h" // STM32F1 env:STM32F103RC_btt env:STM32F103RC_btt_USB env:STM32F103RC_btt_maple env:STM32F103RC_btt_USB_maple + #include "stm32f1/pins_BTT_SKR_MINI_MZ_V1_0.h" // STM32F1 env:STM32F103RC_btt env:STM32F103RC_btt_USB env:STM32F103RC_btt_maple env:STM32F103RC_btt_USB_maple #elif MB(BTT_SKR_E3_DIP) - #include "stm32f1/pins_BTT_SKR_E3_DIP.h" // STM32F1 env:STM32F103RC_btt env:STM32F103RC_btt_USB env:STM32F103RE_btt env:STM32F103RE_btt_USB env:STM32F103RC_btt_maple env:STM32F103RC_btt_USB_maple env:STM32F103RE_btt_maple env:STM32F103RE_btt_USB_maple + #include "stm32f1/pins_BTT_SKR_E3_DIP.h" // STM32F1 env:STM32F103RC_btt env:STM32F103RC_btt_USB env:STM32F103RE_btt env:STM32F103RE_btt_USB env:STM32F103RC_btt_maple env:STM32F103RC_btt_USB_maple env:STM32F103RE_btt_maple env:STM32F103RE_btt_USB_maple #elif MB(BTT_SKR_CR6) - #include "stm32f1/pins_BTT_SKR_CR6.h" // STM32F1 env:STM32F103RE_btt env:STM32F103RE_btt_USB env:STM32F103RE_btt_maple env:STM32F103RE_btt_USB_maple + #include "stm32f1/pins_BTT_SKR_CR6.h" // STM32F1 env:STM32F103RE_btt env:STM32F103RE_btt_USB env:STM32F103RE_btt_maple env:STM32F103RE_btt_USB_maple #elif MB(JGAURORA_A5S_A1) - #include "stm32f1/pins_JGAURORA_A5S_A1.h" // STM32F1 env:jgaurora_a5s_a1 env:jgaurora_a5s_a1_maple + #include "stm32f1/pins_JGAURORA_A5S_A1.h" // STM32F1 env:jgaurora_a5s_a1 env:jgaurora_a5s_a1_maple #elif MB(FYSETC_AIO_II) - #include "stm32f1/pins_FYSETC_AIO_II.h" // STM32F1 env:STM32F103RC_fysetc env:STM32F103RC_fysetc_maple + #include "stm32f1/pins_FYSETC_AIO_II.h" // STM32F1 env:STM32F103RC_fysetc env:STM32F103RC_fysetc_maple #elif MB(FYSETC_CHEETAH) - #include "stm32f1/pins_FYSETC_CHEETAH.h" // STM32F1 env:STM32F103RC_fysetc env:STM32F103RC_fysetc_maple + #include "stm32f1/pins_FYSETC_CHEETAH.h" // STM32F1 env:STM32F103RC_fysetc env:STM32F103RC_fysetc_maple #elif MB(FYSETC_CHEETAH_V12) - #include "stm32f1/pins_FYSETC_CHEETAH_V12.h" // STM32F1 env:STM32F103RC_fysetc env:STM32F103RC_fysetc_maple + #include "stm32f1/pins_FYSETC_CHEETAH_V12.h" // STM32F1 env:STM32F103RC_fysetc env:STM32F103RC_fysetc_maple #elif MB(LONGER3D_LK) - #include "stm32f1/pins_LONGER3D_LK.h" // STM32F1 env:STM32F103VE_longer env:STM32F103VE_longer_maple + #include "stm32f1/pins_LONGER3D_LK.h" // STM32F1 env:STM32F103VE_longer env:STM32F103VE_longer_maple #elif MB(CCROBOT_MEEB_3DP) - #include "stm32f1/pins_CCROBOT_MEEB_3DP.h" // STM32F1 env:STM32F103RC_meeb_maple + #include "stm32f1/pins_CCROBOT_MEEB_3DP.h" // STM32F1 env:STM32F103RC_meeb_maple #elif MB(CHITU3D_V5) - #include "stm32f1/pins_CHITU3D_V5.h" // STM32F1 env:chitu_f103 env:chitu_f103_maple env:chitu_v5_gpio_init env:chitu_v5_gpio_init_maple + #include "stm32f1/pins_CHITU3D_V5.h" // STM32F1 env:chitu_f103 env:chitu_f103_maple env:chitu_v5_gpio_init env:chitu_v5_gpio_init_maple #elif MB(CHITU3D_V6) - #include "stm32f1/pins_CHITU3D_V6.h" // STM32F1 env:chitu_f103 env:chitu_f103_maple + #include "stm32f1/pins_CHITU3D_V6.h" // STM32F1 env:chitu_f103 env:chitu_f103_maple #elif MB(CHITU3D_V9) - #include "stm32f1/pins_CHITU3D_V9.h" // STM32F1 env:chitu_f103 env:chitu_f103_maple + #include "stm32f1/pins_CHITU3D_V9.h" // STM32F1 env:chitu_f103 env:chitu_f103_maple #elif MB(CREALITY_V4) - #include "stm32f1/pins_CREALITY_V4.h" // STM32F1 env:STM32F103RE_creality env:STM32F103RE_creality_xfer env:STM32F103RC_creality env:STM32F103RC_creality_xfer env:STM32F103RE_creality_maple + #include "stm32f1/pins_CREALITY_V4.h" // STM32F1 env:STM32F103RE_creality env:STM32F103RE_creality_xfer env:STM32F103RC_creality env:STM32F103RC_creality_xfer env:STM32F103RE_creality_maple #elif MB(CREALITY_V4210) - #include "stm32f1/pins_CREALITY_V4210.h" // STM32F1 env:STM32F103RE_creality env:STM32F103RE_creality_xfer env:STM32F103RC_creality env:STM32F103RC_creality_xfer env:STM32F103RE_creality_maple + #include "stm32f1/pins_CREALITY_V4210.h" // STM32F1 env:STM32F103RE_creality env:STM32F103RE_creality_xfer env:STM32F103RC_creality env:STM32F103RC_creality_xfer env:STM32F103RE_creality_maple #elif MB(CREALITY_V425) - #include "stm32f1/pins_CREALITY_V425.h" // STM32F1 env:STM32F103RE_creality env:STM32F103RE_creality_xfer env:STM32F103RC_creality env:STM32F103RC_creality_xfer env:STM32F103RE_creality_maple + #include "stm32f1/pins_CREALITY_V425.h" // STM32F1 env:STM32F103RE_creality env:STM32F103RE_creality_xfer env:STM32F103RC_creality env:STM32F103RC_creality_xfer env:STM32F103RE_creality_maple #elif MB(CREALITY_V422) - #include "stm32f1/pins_CREALITY_V422.h" // STM32F1 env:STM32F103RE_creality env:STM32F103RE_creality_xfer env:STM32F103RC_creality env:STM32F103RC_creality_xfer env:STM32F103RE_creality_maple + #include "stm32f1/pins_CREALITY_V422.h" // STM32F1 env:STM32F103RE_creality env:STM32F103RE_creality_xfer env:STM32F103RC_creality env:STM32F103RC_creality_xfer env:STM32F103RE_creality_maple #elif MB(CREALITY_V423) - #include "stm32f1/pins_CREALITY_V423.h" // STM32F1 env:STM32F103RE_creality env:STM32F103RE_creality_xfer env:STM32F103RC_creality env:STM32F103RC_creality_xfer + #include "stm32f1/pins_CREALITY_V423.h" // STM32F1 env:STM32F103RE_creality env:STM32F103RE_creality_xfer env:STM32F103RC_creality env:STM32F103RC_creality_xfer #elif MB(CREALITY_V427) - #include "stm32f1/pins_CREALITY_V427.h" // STM32F1 env:STM32F103RE_creality env:STM32F103RE_creality_xfer env:STM32F103RC_creality env:STM32F103RC_creality_xfer env:STM32F103RE_creality_maple + #include "stm32f1/pins_CREALITY_V427.h" // STM32F1 env:STM32F103RE_creality env:STM32F103RE_creality_xfer env:STM32F103RC_creality env:STM32F103RC_creality_xfer env:STM32F103RE_creality_maple #elif MB(CREALITY_V431, CREALITY_V431_A, CREALITY_V431_B, CREALITY_V431_C, CREALITY_V431_D) - #include "stm32f1/pins_CREALITY_V431.h" // STM32F1 env:STM32F103RE_creality env:STM32F103RE_creality_xfer env:STM32F103RC_creality env:STM32F103RC_creality_xfer env:STM32F103RE_creality_maple + #include "stm32f1/pins_CREALITY_V431.h" // STM32F1 env:STM32F103RE_creality env:STM32F103RE_creality_xfer env:STM32F103RC_creality env:STM32F103RC_creality_xfer env:STM32F103RE_creality_maple #elif MB(CREALITY_V452) - #include "stm32f1/pins_CREALITY_V452.h" // STM32F1 env:STM32F103RE_creality env:STM32F103RE_creality_xfer env:STM32F103RC_creality env:STM32F103RC_creality_xfer env:STM32F103RE_creality_maple + #include "stm32f1/pins_CREALITY_V452.h" // STM32F1 env:STM32F103RE_creality env:STM32F103RE_creality_xfer env:STM32F103RC_creality env:STM32F103RC_creality_xfer env:STM32F103RE_creality_maple #elif MB(CREALITY_V453) - #include "stm32f1/pins_CREALITY_V453.h" // STM32F1 env:STM32F103RE_creality env:STM32F103RE_creality_xfer env:STM32F103RC_creality env:STM32F103RC_creality_xfer env:STM32F103RE_creality_maple + #include "stm32f1/pins_CREALITY_V453.h" // STM32F1 env:STM32F103RE_creality env:STM32F103RE_creality_xfer env:STM32F103RC_creality env:STM32F103RC_creality_xfer env:STM32F103RE_creality_maple #elif MB(CREALITY_V24S1) - #include "stm32f1/pins_CREALITY_V24S1.h" // STM32F1 env:STM32F103RE_creality env:STM32F103RE_creality_xfer env:STM32F103RC_creality env:STM32F103RC_creality_xfer env:STM32F103RE_creality_maple + #include "stm32f1/pins_CREALITY_V24S1.h" // STM32F1 env:STM32F103RE_creality env:STM32F103RE_creality_xfer env:STM32F103RC_creality env:STM32F103RC_creality_xfer env:STM32F103RE_creality_maple #elif MB(CREALITY_V24S1_301) - #include "stm32f1/pins_CREALITY_V24S1_301.h" // STM32F1 env:STM32F103RE_creality env:STM32F103RE_creality_xfer env:STM32F103RC_creality env:STM32F103RC_creality_xfer env:STM32F103RE_creality_maple + #include "stm32f1/pins_CREALITY_V24S1_301.h" // STM32F1 env:STM32F103RE_creality env:STM32F103RE_creality_xfer env:STM32F103RC_creality env:STM32F103RC_creality_xfer env:STM32F103RE_creality_maple #elif MB(CREALITY_V25S1) - #include "stm32f1/pins_CREALITY_V25S1.h" // STM32F1 env:STM32F103RE_creality_smartPro env:STM32F103RE_creality_smartPro_maple + #include "stm32f1/pins_CREALITY_V25S1.h" // STM32F1 env:STM32F103RE_creality_smartPro env:STM32F103RE_creality_smartPro_maple #elif MB(CREALITY_V521) - #include "stm32f1/pins_CREALITY_V521.h" // STM32F103VE env:STM32F103VE_creality + #include "stm32f1/pins_CREALITY_V521.h" // STM32F1 env:STM32F103VE_creality #elif MB(TRIGORILLA_PRO) - #include "stm32f1/pins_TRIGORILLA_PRO.h" // STM32F1 env:trigorilla_pro env:trigorilla_pro_maple env:trigorilla_pro_disk + #include "stm32f1/pins_TRIGORILLA_PRO.h" // STM32F1 env:trigorilla_pro env:trigorilla_pro_maple env:trigorilla_pro_disk #elif MB(FLY_MINI) - #include "stm32f1/pins_FLY_MINI.h" // STM32F1 env:FLY_MINI env:FLY_MINI_maple + #include "stm32f1/pins_FLY_MINI.h" // STM32F1 env:FLY_MINI env:FLY_MINI_maple #elif MB(FLSUN_HISPEED) - #include "stm32f1/pins_FLSUN_HISPEED.h" // STM32F1 env:flsun_hispeedv1 + #include "stm32f1/pins_FLSUN_HISPEED.h" // STM32F1 env:flsun_hispeedv1 #elif MB(BEAST) - #include "stm32f1/pins_BEAST.h" // STM32F103VE? env:STM32F103VE env:STM32F103RE_maple + #include "stm32f1/pins_BEAST.h" // STM32F1 env:STM32F103VE env:STM32F103RE_maple #elif MB(MINGDA_MPX_ARM_MINI) - #include "stm32f1/pins_MINGDA_MPX_ARM_MINI.h" // STM32F1 env:mingda_mpx_arm_mini + #include "stm32f1/pins_MINGDA_MPX_ARM_MINI.h" // STM32F1 env:mingda_mpx_arm_mini #elif MB(ZONESTAR_ZM3E2) - #include "stm32f1/pins_ZM3E2_V1_0.h" // STM32F1 env:STM32F103RC_ZM3E2_USB env:STM32F103RC_ZM3E2_USB_maple + #include "stm32f1/pins_ZM3E2_V1_0.h" // STM32F1 env:STM32F103RC_ZM3E2_USB env:STM32F103RC_ZM3E2_USB_maple #elif MB(ZONESTAR_ZM3E4) - #include "stm32f1/pins_ZM3E4_V1_0.h" // STM32F1 env:STM32F103VC_ZM3E4_USB env:STM32F103VC_ZM3E4_USB_maple + #include "stm32f1/pins_ZM3E4_V1_0.h" // STM32F1 env:STM32F103VC_ZM3E4_USB env:STM32F103VC_ZM3E4_USB_maple #elif MB(ZONESTAR_ZM3E4V2) - #include "stm32f1/pins_ZM3E4_V2_0.h" // STM32F1 env:STM32F103VE_ZM3E4V2_USB env:STM32F103VE_ZM3E4V2_USB_maple + #include "stm32f1/pins_ZM3E4_V2_0.h" // STM32F1 env:STM32F103VE_ZM3E4V2_USB env:STM32F103VE_ZM3E4V2_USB_maple #elif MB(ERYONE_ERY32_MINI) - #include "stm32f1/pins_ERYONE_ERY32_MINI.h" // STM32F103VET6 env:ERYONE_ERY32_MINI_maple + #include "stm32f1/pins_ERYONE_ERY32_MINI.h" // STM32F1 env:ERYONE_ERY32_MINI_maple #elif MB(PANDA_PI_V29) - #include "stm32f1/pins_PANDA_PI_V29.h" // STM32F103RCT6 env:PANDA_PI_V29 + #include "stm32f1/pins_PANDA_PI_V29.h" // STM32F1 env:PANDA_PI_V29 #elif MB(SOVOL_V131) - #include "gd32f1/pins_SOVOL_V131.h" // GD32F1 env:GD32F103RET6_sovol_maple + #include "gd32f1/pins_SOVOL_V131.h" // GD32F1 env:GD32F103RET6_sovol_maple #elif MB(TRIGORILLA_V006) - #include "gd32f1/pins_TRIGORILLA_V006.h" // GD32F103 env:trigorilla_v006 + #include "gd32f1/pins_TRIGORILLA_V006.h" // GD32F1 env:trigorilla_v006 #elif MB(KEDI_CONTROLLER_V1_2) - #include "stm32f1/pins_KEDI_CONTROLLER_V1_2.h" // STM32F1 env:STM32F103RC_btt env:STM32F103RC_btt_USB env:STM32F103RC_btt_maple env:STM32F103RC_btt_USB_maple + #include "stm32f1/pins_KEDI_CONTROLLER_V1_2.h" // STM32F1 env:STM32F103RC_btt env:STM32F103RC_btt_USB env:STM32F103RC_btt_maple env:STM32F103RC_btt_USB_maple // // ARM Cortex-M4F // #elif MB(TEENSY31_32) - #include "teensy3/pins_TEENSY31_32.h" // TEENSY31_32 env:teensy31 + #include "teensy3/pins_TEENSY31_32.h" // TEENSY31_32 env:teensy31 #elif MB(TEENSY35_36) - #include "teensy3/pins_TEENSY35_36.h" // TEENSY35_36 env:teensy35 env:teensy36 + #include "teensy3/pins_TEENSY35_36.h" // TEENSY35_36 env:teensy35 env:teensy36 // // STM32 ARM Cortex-M4F // #elif MB(ARMED) - #include "stm32f4/pins_ARMED.h" // STM32F4 env:ARMED + #include "stm32f4/pins_ARMED.h" // STM32F4 env:ARMED #elif MB(RUMBA32_V1_0, RUMBA32_V1_1) - #include "stm32f4/pins_RUMBA32_AUS3D.h" // STM32F4 env:rumba32 + #include "stm32f4/pins_RUMBA32_AUS3D.h" // STM32F4 env:rumba32 #elif MB(RUMBA32_MKS) - #include "stm32f4/pins_RUMBA32_MKS.h" // STM32F4 env:rumba32 + #include "stm32f4/pins_RUMBA32_MKS.h" // STM32F4 env:rumba32 #elif MB(RUMBA32_BTT) - #include "stm32f4/pins_RUMBA32_BTT.h" // STM32F4 env:rumba32 + #include "stm32f4/pins_RUMBA32_BTT.h" // STM32F4 env:rumba32 #elif MB(BLACK_STM32F407VE) - #include "stm32f4/pins_BLACK_STM32F407VE.h" // STM32F4 env:STM32F407VE_black + #include "stm32f4/pins_BLACK_STM32F407VE.h" // STM32F4 env:STM32F407VE_black #elif MB(BTT_SKR_PRO_V1_1) - #include "stm32f4/pins_BTT_SKR_PRO_V1_1.h" // STM32F4 env:BIGTREE_SKR_PRO env:BIGTREE_SKR_PRO_usb_flash_drive + #include "stm32f4/pins_BTT_SKR_PRO_V1_1.h" // STM32F4 env:BIGTREE_SKR_PRO env:BIGTREE_SKR_PRO_usb_flash_drive #elif MB(BTT_SKR_PRO_V1_2) - #include "stm32f4/pins_BTT_SKR_PRO_V1_2.h" // STM32F4 env:BIGTREE_SKR_PRO env:BIGTREE_SKR_PRO_usb_flash_drive + #include "stm32f4/pins_BTT_SKR_PRO_V1_2.h" // STM32F4 env:BIGTREE_SKR_PRO env:BIGTREE_SKR_PRO_usb_flash_drive #elif MB(BTT_GTR_V1_0) - #include "stm32f4/pins_BTT_GTR_V1_0.h" // STM32F4 env:BIGTREE_GTR_V1_0 env:BIGTREE_GTR_V1_0_usb_flash_drive + #include "stm32f4/pins_BTT_GTR_V1_0.h" // STM32F4 env:BIGTREE_GTR_V1_0 env:BIGTREE_GTR_V1_0_usb_flash_drive #elif MB(BTT_BTT002_V1_0) - #include "stm32f4/pins_BTT_BTT002_V1_0.h" // STM32F4 env:BIGTREE_BTT002 env:BIGTREE_BTT002_VET6 + #include "stm32f4/pins_BTT_BTT002_V1_0.h" // STM32F4 env:BIGTREE_BTT002 env:BIGTREE_BTT002_VET6 #elif MB(BTT_E3_RRF) - #include "stm32f4/pins_BTT_E3_RRF.h" // STM32F4 env:BIGTREE_E3_RRF + #include "stm32f4/pins_BTT_E3_RRF.h" // STM32F4 env:BIGTREE_E3_RRF +#elif MB(BTT_SKR_MINI_E3_V3_0_1) + #include "stm32f4/pins_BTT_SKR_MINI_E3_V3_0_1.h" // STM32F4 env:STM32F401RC_btt env:STM32F401RC_btt_xfer #elif MB(BTT_SKR_V2_0_REV_A) - #include "stm32f4/pins_BTT_SKR_V2_0_REV_A.h" // STM32F4 env:BIGTREE_SKR_2 env:BIGTREE_SKR_2_USB env:BIGTREE_SKR_2_USB_debug + #include "stm32f4/pins_BTT_SKR_V2_0_REV_A.h" // STM32F4 env:BIGTREE_SKR_2 env:BIGTREE_SKR_2_USB env:BIGTREE_SKR_2_USB_debug #elif MB(BTT_SKR_V2_0_REV_B) - #include "stm32f4/pins_BTT_SKR_V2_0_REV_B.h" // STM32F4 env:BIGTREE_SKR_2 env:BIGTREE_SKR_2_USB env:BIGTREE_SKR_2_USB_debug env:BIGTREE_SKR_2_F429 env:BIGTREE_SKR_2_F429_USB env:BIGTREE_SKR_2_F429_USB_debug + #include "stm32f4/pins_BTT_SKR_V2_0_REV_B.h" // STM32F4 env:BIGTREE_SKR_2 env:BIGTREE_SKR_2_USB env:BIGTREE_SKR_2_USB_debug env:BIGTREE_SKR_2_F429 env:BIGTREE_SKR_2_F429_USB env:BIGTREE_SKR_2_F429_USB_debug #elif MB(BTT_OCTOPUS_V1_0) - #include "stm32f4/pins_BTT_OCTOPUS_V1_0.h" // STM32F4 env:STM32F446ZE_btt env:STM32F446ZE_btt_USB + #include "stm32f4/pins_BTT_OCTOPUS_V1_0.h" // STM32F4 env:STM32F446ZE_btt env:STM32F446ZE_btt_USB #elif MB(BTT_OCTOPUS_V1_1) - #include "stm32f4/pins_BTT_OCTOPUS_V1_1.h" // STM32F4 env:STM32F446ZE_btt env:STM32F446ZE_btt_USB env:STM32F429ZG_btt env:STM32F429ZG_btt_USB env:STM32F407ZE_btt env:STM32F407ZE_btt_USB + #include "stm32f4/pins_BTT_OCTOPUS_V1_1.h" // STM32F4 env:STM32F446ZE_btt env:STM32F446ZE_btt_USB env:STM32F429ZG_btt env:STM32F429ZG_btt_USB env:STM32F407ZE_btt env:STM32F407ZE_btt_USB #elif MB(BTT_OCTOPUS_PRO_V1_0) - #include "stm32f4/pins_BTT_OCTOPUS_PRO_V1_0.h" // STM32F4 env:STM32F446ZE_btt env:STM32F446ZE_btt_USB env:STM32F429ZG_btt env:STM32F429ZG_btt_USB env:STM32H723Zx_btt + #include "stm32f4/pins_BTT_OCTOPUS_PRO_V1_0.h" // STM32F4 env:STM32F446ZE_btt env:STM32F446ZE_btt_USB env:STM32F429ZG_btt env:STM32F429ZG_btt_USB env:STM32H723ZE_btt #elif MB(LERDGE_K) - #include "stm32f4/pins_LERDGE_K.h" // STM32F4 env:LERDGEK env:LERDGEK_usb_flash_drive + #include "stm32f4/pins_LERDGE_K.h" // STM32F4 env:LERDGEK env:LERDGEK_usb_flash_drive #elif MB(LERDGE_S) - #include "stm32f4/pins_LERDGE_S.h" // STM32F4 env:LERDGES env:LERDGES_usb_flash_drive + #include "stm32f4/pins_LERDGE_S.h" // STM32F4 env:LERDGES env:LERDGES_usb_flash_drive #elif MB(LERDGE_X) - #include "stm32f4/pins_LERDGE_X.h" // STM32F4 env:LERDGEX env:LERDGEX_usb_flash_drive -#elif MB(VAKE403D) - #include "stm32f4/pins_VAKE403D.h" // STM32F4 + #include "stm32f4/pins_LERDGE_X.h" // STM32F4 env:LERDGEX env:LERDGEX_usb_flash_drive #elif MB(FYSETC_S6) - #include "stm32f4/pins_FYSETC_S6.h" // STM32F4 env:FYSETC_S6 env:FYSETC_S6_8000 + #include "stm32f4/pins_FYSETC_S6.h" // STM32F4 env:FYSETC_S6 env:FYSETC_S6_8000 #elif MB(FYSETC_S6_V2_0) - #include "stm32f4/pins_FYSETC_S6_V2_0.h" // STM32F4 env:FYSETC_S6 env:FYSETC_S6_8000 + #include "stm32f4/pins_FYSETC_S6_V2_0.h" // STM32F4 env:FYSETC_S6 env:FYSETC_S6_8000 #elif MB(FYSETC_SPIDER) - #include "stm32f4/pins_FYSETC_SPIDER.h" // STM32F4 env:FYSETC_S6 env:FYSETC_S6_8000 + #include "stm32f4/pins_FYSETC_SPIDER.h" // STM32F4 env:FYSETC_S6 env:FYSETC_S6_8000 #elif MB(FYSETC_SPIDER_V2_2) - #include "stm32f4/pins_FYSETC_SPIDER_V2_2.h" // STM32F4 env:FYSETC_S6 env:FYSETC_S6_8000 + #include "stm32f4/pins_FYSETC_SPIDER_V2_2.h" // STM32F4 env:FYSETC_S6 env:FYSETC_S6_8000 #elif MB(FLYF407ZG) - #include "stm32f4/pins_FLYF407ZG.h" // STM32F4 env:FLYF407ZG + #include "stm32f4/pins_FLYF407ZG.h" // STM32F4 env:FLYF407ZG #elif MB(MKS_ROBIN2) - #include "stm32f4/pins_MKS_ROBIN2.h" // STM32F4 env:mks_robin2 + #include "stm32f4/pins_MKS_ROBIN2.h" // STM32F4 env:mks_robin2 #elif MB(MKS_ROBIN_PRO_V2) - #include "stm32f4/pins_MKS_ROBIN_PRO_V2.h" // STM32F4 env:mks_robin_pro2 + #include "stm32f4/pins_MKS_ROBIN_PRO_V2.h" // STM32F4 env:mks_robin_pro2 #elif MB(MKS_ROBIN_NANO_V3) - #include "stm32f4/pins_MKS_ROBIN_NANO_V3.h" // STM32F4 env:mks_robin_nano_v3 env:mks_robin_nano_v3_usb_flash_drive env:mks_robin_nano_v3_usb_flash_drive_msc + #include "stm32f4/pins_MKS_ROBIN_NANO_V3.h" // STM32F4 env:mks_robin_nano_v3 env:mks_robin_nano_v3_usb_flash_drive env:mks_robin_nano_v3_usb_flash_drive_msc #elif MB(MKS_ROBIN_NANO_V3_1) - #include "stm32f4/pins_MKS_ROBIN_NANO_V3.h" // STM32F4 env:mks_robin_nano_v3_1 env:mks_robin_nano_v3_1_usb_flash_drive env:mks_robin_nano_v3_1_usb_flash_drive_msc + #include "stm32f4/pins_MKS_ROBIN_NANO_V3.h" // STM32F4 env:mks_robin_nano_v3_1 env:mks_robin_nano_v3_1_usb_flash_drive env:mks_robin_nano_v3_1_usb_flash_drive_msc #elif MB(ANET_ET4) - #include "stm32f4/pins_ANET_ET4.h" // STM32F4 env:Anet_ET4_no_bootloader env:Anet_ET4_OpenBLT + #include "stm32f4/pins_ANET_ET4.h" // STM32F4 env:Anet_ET4_no_bootloader env:Anet_ET4_OpenBLT #elif MB(ANET_ET4P) - #include "stm32f4/pins_ANET_ET4P.h" // STM32F4 env:Anet_ET4_no_bootloader env:Anet_ET4_OpenBLT + #include "stm32f4/pins_ANET_ET4P.h" // STM32F4 env:Anet_ET4_no_bootloader env:Anet_ET4_OpenBLT #elif MB(FYSETC_CHEETAH_V20) - #include "stm32f4/pins_FYSETC_CHEETAH_V20.h" // STM32F4 env:FYSETC_CHEETAH_V20 + #include "stm32f4/pins_FYSETC_CHEETAH_V20.h" // STM32F4 env:FYSETC_CHEETAH_V20 #elif MB(MKS_MONSTER8_V1) - #include "stm32f4/pins_MKS_MONSTER8_V1.h" // STM32F4 env:mks_monster8 env:mks_monster8_usb_flash_drive env:mks_monster8_usb_flash_drive_msc + #include "stm32f4/pins_MKS_MONSTER8_V1.h" // STM32F4 env:mks_monster8 env:mks_monster8_usb_flash_drive env:mks_monster8_usb_flash_drive_msc #elif MB(MKS_MONSTER8_V2) - #include "stm32f4/pins_MKS_MONSTER8_V2.h" // STM32F4 env:mks_monster8 env:mks_monster8_usb_flash_drive env:mks_monster8_usb_flash_drive_msc + #include "stm32f4/pins_MKS_MONSTER8_V2.h" // STM32F4 env:mks_monster8 env:mks_monster8_usb_flash_drive env:mks_monster8_usb_flash_drive_msc #elif MB(TH3D_EZBOARD_V2) - #include "stm32f4/pins_TH3D_EZBOARD_V2.h" // STM32F4 env:TH3D_EZBoard_V2_no_bootloader env:TH3D_EZBoard_V2_OpenBLT + #include "stm32f4/pins_TH3D_EZBOARD_V2.h" // STM32F4 env:TH3D_EZBoard_V2_no_bootloader env:TH3D_EZBoard_V2_OpenBLT #elif MB(OPULO_LUMEN_REV3) - #include "stm32f4/pins_OPULO_LUMEN_REV3.h" // STM32F4 env:Opulo_Lumen_REV3 + #include "stm32f4/pins_OPULO_LUMEN_REV3.h" // STM32F4 env:Opulo_Lumen_REV3 #elif MB(MKS_ROBIN_NANO_V1_3_F4) - #include "stm32f4/pins_MKS_ROBIN_NANO_V1_3_F4.h" // STM32F4 env:mks_robin_nano_v1_3_f4 env:mks_robin_nano_v1_3_f4_usbmod + #include "stm32f4/pins_MKS_ROBIN_NANO_V1_3_F4.h" // STM32F4 env:mks_robin_nano_v1_3_f4 env:mks_robin_nano_v1_3_f4_usbmod #elif MB(MKS_EAGLE) - #include "stm32f4/pins_MKS_EAGLE.h" // STM32F4 env:mks_eagle + #include "stm32f4/pins_MKS_EAGLE.h" // STM32F4 env:mks_eagle #elif MB(ARTILLERY_RUBY) - #include "stm32f4/pins_ARTILLERY_RUBY.h" // STM32F4 env:Artillery_Ruby + #include "stm32f4/pins_ARTILLERY_RUBY.h" // STM32F4 env:Artillery_Ruby #elif MB(CREALITY_V24S1_301F4) - #include "stm32f4/pins_CREALITY_V24S1_301F4.h" // STM32F4 env:STM32F401RC_creality env:STM32F401RC_creality_jlink env:STM32F401RC_creality_stlink + #include "stm32f4/pins_CREALITY_V24S1_301F4.h" // STM32F4 env:STM32F401RC_creality env:STM32F401RC_creality_jlink env:STM32F401RC_creality_stlink #elif MB(OPULO_LUMEN_REV4) - #include "stm32f4/pins_OPULO_LUMEN_REV4.h" // STM32F4 env:Opulo_Lumen_REV4 + #include "stm32f4/pins_OPULO_LUMEN_REV4.h" // STM32F4 env:Opulo_Lumen_REV4 #elif MB(FYSETC_SPIDER_KING407) - #include "stm32f4/pins_FYSETC_SPIDER_KING407.h" // STM32F4 env:FYSETC_SPIDER_KING407 + #include "stm32f4/pins_FYSETC_SPIDER_KING407.h" // STM32F4 env:FYSETC_SPIDER_KING407 #elif MB(MKS_SKIPR_V1) - #include "stm32f4/pins_MKS_SKIPR_V1_0.h" // STM32F4 env:mks_skipr_v1 env:mks_skipr_v1_nobootloader + #include "stm32f4/pins_MKS_SKIPR_V1_0.h" // STM32F4 env:mks_skipr_v1 env:mks_skipr_v1_nobootloader #elif MB(TRONXY_V10) - #include "stm32f4/pins_TRONXY_V10.h" // STM32F4 env:STM32F446_tronxy + #include "stm32f4/pins_TRONXY_V10.h" // STM32F4 env:STM32F446_tronxy #elif MB(CREALITY_F401RE) - #include "stm32f4/pins_CREALITY_F401.h" // STM32F4 env:STM32F401RE_creality + #include "stm32f4/pins_CREALITY_F401.h" // STM32F4 env:STM32F401RE_creality #elif MB(BLACKPILL_CUSTOM) - #include "stm32f4/pins_BLACKPILL_CUSTOM.h" // STM32F4 env:STM32F401CD_blackpill_stlink + #include "stm32f4/pins_BLACKPILL_CUSTOM.h" // STM32F4 env:STM32F401CD_blackpill_stlink #elif MB(I3DBEEZ9_V1) - #include "stm32f4/pins_I3DBEEZ9.h" // STM32F4 env:I3DBEEZ9_V1 + #include "stm32f4/pins_I3DBEEZ9.h" // STM32F4 env:I3DBEEZ9_V1 // -// ARM Cortex M7 +// ARM Cortex-M7 // #elif MB(REMRAM_V1) - #include "stm32f7/pins_REMRAM_V1.h" // STM32F7 env:REMRAM_V1 + #include "stm32f7/pins_REMRAM_V1.h" // STM32F7 env:REMRAM_V1 #elif MB(NUCLEO_F767ZI) - #include "stm32f7/pins_NUCLEO_F767ZI.h" // STM32F7 env:NUCLEO_F767ZI + #include "stm32f7/pins_NUCLEO_F767ZI.h" // STM32F7 env:NUCLEO_F767ZI #elif MB(BTT_SKR_SE_BX_V2) - #include "stm32h7/pins_BTT_SKR_SE_BX_V2.h" // STM32H7 env:BTT_SKR_SE_BX + #include "stm32h7/pins_BTT_SKR_SE_BX_V2.h" // STM32H7 env:BTT_SKR_SE_BX #elif MB(BTT_SKR_SE_BX_V3) - #include "stm32h7/pins_BTT_SKR_SE_BX_V3.h" // STM32H7 env:BTT_SKR_SE_BX + #include "stm32h7/pins_BTT_SKR_SE_BX_V3.h" // STM32H7 env:BTT_SKR_SE_BX #elif MB(BTT_SKR_V3_0) - #include "stm32h7/pins_BTT_SKR_V3_0.h" // STM32H743Vx/STM32H723VG env:STM32H743Vx_btt env:STM32H723VG_btt + #include "stm32h7/pins_BTT_SKR_V3_0.h" // STM32H7 env:STM32H743VI_btt env:STM32H723VG_btt #elif MB(BTT_SKR_V3_0_EZ) - #include "stm32h7/pins_BTT_SKR_V3_0_EZ.h" // STM32H743Vx/STM32H723VG env:STM32H743Vx_btt env:STM32H723VG_btt + #include "stm32h7/pins_BTT_SKR_V3_0_EZ.h" // STM32H7 env:STM32H743VI_btt env:STM32H723VG_btt #elif MB(BTT_OCTOPUS_MAX_EZ_V1_0) - #include "stm32h7/pins_BTT_OCTOPUS_MAX_EZ.h" // STM32H723Zx/STM32H723VE env:STM32H723Zx_btt env:STM32H723VE_btt + #include "stm32h7/pins_BTT_OCTOPUS_MAX_EZ.h" // STM32H7 env:STM32H723ZE_btt #elif MB(TEENSY41) - #include "teensy4/pins_TEENSY41.h" // Teensy-4.x env:teensy41 + #include "teensy4/pins_TEENSY41.h" // Teensy-4.x env:teensy41 #elif MB(T41U5XBB) - #include "teensy4/pins_T41U5XBB.h" // Teensy-4.x env:teensy41 + #include "teensy4/pins_T41U5XBB.h" // Teensy-4.x env:teensy41 // // Espressif ESP32 // #elif MB(ESPRESSIF_ESP32) - #include "esp32/pins_ESP32.h" // ESP32 env:esp32 + #include "esp32/pins_ESP32.h" // ESP32 env:esp32 #elif MB(MRR_ESPA) - #include "esp32/pins_MRR_ESPA.h" // ESP32 env:esp32 + #include "esp32/pins_MRR_ESPA.h" // ESP32 env:esp32 #elif MB(MRR_ESPE) - #include "esp32/pins_MRR_ESPE.h" // ESP32 env:esp32 + #include "esp32/pins_MRR_ESPE.h" // ESP32 env:esp32 #elif MB(E4D_BOX) - #include "esp32/pins_E4D.h" // ESP32 env:esp32 + #include "esp32/pins_E4D.h" // ESP32 env:esp32 #elif MB(RESP32_CUSTOM) - #include "esp32/pins_RESP32_CUSTOM.h" // ESP32 env:esp32 + #include "esp32/pins_RESP32_CUSTOM.h" // ESP32 env:esp32 #elif MB(FYSETC_E4) - #include "esp32/pins_FYSETC_E4.h" // ESP32 env:FYSETC_E4 + #include "esp32/pins_FYSETC_E4.h" // ESP32 env:FYSETC_E4 #elif MB(PANDA_ZHU) - #include "esp32/pins_PANDA_ZHU.h" // ESP32 env:PANDA + #include "esp32/pins_PANDA_ZHU.h" // ESP32 env:PANDA #elif MB(PANDA_M4) - #include "esp32/pins_PANDA_M4.h" // ESP32 env:PANDA + #include "esp32/pins_PANDA_M4.h" // ESP32 env:PANDA #elif MB(MKS_TINYBEE) - #include "esp32/pins_MKS_TINYBEE.h" // ESP32 env:mks_tinybee + #include "esp32/pins_MKS_TINYBEE.h" // ESP32 env:mks_tinybee #elif MB(ENWI_ESPNP) - #include "esp32/pins_ENWI_ESPNP.h" // ESP32 env:esp32 + #include "esp32/pins_ENWI_ESPNP.h" // ESP32 env:esp32 #elif MB(GODI_CONTROLLER_V1_0) - #include "esp32/pins_GODI_CONTROLLER_V1_0.h" // ESP32 env:godi_esp32 + #include "esp32/pins_GODI_CONTROLLER_V1_0.h" // ESP32 env:godi_esp32 // // Adafruit Grand Central M4 (SAMD51 ARM Cortex-M4) // #elif MB(AGCM4_RAMPS_144) - #include "samd/pins_RAMPS_144.h" // SAMD51 env:SAMD51_grandcentral_m4 + #include "samd/pins_RAMPS_144.h" // SAMD51 env:SAMD51_grandcentral_m4 #elif MB(BRICOLEMON_V1_0) - #include "samd/pins_BRICOLEMON_V1_0.h" // SAMD51 env:SAMD51_grandcentral_m4 + #include "samd/pins_BRICOLEMON_V1_0.h" // SAMD51 env:SAMD51_grandcentral_m4 #elif MB(BRICOLEMON_LITE_V1_0) - #include "samd/pins_BRICOLEMON_LITE_V1_0.h" // SAMD51 env:SAMD51_grandcentral_m4 + #include "samd/pins_BRICOLEMON_LITE_V1_0.h" // SAMD51 env:SAMD51_grandcentral_m4 // // ReprapWorld Minitronics (SAMD21) // #elif MB(MINITRONICS20) - #include "samd/pins_MINITRONICS20.h" // SAMD21 env:SAMD21_minitronics20 + #include "samd/pins_MINITRONICS20.h" // SAMD21 env:SAMD21_minitronics20 // // Custom board (with custom PIO env) // #elif MB(CUSTOM) - #include "pins_custom.h" // env:custom + #include "pins_custom.h" // env:custom // // Linux Native Debug board // #elif MB(SIMULATED) - #include "linux/pins_RAMPS_LINUX.h" // Native or Simulation lin:linux_native mac:simulator_macos_debug mac:simulator_macos_release win:simulator_windows lin:simulator_linux_debug lin:simulator_linux_release + #include "linux/pins_RAMPS_LINUX.h" // Native or Simulation lin:linux_native mac:simulator_macos_debug mac:simulator_macos_release win:simulator_windows lin:simulator_linux_debug lin:simulator_linux_release #else diff --git a/Marlin/src/pins/pinsDebug.h b/Marlin/src/pins/pinsDebug.h index 4d51de52c88e7..9181a5b9da296 100644 --- a/Marlin/src/pins/pinsDebug.h +++ b/Marlin/src/pins/pinsDebug.h @@ -177,11 +177,11 @@ const PinInfo pin_array[] PROGMEM = { bool pin_is_protected(const pin_t pin); static void print_input_or_output(const bool isout) { - SERIAL_ECHOF(isout ? F("Output ") : F("Input ")); + SERIAL_ECHO(isout ? F("Output ") : F("Input ")); } static void print_pin_state(const bool state) { - SERIAL_ECHOF(state ? F("HIGH") : F("LOW")); + SERIAL_ECHO(state ? F("HIGH") : F("LOW")); } // pretty report with PWM info @@ -209,7 +209,7 @@ inline void report_pin_state_extended(const pin_t pin, const bool ignore, const for (uint8_t x = 0; x < COUNT(pin_array); ++x) { // scan entire array and report all instances of this pin if (GET_ARRAY_PIN(x) == pin) { if (!found) { // report digital and analog pin number only on the first time through - if (start_string) SERIAL_ECHOF(start_string); + if (start_string) SERIAL_ECHO(start_string); SERIAL_ECHOPGM("PIN: "); PRINT_PIN(pin); print_port(pin); @@ -257,7 +257,7 @@ inline void report_pin_state_extended(const pin_t pin, const bool ignore, const } // end of for loop if (!found) { - if (start_string) SERIAL_ECHOF(start_string); + if (start_string) SERIAL_ECHO(start_string); SERIAL_ECHOPGM("PIN: "); PRINT_PIN(pin); print_port(pin); diff --git a/Marlin/src/pins/ramps/pins_RAMPS_BTT_16_PLUS.h b/Marlin/src/pins/ramps/pins_RAMPS_BTT_16_PLUS.h new file mode 100644 index 0000000000000..803a1de30bc89 --- /dev/null +++ b/Marlin/src/pins/ramps/pins_RAMPS_BTT_16_PLUS.h @@ -0,0 +1,49 @@ +/** + * 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 + +/** + * Arduino Mega with RAMPS BTT v1.6+ + * Schematic: https://github.com/bigtreetech/ramps-1.6/blob/master/Ramps1.6/hardware/R6%2B-SCH.pdf + * + * Differences from RAMPS v1.4: + * - SPI Stepper drivers use AVR hardware SPI pins + * - SPI Stepper CS pins are different + */ + +#include "env_validate.h" + +#define BOARD_INFO_NAME "RAMPS BTT 1.6+" + +#if HAS_TMC_SPI && DISABLED(TMC_USE_SW_SPI) + #define TMC_SPI_MOSI MOSI // 51 + #define TMC_SPI_MISO MISO // 50 + #define TMC_SPI_SCK SCK // 52 +#endif + +#define X_CS_PIN 63 // A0 +#define Y_CS_PIN 40 +#define Z_CS_PIN 42 +#define E0_CS_PIN 65 // A11 +#define E1_CS_PIN 66 // A12 + +#include "pins_RAMPS.h" diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V25S1.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V25S1.h index 5657a79950271..61207f90b03e2 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V25S1.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V25S1.h @@ -51,9 +51,9 @@ #if ENABLED(IIC_BL24CXX_EEPROM) #define IIC_EEPROM_SDA PA11 #define IIC_EEPROM_SCL PA12 - #define MARLIN_EEPROM_SIZE 0x800 // 2K (24C16) + #define MARLIN_EEPROM_SIZE 0x800 // 2K (24C16) #elif ANY(SDCARD_EEPROM_EMULATION, FLASH_EEPROM_EMULATION) - #define MARLIN_EEPROM_SIZE 0x800 // 2K + #define MARLIN_EEPROM_SIZE 0x800 // 2K #endif // @@ -61,19 +61,13 @@ // #define X_STOP_PIN PC4 #define Y_STOP_PIN PC5 +#define Z_STOP_PIN PC15 #if ENABLED(BLTOUCH) - #define Z_STOP_PIN -1 #define SERVO0_PIN PC14 // BLTouch OUT PIN - #ifndef Z_MIN_PROBE_PIN - #define Z_MIN_PROBE_PIN PC15 // BLTouch IN PIN - #endif -#else - #define Z_STOP_PIN PC15 - #if ENABLED(PROBE_ACTIVATION_SWITCH) - #define PROBE_TARE_PIN PC14 - #define PROBE_ACTIVATION_SWITCH_PIN PB2 - #endif +#elif ENABLED(PROBE_ACTIVATION_SWITCH) + #define PROBE_TARE_PIN PC14 + #define PROBE_ACTIVATION_SWITCH_PIN PB2 #endif // diff --git a/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h b/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h index a0c2ed1dc8274..d1b64dd805fd9 100644 --- a/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h +++ b/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h @@ -307,7 +307,7 @@ #define TFT_CS_PIN FSMC_CS_PIN #define TFT_RS_PIN FSMC_RS_PIN - #ifdef TFT_CLASSIC_UI + #if ENABLED(TFT_CLASSIC_UI) #define TFT_MARLINBG_COLOR 0x3186 // Grey #define TFT_MARLINUI_COLOR 0xC7B6 // Green #define TFT_BTARROWS_COLOR 0xDEE6 // Yellow diff --git a/Marlin/src/pins/stm32f4/pins_VAKE403D.h b/Marlin/src/pins/stm32f4/pins_VAKE403D.h deleted file mode 100644 index e4150f3bd27c1..0000000000000 --- a/Marlin/src/pins/stm32f4/pins_VAKE403D.h +++ /dev/null @@ -1,226 +0,0 @@ -/** - * 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 - -#define ALLOW_STM32DUINO -#include "env_validate.h" - -#if HOTENDS > 2 || E_STEPPERS > 2 - #error "STM32F4 VAkE supports up to 2 hotends / E steppers." -#endif - -#define DEFAULT_MACHINE_NAME "STM32F446VET6" -#define BOARD_INFO_NAME "STM32F4 VAkE" - -//#define I2C_EEPROM -#define MARLIN_EEPROM_SIZE 0x1000 // 4K - -// -// Servos -// -//#define SERVO0_PIN PE13 -//#define SERVO1_PIN PE14 - -// -// Limit Switches -// -#define X_STOP_PIN PE10 -#define Y_STOP_PIN PE9 -#define Z_STOP_PIN PE8 - -// -// Z Probe (when not Z_MIN_PIN) -// -#ifndef Z_MIN_PROBE_PIN - #define Z_MIN_PROBE_PIN PA4 -#endif - -// -// Filament runout -// -#define FIL_RUNOUT_PIN PA3 - -// -// Steppers -// - -#define STEPPER_ENABLE_PIN PB2 - -#define X_STEP_PIN PC6 // X_STEP -#define X_DIR_PIN PC7 // X_DIR -#define X_ENABLE_PIN PB2 // -#ifndef X_CS_PIN - #define X_CS_PIN PC8 // X_CS -#endif - -#define Y_STEP_PIN PD9 // Y_STEP -#define Y_DIR_PIN PD10 // Y_DIR -#define Y_ENABLE_PIN PB2 // -#ifndef Y_CS_PIN - #define Y_CS_PIN PD11 // Y_CS -#endif - -#define Z_STEP_PIN PE15 // Z_STEP -#define Z_DIR_PIN PB10 // Z_DIR -#define Z_ENABLE_PIN PB2 -#ifndef Z_CS_PIN - #define Z_CS_PIN PD8 -#endif - -#define E0_STEP_PIN PB1 -#define E0_DIR_PIN PB13 -#define E0_ENABLE_PIN PB2 -#ifndef E0_CS_PIN - #define E0_CS_PIN PE11 -#endif - -#define E1_STEP_PIN PC4 -#define E1_DIR_PIN PC5 -#define E1_ENABLE_PIN PB2 -#ifndef E1_CS_PIN - #define E1_CS_PIN PB0 -#endif - -#define SD_SCK_PIN PE12 // PA5 // SPI1 for SD card -#define SD_MISO_PIN PE13 // PA6 -#define SD_MOSI_PIN PE14 // PA7 - -// added for SD card : optional or not ??? -//#define SD_CHIP_SELECT_PIN SDSS // The default chip select pin for the SD card is SS. -// The following three pins must not be redefined for hardware SPI. -//#define SPI_MOSI_PIN SD_MOSI_PIN // SPI Master Out Slave In pin -//#define SPI_MISO_PIN SD_MISO_PIN // SPI Master In Slave Out pin -//#define SPI_SCK_PIN SD_SCK_PIN // SPI Clock pin - -// -// Temperature Sensors (Analog inputs) -// - -#define TEMP_0_PIN PC0 // Analog Input -#define TEMP_1_PIN PC1 // Analog Input -#define TEMP_2_PIN PC2 // Analog Input -#define TEMP_3_PIN PC3 // Analog Input -#define TEMP_BED_PIN PC3 // Analog Input - -// -// Heaters / Fans -// - -#define HEATER_0_PIN PD15 -#define HEATER_1_PIN PD14 -#define HEATER_BED_PIN PD12 - -#ifndef FAN0_PIN - #define FAN0_PIN PD13 -#endif -#define FAN1_PIN PB5 // PA0 -#define FAN2_PIN PB4 // PA1 - -#ifndef E0_AUTO_FAN_PIN - #define E0_AUTO_FAN_PIN PD13 -#endif - -// -// Misc. Functions -// - -//#define CASE_LIGHT_PIN_CI PF13 -//#define CASE_LIGHT_PIN_DO PF14 -//#define NEOPIXEL_PIN PF13 - -// -// PrΕ―Ε‘a i3 MK2 Multi Material Multiplexer Support -// -#if HAS_PRUSA_MMU1 - //#define E_MUX0_PIN PG3 - //#define E_MUX1_PIN PG4 -#endif - -#define LED_PIN PB14 // Alive -#define PS_ON_PIN PE0 -#define KILL_PIN PD5 -#define POWER_LOSS_PIN PA4 // ?? Power loss / nAC_FAULT - -#if HAS_MEDIA - #define SD_DETECT_PIN EXP2_07_PIN - #define SD_SS_PIN PB15 // USD_CS -> CS for onboard SD -#endif - -/** - * ------ ------ - * PC9 | 1 2 | PB12 ? | 1 2 | ? - * PD7 | 3 4 | PC12 PD6 | 3 4 | ? - * PD1 | 5 6 PD2 PD0 | 5 6 ? - * PD3 | 7 8 | PD4 PB7 | 7 8 | RESET - * GND | 9 10 | 5V GND | 9 10 | 3.3V - * ------ ------ - * EXP1 EXP2 - */ -#define EXP1_01_PIN PC9 -#define EXP1_02_PIN PB12 -#define EXP1_03_PIN PD7 -#define EXP1_04_PIN PC12 -#define EXP1_05_PIN PD1 -#define EXP1_06_PIN PD2 -#define EXP1_07_PIN PD3 -#define EXP1_08_PIN PD4 - -//#define EXP2_01_PIN ? -//#define EXP2_02_PIN ? -#define EXP2_03_PIN PD6 -//#define EXP2_04_PIN ? -#define EXP2_05_PIN PD0 -//#define EXP2_06_PIN ? -#define EXP2_07_PIN PB7 -#define EXP2_08_PIN -1 - -// -// LCD / Controller -// -#if HAS_WIRED_LCD - - #if HAS_MEDIA - #define SDSS PB6 // CS for SD card in LCD - #endif - - #define BEEPER_PIN EXP1_01_PIN - - #define BTN_EN1 EXP2_03_PIN - #define BTN_EN2 EXP2_05_PIN - #define BTN_ENC EXP1_02_PIN - - #define LCD_PINS_EN EXP1_03_PIN - #define LCD_PINS_RS EXP1_04_PIN - - #define LCD_PINS_D4 EXP1_05_PIN - #define LCD_PINS_D5 EXP1_06_PIN - #define LCD_PINS_D6 EXP1_07_PIN - #define LCD_PINS_D7 EXP1_08_PIN - -#endif - -// Alter timing for graphical display -#if IS_U8GLIB_ST7920 - #define BOARD_ST7920_DELAY_1 96 - #define BOARD_ST7920_DELAY_2 48 - #define BOARD_ST7920_DELAY_3 715 -#endif diff --git a/Marlin/src/pins/stm32g0/pins_BTT_MANTA_E3_EZ_V1_0.h b/Marlin/src/pins/stm32g0/pins_BTT_MANTA_E3_EZ_V1_0.h index 156698f4247ee..fdcdd36ae86f3 100644 --- a/Marlin/src/pins/stm32g0/pins_BTT_MANTA_E3_EZ_V1_0.h +++ b/Marlin/src/pins/stm32g0/pins_BTT_MANTA_E3_EZ_V1_0.h @@ -238,21 +238,36 @@ #define EXP1_10_PIN -1 #if HAS_DWIN_E3V2 || IS_DWIN_MARLINUI + /** + * ------ ------ --- + * (PC1) BEEP | 1 2 | | 1 2 | | 1 | (5V) + * | 3 4 | RX | 3 4 | TX | 2 | (GND) + * (PC0) ENT 5 6 | ENT 5 6 | BEEP | 3 | RX (PD8) + * (PA2) B | 7 8 | A (PA1) B | 7 8 | A | 4 | TX (PD9) + * GND | 9 10 | 5V GND | 9 10 | VCC | 5 | (RST) + * ------ ------ --- + * EXP1 DWIN TFT + * + * DWIN pins are labeled as printed on DWIN PCB. GND, VCC, A, B, ENT & BEEP can be connected in the same orientation as the + * existing plug/DWIN to EXP1. DWIN TX/RX need to be connected to the Manta E3 EZ's TFT port, with DWIN TX->PD9, DWIN RX->PD8. + * + * Needs custom cable: + * + * Board Adapter Display + * ------------------------------------------ + * (EXP1-1) PC1 <-----------> BEEP (DWIN-6) + * (EXP1-5) PC0 <-----------> ENT (DWIN-5) + * (TFT-4) PD9 <-----------> RX (DWIN-3) + * (TFT-3) PD8 <-----------> TX (DWIN-4) + * (EXP1-7) PA2 <-----------> B (DWIN-7) + * (EXP1-9) GND <-----------> GND (DWIN-9) + * (EXP1-8) PA1 <-----------> A (DWIN-8) + * (EXP1-10) 5V <-----------> VCC (DWIN-10) + */ #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING #error "CAUTION! Ender-3 V2 display requires a custom cable with TX = PA0, RX = PC2. See 'pins_BTT_MANTA_E3_EZ_V1_0.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" #endif - /** - * Ender-3 V2 display Manta E3 EZ V1.0 Ender-3 V2 display --> Manta E3 EZ V1.0 - * ------ ------ RX 3 --> 5 P0_15 - * -- | 1 2 | -- (BEEPER) PC1 | 1 2 | PC2 (BTN_ENC) TX 4 --> 9 P0_16 - * (MANTA TX1) RX | 3 4 | TX (MANTA RX1) (BTN_EN1) PC3 | 3 4 | RESET BEEPER 6 --> 10 P2_08 - * (BTN_ENC) ENT 5 6 | BEEPER (BTN_EN2) PC0 5 6 | PA0 (LCD_D4) - * (BTN_E2) B | 7 8 | A (BTN_E1) (LCD_RS) PA2 | 7 8 | PA1 (LCD_EN) - * GND | 9 10 | 5V GND | 9 10 | 5V - * ------ ------ - */ - #define BEEPER_PIN EXP1_01_PIN #define BTN_EN1 EXP1_08_PIN #define BTN_EN2 EXP1_07_PIN @@ -310,7 +325,6 @@ // // SD Support // - #ifndef SDCARD_CONNECTION #define SDCARD_CONNECTION ONBOARD #endif diff --git a/Marlin/src/pins/teensy4/env_validate.h b/Marlin/src/pins/teensy4/env_validate.h new file mode 100644 index 0000000000000..5a89e8a409a8a --- /dev/null +++ b/Marlin/src/pins/teensy4/env_validate.h @@ -0,0 +1,26 @@ +/** + * 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 + +#if NOT_TARGET(IS_TEENSY41) + #error "Oops! Select 'Teensy 4.1' in 'Tools > Board.'" +#endif diff --git a/Marlin/src/pins/teensy4/pins_T41U5XBB.h b/Marlin/src/pins/teensy4/pins_T41U5XBB.h index 5f62bb05a64b2..2ee4f2970e8a0 100644 --- a/Marlin/src/pins/teensy4/pins_T41U5XBB.h +++ b/Marlin/src/pins/teensy4/pins_T41U5XBB.h @@ -27,9 +27,7 @@ * https://www.pjrc.com/teensy/teensyduino.html ****************************************************************************************/ -#if NOT_TARGET(IS_TEENSY41) - #error "Oops! Select 'Teensy 4.1' in 'Tools > Board.'" -#endif +#include "env_validate.h" #define BOARD_INFO_NAME "Teensy4.1" diff --git a/Marlin/src/pins/teensy4/pins_TEENSY41.h b/Marlin/src/pins/teensy4/pins_TEENSY41.h index 263d9e8f8b083..2a8a76f17c568 100644 --- a/Marlin/src/pins/teensy4/pins_TEENSY41.h +++ b/Marlin/src/pins/teensy4/pins_TEENSY41.h @@ -27,9 +27,7 @@ * https://www.pjrc.com/teensy/teensyduino.html ****************************************************************************************/ -#if NOT_TARGET(IS_TEENSY41) - #error "Oops! Select 'Teensy 4.1' in 'Tools > Board.'" -#endif +#include "env_validate.h" #define BOARD_INFO_NAME "Teensy4.1" diff --git a/Marlin/src/sd/Sd2Card.h b/Marlin/src/sd/Sd2Card.h index 71e31ac614c2c..49569af5121f2 100644 --- a/Marlin/src/sd/Sd2Card.h +++ b/Marlin/src/sd/Sd2Card.h @@ -70,7 +70,7 @@ typedef enum : uint8_t { SD_CARD_ERROR_WRITE_PROGRAMMING = 0x16, // Card returned an error to a CMD13 status check after a write SD_CARD_ERROR_WRITE_TIMEOUT = 0x17, // Timeout occurred during write programming SD_CARD_ERROR_SCK_RATE = 0x18, // Incorrect rate selected - SD_CARD_ERROR_INIT_NOT_CALLED = 0x19, // Init() not called + SD_CARD_ERROR_INIT_NOT_CALLED = 0x19, // init() not called // 0x1A is unused now, it was: card returned an error for CMD59 (CRC_ON_OFF) SD_CARD_ERROR_READ_CRC = 0x1B // Invalid read CRC } sd_error_code_t; diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index 40c1f09f1182f..e09bc5265a383 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -621,7 +621,7 @@ void CardReader::startOrResumeFilePrinting() { // void CardReader::endFilePrintNow(TERN_(SD_RESORT, const bool re_sort/*=false*/)) { TERN_(ADVANCED_PAUSE_FEATURE, did_pause_print = 0); - TERN_(DWIN_CREALITY_LCD, HMI_flag.print_finish = flag.sdprinting); + TERN_(DWIN_CREALITY_LCD, hmiFlag.print_finish = flag.sdprinting); flag.abort_sd_printing = false; if (isFileOpen()) file.close(); TERN_(SD_RESORT, if (re_sort) presort()); @@ -668,9 +668,7 @@ void announceOpen(const uint8_t doing, const char * const path) { if (doing) { PORT_REDIRECT(SerialMask::All); SERIAL_ECHO_START(); - SERIAL_ECHOPGM("Now "); - SERIAL_ECHOF(doing == 1 ? F("doing") : F("fresh")); - SERIAL_ECHOLNPGM(" file: ", path); + SERIAL_ECHOLN(F("Now "), doing == 1 ? F("doing") : F("fresh"), F(" file: "), path); } } @@ -1447,8 +1445,7 @@ void CardReader::fileHasFinished() { recovery.init(); removeFile(recovery.filename); #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) - SERIAL_ECHOPGM("Power-loss file delete"); - SERIAL_ECHOF(jobRecoverFileExists() ? F(" failed.\n") : F("d.\n")); + SERIAL_ECHOLN(F("Power-loss file delete"), jobRecoverFileExists() ? F(" failed.") : F("d.")); #endif } } diff --git a/buildroot/share/PlatformIO/boards/marlin_CREALITY_STM32F401RC.json b/buildroot/share/PlatformIO/boards/marlin_CREALITY_STM32F401RC.json deleted file mode 100644 index 82f49fa815d65..0000000000000 --- a/buildroot/share/PlatformIO/boards/marlin_CREALITY_STM32F401RC.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "build": { - "core": "stm32", - "cpu": "cortex-m4", - "extra_flags": "-DSTM32F401xx", - "f_cpu": "84000000L", - "hwids": [ - [ - "0x1EAF", - "0x0003" - ], - [ - "0x0483", - "0x3748" - ] - ], - "ldscript": "ldscript.ld", - "mcu": "stm32f401rct6", - "variant": "MARLIN_CREALITY_STM32F401RC" - }, - "debug": { - "jlink_device": "STM32F401RC", - "openocd_target": "stm32f4x", - "svd_path": "STM32F40x.svd", - "tools": { - "stlink": { - "server": { - "arguments": [ - "-f", - "scripts/interface/stlink.cfg", - "-c", - "transport select hla_swd", - "-f", - "scripts/target/stm32f4x.cfg", - "-c", - "reset_config none" - ], - "executable": "bin/openocd", - "package": "tool-openocd" - } - } - } - }, - "frameworks": [ - "arduino", - "stm32cube" - ], - "name": "STM32F401RC (64k RAM. 256k Flash)", - "upload": { - "disable_flushing": false, - "maximum_ram_size": 65536, - "maximum_size": 262144, - "protocol": "stlink", - "protocols": [ - "stlink", - "dfu", - "jlink" - ], - "require_upload_port": true, - "use_1200bps_touch": false, - "wait_for_upload_port": false - }, - "url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f401rc.html", - "vendor": "Generic" -} diff --git a/buildroot/share/PlatformIO/boards/marlin_STM32H723Zx.json b/buildroot/share/PlatformIO/boards/marlin_STM32H723ZE.json similarity index 97% rename from buildroot/share/PlatformIO/boards/marlin_STM32H723Zx.json rename to buildroot/share/PlatformIO/boards/marlin_STM32H723ZE.json index 8525793c4e018..f4bb75b5dae93 100644 --- a/buildroot/share/PlatformIO/boards/marlin_STM32H723Zx.json +++ b/buildroot/share/PlatformIO/boards/marlin_STM32H723ZE.json @@ -6,7 +6,7 @@ "f_cpu": "550000000L", "mcu": "stm32h723zet6", "product_line": "STM32H723xx", - "variant": "MARLIN_H723Zx" + "variant": "MARLIN_H723ZE" }, "connectivity": [ "can", diff --git a/buildroot/share/PlatformIO/boards/marlin_STM32H743Vx.json b/buildroot/share/PlatformIO/boards/marlin_STM32H743VI.json similarity index 97% rename from buildroot/share/PlatformIO/boards/marlin_STM32H743Vx.json rename to buildroot/share/PlatformIO/boards/marlin_STM32H743VI.json index 4ec34e5b35028..56e853cad43e9 100644 --- a/buildroot/share/PlatformIO/boards/marlin_STM32H743Vx.json +++ b/buildroot/share/PlatformIO/boards/marlin_STM32H743VI.json @@ -6,7 +6,7 @@ "f_cpu": "480000000L", "mcu": "stm32h743vit6", "product_line": "STM32H743xx", - "variant": "MARLIN_H743Vx" + "variant": "MARLIN_H743VI" }, "connectivity": [ "can", diff --git a/buildroot/share/PlatformIO/scripts/offset_and_rename.py b/buildroot/share/PlatformIO/scripts/offset_and_rename.py index de14ccbbbf5f5..e9940a50d0140 100644 --- a/buildroot/share/PlatformIO/scripts/offset_and_rename.py +++ b/buildroot/share/PlatformIO/scripts/offset_and_rename.py @@ -60,6 +60,7 @@ def encrypt(source, target, env): def rename_target(source, target, env): from pathlib import Path - Path(target[0].path).replace(Path(target[0].dir.path, new_name)) + from datetime import datetime + Path(target[0].path).replace(Path(target[0].dir.path, datetime.now().strftime(new_name.replace('{date}', '%Y%m%d').replace('{time}', '%H%M%S')))) marlin.add_post_action(rename_target) diff --git a/buildroot/share/PlatformIO/scripts/random-bin.py b/buildroot/share/PlatformIO/scripts/random-bin.py deleted file mode 100644 index dc8634ea7d640..0000000000000 --- a/buildroot/share/PlatformIO/scripts/random-bin.py +++ /dev/null @@ -1,9 +0,0 @@ -# -# random-bin.py -# Set a unique firmware name based on current date and time -# -import pioutil -if pioutil.is_pio_build(): - from datetime import datetime - Import("env") - env['PROGNAME'] = datetime.now().strftime("firmware-%Y%m%d-%H%M%S") diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723Zx/PeripheralPins.c b/buildroot/share/PlatformIO/variants/MARLIN_H723ZE/PeripheralPins.c similarity index 100% rename from buildroot/share/PlatformIO/variants/MARLIN_H723Zx/PeripheralPins.c rename to buildroot/share/PlatformIO/variants/MARLIN_H723ZE/PeripheralPins.c diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723Zx/PinNamesVar.h b/buildroot/share/PlatformIO/variants/MARLIN_H723ZE/PinNamesVar.h similarity index 100% rename from buildroot/share/PlatformIO/variants/MARLIN_H723Zx/PinNamesVar.h rename to buildroot/share/PlatformIO/variants/MARLIN_H723ZE/PinNamesVar.h diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723Zx/ldscript.ld b/buildroot/share/PlatformIO/variants/MARLIN_H723ZE/ldscript.ld similarity index 100% rename from buildroot/share/PlatformIO/variants/MARLIN_H723Zx/ldscript.ld rename to buildroot/share/PlatformIO/variants/MARLIN_H723ZE/ldscript.ld diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723Zx/variant_MARLIN_STM32H723ZX.cpp b/buildroot/share/PlatformIO/variants/MARLIN_H723ZE/variant_MARLIN_STM32H723ZE.cpp similarity index 100% rename from buildroot/share/PlatformIO/variants/MARLIN_H723Zx/variant_MARLIN_STM32H723ZX.cpp rename to buildroot/share/PlatformIO/variants/MARLIN_H723ZE/variant_MARLIN_STM32H723ZE.cpp diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723Zx/variant_MARLIN_STM32H723ZX.h b/buildroot/share/PlatformIO/variants/MARLIN_H723ZE/variant_MARLIN_STM32H723ZE.h similarity index 100% rename from buildroot/share/PlatformIO/variants/MARLIN_H723Zx/variant_MARLIN_STM32H723ZX.h rename to buildroot/share/PlatformIO/variants/MARLIN_H723ZE/variant_MARLIN_STM32H723ZE.h diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H743Vx/PeripheralPins.c b/buildroot/share/PlatformIO/variants/MARLIN_H743VI/PeripheralPins.c similarity index 100% rename from buildroot/share/PlatformIO/variants/MARLIN_H743Vx/PeripheralPins.c rename to buildroot/share/PlatformIO/variants/MARLIN_H743VI/PeripheralPins.c diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H743Vx/PinNamesVar.h b/buildroot/share/PlatformIO/variants/MARLIN_H743VI/PinNamesVar.h similarity index 100% rename from buildroot/share/PlatformIO/variants/MARLIN_H743Vx/PinNamesVar.h rename to buildroot/share/PlatformIO/variants/MARLIN_H743VI/PinNamesVar.h diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H743Vx/ldscript.ld b/buildroot/share/PlatformIO/variants/MARLIN_H743VI/ldscript.ld similarity index 100% rename from buildroot/share/PlatformIO/variants/MARLIN_H743Vx/ldscript.ld rename to buildroot/share/PlatformIO/variants/MARLIN_H743VI/ldscript.ld diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H743Vx/variant_MARLIN_STM32H743VX.cpp b/buildroot/share/PlatformIO/variants/MARLIN_H743VI/variant_MARLIN_STM32H743VI.cpp similarity index 100% rename from buildroot/share/PlatformIO/variants/MARLIN_H743Vx/variant_MARLIN_STM32H743VX.cpp rename to buildroot/share/PlatformIO/variants/MARLIN_H743VI/variant_MARLIN_STM32H743VI.cpp diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H743Vx/variant_MARLIN_STM32H743VX.h b/buildroot/share/PlatformIO/variants/MARLIN_H743VI/variant_MARLIN_STM32H743VI.h similarity index 100% rename from buildroot/share/PlatformIO/variants/MARLIN_H743Vx/variant_MARLIN_STM32H743VX.h rename to buildroot/share/PlatformIO/variants/MARLIN_H743VI/variant_MARLIN_STM32H743VI.h diff --git a/docs/Serial.md b/docs/Serial.md index 88846e1bb45ad..5e0d7e63eb072 100644 --- a/docs/Serial.md +++ b/docs/Serial.md @@ -57,18 +57,15 @@ The following macros are defined (in `serial.h`) to output data to the serial po |-------|------------|-------|---------|-----------------| | `SERIAL_ECHO` | Any basic type is supported (`char`, `uint8_t`, `int16_t`, `int32_t`, `float`, `long`, `const char*`, ...). | For a numeric type it prints the number in decimal. A string is output as a string. | `uint8_t a = 123; SERIAL_ECHO(a); SERIAL_CHAR(' '); SERIAL_ECHO(' '); ` | `123 32` | | `SERIAL_ECHOLN` | Same as `SERIAL_ECHO` | Do `SERIAL_ECHO`, adding a newline | `int a = 456; SERIAL_ECHOLN(a);` | `456\n` | -| `SERIAL_ECHO_F` | `float` or `double` | Print a decimal value with a given precision (default 2) | `float a = 3.1415; SERIAL_ECHO_F(a); SERIAL_CHAR(' '); SERIAL_ECHO_F(a, 4);` | `3.14 3.1415`| | `SERIAL_ECHOPGM` | String / Value pairs | Print a series of string literals and values alternately | `SERIAL_ECHOPGM("Bob", 34);` | `Bob34` | | `SERIAL_ECHOLNPGM` | Same as `SERIAL_ECHOPGM` | Do `SERIAL_ECHOPGM`, adding a newline | `SERIAL_ECHOPGM("Alice", 56);` | `alice56` | | `SERIAL_ECHOPGM_P` | Like `SERIAL_ECHOPGM` but takes PGM strings | Print a series of PGM strings and values alternately | `SERIAL_ECHOPGM_P(GET_TEXT(MSG_HELLO), 123);` | `Hello123` | | `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_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_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);` | ... | *This document was written by [X-Ryl669](https://blog.cyril.by) and is under [CC-SA license](https://creativecommons.org/licenses/by-sa)* diff --git a/ini/renamed.ini b/ini/renamed.ini index 99fbde95d01ad..fa35839ad45ab 100644 --- a/ini/renamed.ini +++ b/ini/renamed.ini @@ -72,5 +72,10 @@ extends = renamed [env:BIGTREE_OCTOPUS_V1_F407_USB] ;=> STM32F407ZE_btt_USB extends = renamed -[env:STM32H723Vx_btt] ;=> STM32H723VE_btt or STM32H723VG_btt +[env:STM32H723Vx_btt] ;=> STM32H723VG_btt extends = renamed + +[env:STM32H723Zx_btt] ;=> STM32H723ZE_btt +extends = renamed + +[env:STM32H743Vx_btt] ;=> STM32H743VI_btt diff --git a/ini/stm32f1-maple.ini b/ini/stm32f1-maple.ini index 3560c1fd2a87e..6f9ac32e0e6e6 100644 --- a/ini/stm32f1-maple.ini +++ b/ini/stm32f1-maple.ini @@ -118,8 +118,7 @@ extends = env:STM32F103RE_maple build_flags = ${env:STM32F103RE_maple.build_flags} -DTEMP_TIMER_CHAN=4 board_build.address = 0x08007000 board_build.ldscript = creality.ld -extra_scripts = ${env:STM32F103RE_maple.extra_scripts} - pre:buildroot/share/PlatformIO/scripts/random-bin.py +board_build.rename = firmware-{date}-{time}.bin debug_tool = jlink upload_protocol = jlink @@ -131,8 +130,7 @@ extends = env:STM32F103RC_maple build_flags = ${env:STM32F103RC_maple.build_flags} -DTEMP_TIMER_CHAN=4 board_build.address = 0x08007000 board_build.ldscript = creality.ld -extra_scripts = ${env:STM32F103RC_maple.extra_scripts} - pre:buildroot/share/PlatformIO/scripts/random-bin.py +board_build.rename = firmware-{date}-{time}.bin debug_tool = jlink upload_protocol = jlink @@ -400,8 +398,8 @@ extends = env:STM32F103RE_maple build_flags = ${STM32F1_maple.build_flags} -DTEMP_TIMER_CHAN=4 board_build.address = 0x08007000 board_build.ldscript = sovol.ld +board_build.rename = firmware-{date}-{time}.bin extra_scripts = ${STM32F1_maple.extra_scripts} - pre:buildroot/share/PlatformIO/scripts/random-bin.py buildroot/share/PlatformIO/scripts/custom_board.py debug_tool = jlink upload_protocol = jlink diff --git a/ini/stm32f1.ini b/ini/stm32f1.ini index d19de4d2ddde7..08686a1fb4753 100644 --- a/ini/stm32f1.ini +++ b/ini/stm32f1.ini @@ -121,6 +121,7 @@ debug_tool = stlink extends = stm32_variant board_build.variant = MARLIN_F103Rx board_build.offset = 0x7000 +board_build.rename = firmware-{date}-{time}.bin board_upload.offset_address = 0x08007000 build_flags = ${stm32_variant.build_flags} -DMCU_STM32F103RE -DHAL_SD_MODULE_ENABLED @@ -128,8 +129,6 @@ build_flags = ${stm32_variant.build_flags} -DENABLE_HWSERIAL3 -DTRANSFER_CLOCK_DIV=8 build_unflags = ${stm32_variant.build_unflags} -DUSBCON -DUSBD_USE_CDC -extra_scripts = ${stm32_variant.extra_scripts} - pre:buildroot/share/PlatformIO/scripts/random-bin.py monitor_speed = 115200 debug_tool = jlink upload_protocol = jlink diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 34a5c4d607bde..8708a6dbcacde 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -684,12 +684,11 @@ board = genericSTM32F401RC board_build.variant = MARLIN_CREALITY_STM32F401RC board_build.offset = 0x10000 board_upload.offset_address = 0x08010000 +board_build.rename = firmware-{date}-{time}.bin build_flags = ${stm32_variant.build_flags} -DMCU_STM32F401RC -DSTM32F4 -DSS_TIMER=4 -DTIMER_SERVO=TIM5 -DENABLE_HWSERIAL3 -DTRANSFER_CLOCK_DIV=8 build_unflags = ${stm32_variant.build_unflags} -DUSBCON -DUSBD_USE_CDC -extra_scripts = ${stm32_variant.extra_scripts} - pre:buildroot/share/PlatformIO/scripts/random-bin.py monitor_speed = 115200 [env:STM32F401RC_creality_jlink] @@ -710,10 +709,9 @@ extends = stm32_variant board = marlin_CREALITY_STM32F401RE board_build.offset = 0x10000 board_upload.offset_address = 0x08010000 +board_build.rename = firmware-{date}-{time}.bin build_flags = ${stm32_variant.build_flags} -DSTM32F401xE -DSTM32F4 -DSTM32F4_UPDATE_FOLDER build_unflags = ${stm32_variant.build_unflags} -DUSBCON -DUSBD_USE_CDC -extra_scripts = ${stm32_variant.extra_scripts} - pre:buildroot/share/PlatformIO/scripts/random-bin.py monitor_speed = 115200 [env:STM32F401RE_creality_jlink] @@ -745,6 +743,20 @@ build_flags = ${stm32_variant.build_flags} upload_protocol = stlink debug_tool = stlink +# +# BigTreeTech SKR Mini E3 V3.0.1 (STM32F401RCT6 ARM Cortex-M0+) +# Custom upload to SD via Marlin with Binary Protocol +# Requires Marlin with BINARY_FILE_TRANSFER already installed on the target board. +# If CUSTOM_FIRMWARE_UPLOAD is also installed, Marlin will reboot the board to install the firmware. +# Currently CUSTOM_FIRMWARE_UPLOAD must also be enabled to use 'xfer' build envs. +# +[env:STM32F401RC_btt_xfer] +extends = env:STM32F401RC_btt +build_flags = ${env:STM32F401RC_btt.build_flags} -DXFER_BUILD +extra_scripts = ${env:STM32F401RC_btt.extra_scripts} + pre:buildroot/share/scripts/upload.py +upload_protocol = custom + # # MKS SKIPR v1.0 all-in-one board (STM32F407VE) # diff --git a/ini/stm32h7.ini b/ini/stm32h7.ini index 5485e57e91d88..2d719c000b158 100644 --- a/ini/stm32h7.ini +++ b/ini/stm32h7.ini @@ -13,7 +13,7 @@ # 7 : Cortex M7 core (0:M0, 1-2:M3, 3-4:M4, 7:M7) # 43 : Line/Features # I : 176 pins (T:36, C:48 or 49, M:81, V:100, Z:144, I:176) -# I : 2048KB Flash-memory (C:256KB, D:384KB, E:512KB, G:1024KB) +# I : 2048KB Flash-memory (C:256KB, D:384KB, E:512KB, G:1024KB, I:2048KB) # T : LQFP package # 6 : -40...85Β°C (7: ...105Β°C) # @@ -40,13 +40,12 @@ upload_protocol = cmsis-dap debug_tool = cmsis-dap # -# BigTreeTech SKR V3.0 / V3.0 EZ (STM32H743VIT6 ARM Cortex-M7) +# BigTreeTech STM32H743Vx ARM Cortex-M7 Common # -[env:STM32H743Vx_btt] +[STM32H743Vx_btt] extends = stm32_variant platform = ststm32@15.4.1 platform_packages = framework-arduinoststm32@~4.20200.220530 -board = marlin_STM32H743Vx board_build.offset = 0x20000 board_upload.offset_address = 0x08020000 build_flags = ${stm32_variant.build_flags} @@ -60,6 +59,13 @@ build_flags = ${stm32_variant.build_flags} upload_protocol = cmsis-dap debug_tool = cmsis-dap +# +# BigTreeTech SKR V3.0 / V3.0 EZ (STM32H743VIT6 ARM Cortex-M7) +# +[env:STM32H743VI_btt] +extends = STM32H743Vx_btt +board = marlin_STM32H743VI + # # BigTreeTech STM32H723Vx ARM Cortex-M7 Common # @@ -102,11 +108,17 @@ board = marlin_STM32H723VG # # BigTreeTech Octopus Pro V1.0 / Octopus Max EZ V1.0 (STM32H723ZET6 ARM Cortex-M7) # -[env:STM32H723Zx_btt] +[env:STM32H723VG_btt] +extends = STM32H723Vx_btt +board = marlin_STM32H723VG + +# +# BigTreeTech STM32H723Zx ARM Cortex-M7 Common +# +[STM32H723Zx_btt] extends = stm32_variant platform = ststm32@15.4.1 platform_packages = framework-arduinoststm32@~4.20200.220530 -board = marlin_STM32H723Zx board_build.offset = 0x20000 board_upload.offset_address = 0x08020000 build_flags = ${stm32_variant.build_flags} @@ -124,3 +136,10 @@ build_flags = ${stm32_variant.build_flags} -UI2C5_BASE upload_protocol = cmsis-dap debug_tool = cmsis-dap + +# +# BigTreeTech Octopus Pro V1.0 / Octopus Max EZ V1.0 (STM32H723ZET6 ARM Cortex-M7) +# +[env:STM32H723ZE_btt] +extends = STM32H723Zx_btt +board = marlin_STM32H723ZE