From c9718e1ec0570a96bd104cd4bbefed57cc613d5d Mon Sep 17 00:00:00 2001 From: Augusto Zanellato Date: Tue, 19 Oct 2021 17:24:22 +0200 Subject: [PATCH 01/14] =?UTF-8?q?=E2=9C=A8=20Eryone=20Ery32=20mini=20(STM3?= =?UTF-8?q?2F103VET6)=20board=20(#22956)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/boards.h | 1 + Marlin/src/pins/pins.h | 2 + .../src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h | 195 ++++++++++++++++++ .../PlatformIO/ldscripts/eryone_ery32_mini.ld | 14 ++ .../variants/marlin_MEEB_3DP/ld/mem-flash.inc | 4 +- ini/stm32f1-maple.ini | 19 ++ 6 files changed, 233 insertions(+), 2 deletions(-) create mode 100644 Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h create mode 100644 buildroot/share/PlatformIO/ldscripts/eryone_ery32_mini.ld diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index dd08f6a1b4..82fd51e2a3 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -355,6 +355,7 @@ #define BOARD_ZONESTAR_ZM3E2 4055 // Zonestar ZM3E2 (STM32F103RCT6) #define BOARD_ZONESTAR_ZM3E4 4056 // Zonestar ZM3E4 V1 (STM32F103VCT6) #define BOARD_ZONESTAR_ZM3E4V2 4057 // Zonestar ZM3E4 V2 (STM32F103VCT6) +#define BOARD_ERYONE_ERY32_MINI 4058 // Eryone Ery32 mini (STM32F103VET6) // // ARM Cortex-M4F diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 14a13219dd..15794641ca 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -571,6 +571,8 @@ #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 +#elif MB(ERYONE_ERY32_MINI) + #include "stm32f1/pins_ERYONE_ERY32_MINI.h" // STM32F103VET6 env:ERYONE_ERY32_MINI_maple // // ARM Cortex-M4F diff --git a/Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h b/Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h new file mode 100644 index 0000000000..7ce21a20af --- /dev/null +++ b/Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h @@ -0,0 +1,195 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2021 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 + +/** + * Eryone Ery32 mini (STM32F103VET6) board pin assignments + */ + +#include "env_validate.h" + +#if HOTENDS > 2 || E_STEPPERS > 2 + #error "Eryone Ery32 mini supports up to 2 hotends / E-steppers. Comment out this line to continue." +#endif + +#ifndef BOARD_INFO_NAME + #define BOARD_INFO_NAME "ERYONE Ery32 mini" +#endif + +//#define DISABLE_DEBUG +#define DISABLE_JTAG +//#define ENABLE_SPI3 +#define FLASH_EEPROM_EMULATION +#define FAN_SOFT_PWM + +#if ENABLED(FLASH_EEPROM_EMULATION) + #define EEPROM_PAGE_SIZE (0x800U) // 2KB + #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) + #define MARLIN_EEPROM_SIZE (EEPROM_PAGE_SIZE) +#endif + +// +// Servos +// +#define SERVO0_PIN PA12 + +// +// Limit Switches +// +#define X_STOP_PIN PD8 +#define Y_STOP_PIN PD15 +#define Z_MIN_PIN PA11 +//#define Z_MAX_PIN PB1 + +// +// Steppers +// +#define X_STEP_PIN PB15 +#define X_DIR_PIN PB14 +#define X_ENABLE_PIN PD10 + +#define Y_STEP_PIN PD14 +#define Y_DIR_PIN PD13 +#define Y_ENABLE_PIN PC6 + +#define Z_STEP_PIN PC8 +#define Z_DIR_PIN PC7 +#define Z_ENABLE_PIN PA8 + +#define E0_STEP_PIN PE13 +#define E0_DIR_PIN PE14 +#define E0_ENABLE_PIN PB13 + +//#define E1_STEP_PIN PD13 +//#define E1_DIR_PIN PD12 +//#define E1_ENABLE_PIN PC6 + +// +// Heaters 0,1 / Fans / Bed +// +#define HEATER_0_PIN PD11 + +#if ENABLED(FET_ORDER_EFB) // Hotend, Fan, Bed + #define HEATER_BED_PIN PD12 +#elif ENABLED(FET_ORDER_EEF) // Hotend, Hotend, Fan + #define HEATER_1_PIN PD4 +#elif ENABLED(FET_ORDER_EEB) // Hotend, Hotend, Bed + #define HEATER_1_PIN PD4 + #define HEATER_BED_PIN PD12 +#elif ENABLED(FET_ORDER_EFF) // Hotend, Fan, Fan + #define FAN1_PIN PD12 +#elif DISABLED(FET_ORDER_SF) // Not Spindle, Fan (i.e., "EFBF" or "EFBE") + #define HEATER_BED_PIN PD12 + #if EITHER(HAS_MULTI_HOTEND, HEATERS_PARALLEL) + #define HEATER_1_PIN PB9 + #else + #define FAN1_PIN PB9 + #endif +#endif + +#ifndef FAN_PIN + #if EITHER(FET_ORDER_EFB, FET_ORDER_EFF) // Hotend, Fan, Bed or Hotend, Fan, Fan + #define FAN_PIN PB5 + #elif EITHER(FET_ORDER_EEF, FET_ORDER_SF) // Hotend, Hotend, Fan or Spindle, Fan + #define FAN_PIN PD12 + #elif ENABLED(FET_ORDER_EEB) // Hotend, Hotend, Bed + #define FAN_PIN -1 // IO pin. Buffer needed + #else // Non-specific are "EFB" (i.e., "EFBF" or "EFBE") + #define FAN_PIN PB5 + #endif +#endif + +// +// Misc. Functions +// +//#define PS_ON_PIN PB9 + +#if HAS_TMC_UART + /** + * TMC2208/TMC2209 stepper drivers + * + * Hardware serial communication ports. + * If undefined software serial is used according to the pins below + */ + #define X_HARDWARE_SERIAL MSerial4 + #define Y_HARDWARE_SERIAL MSerial4 + #define Z_HARDWARE_SERIAL MSerial4 + #define E0_HARDWARE_SERIAL MSerial4 + #ifndef X_SLAVE_ADDRESS + #define X_SLAVE_ADDRESS 2 + #endif + #ifndef Y_SLAVE_ADDRESS + #define Y_SLAVE_ADDRESS 3 + #endif + #ifndef Z_SLAVE_ADDRESS + #define Z_SLAVE_ADDRESS 1 + #endif + #ifndef E0_SLAVE_ADDRESS + #define E0_SLAVE_ADDRESS 0 + #endif +#endif +// +// Temperature Sensors +// +#define TEMP_BED_PIN PC2 //TB +#define TEMP_0_PIN PC1 //TH1 +//#define TEMP_1_PIN PC3 //TH2 +#define TEMP_BOARD_PIN PC3 +#ifndef TEMP_SENSOR_BOARD + #define TEMP_SENSOR_BOARD 13 +#endif +#define FIL_RUNOUT_PIN PA10 // MT_DET + +// +// LCD Pins +// +#if HAS_WIRED_LCD + #define BEEPER_PIN PE12 + #define BTN_ENC PE11 + #define LCD_PINS_ENABLE PE10 + #define LCD_PINS_RS PE9 + #define BTN_EN1 PE4 + #define BTN_EN2 PE3 + #define LCD_PINS_D4 PE8 + #define LCD_PINS_D5 PE7 + #define LCD_PINS_D6 PB2 + #define LCD_PINS_D7 PB1 + + #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) + #define BTN_ENC_EN LCD_PINS_D7 // Detect the presence of the encoder + #endif + + #define BOARD_ST7920_DELAY_1 50 + #define BOARD_ST7920_DELAY_2 50 + #define BOARD_ST7920_DELAY_3 50 + +#endif // HAS_WIRED_LCD + +// +// SD Card +// +#define ENABLE_SPI1 +#define SD_DETECT_PIN PA4 +#define SCK_PIN PA5 +#define MISO_PIN PA6 +#define MOSI_PIN PA7 +#define SS_PIN PC4 diff --git a/buildroot/share/PlatformIO/ldscripts/eryone_ery32_mini.ld b/buildroot/share/PlatformIO/ldscripts/eryone_ery32_mini.ld new file mode 100644 index 0000000000..0458574256 --- /dev/null +++ b/buildroot/share/PlatformIO/ldscripts/eryone_ery32_mini.ld @@ -0,0 +1,14 @@ +MEMORY +{ + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K - 4K + rom (rx) : ORIGIN = 0x08004000, LENGTH = 512K - 16K +} + +/* Provide memory region aliases for common.inc */ +REGION_ALIAS("REGION_TEXT", rom); +REGION_ALIAS("REGION_DATA", ram); +REGION_ALIAS("REGION_BSS", ram); +REGION_ALIAS("REGION_RODATA", rom); + +/* Let common.inc handle the real work. */ +INCLUDE common.inc diff --git a/buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/mem-flash.inc b/buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/mem-flash.inc index ddb8876fa5..75030ec01a 100644 --- a/buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/mem-flash.inc +++ b/buildroot/share/PlatformIO/variants/marlin_MEEB_3DP/ld/mem-flash.inc @@ -1,5 +1,5 @@ MEMORY { - ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 61K - rom (rx) : ORIGIN = 0x08005000, LENGTH = 492K + ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 64K - 3K + rom (rx) : ORIGIN = 0x08005000, LENGTH = 512K - 20K } diff --git a/ini/stm32f1-maple.ini b/ini/stm32f1-maple.ini index e11aa03560..f86bf98ebd 100644 --- a/ini/stm32f1-maple.ini +++ b/ini/stm32f1-maple.ini @@ -400,3 +400,22 @@ board = genericSTM32F103VE board_build.ldscript = ZONESTAR_ZM3E_512K.ld build_flags = ${ZONESTAR_ZM3E_maple.build_flags} -DTONE_TIMER=1 -DTONE_CHANNEL=2 board_upload.maximum_size = 499712 + +# +# ERYONE ERY32 Mini (STM32F103VET6) +# +[env:ERYONE_ERY32_MINI_maple] +platform = ${common_stm32f1.platform} +extends = common_stm32f1 +board = genericSTM32F103VE +build_flags = ${common_stm32f1.build_flags} + -ffunction-sections -fdata-sections -nostdlib -MMD + -DMCU_STM32F103VE -DARDUINO_GENERIC_STM32F103V -DARDUINO_ARCH_STM32F1 -O0 + -DDEBUG_LEVEL=DEBUG_NONE -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 + -DSS_TIMER=4 +board_build.variant = MARLIN_F103Vx +board_build.ldscript = eryone_ery32_mini.ld +board_build.address = 0x08004000 +build_unflags = ${common_stm32f1.build_unflags} +extra_scripts = ${common_stm32f1.extra_scripts} + buildroot/share/PlatformIO/scripts/custom_board.py From e852732ea8e71d7e969520d0bcd4f242dc6755b2 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Fri, 22 Oct 2021 17:57:30 +1300 Subject: [PATCH 02/14] =?UTF-8?q?=F0=9F=90=9B=20Fix=20E3V2=20width/height?= =?UTF-8?q?=20defines=20(#22994)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/e3v2/common/dwin_api.h | 7 ++++--- Marlin/src/lcd/e3v2/creality/dwin_lcd.h | 3 --- Marlin/src/lcd/e3v2/marlinui/dwin_lcd.h | 5 ----- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/Marlin/src/lcd/e3v2/common/dwin_api.h b/Marlin/src/lcd/e3v2/common/dwin_api.h index 735907e4a4..aea13aa621 100644 --- a/Marlin/src/lcd/e3v2/common/dwin_api.h +++ b/Marlin/src/lcd/e3v2/common/dwin_api.h @@ -23,10 +23,11 @@ #include "../../../inc/MarlinConfig.h" -#ifndef DWIN_WIDTH +#if ENABLED(DWIN_MARLINUI_LANDSCAPE) + #define DWIN_WIDTH 480 + #define DWIN_HEIGHT 272 +#else #define DWIN_WIDTH 272 -#endif -#ifndef DWIN_HEIGHT #define DWIN_HEIGHT 480 #endif diff --git a/Marlin/src/lcd/e3v2/creality/dwin_lcd.h b/Marlin/src/lcd/e3v2/creality/dwin_lcd.h index 115781f094..b37a65977c 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin_lcd.h +++ b/Marlin/src/lcd/e3v2/creality/dwin_lcd.h @@ -29,9 +29,6 @@ * @brief 迪文屏控制操作函数 ********************************************************************************/ -#define DWIN_WIDTH 272 -#define DWIN_HEIGHT 480 - #include "../common/dwin_api.h" #include "../common/dwin_set.h" #include "../common/dwin_font.h" diff --git a/Marlin/src/lcd/e3v2/marlinui/dwin_lcd.h b/Marlin/src/lcd/e3v2/marlinui/dwin_lcd.h index 65d9394a85..3e80a0103e 100644 --- a/Marlin/src/lcd/e3v2/marlinui/dwin_lcd.h +++ b/Marlin/src/lcd/e3v2/marlinui/dwin_lcd.h @@ -28,11 +28,6 @@ #include "../../../inc/MarlinConfigPre.h" -#if ENABLED(DWIN_MARLINUI_LANDSCAPE) - #define DWIN_WIDTH 480 - #define DWIN_HEIGHT 272 -#endif - #include "../common/dwin_api.h" // Picture ID From 5b478cd5f6b6eae0343acbf169976f97b1ba5609 Mon Sep 17 00:00:00 2001 From: tombrazier <68918209+tombrazier@users.noreply.github.com> Date: Fri, 22 Oct 2021 21:56:05 +0100 Subject: [PATCH 03/14] =?UTF-8?q?=F0=9F=90=9B=20Fix=20probe=20temp=20compe?= =?UTF-8?q?nsation=20maths=20(#23004)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/probe_temp_comp.cpp | 63 +++++++++++--------- Marlin/src/feature/probe_temp_comp.h | 8 +-- Marlin/src/gcode/calibrate/G76_M192_M871.cpp | 2 +- 3 files changed, 40 insertions(+), 33 deletions(-) diff --git a/Marlin/src/feature/probe_temp_comp.cpp b/Marlin/src/feature/probe_temp_comp.cpp index 68984fe756..deae447568 100644 --- a/Marlin/src/feature/probe_temp_comp.cpp +++ b/Marlin/src/feature/probe_temp_comp.cpp @@ -24,6 +24,8 @@ #if ENABLED(PROBE_TEMP_COMPENSATION) +//#define DEBUG_PTC // Print extra debug output with 'M871' + #include "probe_temp_comp.h" #include @@ -79,9 +81,17 @@ void ProbeTempComp::print_offsets() { " temp: ", temp, "C; Offset: ", i < 0 ? 0.0f : sensor_z_offsets[s][i], " um" ); - temp += cali_info[s].temp_res; + temp += cali_info[s].temp_resolution; } } + #if ENABLED(DEBUG_PTC) + float meas[4] = { 0, 0, 0, 0 }; + compensate_measurement(TSI_PROBE, 27.5, meas[0]); + compensate_measurement(TSI_PROBE, 32.5, meas[1]); + compensate_measurement(TSI_PROBE, 77.5, meas[2]); + compensate_measurement(TSI_PROBE, 82.5, meas[3]); + SERIAL_ECHOLNPGM("DEBUG_PTC 27.5:", meas[0], " 32.5:", meas[1], " 77.5:", meas[2], " 82.5:", meas[3]); + #endif } void ProbeTempComp::prepare_new_calibration(const_float_t init_meas_z) { @@ -111,7 +121,7 @@ bool ProbeTempComp::finish_calibration(const TempSensorID tsi) { const uint8_t measurements = cali_info[tsi].measurements; const celsius_t start_temp = cali_info[tsi].start_temp, - res_temp = cali_info[tsi].temp_res; + res_temp = cali_info[tsi].temp_resolution; int16_t * const data = sensor_z_offsets[tsi]; // Extrapolate @@ -156,46 +166,45 @@ bool ProbeTempComp::finish_calibration(const TempSensorID tsi) { } void ProbeTempComp::compensate_measurement(const TempSensorID tsi, const celsius_t temp, float &meas_z) { - if (WITHIN(temp, cali_info[tsi].start_temp, cali_info[tsi].end_temp)) - meas_z -= get_offset_for_temperature(tsi, temp); -} - -float ProbeTempComp::get_offset_for_temperature(const TempSensorID tsi, const celsius_t temp) { const uint8_t measurements = cali_info[tsi].measurements; const celsius_t start_temp = cali_info[tsi].start_temp, - res_temp = cali_info[tsi].temp_res; + end_temp = cali_info[tsi].end_temp, + res_temp = cali_info[tsi].temp_resolution; const int16_t * const data = sensor_z_offsets[tsi]; - auto point = [&](uint8_t i) -> xy_float_t { - return xy_float_t({ static_cast(start_temp) + i * res_temp, static_cast(data[i]) }); + // Given a data index, return { celsius, zoffset } in the form { x, y } + auto tpoint = [&](uint8_t i) -> xy_float_t { + return xy_float_t({ static_cast(start_temp) + i * res_temp, i ? static_cast(data[i - 1]) : 0.0f }); }; + // Interpolate Z based on a temperature being within a given range auto linear_interp = [](const_float_t x, xy_float_t p1, xy_float_t p2) { - return (p2.y - p1.y) / (p2.x - p2.y) * (x - p1.x) + p1.y; + // zoffs1 + zoffset_per_toffset * toffset + return p1.y + (p2.y - p1.y) / (p2.x - p1.x) * (x - p1.x); }; - // Linear interpolation - uint8_t idx = static_cast((temp - start_temp) / res_temp); - // offset in µm float offset = 0.0f; - #if !defined(PTC_LINEAR_EXTRAPOLATION) || PTC_LINEAR_EXTRAPOLATION <= 0 - if (idx < 0) + #if PTC_LINEAR_EXTRAPOLATION + if (temp < start_temp) + offset = linear_interp(temp, tpoint(0), tpoint(PTC_LINEAR_EXTRAPOLATION)); + else if (temp >= end_temp) + offset = linear_interp(temp, tpoint(measurements - PTC_LINEAR_EXTRAPOLATION), tpoint(measurements)); + #else + if (temp < start_temp) offset = 0.0f; - else if (idx > measurements - 2) + else if (temp >= end_temp) offset = static_cast(data[measurements - 1]); - #else - if (idx < 0) - offset = linear_interp(temp, point(0), point(PTC_LINEAR_EXTRAPOLATION)); - else if (idx > measurements - 2) - offset = linear_interp(temp, point(measurements - PTC_LINEAR_EXTRAPOLATION - 1), point(measurements - 1)); #endif - else - offset = linear_interp(temp, point(idx), point(idx + 1)); + else { + // Linear interpolation + const int8_t idx = static_cast((temp - start_temp) / res_temp); + offset = linear_interp(temp, tpoint(idx), tpoint(idx + 1)); + } - // return offset in mm - return offset / 1000.0f; + // convert offset to mm and apply it + meas_z -= offset / 1000.0f; } bool ProbeTempComp::linear_regression(const TempSensorID tsi, float &k, float &d) { @@ -204,7 +213,7 @@ bool ProbeTempComp::linear_regression(const TempSensorID tsi, float &k, float &d if (!WITHIN(calib_idx, 2, cali_info[tsi].measurements)) return false; const celsius_t start_temp = cali_info[tsi].start_temp, - res_temp = cali_info[tsi].temp_res; + res_temp = cali_info[tsi].temp_resolution; const int16_t * const data = sensor_z_offsets[tsi]; float sum_x = start_temp, diff --git a/Marlin/src/feature/probe_temp_comp.h b/Marlin/src/feature/probe_temp_comp.h index f5f922410c..f24b9acd9b 100644 --- a/Marlin/src/feature/probe_temp_comp.h +++ b/Marlin/src/feature/probe_temp_comp.h @@ -33,9 +33,9 @@ enum TempSensorID : uint8_t { }; typedef struct { - uint8_t measurements; // Max. number of measurements to be stored (35 - 80°C) - celsius_t temp_res, // Resolution in °C between measurements - start_temp, // Base measurement; z-offset == 0 + uint8_t measurements; // Max. number of measurements to be stored (35 - 80°C) + celsius_t temp_resolution, // Resolution in °C between measurements + start_temp, // Base measurement; z-offset == 0 end_temp; } temp_calib_t; @@ -135,8 +135,6 @@ class ProbeTempComp { */ static float init_measurement; - static float get_offset_for_temperature(const TempSensorID tsi, const celsius_t temp); - /** * Fit a linear function in measured temperature offsets * to allow generating values of higher temperatures. diff --git a/Marlin/src/gcode/calibrate/G76_M192_M871.cpp b/Marlin/src/gcode/calibrate/G76_M192_M871.cpp index 170958cab4..946701050e 100644 --- a/Marlin/src/gcode/calibrate/G76_M192_M871.cpp +++ b/Marlin/src/gcode/calibrate/G76_M192_M871.cpp @@ -121,7 +121,7 @@ void GcodeSuite::G76() { temp_comp.prepare_new_calibration(measured_z); else temp_comp.push_back_new_measurement(sid, measured_z); - targ += cali_info_init[sid].temp_res; + targ += cali_info_init[sid].temp_resolution; } return measured_z; }; From f179e25cc640135f968ffb12a12fdf4bd0b14212 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 24 Oct 2021 23:32:34 -0500 Subject: [PATCH 04/14] =?UTF-8?q?=F0=9F=90=9B=20More=20explicit=20allocati?= =?UTF-8?q?on=20of=20solenoids?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In reference to #22887 --- Marlin/Configuration.h | 1 - Marlin/src/feature/solenoid.cpp | 40 +++----------------- Marlin/src/inc/Conditionals_post.h | 59 ++++++++++++++++++------------ Marlin/src/inc/SanityCheck.h | 2 +- 4 files changed, 41 insertions(+), 61 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index c50af25e63..e90e90b146 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -260,7 +260,6 @@ #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder - //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) diff --git a/Marlin/src/feature/solenoid.cpp b/Marlin/src/feature/solenoid.cpp index 623f223caa..b6795d1a1e 100644 --- a/Marlin/src/feature/solenoid.cpp +++ b/Marlin/src/feature/solenoid.cpp @@ -34,28 +34,12 @@ #include "../module/tool_change.h" #endif -#define HAS_SOLENOID(N) (HAS_SOLENOID_##N && (ENABLED(MANUAL_SOLENOID_CONTROL) || N < EXTRUDERS)) - // Used primarily with MANUAL_SOLENOID_CONTROL static void set_solenoid(const uint8_t num, const bool active) { const uint8_t value = active ? PE_MAGNET_ON_STATE : !PE_MAGNET_ON_STATE; + #define _SOL_CASE(N) case N: TERN_(HAS_SOLENOID_##N, OUT_WRITE(SOL##N##_PIN, value)); break; switch (num) { - case 0: OUT_WRITE(SOL0_PIN, value); break; - #if HAS_SOLENOID(1) - case 1: OUT_WRITE(SOL1_PIN, value); break; - #endif - #if HAS_SOLENOID(2) - case 2: OUT_WRITE(SOL2_PIN, value); break; - #endif - #if HAS_SOLENOID(3) - case 3: OUT_WRITE(SOL3_PIN, value); break; - #endif - #if HAS_SOLENOID(4) - case 4: OUT_WRITE(SOL4_PIN, value); break; - #endif - #if HAS_SOLENOID(5) - case 5: OUT_WRITE(SOL5_PIN, value); break; - #endif + REPEAT(8, _SOL_CASE) default: SERIAL_ECHO_MSG(STR_INVALID_SOLENOID); break; } @@ -67,25 +51,11 @@ static void set_solenoid(const uint8_t num, const bool active) { void enable_solenoid(const uint8_t num) { set_solenoid(num, true); } void disable_solenoid(const uint8_t num) { set_solenoid(num, false); } -void enable_solenoid_on_active_extruder() { enable_solenoid(active_extruder); } +void enable_solenoid_on_active_extruder() { } void disable_all_solenoids() { - disable_solenoid(0); - #if HAS_SOLENOID(1) - disable_solenoid(1); - #endif - #if HAS_SOLENOID(2) - disable_solenoid(2); - #endif - #if HAS_SOLENOID(3) - disable_solenoid(3); - #endif - #if HAS_SOLENOID(4) - disable_solenoid(4); - #endif - #if HAS_SOLENOID(5) - disable_solenoid(5); - #endif + #define _SOL_DISABLE(N) TERN_(HAS_SOLENOID_##N, disable_solenoid(N)); + REPEAT(8, _SOL_DISABLE) } #endif // EXT_SOLENOID || MANUAL_SOLENOID_CONTROL diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 1db4208a1f..e9e282c262 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -1633,9 +1633,6 @@ #if PIN_EXISTS(E0_MS1) #define HAS_E0_MS_PINS 1 #endif - #if PIN_EXISTS(SOL0) - #define HAS_SOLENOID_0 1 - #endif #if E_STEPPERS > 1 #if PIN_EXISTS(E1_ENABLE) || AXIS_IS_L64XX(E1) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E1)) @@ -1650,9 +1647,6 @@ #if PIN_EXISTS(E1_MS1) #define HAS_E1_MS_PINS 1 #endif - #if PIN_EXISTS(SOL1) - #define HAS_SOLENOID_1 1 - #endif #endif #if E_STEPPERS > 2 @@ -1668,9 +1662,6 @@ #if PIN_EXISTS(E2_MS1) #define HAS_E2_MS_PINS 1 #endif - #if PIN_EXISTS(SOL2) - #define HAS_SOLENOID_2 1 - #endif #endif #if E_STEPPERS > 3 @@ -1686,9 +1677,6 @@ #if PIN_EXISTS(E3_MS1) #define HAS_E3_MS_PINS 1 #endif - #if PIN_EXISTS(SOL3) - #define HAS_SOLENOID_3 1 - #endif #endif #if E_STEPPERS > 4 @@ -1704,9 +1692,6 @@ #if PIN_EXISTS(E4_MS1) #define HAS_E4_MS_PINS 1 #endif - #if PIN_EXISTS(SOL4) - #define HAS_SOLENOID_4 1 - #endif #endif #if E_STEPPERS > 5 @@ -1722,9 +1707,6 @@ #if PIN_EXISTS(E5_MS1) #define HAS_E5_MS_PINS 1 #endif - #if PIN_EXISTS(SOL5) - #define HAS_SOLENOID_5 1 - #endif #endif #if E_STEPPERS > 6 @@ -1740,9 +1722,6 @@ #if PIN_EXISTS(E6_MS1) #define HAS_E6_MS_PINS 1 #endif - #if PIN_EXISTS(SOL6) - #define HAS_SOLENOID_6 1 - #endif #endif #if E_STEPPERS > 7 @@ -1758,9 +1737,6 @@ #if PIN_EXISTS(E7_MS1) #define HAS_E7_MS_PINS 1 #endif - #if PIN_EXISTS(SOL7) - #define HAS_SOLENOID_7 1 - #endif #endif #if !defined(DISABLE_INACTIVE_E) && ENABLED(DISABLE_E) @@ -1770,6 +1746,41 @@ #undef DISABLE_INACTIVE_E #endif // HAS_EXTRUDERS +/** + * Set solenoid flags if any features use solenoids + * - EXT_SOLENOID (M380, M381) to enable/disable the extruder solenoid + * - MANUAL_SOLENOID_CONTROL (M380, M381) to enable/disable solenoids by index + * - PARKING_EXTRUDER uses SOL0_PIN and SOL1_PIN + * - SOLENOID_PROBE uses SOL1_PIN + * - Z_PROBE_SLED uses SOL1_PIN, when defined (unless EXT_SOLENOID is enabled) + */ +#if ANY(EXT_SOLENOID, MANUAL_SOLENOID_CONTROL, PARKING_EXTRUDER, SOLENOID_PROBE, Z_PROBE_SLED) + #if PIN_EXISTS(SOL0) && (EITHER(MANUAL_SOLENOID_CONTROL, PARKING_EXTRUDER) || BOTH(EXT_SOLENOID, HAS_EXTRUDERS)) + #define HAS_SOLENOID_0 1 + #endif + #if PIN_EXISTS(SOL1) && (ANY(MANUAL_SOLENOID_CONTROL, PARKING_EXTRUDER, SOLENOID_PROBE, Z_PROBE_SLED) || TERN0(EXT_SOLENOID, E_STEPPERS > 1)) + #define HAS_SOLENOID_1 1 + #endif + #if PIN_EXISTS(SOL2) && (ENABLED(MANUAL_SOLENOID_CONTROL) || TERN0(EXT_SOLENOID, E_STEPPERS > 2)) + #define HAS_SOLENOID_2 2 + #endif + #if PIN_EXISTS(SOL3) && (ENABLED(MANUAL_SOLENOID_CONTROL) || TERN0(EXT_SOLENOID, E_STEPPERS > 3)) + #define HAS_SOLENOID_3 3 + #endif + #if PIN_EXISTS(SOL4) && (ENABLED(MANUAL_SOLENOID_CONTROL) || TERN0(EXT_SOLENOID, E_STEPPERS > 4)) + #define HAS_SOLENOID_4 4 + #endif + #if PIN_EXISTS(SOL5) && (ENABLED(MANUAL_SOLENOID_CONTROL) || TERN0(EXT_SOLENOID, E_STEPPERS > 5)) + #define HAS_SOLENOID_5 5 + #endif + #if PIN_EXISTS(SOL6) && (ENABLED(MANUAL_SOLENOID_CONTROL) || TERN0(EXT_SOLENOID, E_STEPPERS > 6)) + #define HAS_SOLENOID_6 6 + #endif + #if PIN_EXISTS(SOL7) && (ENABLED(MANUAL_SOLENOID_CONTROL) || TERN0(EXT_SOLENOID, E_STEPPERS > 7)) + #define HAS_SOLENOID_7 7 + #endif +#endif + // // Trinamic Stepper Drivers // diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index abc38c0a5a..856d0c44c7 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1239,7 +1239,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS /** * (Magnetic) Parking Extruder requirements */ -#if ANY(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #if ENABLED(EXT_SOLENOID) #error "(MAGNETIC_)PARKING_EXTRUDER and EXT_SOLENOID are incompatible. (Pins are used twice.)" #elif EXTRUDERS != 2 From f6d211f77941d2df03db9493c8ad6b39c511ee63 Mon Sep 17 00:00:00 2001 From: Dennis Date: Mon, 25 Oct 2021 07:35:11 +0200 Subject: [PATCH 05/14] =?UTF-8?q?=F0=9F=90=9B=20Fix=20JyersUI=20current=20?= =?UTF-8?q?positions=20(scaling)=20(#23005)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index e53ca4f3ff..b2b8450316 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -888,21 +888,21 @@ void CrealityDWINClass::Draw_Status_Area(bool icons/*=false*/) { 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(" -?- ")); 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 * 10); + 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); } 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(" -?- ")); 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 * 10); + 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); } 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(" -?- ")); 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 * 100 : 0); + 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); } DWIN_UpdateLCD(); } From 0309fce1fd12cfe0259f67f9d2381d08041ae525 Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Mon, 25 Oct 2021 01:39:48 -0400 Subject: [PATCH 06/14] =?UTF-8?q?=E2=9C=A8=20Creality=20v2.4.S1=20(Ender?= =?UTF-8?q?=207)=20board=20=20(#23010)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/boards.h | 21 +++++------ Marlin/src/pins/pins.h | 2 ++ Marlin/src/pins/stm32f1/pins_CREALITY_V24S1.h | 36 +++++++++++++++++++ Marlin/src/pins/stm32f1/pins_CREALITY_V4.h | 9 +++-- 4 files changed, 55 insertions(+), 13 deletions(-) create mode 100644 Marlin/src/pins/stm32f1/pins_CREALITY_V24S1.h diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 82fd51e2a3..d5630ce4cb 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -346,16 +346,17 @@ #define BOARD_CREALITY_V431_D 4046 // Creality v4.3.1d (STM32F103RE) #define BOARD_CREALITY_V452 4047 // Creality v4.5.2 (STM32F103RE) #define BOARD_CREALITY_V453 4048 // Creality v4.5.3 (STM32F103RE) -#define BOARD_TRIGORILLA_PRO 4049 // Trigorilla Pro (STM32F103ZET6) -#define BOARD_FLY_MINI 4050 // FLYmaker FLY MINI (STM32F103RCT6) -#define BOARD_FLSUN_HISPEED 4051 // FLSUN HiSpeedV1 (STM32F103VET6) -#define BOARD_BEAST 4052 // STM32F103RET6 Libmaple-based controller -#define BOARD_MINGDA_MPX_ARM_MINI 4053 // STM32F103ZET6 Mingda MD-16 -#define BOARD_GTM32_PRO_VD 4054 // STM32F103VET6 controller -#define BOARD_ZONESTAR_ZM3E2 4055 // Zonestar ZM3E2 (STM32F103RCT6) -#define BOARD_ZONESTAR_ZM3E4 4056 // Zonestar ZM3E4 V1 (STM32F103VCT6) -#define BOARD_ZONESTAR_ZM3E4V2 4057 // Zonestar ZM3E4 V2 (STM32F103VCT6) -#define BOARD_ERYONE_ERY32_MINI 4058 // Eryone Ery32 mini (STM32F103VET6) +#define BOARD_CREALITY_V24S1 4049 // Creality v2.4.S1 (STM32F103RE) v101 as found in the Ender 7 +#define BOARD_TRIGORILLA_PRO 4050 // Trigorilla Pro (STM32F103ZET6) +#define BOARD_FLY_MINI 4051 // FLYmaker FLY MINI (STM32F103RCT6) +#define BOARD_FLSUN_HISPEED 4052 // FLSUN HiSpeedV1 (STM32F103VET6) +#define BOARD_BEAST 4053 // STM32F103RET6 Libmaple-based controller +#define BOARD_MINGDA_MPX_ARM_MINI 4054 // STM32F103ZET6 Mingda MD-16 +#define BOARD_GTM32_PRO_VD 4055 // STM32F103VET6 controller +#define BOARD_ZONESTAR_ZM3E2 4056 // Zonestar ZM3E2 (STM32F103RCT6) +#define BOARD_ZONESTAR_ZM3E4 4057 // Zonestar ZM3E4 V1 (STM32F103VCT6) +#define BOARD_ZONESTAR_ZM3E4V2 4058 // Zonestar ZM3E4 V2 (STM32F103VCT6) +#define BOARD_ERYONE_ERY32_MINI 4059 // Eryone Ery32 mini (STM32F103VET6) // // ARM Cortex-M4F diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 15794641ca..4c2b09a0d8 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -555,6 +555,8 @@ #include "stm32f1/pins_CREALITY_V452.h" // STM32F1 env:STM32F103RET6_creality env:STM32F103RET6_creality_maple #elif MB(CREALITY_V453) #include "stm32f1/pins_CREALITY_V453.h" // STM32F1 env:STM32F103RET6_creality env:STM32F103RET6_creality_maple +#elif MB(CREALITY_V24S1) + #include "stm32f1/pins_CREALITY_V24S1.h" // STM32F1 env:STM32F103RET6_creality env:STM32F103RET6_creality_maple #elif MB(TRIGORILLA_PRO) #include "stm32f1/pins_TRIGORILLA_PRO.h" // STM32F1 env:trigorilla_pro env:trigorilla_pro_maple #elif MB(FLY_MINI) diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1.h new file mode 100644 index 0000000000..ffd7baa00c --- /dev/null +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1.h @@ -0,0 +1,36 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2021 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 + +/** + * Creality v2.4.S1 (STM32F103RE) v101 as found in the Ender 7 board pin assignments + */ + +#define BOARD_INFO_NAME "Creality v2.4.S1 V101" +#define DEFAULT_MACHINE_NAME "Creality3D" + +// +// Heaters +// +#define HEATER_BED_PIN PA15 // HOT BED + +#include "pins_CREALITY_V4.h" diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h index c60d4dc2ba..ea58b5b3a9 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h @@ -134,9 +134,12 @@ // // Heaters / Fans // -#define HEATER_0_PIN PA1 // HEATER1 -#define HEATER_BED_PIN PA2 // HOT BED - +#ifndef HEATER_0_PIN + #define HEATER_0_PIN PA1 // HEATER1 +#endif +#ifndef HEATER_BED_PIN + #define HEATER_BED_PIN PA2 // HOT BED +#endif #ifndef FAN_PIN #define FAN_PIN PA0 // FAN #endif From 59503c6bbbcea81dcbe3e5ffa9ac175a01e7a2dc Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 28 Sep 2021 05:59:03 -0500 Subject: [PATCH 07/14] =?UTF-8?q?=F0=9F=8E=A8=20Apply=20F()=20to=20E3V2=20?= =?UTF-8?q?titles,=20popups?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/lcd/M0_M1.cpp | 5 +- Marlin/src/lcd/e3v2/common/dwin_api.h | 7 +- Marlin/src/lcd/e3v2/creality/dwin.cpp | 50 +- Marlin/src/lcd/e3v2/enhanced/dwin.cpp | 73 +-- Marlin/src/lcd/e3v2/enhanced/dwin.h | 30 +- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 642 +++++++++++++------------- Marlin/src/lcd/e3v2/jyersui/dwin.h | 6 +- 7 files changed, 428 insertions(+), 385 deletions(-) diff --git a/Marlin/src/gcode/lcd/M0_M1.cpp b/Marlin/src/gcode/lcd/M0_M1.cpp index 9ba6ed5fc7..241f11c813 100644 --- a/Marlin/src/gcode/lcd/M0_M1.cpp +++ b/Marlin/src/gcode/lcd/M0_M1.cpp @@ -71,7 +71,10 @@ void GcodeSuite::M0_M1() { else ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_USERWAIT)); #elif ENABLED(DWIN_CREALITY_LCD_ENHANCED) - DWIN_Popup_Confirm(ICON_BLTouch, parser.string_arg ?: GET_TEXT(MSG_STOPPED), GET_TEXT(MSG_USERWAIT)); + if (parser.string_arg) + DWIN_Popup_Confirm(ICON_BLTouch, parser.string_arg, GET_TEXT_F(MSG_USERWAIT)); + else + DWIN_Popup_Confirm(ICON_BLTouch, GET_TEXT_F(MSG_STOPPED), GET_TEXT_F(MSG_USERWAIT)); #else if (parser.string_arg) { diff --git a/Marlin/src/lcd/e3v2/common/dwin_api.h b/Marlin/src/lcd/e3v2/common/dwin_api.h index aea13aa621..37b1525ba3 100644 --- a/Marlin/src/lcd/e3v2/common/dwin_api.h +++ b/Marlin/src/lcd/e3v2/common/dwin_api.h @@ -175,9 +175,10 @@ void DWIN_Frame_AreaMove(uint8_t mode, uint8_t dir, uint16_t dis, // rlimit: For draw less chars than string length use rlimit void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, const char * const string, uint16_t rlimit=0xFFFF); -inline void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, FSTR_P title) { - // Note that this won't work on AVR, only 32-bit systems! - DWIN_Draw_String(bShow, size, color, bColor, x, y, FTOP(title)); +inline void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, FSTR_P const ftitle) { + char ctitle[strlen_P(FTOP(ftitle)) + 1]; + strcpy_P(ctitle, FTOP(ftitle)); + DWIN_Draw_String(bShow, size, color, bColor, x, y, ctitle); } // Draw a positive integer diff --git a/Marlin/src/lcd/e3v2/creality/dwin.cpp b/Marlin/src/lcd/e3v2/creality/dwin.cpp index 006ff5db26..54fa6f941b 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.cpp +++ b/Marlin/src/lcd/e3v2/creality/dwin.cpp @@ -359,12 +359,8 @@ inline void Clear_Title_Bar() { DWIN_Draw_Box(1, Color_Bg_Blue, 0, 0, DWIN_WIDTH, TITLE_HEIGHT); } -void Draw_Title(const char * const title) { - DWIN_Draw_String(false, DWIN_FONT_HEAD, Color_White, Color_Bg_Blue, 14, 4, (char*)title); -} - -void Draw_Title(FSTR_P title) { - DWIN_Draw_String(false, DWIN_FONT_HEAD, Color_White, Color_Bg_Blue, 14, 4, (char*)title); +void Draw_Title(FSTR_P ftitle) { + DWIN_Draw_String(false, DWIN_FONT_HEAD, Color_White, Color_Bg_Blue, 14, 4, ftitle); } inline void Clear_Menu_Area() { @@ -420,18 +416,25 @@ inline uint16_t nr_sd_menu_items() { return card.get_num_Files() + !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 Draw_Menu_Icon(const uint8_t line, const uint8_t icon) { DWIN_ICON_Show(ICON, icon, 26, MBASE(line) - 3); } -void Erase_Menu_Text(const uint8_t line) { - DWIN_Draw_Rectangle(1, Color_Bg_Black, LBLX, MBASE(line) - 14, 271, MBASE(line) + 28); +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 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); - if (icon) Draw_Menu_Icon(line, icon); - if (more) Draw_More_Icon(line); + _Decorate_Menu_Item(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 Draw_Menu_Line(const uint8_t line, const uint8_t icon=0, const char * const label=nullptr, bool more=false) { @@ -439,13 +442,14 @@ void Draw_Menu_Line(const uint8_t line, const uint8_t icon=0, const char * const DWIN_Draw_Line(Line_Color, 16, MBASE(line) + 33, 256, MBASE(line) + 34); } -void Draw_Menu_LineF(const uint8_t line, const uint8_t icon=0, FSTR_P label=nullptr, bool more=false) { - Draw_Menu_Line(line, icon, (char*)label, more); +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 Draw_Checkbox_Line(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, F(ison ? "X" : " ")); + 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); } @@ -1853,7 +1857,7 @@ void Draw_SDItem(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, ".."); + Draw_Menu_Line(row, ICON_Folder, F("..")); return; } @@ -2531,7 +2535,7 @@ void Item_HomeOffs_X(const uint8_t row) { } else { #ifdef USE_STRING_TITLES - Draw_Menu_LineF(row, ICON_HomeOffsetX, GET_TEXT_F(MSG_HOME_OFFSET_X)); + Draw_Menu_Line(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 @@ -2546,7 +2550,7 @@ void Item_HomeOffs_Y(const uint8_t row) { } else { #ifdef USE_STRING_TITLES - Draw_Menu_LineF(row, ICON_HomeOffsetY, GET_TEXT_F(MSG_HOME_OFFSET_Y)); + Draw_Menu_Line(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 @@ -2561,7 +2565,7 @@ void Item_HomeOffs_Z(const uint8_t row) { } else { #ifdef USE_STRING_TITLES - Draw_Menu_LineF(row, ICON_HomeOffsetZ, GET_TEXT_F(MSG_HOME_OFFSET_Z)); + Draw_Menu_Line(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 @@ -2604,8 +2608,8 @@ void Draw_HomeOff_Menu() { DWIN_Frame_TitleCopy(124, 431, 91, 12); // "Probe Offsets" #endif #ifdef USE_STRING_TITLES - Draw_Menu_LineF(1, ICON_ProbeOffsetX, GET_TEXT_F(MSG_ZPROBE_XOFFSET)); // Probe X Offset - Draw_Menu_LineF(2, ICON_ProbeOffsetY, GET_TEXT_F(MSG_ZPROBE_YOFFSET)); // Probe Y Offset + 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 #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" @@ -3090,7 +3094,7 @@ void HMI_Temperature() { } else { #ifdef USE_STRING_HEADINGS - Draw_Title(PREHEAT_1_LABEL " Settings"); // TODO: GET_TEXT_F + Draw_Title(F(PREHEAT_1_LABEL " Settings")); // TODO: GET_TEXT_F #else DWIN_Frame_TitleCopy(56, 15, 85, 14); // "Temperature" TODO: "PLA Settings" #endif @@ -3169,7 +3173,7 @@ void HMI_Temperature() { } else { #ifdef USE_STRING_HEADINGS - Draw_Title("ABS Settings"); // TODO: GET_TEXT_F + Draw_Title(F("ABS Settings")); // TODO: GET_TEXT_F #else DWIN_Frame_TitleCopy(56, 15, 85, 14); // "Temperature" TODO: "ABS Settings" #endif @@ -3252,7 +3256,7 @@ void Draw_Max_Speed_Menu() { } else { #ifdef USE_STRING_HEADINGS - Draw_Title("Max Speed (mm/s)"); // TODO: GET_TEXT_F + Draw_Title(F("Max Speed (mm/s)")); // TODO: GET_TEXT_F #else DWIN_Frame_TitleCopy(144, 16, 46, 11); // "Max Speed (mm/s)" #endif diff --git a/Marlin/src/lcd/e3v2/enhanced/dwin.cpp b/Marlin/src/lcd/e3v2/enhanced/dwin.cpp index 8bb5a155ee..81b83a0562 100644 --- a/Marlin/src/lcd/e3v2/enhanced/dwin.cpp +++ b/Marlin/src/lcd/e3v2/enhanced/dwin.cpp @@ -486,24 +486,31 @@ void Clear_Popup_Area() { DWIN_Draw_Rectangle(1, HMI_data.Background_Color, 0, 31, DWIN_WIDTH, DWIN_HEIGHT); } -void DWIN_Draw_Popup(uint8_t icon=0, const char * const msg1=nullptr, const char * const msg2=nullptr, uint8_t button=0) { +void DWIN_Draw_Popup1(const uint8_t icon) { DWINUI::ClearMenuArea(); Draw_Popup_Bkgd_60(); if (icon) DWINUI::Draw_Icon(icon, 101, 105); - if (msg1) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 210, msg1); - if (msg2) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 240, msg2); +} +void DWIN_Draw_Popup2(FSTR_P const fmsg2, uint8_t button) { + if (fmsg2) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 240, fmsg2); if (button) DWINUI::Draw_Icon(button, 86, 280); } -void DWIN_Popup_Confirm(uint8_t icon, const char * const msg1, const char * const msg2) { - HMI_SaveProcessID(WaitResponse); - DWIN_Draw_Popup(icon, msg1, msg2, ICON_Confirm_E); // Button Confirm - DWIN_UpdateLCD(); +void DWIN_Draw_Popup(const uint8_t icon, const char * const cmsg1, FSTR_P const fmsg2, uint8_t button) { + DWIN_Draw_Popup1(icon); + if (cmsg1) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 210, cmsg1); + DWIN_Draw_Popup2(fmsg2, button); +} + +void DWIN_Draw_Popup(const uint8_t icon, FSTR_P const fmsg1, FSTR_P const fmsg2, uint8_t button) { + DWIN_Draw_Popup1(icon); + if (fmsg1) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 210, fmsg1); + DWIN_Draw_Popup2(fmsg2, button); } -void DWIN_Popup_Continue(uint8_t icon, const char * const msg1, const char * const msg2) { +void DWIN_Popup_Continue(const uint8_t icon, FSTR_P const fmsg1, FSTR_P const fmsg2) { HMI_SaveProcessID(WaitResponse); - DWIN_Draw_Popup(icon, msg1, msg2, ICON_Continue_E); // Button Continue + DWIN_Draw_Popup(icon, fmsg1, fmsg2, ICON_Continue_E); // Button Continue DWIN_UpdateLCD(); } @@ -521,7 +528,7 @@ void DWIN_Popup_Continue(uint8_t icon, const char * const msg1, const char * con DWIN_UpdateLCD(); } else - DWIN_Popup_Confirm(ICON_TempTooLow, "Nozzle is too cold", "Preheat the hotend"); + DWIN_Popup_Confirm(ICON_TempTooLow, F("Nozzle is too cold"), F("Preheat the hotend")); } #endif @@ -565,7 +572,7 @@ void Popup_window_PauseOrStop() { DWINUI::Draw_Icon(ICON_Cancel_C, 146, 280); } else { - DWIN_Draw_Popup(ICON_BLTouch, "Please confirm", select_print.now == PRINT_PAUSE_RESUME ? GET_TEXT(MSG_PAUSE_PRINT) : GET_TEXT(MSG_STOP_PRINT)); + DWIN_Draw_Popup(ICON_BLTouch, F("Please confirm"), select_print.now == PRINT_PAUSE_RESUME ? GET_TEXT_F(MSG_PAUSE_PRINT) : GET_TEXT_F(MSG_STOP_PRINT)); DWINUI::Draw_Icon(ICON_Confirm_E, 26, 280); DWINUI::Draw_Icon(ICON_Cancel_E, 146, 280); } @@ -1386,7 +1393,7 @@ void HMI_PauseOrStop() { #ifdef ACTION_ON_CANCEL host_action_cancel(); #endif - DWIN_Draw_Popup(ICON_BLTouch, "Stopping..." , "Please wait until done."); + DWIN_Draw_Popup(ICON_BLTouch, F("Stopping...") , F("Please wait until done.")); } else Goto_PrintProcess(); // cancel stop @@ -1644,7 +1651,7 @@ void HMI_SaveProcessID(const uint8_t id) { void DWIN_StartHoming() { HMI_flag.home_flag = true; HMI_SaveProcessID(Homing); - DWIN_Draw_Popup(ICON_BLTouch, "Axis Homing", "Please wait until done."); + DWIN_Draw_Popup(ICON_BLTouch, F("Axis Homing"), F("Please wait until done.")); } void DWIN_CompletedHoming() { @@ -1659,7 +1666,7 @@ void DWIN_CompletedHoming() { void DWIN_MeshLevelingStart() { #if HAS_ONESTEP_LEVELING HMI_SaveProcessID(Leveling); - DWIN_Draw_Popup(ICON_AutoLeveling, GET_TEXT(MSG_BED_LEVELING), "Please wait until done."); + DWIN_Draw_Popup(ICON_AutoLeveling, GET_TEXT_F(MSG_BED_LEVELING), F("Please wait until done.")); #elif ENABLED(MESH_BED_LEVELING) Draw_ManualMesh_Menu(); #endif @@ -1682,27 +1689,27 @@ void DWIN_PidTuning(pidresult_t result) { switch (result) { case PID_BED_START: HMI_SaveProcessID(NothingToDo); - DWIN_Draw_Popup(ICON_TempTooHigh, GET_TEXT(MSG_PID_AUTOTUNE), "for BED is running."); + DWIN_Draw_Popup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), F("for BED is running.")); break; case PID_EXTR_START: HMI_SaveProcessID(NothingToDo); - DWIN_Draw_Popup(ICON_TempTooHigh, GET_TEXT(MSG_PID_AUTOTUNE), "for Nozzle is running."); + DWIN_Draw_Popup(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE), F("for Nozzle is running.")); break; case PID_BAD_EXTRUDER_NUM: checkkey = last_checkkey; - DWIN_Popup_Confirm(ICON_TempTooLow, "PID Autotune failed!", "Bad extruder"); + DWIN_Popup_Confirm(ICON_TempTooLow, F("PID Autotune failed!"), F("Bad extruder")); break; case PID_TUNING_TIMEOUT: checkkey = last_checkkey; - DWIN_Popup_Confirm(ICON_TempTooHigh, "Error", GET_TEXT(MSG_PID_TIMEOUT)); + DWIN_Popup_Confirm(ICON_TempTooHigh, F("Error"), GET_TEXT_F(MSG_PID_TIMEOUT)); break; case PID_TEMP_TOO_HIGH: checkkey = last_checkkey; - DWIN_Popup_Confirm(ICON_TempTooHigh, "PID Autotune failed!", "Temperature too high"); + DWIN_Popup_Confirm(ICON_TempTooHigh, F("PID Autotune failed!"), F("Temperature too high")); break; case PID_DONE: checkkey = last_checkkey; - DWIN_Popup_Confirm(ICON_TempTooLow, GET_TEXT(MSG_PID_AUTOTUNE), GET_TEXT(MSG_BUTTON_DONE)); + DWIN_Popup_Confirm(ICON_TempTooLow, GET_TEXT_F(MSG_PID_AUTOTUNE), GET_TEXT_F(MSG_BUTTON_DONE)); break; default: checkkey = last_checkkey; @@ -1864,24 +1871,24 @@ void DWIN_Redraw_screen() { #if ENABLED(ADVANCED_PAUSE_FEATURE) - void DWIN_Popup_Pause(const char *msg, uint8_t button = 0) { + void DWIN_Popup_Pause(FSTR_P const fmsg, uint8_t button = 0) { HMI_SaveProcessID(button ? WaitResponse : NothingToDo); - DWIN_Draw_Popup(ICON_BLTouch, "Advanced Pause", msg, button); + DWIN_Draw_Popup(ICON_BLTouch, F("Advanced Pause"), fmsg, button); ui.reset_status(true); } 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_PARKING: DWIN_Popup_Pause(GET_TEXT(MSG_PAUSE_PRINT_PARKING)); break; - case PAUSE_MESSAGE_CHANGING: DWIN_Popup_Pause(GET_TEXT(MSG_FILAMENT_CHANGE_INIT)); break; - case PAUSE_MESSAGE_UNLOAD: DWIN_Popup_Pause(GET_TEXT(MSG_FILAMENT_CHANGE_UNLOAD)); break; - case PAUSE_MESSAGE_WAITING: DWIN_Popup_Pause(GET_TEXT(MSG_ADVANCED_PAUSE_WAITING), ICON_Continue_E); break; - case PAUSE_MESSAGE_INSERT: DWIN_Popup_Continue(ICON_BLTouch, "Advanced Pause", GET_TEXT(MSG_FILAMENT_CHANGE_INSERT)); break; - case PAUSE_MESSAGE_LOAD: DWIN_Popup_Pause(GET_TEXT(MSG_FILAMENT_CHANGE_LOAD)); break; - case PAUSE_MESSAGE_PURGE: DWIN_Popup_Pause(GET_TEXT(MSG_FILAMENT_CHANGE_PURGE)); break; + case PAUSE_MESSAGE_PARKING: DWIN_Popup_Pause(GET_TEXT_F(MSG_PAUSE_PRINT_PARKING)); break; + case PAUSE_MESSAGE_CHANGING: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_INIT)); break; + case PAUSE_MESSAGE_UNLOAD: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_UNLOAD)); break; + case PAUSE_MESSAGE_WAITING: DWIN_Popup_Pause(GET_TEXT_F(MSG_ADVANCED_PAUSE_WAITING), ICON_Continue_E); break; + case PAUSE_MESSAGE_INSERT: DWIN_Popup_Continue(ICON_BLTouch, F("Advanced Pause"), GET_TEXT_F(MSG_FILAMENT_CHANGE_INSERT)); break; + case PAUSE_MESSAGE_LOAD: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_LOAD)); break; + case PAUSE_MESSAGE_PURGE: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE)); break; case PAUSE_MESSAGE_OPTION: DWIN_Popup_FilamentPurge(); break; - case PAUSE_MESSAGE_RESUME: DWIN_Popup_Pause(GET_TEXT(MSG_FILAMENT_CHANGE_RESUME)); break; - case PAUSE_MESSAGE_HEAT: DWIN_Popup_Pause(GET_TEXT(MSG_FILAMENT_CHANGE_HEAT), ICON_Continue_E); break; + case PAUSE_MESSAGE_RESUME: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_RESUME)); break; + case PAUSE_MESSAGE_HEAT: DWIN_Popup_Pause(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEAT), ICON_Continue_E); break; case PAUSE_MESSAGE_HEATING: ui.set_status_P(GET_TEXT(MSG_FILAMENT_CHANGE_HEATING)); break; case PAUSE_MESSAGE_STATUS: HMI_ReturnScreen(); break; default: break; @@ -1889,7 +1896,7 @@ void DWIN_Redraw_screen() { } void Draw_Popup_FilamentPurge() { - DWIN_Draw_Popup(ICON_BLTouch, "Advanced Pause", "Purge or Continue?"); + DWIN_Draw_Popup(ICON_BLTouch, F("Advanced Pause"), F("Purge or Continue?")); DWINUI::Draw_Icon(ICON_Confirm_E, 26, 280); DWINUI::Draw_Icon(ICON_Continue_E, 146, 280); Draw_Select_Highlight(true); @@ -1928,7 +1935,7 @@ void DWIN_Redraw_screen() { #if HAS_MESH void DWIN_MeshViewer() { if (!leveling_is_valid()) - DWIN_Popup_Continue(ICON_BLTouch, "Mesh viewer", "No valid mesh"); + DWIN_Popup_Continue(ICON_BLTouch, F("Mesh viewer"), F("No valid mesh")); else { HMI_SaveProcessID(WaitResponse); MeshViewer.Draw(); diff --git a/Marlin/src/lcd/e3v2/enhanced/dwin.h b/Marlin/src/lcd/e3v2/enhanced/dwin.h index 6b131592a8..f71d54b482 100644 --- a/Marlin/src/lcd/e3v2/enhanced/dwin.h +++ b/Marlin/src/lcd/e3v2/enhanced/dwin.h @@ -152,16 +152,6 @@ extern HMI_data_t HMI_data; extern uint8_t checkkey; extern millis_t dwin_heat_time; -// Popup windows -void DWIN_Popup_Confirm(uint8_t icon, const char * const msg1, const char * const msg2); -#if HAS_HOTEND || HAS_HEATED_BED - void DWIN_Popup_Temperature(const bool toohigh); -#endif -#if HAS_HOTEND - void Popup_Window_ETempTooLow(); -#endif -void Popup_Window_Resume(); - // SD Card void HMI_SDCardInit(); void HMI_SDCardUpdate(); @@ -278,3 +268,23 @@ void Draw_Steps_Menu(); #if EITHER(HAS_BED_PROBE, BABYSTEPPING) void Draw_ZOffsetWiz_Menu(); #endif + +// Popup windows + +void DWIN_Draw_Popup(const uint8_t icon, const char * const cmsg1, FSTR_P const fmsg2, uint8_t button=0); +void DWIN_Draw_Popup(const uint8_t icon, FSTR_P const fmsg1=nullptr, FSTR_P const fmsg2=nullptr, uint8_t button=0); + +template +void DWIN_Popup_Confirm(const uint8_t icon, T amsg1, U amsg2) { + HMI_SaveProcessID(WaitResponse); + DWIN_Draw_Popup(icon, amsg1, amsg2, ICON_Confirm_E); // Button Confirm + DWIN_UpdateLCD(); +} + +#if HAS_HOTEND || HAS_HEATED_BED + void DWIN_Popup_Temperature(const bool toohigh); +#endif +#if HAS_HOTEND + void Popup_Window_ETempTooLow(); +#endif +void Popup_Window_Resume(); diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index b2b8450316..9f50b2f287 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -470,19 +470,35 @@ uint16_t CrealityDWINClass::GetColor(uint8_t color, uint16_t original, bool ligh return Color_White; } -void CrealityDWINClass::Draw_Title(const char * title) { - DWIN_Draw_String(false, DWIN_FONT_HEAD, GetColor(eeprom_settings.menu_top_txt, Color_White, false), Color_Bg_Blue, (DWIN_WIDTH - strlen(title) * STAT_CHR_W) / 2, 5, title); +void CrealityDWINClass::Draw_Title(const char * 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 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 _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 CrealityDWINClass::Draw_Menu_Item(uint8_t row, uint8_t icon/*=0*/, const char * label1, const char * label2, bool more/*=false*/, bool centered/*=false*/) { - const uint8_t label_offset_y = !(label1 && label2) ? 0 : MENU_CHR_H * 3 / 5; - const uint8_t label1_offset_x = !centered ? LBLX : LBLX * 4/5 + _MAX(LBLX * 1U/5, (DWIN_WIDTH - LBLX - (label1 ? strlen(label1) : 0) * MENU_CHR_W) / 2); - const uint8_t label2_offset_x = !centered ? LBLX : LBLX * 4/5 + _MAX(LBLX * 1U/5, (DWIN_WIDTH - LBLX - (label2 ? strlen(label2) : 0) * MENU_CHR_W) / 2); + 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 - 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(GetColor(eeprom_settings.menu_split_line, Line_Color, true), 16, MBASE(row) + 33, 256, MBASE(row) + 33); // Draw Menu Line + _Decorate_Menu_Item(row, icon, more); +} + +void CrealityDWINClass::Draw_Menu_Item(uint8_t row, uint8_t icon/*=0*/, FSTR_P const flabel1, FSTR_P const flabel2, bool more/*=false*/, 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); } void CrealityDWINClass::Draw_Checkbox(uint8_t row, bool value) { @@ -742,7 +758,7 @@ void CrealityDWINClass::Draw_Print_confirm() { void CrealityDWINClass::Draw_SD_Item(uint8_t item, uint8_t row) { if (item == 0) - Draw_Menu_Item(0, ICON_Back, card.flag.workDirIsRoot ? "Back" : ".."); + Draw_Menu_Item(0, ICON_Back, card.flag.workDirIsRoot ? F("Back") : F("..")); else { card.getfilename_sorted(SD_ORDER(item - 1, card.get_num_Files())); char * const filename = card.longest_filename(); @@ -772,7 +788,7 @@ void CrealityDWINClass::Draw_SD_List(bool removed/*=false*/) { Draw_SD_Item(i, i); } else { - Draw_Menu_Item(0, ICON_Back, "Back"); + 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")); } @@ -907,7 +923,7 @@ void CrealityDWINClass::Draw_Status_Area(bool icons/*=false*/) { DWIN_UpdateLCD(); } -void CrealityDWINClass::Draw_Popup(PGM_P const line1, PGM_P const line2, PGM_P const line3, uint8_t mode, uint8_t icon/*=0*/) { +void CrealityDWINClass::Draw_Popup(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; @@ -916,9 +932,9 @@ void CrealityDWINClass::Draw_Popup(PGM_P const line1, PGM_P const line2, PGM_P c DWIN_Draw_Rectangle(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(line1)) / 2, ypos, line1); - DWIN_Draw_String(true, DWIN_FONT_MENU, Popup_Text_Color, Color_Bg_Window, (272 - 8 * strlen_P(line2)) / 2, ypos + 30, line2); - DWIN_Draw_String(true, DWIN_FONT_MENU, Popup_Text_Color, Color_Bg_Window, (272 - 8 * strlen_P(line3)) / 2, ypos + 60, line3); + 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 (mode == Popup) { selection = 0; DWIN_Draw_Rectangle(1, Confirm_Color, 26, 280, 125, 317); @@ -934,7 +950,7 @@ void CrealityDWINClass::Draw_Popup(PGM_P const line1, PGM_P const line2, PGM_P c } void MarlinUI::kill_screen(PGM_P const error, PGM_P const component) { - CrealityDWIN.Draw_Popup(PSTR("Printer Kill Reason:"), error, PSTR("Restart Required"), Wait, ICON_BLTouch); + CrealityDWIN.Draw_Popup(F("Printer Kill Reason:"), error, F("Restart Required"), Wait, ICON_BLTouch); } void CrealityDWINClass::Popup_Select() { @@ -1025,31 +1041,31 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case PREPARE_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else Draw_Main_Menu(1); break; case PREPARE_MOVE: if (draw) - Draw_Menu_Item(row, ICON_Axis, "Move", nullptr, true); + Draw_Menu_Item(row, ICON_Axis, F("Move"), nullptr, true); else Draw_Menu(Move); break; case PREPARE_DISABLE: if (draw) - Draw_Menu_Item(row, ICON_CloseMotor, "Disable Stepper"); + Draw_Menu_Item(row, ICON_CloseMotor, F("Disable Stepper")); else queue.inject_P(PSTR("M84")); break; case PREPARE_HOME: if (draw) - Draw_Menu_Item(row, ICON_SetHome, "Homing", nullptr, true); + Draw_Menu_Item(row, ICON_SetHome, F("Homing"), nullptr, true); else Draw_Menu(HomeMenu); break; case PREPARE_MANUALLEVEL: if (draw) - Draw_Menu_Item(row, ICON_PrintSize, "Manual Leveling", nullptr, true); + Draw_Menu_Item(row, ICON_PrintSize, F("Manual Leveling"), nullptr, true); else { if (axes_should_home()) { Popup_Handler(Home); @@ -1066,7 +1082,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_ZOFFSET_ITEM case PREPARE_ZOFFSET: if (draw) - Draw_Menu_Item(row, ICON_Zoffset, "Z-Offset", nullptr, true); + Draw_Menu_Item(row, ICON_Zoffset, F("Z-Offset"), nullptr, true); else { #if HAS_LEVELING level_state = planner.leveling_active; @@ -1080,13 +1096,13 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_PREHEAT case PREPARE_PREHEAT: if (draw) - Draw_Menu_Item(row, ICON_Temperature, "Preheat", nullptr, true); + Draw_Menu_Item(row, ICON_Temperature, F("Preheat"), nullptr, true); else Draw_Menu(Preheat); break; case PREPARE_COOLDOWN: if (draw) - Draw_Menu_Item(row, ICON_Cool, "Cooldown"); + Draw_Menu_Item(row, ICON_Cool, F("Cooldown")); else { TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); thermalManager.disable_all_heaters(); @@ -1097,7 +1113,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if ENABLED(ADVANCED_PAUSE_FEATURE) case PREPARE_CHANGEFIL: if (draw) { - Draw_Menu_Item(row, ICON_ResumeEEPROM, "Change Filament" + Draw_Menu_Item(row, ICON_ResumeEEPROM, F("Change Filament") #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) , nullptr, true #endif @@ -1138,13 +1154,13 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case HOME_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else Draw_Menu(Prepare, PREPARE_HOME); break; case HOME_ALL: if (draw) - Draw_Menu_Item(row, ICON_Homing, "Home All"); + Draw_Menu_Item(row, ICON_Homing, F("Home All")); else { Popup_Handler(Home); gcode.home_all_axes(true); @@ -1153,7 +1169,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case HOME_X: if (draw) - Draw_Menu_Item(row, ICON_MoveX, "Home X"); + Draw_Menu_Item(row, ICON_MoveX, F("Home X")); else { Popup_Handler(Home); gcode.process_subcommands_now_P(PSTR("G28 X")); @@ -1163,7 +1179,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case HOME_Y: if (draw) - Draw_Menu_Item(row, ICON_MoveY, "Home Y"); + Draw_Menu_Item(row, ICON_MoveY, F("Home Y")); else { Popup_Handler(Home); gcode.process_subcommands_now_P(PSTR("G28 Y")); @@ -1173,7 +1189,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case HOME_Z: if (draw) - Draw_Menu_Item(row, ICON_MoveZ,"Home Z"); + Draw_Menu_Item(row, ICON_MoveZ, F("Home Z")); else { Popup_Handler(Home); gcode.process_subcommands_now_P(PSTR("G28 Z")); @@ -1183,7 +1199,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case HOME_SET: if (draw) - Draw_Menu_Item(row, ICON_SetHome, "Set Home Position"); + Draw_Menu_Item(row, ICON_SetHome, F("Set Home Position")); else { gcode.process_subcommands_now_P(PSTR("G92 X0 Y0 Z0")); AudioFeedback(); @@ -1206,7 +1222,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case MOVE_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else { #if HAS_BED_PROBE probe_deployed = false; @@ -1217,7 +1233,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case MOVE_X: if (draw) { - Draw_Menu_Item(row, ICON_MoveX, "Move X"); + Draw_Menu_Item(row, ICON_MoveX, F("Move X")); Draw_Float(current_position.x, row, false); } else @@ -1225,7 +1241,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case MOVE_Y: if (draw) { - Draw_Menu_Item(row, ICON_MoveY, "Move Y"); + Draw_Menu_Item(row, ICON_MoveY, F("Move Y")); Draw_Float(current_position.y, row); } else @@ -1233,7 +1249,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case MOVE_Z: if (draw) { - Draw_Menu_Item(row, ICON_MoveZ, "Move Z"); + Draw_Menu_Item(row, ICON_MoveZ, F("Move Z")); Draw_Float(current_position.z, row); } else @@ -1243,7 +1259,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_HOTEND case MOVE_E: if (draw) { - Draw_Menu_Item(row, ICON_Extruder, "Extruder"); + Draw_Menu_Item(row, ICON_Extruder, F("Extruder")); current_position.e = 0; sync_plan_position(); Draw_Float(current_position.e, row); @@ -1269,7 +1285,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_BED_PROBE case MOVE_P: if (draw) { - Draw_Menu_Item(row, ICON_StockConfiguration, "Probe"); + Draw_Menu_Item(row, ICON_StockConfiguration, F("Probe")); Draw_Checkbox(row, probe_deployed); } else { @@ -1282,7 +1298,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ case MOVE_LIVE: if (draw) { - Draw_Menu_Item(row, ICON_Axis, "Live Movement"); + Draw_Menu_Item(row, ICON_Axis, F("Live Movement")); Draw_Checkbox(row, livemove); } else { @@ -1310,7 +1326,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case MLEVEL_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else { TERN_(HAS_LEVELING, set_bed_leveling_enabled(level_state)); Draw_Menu(Prepare, PREPARE_MANUALLEVEL); @@ -1319,7 +1335,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_BED_PROBE case MLEVEL_PROBE: if (draw) { - Draw_Menu_Item(row, ICON_Zoffset, "Use Probe"); + Draw_Menu_Item(row, ICON_Zoffset, F("Use Probe")); Draw_Checkbox(row, use_probe); } else { @@ -1344,7 +1360,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #endif case MLEVEL_BL: if (draw) - Draw_Menu_Item(row, ICON_AxisBL, "Bottom Left"); + Draw_Menu_Item(row, ICON_AxisBL, F("Bottom Left")); else { Popup_Handler(MoveWait); if (use_probe) { @@ -1365,7 +1381,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case MLEVEL_TL: if (draw) - Draw_Menu_Item(row, ICON_AxisTL, "Top Left"); + Draw_Menu_Item(row, ICON_AxisTL, F("Top Left")); else { Popup_Handler(MoveWait); if (use_probe) { @@ -1386,7 +1402,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case MLEVEL_TR: if (draw) - Draw_Menu_Item(row, ICON_AxisTR, "Top Right"); + Draw_Menu_Item(row, ICON_AxisTR, F("Top Right")); else { Popup_Handler(MoveWait); if (use_probe) { @@ -1407,7 +1423,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case MLEVEL_BR: if (draw) - Draw_Menu_Item(row, ICON_AxisBR, "Bottom Right"); + Draw_Menu_Item(row, ICON_AxisBR, F("Bottom Right")); else { Popup_Handler(MoveWait); if (use_probe) { @@ -1428,7 +1444,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case MLEVEL_C: if (draw) - Draw_Menu_Item(row, ICON_AxisC, "Center"); + Draw_Menu_Item(row, ICON_AxisC, F("Center")); else { Popup_Handler(MoveWait); if (use_probe) { @@ -1449,7 +1465,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case MLEVEL_ZPOS: if (draw) { - Draw_Menu_Item(row, ICON_SetZOffset, "Z Position"); + Draw_Menu_Item(row, ICON_SetZOffset, F("Z Position")); Draw_Float(mlev_z_pos, row, false, 100); } else @@ -1472,7 +1488,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case ZOFFSET_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else { liveadjust = false; TERN_(HAS_LEVELING, set_bed_leveling_enabled(level_state)); @@ -1481,7 +1497,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case ZOFFSET_HOME: if (draw) - Draw_Menu_Item(row, ICON_Homing, "Home Z Axis"); + Draw_Menu_Item(row, ICON_Homing, F("Home Z Axis")); else { Popup_Handler(Home); gcode.process_subcommands_now_P(PSTR("G28 Z")); @@ -1500,7 +1516,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case ZOFFSET_MODE: if (draw) { - Draw_Menu_Item(row, ICON_Zoffset, "Live Adjustment"); + Draw_Menu_Item(row, ICON_Zoffset, F("Live Adjustment")); Draw_Checkbox(row, liveadjust); } else { @@ -1527,7 +1543,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case ZOFFSET_OFFSET: if (draw) { - Draw_Menu_Item(row, ICON_SetZOffset, "Z Offset"); + Draw_Menu_Item(row, ICON_SetZOffset, F("Z Offset")); Draw_Float(zoffsetvalue, row, false, 100); } else @@ -1535,7 +1551,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case ZOFFSET_UP: if (draw) - Draw_Menu_Item(row, ICON_Axis, "Microstep Up"); + Draw_Menu_Item(row, ICON_Axis, F("Microstep Up")); else { if (zoffsetvalue < MAX_Z_OFFSET) { if (liveadjust) { @@ -1549,7 +1565,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case ZOFFSET_DOWN: if (draw) - Draw_Menu_Item(row, ICON_AxisD, "Microstep Down"); + Draw_Menu_Item(row, ICON_AxisD, F("Microstep Down")); else { if (zoffsetvalue > MIN_Z_OFFSET) { if (liveadjust) { @@ -1564,7 +1580,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if ENABLED(EEPROM_SETTINGS) case ZOFFSET_SAVE: if (draw) - Draw_Menu_Item(row, ICON_WriteEEPROM, "Save"); + Draw_Menu_Item(row, ICON_WriteEEPROM, F("Save")); else AudioFeedback(settings.save()); break; @@ -1587,13 +1603,13 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case PREHEAT_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else Draw_Menu(Prepare, PREPARE_PREHEAT); break; case PREHEAT_MODE: if (draw) { - Draw_Menu_Item(row, ICON_Homing, "Preheat Mode"); + Draw_Menu_Item(row, ICON_Homing, F("Preheat Mode")); Draw_Option(preheatmode, preheat_modes, row); } else @@ -1603,7 +1619,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if PREHEAT_COUNT >= 1 case PREHEAT_1: if (draw) - Draw_Menu_Item(row, ICON_Temperature, PREHEAT_1_LABEL); + Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_1_LABEL)); else { thermalManager.disable_all_heaters(); TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); @@ -1621,7 +1637,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if PREHEAT_COUNT >= 2 case PREHEAT_2: if (draw) - Draw_Menu_Item(row, ICON_Temperature, PREHEAT_2_LABEL); + Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_2_LABEL)); else { thermalManager.disable_all_heaters(); TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); @@ -1639,7 +1655,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if PREHEAT_COUNT >= 3 case PREHEAT_3: if (draw) - Draw_Menu_Item(row, ICON_Temperature, PREHEAT_3_LABEL); + Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_3_LABEL)); else { thermalManager.disable_all_heaters(); TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); @@ -1657,7 +1673,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if PREHEAT_COUNT >= 4 case PREHEAT_4: if (draw) - Draw_Menu_Item(row, ICON_Temperature, PREHEAT_4_LABEL); + Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_4_LABEL)); else { thermalManager.disable_all_heaters(); TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); @@ -1675,7 +1691,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if PREHEAT_COUNT >= 5 case PREHEAT_5: if (draw) - Draw_Menu_Item(row, ICON_Temperature, PREHEAT_5_LABEL); + Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_5_LABEL)); else { thermalManager.disable_all_heaters(); TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); @@ -1705,13 +1721,13 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case CHANGEFIL_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else Draw_Menu(Prepare, PREPARE_CHANGEFIL); break; case CHANGEFIL_LOAD: if (draw) - Draw_Menu_Item(row, ICON_WriteEEPROM, "Load Filament"); + Draw_Menu_Item(row, ICON_WriteEEPROM, F("Load Filament")); else { if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp) Popup_Handler(ETemp); @@ -1729,7 +1745,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case CHANGEFIL_UNLOAD: if (draw) - Draw_Menu_Item(row, ICON_ReadEEPROM, "Unload Filament"); + Draw_Menu_Item(row, ICON_ReadEEPROM, F("Unload Filament")); else { if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp) { Popup_Handler(ETemp); @@ -1748,7 +1764,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case CHANGEFIL_CHANGE: if (draw) - Draw_Menu_Item(row, ICON_ResumeEEPROM, "Change Filament"); + Draw_Menu_Item(row, ICON_ResumeEEPROM, F("Change Filament")); else { if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp) Popup_Handler(ETemp); @@ -1783,50 +1799,50 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case CONTROL_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else Draw_Main_Menu(2); break; case CONTROL_TEMP: if (draw) - Draw_Menu_Item(row, ICON_Temperature, "Temperature", nullptr, true); + Draw_Menu_Item(row, ICON_Temperature, F("Temperature"), nullptr, true); else Draw_Menu(TempMenu); break; case CONTROL_MOTION: if (draw) - Draw_Menu_Item(row, ICON_Motion, "Motion", nullptr, true); + Draw_Menu_Item(row, ICON_Motion, F("Motion"), nullptr, true); else Draw_Menu(Motion); break; case CONTROL_VISUAL: if (draw) - Draw_Menu_Item(row, ICON_PrintSize, "Visual", nullptr, true); + Draw_Menu_Item(row, ICON_PrintSize, F("Visual"), nullptr, true); else Draw_Menu(Visual); break; case CONTROL_ADVANCED: if (draw) - Draw_Menu_Item(row, ICON_Version, "Advanced", nullptr, true); + Draw_Menu_Item(row, ICON_Version, F("Advanced"), nullptr, true); else Draw_Menu(Advanced); break; #if ENABLED(EEPROM_SETTINGS) case CONTROL_SAVE: if (draw) - Draw_Menu_Item(row, ICON_WriteEEPROM, "Store Settings"); + Draw_Menu_Item(row, ICON_WriteEEPROM, F("Store Settings")); else AudioFeedback(settings.save()); break; case CONTROL_RESTORE: if (draw) - Draw_Menu_Item(row, ICON_ReadEEPROM, "Restore Settings"); + Draw_Menu_Item(row, ICON_ReadEEPROM, F("Restore Settings")); else AudioFeedback(settings.load()); break; case CONTROL_RESET: if (draw) - Draw_Menu_Item(row, ICON_Temperature, "Reset to Defaults"); + Draw_Menu_Item(row, ICON_Temperature, F("Reset to Defaults")); else { settings.reset(); AudioFeedback(); @@ -1835,7 +1851,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #endif case CONTROL_INFO: if (draw) - Draw_Menu_Item(row, ICON_Info, "Info"); + Draw_Menu_Item(row, ICON_Info, F("Info")); else Draw_Menu(Info); break; @@ -1859,14 +1875,14 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case TEMP_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else Draw_Menu(Control, CONTROL_TEMP); break; #if HAS_HOTEND case TEMP_HOTEND: if (draw) { - Draw_Menu_Item(row, ICON_SetEndTemp, "Hotend"); + Draw_Menu_Item(row, ICON_SetEndTemp, F("Hotend")); Draw_Float(thermalManager.temp_hotend[0].target, row, false, 1); } else @@ -1876,7 +1892,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_HEATED_BED case TEMP_BED: if (draw) { - Draw_Menu_Item(row, ICON_SetBedTemp, "Bed"); + Draw_Menu_Item(row, ICON_SetBedTemp, F("Bed")); Draw_Float(thermalManager.temp_bed.target, row, false, 1); } else @@ -1886,7 +1902,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_FAN case TEMP_FAN: if (draw) { - Draw_Menu_Item(row, ICON_FanSpeed, "Fan"); + Draw_Menu_Item(row, ICON_FanSpeed, F("Fan")); Draw_Float(thermalManager.fan_speed[0], row, false, 1); } else @@ -1896,7 +1912,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_HOTEND || HAS_HEATED_BED case TEMP_PID: if (draw) - Draw_Menu_Item(row, ICON_Step, "PID", nullptr, true); + Draw_Menu_Item(row, ICON_Step, F("PID"), nullptr, true); else Draw_Menu(PID); break; @@ -1904,7 +1920,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if PREHEAT_COUNT >= 1 case TEMP_PREHEAT1: if (draw) - Draw_Menu_Item(row, ICON_Step, PREHEAT_1_LABEL, nullptr, true); + Draw_Menu_Item(row, ICON_Step, F(PREHEAT_1_LABEL), nullptr, true); else Draw_Menu(Preheat1); break; @@ -1912,7 +1928,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if PREHEAT_COUNT >= 2 case TEMP_PREHEAT2: if (draw) - Draw_Menu_Item(row, ICON_Step, PREHEAT_2_LABEL, nullptr, true); + Draw_Menu_Item(row, ICON_Step, F(PREHEAT_2_LABEL), nullptr, true); else Draw_Menu(Preheat2); break; @@ -1920,7 +1936,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if PREHEAT_COUNT >= 3 case TEMP_PREHEAT3: if (draw) - Draw_Menu_Item(row, ICON_Step, PREHEAT_3_LABEL, nullptr, true); + Draw_Menu_Item(row, ICON_Step, F(PREHEAT_3_LABEL), nullptr, true); else Draw_Menu(Preheat3); break; @@ -1928,7 +1944,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if PREHEAT_COUNT >= 4 case TEMP_PREHEAT4: if (draw) - Draw_Menu_Item(row, ICON_Step, PREHEAT_4_LABEL, nullptr, true); + Draw_Menu_Item(row, ICON_Step, F(PREHEAT_4_LABEL), nullptr, true); else Draw_Menu(Preheat4); break; @@ -1936,7 +1952,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if PREHEAT_COUNT >= 5 case TEMP_PREHEAT5: if (draw) - Draw_Menu_Item(row, ICON_Step, PREHEAT_5_LABEL, nullptr, true); + Draw_Menu_Item(row, ICON_Step, F(PREHEAT_5_LABEL), nullptr, true); else Draw_Menu(Preheat5); break; @@ -1958,14 +1974,14 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case PID_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else Draw_Menu(TempMenu, TEMP_PID); break; #if HAS_HOTEND case PID_HOTEND: if (draw) - Draw_Menu_Item(row, ICON_HotendTemp, "Hotend", nullptr, true); + Draw_Menu_Item(row, ICON_HotendTemp, F("Hotend"), nullptr, true); else Draw_Menu(HotendPID); break; @@ -1973,14 +1989,14 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_HEATED_BED case PID_BED: if (draw) - Draw_Menu_Item(row, ICON_BedTemp, "Bed", nullptr, true); + Draw_Menu_Item(row, ICON_BedTemp, F("Bed"), nullptr, true); else Draw_Menu(BedPID); break; #endif case PID_CYCLES: if (draw) { - Draw_Menu_Item(row, ICON_FanSpeed, "Cycles"); + Draw_Menu_Item(row, ICON_FanSpeed, F("Cycles")); Draw_Float(PID_cycles, row, false, 1); } else @@ -2006,13 +2022,13 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case HOTENDPID_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else Draw_Menu(PID, PID_HOTEND); break; case HOTENDPID_TUNE: if (draw) - Draw_Menu_Item(row, ICON_HotendTemp, "Autotune"); + Draw_Menu_Item(row, ICON_HotendTemp, F("Autotune")); else { Popup_Handler(PIDWait); sprintf_P(cmd, PSTR("M303 E0 C%i S%i U1"), PID_cycles, PID_e_temp); @@ -2023,7 +2039,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case HOTENDPID_TEMP: if (draw) { - Draw_Menu_Item(row, ICON_Temperature, "Temperature"); + Draw_Menu_Item(row, ICON_Temperature, F("Temperature")); Draw_Float(PID_e_temp, row, false, 1); } else @@ -2031,7 +2047,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case HOTENDPID_KP: if (draw) { - Draw_Menu_Item(row, ICON_Version, "Kp Value"); + Draw_Menu_Item(row, ICON_Version, F("Kp Value")); Draw_Float(thermalManager.temp_hotend[0].pid.Kp, row, false, 100); } else @@ -2039,7 +2055,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case HOTENDPID_KI: if (draw) { - Draw_Menu_Item(row, ICON_Version, "Ki Value"); + Draw_Menu_Item(row, ICON_Version, F("Ki Value")); Draw_Float(unscalePID_i(thermalManager.temp_hotend[0].pid.Ki), row, false, 100); } else @@ -2047,7 +2063,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case HOTENDPID_KD: if (draw) { - Draw_Menu_Item(row, ICON_Version, "Kd Value"); + Draw_Menu_Item(row, ICON_Version, F("Kd Value")); Draw_Float(unscalePID_d(thermalManager.temp_hotend[0].pid.Kd), row, false, 100); } else @@ -2073,13 +2089,13 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case BEDPID_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else Draw_Menu(PID, PID_BED); break; case BEDPID_TUNE: if (draw) - Draw_Menu_Item(row, ICON_HotendTemp, "Autotune"); + Draw_Menu_Item(row, ICON_HotendTemp, F("Autotune")); else { Popup_Handler(PIDWait); sprintf_P(cmd, PSTR("M303 E-1 C%i S%i U1"), PID_cycles, PID_bed_temp); @@ -2090,7 +2106,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case BEDPID_TEMP: if (draw) { - Draw_Menu_Item(row, ICON_Temperature, "Temperature"); + Draw_Menu_Item(row, ICON_Temperature, F("Temperature")); Draw_Float(PID_bed_temp, row, false, 1); } else @@ -2098,7 +2114,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case BEDPID_KP: if (draw) { - Draw_Menu_Item(row, ICON_Version, "Kp Value"); + Draw_Menu_Item(row, ICON_Version, F("Kp Value")); Draw_Float(thermalManager.temp_bed.pid.Kp, row, false, 100); } else { @@ -2107,7 +2123,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case BEDPID_KI: if (draw) { - Draw_Menu_Item(row, ICON_Version, "Ki Value"); + Draw_Menu_Item(row, ICON_Version, F("Ki Value")); Draw_Float(unscalePID_i(thermalManager.temp_bed.pid.Ki), row, false, 100); } else @@ -2115,7 +2131,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case BEDPID_KD: if (draw) { - Draw_Menu_Item(row, ICON_Version, "Kd Value"); + Draw_Menu_Item(row, ICON_Version, F("Kd Value")); Draw_Float(unscalePID_d(thermalManager.temp_bed.pid.Kd), row, false, 100); } else @@ -2137,14 +2153,14 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case PREHEAT1_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else Draw_Menu(TempMenu, TEMP_PREHEAT1); break; #if HAS_HOTEND case PREHEAT1_HOTEND: if (draw) { - Draw_Menu_Item(row, ICON_SetEndTemp, "Hotend"); + Draw_Menu_Item(row, ICON_SetEndTemp, F("Hotend")); Draw_Float(ui.material_preset[0].hotend_temp, row, false, 1); } else @@ -2154,7 +2170,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_HEATED_BED case PREHEAT1_BED: if (draw) { - Draw_Menu_Item(row, ICON_SetBedTemp, "Bed"); + Draw_Menu_Item(row, ICON_SetBedTemp, F("Bed")); Draw_Float(ui.material_preset[0].bed_temp, row, false, 1); } else @@ -2164,7 +2180,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_FAN case PREHEAT1_FAN: if (draw) { - Draw_Menu_Item(row, ICON_FanSpeed, "Fan"); + Draw_Menu_Item(row, ICON_FanSpeed, F("Fan")); Draw_Float(ui.material_preset[0].fan_speed, row, false, 1); } else @@ -2187,14 +2203,14 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case PREHEAT2_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else Draw_Menu(TempMenu, TEMP_PREHEAT2); break; #if HAS_HOTEND case PREHEAT2_HOTEND: if (draw) { - Draw_Menu_Item(row, ICON_SetEndTemp, "Hotend"); + Draw_Menu_Item(row, ICON_SetEndTemp, F("Hotend")); Draw_Float(ui.material_preset[1].hotend_temp, row, false, 1); } else @@ -2204,7 +2220,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_HEATED_BED case PREHEAT2_BED: if (draw) { - Draw_Menu_Item(row, ICON_SetBedTemp, "Bed"); + Draw_Menu_Item(row, ICON_SetBedTemp, F("Bed")); Draw_Float(ui.material_preset[1].bed_temp, row, false, 1); } else @@ -2214,7 +2230,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_FAN case PREHEAT2_FAN: if (draw) { - Draw_Menu_Item(row, ICON_FanSpeed, "Fan"); + Draw_Menu_Item(row, ICON_FanSpeed, F("Fan")); Draw_Float(ui.material_preset[1].fan_speed, row, false, 1); } else @@ -2237,14 +2253,14 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case PREHEAT3_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else Draw_Menu(TempMenu, TEMP_PREHEAT3); break; #if HAS_HOTEND case PREHEAT3_HOTEND: if (draw) { - Draw_Menu_Item(row, ICON_SetEndTemp, "Hotend"); + Draw_Menu_Item(row, ICON_SetEndTemp, F("Hotend")); Draw_Float(ui.material_preset[2].hotend_temp, row, false, 1); } else @@ -2254,7 +2270,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_HEATED_BED case PREHEAT3_BED: if (draw) { - Draw_Menu_Item(row, ICON_SetBedTemp, "Bed"); + Draw_Menu_Item(row, ICON_SetBedTemp, F("Bed")); Draw_Float(ui.material_preset[2].bed_temp, row, false, 1); } else @@ -2264,7 +2280,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_FAN case PREHEAT3_FAN: if (draw) { - Draw_Menu_Item(row, ICON_FanSpeed, "Fan"); + Draw_Menu_Item(row, ICON_FanSpeed, F("Fan")); Draw_Float(ui.material_preset[2].fan_speed, row, false, 1); } else @@ -2287,14 +2303,14 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case PREHEAT4_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else Draw_Menu(TempMenu, TEMP_PREHEAT4); break; #if HAS_HOTEND case PREHEAT4_HOTEND: if (draw) { - Draw_Menu_Item(row, ICON_SetEndTemp, "Hotend"); + Draw_Menu_Item(row, ICON_SetEndTemp, F("Hotend")); Draw_Float(ui.material_preset[3].hotend_temp, row, false, 1); } else @@ -2304,7 +2320,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_HEATED_BED case PREHEAT4_BED: if (draw) { - Draw_Menu_Item(row, ICON_SetBedTemp, "Bed"); + Draw_Menu_Item(row, ICON_SetBedTemp, F("Bed")); Draw_Float(ui.material_preset[3].bed_temp, row, false, 1); } else @@ -2314,7 +2330,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_FAN case PREHEAT4_FAN: if (draw) { - Draw_Menu_Item(row, ICON_FanSpeed, "Fan"); + Draw_Menu_Item(row, ICON_FanSpeed, F("Fan")); Draw_Float(ui.material_preset[3].fan_speed, row, false, 1); } else @@ -2337,14 +2353,14 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case PREHEAT5_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else Draw_Menu(TempMenu, TEMP_PREHEAT5); break; #if HAS_HOTEND case PREHEAT5_HOTEND: if (draw) { - Draw_Menu_Item(row, ICON_SetEndTemp, "Hotend"); + Draw_Menu_Item(row, ICON_SetEndTemp, F("Hotend")); Draw_Float(ui.material_preset[4].hotend_temp, row, false, 1); } else @@ -2354,7 +2370,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_HEATED_BED case PREHEAT5_BED: if (draw) { - Draw_Menu_Item(row, ICON_SetBedTemp, "Bed"); + Draw_Menu_Item(row, ICON_SetBedTemp, F("Bed")); Draw_Float(ui.material_preset[4].bed_temp, row, false, 1); } else @@ -2364,7 +2380,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_FAN case PREHEAT5_FAN: if (draw) { - Draw_Menu_Item(row, ICON_FanSpeed, "Fan"); + Draw_Menu_Item(row, ICON_FanSpeed, F("Fan")); Draw_Float(ui.material_preset[4].fan_speed, row, false, 1); } else @@ -2389,46 +2405,46 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case MOTION_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else Draw_Menu(Control, CONTROL_MOTION); break; case MOTION_HOMEOFFSETS: if (draw) - Draw_Menu_Item(row, ICON_SetHome, "Home Offsets", nullptr, true); + Draw_Menu_Item(row, ICON_SetHome, F("Home Offsets"), nullptr, true); else Draw_Menu(HomeOffsets); break; case MOTION_SPEED: if (draw) - Draw_Menu_Item(row, ICON_MaxSpeed, "Max Speed", nullptr, true); + Draw_Menu_Item(row, ICON_MaxSpeed, F("Max Speed"), nullptr, true); else Draw_Menu(MaxSpeed); break; case MOTION_ACCEL: if (draw) - Draw_Menu_Item(row, ICON_MaxAccelerated, "Max Acceleration", nullptr, true); + Draw_Menu_Item(row, ICON_MaxAccelerated, F("Max Acceleration"), nullptr, true); else Draw_Menu(MaxAcceleration); break; #if HAS_CLASSIC_JERK case MOTION_JERK: if (draw) - Draw_Menu_Item(row, ICON_MaxJerk, "Max Jerk", nullptr, true); + Draw_Menu_Item(row, ICON_MaxJerk, F("Max Jerk"), nullptr, true); else Draw_Menu(MaxJerk); break; #endif case MOTION_STEPS: if (draw) - Draw_Menu_Item(row, ICON_Step, "Steps/mm", nullptr, true); + Draw_Menu_Item(row, ICON_Step, F("Steps/mm"), nullptr, true); else Draw_Menu(Steps); break; #if HAS_HOTEND case MOTION_FLOW: if (draw) { - Draw_Menu_Item(row, ICON_Speed, "Flow Rate"); + Draw_Menu_Item(row, ICON_Speed, F("Flow Rate")); Draw_Float(planner.flow_percentage[0], row, false, 1); } else @@ -2448,13 +2464,13 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case HOMEOFFSETS_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else Draw_Menu(Motion, MOTION_HOMEOFFSETS); break; case HOMEOFFSETS_XOFFSET: if (draw) { - Draw_Menu_Item(row, ICON_StepX, "X Offset"); + Draw_Menu_Item(row, ICON_StepX, F("X Offset")); Draw_Float(home_offset.x, row, false, 100); } else @@ -2462,7 +2478,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case HOMEOFFSETS_YOFFSET: if (draw) { - Draw_Menu_Item(row, ICON_StepY, "Y Offset"); + Draw_Menu_Item(row, ICON_StepY, F("Y Offset")); Draw_Float(home_offset.y, row, false, 100); } else @@ -2482,13 +2498,13 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case SPEED_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else Draw_Menu(Motion, MOTION_SPEED); break; case SPEED_X: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedX, "X Axis"); + Draw_Menu_Item(row, ICON_MaxSpeedX, F("X Axis")); Draw_Float(planner.settings.max_feedrate_mm_s[X_AXIS], row, false, 1); } else @@ -2498,7 +2514,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_Y_AXIS case SPEED_Y: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedY, "Y Axis"); + Draw_Menu_Item(row, ICON_MaxSpeedY, F("Y Axis")); Draw_Float(planner.settings.max_feedrate_mm_s[Y_AXIS], row, false, 1); } else @@ -2509,7 +2525,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_Z_AXIS case SPEED_Z: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedZ, "Z Axis"); + Draw_Menu_Item(row, ICON_MaxSpeedZ, F("Z Axis")); Draw_Float(planner.settings.max_feedrate_mm_s[Z_AXIS], row, false, 1); } else @@ -2520,7 +2536,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_HOTEND case SPEED_E: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedE, "Extruder"); + Draw_Menu_Item(row, ICON_MaxSpeedE, F("Extruder")); Draw_Float(planner.settings.max_feedrate_mm_s[E_AXIS], row, false, 1); } else @@ -2542,13 +2558,13 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case ACCEL_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else Draw_Menu(Motion, MOTION_ACCEL); break; case ACCEL_X: if (draw) { - Draw_Menu_Item(row, ICON_MaxAccX, "X Axis"); + Draw_Menu_Item(row, ICON_MaxAccX, F("X Axis")); Draw_Float(planner.settings.max_acceleration_mm_per_s2[X_AXIS], row, false, 1); } else @@ -2556,7 +2572,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case ACCEL_Y: if (draw) { - Draw_Menu_Item(row, ICON_MaxAccY, "Y Axis"); + Draw_Menu_Item(row, ICON_MaxAccY, F("Y Axis")); Draw_Float(planner.settings.max_acceleration_mm_per_s2[Y_AXIS], row, false, 1); } else @@ -2564,7 +2580,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case ACCEL_Z: if (draw) { - Draw_Menu_Item(row, ICON_MaxAccZ, "Z Axis"); + Draw_Menu_Item(row, ICON_MaxAccZ, F("Z Axis")); Draw_Float(planner.settings.max_acceleration_mm_per_s2[Z_AXIS], row, false, 1); } else @@ -2573,7 +2589,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_HOTEND case ACCEL_E: if (draw) { - Draw_Menu_Item(row, ICON_MaxAccE, "Extruder"); + Draw_Menu_Item(row, ICON_MaxAccE, F("Extruder")); Draw_Float(planner.settings.max_acceleration_mm_per_s2[E_AXIS], row, false, 1); } else @@ -2595,13 +2611,13 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case JERK_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else Draw_Menu(Motion, MOTION_JERK); break; case JERK_X: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedJerkX, "X Axis"); + Draw_Menu_Item(row, ICON_MaxSpeedJerkX, F("X Axis")); Draw_Float(planner.max_jerk[X_AXIS], row, false, 10); } else @@ -2609,7 +2625,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case JERK_Y: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedJerkY, "Y Axis"); + Draw_Menu_Item(row, ICON_MaxSpeedJerkY, F("Y Axis")); Draw_Float(planner.max_jerk[Y_AXIS], row, false, 10); } else @@ -2617,7 +2633,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case JERK_Z: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedJerkZ, "Z Axis"); + Draw_Menu_Item(row, ICON_MaxSpeedJerkZ, F("Z Axis")); Draw_Float(planner.max_jerk[Z_AXIS], row, false, 10); } else @@ -2626,7 +2642,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_HOTEND case JERK_E: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeedJerkE, "Extruder"); + Draw_Menu_Item(row, ICON_MaxSpeedJerkE, F("Extruder")); Draw_Float(planner.max_jerk[E_AXIS], row, false, 10); } else @@ -2648,13 +2664,13 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case STEPS_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else Draw_Menu(Motion, MOTION_STEPS); break; case STEPS_X: if (draw) { - Draw_Menu_Item(row, ICON_StepX, "X Axis"); + Draw_Menu_Item(row, ICON_StepX, F("X Axis")); Draw_Float(planner.settings.axis_steps_per_mm[X_AXIS], row, false, 10); } else @@ -2662,7 +2678,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case STEPS_Y: if (draw) { - Draw_Menu_Item(row, ICON_StepY, "Y Axis"); + Draw_Menu_Item(row, ICON_StepY, F("Y Axis")); Draw_Float(planner.settings.axis_steps_per_mm[Y_AXIS], row, false, 10); } else @@ -2670,7 +2686,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case STEPS_Z: if (draw) { - Draw_Menu_Item(row, ICON_StepZ, "Z Axis"); + Draw_Menu_Item(row, ICON_StepZ, F("Z Axis")); Draw_Float(planner.settings.axis_steps_per_mm[Z_AXIS], row, false, 10); } else @@ -2679,7 +2695,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_HOTEND case STEPS_E: if (draw) { - Draw_Menu_Item(row, ICON_StepE, "Extruder"); + Draw_Menu_Item(row, ICON_StepE, F("Extruder")); Draw_Float(planner.settings.axis_steps_per_mm[E_AXIS], row, false, 10); } else @@ -2701,19 +2717,19 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case VISUAL_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else Draw_Menu(Control, CONTROL_VISUAL); break; case VISUAL_BACKLIGHT: if (draw) - Draw_Menu_Item(row, ICON_Brightness, "Display Off"); + Draw_Menu_Item(row, ICON_Brightness, F("Display Off")); else ui.set_brightness(0); break; case VISUAL_BRIGHTNESS: if (draw) { - Draw_Menu_Item(row, ICON_Brightness, "LCD Brightness"); + Draw_Menu_Item(row, ICON_Brightness, F("LCD Brightness")); Draw_Float(ui.brightness, row, false, 1); } else @@ -2721,7 +2737,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case VISUAL_TIME_FORMAT: if (draw) { - Draw_Menu_Item(row, ICON_PrintTime, "Progress as __h__m"); + Draw_Menu_Item(row, ICON_PrintTime, F("Progress as __h__m")); Draw_Checkbox(row, eeprom_settings.time_format_textual); } else { @@ -2731,7 +2747,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case VISUAL_COLOR_THEMES: if (draw) - Draw_Menu_Item(row, ICON_MaxSpeed, "UI Color Settings", nullptr, true); + Draw_Menu_Item(row, ICON_MaxSpeed, F("UI Color Settings"), nullptr, true); else Draw_Menu(ColorSettings); break; @@ -2757,13 +2773,13 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case COLORSETTINGS_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else Draw_Menu(Visual, VISUAL_COLOR_THEMES); break; case COLORSETTINGS_CURSOR: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, "Cursor"); + Draw_Menu_Item(row, ICON_MaxSpeed, F("Cursor")); Draw_Option(eeprom_settings.cursor_color, color_names, row, false, true); } else @@ -2771,7 +2787,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case COLORSETTINGS_SPLIT_LINE: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, "Menu Split Line"); + Draw_Menu_Item(row, ICON_MaxSpeed, F("Menu Split Line")); Draw_Option(eeprom_settings.menu_split_line, color_names, row, false, true); } else @@ -2779,7 +2795,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case COLORSETTINGS_MENU_TOP_TXT: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, "Menu Header Text"); + Draw_Menu_Item(row, ICON_MaxSpeed, F("Menu Header Text")); Draw_Option(eeprom_settings.menu_top_txt, color_names, row, false, true); } else @@ -2787,7 +2803,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case COLORSETTINGS_MENU_TOP_BG: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, "Menu Header Bg"); + Draw_Menu_Item(row, ICON_MaxSpeed, F("Menu Header Bg")); Draw_Option(eeprom_settings.menu_top_bg, color_names, row, false, true); } else @@ -2795,7 +2811,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case COLORSETTINGS_HIGHLIGHT_BORDER: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, "Highlight Box"); + Draw_Menu_Item(row, ICON_MaxSpeed, F("Highlight Box")); Draw_Option(eeprom_settings.highlight_box, color_names, row, false, true); } else @@ -2803,7 +2819,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case COLORSETTINGS_PROGRESS_PERCENT: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, "Progress Percent"); + Draw_Menu_Item(row, ICON_MaxSpeed, F("Progress Percent")); Draw_Option(eeprom_settings.progress_percent, color_names, row, false, true); } else @@ -2811,7 +2827,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case COLORSETTINGS_PROGRESS_TIME: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, "Progress Time"); + Draw_Menu_Item(row, ICON_MaxSpeed, F("Progress Time")); Draw_Option(eeprom_settings.progress_time, color_names, row, false, true); } else @@ -2819,7 +2835,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case COLORSETTINGS_PROGRESS_STATUS_BAR: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, "Status Bar Text"); + Draw_Menu_Item(row, ICON_MaxSpeed, F("Status Bar Text")); Draw_Option(eeprom_settings.status_bar_text, color_names, row, false, true); } else @@ -2827,7 +2843,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case COLORSETTINGS_PROGRESS_STATUS_AREA: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, "Status Area Text"); + Draw_Menu_Item(row, ICON_MaxSpeed, F("Status Area Text")); Draw_Option(eeprom_settings.status_area_text, color_names, row, false, true); } else @@ -2835,7 +2851,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case COLORSETTINGS_PROGRESS_COORDINATES: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, "Coordinates Text"); + Draw_Menu_Item(row, ICON_MaxSpeed, F("Coordinates Text")); Draw_Option(eeprom_settings.coordinates_text, color_names, row, false, true); } else @@ -2843,7 +2859,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case COLORSETTINGS_PROGRESS_COORDINATES_LINE: if (draw) { - Draw_Menu_Item(row, ICON_MaxSpeed, "Coordinates Line"); + Draw_Menu_Item(row, ICON_MaxSpeed, F("Coordinates Line")); Draw_Option(eeprom_settings.coordinates_split_line, color_names, row, false, true); } else @@ -2870,7 +2886,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case ADVANCED_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else Draw_Menu(Control, CONTROL_ADVANCED); break; @@ -2878,7 +2894,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if ENABLED(SOUND_MENU_ITEM) case ADVANCED_BEEPER: if (draw) { - Draw_Menu_Item(row, ICON_Version, "LCD Beeper"); + Draw_Menu_Item(row, ICON_Version, F("LCD Beeper")); Draw_Checkbox(row, ui.buzzer_enabled); } else { @@ -2891,7 +2907,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_BED_PROBE case ADVANCED_PROBE: if (draw) - Draw_Menu_Item(row, ICON_StepX, "Probe", nullptr, true); + Draw_Menu_Item(row, ICON_StepX, F("Probe"), nullptr, true); else Draw_Menu(ProbeMenu); break; @@ -2899,7 +2915,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ case ADVANCED_CORNER: if (draw) { - Draw_Menu_Item(row, ICON_MaxAccelerated, "Bed Screw Inset"); + Draw_Menu_Item(row, ICON_MaxAccelerated, F("Bed Screw Inset")); Draw_Float(corner_pos, row, false, 10); } else @@ -2909,7 +2925,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if ENABLED(LIN_ADVANCE) case ADVANCED_LA: if (draw) { - Draw_Menu_Item(row, ICON_MaxAccelerated, "Lin Advance Kp"); + Draw_Menu_Item(row, ICON_MaxAccelerated, F("Lin Advance Kp")); Draw_Float(planner.extruder_advance_K[0], row, false, 100); } else @@ -2920,7 +2936,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if ENABLED(ADVANCED_PAUSE_FEATURE) case ADVANCED_LOAD: if (draw) { - Draw_Menu_Item(row, ICON_WriteEEPROM, "Load Length"); + Draw_Menu_Item(row, ICON_WriteEEPROM, F("Load Length")); Draw_Float(fc_settings[0].load_length, row, false, 1); } else @@ -2928,7 +2944,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case ADVANCED_UNLOAD: if (draw) { - Draw_Menu_Item(row, ICON_ReadEEPROM, "Unload Length"); + Draw_Menu_Item(row, ICON_ReadEEPROM, F("Unload Length")); Draw_Float(fc_settings[0].unload_length, row, false, 1); } else @@ -2939,7 +2955,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if ENABLED(PREVENT_COLD_EXTRUSION) case ADVANCED_COLD_EXTRUDE: if (draw) { - Draw_Menu_Item(row, ICON_Cool, "Min Extrusion T"); + Draw_Menu_Item(row, ICON_Cool, F("Min Extrusion T")); Draw_Float(thermalManager.extrude_min_temp, row, false, 1); } else { @@ -2952,7 +2968,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if ENABLED(FILAMENT_RUNOUT_SENSOR) case ADVANCED_FILSENSORENABLED: if (draw) { - Draw_Menu_Item(row, ICON_Extruder, "Filament Sensor"); + Draw_Menu_Item(row, ICON_Extruder, F("Filament Sensor")); Draw_Checkbox(row, runout.enabled); } else { @@ -2964,7 +2980,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if ENABLED(HAS_FILAMENT_RUNOUT_DISTANCE) case ADVANCED_FILSENSORDISTANCE: if (draw) { - Draw_Menu_Item(row, ICON_MaxAccE, "Runout Distance"); + Draw_Menu_Item(row, ICON_MaxAccE, F("Runout Distance")); Draw_Float(runout.runout_distance(), row, false, 10); } else @@ -2976,7 +2992,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if ENABLED(POWER_LOSS_RECOVERY) case ADVANCED_POWER_LOSS: if (draw) { - Draw_Menu_Item(row, ICON_Motion, "Power-loss recovery"); + Draw_Menu_Item(row, ICON_Motion, F("Power-loss recovery")); Draw_Checkbox(row, recovery.enabled); } else { @@ -3003,14 +3019,14 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case PROBE_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else Draw_Menu(Advanced, ADVANCED_PROBE); break; case PROBE_XOFFSET: if (draw) { - Draw_Menu_Item(row, ICON_StepX, "Probe X Offset"); + Draw_Menu_Item(row, ICON_StepX, F("Probe X Offset")); Draw_Float(probe.offset.x, row, false, 10); } else @@ -3018,7 +3034,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case PROBE_YOFFSET: if (draw) { - Draw_Menu_Item(row, ICON_StepY, "Probe Y Offset"); + Draw_Menu_Item(row, ICON_StepY, F("Probe Y Offset")); Draw_Float(probe.offset.y, row, false, 10); } else @@ -3026,7 +3042,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case PROBE_TEST: if (draw) - Draw_Menu_Item(row, ICON_StepY, "M48 Probe Test"); + Draw_Menu_Item(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_P(cmd); @@ -3034,7 +3050,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case PROBE_TEST_COUNT: if (draw) { - Draw_Menu_Item(row, ICON_StepY, "Probe Test Count"); + Draw_Menu_Item(row, ICON_StepY, F("Probe Test Count")); Draw_Float(testcount, row, false, 1); } else @@ -3058,7 +3074,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case INFO_BACK: if (draw) { - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); #if ENABLED(PRINTCOUNTER) char row1[50], row2[50], buf[32]; @@ -3075,9 +3091,9 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ Draw_Menu_Item(INFO_PRINTTIME, ICON_PrintTime, row1, row2, false, true); #endif - Draw_Menu_Item(INFO_SIZE, ICON_PrintSize, MACHINE_SIZE, nullptr, false, true); - Draw_Menu_Item(INFO_VERSION, ICON_Version, SHORT_BUILD_VERSION, nullptr, false, true); - Draw_Menu_Item(INFO_CONTACT, ICON_Contact, CORP_WEBSITE, nullptr, false, true); + 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); } else { if (menu == Info) @@ -3107,13 +3123,13 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case LEVELING_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else Draw_Main_Menu(3); break; case LEVELING_ACTIVE: if (draw) { - Draw_Menu_Item(row, ICON_StockConfiguration, "Leveling Active"); + Draw_Menu_Item(row, ICON_StockConfiguration, F("Leveling Active")); Draw_Checkbox(row, planner.leveling_active); } else { @@ -3132,7 +3148,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if BOTH(HAS_BED_PROBE, AUTO_BED_LEVELING_UBL) case LEVELING_GET_TILT: if (draw) - Draw_Menu_Item(row, ICON_Tilt, "Autotilt Current Mesh"); + Draw_Menu_Item(row, ICON_Tilt, F("Autotilt Current Mesh")); else { if (ubl.storage_slot < 0) { Popup_Handler(MeshSlot); @@ -3153,7 +3169,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #endif case LEVELING_GET_MESH: if (draw) - Draw_Menu_Item(row, ICON_Mesh, "Create New Mesh"); + Draw_Menu_Item(row, ICON_Mesh, F("Create New Mesh")); else { Popup_Handler(Home); gcode.home_all_axes(true); @@ -3205,7 +3221,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case LEVELING_MANUAL: if (draw) - Draw_Menu_Item(row, ICON_Mesh, "Manual Tuning", nullptr, true); + Draw_Menu_Item(row, ICON_Mesh, F("Manual Tuning"), nullptr, true); else { #if ENABLED(AUTO_BED_LEVELING_BILINEAR) if (!leveling_is_valid()) { @@ -3259,14 +3275,14 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case LEVELING_SETTINGS: if (draw) - Draw_Menu_Item(row, ICON_Step, "Leveling Settings", nullptr, true); + Draw_Menu_Item(row, ICON_Step, F("Leveling Settings"), nullptr, true); else Draw_Menu(LevelSettings); break; #if ENABLED(AUTO_BED_LEVELING_UBL) case LEVELING_SLOT: if (draw) { - Draw_Menu_Item(row, ICON_PrintSize, "Mesh Slot"); + Draw_Menu_Item(row, ICON_PrintSize, F("Mesh Slot")); Draw_Float(ubl.storage_slot, row, false, 1); } else @@ -3274,7 +3290,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case LEVELING_LOAD: if (draw) - Draw_Menu_Item(row, ICON_ReadEEPROM, "Load Mesh"); + Draw_Menu_Item(row, ICON_ReadEEPROM, F("Load Mesh")); else { if (ubl.storage_slot < 0) { Popup_Handler(MeshSlot); @@ -3287,7 +3303,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case LEVELING_SAVE: if (draw) - Draw_Menu_Item(row, ICON_WriteEEPROM, "Save Mesh"); + Draw_Menu_Item(row, ICON_WriteEEPROM, F("Save Mesh")); else { if (ubl.storage_slot < 0) { Popup_Handler(MeshSlot); @@ -3313,7 +3329,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case LEVELING_VIEW_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else Draw_Menu(Leveling, LEVELING_VIEW); break; @@ -3325,7 +3341,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case LEVELING_VIEW_TEXT: if (draw) { - Draw_Menu_Item(row, ICON_Contact, "Viewer Show Values"); + Draw_Menu_Item(row, ICON_Contact, F("Viewer Show Values")); Draw_Checkbox(row, mesh_conf.viewer_print_value); } else { @@ -3335,7 +3351,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case LEVELING_VIEW_ASYMMETRIC: if (draw) { - Draw_Menu_Item(row, ICON_Axis, "Viewer Asymmetric"); + Draw_Menu_Item(row, ICON_Axis, F("Viewer Asymmetric")); Draw_Checkbox(row, mesh_conf.viewer_asymmetric_range); } else { @@ -3359,13 +3375,13 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case LEVELING_SETTINGS_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else Draw_Menu(Leveling, LEVELING_SETTINGS); break; case LEVELING_SETTINGS_FADE: if (draw) { - Draw_Menu_Item(row, ICON_Fade, "Fade Mesh within"); + Draw_Menu_Item(row, ICON_Fade, F("Fade Mesh within")); Draw_Float(planner.z_fade_height, row, false, 1); } else { @@ -3378,7 +3394,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if ENABLED(AUTO_BED_LEVELING_UBL) case LEVELING_SETTINGS_TILT: if (draw) { - Draw_Menu_Item(row, ICON_Tilt, "Tilting Grid Size"); + Draw_Menu_Item(row, ICON_Tilt, F("Tilting Grid Size")); Draw_Float(mesh_conf.tilt_grid, row, false, 1); } else @@ -3386,7 +3402,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case LEVELING_SETTINGS_PLANE: if (draw) - Draw_Menu_Item(row, ICON_ResumeEEPROM, "Convert Mesh to Plane"); + Draw_Menu_Item(row, ICON_ResumeEEPROM, F("Convert Mesh to Plane")); else { if (mesh_conf.create_plane_from_mesh()) break; gcode.process_subcommands_now_P(PSTR("M420 S1")); @@ -3396,13 +3412,13 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case LEVELING_SETTINGS_ZERO: if (draw) - Draw_Menu_Item(row, ICON_Mesh, "Zero Current Mesh"); + Draw_Menu_Item(row, ICON_Mesh, F("Zero Current Mesh")); else ZERO(Z_VALUES_ARR); break; case LEVELING_SETTINGS_UNDEF: if (draw) - Draw_Menu_Item(row, ICON_Mesh, "Clear Current Mesh"); + Draw_Menu_Item(row, ICON_Mesh, F("Clear Current Mesh")); else ubl.invalidate(); break; @@ -3416,7 +3432,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ if (item == MESHVIEW_BACK) { if (draw) { - Draw_Menu_Item(0, ICON_Back, "Back"); + Draw_Menu_Item(0, ICON_Back, F("Back")); mesh_conf.Draw_Bed_Mesh(); mesh_conf.Set_Mesh_Viewer_Status(); } @@ -3443,7 +3459,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case LEVELING_M_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else { set_bed_leveling_enabled(level_state); TERN_(AUTO_BED_LEVELING_BILINEAR, refresh_bed_level()); @@ -3452,7 +3468,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case LEVELING_M_X: if (draw) { - Draw_Menu_Item(row, ICON_MoveX, "Mesh Point X"); + Draw_Menu_Item(row, ICON_MoveX, F("Mesh Point X")); Draw_Float(mesh_conf.mesh_x, row, 0, 1); } else @@ -3460,7 +3476,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case LEVELING_M_Y: if (draw) { - Draw_Menu_Item(row, ICON_MoveY, "Mesh Point Y"); + Draw_Menu_Item(row, ICON_MoveY, F("Mesh Point Y")); Draw_Float(mesh_conf.mesh_y, row, 0, 1); } else @@ -3468,7 +3484,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case LEVELING_M_NEXT: if (draw) - Draw_Menu_Item(row, ICON_More, "Next Point"); + Draw_Menu_Item(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)) @@ -3483,7 +3499,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case LEVELING_M_OFFSET: if (draw) { - Draw_Menu_Item(row, ICON_SetZOffset, "Point Z Offset"); + Draw_Menu_Item(row, ICON_SetZOffset, F("Point Z Offset")); Draw_Float(Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y], row, false, 100); } else { @@ -3494,7 +3510,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case LEVELING_M_UP: if (draw) - Draw_Menu_Item(row, ICON_Axis, "Microstep Up"); + Draw_Menu_Item(row, ICON_Axis, F("Microstep Up")); else if (Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y] < MAX_Z_OFFSET) { Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y] += 0.01; gcode.process_subcommands_now_P(PSTR("M290 Z0.01")); @@ -3506,7 +3522,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case LEVELING_M_DOWN: if (draw) - Draw_Menu_Item(row, ICON_AxisD, "Microstep Down"); + Draw_Menu_Item(row, ICON_AxisD, F("Microstep Down")); else if (Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y] > MIN_Z_OFFSET) { Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y] -= 0.01; gcode.process_subcommands_now_P(PSTR("M290 Z-0.01")); @@ -3518,7 +3534,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case LEVELING_M_GOTO_VALUE: if (draw) { - Draw_Menu_Item(row, ICON_StockConfiguration, "Go to Mesh Z Value"); + Draw_Menu_Item(row, ICON_StockConfiguration, F("Go to Mesh Z Value")); Draw_Checkbox(row, mesh_conf.goto_mesh_value); } else { @@ -3531,7 +3547,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if ENABLED(AUTO_BED_LEVELING_UBL) case LEVELING_M_UNDEF: if (draw) - Draw_Menu_Item(row, ICON_ResumeEEPROM, "Clear Point Value"); + Draw_Menu_Item(row, ICON_ResumeEEPROM, F("Clear Point Value")); else { mesh_conf.manual_value_update(true); Redraw_Menu(false); @@ -3556,7 +3572,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case UBL_M_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else { set_bed_leveling_enabled(level_state); Draw_Menu(Leveling, LEVELING_GET_MESH); @@ -3565,9 +3581,9 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ 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, "Next Point"); + Draw_Menu_Item(row, ICON_More, F("Next Point")); else - Draw_Menu_Item(row, ICON_More, "Save Mesh"); + Draw_Menu_Item(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)) { @@ -3589,7 +3605,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case UBL_M_PREV: if (draw) - Draw_Menu_Item(row, ICON_More, "Previous Point"); + Draw_Menu_Item(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)) @@ -3604,7 +3620,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case UBL_M_OFFSET: if (draw) { - Draw_Menu_Item(row, ICON_SetZOffset, "Point Z Offset"); + Draw_Menu_Item(row, ICON_SetZOffset, F("Point Z Offset")); Draw_Float(Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y], row, false, 100); } else { @@ -3615,7 +3631,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case UBL_M_UP: if (draw) - Draw_Menu_Item(row, ICON_Axis, "Microstep Up"); + Draw_Menu_Item(row, ICON_Axis, F("Microstep Up")); else if (Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y] < MAX_Z_OFFSET) { Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y] += 0.01; gcode.process_subcommands_now_P(PSTR("M290 Z0.01")); @@ -3627,7 +3643,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case UBL_M_DOWN: if (draw) - Draw_Menu_Item(row, ICON_Axis, "Microstep Down"); + Draw_Menu_Item(row, ICON_Axis, F("Microstep Down")); else if (Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y] > MIN_Z_OFFSET) { Z_VALUES_ARR[mesh_conf.mesh_x][mesh_conf.mesh_y] -= 0.01; gcode.process_subcommands_now_P(PSTR("M290 Z-0.01")); @@ -3655,7 +3671,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case MMESH_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Cancel"); + Draw_Menu_Item(row, ICON_Back, F("Cancel")); else { gcode.process_subcommands_now_P(PSTR("G29 A")); planner.synchronize(); @@ -3666,9 +3682,9 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ case MMESH_NEXT: if (draw) { if (gridpoint < GRID_MAX_POINTS) - Draw_Menu_Item(row, ICON_More, "Next Point"); + Draw_Menu_Item(row, ICON_More, F("Next Point")); else - Draw_Menu_Item(row, ICON_More, "Save Mesh"); + Draw_Menu_Item(row, ICON_More, F("Save Mesh")); } else if (gridpoint < GRID_MAX_POINTS) { Popup_Handler(MoveWait); @@ -3686,7 +3702,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case MMESH_OFFSET: if (draw) { - Draw_Menu_Item(row, ICON_SetZOffset, "Z Position"); + Draw_Menu_Item(row, ICON_SetZOffset, F("Z Position")); current_position.z = MANUAL_PROBE_START_Z; Draw_Float(current_position.z, row, false, 100); } @@ -3695,7 +3711,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case MMESH_UP: if (draw) - Draw_Menu_Item(row, ICON_Axis, "Microstep Up"); + Draw_Menu_Item(row, ICON_Axis, F("Microstep Up")); else if (current_position.z < MAX_Z_OFFSET) { gcode.process_subcommands_now_P(PSTR("M290 Z0.01")); planner.synchronize(); @@ -3706,7 +3722,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case MMESH_DOWN: if (draw) - Draw_Menu_Item(row, ICON_AxisD, "Microstep Down"); + Draw_Menu_Item(row, ICON_AxisD, F("Microstep Down")); else if (current_position.z > MIN_Z_OFFSET) { gcode.process_subcommands_now_P(PSTR("M290 Z-0.01")); planner.synchronize(); @@ -3727,7 +3743,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ const float currval = Z_VALUES_ARR[mesh_x][mesh_y]; if (draw) { - Draw_Menu_Item(row, ICON_Zoffset, "Goto Mesh Value"); + Draw_Menu_Item(row, ICON_Zoffset, F("Goto Mesh Value")); Draw_Float(currval, row, false, 100); } else if (!isnan(currval)) { @@ -3762,13 +3778,13 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case TUNE_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Back"); + Draw_Menu_Item(row, ICON_Back, F("Back")); else Draw_Print_Screen(); break; case TUNE_SPEED: if (draw) { - Draw_Menu_Item(row, ICON_Speed, "Print Speed"); + Draw_Menu_Item(row, ICON_Speed, F("Print Speed")); Draw_Float(feedrate_percentage, row, false, 1); } else @@ -3778,7 +3794,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_HOTEND case TUNE_FLOW: if (draw) { - Draw_Menu_Item(row, ICON_Speed, "Flow Rate"); + Draw_Menu_Item(row, ICON_Speed, F("Flow Rate")); Draw_Float(planner.flow_percentage[0], row, false, 1); } else @@ -3786,7 +3802,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case TUNE_HOTEND: if (draw) { - Draw_Menu_Item(row, ICON_SetEndTemp, "Hotend"); + Draw_Menu_Item(row, ICON_SetEndTemp, F("Hotend")); Draw_Float(thermalManager.temp_hotend[0].target, row, false, 1); } else @@ -3797,7 +3813,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_HEATED_BED case TUNE_BED: if (draw) { - Draw_Menu_Item(row, ICON_SetBedTemp, "Bed"); + Draw_Menu_Item(row, ICON_SetBedTemp, F("Bed")); Draw_Float(thermalManager.temp_bed.target, row, false, 1); } else @@ -3808,7 +3824,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_FAN case TUNE_FAN: if (draw) { - Draw_Menu_Item(row, ICON_FanSpeed, "Fan"); + Draw_Menu_Item(row, ICON_FanSpeed, F("Fan")); Draw_Float(thermalManager.fan_speed[0], row, false, 1); } else @@ -3819,7 +3835,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if HAS_ZOFFSET_ITEM case TUNE_ZOFFSET: if (draw) { - Draw_Menu_Item(row, ICON_FanSpeed, "Z-Offset"); + Draw_Menu_Item(row, ICON_FanSpeed, F("Z-Offset")); Draw_Float(zoffsetvalue, row, false, 100); } else @@ -3827,7 +3843,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case TUNE_ZUP: if (draw) - Draw_Menu_Item(row, ICON_Axis, "Z-Offset Up"); + Draw_Menu_Item(row, ICON_Axis, F("Z-Offset Up")); else if (zoffsetvalue < MAX_Z_OFFSET) { gcode.process_subcommands_now_P(PSTR("M290 Z0.01")); zoffsetvalue += 0.01; @@ -3836,7 +3852,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case TUNE_ZDOWN: if (draw) - Draw_Menu_Item(row, ICON_AxisD, "Z-Offset Down"); + Draw_Menu_Item(row, ICON_AxisD, F("Z-Offset Down")); else if (zoffsetvalue > MIN_Z_OFFSET) { gcode.process_subcommands_now_P(PSTR("M290 Z-0.01")); zoffsetvalue -= 0.01; @@ -3848,7 +3864,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) case TUNE_CHANGEFIL: if (draw) - Draw_Menu_Item(row, ICON_ResumeEEPROM, "Change Filament"); + Draw_Menu_Item(row, ICON_ResumeEEPROM, F("Change Filament")); else Popup_Handler(ConfFilChange); break; @@ -3857,7 +3873,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if ENABLED(FILAMENT_RUNOUT_SENSOR) case TUNE_FILSENSORENABLED: if (draw) { - Draw_Menu_Item(row, ICON_Extruder, "Filament Sensor"); + Draw_Menu_Item(row, ICON_Extruder, F("Filament Sensor")); Draw_Checkbox(row, runout.enabled); } else { @@ -3869,13 +3885,13 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ case TUNE_BACKLIGHT_OFF: if (draw) - Draw_Menu_Item(row, ICON_Brightness, "Display Off"); + Draw_Menu_Item(row, ICON_Brightness, F("Display Off")); else ui.set_brightness(0); break; case TUNE_BACKLIGHT: if (draw) { - Draw_Menu_Item(row, ICON_Brightness, "LCD Brightness"); + Draw_Menu_Item(row, ICON_Brightness, F("LCD Brightness")); Draw_Float(ui.brightness, row, false, 1); } else @@ -3899,7 +3915,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ switch (item) { case PREHEATHOTEND_BACK: if (draw) - Draw_Menu_Item(row, ICON_Back, "Cancel"); + Draw_Menu_Item(row, ICON_Back, F("Cancel")); else { thermalManager.setTargetHotend(0, 0); thermalManager.set_fan_speed(0, 0); @@ -3908,7 +3924,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ break; case PREHEATHOTEND_CONTINUE: if (draw) - Draw_Menu_Item(row, ICON_SetEndTemp, "Continue"); + Draw_Menu_Item(row, ICON_SetEndTemp, F("Continue")); else { Popup_Handler(Heating); thermalManager.wait_for_hotend(0); @@ -3950,7 +3966,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if PREHEAT_COUNT >= 1 case PREHEATHOTEND_1: if (draw) - Draw_Menu_Item(row, ICON_Temperature, PREHEAT_1_LABEL); + Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_1_LABEL)); else { thermalManager.setTargetHotend(ui.material_preset[0].hotend_temp, 0); thermalManager.set_fan_speed(0, ui.material_preset[0].fan_speed); @@ -3960,7 +3976,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if PREHEAT_COUNT >= 2 case PREHEATHOTEND_2: if (draw) - Draw_Menu_Item(row, ICON_Temperature, PREHEAT_2_LABEL); + Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_2_LABEL)); else { thermalManager.setTargetHotend(ui.material_preset[1].hotend_temp, 0); thermalManager.set_fan_speed(0, ui.material_preset[1].fan_speed); @@ -3970,7 +3986,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if PREHEAT_COUNT >= 3 case PREHEATHOTEND_3: if (draw) - Draw_Menu_Item(row, ICON_Temperature, PREHEAT_3_LABEL); + Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_3_LABEL)); else { thermalManager.setTargetHotend(ui.material_preset[2].hotend_temp, 0); thermalManager.set_fan_speed(0, ui.material_preset[2].fan_speed); @@ -3980,7 +3996,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if PREHEAT_COUNT >= 4 case PREHEATHOTEND_4: if (draw) - Draw_Menu_Item(row, ICON_Temperature, PREHEAT_4_LABEL); + Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_4_LABEL)); else { thermalManager.setTargetHotend(ui.material_preset[3].hotend_temp, 0); thermalManager.set_fan_speed(0, ui.material_preset[3].fan_speed); @@ -3990,7 +4006,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #if PREHEAT_COUNT >= 5 case PREHEATHOTEND_5: if (draw) - Draw_Menu_Item(row, ICON_Temperature, PREHEAT_5_LABEL); + Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_5_LABEL)); else { thermalManager.setTargetHotend(ui.material_preset[4].hotend_temp, 0); thermalManager.set_fan_speed(0, ui.material_preset[4].fan_speed); @@ -3999,7 +4015,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #endif case PREHEATHOTEND_CUSTOM: if (draw) { - Draw_Menu_Item(row, ICON_Temperature, "Custom"); + Draw_Menu_Item(row, ICON_Temperature, F("Custom")); Draw_Float(thermalManager.temp_hotend[0].target, row, false, 1); } else @@ -4010,81 +4026,81 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ } } -const char * CrealityDWINClass::Get_Menu_Title(uint8_t menu) { +FSTR_P CrealityDWINClass::Get_Menu_Title(uint8_t menu) { switch (menu) { - case MainMenu: return "Main Menu"; - case Prepare: return "Prepare"; - case HomeMenu: return "Homing Menu"; - case Move: return "Move"; - case ManualLevel: return "Manual Leveling"; + case MainMenu: return F("Main Menu"); + case Prepare: return F("Prepare"); + case HomeMenu: return F("Homing Menu"); + case Move: return F("Move"); + case ManualLevel: return F("Manual Leveling"); #if HAS_ZOFFSET_ITEM - case ZOffset: return "Z Offset"; + case ZOffset: return F("Z Offset"); #endif #if HAS_PREHEAT - case Preheat: return "Preheat"; + case Preheat: return F("Preheat"); #endif #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) - case ChangeFilament: return "Change Filament"; + case ChangeFilament: return F("Change Filament"); #endif - case Control: return "Control"; - case TempMenu: return "Temperature"; + case Control: return F("Control"); + case TempMenu: return F("Temperature"); #if HAS_HOTEND || HAS_HEATED_BED - case PID: return "PID Menu"; + case PID: return F("PID Menu"); #endif #if HAS_HOTEND - case HotendPID: return "Hotend PID Settings"; + case HotendPID: return F("Hotend PID Settings"); #endif #if HAS_HEATED_BED - case BedPID: return "Bed PID Settings"; + case BedPID: return F("Bed PID Settings"); #endif #if PREHEAT_COUNT >= 1 - case Preheat1: return (PREHEAT_1_LABEL " Settings"); + case Preheat1: return F(PREHEAT_1_LABEL " Settings"); #endif #if PREHEAT_COUNT >= 2 - case Preheat2: return (PREHEAT_2_LABEL " Settings"); + case Preheat2: return F(PREHEAT_2_LABEL " Settings"); #endif #if PREHEAT_COUNT >= 3 - case Preheat3: return (PREHEAT_3_LABEL " Settings"); + case Preheat3: return F(PREHEAT_3_LABEL " Settings"); #endif #if PREHEAT_COUNT >= 4 - case Preheat4: return (PREHEAT_4_LABEL " Settings"); + case Preheat4: return F(PREHEAT_4_LABEL " Settings"); #endif #if PREHEAT_COUNT >= 5 - case Preheat5: return (PREHEAT_5_LABEL " Settings"); + case Preheat5: return F(PREHEAT_5_LABEL " Settings"); #endif - case Motion: return "Motion Settings"; - case HomeOffsets: return "Home Offsets"; - case MaxSpeed: return "Max Speed"; - case MaxAcceleration: return "Max Acceleration"; + case Motion: return F("Motion Settings"); + case HomeOffsets: return F("Home Offsets"); + case MaxSpeed: return F("Max Speed"); + case MaxAcceleration: return F("Max Acceleration"); #if HAS_CLASSIC_JERK - case MaxJerk: return "Max Jerk"; + case MaxJerk: return F("Max Jerk"); #endif - case Steps: return "Steps/mm"; - case Visual: return "Visual Settings"; - case Advanced: return "Advanced Settings"; + case Steps: return F("Steps/mm"); + case Visual: return F("Visual Settings"); + case Advanced: return F("Advanced Settings"); #if HAS_BED_PROBE - case ProbeMenu: return "Probe Menu"; + case ProbeMenu: return F("Probe Menu"); #endif - case ColorSettings: return "UI Color Settings"; - case Info: return "Info"; - case InfoMain: return "Info"; + case ColorSettings: return F("UI Color Settings"); + case Info: return F("Info"); + case InfoMain: return F("Info"); #if HAS_MESH - case Leveling: return "Leveling"; - case LevelView: return GET_TEXT(MSG_MESH_VIEW); - case LevelSettings: return "Leveling Settings"; - case MeshViewer: return GET_TEXT(MSG_MESH_VIEW); - case LevelManual: return "Manual Tuning"; + case Leveling: return F("Leveling"); + case LevelView: return GET_TEXT_F(MSG_MESH_VIEW); + case LevelSettings: return F("Leveling Settings"); + case MeshViewer: return GET_TEXT_F(MSG_MESH_VIEW); + case LevelManual: return F("Manual Tuning"); #endif #if ENABLED(AUTO_BED_LEVELING_UBL) && !HAS_BED_PROBE - case UBLMesh: return "UBL Bed Leveling"; + case UBLMesh: return F("UBL Bed Leveling"); #endif #if ENABLED(PROBE_MANUALLY) - case ManualMesh: return "Mesh Bed Leveling"; + case ManualMesh: return F("Mesh Bed Leveling"); #endif - case Tune: return "Tune"; - case PreheatHotend: return "Preheat Hotend"; + case Tune: return F("Tune"); + case PreheatHotend: return F("Preheat Hotend"); } - return ""; + return F(""); } uint8_t CrealityDWINClass::Get_Menu_Size(uint8_t menu) { @@ -4168,25 +4184,25 @@ uint8_t CrealityDWINClass::Get_Menu_Size(uint8_t menu) { void CrealityDWINClass::Popup_Handler(PopupID popupid, bool option/*=false*/) { popup = last_popup = popupid; switch (popupid) { - case Pause: Draw_Popup(PSTR("Pause Print"), PSTR(""), PSTR(""), Popup); break; - case Stop: Draw_Popup(PSTR("Stop Print"), PSTR(""), PSTR(""), Popup); break; - case Resume: Draw_Popup(PSTR("Resume Print?"), PSTR("Looks Like the last"), PSTR("print was interupted."), Popup); break; - case ConfFilChange: Draw_Popup(PSTR("Confirm Filament Change"), PSTR(""), PSTR(""), Popup); break; - case PurgeMore: Draw_Popup(PSTR("Purge more filament?"), PSTR("(Cancel to finish process)"), PSTR(""), Popup); break; - case SaveLevel: Draw_Popup(PSTR("Leveling Complete"), PSTR("Save to EEPROM?"), PSTR(""), Popup); break; - case MeshSlot: Draw_Popup(PSTR("Mesh slot not selected"), PSTR("(Confirm to select slot 0)"), PSTR(""), Popup); break; - case ETemp: Draw_Popup(PSTR("Nozzle is too cold"), PSTR("Open Preheat Menu?"), PSTR(""), Popup); break; - case ManualProbing: Draw_Popup(PSTR("Manual Probing"), PSTR("(Confirm to probe)"), PSTR("(cancel to exit)"), Popup); break; - case Level: Draw_Popup(PSTR("Auto Bed Leveling"), PSTR("Please wait until done."), PSTR(""), Wait, ICON_AutoLeveling); break; - case Home: Draw_Popup(option ? PSTR("Parking") : PSTR("Homing"), PSTR("Please wait until done."), PSTR(""), Wait, ICON_BLTouch); break; - case MoveWait: Draw_Popup(PSTR("Moving to Point"), PSTR("Please wait until done."), PSTR(""), Wait, ICON_BLTouch); break; - case Heating: Draw_Popup(PSTR("Heating"), PSTR("Please wait until done."), PSTR(""), Wait, ICON_BLTouch); break; - case FilLoad: Draw_Popup(option ? PSTR("Unloading Filament") : PSTR("Loading Filament"), PSTR("Please wait until done."), PSTR(""), Wait, ICON_BLTouch); break; - case FilChange: Draw_Popup(PSTR("Filament Change"), PSTR("Please wait for prompt."), PSTR(""), Wait, ICON_BLTouch); break; - case TempWarn: Draw_Popup(option ? PSTR("Nozzle temp too low!") : PSTR("Nozzle temp too high!"), PSTR(""), PSTR(""), Wait, option ? ICON_TempTooLow : ICON_TempTooHigh); break; - case Runout: Draw_Popup(PSTR("Filament Runout"), PSTR(""), PSTR(""), Wait, ICON_BLTouch); break; - case PIDWait: Draw_Popup(PSTR("PID Autotune"), PSTR("in process"), PSTR("Please wait until done."), Wait, ICON_BLTouch); break; - case Resuming: Draw_Popup(PSTR("Resuming Print"), PSTR("Please wait until done."), PSTR(""), Wait, ICON_BLTouch); break; + 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 interupted."), 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; default: break; } } @@ -4194,11 +4210,11 @@ void CrealityDWINClass::Popup_Handler(PopupID popupid, bool option/*=false*/) { void CrealityDWINClass::Confirm_Handler(PopupID popupid) { popup = popupid; switch (popupid) { - case FilInsert: Draw_Popup(PSTR("Insert Filament"), PSTR("Press to Continue"), PSTR(""), Confirm); break; - case HeaterTime: Draw_Popup(PSTR("Heater Timed Out"), PSTR("Press to Reheat"), PSTR(""), Confirm); break; - case UserInput: Draw_Popup(PSTR("Waiting for Input"), PSTR("Press to Continue"), PSTR(""), Confirm); break; - case LevelError: Draw_Popup(PSTR("Couldn't enable Leveling"), PSTR("(Valid mesh must exist)"), PSTR(""), Confirm); break; - case InvalidMesh: Draw_Popup(PSTR("Valid mesh must exist"), PSTR("before tuning can be"), PSTR("performed"), Confirm); break; + 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; default: break; } } diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.h b/Marlin/src/lcd/e3v2/jyersui/dwin.h index 92470c2f0e..0157f673ce 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.h +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.h @@ -175,7 +175,9 @@ public: static uint16_t GetColor(uint8_t color, uint16_t original, bool light=false); static void Draw_Checkbox(uint8_t row, bool value); static void Draw_Title(const char * title); + static void Draw_Title(FSTR_P const title); static void Draw_Menu_Item(uint8_t row, uint8_t icon=0, const char * const label1=nullptr, const char * const label2=nullptr, bool more=false, bool centered=false); + static void Draw_Menu_Item(uint8_t row, uint8_t icon=0, FSTR_P const flabel1=nullptr, FSTR_P const flabel2=nullptr, bool more=false, bool centered=false); static void Draw_Menu(uint8_t menu, uint8_t select=0, uint8_t scroll=0); static void Redraw_Menu(bool lastprocess=true, bool lastselection=false, bool lastmenu=false); static void Redraw_Screen(); @@ -194,7 +196,7 @@ public: static void Draw_SD_Item(uint8_t item, uint8_t row); static void Draw_SD_List(bool removed=false); static void Draw_Status_Area(bool icons=false); - static void Draw_Popup(PGM_P const line1, PGM_P const line2, PGM_P const line3, uint8_t mode, uint8_t icon=0); + 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(bool refresh=false); @@ -203,7 +205,7 @@ public: static void Set_Mesh_Viewer_Status(); #endif - static const char * Get_Menu_Title(uint8_t menu); + static FSTR_P Get_Menu_Title(uint8_t menu); static uint8_t Get_Menu_Size(uint8_t menu); static void Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw=true); From 5f35c539ce38a6d6715ce77005b387a0b87ac822 Mon Sep 17 00:00:00 2001 From: Lefteris Garyfalakis <46350667+lefterisgar@users.noreply.github.com> Date: Mon, 25 Oct 2021 09:06:13 +0300 Subject: [PATCH 08/14] =?UTF-8?q?=F0=9F=9A=B8=20E3V2=20Enhanced=20cosmetic?= =?UTF-8?q?=20fixes=20(#23009)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/e3v2/enhanced/dwin.cpp | 4 +++- Marlin/src/lcd/e3v2/enhanced/meshviewer.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Marlin/src/lcd/e3v2/enhanced/dwin.cpp b/Marlin/src/lcd/e3v2/enhanced/dwin.cpp index 81b83a0562..7434ae6da2 100644 --- a/Marlin/src/lcd/e3v2/enhanced/dwin.cpp +++ b/Marlin/src/lcd/e3v2/enhanced/dwin.cpp @@ -1105,7 +1105,7 @@ void Draw_Info_Menu() { LOOP_L_N(i, 3) { DWINUI::Draw_Icon(ICON_PrintSize + i, 26, 99 + i * 73); - DWIN_Draw_Line(HMI_data.SplitLine_Color, 16, MBASE(2) + i * 73, 256, 156 + i * 73); + DWIN_Draw_HLine(HMI_data.SplitLine_Color, 16, MBASE(2) + i * 73, 240); } DWIN_UpdateLCD(); @@ -1651,6 +1651,7 @@ void HMI_SaveProcessID(const uint8_t id) { void DWIN_StartHoming() { HMI_flag.home_flag = true; HMI_SaveProcessID(Homing); + Title.ShowCaption(F("Axis Homing")); DWIN_Draw_Popup(ICON_BLTouch, F("Axis Homing"), F("Please wait until done.")); } @@ -1666,6 +1667,7 @@ void DWIN_CompletedHoming() { void DWIN_MeshLevelingStart() { #if HAS_ONESTEP_LEVELING HMI_SaveProcessID(Leveling); + Title.ShowCaption(F("Bed Leveling")); DWIN_Draw_Popup(ICON_AutoLeveling, GET_TEXT_F(MSG_BED_LEVELING), F("Please wait until done.")); #elif ENABLED(MESH_BED_LEVELING) Draw_ManualMesh_Menu(); diff --git a/Marlin/src/lcd/e3v2/enhanced/meshviewer.cpp b/Marlin/src/lcd/e3v2/enhanced/meshviewer.cpp index 6efc96f21b..88ab504a54 100644 --- a/Marlin/src/lcd/e3v2/enhanced/meshviewer.cpp +++ b/Marlin/src/lcd/e3v2/enhanced/meshviewer.cpp @@ -51,7 +51,7 @@ void MeshViewerClass::Draw() { NOLESS(maxz, v); NOMORE(minz, v); } - Title.ShowCaption(F("Mesh viewer")); + Title.ShowCaption(F("Mesh Viewer")); DWINUI::ClearMenuArea(); DWINUI::Draw_Icon(ICON_Continue_E, 86, 305); DWIN_Draw_Rectangle(0, HMI_data.SplitLine_Color, px(0), py(0), px(GRID_MAX_POINTS_X - 1), py(GRID_MAX_POINTS_Y - 1)); From f51e07b19636cbbfc9511073e41e5a98cd7c5625 Mon Sep 17 00:00:00 2001 From: Miguel Risco-Castillo Date: Mon, 25 Oct 2021 01:08:15 -0500 Subject: [PATCH 09/14] =?UTF-8?q?=F0=9F=90=9B=20Fix=20Ender-3=20V2=20Enhan?= =?UTF-8?q?ced=20SetFlow=20(#23016)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/e3v2/enhanced/dwin.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Marlin/src/lcd/e3v2/enhanced/dwin.cpp b/Marlin/src/lcd/e3v2/enhanced/dwin.cpp index 7434ae6da2..065dce713b 100644 --- a/Marlin/src/lcd/e3v2/enhanced/dwin.cpp +++ b/Marlin/src/lcd/e3v2/enhanced/dwin.cpp @@ -2343,7 +2343,8 @@ void SetSpeed() { SetPIntOnClick(MIN_PRINT_SPEED, MAX_PRINT_SPEED); } #endif // ADVANCED_PAUSE_FEATURE -void SetFlow() { SetPIntOnClick(MIN_PRINT_FLOW, MAX_PRINT_FLOW); } +void ApplyFlow() { planner.refresh_e_factor(0); } +void SetFlow() { SetPIntOnClick(MIN_PRINT_FLOW, MAX_PRINT_FLOW, ApplyFlow); } // Leveling Bed Corners void LevBed(uint8_t point) { From a7415a052ebf57c0a0a30cf97973b86c2065958d Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Mon, 25 Oct 2021 19:12:07 +1300 Subject: [PATCH 10/14] =?UTF-8?q?=F0=9F=90=9B=20Fix=20b=C3=B8rken=20E=5FDU?= =?UTF-8?q?AL=5FSTEPPER=5FDRIVERS=20(#23017)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/Conditionals_post.h | 2 +- Marlin/src/module/stepper.cpp | 2 +- Marlin/src/module/stepper/indirection.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index e9e282c262..94750d810a 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -1634,7 +1634,7 @@ #define HAS_E0_MS_PINS 1 #endif - #if E_STEPPERS > 1 + #if E_STEPPERS > 1 || ENABLED(E_DUAL_STEPPER_DRIVERS) #if PIN_EXISTS(E1_ENABLE) || AXIS_IS_L64XX(E1) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E1)) #define HAS_E1_ENABLE 1 #endif diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 3a1ee39c52..649f0d5d23 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -2744,7 +2744,7 @@ void Stepper::init() { #if E_STEPPERS && HAS_E0_STEP E_AXIS_INIT(0); #endif - #if E_STEPPERS > 1 && HAS_E1_STEP + #if (E_STEPPERS > 1 || ENABLED(E_DUAL_STEPPER_DRIVERS)) && HAS_E1_STEP E_AXIS_INIT(1); #endif #if E_STEPPERS > 2 && HAS_E2_STEP diff --git a/Marlin/src/module/stepper/indirection.h b/Marlin/src/module/stepper/indirection.h index 3e3ebd411f..93b765d7a5 100644 --- a/Marlin/src/module/stepper/indirection.h +++ b/Marlin/src/module/stepper/indirection.h @@ -751,14 +751,14 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #endif #ifndef ENABLE_STEPPER_E1 - #if E_STEPPERS > 1 && HAS_E1_ENABLE + #if (E_STEPPERS > 1 || ENABLED(E_DUAL_STEPPER_DRIVERS)) && HAS_E1_ENABLE #define ENABLE_STEPPER_E1() E1_ENABLE_WRITE( E_ENABLE_ON) #else #define ENABLE_STEPPER_E1() NOOP #endif #endif #ifndef DISABLE_STEPPER_E1 - #if E_STEPPERS > 1 && HAS_E1_ENABLE + #if (E_STEPPERS > 1 || ENABLED(E_DUAL_STEPPER_DRIVERS)) && HAS_E1_ENABLE #define DISABLE_STEPPER_E1() E1_ENABLE_WRITE(!E_ENABLE_ON) #else #define DISABLE_STEPPER_E1() NOOP From 908335367edba11eff8e457c511482db8a36dfcf Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Mon, 18 Oct 2021 00:51:01 -0700 Subject: [PATCH 11/14] =?UTF-8?q?=E2=9C=A8=20=20BTT=20Octopus=20Pro=20V1.0?= =?UTF-8?q?=20(STM32F446ZET6)=20(#22971)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/boards.h | 39 ++++++++++--------- Marlin/src/pins/pins.h | 2 + .../pins/stm32f4/pins_BTT_OCTOPUS_PRO_V1_0.h | 39 +++++++++++++++++++ .../src/pins/stm32f4/pins_BTT_OCTOPUS_V1_0.h | 9 +++++ .../src/pins/stm32f4/pins_BTT_OCTOPUS_V1_1.h | 9 +++++ .../pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h | 11 +++--- ini/stm32f4.ini | 4 +- 7 files changed, 86 insertions(+), 27 deletions(-) create mode 100644 Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_PRO_V1_0.h diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index d5630ce4cb..82c68f3171 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -386,25 +386,26 @@ #define BOARD_BTT_GTR_V1_0 4214 // BigTreeTech GTR v1.0 (STM32F407IGT) #define BOARD_BTT_OCTOPUS_V1_0 4215 // BigTreeTech Octopus v1.0 (STM32F446ZET6) #define BOARD_BTT_OCTOPUS_V1_1 4216 // BigTreeTech Octopus v1.1 (STM32F446ZET6) -#define BOARD_LERDGE_K 4217 // Lerdge K (STM32F407ZG) -#define BOARD_LERDGE_S 4218 // Lerdge S (STM32F407VE) -#define BOARD_LERDGE_X 4219 // Lerdge X (STM32F407VE) -#define BOARD_VAKE403D 4220 // VAkE 403D (STM32F446VET6) -#define BOARD_FYSETC_S6 4221 // FYSETC S6 (STM32F446VET6) -#define BOARD_FYSETC_S6_V2_0 4222 // FYSETC S6 v2.0 (STM32F446VET6) -#define BOARD_FYSETC_SPIDER 4223 // FYSETC Spider (STM32F446VET6) -#define BOARD_FLYF407ZG 4224 // FLYmaker FLYF407ZG (STM32F407ZG) -#define BOARD_MKS_ROBIN2 4225 // MKS_ROBIN2 (STM32F407ZE) -#define BOARD_MKS_ROBIN_PRO_V2 4226 // MKS Robin Pro V2 (STM32F407VE) -#define BOARD_MKS_ROBIN_NANO_V3 4227 // MKS Robin Nano V3 (STM32F407VG) -#define BOARD_MKS_MONSTER8 4228 // MKS Monster8 (STM32F407VGT6) -#define BOARD_ANET_ET4 4229 // ANET ET4 V1.x (STM32F407VGT6) -#define BOARD_ANET_ET4P 4230 // ANET ET4P V1.x (STM32F407VGT6) -#define BOARD_FYSETC_CHEETAH_V20 4231 // FYSETC Cheetah V2.0 -#define BOARD_TH3D_EZBOARD_LITE_V2 4232 // TH3D EZBoard Lite v2.0 -#define BOARD_INDEX_REV03 4233 // Index PnP Controller REV03 (STM32F407VET6/VGT6) -#define BOARD_MKS_ROBIN_NANO_V1_3_F4 4234 // MKS Robin Nano V1.3 and MKS Robin Nano-S V1.3 (STM32F407VET6) -#define BOARD_MKS_EAGLE 4235 // MKS Eagle (STM32F407VET6) +#define BOARD_BTT_OCTOPUS_PRO_V1_0 4217 // BigTreeTech Octopus Pro v1.0 (STM32F446ZET6/STM32F429ZGT6) +#define BOARD_LERDGE_K 4218 // Lerdge K (STM32F407ZG) +#define BOARD_LERDGE_S 4219 // Lerdge S (STM32F407VE) +#define BOARD_LERDGE_X 4220 // Lerdge X (STM32F407VE) +#define BOARD_VAKE403D 4221 // VAkE 403D (STM32F446VET6) +#define BOARD_FYSETC_S6 4222 // FYSETC S6 (STM32F446VET6) +#define BOARD_FYSETC_S6_V2_0 4223 // FYSETC S6 v2.0 (STM32F446VET6) +#define BOARD_FYSETC_SPIDER 4224 // FYSETC Spider (STM32F446VET6) +#define BOARD_FLYF407ZG 4225 // FLYmaker FLYF407ZG (STM32F407ZG) +#define BOARD_MKS_ROBIN2 4226 // MKS_ROBIN2 (STM32F407ZE) +#define BOARD_MKS_ROBIN_PRO_V2 4227 // MKS Robin Pro V2 (STM32F407VE) +#define BOARD_MKS_ROBIN_NANO_V3 4228 // MKS Robin Nano V3 (STM32F407VG) +#define BOARD_MKS_MONSTER8 4229 // MKS Monster8 (STM32F407VGT6) +#define BOARD_ANET_ET4 4230 // ANET ET4 V1.x (STM32F407VGT6) +#define BOARD_ANET_ET4P 4231 // ANET ET4P V1.x (STM32F407VGT6) +#define BOARD_FYSETC_CHEETAH_V20 4232 // FYSETC Cheetah V2.0 +#define BOARD_TH3D_EZBOARD_LITE_V2 4233 // TH3D EZBoard Lite v2.0 +#define BOARD_INDEX_REV03 4234 // Index PnP Controller REV03 (STM32F407VET6/VGT6) +#define BOARD_MKS_ROBIN_NANO_V1_3_F4 4235 // MKS Robin Nano V1.3 and MKS Robin Nano-S V1.3 (STM32F407VET6) +#define BOARD_MKS_EAGLE 4236 // MKS Eagle (STM32F407VET6) // // ARM Cortex M7 diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 4c2b09a0d8..454e4e51da 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -619,6 +619,8 @@ #include "stm32f4/pins_BTT_OCTOPUS_V1_0.h" // STM32F4 env:BIGTREE_OCTOPUS_V1 env:BIGTREE_OCTOPUS_V1_USB #elif MB(BTT_OCTOPUS_V1_1) #include "stm32f4/pins_BTT_OCTOPUS_V1_1.h" // STM32F4 env:BIGTREE_OCTOPUS_V1 env:BIGTREE_OCTOPUS_V1_USB +#elif MB(BTT_OCTOPUS_PRO_V1_0) + #include "stm32f4/pins_BTT_OCTOPUS_PRO_V1_0.h" // STM32F4 env:BIGTREE_OCTOPUS_V1 env:BIGTREE_OCTOPUS_V1_USB #elif MB(LERDGE_K) #include "stm32f4/pins_LERDGE_K.h" // STM32F4 env:LERDGEK env:LERDGEK_usb_flash_drive #elif MB(LERDGE_S) diff --git a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_PRO_V1_0.h b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_PRO_V1_0.h new file mode 100644 index 0000000000..a93ed68201 --- /dev/null +++ b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_PRO_V1_0.h @@ -0,0 +1,39 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2021 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 BOARD_INFO_NAME "BTT OCTOPUS PRO V1.0" + +// +// Temperature Sensors +// +#if TEMP_SENSOR_0 == -5 + #define TEMP_0_CS_PIN PF8 // Max31865 CS + #define TEMP_0_SCK_PIN PA5 + #define TEMP_0_MISO_PIN PA6 + #define TEMP_0_MOSI_PIN PA7 + #define SOFTWARE_SPI // Max31865 and LCD SD share a set of SPIs, Set SD to softwareSPI for Max31865 +#else + #define TEMP_0_PIN PF4 // TH0 +#endif + +#include "pins_BTT_OCTOPUS_V1_common.h" diff --git a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_0.h b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_0.h index e51e0a24bb..c2f02d0d8e 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_0.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_0.h @@ -23,4 +23,13 @@ #define BOARD_INFO_NAME "BTT OCTOPUS V1.0" +// +// Temperature Sensors +// +#if TEMP_SENSOR_0 == 20 + #define TEMP_0_PIN PF8 // PT100 Connector +#else + #define TEMP_0_PIN PF4 // TH0 +#endif + #include "pins_BTT_OCTOPUS_V1_common.h" diff --git a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_1.h b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_1.h index 93240c16b8..daa0e8fbfd 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_1.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_1.h @@ -23,4 +23,13 @@ #define BOARD_INFO_NAME "BTT OCTOPUS V1.1" +// +// Temperature Sensors +// +#if TEMP_SENSOR_0 == 20 + #define TEMP_0_PIN PF8 // PT100 Connector +#else + #define TEMP_0_PIN PF4 // TH0 +#endif + #include "pins_BTT_OCTOPUS_V1_common.h" diff --git a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h index 4a667bbc20..943dda7345 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h @@ -61,7 +61,11 @@ // Z Probe (when not Z_MIN_PIN) // #ifndef Z_MIN_PROBE_PIN - #define Z_MIN_PROBE_PIN PB7 + #if ENABLED(BLTOUCH) + #define Z_MIN_PROBE_PIN PB7 + #else + #define Z_MIN_PROBE_PIN PC5 // Probe (Proximity switch) port + #endif #endif // @@ -235,11 +239,6 @@ // Temperature Sensors // #define TEMP_BED_PIN PF3 // TB -#if TEMP_SENSOR_0 == 20 - #define TEMP_0_PIN PF8 // PT100 Connector -#else - #define TEMP_0_PIN PF4 // TH0 -#endif #define TEMP_1_PIN PF5 // TH1 #define TEMP_2_PIN PF6 // TH2 #define TEMP_3_PIN PF7 // TH3 diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 6d55ac37b9..a6bc125d21 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -231,7 +231,7 @@ build_flags = ${env:BIGTREE_SKR_2.build_flags} -DUSBD_USE_CDC_MSC build_unflags = ${env:BIGTREE_SKR_2.build_unflags} -DUSBD_USE_CDC # -# BigTreeTech Octopus V1.0/1.1 (STM32F446ZET6 ARM Cortex-M4) +# BigTreeTech Octopus V1.0/1.1 / Octopus Pro V1.0 (STM32F446ZET6 ARM Cortex-M4) # [env:BIGTREE_OCTOPUS_V1] platform = ${common_stm32.platform} @@ -242,7 +242,7 @@ build_flags = ${stm32_variant.build_flags} -DSTM32F446_5VX -DUSE_USB_HS_IN_FS # -# BigTreeTech Octopus V1.0/1.1 (STM32F446ZET6 ARM Cortex-M4) with USB Flash Drive Support +# BigTreeTech Octopus V1.0/1.1 / Octopus Pro V1.0 (STM32F446ZET6 ARM Cortex-M4) with USB Flash Drive Support # [env:BIGTREE_OCTOPUS_V1_USB] platform = ${common_stm32.platform} From 2b8a804997b18c49126868f5301702e2bf8eeaa6 Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Sun, 24 Oct 2021 23:14:02 -0700 Subject: [PATCH 12/14] =?UTF-8?q?=E2=9C=A8=20Octopus=20Pro=20V1.0=20with?= =?UTF-8?q?=20STM32F429ZGT6=20(#23008)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/pins.h | 2 +- .../marlin_BigTree_Octopus_Pro_v1_F429.json | 50 ++ .../PeripheralPins.c | 433 ++++++++++++++++++ .../PinNamesVar.h | 30 ++ .../hal_conf_extra.h | 53 +++ .../ldscript.ld | 209 +++++++++ .../variant.cpp | 233 ++++++++++ .../variant.h | 216 +++++++++ ini/stm32f4.ini | 25 + 9 files changed, 1250 insertions(+), 1 deletion(-) create mode 100644 buildroot/share/PlatformIO/boards/marlin_BigTree_Octopus_Pro_v1_F429.json create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429/PeripheralPins.c create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429/PinNamesVar.h create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429/hal_conf_extra.h create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429/ldscript.ld create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429/variant.cpp create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429/variant.h diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 454e4e51da..49585673bd 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -620,7 +620,7 @@ #elif MB(BTT_OCTOPUS_V1_1) #include "stm32f4/pins_BTT_OCTOPUS_V1_1.h" // STM32F4 env:BIGTREE_OCTOPUS_V1 env:BIGTREE_OCTOPUS_V1_USB #elif MB(BTT_OCTOPUS_PRO_V1_0) - #include "stm32f4/pins_BTT_OCTOPUS_PRO_V1_0.h" // STM32F4 env:BIGTREE_OCTOPUS_V1 env:BIGTREE_OCTOPUS_V1_USB + #include "stm32f4/pins_BTT_OCTOPUS_PRO_V1_0.h" // STM32F4 env:BIGTREE_OCTOPUS_V1 env:BIGTREE_OCTOPUS_V1_USB env:BIGTREE_OCTOPUS_PRO_V1_F429 env:BIGTREE_OCTOPUS_PRO_V1_F429_USB #elif MB(LERDGE_K) #include "stm32f4/pins_LERDGE_K.h" // STM32F4 env:LERDGEK env:LERDGEK_usb_flash_drive #elif MB(LERDGE_S) diff --git a/buildroot/share/PlatformIO/boards/marlin_BigTree_Octopus_Pro_v1_F429.json b/buildroot/share/PlatformIO/boards/marlin_BigTree_Octopus_Pro_v1_F429.json new file mode 100644 index 0000000000..66ee1c842e --- /dev/null +++ b/buildroot/share/PlatformIO/boards/marlin_BigTree_Octopus_Pro_v1_F429.json @@ -0,0 +1,50 @@ +{ + "build": { + "cpu": "cortex-m4", + "extra_flags": "-DSTM32F4 -DSTM32F429xx", + "f_cpu": "168000000L", + "mcu": "stm32f429zgt6", + "product_line": "STM32F429xx", + "variant": "MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429" + }, + "connectivity": [ + "can" + ], + "debug": { + "default_tools": [ + "stlink" + ], + "jlink_device": "STM32F429ZG", + "onboard_tools": [ + "stlink" + ], + "openocd_board": "stm32f429", + "openocd_target": "stm32f4x", + "svd_path": "STM32F429x.svd" + }, + "frameworks": [ + "arduino", + "cmsis", + "mbed", + "stm32cube", + "libopencm3", + "zephyr" + ], + "name": "STM32F429ZG (128k RAM, 64k CCM RAM, 1024k Flash", + "upload": { + "disable_flushing": false, + "maximum_ram_size": 131072, + "maximum_size": 1048576, + "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/stm32f429-439.html", + "vendor": "ST" +} diff --git a/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429/PeripheralPins.c b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429/PeripheralPins.c new file mode 100644 index 0000000000..d0905853a9 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429/PeripheralPins.c @@ -0,0 +1,433 @@ +/* + ******************************************************************************* + * Copyright (c) 2016, STMicroelectronics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ******************************************************************************* + */ +#include "Arduino.h" +#include "PeripheralPins.h" + +// ===== +// Note: Commented lines are alternative possibilities which are not used per default. +// If you change them, you will have to know what you do +// ===== + + +//*** ADC *** + +#ifdef HAL_ADC_MODULE_ENABLED +const PinMap PinMap_ADC[] = { + {PA_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC1_IN3 + {PA_4, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC2_IN4 + {PC_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC1_IN10 + {PC_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC1_IN11 + {PC_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 12, 0)}, // ADC1_IN12 + {PC_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 13, 0)}, // ADC1_IN13 + {PC_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC1_IN14 + {PF_3, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC3_IN9 TH_0 + {PF_4, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC3_IN14 TH_1 + {PF_5, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC3_IN15 TH_2 + {PF_6, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC3_IN4 TH_3 + {PF_7, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC3_IN5 EXP_13 + {PF_8, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC3_IN6 PT100 + {NC, NP, 0} + + // {PA_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC1_IN0 + // {PA_0, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC2_IN0 + // {PA_0, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC3_IN0 + // {PA_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC1_IN1 + // {PA_1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC2_IN1 + // {PA_1, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC3_IN1 + // {PA_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC1_IN2 + // {PA_2, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC2_IN2 + // {PA_2, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC3_IN2 + // {PA_3, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC2_IN3 + // {PA_3, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC3_IN3 + //{PA_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC1_IN4 + // {PA_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC1_IN5 + // {PA_5, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC2_IN5 + // {PA_6, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC1_IN6 + // {PA_6, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC2_IN6 + // {PA_7, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC1_IN7 + // {PA_7, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC2_IN7 + // {PB_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC1_IN8 + // {PB_0, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC2_IN8 + // {PB_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC1_IN9 + // {PB_1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC2_IN9 + // {PC_0, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC2_IN10 + // {PC_0, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC3_IN10 + // {PC_1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC2_IN11 + // {PC_1, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC3_IN11 + // {PC_2, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 12, 0)}, // ADC2_IN12 + // {PC_2, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 12, 0)}, // ADC3_IN12 + // {PC_3, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 13, 0)}, // ADC2_IN13 + // {PC_3, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 13, 0)}, // ADC3_IN13 + // {PC_4, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC2_IN14 + // {PC_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC1_IN15 + // {PC_5, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC2_IN15 + +}; +#endif + +//*** DAC *** + +#ifdef HAL_DAC_MODULE_ENABLED +const PinMap PinMap_DAC[] = { + // {PA_4, DAC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // DAC_OUT1 + // {PA_5, DAC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // DAC_OUT2 - LD2 + {NC, NP, 0} +}; +#endif + +//*** I2C *** + +#ifdef HAL_I2C_MODULE_ENABLED +const PinMap PinMap_I2C_SDA[] = { + // {PB_3, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, + // {PB_4, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, + // {PB_7, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_9, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + // {PC_7, FMPI2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_FMPI2C1)}, + // {PC_9, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, + // {PC_12, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_I2C_MODULE_ENABLED +const PinMap PinMap_I2C_SCL[] = { + // {PA_8, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, + // {PB_6, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_8, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + // {PB_10, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, + // {PC_6, FMPI2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_FMPI2C1)}, + {NC, NP, 0} +}; +#endif + +//*** PWM *** + +#ifdef HAL_TIM_MODULE_ENABLED +const PinMap PinMap_PWM[] = { + {PA_1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 2, 0)}, // TIM5_CH2 BED + {PA_2, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 HEATER0 + {PA_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4 HEATER1 + {PB_10, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 HEATER2 + {PB_11, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4 HEATER3 + {PA_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1 FAN0 + {PE_5, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 1, 0)}, // TIM9_CH1 FAN1 + {PD_12, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1 FAN2 + {PD_13, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2 FAN3 + {PD_14, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)}, // TIM4_CH3 FAN4 + {PD_15, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4 FAN5 + + /** + * Unused by specifications on Octopus. + * Uncomment the corresponding line if you want to have HardwarePWM on some pins. + * WARNING: check timers' usage first to avoid conflicts. + * If you don't know what you're doing leave things as they are or you WILL break something (including hardware) + * If you alter this section DO NOT report bugs to Marlin team since they are most likely caused by you. Thank you. + */ + //{PA_0, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + //{PA_0, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 1, 0)}, // TIM5_CH1 + //{PA_1, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 BLTOUCH is a "servo" + //{PA_2, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 BLTOUCH is a "servo" + //{PA_1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 2, 0)}, // TIM5_CH2 + //{PA_2, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 3, 0)}, // TIM5_CH3 + //{PA_2, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 1, 0)}, // TIM9_CH1 + //{PA_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4 + //{PA_3, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 4, 0)}, // TIM5_CH4 + //{PA_3, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 2, 0)}, // TIM9_CH2 + //{PA_5, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + //{PA_5, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 1)}, // TIM8_CH1N + //{PA_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + //{PA_6, TIM13, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM13, 1, 0)}, // TIM13_CH1 + //{PA_7, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N + //{PA_7, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + //{PA_7, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 1)}, // TIM8_CH1N + //{PA_7, TIM14, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM14, 1, 0)}, // TIM14_CH1 + //{PA_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1 + //{PA_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2 + //{PA_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3 + //{PA_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4 + //{PA_15, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + //{PB_0, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N + //{PB_0, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 1)}, // TIM8_CH2N + //{PB_1, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N + //{PB_1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 1)}, // TIM8_CH3N + //{PB_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 + //{PB_4, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + //{PB_5, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + //{PB_6, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1 + //{PB_8, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)}, // TIM4_CH3 + //{PB_8, TIM10, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM10, 1, 0)}, // TIM10_CH1 + //{PB_9, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4 + //{PB_9, TIM11, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM11, 1, 0)}, // TIM11_CH1 + //{PB_10, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 + //{PB_11, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4 + //{PB_13, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N + //{PB_14, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N + //{PB_14, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 1)}, // TIM8_CH2N + //{PB_14, TIM12, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM12, 1, 0)}, // TIM12_CH1 + //{PB_15, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N + //{PB_15, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 1)}, // TIM8_CH3N + //{PB_15, TIM12, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM12, 2, 0)}, // TIM12_CH2 + //{PC_6, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 0)}, // TIM8_CH1 + //{PC_7, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + //{PC_7, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 0)}, // TIM8_CH2 + //{PC_8, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 + //{PC_9, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 + //{PD_13, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2 + //{PD_15, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4 + //{PE_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N + //{PE_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1 + //{PE_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N + //{PE_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2 + //{PE_12, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N + //{PE_13, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3 + //{PE_14, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4 + //144 pins mcu, 114 gpio + //{PF_6, TIM10, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM10, 1, 0)}, // TIM10_CH1 + //{PF_7, TIM11, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM11, 1, 0)}, // TIM11_CH1 + //{PF_8, TIM13, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM13, 1, 0)}, // TIM13_CH1 + //{PF_9, TIM14, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM14, 1, 0)}, // TIM14_CH1 + + //176 pins mcu, 140 gpio + //{PH_10, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 1, 0)}, // TIM5_CH1 + //{PH_6, TIM12, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM12, 1, 0)}, // TIM12_CH1 + //{PH_11, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 2, 0)}, // TIM5_CH2 + //{PI_5, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 0)}, // TIM8_CH1 + //{PI_6, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 0)}, // TIM8_CH2 + + {NC, NP, 0} +}; +#endif + +//*** SERIAL *** + +#ifdef HAL_UART_MODULE_ENABLED +const PinMap PinMap_UART_TX[] = { + // {PA_0, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + // {PA_2, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PD_5, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_9, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PD_8, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + // {PB_6, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + // {PB_10, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + // {PC_6, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, + // {PC_10, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + //{PC_10, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + // {PC_12, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +const PinMap PinMap_UART_RX[] = { + // {PA_1, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + // {PA_3, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PD_6, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_10, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PD_9, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + // {PB_7, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + // {PC_5, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + // {PC_7, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, + // {PC_11, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + //{PC_11, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + // {PD_2, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +const PinMap PinMap_UART_RTS[] = { + // {PA_1, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + // {PA_12, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + // {PA_15, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + // {PB_14, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + // {PC_8, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART5)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +const PinMap PinMap_UART_CTS[] = { + // {PA_0, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + // {PA_11, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + // {PB_0, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + // {PB_13, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + // {PC_9, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART5)}, + {NC, NP, 0} +}; +#endif + +//*** SPI *** + +#ifdef HAL_SPI_MODULE_ENABLED +const PinMap PinMap_SPI_MOSI[] = { + {PA_7, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + // {PB_0, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI3)}, + // {PB_2, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI3)}, + // {PB_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + // {PB_5, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + // {PB_15, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + // {PC_1, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI2)}, + // {PC_1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI3)}, + // {PC_3, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + // {PC_12, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +const PinMap PinMap_SPI_MISO[] = { + {PA_6, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + // {PB_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + // {PB_4, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + // {PB_14, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + // {PC_2, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + // {PC_11, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +const PinMap PinMap_SPI_SCLK[] = { + {PA_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + // {PA_9, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + // {PB_3, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + // {PB_3, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + // {PB_10, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + // {PB_13, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + // {PC_7, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + // {PC_10, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +const PinMap PinMap_SPI_SSEL[] = { + {PA_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + // {PA_4, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + // {PA_15, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + // {PA_15, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + // {PB_4, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI2)}, + // {PB_9, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + // {PB_12, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {NC, NP, 0} +}; +#endif + +//*** CAN *** + +#ifdef HAL_CAN_MODULE_ENABLED +const PinMap PinMap_CAN_RD[] = { + // {PA_11, CAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)}, + // {PB_5, CAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN2)}, + // {PB_8, CAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)}, + // {PB_12, CAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN2)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_CAN_MODULE_ENABLED +const PinMap PinMap_CAN_TD[] = { + // {PA_12, CAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)}, + // {PB_6, CAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN2)}, + // {PB_9, CAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)}, + // {PB_13, CAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN2)}, + {NC, NP, 0} +}; +#endif + +//*** ETHERNET *** + +//*** No Ethernet *** + +//*** QUADSPI *** + +#ifdef HAL_QSPI_MODULE_ENABLED +const PinMap PinMap_QUADSPI[] = { + // {PA_1, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QSPI)}, // QUADSPI_BK1_IO3 + // {PB_2, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QSPI)}, // QUADSPI_CLK + // {PB_6, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_QSPI)}, // QUADSPI_BK1_NCS + // {PC_9, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QSPI)}, // QUADSPI_BK1_IO0 + // {PC_10, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QSPI)}, // QUADSPI_BK1_IO1 + // {PC_11, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QSPI)}, // QUADSPI_BK2_NCS + {NC, NP, 0} +}; +#endif + +//*** USB *** + +#ifdef HAL_PCD_MODULE_ENABLED +const PinMap PinMap_USB_OTG_FS[] = { + // {PA_8, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_SOF + // {PA_9, USB_OTG_FS, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, 0)}, // USB_OTG_FS_VBUS + // {PA_10, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_ID + {PA_11, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_DM + {PA_12, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_DP + {NC, NP, 0} +}; + +const PinMap PinMap_USB_OTG_HS[] = { + //{PB_12, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_PULLUP, GPIO_AF12_OTG_HS_FS)}, // USB_OTG_HS_ID + //{PB_13, USB_OTG_HS, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, GPIO_AF_NONE)}, // USB_OTG_HS_VBUS + {PB_14, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_OTG_HS_FS)}, // USB_OTG_HS_DM + {PB_15, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_OTG_HS_FS)}, // USB_OTG_HS_DP + + /*#error "USB in HS mode isn't supported by the board" + {PA_3, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_D0 + {PB_0, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_D1 + {PB_1, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_D2 + {PB_5, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_D7 + {PB_10, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_D3 + {PB_12, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_D5 + {PB_13, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_D6 + {PC_0, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_STP + {PC_2, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_DIR + {PC_3, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_NXT + */ + {NC, NP, 0} +}; + + +#ifdef HAL_SD_MODULE_ENABLED +WEAK const PinMap PinMap_SD[] = { + // {PB_8, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D4 + // {PB_9, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D5 + // {PC_6, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D6 + // {PC_7, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D7 + {PC_8, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D0 + {PC_9, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D1 + {PC_10, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D2 + {PC_11, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D3 + {PC_12, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_SDIO)}, // SDIO_CK + {PD_2, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_SDIO)}, // SDIO_CMD + {NC, NP, 0} +}; +#endif +#endif diff --git a/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429/PinNamesVar.h b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429/PinNamesVar.h new file mode 100644 index 0000000000..bff3f21349 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429/PinNamesVar.h @@ -0,0 +1,30 @@ +/* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, /* SYS_WKUP0 */ +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = NC, +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = NC, +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = NC, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = NC, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = NC, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif +/* USB */ +#ifdef USBCON + USB_OTG_FS_DM = PA_11, + USB_OTG_FS_DP = PA_12, +#endif diff --git a/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429/hal_conf_extra.h b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429/hal_conf_extra.h new file mode 100644 index 0000000000..d62c510095 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429/hal_conf_extra.h @@ -0,0 +1,53 @@ +#pragma once + +#define HAL_MODULE_ENABLED +#define HAL_ADC_MODULE_ENABLED +#define HAL_CRC_MODULE_ENABLED +#define HAL_DMA_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED // Needed for Endstop (and other external) Interrupts +#define HAL_GPIO_MODULE_ENABLED +#define HAL_I2C_MODULE_ENABLED +#define HAL_PWR_MODULE_ENABLED +#define HAL_RCC_MODULE_ENABLED +//#define HAL_RTC_MODULE_ENABLED // Real Time Clock...do we use it? +#define HAL_SPI_MODULE_ENABLED +#define HAL_TIM_MODULE_ENABLED +#define HAL_USART_MODULE_ENABLED +#define HAL_CORTEX_MODULE_ENABLED +//#define HAL_UART_MODULE_ENABLED // by default +//#define HAL_PCD_MODULE_ENABLED // Since STM32 v3.10700.191028 this is automatically added if any type of USB is enabled (as in Arduino IDE) +#define HAL_SD_MODULE_ENABLED + +//#undef HAL_SD_MODULE_ENABLED +#undef HAL_DAC_MODULE_ENABLED +#undef HAL_FLASH_MODULE_ENABLED +#undef HAL_CAN_MODULE_ENABLED +#undef HAL_CAN_LEGACY_MODULE_ENABLED +#undef HAL_CEC_MODULE_ENABLED +#undef HAL_CRYP_MODULE_ENABLED +#undef HAL_DCMI_MODULE_ENABLED +#undef HAL_DMA2D_MODULE_ENABLED +#undef HAL_ETH_MODULE_ENABLED +#undef HAL_NAND_MODULE_ENABLED +#undef HAL_NOR_MODULE_ENABLED +#undef HAL_PCCARD_MODULE_ENABLED +#undef HAL_SRAM_MODULE_ENABLED +#undef HAL_SDRAM_MODULE_ENABLED +#undef HAL_HASH_MODULE_ENABLED +#undef HAL_SMBUS_MODULE_ENABLED +#undef HAL_I2S_MODULE_ENABLED +#undef HAL_IWDG_MODULE_ENABLED +#undef HAL_LTDC_MODULE_ENABLED +#undef HAL_DSI_MODULE_ENABLED +#undef HAL_QSPI_MODULE_ENABLED +#undef HAL_RNG_MODULE_ENABLED +#undef HAL_SAI_MODULE_ENABLED +#undef HAL_IRDA_MODULE_ENABLED +#undef HAL_SMARTCARD_MODULE_ENABLED +#undef HAL_WWDG_MODULE_ENABLED +//#undef HAL_HCD_MODULE_ENABLED +#undef HAL_FMPI2C_MODULE_ENABLED +#undef HAL_SPDIFRX_MODULE_ENABLED +#undef HAL_DFSDM_MODULE_ENABLED +#undef HAL_LPTIM_MODULE_ENABLED +#undef HAL_MMC_MODULE_ENABLED diff --git a/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429/ldscript.ld b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429/ldscript.ld new file mode 100644 index 0000000000..4cac4ac6e2 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429/ldscript.ld @@ -0,0 +1,209 @@ +/* +***************************************************************************** +** + +** File : LinkerScript.ld +** +** Abstract : Linker script for STM32F429VGTx Device with +** 2048KByte FLASH, 192KByte RAM +** +** Set heap size, stack size and stack location according +** to application requirements. +** +** Set memory bank area and size if external memory is used. +** +** Target : STMicroelectronics STM32 +** +** +** Distribution: The file is distributed as is, without any warranty +** of any kind. +** +***************************************************************************** +** @attention +** +**

© COPYRIGHT(c) 2014 Ac6

+** +** Redistribution and use in source and binary forms, with or without modification, +** are permitted provided that the following conditions are met: +** 1. Redistributions of source code must retain the above copyright notice, +** this list of conditions and the following disclaimer. +** 2. Redistributions in binary form must reproduce the above copyright notice, +** this list of conditions and the following disclaimer in the documentation +** and/or other materials provided with the distribution. +** 3. Neither the name of Ac6 nor the names of its contributors +** may be used to endorse or promote products derived from this software +** without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +** +***************************************************************************** +*/ + +/* Entry Point */ +ENTRY(Reset_Handler) + +/* Highest address of the user mode stack */ +_estack = 0x20000000 + LD_MAX_DATA_SIZE; /* end of RAM */ +/* Generate a link error if heap and stack don't fit into RAM */ +_Min_Heap_Size = 0x200; /* required amount of heap */ +_Min_Stack_Size = 0x400; /* required amount of stack */ + +/* Specify the memory areas */ +MEMORY +{ +FLASH (rx) : ORIGIN = 0x08000000 + LD_FLASH_OFFSET, LENGTH = LD_MAX_SIZE - LD_FLASH_OFFSET +RAM (xrw) : ORIGIN = 0x20000000, LENGTH = LD_MAX_DATA_SIZE +CCMRAM (rw) : ORIGIN = 0x10000000, LENGTH = 64K +MEMORY_ARRAY (rw) : ORIGIN = 0x10000000, LENGTH = 0x144 +} + +/* Define output sections */ +SECTIONS +{ + /* The startup code goes first into FLASH */ + .isr_vector : + { + . = ALIGN(4); + KEEP(*(.isr_vector)) /* Startup code */ + . = ALIGN(4); + } >FLASH + + /* The program code and other data goes into FLASH */ + .text ALIGN(4): + { + . = ALIGN(4); + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.glue_7) /* glue arm to thumb code */ + *(.glue_7t) /* glue thumb to arm code */ + *(.eh_frame) + + KEEP (*(.init)) + KEEP (*(.fini)) + + . = ALIGN(4); + _etext = .; /* define a global symbols at end of code */ + } >FLASH + + /* Constant data goes into FLASH */ + .rodata ALIGN(4) : + { + . = ALIGN(4); + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + . = ALIGN(4); + } >FLASH + + .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH + .ARM : { + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + } >FLASH + + .preinit_array : + { + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array*)) + PROVIDE_HIDDEN (__preinit_array_end = .); + } >FLASH + .init_array : + { + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + } >FLASH + .fini_array : + { + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array*)) + PROVIDE_HIDDEN (__fini_array_end = .); + } >FLASH + + /* used by the startup to initialize data */ + _sidata = LOADADDR(.data); + + /* Initialized data sections goes into RAM, load LMA copy after code */ + .data : + { + . = ALIGN(4); + _sdata = .; /* create a global symbol at data start */ + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + + . = ALIGN(4); + _edata = .; /* define a global symbol at data end */ + } >RAM AT> FLASH + + + _siccmram = LOADADDR(.ccmram); + + /* CCM-RAM section + * + * IMPORTANT NOTE! + * If initialized variables will be placed in this section, + * the startup code needs to be modified to copy the init-values. + */ + .ccmram : + { + . = ALIGN(4); + _sccmram = .; /* create a global symbol at ccmram start */ + *(.ccmram) + *(.ccmram*) + + . = ALIGN(4); + _eccmram = .; /* create a global symbol at ccmram end */ + } >CCMRAM AT> FLASH + + + /* Uninitialized data section */ + . = ALIGN(4); + .bss : + { + /* This is used by the startup in order to initialize the .bss secion */ + _sbss = .; /* define a global symbol at bss start */ + __bss_start__ = _sbss; + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + _ebss = .; /* define a global symbol at bss end */ + __bss_end__ = _ebss; + } >RAM + + /* User_heap_stack section, used to check that there is enough RAM left */ + ._user_heap_stack : + { + . = ALIGN(8); + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(8); + } >RAM + + + + /* Remove information from the standard libraries */ + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : { *(.ARM.attributes) } + ExtRAMData : {*(.ExtRAMData)} >MEMORY_ARRAY +} diff --git a/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429/variant.cpp b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429/variant.cpp new file mode 100644 index 0000000000..c8ed0d1e52 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429/variant.cpp @@ -0,0 +1,233 @@ +/* + Copyright (c) 2011 Arduino. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "pins_arduino.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Pin number +const PinName digitalPin[] = { + PA_0, //D0 + PA_1, //D1 + PA_2, //D2 + PA_3, //D3 + PA_4, //D4 + PA_5, //D5 + PA_6, //D6 + PA_7, //D7 + PA_8, //D8 + PA_9, //D9 + PA_10, //D10 + PA_11, //D11 + PA_12, //D12 + PA_13, //D13 + PA_14, //D14 + PA_15, //D15 + PB_0, //D16 + PB_1, //D17 + PB_2, //D18 + PB_3, //D19 + PB_4, //D20 + PB_5, //D21 + PB_6, //D22 + PB_7, //D23 + PB_8, //D24 + PB_9, //D25 + PB_10, //D26 + PB_11, //D27 + PB_12, //D28 + PB_13, //D29 + PB_14, //D30 + PB_15, //D31 + PC_0, //D32 + PC_1, //D33 + PC_2, //D34 + PC_3, //D35 + PC_4, //D36 + PC_5, //D37 + PC_6, //D38 + PC_7, //D39 + PC_8, //D40 + PC_9, //D41 + PC_10, //D42 + PC_11, //D43 + PC_12, //D44 + PC_13, //D45 + PC_14, //D46 + PC_15, //D47 + PD_0, //D48 + PD_1, //D49 + PD_2, //D50 + PD_3, //D51 + PD_4, //D52 + PD_5, //D53 + PD_6, //D54 + PD_7, //D55 + PD_8, //D56 + PD_9, //D57 + PD_10, //D58 + PD_11, //D59 + PD_12, //D60 + PD_13, //D61 + PD_14, //D62 + PD_15, //D63 + PE_0, //D64 + PE_1, //D65 + PE_2, //D66 + PE_3, //D67 + PE_4, //D68 + PE_5, //D69 + PE_6, //D70 + PE_7, //D71 + PE_8, //D72 + PE_9, //D73 + PE_10, //D74 + PE_11, //D75 + PE_12, //D76 + PE_13, //D77 + PE_14, //D78 + PE_15, //D79 + PF_0, //D80 + PF_1, //D81 + PF_2, //D82 + PF_3, //D83 + PF_4, //D84 + PF_5, //D85 + PF_6, //D86 + PF_7, //D87 + PF_8, //D88 + PF_9, //D89 + PF_10, //D90 + PF_11, //D91 + PF_12, //D92 + PF_13, //D93 + PF_14, //D94 + PF_15, //D95 + PG_0, //D96 + PG_1, //D97 + PG_2, //D98 + PG_3, //D99 + PG_4, //D100 + PG_5, //D101 + PG_6, //D102 + PG_7, //D103 + PG_8, //D104 + PG_9, //D105 + PG_10, //D106 + PG_11, //D107 + PG_12, //D108 + PG_13, //D109 + PG_14, //D110 + PG_15, //D111 + + //Duplicated ADC Pins + PA_3, //D112/A0 + PA_4, //D113/A1 + PC_0, //D114/A2 + PC_1, //D115/A3 + PC_2, //D116/A4 + PC_3, //D117/A5 + PC_4, //D118/A6 + PF_3, //D119/A16 - 1:FSMC_A3 2:ADC3_IN9 + PF_4, //D120/A17 - 1:FSMC_A4 2:ADC3_IN14 + PF_5, //D121/A18 - 1:FSMC_A5 2:ADC3_IN15 + PF_6, //D122/A19 - 1:TIM10_CH1 2:ADC3_IN4 + PF_7, //D123/A20 - 1:TIM11_CH1 2:ADC3_IN5 + PF_8, //D124/A20 - 1:TIM11_CH1 2:ADC3_IN6 +}; + +#ifdef __cplusplus +} +#endif + +// ---------------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief System Clock Configuration + * The system Clock is configured as follow : + * System Clock source = PLL (HSE) + * SYSCLK(Hz) = 168000000 + * HCLK(Hz) = 168000000 + * AHB Prescaler = 1 + * APB1 Prescaler = 4 + * APB2 Prescaler = 2 + * HSE Frequency(Hz) = 8000000 + * PLL_M = 8 + * PLL_N = 336 + * PLL_P = 2 + * PLL_Q = 7 + * VDD(V) = 3.3 + * Main regulator output voltage = Scale1 mode + * Flash Latency(WS) = 5 + * @param None + * @retval None + */ +WEAK void SystemClock_Config(void) +{ + RCC_ClkInitTypeDef RCC_ClkInitStruct; + RCC_OscInitTypeDef RCC_OscInitStruct; + + /* Enable Power Control clock */ + __HAL_RCC_PWR_CLK_ENABLE(); + + /* The voltage scaling allows optimizing the power consumption when the device is + clocked below the maximum system frequency, to update the voltage scaling value + regarding system frequency refer to product datasheet. */ + __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); + + /* Enable HSE Oscillator and activate PLL with HSE as source */ + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; + RCC_OscInitStruct.HSEState = RCC_HSE_ON; + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; + RCC_OscInitStruct.PLL.PLLM = 8; + RCC_OscInitStruct.PLL.PLLN = 336; + RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; + RCC_OscInitStruct.PLL.PLLQ = 7; + if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) + { + /* Initialization Error */ + } + + if(HAL_PWREx_EnableOverDrive() != HAL_OK) + { + /* Initialization Error */ + } + + /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 + clocks dividers */ + RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2); + RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; + RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; + RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4; + RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2; + if(HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK) + { + /* Initialization Error */ + } +} + +#ifdef __cplusplus +} +#endif diff --git a/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429/variant.h new file mode 100644 index 0000000000..0147ece0ab --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429/variant.h @@ -0,0 +1,216 @@ +/* + Copyright (c) 2011 Arduino. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef _VARIANT_ARDUINO_STM32_ +#define _VARIANT_ARDUINO_STM32_ + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +/*---------------------------------------------------------------------------- + * Pins + *----------------------------------------------------------------------------*/ + +#define PA0 0 //D0 +#define PA1 1 //D1 +#define PA2 2 //D2 +#define PA3 3 //D3 +#define PA4 4 //D4 +#define PA5 5 //D5 +#define PA6 6 //D6 +#define PA7 7 //D7 +#define PA8 8 //D8 +#define PA9 9 //D9 +#define PA10 10 //D10 +#define PA11 11 //D11 +#define PA12 12 //D12 +#define PA13 13 //D13 +#define PA14 14 //D14 +#define PA15 15 //D15 +#define PB0 16 //D16 +#define PB1 17 //D17 +#define PB2 18 //D18 +#define PB3 19 //D19 +#define PB4 20 //D20 +#define PB5 21 //D21 +#define PB6 22 //D22 +#define PB7 23 //D23 +#define PB8 24 //D24 +#define PB9 25 //D25 +#define PB10 26 //D26 +#define PB11 27 //D27 +#define PB12 28 //D28 +#define PB13 29 //D29 +#define PB14 30 //D30 +#define PB15 31 //D31 +#define PC0 32 //D32 +#define PC1 33 //D33 +#define PC2 34 //D34 +#define PC3 35 //D35 +#define PC4 36 //D36 +#define PC5 37 //D37 +#define PC6 38 //D38 +#define PC7 39 //D39 +#define PC8 40 //D40 +#define PC9 41 //D41 +#define PC10 42 //D42 +#define PC11 43 //D43 +#define PC12 44 //D44 +#define PC13 45 //D45 +#define PC14 46 //D46 +#define PC15 47 //D47 +#define PD0 48 //D48 +#define PD1 49 //D49 +#define PD2 50 //D50 +#define PD3 51 //D51 +#define PD4 52 //D52 +#define PD5 53 //D53 +#define PD6 54 //D54 +#define PD7 55 //D55 +#define PD8 56 //D56 +#define PD9 57 //D57 +#define PD10 58 //D58 +#define PD11 59 //D59 +#define PD12 60 //D60 +#define PD13 61 //D61 +#define PD14 62 //D62 +#define PD15 63 //D63 +#define PE0 64 //D64 +#define PE1 65 //D65 +#define PE2 66 //D66 +#define PE3 67 //D67 +#define PE4 68 //D68 +#define PE5 69 //D69 +#define PE6 70 //D70 +#define PE7 71 //D71 +#define PE8 72 //D72 +#define PE9 73 //D73 +#define PE10 74 //D74 +#define PE11 75 //D75 +#define PE12 76 //D76 +#define PE13 77 //D77 +#define PE14 78 //D78 +#define PE15 79 //D79 +#define PF0 80 //D64 +#define PF1 81 //D65 +#define PF2 82 //D66 +#define PF3 83 //D67 +#define PF4 84 //D68 +#define PF5 85 //D69 +#define PF6 86 //D70 +#define PF7 87 //D71 +#define PF8 88 //D72 +#define PF9 89 //D73 +#define PF10 90 //D74 +#define PF11 91 //D75 +#define PF12 92 //D76 +#define PF13 93 //D77 +#define PF14 94 //D78 +#define PF15 95 //D79 +#define PG0 96 //D64 +#define PG1 97 //D65 +#define PG2 98 //D66 +#define PG3 99 //D67 +#define PG4 100 //D68 +#define PG5 101 //D69 +#define PG6 102 //D70 +#define PG7 103 //D71 +#define PG8 104 //D72 +#define PG9 105 //D73 +#define PG10 106 //D74 +#define PG11 107 //D75 +#define PG12 108 //D76 +#define PG13 109 //D77 +#define PG14 110 //D78 +#define PG15 111 //D79 + +// This must be a literal with the same value as PEND +#define NUM_DIGITAL_PINS 125 +// This must be a literal with a value less than or equal to to MAX_ANALOG_INPUTS +#define NUM_ANALOG_INPUTS 13 +#define NUM_ANALOG_FIRST 112 + +//#define ADC_RESOLUTION 12 + +// PWM resolution +//#define PWM_RESOLUTION 12 +#define PWM_FREQUENCY 1000 // >= 20 Khz => inaudible noise for fans +#define PWM_MAX_DUTY_CYCLE 255 + +// SPI Definitions +#define PIN_SPI_SS PA4 +#define PIN_SPI_MOSI PA7 +#define PIN_SPI_MISO PA6 +#define PIN_SPI_SCK PA5 + +// I2C Definitions +#define PIN_WIRE_SDA PB9 +#define PIN_WIRE_SCL PB8 + +// Timer Definitions +// Do not use timer used by PWM pin. See PinMap_PWM. +#define TIMER_TONE TIM6 +#define TIMER_SERVO TIM5 +#define TIMER_SERIAL TIM7 + +// UART Definitions +//#define SERIAL_UART_INSTANCE 1 // Connected to EXP3 header +/* Enable Serial 3 */ +#define HAVE_HWSERIAL1 +#define HAVE_HWSERIAL3 + +// Default pin used for 'Serial' instance (ex: ST-Link) +// Mandatory for Firmata +#define PIN_SERIAL_RX PA10 +#define PIN_SERIAL_TX PA9 + +/* HAL configuration */ +#define HSE_VALUE 8000000U + +#define FLASH_PAGE_SIZE (4U * 1024U) + +#ifdef __cplusplus +} // extern "C" +#endif + +/*---------------------------------------------------------------------------- + * Arduino objects - C++ only + *----------------------------------------------------------------------------*/ + +#ifdef __cplusplus +// These serial port names are intended to allow libraries and architecture-neutral +// sketches to automatically default to the correct port name for a particular type +// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, +// the first hardware serial port whose RX/TX pins are not dedicated to another use. +// +// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor +// +// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial +// +// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library +// +// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. +// +// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX +// pins are NOT connected to anything by default. +#define SERIAL_PORT_MONITOR Serial +#define SERIAL_PORT_HARDWARE_OPEN Serial +#endif + +#endif /* _VARIANT_ARDUINO_STM32_ */ diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index a6bc125d21..3e0c400a6b 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -255,6 +255,31 @@ build_flags = ${stm_flash_drive.build_flags} -DUSBD_IRQ_SUBPRIO=6 -DUSBD_USE_CDC_MSC +# +# BigTreeTech Octopus Pro V1.0 (STM32F429ZGT6 ARM Cortex-M4) +# +[env:BIGTREE_OCTOPUS_PRO_V1_F429] +platform = ${common_stm32.platform} +extends = stm32_variant +board = marlin_BigTree_Octopus_Pro_v1_F429 +board_build.offset = 0x8000 +build_flags = ${stm32_variant.build_flags} + -DUSE_USB_HS_IN_FS + +# +# BigTreeTech Octopus Pro V1.0 (STM32F429ZGT6 ARM Cortex-M4) with USB Flash Drive Support +# +[env:BIGTREE_OCTOPUS_PRO_V1_F429_USB] +platform = ${common_stm32.platform} +extends = env:BIGTREE_OCTOPUS_PRO_V1_F429 +platform_packages = ${stm_flash_drive.platform_packages} +build_unflags = -DUSBD_USE_CDC +build_flags = ${stm_flash_drive.build_flags} + -DSTM32F446_5VX -DUSE_USB_HS_IN_FS + -DUSE_USBHOST_HS -DUSBD_IRQ_PRIO=5 + -DUSBD_IRQ_SUBPRIO=6 + -DUSBD_USE_CDC_MSC + # # Lerdge base # From a7ea6b59255ee5405b0118d78a5d7bdf69a8eb68 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Tue, 26 Oct 2021 10:02:29 +1300 Subject: [PATCH 13/14] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20Add'l=20PCINTs=20for?= =?UTF-8?q?=20Mega=20Extended=20(#23019)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../variants/MARLIN_MEGA_EXTENDED/pins_arduino.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/buildroot/share/PlatformIO/variants/MARLIN_MEGA_EXTENDED/pins_arduino.h b/buildroot/share/PlatformIO/variants/MARLIN_MEGA_EXTENDED/pins_arduino.h index dbbb7b4832..1129f8edae 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_MEGA_EXTENDED/pins_arduino.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_MEGA_EXTENDED/pins_arduino.h @@ -85,19 +85,23 @@ static const uint8_t A15 = PIN_A15; // A majority of the pins are NOT PCINTs, SO BE WARNED (i.e. you cannot use them as receive pins) // Only pins available for RECEIVE (TRANSMIT can be on any pin): // (I've deliberately left out pin mapping to the Hardware USARTs - seems senseless to me) -// Pins: 10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69 +// Pins: 10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69, 72, 73, 75, 76, 77 #define digitalPinToPCICR(p) ( (((p) >= 10) && ((p) <= 13)) || \ (((p) >= 50) && ((p) <= 53)) || \ - (((p) >= 62) && ((p) <= 69)) ? (&PCICR) : nullptr ) + (((p) >= 62) && ((p) <= 69)) || \ + (((p) >= 72) && ((p) <= 73)) || \ + (((p) >= 75) && ((p) <= 77)) ? (&PCICR) : nullptr ) #define digitalPinToPCICRbit(p) ( (((p) >= 10) && ((p) <= 13)) || (((p) >= 50) && ((p) <= 53)) ? 0 : \ ( (((p) >= 62) && ((p) <= 69)) ? 2 : \ - 0 ) ) + ( (((p) >= 72) && ((p) <= 73)) || (((p) >= 75) && ((p) <= 77)) ? 1 : \ + 0 ) ) ) #define digitalPinToPCMSK(p) ( (((p) >= 10) && ((p) <= 13)) || (((p) >= 50) && ((p) <= 53)) ? (&PCMSK0) : \ ( (((p) >= 62) && ((p) <= 69)) ? (&PCMSK2) : \ - nullptr ) ) + ( (((p) >= 72) && ((p) <= 73)) || (((p) >= 75) && ((p) <= 77)) ? (&PCMSK1) : \ + nullptr ) ) ) #define digitalPinToPCMSKbit(p) ( (((p) >= 10) && ((p) <= 13)) ? ((p) - 6) : \ ( ((p) == 50) ? 3 : \ @@ -105,7 +109,9 @@ static const uint8_t A15 = PIN_A15; ( ((p) == 52) ? 1 : \ ( ((p) == 53) ? 0 : \ ( (((p) >= 62) && ((p) <= 69)) ? ((p) - 62) : \ - 0 ) ) ) ) ) ) + ( (((p) >= 72) && ((p) <= 73)) ? ((p) - 69) : \ + ( (((p) >= 75) && ((p) <= 77)) ? ((p) - 70) : \ + 0 ) ) ) ) ) ) ) ) #define digitalPinToInterrupt(p) ((p) == 2 ? 0 : ((p) == 3 ? 1 : ((p) >= 18 && (p) <= 21 ? 23 - (p) : NOT_AN_INTERRUPT))) From ee26fd0e0559d7f2d86b11b5552eaf9c9ff3174c Mon Sep 17 00:00:00 2001 From: tombrazier <68918209+tombrazier@users.noreply.github.com> Date: Mon, 25 Oct 2021 22:29:40 +0100 Subject: [PATCH 14/14] =?UTF-8?q?=F0=9F=9A=B8=20Default=20T0=20for=20M569,?= =?UTF-8?q?=20M906,=20M913=20(#23020)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/feature/L6470/M906.cpp | 2 +- Marlin/src/gcode/feature/trinamic/M569.cpp | 2 +- Marlin/src/gcode/feature/trinamic/M906.cpp | 2 +- Marlin/src/gcode/feature/trinamic/M911-M914.cpp | 2 +- Marlin/src/gcode/gcode.cpp | 9 +++++---- Marlin/src/gcode/gcode.h | 2 +- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Marlin/src/gcode/feature/L6470/M906.cpp b/Marlin/src/gcode/feature/L6470/M906.cpp index 2ab13f5b5d..bab355fe38 100644 --- a/Marlin/src/gcode/feature/L6470/M906.cpp +++ b/Marlin/src/gcode/feature/L6470/M906.cpp @@ -280,7 +280,7 @@ void GcodeSuite::M906() { #if E_STEPPERS case E_AXIS: { - const int8_t target_e_stepper = get_target_e_stepper_from_command(); + const int8_t target_e_stepper = get_target_e_stepper_from_command(0); if (target_e_stepper < 0) return; switch (target_e_stepper) { #if AXIS_IS_L64XX(E0) diff --git a/Marlin/src/gcode/feature/trinamic/M569.cpp b/Marlin/src/gcode/feature/trinamic/M569.cpp index 5cadd2d45e..05730eabfd 100644 --- a/Marlin/src/gcode/feature/trinamic/M569.cpp +++ b/Marlin/src/gcode/feature/trinamic/M569.cpp @@ -133,7 +133,7 @@ static void say_stealth_status() { */ void GcodeSuite::M569() { if (parser.seen('S')) - set_stealth_status(parser.value_bool(), get_target_e_stepper_from_command()); + set_stealth_status(parser.value_bool(), get_target_e_stepper_from_command(0)); else say_stealth_status(); } diff --git a/Marlin/src/gcode/feature/trinamic/M906.cpp b/Marlin/src/gcode/feature/trinamic/M906.cpp index 48db266c72..c3e12a4f92 100644 --- a/Marlin/src/gcode/feature/trinamic/M906.cpp +++ b/Marlin/src/gcode/feature/trinamic/M906.cpp @@ -104,7 +104,7 @@ void GcodeSuite::M906() { #if E_STEPPERS case E_AXIS: { - const int8_t target_e_stepper = get_target_e_stepper_from_command(); + const int8_t target_e_stepper = get_target_e_stepper_from_command(0); if (target_e_stepper < 0) return; switch (target_e_stepper) { #if AXIS_IS_TMC(E0) diff --git a/Marlin/src/gcode/feature/trinamic/M911-M914.cpp b/Marlin/src/gcode/feature/trinamic/M911-M914.cpp index 58702c603f..f15343484a 100644 --- a/Marlin/src/gcode/feature/trinamic/M911-M914.cpp +++ b/Marlin/src/gcode/feature/trinamic/M911-M914.cpp @@ -268,7 +268,7 @@ break; #if E_STEPPERS case E_AXIS: { - const int8_t target_e_stepper = get_target_e_stepper_from_command(); + const int8_t target_e_stepper = get_target_e_stepper_from_command(0); if (target_e_stepper < 0) return; switch (target_e_stepper) { TERN_(E0_HAS_STEALTHCHOP, case 0: TMC_SET_PWMTHRS_E(0); break;) diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 888dbe7027..126ceadb3b 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -137,11 +137,12 @@ int8_t GcodeSuite::get_target_extruder_from_command() { } /** - * Get the target e stepper from the T parameter - * Return -1 if the T parameter is out of range or unspecified + * Get the target E stepper from the 'T' parameter. + * If there is no 'T' parameter then dval will be substituted. + * Returns -1 if the resulting E stepper index is out of range. */ -int8_t GcodeSuite::get_target_e_stepper_from_command() { - const int8_t e = parser.intval('T', -1); +int8_t GcodeSuite::get_target_e_stepper_from_command(const int8_t dval/*=-1*/) { + const int8_t e = parser.intval('T', dval); if (WITHIN(e, 0, E_STEPPERS - 1)) return e; SERIAL_ECHO_START(); diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 4a3c865a4f..2173c5cab1 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -390,7 +390,7 @@ public: static void say_units(); static int8_t get_target_extruder_from_command(); - static int8_t get_target_e_stepper_from_command(); + static int8_t get_target_e_stepper_from_command(const int8_t dval=-1); static void get_destination_from_command(); static void process_parsed_command(const bool no_ok=false);