From 5d665d5e1e3a7b9f95cd4075815883fce3791465 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Thu, 14 Oct 2021 01:01:39 +0000 Subject: [PATCH 001/125] [cron] Bump distribution date (2021-10-14) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index b48ab6ef67..9c5769db27 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-10-13" +//#define STRING_DISTRIBUTION_DATE "2021-10-14" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 614fdc36f2..2743d5b41d 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-10-13" + #define STRING_DISTRIBUTION_DATE "2021-10-14" #endif /** From 11435356643c7e32dd6f30e8a144e2c3766bfb35 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Fri, 15 Oct 2021 01:05:59 +0000 Subject: [PATCH 002/125] [cron] Bump distribution date (2021-10-15) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 9c5769db27..cb13c11a22 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-10-14" +//#define STRING_DISTRIBUTION_DATE "2021-10-15" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 2743d5b41d..d6176599f0 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-10-14" + #define STRING_DISTRIBUTION_DATE "2021-10-15" #endif /** From de5aefd09e2ede1314382c4a10e51335d07524f9 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Fri, 15 Oct 2021 14:38:03 +1300 Subject: [PATCH 003/125] =?UTF-8?q?=F0=9F=94=A7=20Add,=20update=20TFT=20sa?= =?UTF-8?q?nity=20checks=20(#22928)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/Conditionals_LCD.h | 1 - Marlin/src/inc/SanityCheck.h | 11 +++++++---- Marlin/src/inc/Warnings.cpp | 4 ++++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 46b969a478..e80dd3ed69 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -332,7 +332,6 @@ #if ANY(FSMC_GRAPHICAL_TFT, SPI_GRAPHICAL_TFT, TFT_320x240, TFT_480x320, TFT_320x240_SPI, TFT_480x320_SPI, TFT_LVGL_UI_FSMC, TFT_LVGL_UI_SPI) #define IS_LEGACY_TFT 1 #define TFT_GENERIC - #warning "Don't forget to update your TFT settings in Configuration.h." #endif #if ANY(FSMC_GRAPHICAL_TFT, TFT_320x240, TFT_480x320, TFT_LVGL_UI_FSMC) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 3be2076dd9..0aa5bd9f2d 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -2723,12 +2723,11 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #undef IS_U8GLIB_SSD1306 #undef IS_EXTUI -#undef IS_LEGACY_TFT #if ANY(TFT_GENERIC, MKS_TS35_V2_0, MKS_ROBIN_TFT24, MKS_ROBIN_TFT28, MKS_ROBIN_TFT32, MKS_ROBIN_TFT35, MKS_ROBIN_TFT43, MKS_ROBIN_TFT_V1_1R, TFT_TRONXY_X5SA, ANYCUBIC_TFT35, ANYCUBIC_TFT35, LONGER_LK_TFT28, ANET_ET4_TFT28, ANET_ET5_TFT35, BIQU_BX_TFT70) #if NONE(TFT_COLOR_UI, TFT_CLASSIC_UI, TFT_LVGL_UI) #error "TFT_COLOR_UI, TFT_CLASSIC_UI, TFT_LVGL_UI is required for your TFT. Please enable one." - #elif 1 < ENABLED(TFT_COLOR_UI) + ENABLED(TFT_CLASSIC_UI) + ENABLED(TFT_LVGL_UI) + #elif MANY(TFT_COLOR_UI, TFT_CLASSIC_UI, TFT_LVGL_UI) #error "Please select only one of TFT_COLOR_UI, TFT_CLASSIC_UI, or TFT_LVGL_UI." #endif #elif ANY(TFT_COLOR_UI, TFT_CLASSIC_UI, TFT_LVGL_UI) @@ -2751,8 +2750,12 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "Please select only one of TFT_RES_320x240, TFT_RES_480x272, TFT_RES_480x320, or TFT_RES_1024x600." #endif -#if HAS_TFT_LVGL_UI && DISABLED(TFT_RES_480x320) - #error "(FMSC|SPI)TFT_LVGL_UI requires TFT_RES_480x320." +#if ENABLED(TFT_LVGL_UI) + #if DISABLED(TFT_RES_480x320) + #error "TFT_LVGL_UI requires TFT_RES_480x320." + #elif DISABLED(SDSUPPORT) + #error "TFT_LVGL_UI requires SDSUPPORT." + #endif #endif #if defined(GRAPHICAL_TFT_UPSCALE) && !WITHIN(GRAPHICAL_TFT_UPSCALE, 2, 4) diff --git a/Marlin/src/inc/Warnings.cpp b/Marlin/src/inc/Warnings.cpp index fbec990fa7..0e04cdd435 100644 --- a/Marlin/src/inc/Warnings.cpp +++ b/Marlin/src/inc/Warnings.cpp @@ -456,6 +456,10 @@ #endif #endif +#if IS_LEGACY_TFT + #warning "Don't forget to update your TFT settings in Configuration.h." +#endif + // Ender 3 Pro (but, apparently all Creality 4.2.2 boards) #if ENABLED(EMIT_CREALITY_422_WARNING) || MB(CREALITY_V4) #warning "Creality 4.2.2 boards may have A4988 or TMC2208_STANDALONE drivers. Check your board and make sure to select the correct DRIVER_TYPE!" From ee28a14e8e7f6b33fe5813dbedcd85380207c345 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 15 Oct 2021 00:24:08 -0500 Subject: [PATCH 004/125] =?UTF-8?q?=F0=9F=8E=A8=20Refactor=20Host=20Action?= =?UTF-8?q?s=20as=20singleton?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/MarlinCore.cpp | 4 +- Marlin/src/feature/e_parser.h | 2 +- Marlin/src/feature/host_actions.cpp | 109 +++++++++------- Marlin/src/feature/host_actions.h | 122 ++++++++++++------ Marlin/src/feature/mmu/mmu2.cpp | 2 +- Marlin/src/feature/pause.cpp | 28 ++-- Marlin/src/feature/runout.cpp | 9 +- Marlin/src/gcode/config/M43.cpp | 2 +- Marlin/src/gcode/control/M111.cpp | 2 +- Marlin/src/gcode/gcode.cpp | 10 +- Marlin/src/gcode/host/M876.cpp | 2 +- Marlin/src/gcode/lcd/M0_M1.cpp | 2 +- Marlin/src/gcode/sd/M1001.cpp | 2 +- Marlin/src/gcode/sd/M24_M25.cpp | 8 +- Marlin/src/gcode/stats/M75-M78.cpp | 2 +- Marlin/src/lcd/e3v2/creality/dwin.cpp | 2 +- Marlin/src/lcd/e3v2/enhanced/dwin.cpp | 2 +- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 6 +- .../cocoa_press/status_screen.cpp | 4 +- .../confirm_abort_print_dialog_box.cpp | 2 +- .../ftdi_eve_touch_ui/generic/tune_menu.cpp | 4 +- Marlin/src/lcd/extui/ui_api.cpp | 2 +- Marlin/src/lcd/marlinui.cpp | 20 +-- Marlin/src/lcd/menu/menu_delta_calibrate.cpp | 4 +- Marlin/src/lcd/menu/menu_main.cpp | 2 +- Marlin/src/module/probe.cpp | 4 +- 26 files changed, 208 insertions(+), 150 deletions(-) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 346c5f8f2c..2e9f6a6fc2 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -872,7 +872,7 @@ void kill(FSTR_P const lcd_error/*=nullptr*/, FSTR_P const lcd_component/*=nullp SERIAL_ERROR_MSG(STR_ERR_KILLED); #ifdef ACTION_ON_KILL - host_action_kill(); + hostui.kill(); #endif minkill(steppers_off); @@ -1525,7 +1525,7 @@ void setup() { #endif #if ENABLED(HOST_PROMPT_SUPPORT) - SETUP_RUN(host_action_prompt_end()); + SETUP_RUN(hostui.prompt_end()); #endif #if HAS_TRINAMIC_CONFIG && DISABLED(PSU_DEFAULT_OFF) diff --git a/Marlin/src/feature/e_parser.h b/Marlin/src/feature/e_parser.h index 3723caa35e..1dee0cf755 100644 --- a/Marlin/src/feature/e_parser.h +++ b/Marlin/src/feature/e_parser.h @@ -199,7 +199,7 @@ public: case EP_M112: killed_by_M112 = true; break; case EP_M410: quickstop_by_M410 = true; break; #if ENABLED(HOST_PROMPT_SUPPORT) - case EP_M876SN: host_response_handler(M876_reason); break; + case EP_M876SN: hostui.handle_response(M876_reason); break; #endif #if ENABLED(REALTIME_REPORTING_COMMANDS) case EP_GRBL_STATUS: report_current_position_moving(); break; diff --git a/Marlin/src/feature/host_actions.cpp b/Marlin/src/feature/host_actions.cpp index 9f5a1481f1..6a1faf81c0 100644 --- a/Marlin/src/feature/host_actions.cpp +++ b/Marlin/src/feature/host_actions.cpp @@ -24,10 +24,10 @@ #if ENABLED(HOST_ACTION_COMMANDS) -#include "host_actions.h" - //#define DEBUG_HOST_ACTIONS +#include "host_actions.h" + #if ENABLED(ADVANCED_PAUSE_FEATURE) #include "pause.h" #include "../gcode/queue.h" @@ -37,7 +37,12 @@ #include "runout.h" #endif -void host_action(FSTR_P const fstr, const bool eol) { +HostUI hostui; + +flag_t HostUI::flag; + +void HostUI::action(FSTR_P const fstr, const bool eol) { + if (!flag.bits) return; PORT_REDIRECT(SerialMask::All); SERIAL_ECHOPGM("//action:"); SERIAL_ECHOF(fstr); @@ -45,29 +50,40 @@ void host_action(FSTR_P const fstr, const bool eol) { } #ifdef ACTION_ON_KILL - void host_action_kill() { host_action(F(ACTION_ON_KILL)); } + void HostUI::kill() { action(F(ACTION_ON_KILL)); } #endif #ifdef ACTION_ON_PAUSE - void host_action_pause(const bool eol/*=true*/) { host_action(F(ACTION_ON_PAUSE), eol); } + void HostUI::pause(const bool eol/*=true*/) { action(F(ACTION_ON_PAUSE), eol); } #endif #ifdef ACTION_ON_PAUSED - void host_action_paused(const bool eol/*=true*/) { host_action(F(ACTION_ON_PAUSED), eol); } + void HostUI::paused(const bool eol/*=true*/) { action(F(ACTION_ON_PAUSED), eol); } #endif #ifdef ACTION_ON_RESUME - void host_action_resume() { host_action(F(ACTION_ON_RESUME)); } + void HostUI::resume() { action(F(ACTION_ON_RESUME)); } #endif #ifdef ACTION_ON_RESUMED - void host_action_resumed() { host_action(F(ACTION_ON_RESUMED)); } + void HostUI::resumed() { action(F(ACTION_ON_RESUMED)); } #endif #ifdef ACTION_ON_CANCEL - void host_action_cancel() { host_action(F(ACTION_ON_CANCEL)); } + void HostUI::cancel() { action(F(ACTION_ON_CANCEL)); } #endif #ifdef ACTION_ON_START - void host_action_start() { host_action(F(ACTION_ON_START)); } + void HostUI::start() { action(F(ACTION_ON_START)); } +#endif + +#if ENABLED(G29_RETRY_AND_RECOVER) + #ifdef ACTION_ON_G29_RECOVER + void HostUI::g29_recover() { action(F(ACTION_ON_G29_RECOVER)); } + #endif + #ifdef ACTION_ON_G29_FAILURE + void HostUI::g29_failure() { action(F(ACTION_ON_G29_FAILURE)); } + #endif #endif #if ENABLED(HOST_PROMPT_SUPPORT) + PromptReason HostUI::host_prompt_reason = PROMPT_NOT_DEFINED; + PGMSTR(CONTINUE_STR, "Continue"); PGMSTR(DISMISS_STR, "Dismiss"); @@ -75,64 +91,69 @@ void host_action(FSTR_P const fstr, const bool eol) { extern bool wait_for_user; #endif - PromptReason host_prompt_reason = PROMPT_NOT_DEFINED; - - void host_action_notify(const char * const cstr) { + void HostUI::notify(const char * const cstr) { + if (!flag.bits) return; PORT_REDIRECT(SerialMask::All); - host_action(F("notification "), false); + action(F("notification "), false); SERIAL_ECHOLN(cstr); } - void host_action_notify(FSTR_P const fstr) { + void HostUI::notify_P(PGM_P const pstr) { + if (!flag.bits) return; PORT_REDIRECT(SerialMask::All); - host_action(F("notification "), false); - SERIAL_ECHOLNF(fstr); + action(F("notification "), false); + SERIAL_ECHOLNPGM_P(pstr); } - void host_action_prompt(FSTR_P const ptype, const bool eol=true) { + void HostUI::prompt(FSTR_P const ptype, const bool eol/*=true*/) { + if (!flag.bits) return; PORT_REDIRECT(SerialMask::All); - host_action(F("prompt_"), false); + action(F("prompt_"), false); SERIAL_ECHOF(ptype); if (eol) SERIAL_EOL(); } - void host_action_prompt_plus(FSTR_P const ptype, FSTR_P const fstr, const char extra_char='\0') { - host_action_prompt(ptype, false); + void HostUI::prompt_plus(FSTR_P const ptype, FSTR_P const fstr, const char extra_char/*='\0'*/) { + if (!flag.bits) return; + prompt(ptype, false); PORT_REDIRECT(SerialMask::All); SERIAL_CHAR(' '); SERIAL_ECHOF(fstr); if (extra_char != '\0') SERIAL_CHAR(extra_char); SERIAL_EOL(); } - void host_action_prompt_begin(const PromptReason reason, FSTR_P const fstr, const char extra_char/*='\0'*/) { - host_action_prompt_end(); + void HostUI::prompt_begin(const PromptReason reason, FSTR_P const fstr, const char extra_char/*='\0'*/) { + if (!flag.bits) return; + prompt_end(); host_prompt_reason = reason; - host_action_prompt_plus(F("begin"), fstr, extra_char); + prompt_plus(F("begin"), fstr, extra_char); } - void host_action_prompt_button(FSTR_P const fstr) { host_action_prompt_plus(F("button"), fstr); } - void host_action_prompt_end() { host_action_prompt(F("end")); } - void host_action_prompt_show() { host_action_prompt(F("show")); } + void HostUI::prompt_button(FSTR_P const fstr) { prompt_plus(F("button"), fstr); } + void HostUI::prompt_end() { prompt(F("end")); } + void HostUI::prompt_show() { prompt(F("show")); } - void _host_prompt_show(FSTR_P const btn1/*=nullptr*/, FSTR_P const btn2/*=nullptr*/) { - if (btn1) host_action_prompt_button(btn1); - if (btn2) host_action_prompt_button(btn2); - host_action_prompt_show(); + void HostUI::_prompt_show(FSTR_P const btn1, FSTR_P const btn2) { + if (btn1) prompt_button(btn1); + if (btn2) prompt_button(btn2); + prompt_show(); } - void host_prompt_do(const PromptReason reason, FSTR_P const fstr, FSTR_P const btn1/*=nullptr*/, FSTR_P const btn2/*=nullptr*/) { - host_action_prompt_begin(reason, fstr); - _host_prompt_show(btn1, btn2); + void HostUI::prompt_do(const PromptReason reason, FSTR_P const fstr, FSTR_P const btn1/*=nullptr*/, FSTR_P const btn2/*=nullptr*/) { + prompt_begin(reason, fstr); + _prompt_show(btn1, btn2); } - void host_prompt_do(const PromptReason reason, FSTR_P const fstr, const char extra_char, FSTR_P const btn1/*=nullptr*/, FSTR_P const btn2/*=nullptr*/) { - host_action_prompt_begin(reason, fstr, extra_char); - _host_prompt_show(btn1, btn2); + void HostUI::prompt_do(const PromptReason reason, FSTR_P const fstr, const char extra_char, FSTR_P const btn1/*=nullptr*/, FSTR_P const btn2/*=nullptr*/) { + prompt_begin(reason, fstr, extra_char); + _prompt_show(btn1, btn2); } - void filament_load_host_prompt() { - const bool disable_to_continue = TERN0(HAS_FILAMENT_SENSOR, runout.filament_ran_out); - host_prompt_do(PROMPT_FILAMENT_RUNOUT, F("Paused"), F("PurgeMore"), - disable_to_continue ? F("DisableRunout") : FPSTR(CONTINUE_STR) - ); - } + #if ENABLED(ADVANCED_PAUSE_FEATURE) + void HostUI::filament_load_prompt() { + const bool disable_to_continue = TERN0(HAS_FILAMENT_SENSOR, runout.filament_ran_out); + prompt_do(PROMPT_FILAMENT_RUNOUT, F("Paused"), F("PurgeMore"), + disable_to_continue ? F("DisableRunout") : FPSTR(CONTINUE_STR) + ); + } + #endif // // Handle responses from the host, such as: @@ -141,7 +162,7 @@ void host_action(FSTR_P const fstr, const bool eol) { // - Resume Print response // - Dismissal of info // - void host_response_handler(const uint8_t response) { + void HostUI::handle_response(const uint8_t response) { const PromptReason hpr = host_prompt_reason; host_prompt_reason = PROMPT_NOT_DEFINED; // Reset now ahead of logic switch (hpr) { diff --git a/Marlin/src/feature/host_actions.h b/Marlin/src/feature/host_actions.h index fb19618b1a..6671072139 100644 --- a/Marlin/src/feature/host_actions.h +++ b/Marlin/src/feature/host_actions.h @@ -24,34 +24,13 @@ #include "../inc/MarlinConfigPre.h" #include "../HAL/shared/Marduino.h" -void host_action(FSTR_P const fstr, const bool eol=true); - -#ifdef ACTION_ON_KILL - void host_action_kill(); -#endif -#ifdef ACTION_ON_PAUSE - void host_action_pause(const bool eol=true); -#endif -#ifdef ACTION_ON_PAUSED - void host_action_paused(const bool eol=true); -#endif -#ifdef ACTION_ON_RESUME - void host_action_resume(); -#endif -#ifdef ACTION_ON_RESUMED - void host_action_resumed(); -#endif -#ifdef ACTION_ON_CANCEL - void host_action_cancel(); -#endif -#ifdef ACTION_ON_START - void host_action_start(); -#endif +typedef union { + uint8_t bits; + struct { bool info:1, errors:1, debug:1; }; +} flag_t; #if ENABLED(HOST_PROMPT_SUPPORT) - extern const char CONTINUE_STR[], DISMISS_STR[]; - enum PromptReason : uint8_t { PROMPT_NOT_DEFINED, PROMPT_FILAMENT_RUNOUT, @@ -61,21 +40,80 @@ void host_action(FSTR_P const fstr, const bool eol=true); PROMPT_INFO }; - extern PromptReason host_prompt_reason; - - void host_response_handler(const uint8_t response); - void host_action_notify(const char * const cstr); - void host_action_notify(FSTR_P const fstr); - void host_action_prompt_begin(const PromptReason reason, FSTR_P const fstr, const char extra_char='\0'); - void host_action_prompt_button(FSTR_P const fstr); - void host_action_prompt_end(); - void host_action_prompt_show(); - void host_prompt_do(const PromptReason reason, FSTR_P const fstr, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr); - void host_prompt_do(const PromptReason reason, FSTR_P const fstr, const char extra_char, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr); - inline void host_prompt_open(const PromptReason reason, FSTR_P const fstr, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr) { - if (host_prompt_reason == PROMPT_NOT_DEFINED) host_prompt_do(reason, fstr, btn1, btn2); - } - - void filament_load_host_prompt(); - #endif + +class HostUI { + public: + + static flag_t flag; + HostUI() { flag.bits = 0xFF; } + + static void action(FSTR_P const fstr, const bool eol=true); + + #ifdef ACTION_ON_KILL + static void kill(); + #endif + #ifdef ACTION_ON_PAUSE + static void pause(const bool eol=true); + #endif + #ifdef ACTION_ON_PAUSED + static void paused(const bool eol=true); + #endif + #ifdef ACTION_ON_RESUME + static void resume(); + #endif + #ifdef ACTION_ON_RESUMED + static void resumed(); + #endif + #ifdef ACTION_ON_CANCEL + static void cancel(); + #endif + #ifdef ACTION_ON_START + static void start(); + #endif + + #if ENABLED(G29_RETRY_AND_RECOVER) + #ifdef ACTION_ON_G29_RECOVER + static void g29_recover(); + #endif + #ifdef ACTION_ON_G29_FAILURE + static void g29_failure(); + #endif + #endif + + #if ENABLED(HOST_PROMPT_SUPPORT) + private: + static void prompt(FSTR_P const ptype, const bool eol=true); + static void prompt_plus(FSTR_P const ptype, FSTR_P const fstr, const char extra_char='\0'); + static void prompt_show(); + static void _prompt_show(FSTR_P const btn1, FSTR_P const btn2); + + public: + static PromptReason host_prompt_reason; + + static void handle_response(const uint8_t response); + + static void notify_P(PGM_P const message); + static inline void notify(FSTR_P const fmsg) { notify_P(FTOP(fmsg)); } + static void notify(const char * const message); + + static void prompt_begin(const PromptReason reason, FSTR_P const fstr, const char extra_char='\0'); + static void prompt_button(FSTR_P const fstr); + static void prompt_end(); + static void prompt_do(const PromptReason reason, FSTR_P const pstr, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr); + static void prompt_do(const PromptReason reason, FSTR_P const pstr, const char extra_char, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr); + static inline void prompt_open(const PromptReason reason, FSTR_P const pstr, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr) { + if (host_prompt_reason == PROMPT_NOT_DEFINED) prompt_do(reason, pstr, btn1, btn2); + } + + #if ENABLED(ADVANCED_PAUSE_FEATURE) + static void filament_load_prompt(); + #endif + + #endif + +}; + +extern HostUI hostui; + +extern const char CONTINUE_STR[], DISMISS_STR[]; diff --git a/Marlin/src/feature/mmu/mmu2.cpp b/Marlin/src/feature/mmu/mmu2.cpp index 56e6e6150b..2813337c63 100644 --- a/Marlin/src/feature/mmu/mmu2.cpp +++ b/Marlin/src/feature/mmu/mmu2.cpp @@ -962,7 +962,7 @@ bool MMU2::eject_filament(const uint8_t index, const bool recover) { if (recover) { LCD_MESSAGE(MSG_MMU2_EJECT_RECOVER); BUZZ(200, 404); - TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, F("MMU2 Eject Recover"), FPSTR(CONTINUE_STR))); + TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, F("MMU2 Eject Recover"), FPSTR(CONTINUE_STR))); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(F("MMU2 Eject Recover"))); TERN_(HAS_RESUME_CONTINUE, wait_for_user_response()); BUZZ(200, 404); diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index 643c4ef9fc..d97ac2a0ac 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -198,7 +198,7 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load #if ENABLED(HOST_PROMPT_SUPPORT) const char tool = '0' + TERN0(MULTI_FILAMENT_SENSOR, active_extruder); - host_prompt_do(PROMPT_USER_CONTINUE, F("Load Filament T"), tool, FPSTR(CONTINUE_STR)); + hostui.prompt_do(PROMPT_USER_CONTINUE, F("Load Filament T"), tool, FPSTR(CONTINUE_STR)); #endif while (wait_for_user) { @@ -253,7 +253,7 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load if (show_lcd) ui.pause_show_message(PAUSE_MESSAGE_PURGE); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE))); - TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE), FPSTR(CONTINUE_STR))); + TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE), FPSTR(CONTINUE_STR))); TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_Popup_Confirm(ICON_BLTouch, GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE), FPSTR(CONTINUE_STR))); wait_for_user = true; // A click or M108 breaks the purge_length loop for (float purge_count = purge_length; purge_count > 0 && wait_for_user; --purge_count) @@ -271,7 +271,7 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load unscaled_e_move(purge_length, ADVANCED_PAUSE_PURGE_FEEDRATE); } - TERN_(HOST_PROMPT_SUPPORT, filament_load_host_prompt()); // Initiate another host prompt. + TERN_(HOST_PROMPT_SUPPORT, hostui.filament_load_prompt()); // Initiate another host prompt. #if M600_PURGE_MORE_RESUMABLE if (show_lcd) { @@ -291,7 +291,7 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load } while (TERN0(M600_PURGE_MORE_RESUMABLE, pause_menu_response == PAUSE_RESPONSE_EXTRUDE_MORE)); #endif - TERN_(HOST_PROMPT_SUPPORT, host_action_prompt_end()); + TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_end()); return true; } @@ -397,13 +397,13 @@ bool pause_print(const_float_t retract, const xyz_pos_t &park_point, const bool #if ENABLED(HOST_ACTION_COMMANDS) #ifdef ACTION_ON_PAUSED - host_action_paused(); + hostui.paused(); #elif defined(ACTION_ON_PAUSE) - host_action_pause(); + hostui.pause(); #endif #endif - TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_INFO, F("Pause"), FPSTR(DISMISS_STR))); + TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_open(PROMPT_INFO, F("Pause"), FPSTR(DISMISS_STR))); // Indicate that the printer is paused ++did_pause_print; @@ -512,7 +512,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep // Wait for filament insert by user and press button KEEPALIVE_STATE(PAUSED_FOR_USER); - TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_NOZZLE_PARKED), FPSTR(CONTINUE_STR))); + TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_NOZZLE_PARKED), FPSTR(CONTINUE_STR))); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_NOZZLE_PARKED))); wait_for_user = true; // LCD click or M108 will clear this while (wait_for_user) { @@ -528,13 +528,13 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep ui.pause_show_message(PAUSE_MESSAGE_HEAT); SERIAL_ECHO_MSG(_PMSG(STR_FILAMENT_CHANGE_HEAT)); - TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_HEATER_TIMEOUT), GET_TEXT_F(MSG_REHEAT))); + TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_HEATER_TIMEOUT), GET_TEXT_F(MSG_REHEAT))); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_HEATER_TIMEOUT))); TERN_(HAS_RESUME_CONTINUE, wait_for_user_response(0, true)); // Wait for LCD click or M108 - TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_INFO, GET_TEXT_F(MSG_REHEATING))); + TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_INFO, GET_TEXT_F(MSG_REHEATING))); TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged(GET_TEXT_F(MSG_REHEATING))); @@ -554,7 +554,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep HOTEND_LOOP() thermalManager.heater_idle[e].start(nozzle_timeout); - TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_REHEATDONE), FPSTR(CONTINUE_STR))); + TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_REHEATDONE), FPSTR(CONTINUE_STR))); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_REHEATDONE))); TERN_(DWIN_CREALITY_LCD_ENHANCED, LCD_MESSAGE(MSG_REHEATDONE)); @@ -664,14 +664,14 @@ void resume_print(const_float_t slow_load_length/*=0*/, const_float_t fast_load_ ui.pause_show_message(PAUSE_MESSAGE_STATUS); #ifdef ACTION_ON_RESUMED - host_action_resumed(); + hostui.resumed(); #elif defined(ACTION_ON_RESUME) - host_action_resume(); + hostui.resume(); #endif --did_pause_print; - TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_INFO, F("Resuming"), FPSTR(DISMISS_STR))); + TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_open(PROMPT_INFO, F("Resuming"), FPSTR(DISMISS_STR))); // Resume the print job timer if it was running if (print_job_timer.isPaused()) print_job_timer.start(); diff --git a/Marlin/src/feature/runout.cpp b/Marlin/src/feature/runout.cpp index e53c229e70..9317e3489a 100644 --- a/Marlin/src/feature/runout.cpp +++ b/Marlin/src/feature/runout.cpp @@ -96,8 +96,7 @@ void event_filament_runout(const uint8_t extruder) { //action:out_of_filament #if ENABLED(HOST_PROMPT_SUPPORT) - host_action_prompt_begin(PROMPT_FILAMENT_RUNOUT, F("FilamentRunout T"), tool); - host_action_prompt_show(); + hostui.prompt_do(PROMPT_FILAMENT_RUNOUT, F("FilamentRunout T"), tool); //action:out_of_filament #endif const bool run_runout_script = !runout.host_handling; @@ -109,18 +108,18 @@ void event_filament_runout(const uint8_t extruder) { || TERN0(ADVANCED_PAUSE_FEATURE, strstr(FILAMENT_RUNOUT_SCRIPT, "M25")) ) ) { - host_action_paused(false); + hostui.paused(false); } else { // Legacy Repetier command for use until newer version supports standard dialog // To be removed later when pause command also triggers dialog #ifdef ACTION_ON_FILAMENT_RUNOUT - host_action(F(ACTION_ON_FILAMENT_RUNOUT " T"), false); + hostui.action(F(ACTION_ON_FILAMENT_RUNOUT " T"), false); SERIAL_CHAR(tool); SERIAL_EOL(); #endif - host_action_pause(false); + hostui.pause(false); } SERIAL_ECHOPGM(" " ACTION_REASON_ON_FILAMENT_RUNOUT " "); SERIAL_CHAR(tool); diff --git a/Marlin/src/gcode/config/M43.cpp b/Marlin/src/gcode/config/M43.cpp index 2c778fd006..097aa142f0 100644 --- a/Marlin/src/gcode/config/M43.cpp +++ b/Marlin/src/gcode/config/M43.cpp @@ -344,7 +344,7 @@ void GcodeSuite::M43() { #if HAS_RESUME_CONTINUE KEEPALIVE_STATE(PAUSED_FOR_USER); wait_for_user = true; - TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, F("M43 Wait Called"), FPSTR(CONTINUE_STR))); + TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, F("M43 Wait Called"), FPSTR(CONTINUE_STR))); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(F("M43 Wait Called"))); #endif diff --git a/Marlin/src/gcode/control/M111.cpp b/Marlin/src/gcode/control/M111.cpp index 69d20b4c5d..08c39b762e 100644 --- a/Marlin/src/gcode/control/M111.cpp +++ b/Marlin/src/gcode/control/M111.cpp @@ -26,7 +26,7 @@ * M111: Set the debug level */ void GcodeSuite::M111() { - if (parser.seen('S')) marlin_debug_flags = parser.byteval('S'); + if (parser.seenval('S')) marlin_debug_flags = parser.value_byte(); static PGMSTR(str_debug_1, STR_DEBUG_ECHO); static PGMSTR(str_debug_2, STR_DEBUG_INFO); diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 1bfb82622e..5a030e97ab 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -237,9 +237,9 @@ void GcodeSuite::dwell(millis_t time) { #if ENABLED(G29_RETRY_AND_RECOVER) void GcodeSuite::event_probe_recover() { - TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_INFO, F("G29 Retrying"), FPSTR(DISMISS_STR))); + TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_INFO, F("G29 Retrying"), FPSTR(DISMISS_STR))); #ifdef ACTION_ON_G29_RECOVER - host_action(F(ACTION_ON_G29_RECOVER)); + hostui.g29_recover(); #endif #ifdef G29_RECOVER_COMMANDS process_subcommands_now(F(G29_RECOVER_COMMANDS)); @@ -252,14 +252,14 @@ void GcodeSuite::dwell(millis_t time) { void GcodeSuite::event_probe_failure() { #ifdef ACTION_ON_G29_FAILURE - host_action(F(ACTION_ON_G29_FAILURE)); + hostui.g29_failure(); #endif #ifdef G29_FAILURE_COMMANDS process_subcommands_now(F(G29_FAILURE_COMMANDS)); #endif #if ENABLED(G29_HALT_ON_FAILURE) #ifdef ACTION_ON_CANCEL - host_action_cancel(); + hostui.cancel(); #endif kill(GET_TEXT_F(MSG_LCD_PROBING_FAILED)); #endif @@ -282,7 +282,7 @@ void GcodeSuite::dwell(millis_t time) { } } - TERN_(HOST_PROMPT_SUPPORT, host_action_prompt_end()); + TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_end()); #ifdef G29_SUCCESS_COMMANDS process_subcommands_now(F(G29_SUCCESS_COMMANDS)); diff --git a/Marlin/src/gcode/host/M876.cpp b/Marlin/src/gcode/host/M876.cpp index 00efb013d2..49994f44e6 100644 --- a/Marlin/src/gcode/host/M876.cpp +++ b/Marlin/src/gcode/host/M876.cpp @@ -33,7 +33,7 @@ */ void GcodeSuite::M876() { - if (parser.seenval('S')) host_response_handler((uint8_t)parser.value_int()); + if (parser.seenval('S')) hostui.handle_response((uint8_t)parser.value_int()); } diff --git a/Marlin/src/gcode/lcd/M0_M1.cpp b/Marlin/src/gcode/lcd/M0_M1.cpp index 239366fec8..6e3b84c020 100644 --- a/Marlin/src/gcode/lcd/M0_M1.cpp +++ b/Marlin/src/gcode/lcd/M0_M1.cpp @@ -84,7 +84,7 @@ void GcodeSuite::M0_M1() { #endif - TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, parser.codenum ? F("M1 Stop") : F("M0 Stop"), FPSTR(CONTINUE_STR))); + TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, parser.codenum ? F("M1 Stop") : F("M0 Stop"), FPSTR(CONTINUE_STR))); TERN_(HAS_RESUME_CONTINUE, wait_for_user_response(ms)); diff --git a/Marlin/src/gcode/sd/M1001.cpp b/Marlin/src/gcode/sd/M1001.cpp index 374b100f59..417f3747c1 100644 --- a/Marlin/src/gcode/sd/M1001.cpp +++ b/Marlin/src/gcode/sd/M1001.cpp @@ -97,7 +97,7 @@ void GcodeSuite::M1001() { if (long_print) { printerEventLEDs.onPrintCompleted(); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_PRINT_DONE))); - TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_PRINT_DONE), FPSTR(CONTINUE_STR))); + TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_PRINT_DONE), FPSTR(CONTINUE_STR))); TERN_(HAS_RESUME_CONTINUE, wait_for_user_response(SEC_TO_MS(TERN(HAS_LCD_MENU, PE_LEDS_COMPLETED_TIME, 30)))); printerEventLEDs.onResumeAfterWait(); } diff --git a/Marlin/src/gcode/sd/M24_M25.cpp b/Marlin/src/gcode/sd/M24_M25.cpp index 21e43b033e..64ac0cce09 100644 --- a/Marlin/src/gcode/sd/M24_M25.cpp +++ b/Marlin/src/gcode/sd/M24_M25.cpp @@ -77,9 +77,9 @@ void GcodeSuite::M24() { #if ENABLED(HOST_ACTION_COMMANDS) #ifdef ACTION_ON_RESUME - host_action_resume(); + hostui.resume(); #endif - TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_INFO, F("Resuming SD"), FPSTR(DISMISS_STR))); + TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_open(PROMPT_INFO, F("Resuming SD"), FPSTR(DISMISS_STR))); #endif ui.reset_status(); @@ -116,9 +116,9 @@ void GcodeSuite::M25() { IF_DISABLED(DWIN_CREALITY_LCD, ui.reset_status()); #if ENABLED(HOST_ACTION_COMMANDS) - TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_PAUSE_RESUME, F("Pause SD"), F("Resume"))); + TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_open(PROMPT_PAUSE_RESUME, F("Pause SD"), F("Resume"))); #ifdef ACTION_ON_PAUSE - host_action_pause(); + hostui.pause(); #endif #endif diff --git a/Marlin/src/gcode/stats/M75-M78.cpp b/Marlin/src/gcode/stats/M75-M78.cpp index b55409946e..7d16899fd3 100644 --- a/Marlin/src/gcode/stats/M75-M78.cpp +++ b/Marlin/src/gcode/stats/M75-M78.cpp @@ -49,7 +49,7 @@ void GcodeSuite::M75() { */ void GcodeSuite::M76() { print_job_timer.pause(); - TERN_(HOST_PAUSE_M76, host_action_pause()); + TERN_(HOST_PAUSE_M76, hostui.pause()); } /** diff --git a/Marlin/src/lcd/e3v2/creality/dwin.cpp b/Marlin/src/lcd/e3v2/creality/dwin.cpp index d5abe977e5..3326ccb1f3 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.cpp +++ b/Marlin/src/lcd/e3v2/creality/dwin.cpp @@ -2363,7 +2363,7 @@ void HMI_PauseOrStop() { card.abortFilePrintSoon(); // Let the main loop handle SD abort dwin_abort_flag = true; // Reset feedrate, return to Home #ifdef ACTION_ON_CANCEL - host_action_cancel(); + hostui.cancel(); #endif Popup_Window_Home(true); if (HMI_flag.home_flag) planner.synchronize(); // Wait for planner moves to finish! diff --git a/Marlin/src/lcd/e3v2/enhanced/dwin.cpp b/Marlin/src/lcd/e3v2/enhanced/dwin.cpp index 4035a78c93..f9f2da5a4c 100644 --- a/Marlin/src/lcd/e3v2/enhanced/dwin.cpp +++ b/Marlin/src/lcd/e3v2/enhanced/dwin.cpp @@ -1391,7 +1391,7 @@ void HMI_PauseOrStop() { card.abortFilePrintSoon(); // Let the main loop handle SD abort dwin_abort_flag = true; // Reset feedrate, return to Home #ifdef ACTION_ON_CANCEL - host_action_cancel(); + hostui.cancel(); #endif DWIN_Draw_Popup(ICON_BLTouch, F("Stopping...") , F("Please wait until done.")); } diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 9bb324b05e..6fe3db438d 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -4503,7 +4503,7 @@ void CrealityDWINClass::Print_Screen_Control() { #endif } else { - TERN_(HOST_ACTION_COMMANDS, host_action_resume()); + TERN_(HOST_ACTION_COMMANDS, hostui.resume()); } Draw_Print_Screen(); } @@ -4553,7 +4553,7 @@ void CrealityDWINClass::Popup_Control() { #endif } else { - TERN_(HOST_ACTION_COMMANDS, host_action_pause()); + TERN_(HOST_ACTION_COMMANDS, hostui.pause()); } } Draw_Print_Screen(); @@ -4566,7 +4566,7 @@ void CrealityDWINClass::Popup_Control() { thermalManager.disable_all_heaters(); } else { - TERN_(HOST_ACTION_COMMANDS, host_action_cancel()); + TERN_(HOST_ACTION_COMMANDS, hostui.cancel()); } } else diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.cpp index 0db063b70c..00b2d6a094 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/status_screen.cpp @@ -242,7 +242,7 @@ bool StatusScreen::onTouchEnd(uint8_t tag) { if (ExtUI::isPrintingFromMedia()) ExtUI::pausePrint(); #ifdef ACTION_ON_PAUSE - else host_action_pause(); + else hostui.pause(); #endif GOTO_SCREEN(StatusScreen); break; @@ -251,7 +251,7 @@ bool StatusScreen::onTouchEnd(uint8_t tag) { if (ExtUI::isPrintingFromMedia()) ExtUI::resumePrint(); #ifdef ACTION_ON_RESUME - else host_action_resume(); + else hostui.resume(); #endif GOTO_SCREEN(StatusScreen); break; diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/confirm_abort_print_dialog_box.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/confirm_abort_print_dialog_box.cpp index 02e48efa01..bf4aa74375 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/confirm_abort_print_dialog_box.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/confirm_abort_print_dialog_box.cpp @@ -41,7 +41,7 @@ bool ConfirmAbortPrintDialogBox::onTouchEnd(uint8_t tag) { if (ExtUI::isPrintingFromMedia()) ExtUI::stopPrint(); #ifdef ACTION_ON_CANCEL - else host_action_cancel(); + else hostui.cancel(); #endif return true; default: diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/tune_menu.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/tune_menu.cpp index 6f4beb6673..98150ceccb 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/tune_menu.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/tune_menu.cpp @@ -138,7 +138,7 @@ void TuneMenu::pausePrint() { if (ExtUI::isPrintingFromMedia()) ExtUI::pausePrint(); #ifdef ACTION_ON_PAUSE - else host_action_pause(); + else hostui.pause(); #endif GOTO_SCREEN(StatusScreen); } @@ -150,7 +150,7 @@ void TuneMenu::resumePrint() { else if (ExtUI::isPrintingFromMedia()) ExtUI::resumePrint(); #ifdef ACTION_ON_RESUME - else host_action_resume(); + else hostui.resume(); #endif GOTO_SCREEN(StatusScreen); } diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index 8e588ef8c2..72dab6f35e 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -918,7 +918,7 @@ namespace ExtUI { #endif // HAS_LEVELING #if ENABLED(HOST_PROMPT_SUPPORT) - void setHostResponse(const uint8_t response) { host_response_handler(response); } + void setHostResponse(const uint8_t response) { hostui.handle_response(response); } #endif #if ENABLED(PRINTCOUNTER) diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 83be7fd1a8..ae169cdab6 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -1355,7 +1355,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; void MarlinUI::set_status(const char * const cstr, const bool persist) { if (alert_level) return; - TERN_(HOST_PROMPT_SUPPORT, host_action_notify(cstr)); + TERN_(HOST_PROMPT_SUPPORT, hostui.notify(cstr)); // Here we have a problem. The message is encoded in UTF8, so // arbitrarily cutting it will be a problem. We MUST be sure @@ -1427,7 +1427,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; if (level < alert_level) return; alert_level = level; - TERN_(HOST_PROMPT_SUPPORT, host_action_notify(fstr)); + TERN_(HOST_PROMPT_SUPPORT, hostui.notify(fstr)); // Since the message is encoded in UTF8 it must // only be cut on a character boundary. @@ -1533,10 +1533,10 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; card.abortFilePrintSoon(); #endif #ifdef ACTION_ON_CANCEL - host_action_cancel(); + hostui.cancel(); #endif IF_DISABLED(SDSUPPORT, print_job_timer.stop()); - TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_INFO, F("UI Aborted"), FPSTR(DISMISS_STR))); + TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_open(PROMPT_INFO, F("UI Aborted"), FPSTR(DISMISS_STR))); LCD_MESSAGE(MSG_PRINT_ABORTED); TERN_(HAS_LCD_MENU, return_to_status()); } @@ -1565,7 +1565,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; #endif TERN_(HAS_TOUCH_SLEEP, wakeup_screen()); - TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_PAUSE_RESUME, F("UI Pause"), F("Resume"))); + TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_open(PROMPT_PAUSE_RESUME, F("UI Pause"), F("Resume"))); LCD_MESSAGE(MSG_PRINT_PAUSED); @@ -1575,7 +1575,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; #elif ENABLED(SDSUPPORT) queue.inject(F("M25")); #elif defined(ACTION_ON_PAUSE) - host_action_pause(); + hostui.pause(); #endif } @@ -1584,7 +1584,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; TERN_(PARK_HEAD_ON_PAUSE, wait_for_heatup = wait_for_user = false); TERN_(SDSUPPORT, if (IS_SD_PAUSED()) queue.inject_P(M24_STR)); #ifdef ACTION_ON_RESUME - host_action_resume(); + hostui.resume(); #endif print_job_timer.start(); // Also called by M24 } @@ -1639,13 +1639,13 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; // Send the status line as a host notification // void MarlinUI::set_status(const char * const cstr, const bool) { - TERN(HOST_PROMPT_SUPPORT, host_action_notify(cstr), UNUSED(cstr)); + TERN(HOST_PROMPT_SUPPORT, hostui.notify(cstr), UNUSED(cstr)); } void MarlinUI::set_status(FSTR_P const fstr, const int8_t) { - TERN(HOST_PROMPT_SUPPORT, host_action_notify(fstr), UNUSED(fstr)); + TERN(HOST_PROMPT_SUPPORT, hostui.notify(fstr), UNUSED(fstr)); } void MarlinUI::status_printf(const uint8_t, FSTR_P const fstr, ...) { - TERN(HOST_PROMPT_SUPPORT, host_action_notify(fstr), UNUSED(fstr)); + TERN(HOST_PROMPT_SUPPORT, hostui.notify(fstr), UNUSED(fstr)); } #endif // !HAS_DISPLAY && !HAS_STATUS_MESSAGE diff --git a/Marlin/src/lcd/menu/menu_delta_calibrate.cpp b/Marlin/src/lcd/menu/menu_delta_calibrate.cpp index 95103e9bf6..ea627f69e7 100644 --- a/Marlin/src/lcd/menu/menu_delta_calibrate.cpp +++ b/Marlin/src/lcd/menu/menu_delta_calibrate.cpp @@ -58,13 +58,13 @@ void _man_probe_pt(const xy_pos_t &xy) { #include "../../MarlinCore.h" // for wait_for_user_response() #endif #if ENABLED(HOST_PROMPT_SUPPORT) - #include "../../feature/host_actions.h" // for host_prompt_do + #include "../../feature/host_actions.h" // for hostui.prompt_do #endif float lcd_probe_pt(const xy_pos_t &xy) { _man_probe_pt(xy); ui.defer_status_screen(); - TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, F("Delta Calibration in progress"), FPSTR(CONTINUE_STR))); + TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, F("Delta Calibration in progress"), FPSTR(CONTINUE_STR))); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(F("Delta Calibration in progress"))); TERN_(HAS_RESUME_CONTINUE, wait_for_user_response()); ui.goto_previous_screen_no_defer(); diff --git a/Marlin/src/lcd/menu/menu_main.cpp b/Marlin/src/lcd/menu/menu_main.cpp index f39e008cd7..172f9daf7a 100644 --- a/Marlin/src/lcd/menu/menu_main.cpp +++ b/Marlin/src/lcd/menu/menu_main.cpp @@ -301,7 +301,7 @@ void menu_main() { ACTION_ITEM(MSG_RESUME_PRINT, ui.resume_print); #if ENABLED(HOST_START_MENU_ITEM) && defined(ACTION_ON_START) - ACTION_ITEM(MSG_HOST_START_PRINT, host_action_start); + ACTION_ITEM(MSG_HOST_START_PRINT, hostui.start); #endif #if ENABLED(PREHEAT_SHORTCUT_MENU_ITEM) diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 4078effe76..d9e52a9b43 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -140,7 +140,7 @@ xyz_pos_t Probe::offset; // Initialized by settings.load() LCD_MESSAGE(MSG_MANUAL_DEPLOY_TOUCHMI); ui.return_to_status(); - TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, F("Deploy TouchMI"), FPSTR(CONTINUE_STR))); + TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, F("Deploy TouchMI"), FPSTR(CONTINUE_STR))); TERN_(HAS_RESUME_CONTINUE, wait_for_user_response()); ui.reset_status(); ui.goto_screen(prev_screen); @@ -295,7 +295,7 @@ FORCE_INLINE void probe_specific_action(const bool deploy) { ui.set_status(ds_str, 99); SERIAL_ECHOLNF(ds_str); - TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, F("Stow Probe"), FPSTR(CONTINUE_STR))); + TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, F("Stow Probe"), FPSTR(CONTINUE_STR))); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(F("Stow Probe"))); TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_Popup_Confirm(ICON_BLTouch, F("Stow Probe"), FPSTR(CONTINUE_STR))); TERN_(HAS_RESUME_CONTINUE, wait_for_user_response()); From 95662d3aed0a31ea832407c042a5b0c56cd8a2db Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Fri, 15 Oct 2021 15:56:59 -0400 Subject: [PATCH 005/125] =?UTF-8?q?=E2=9C=A8=20Add=20option=20EVENT=5FGCOD?= =?UTF-8?q?E=5FTOOLCHANGE=5FALWAYS=5FRUN=20(#22960)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 1 + Marlin/src/module/tool_change.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 8e1f673c87..9d119eac84 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -2313,6 +2313,7 @@ */ //#define EVENT_GCODE_TOOLCHANGE_T0 "G28 A\nG1 A0" // Extra G-code to run while executing tool-change command T0 //#define EVENT_GCODE_TOOLCHANGE_T1 "G1 A10" // Extra G-code to run while executing tool-change command T1 + //#define EVENT_GCODE_TOOLCHANGE_ALWAYS_RUN // Always execute above G-code sequences. Use with caution! /** * Tool Sensors detect when tools have been picked up or dropped. diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index b968537e71..81d85573af 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -1307,7 +1307,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { TERN_(HAS_FANMUX, fanmux_switch(active_extruder)); - if (!no_move) { + if (ENABLED(EVENT_GCODE_TOOLCHANGE_ALWAYS_RUN) || !no_move) { #ifdef EVENT_GCODE_TOOLCHANGE_T0 if (new_tool == 0) gcode.process_subcommands_now(F(EVENT_GCODE_TOOLCHANGE_T0)); From 9d72cbf84b970e5060f8dceef7158b9ca8252856 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 15 Oct 2021 15:07:47 -0500 Subject: [PATCH 006/125] =?UTF-8?q?=F0=9F=92=A1=20Update=20old=20gnu.org?= =?UTF-8?q?=20links?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/e3v2/marlinui/lcdprint_dwin.cpp | 2 +- Marlin/src/lcd/e3v2/marlinui/marlinui_dwin.h | 2 +- Marlin/src/lcd/e3v2/marlinui/ui_common.cpp | 2 +- Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp | 2 +- Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.cpp | 2 +- Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.h | 2 +- Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp | 2 +- Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.h | 2 +- Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp | 2 +- Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h | 2 +- Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.cpp | 2 +- Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.h | 2 +- Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.cpp | 2 +- Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.h | 2 +- Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Addr.h | 2 +- Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Constants.h | 2 +- Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Control.h | 2 +- Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Data.h | 2 +- Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Screen.h | 2 +- .../lcd/extui/dgus_reloaded/definition/DGUS_ScreenAddrList.cpp | 2 +- .../lcd/extui/dgus_reloaded/definition/DGUS_ScreenAddrList.h | 2 +- .../src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenSetup.cpp | 2 +- .../src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenSetup.h | 2 +- Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VP.h | 2 +- Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.cpp | 2 +- Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.h | 2 +- Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp | 2 +- Marlin/src/pins/stm32f1/pins_ZM3E2_V1_0.h | 2 +- Marlin/src/pins/stm32f1/pins_ZM3E4_V1_0.h | 2 +- Marlin/src/pins/stm32f1/pins_ZM3E4_V2_0.h | 2 +- 30 files changed, 30 insertions(+), 30 deletions(-) diff --git a/Marlin/src/lcd/e3v2/marlinui/lcdprint_dwin.cpp b/Marlin/src/lcd/e3v2/marlinui/lcdprint_dwin.cpp index 5f62459534..44be749d41 100644 --- a/Marlin/src/lcd/e3v2/marlinui/lcdprint_dwin.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/lcdprint_dwin.cpp @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ diff --git a/Marlin/src/lcd/e3v2/marlinui/marlinui_dwin.h b/Marlin/src/lcd/e3v2/marlinui/marlinui_dwin.h index de87c30b6b..a91cd19f6e 100644 --- a/Marlin/src/lcd/e3v2/marlinui/marlinui_dwin.h +++ b/Marlin/src/lcd/e3v2/marlinui/marlinui_dwin.h @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ #pragma once diff --git a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp index 8648401c9c..126700185b 100644 --- a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ diff --git a/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp b/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp index 0e2f3a3d4c..703db2ee45 100644 --- a/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.cpp index 4fce364f81..1d97902c71 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.cpp @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.h b/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.h index 2a679648d1..1869f79404 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.h @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ #pragma once diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp index 58c7baa0b6..f0844dc785 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.h b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.h index 593b2e3bb8..c2e6e4308e 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.h @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ #pragma once diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp index e81eab8e73..9bae2b95d3 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h index 4a5fbd141a..509d599200 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ #pragma once diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.cpp index 6ab2b004e5..090d53c92e 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.cpp @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.h b/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.h index 20cd48c986..9e3866467f 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSSetupHandler.h @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ #pragma once diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.cpp index 6c14745904..3fc48d2ebb 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.cpp @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.h b/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.h index a034b92ece..94632fe385 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.h @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ #pragma once diff --git a/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Addr.h b/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Addr.h index 00cdecb689..4207119c87 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Addr.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Addr.h @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ #pragma once diff --git a/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Constants.h b/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Constants.h index 4047a6d6dc..9b275fb2f5 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Constants.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Constants.h @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ #pragma once diff --git a/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Control.h b/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Control.h index 92d2f5ece2..650e1e3a1d 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Control.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Control.h @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ #pragma once diff --git a/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Data.h b/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Data.h index 886109054c..e1c1bf557f 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Data.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Data.h @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ #pragma once diff --git a/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Screen.h b/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Screen.h index b3d2ad6d3c..0a738223ce 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Screen.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Screen.h @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ #pragma once diff --git a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenAddrList.cpp b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenAddrList.cpp index 95e6444956..1627d44c84 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenAddrList.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenAddrList.cpp @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ diff --git a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenAddrList.h b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenAddrList.h index af05c46d28..1e481ef3cc 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenAddrList.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenAddrList.h @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ #pragma once diff --git a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenSetup.cpp b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenSetup.cpp index 213e430334..13319edd05 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenSetup.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenSetup.cpp @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ diff --git a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenSetup.h b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenSetup.h index 3b9208e5ec..93df5ad90a 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenSetup.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_ScreenSetup.h @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ #pragma once diff --git a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VP.h b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VP.h index b1b6792224..30b3f9ddba 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VP.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VP.h @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ #pragma once diff --git a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.cpp b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.cpp index 486f00f6ed..27b6d9036c 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.cpp @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ diff --git a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.h b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.h index d481fbab5c..1a4f36882c 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.h @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ #pragma once diff --git a/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp b/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp index bf79661b42..61b072a3f7 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ diff --git a/Marlin/src/pins/stm32f1/pins_ZM3E2_V1_0.h b/Marlin/src/pins/stm32f1/pins_ZM3E2_V1_0.h index d4f77d5f84..ba948bc479 100644 --- a/Marlin/src/pins/stm32f1/pins_ZM3E2_V1_0.h +++ b/Marlin/src/pins/stm32f1/pins_ZM3E2_V1_0.h @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ #pragma once diff --git a/Marlin/src/pins/stm32f1/pins_ZM3E4_V1_0.h b/Marlin/src/pins/stm32f1/pins_ZM3E4_V1_0.h index ca6510c7d9..49e9564b27 100644 --- a/Marlin/src/pins/stm32f1/pins_ZM3E4_V1_0.h +++ b/Marlin/src/pins/stm32f1/pins_ZM3E4_V1_0.h @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ #pragma once diff --git a/Marlin/src/pins/stm32f1/pins_ZM3E4_V2_0.h b/Marlin/src/pins/stm32f1/pins_ZM3E4_V2_0.h index 817ad71752..295ab4c50c 100644 --- a/Marlin/src/pins/stm32f1/pins_ZM3E4_V2_0.h +++ b/Marlin/src/pins/stm32f1/pins_ZM3E4_V2_0.h @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ #pragma once From babb3d7b4ce49fdca215bab857039e7132dfadbd Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sat, 16 Oct 2021 01:07:57 +0000 Subject: [PATCH 007/125] [cron] Bump distribution date (2021-10-16) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index cb13c11a22..88550591a9 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-10-15" +//#define STRING_DISTRIBUTION_DATE "2021-10-16" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index d6176599f0..965cc112e6 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-10-15" + #define STRING_DISTRIBUTION_DATE "2021-10-16" #endif /** From 3c94f2f1c33395e45f3b2456f97eb64310b41000 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sun, 17 Oct 2021 01:02:43 +0000 Subject: [PATCH 008/125] [cron] Bump distribution date (2021-10-17) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 88550591a9..efafaf83f7 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-10-16" +//#define STRING_DISTRIBUTION_DATE "2021-10-17" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 965cc112e6..6b67bee326 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-10-16" + #define STRING_DISTRIBUTION_DATE "2021-10-17" #endif /** From bc567e7b4939f3abb75a72c313824e6abf0fb07c Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 17 Oct 2021 16:56:01 -0500 Subject: [PATCH 009/125] =?UTF-8?q?=F0=9F=94=A7=20Safety=20feature=20warni?= =?UTF-8?q?ngs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/Warnings.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Marlin/src/inc/Warnings.cpp b/Marlin/src/inc/Warnings.cpp index 0e04cdd435..e5e9d57fc6 100644 --- a/Marlin/src/inc/Warnings.cpp +++ b/Marlin/src/inc/Warnings.cpp @@ -35,6 +35,23 @@ #warning "WARNING! Disable MARLIN_DEV_MODE for the final build!" #endif +// Safety Features +#if DISABLED(USE_WATCHDOG) + #warning "Safety Alert! Enable USE_WATCHDOG for the final build!" +#endif +#if HAS_HOTEND && DISABLED(THERMAL_PROTECTION_HOTENDS) + #warning "Safety Alert! Enable THERMAL_PROTECTION_HOTENDS for the final build!" +#endif +#if HAS_HEATED_BED && DISABLED(THERMAL_PROTECTION_BED) + #warning "Safety Alert! Enable THERMAL_PROTECTION_BED for the final build!" +#endif +#if HAS_HEATED_CHAMBER && DISABLED(THERMAL_PROTECTION_CHAMBER) + #warning "Safety Alert! Enable THERMAL_PROTECTION_CHAMBER for the final build!" +#endif +#if HAS_COOLER && DISABLED(THERMAL_PROTECTION_COOLER) + #warning "Safety Alert! Enable THERMAL_PROTECTION_COOLER for the final build!" +#endif + #if NONE(HAS_RESUME_CONTINUE, HOST_PROMPT_SUPPORT) #warning "Your Configuration provides no method to acquire user feedback!" #endif From cd0ee8c34dab5393d7b7c7845e553a02dfd6d2da Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Mon, 18 Oct 2021 01:06:10 +0000 Subject: [PATCH 010/125] [cron] Bump distribution date (2021-10-18) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index efafaf83f7..f0f467ba58 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-10-17" +//#define STRING_DISTRIBUTION_DATE "2021-10-18" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 6b67bee326..6341981970 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-10-17" + #define STRING_DISTRIBUTION_DATE "2021-10-18" #endif /** From 7d16f0cadf12ed9c662d47af96daad6fe8e07d9e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 17 Oct 2021 19:26:31 -0500 Subject: [PATCH 011/125] =?UTF-8?q?=F0=9F=94=A8=20Improve=20'mftest'=20err?= =?UTF-8?q?or=20message?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/bin/mftest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildroot/bin/mftest b/buildroot/bin/mftest index 4ed1b9d951..9a58ba9cfc 100755 --- a/buildroot/bin/mftest +++ b/buildroot/bin/mftest @@ -155,7 +155,7 @@ if ((AUTO_BUILD)); then BLINE=$( grep -E "define\s+BOARD_$MB\b" Marlin/src/core/boards.h ) BNUM=$( $SED -E 's/^.+BOARD_[^ ]+ +([0-9]+).+$/\1/' <<<"$BLINE" ) BDESC=$( $SED -E 's/^.+\/\/ *(.+)$/\1/' <<<"$BLINE" ) - [[ -z $BNUM ]] && { echo "Error - Can't find $MB in boards list." ; exit 1 ; } + [[ -z $BNUM ]] && { echo "Error - Can't find BOARD_$MB in core/boards.h." ; exit 1 ; } ENVS=( $( grep -EA1 "MB\(.*\b$MB\b.*\)" Marlin/src/pins/pins.h | grep -E "#include.+//.+(env|$SYS):[^ ]+" | grep -oE "(env|$SYS):[^ ]+" | $SED -E "s/(env|$SYS)://" ) ) [[ -z $ENVS ]] && { errout "Error - Can't find target(s) for $MB ($BNUM)." ; exit 1 ; } ECOUNT=${#ENVS[*]} From d685cbd5c304e8e3f3b86960e616c6b797ae85bd Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 17 Oct 2021 18:11:16 -0500 Subject: [PATCH 012/125] =?UTF-8?q?=F0=9F=8E=A8=20Fix=20up=20MKS=20UI=20de?= =?UTF-8?q?fines?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mks_ui/draw_acceleration_settings.cpp | 41 ++++++++++----- .../extui/mks_ui/draw_advance_settings.cpp | 2 +- .../draw_auto_level_offset_settings.cpp | 2 +- .../lcd/extui/mks_ui/draw_baby_stepping.cpp | 50 +++++++++---------- .../lcd/extui/mks_ui/draw_eeprom_settings.cpp | 2 +- .../extui/mks_ui/draw_encoder_settings.cpp | 2 +- .../extui/mks_ui/draw_filament_settings.cpp | 2 +- Marlin/src/lcd/extui/mks_ui/draw_gcode.cpp | 2 +- .../draw_homing_sensitivity_settings.cpp | 2 +- .../lcd/extui/mks_ui/draw_jerk_settings.cpp | 2 +- Marlin/src/lcd/extui/mks_ui/draw_keyboard.cpp | 20 ++++---- .../lcd/extui/mks_ui/draw_level_settings.cpp | 2 +- .../lcd/extui/mks_ui/draw_machine_para.cpp | 2 +- .../extui/mks_ui/draw_machine_settings.cpp | 32 +++++------- .../mks_ui/draw_max_feedrate_settings.cpp | 2 +- .../lcd/extui/mks_ui/draw_motor_settings.cpp | 2 +- .../lcd/extui/mks_ui/draw_pause_position.cpp | 2 +- Marlin/src/lcd/extui/mks_ui/draw_preHeat.cpp | 2 +- .../lcd/extui/mks_ui/draw_step_settings.cpp | 2 +- .../mks_ui/draw_tmc_current_settings.cpp | 22 +++----- .../mks_ui/draw_tmc_step_mode_settings.cpp | 2 +- .../mks_ui/draw_tramming_pos_settings.cpp | 4 +- Marlin/src/lcd/extui/mks_ui/draw_ui.cpp | 28 +++++------ Marlin/src/lcd/extui/mks_ui/draw_ui.h | 15 +++--- .../lcd/extui/mks_ui/draw_wifi_settings.cpp | 2 +- Marlin/src/lcd/extui/mks_ui/wifi_module.cpp | 6 +-- 26 files changed, 123 insertions(+), 129 deletions(-) diff --git a/Marlin/src/lcd/extui/mks_ui/draw_acceleration_settings.cpp b/Marlin/src/lcd/extui/mks_ui/draw_acceleration_settings.cpp index 5de4a13c88..ac7d6d3dfb 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_acceleration_settings.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_acceleration_settings.cpp @@ -110,38 +110,53 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { void lv_draw_acceleration_settings() { scr = lv_screen_create(ACCELERATION_UI, machine_menu.AccelerationConfTitle); + lv_coord_t y = PARA_UI_POS_Y; if (!uiCfg.para_ui_page) { dtostrf(planner.settings.acceleration, 1, 1, public_buf_l); - lv_screen_menu_item_1_edit(scr, machine_menu.PrintAcceleration, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_ACCE_PRINT, 0, public_buf_l); + lv_screen_menu_item_1_edit(scr, machine_menu.PrintAcceleration, PARA_UI_POS_X, y, event_handler, ID_ACCE_PRINT, 0, public_buf_l); + y += PARA_UI_POS_Y; dtostrf(planner.settings.retract_acceleration, 1, 1, public_buf_l); - lv_screen_menu_item_1_edit(scr, machine_menu.RetractAcceleration, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_ACCE_RETRA, 1, public_buf_l); + lv_screen_menu_item_1_edit(scr, machine_menu.RetractAcceleration, PARA_UI_POS_X, y, event_handler, ID_ACCE_RETRA, 1, public_buf_l); + y += PARA_UI_POS_Y; dtostrf(planner.settings.travel_acceleration, 1, 1, public_buf_l); - lv_screen_menu_item_1_edit(scr, machine_menu.TravelAcceleration, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_ACCE_TRAVEL, 2, public_buf_l); + lv_screen_menu_item_1_edit(scr, machine_menu.TravelAcceleration, PARA_UI_POS_X, y, event_handler, ID_ACCE_TRAVEL, 2, public_buf_l); + y += PARA_UI_POS_Y; itoa(planner.settings.max_acceleration_mm_per_s2[X_AXIS], public_buf_l, 10); - lv_screen_menu_item_1_edit(scr, machine_menu.X_Acceleration, PARA_UI_POS_X, PARA_UI_POS_Y * 4, event_handler, ID_ACCE_X, 3, public_buf_l); + lv_screen_menu_item_1_edit(scr, machine_menu.X_Acceleration, PARA_UI_POS_X, y, event_handler, ID_ACCE_X, 3, public_buf_l); lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.next, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_ACCE_DOWN, true); } else { - itoa(planner.settings.max_acceleration_mm_per_s2[Y_AXIS], public_buf_l, 10); - lv_screen_menu_item_1_edit(scr, machine_menu.Y_Acceleration, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_ACCE_Y, 0, public_buf_l); + #if HAS_Y_AXIS + itoa(planner.settings.max_acceleration_mm_per_s2[Y_AXIS], public_buf_l, 10); + lv_screen_menu_item_1_edit(scr, machine_menu.Y_Acceleration, PARA_UI_POS_X, y, event_handler, ID_ACCE_Y, 0, public_buf_l); + #endif - itoa(planner.settings.max_acceleration_mm_per_s2[Z_AXIS], public_buf_l, 10); - lv_screen_menu_item_1_edit(scr, machine_menu.Z_Acceleration, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_ACCE_Z, 1, public_buf_l); + #if HAS_Z_AXIS + y += PARA_UI_POS_Y; + itoa(planner.settings.max_acceleration_mm_per_s2[Z_AXIS], public_buf_l, 10); + lv_screen_menu_item_1_edit(scr, machine_menu.Z_Acceleration, PARA_UI_POS_X, y, event_handler, ID_ACCE_Z, 1, public_buf_l); + #endif - itoa(planner.settings.max_acceleration_mm_per_s2[E_AXIS], public_buf_l, 10); - lv_screen_menu_item_1_edit(scr, machine_menu.E0_Acceleration, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_ACCE_E0, 2, public_buf_l); + #if HAS_HOTEND + y += PARA_UI_POS_Y; + itoa(planner.settings.max_acceleration_mm_per_s2[E_AXIS], public_buf_l, 10); + lv_screen_menu_item_1_edit(scr, machine_menu.E0_Acceleration, PARA_UI_POS_X, y, event_handler, ID_ACCE_E0, 2, public_buf_l); + #endif - itoa(planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(1)], public_buf_l, 10); - lv_screen_menu_item_1_edit(scr, machine_menu.E1_Acceleration, PARA_UI_POS_X, PARA_UI_POS_Y * 4, event_handler, ID_ACCE_E1, 3, public_buf_l); + #if ENABLED(DISTINCT_E_FACTORS) + y += PARA_UI_POS_Y; + itoa(planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(1)], public_buf_l, 10); + lv_screen_menu_item_1_edit(scr, machine_menu.E1_Acceleration, PARA_UI_POS_X, y, event_handler, ID_ACCE_E1, 3, public_buf_l); + #endif lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.previous, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_ACCE_UP, true); } - lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, event_handler, ID_ACCE_RETURN, true); + lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACK_POS_X, PARA_UI_BACK_POS_Y, event_handler, ID_ACCE_RETURN, true); } void lv_clear_acceleration_settings() { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_advance_settings.cpp b/Marlin/src/lcd/extui/mks_ui/draw_advance_settings.cpp index 28958b6d2c..92acae2a47 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_advance_settings.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_advance_settings.cpp @@ -84,7 +84,7 @@ void lv_draw_advance_settings() { index++; #endif - lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACL_POS_X + 10, PARA_UI_BACL_POS_Y, event_handler, ID_ADVANCE_RETURN, true); + lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACK_POS_X + 10, PARA_UI_BACK_POS_Y, event_handler, ID_ADVANCE_RETURN, true); } void lv_clear_advance_settings() { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_auto_level_offset_settings.cpp b/Marlin/src/lcd/extui/mks_ui/draw_auto_level_offset_settings.cpp index 5ac24c4413..fd14585e70 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_auto_level_offset_settings.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_auto_level_offset_settings.cpp @@ -77,7 +77,7 @@ void lv_draw_auto_level_offset_settings() { dtostrf(TERN0(HAS_PROBE_XY_OFFSET, probe.offset.z), 1, 1, public_buf_l); lv_screen_menu_item_1_edit(scr, machine_menu.Zoffset, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_OFFSET_Z, 2, public_buf_l); - lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, event_handler, ID_OFFSET_RETURN, true); + lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACK_POS_X, PARA_UI_BACK_POS_Y, event_handler, ID_OFFSET_RETURN, true); } void lv_clear_auto_level_offset_settings() { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_baby_stepping.cpp b/Marlin/src/lcd/extui/mks_ui/draw_baby_stepping.cpp index 65617fa9bb..bcc075ae64 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_baby_stepping.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_baby_stepping.cpp @@ -45,14 +45,14 @@ static lv_obj_t *scr; static lv_obj_t *labelV, *buttonV, *zOffsetText; enum { - ID_BABY_STEP_X_P = 1, - ID_BABY_STEP_X_N, - ID_BABY_STEP_Y_P, - ID_BABY_STEP_Y_N, - ID_BABY_STEP_Z_P, - ID_BABY_STEP_Z_N, - ID_BABY_STEP_DIST, - ID_BABY_STEP_RETURN + ID_BABYSTEP_X_P = 1, + ID_BABYSTEP_X_N, + ID_BABYSTEP_Y_P, + ID_BABYSTEP_Y_N, + ID_BABYSTEP_Z_P, + ID_BABYSTEP_Z_N, + ID_BABYSTEP_DIST, + ID_BABYSTEP_RETURN }; static float babystep_dist = 0.01; @@ -63,37 +63,37 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { char baby_buf[30] = { 0 }; char str_1[16]; switch (obj->mks_obj_id) { - case ID_BABY_STEP_X_P: + case ID_BABYSTEP_X_P: sprintf_P(baby_buf, PSTR("M290 X%s"), dtostrf(babystep_dist, 1, 3, str_1)); gcode.process_subcommands_now(F(baby_buf)); has_adjust_z = 1; break; - case ID_BABY_STEP_X_N: + case ID_BABYSTEP_X_N: sprintf_P(baby_buf, PSTR("M290 X%s"), dtostrf(-babystep_dist, 1, 3, str_1)); gcode.process_subcommands_now(F(baby_buf)); has_adjust_z = 1; break; - case ID_BABY_STEP_Y_P: + case ID_BABYSTEP_Y_P: sprintf_P(baby_buf, PSTR("M290 Y%s"), dtostrf(babystep_dist, 1, 3, str_1)); gcode.process_subcommands_now(F(baby_buf)); has_adjust_z = 1; break; - case ID_BABY_STEP_Y_N: + case ID_BABYSTEP_Y_N: sprintf_P(baby_buf, PSTR("M290 Y%s"), dtostrf(-babystep_dist, 1, 3, str_1)); gcode.process_subcommands_now(F(baby_buf)); has_adjust_z = 1; break; - case ID_BABY_STEP_Z_P: + case ID_BABYSTEP_Z_P: sprintf_P(baby_buf, PSTR("M290 Z%s"), dtostrf(babystep_dist, 1, 3, str_1)); gcode.process_subcommands_now(F(baby_buf)); has_adjust_z = 1; break; - case ID_BABY_STEP_Z_N: + case ID_BABYSTEP_Z_N: sprintf_P(baby_buf, PSTR("M290 Z%s"), dtostrf(-babystep_dist, 1, 3, str_1)); gcode.process_subcommands_now(F(baby_buf)); has_adjust_z = 1; break; - case ID_BABY_STEP_DIST: + case ID_BABYSTEP_DIST: if (ABS((int)(100 * babystep_dist)) == 1) babystep_dist = 0.05; else if (ABS((int)(100 * babystep_dist)) == 5) @@ -102,7 +102,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { babystep_dist = 0.01; disp_baby_step_dist(); break; - case ID_BABY_STEP_RETURN: + case ID_BABYSTEP_RETURN: if (has_adjust_z == 1) { TERN_(EEPROM_SETTINGS, (void)settings.save()); has_adjust_z = 0; @@ -114,21 +114,21 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } void lv_draw_baby_stepping() { - scr = lv_screen_create(BABY_STEP_UI); - lv_big_button_create(scr, "F:/bmp_xAdd.bin", move_menu.x_add, INTERVAL_V, titleHeight, event_handler, ID_BABY_STEP_X_P); - lv_big_button_create(scr, "F:/bmp_xDec.bin", move_menu.x_dec, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_BABY_STEP_X_N); - lv_big_button_create(scr, "F:/bmp_yAdd.bin", move_menu.y_add, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_BABY_STEP_Y_P); - lv_big_button_create(scr, "F:/bmp_yDec.bin", move_menu.y_dec, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_BABY_STEP_Y_N); - lv_big_button_create(scr, "F:/bmp_zAdd.bin", move_menu.z_add, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight, event_handler, ID_BABY_STEP_Z_P); - lv_big_button_create(scr, "F:/bmp_zDec.bin", move_menu.z_dec, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_BABY_STEP_Z_N); - buttonV = lv_imgbtn_create(scr, nullptr, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_BABY_STEP_DIST); + scr = lv_screen_create(BABYSTEP_UI); + lv_big_button_create(scr, "F:/bmp_xAdd.bin", move_menu.x_add, INTERVAL_V, titleHeight, event_handler, ID_BABYSTEP_X_P); + lv_big_button_create(scr, "F:/bmp_xDec.bin", move_menu.x_dec, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_BABYSTEP_X_N); + lv_big_button_create(scr, "F:/bmp_yAdd.bin", move_menu.y_add, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_BABYSTEP_Y_P); + lv_big_button_create(scr, "F:/bmp_yDec.bin", move_menu.y_dec, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_BABYSTEP_Y_N); + lv_big_button_create(scr, "F:/bmp_zAdd.bin", move_menu.z_add, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight, event_handler, ID_BABYSTEP_Z_P); + lv_big_button_create(scr, "F:/bmp_zDec.bin", move_menu.z_dec, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_BABYSTEP_Z_N); + buttonV = lv_imgbtn_create(scr, nullptr, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_BABYSTEP_DIST); labelV = lv_label_create_empty(buttonV); #if HAS_ROTARY_ENCODER if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonV); #endif - lv_big_button_create(scr, "F:/bmp_return.bin", common_menu.text_back, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_BABY_STEP_RETURN); + lv_big_button_create(scr, "F:/bmp_return.bin", common_menu.text_back, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_BABYSTEP_RETURN); disp_baby_step_dist(); diff --git a/Marlin/src/lcd/extui/mks_ui/draw_eeprom_settings.cpp b/Marlin/src/lcd/extui/mks_ui/draw_eeprom_settings.cpp index c518d85ab5..a9d4ac781a 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_eeprom_settings.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_eeprom_settings.cpp @@ -70,7 +70,7 @@ void lv_draw_eeprom_settings() { scr = lv_screen_create(EEPROM_SETTINGS_UI); lv_screen_menu_item(scr, eeprom_menu.revert, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_EEPROM_REVERT, 0); lv_screen_menu_item(scr, eeprom_menu.store, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_EEPROM_STORE, 1); - lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, event_handler, ID_EEPROM_RETURN, true); + lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACK_POS_X, PARA_UI_BACK_POS_Y, event_handler, ID_EEPROM_RETURN, true); } void lv_clear_eeprom_settings() { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_encoder_settings.cpp b/Marlin/src/lcd/extui/mks_ui/draw_encoder_settings.cpp index 04c6b51e2a..ec6d221e89 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_encoder_settings.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_encoder_settings.cpp @@ -58,7 +58,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { void lv_draw_encoder_settings() { scr = lv_screen_create(ENCODER_SETTINGS_UI, machine_menu.EncoderConfTitle); buttonEncoderState = lv_screen_menu_item_onoff(scr, machine_menu.EncoderConfText, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_ENCODER_STATE, 0, gCfgItems.encoder_enable); - lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, event_handler, ID_ENCODER_RETURN, true); + lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACK_POS_X, PARA_UI_BACK_POS_Y, event_handler, ID_ENCODER_RETURN, true); } void lv_clear_encoder_settings() { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_filament_settings.cpp b/Marlin/src/lcd/extui/mks_ui/draw_filament_settings.cpp index e3ca75da51..9f418b178e 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_filament_settings.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_filament_settings.cpp @@ -114,7 +114,7 @@ void lv_draw_filament_settings() { lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.previous, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_FILAMENT_SET_UP, true); } - lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, event_handler, ID_FILAMENT_SET_RETURN, true); + lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACK_POS_X, PARA_UI_BACK_POS_Y, event_handler, ID_FILAMENT_SET_RETURN, true); } void lv_clear_filament_settings() { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_gcode.cpp b/Marlin/src/lcd/extui/mks_ui/draw_gcode.cpp index fa9f7b0c47..effd49bff8 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_gcode.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_gcode.cpp @@ -96,7 +96,7 @@ void lv_draw_gcode(bool clear) { outL = lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 2, "Result:"); outV = lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 3, (const char*)public_buf); - lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACL_POS_X + 10, PARA_UI_BACL_POS_Y, event_handler, ID_GCODE_RETURN, true); + lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACK_POS_X + 10, PARA_UI_BACK_POS_Y, event_handler, ID_GCODE_RETURN, true); } void lv_clear_gcode() { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_homing_sensitivity_settings.cpp b/Marlin/src/lcd/extui/mks_ui/draw_homing_sensitivity_settings.cpp index 212f2b4995..aea64e57a8 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_homing_sensitivity_settings.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_homing_sensitivity_settings.cpp @@ -92,7 +92,7 @@ void lv_draw_homing_sensitivity_settings() { lv_screen_menu_item_1_edit(scr, machine_menu.Z2_Sensitivity, PARA_UI_POS_X, PARA_UI_POS_Y * 4, event_handler, ID_SENSITIVITY_Z2, 3, public_buf_l); #endif - lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, event_handler, ID_SENSITIVITY_RETURN, true); + lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACK_POS_X, PARA_UI_BACK_POS_Y, event_handler, ID_SENSITIVITY_RETURN, true); } void lv_clear_homing_sensitivity_settings() { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_jerk_settings.cpp b/Marlin/src/lcd/extui/mks_ui/draw_jerk_settings.cpp index d410b2003c..a680976d96 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_jerk_settings.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_jerk_settings.cpp @@ -86,7 +86,7 @@ void lv_draw_jerk_settings() { dtostrf(planner.max_jerk[E_AXIS], 1, 1, public_buf_l); lv_screen_menu_item_1_edit(scr, machine_menu.E_Jerk, PARA_UI_POS_X, PARA_UI_POS_Y * 4, event_handler, ID_JERK_E, 3, public_buf_l); - lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, event_handler, ID_JERK_RETURN, true); + lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACK_POS_X, PARA_UI_BACK_POS_Y, event_handler, ID_JERK_RETURN, true); } void lv_clear_jerk_settings() { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_keyboard.cpp b/Marlin/src/lcd/extui/mks_ui/draw_keyboard.cpp index e1184c2195..df5ebc8f22 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_keyboard.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_keyboard.cpp @@ -88,22 +88,22 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) { if (!txt) return; // Do the corresponding action according to the text of the button - if (strcmp(txt, "abc") == 0) { + if (strcmp_P(txt, PSTR("abc")) == 0) { lv_btnm_set_map(kb, kb_map_lc); lv_btnm_set_ctrl_map(kb, kb_ctrl_lc_map); return; } - else if (strcmp(txt, "ABC") == 0) { + else if (strcmp_P(txt, PSTR("ABC")) == 0) { lv_btnm_set_map(kb, kb_map_uc); lv_btnm_set_ctrl_map(kb, kb_ctrl_uc_map); return; } - else if (strcmp(txt, "1#") == 0) { + else if (strcmp_P(txt, PSTR("1#")) == 0) { lv_btnm_set_map(kb, kb_map_spec); lv_btnm_set_ctrl_map(kb, kb_ctrl_spec_map); return; } - else if (strcmp(txt, LV_SYMBOL_CLOSE) == 0) { + else if (strcmp_P(txt, PSTR(LV_SYMBOL_CLOSE)) == 0) { if (kb->event_cb != lv_kb_def_event_cb) { lv_clear_keyboard(); draw_return_ui(); @@ -115,7 +115,7 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) { } return; } - else if (strcmp(txt, LV_SYMBOL_OK) == 0) { + else if (strcmp_P(txt, PSTR(LV_SYMBOL_OK)) == 0) { if (kb->event_cb != lv_kb_def_event_cb) { const char * ret_ta_txt = lv_ta_get_text(ext->ta); switch (keyboard_value) { @@ -183,15 +183,15 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) { // Add the characters to the text area if set if (!ext->ta) return; - if (strcmp(txt, "Enter") == 0 || strcmp(txt, LV_SYMBOL_NEW_LINE) == 0) + if (strcmp_P(txt, PSTR("Enter")) == 0 || strcmp_P(txt, PSTR(LV_SYMBOL_NEW_LINE)) == 0) lv_ta_add_char(ext->ta, '\n'); - else if (strcmp(txt, LV_SYMBOL_LEFT) == 0) + else if (strcmp_P(txt, PSTR(LV_SYMBOL_LEFT)) == 0) lv_ta_cursor_left(ext->ta); - else if (strcmp(txt, LV_SYMBOL_RIGHT) == 0) + else if (strcmp_P(txt, PSTR(LV_SYMBOL_RIGHT)) == 0) lv_ta_cursor_right(ext->ta); - else if (strcmp(txt, LV_SYMBOL_BACKSPACE) == 0) + else if (strcmp_P(txt, PSTR(LV_SYMBOL_BACKSPACE)) == 0) lv_ta_del_char(ext->ta); - else if (strcmp(txt, "+/-") == 0) { + else if (strcmp_P(txt, PSTR("+/-")) == 0) { uint16_t cur = lv_ta_get_cursor_pos(ext->ta); const char * ta_txt = lv_ta_get_text(ext->ta); if (ta_txt[0] == '-') { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_level_settings.cpp b/Marlin/src/lcd/extui/mks_ui/draw_level_settings.cpp index 6fc8704607..93d34a8578 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_level_settings.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_level_settings.cpp @@ -68,7 +68,7 @@ void lv_draw_level_settings() { #if HAS_BED_PROBE lv_screen_menu_item(scr, machine_menu.LevelingAutoZoffsetConf, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_LEVEL_ZOFFSET, 2); #endif - lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACL_POS_X + 10, PARA_UI_BACL_POS_Y, event_handler, ID_LEVEL_RETURN, true); + lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACK_POS_X + 10, PARA_UI_BACK_POS_Y, event_handler, ID_LEVEL_RETURN, true); } void lv_clear_level_settings() { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_machine_para.cpp b/Marlin/src/lcd/extui/mks_ui/draw_machine_para.cpp index 57c32c733e..8e50fd8b04 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_machine_para.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_machine_para.cpp @@ -72,7 +72,7 @@ void lv_draw_machine_para() { lv_screen_menu_item(scr, MachinePara_menu.MotorSetting, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_PARA_MOTOR, 1); lv_screen_menu_item(scr, MachinePara_menu.leveling, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_PARA_LEVEL, 2); lv_screen_menu_item(scr, MachinePara_menu.AdvanceSetting, PARA_UI_POS_X, PARA_UI_POS_Y * 4, event_handler, ID_PARA_ADVANCE, 3); - lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACL_POS_X + 10, PARA_UI_BACL_POS_Y, event_handler, ID_PARA_RETURN, true); + lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACK_POS_X + 10, PARA_UI_BACK_POS_Y, event_handler, ID_PARA_RETURN, true); } void lv_clear_machine_para() { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_machine_settings.cpp b/Marlin/src/lcd/extui/mks_ui/draw_machine_settings.cpp index b14dc6b759..c81002e3e0 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_machine_settings.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_machine_settings.cpp @@ -41,36 +41,28 @@ enum { static void event_handler(lv_obj_t *obj, lv_event_t event) { if (event != LV_EVENT_RELEASED) return; + clear_cur_ui(); switch (obj->mks_obj_id) { - case ID_MACHINE_RETURN: - lv_clear_machine_settings(); - draw_return_ui(); - break; - case ID_MACHINE_ACCELERATION: - lv_clear_machine_settings(); - lv_draw_acceleration_settings(); - break; - case ID_MACHINE_FEEDRATE: - lv_clear_machine_settings(); - lv_draw_max_feedrate_settings(); - break; + case ID_MACHINE_RETURN: draw_return_ui(); break; + case ID_MACHINE_ACCELERATION: lv_draw_acceleration_settings(); break; + case ID_MACHINE_FEEDRATE: lv_draw_max_feedrate_settings(); break; #if HAS_CLASSIC_JERK - case ID_MACHINE_JERK: - lv_clear_machine_settings(); - lv_draw_jerk_settings(); - break; + case ID_MACHINE_JERK: lv_draw_jerk_settings(); break; #endif } } void lv_draw_machine_settings() { scr = lv_screen_create(MACHINE_SETTINGS_UI, machine_menu.MachineConfigTitle); - lv_screen_menu_item(scr, machine_menu.AccelerationConf, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_MACHINE_ACCELERATION, 0); - lv_screen_menu_item(scr, machine_menu.MaxFeedRateConf, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_MACHINE_FEEDRATE, 1); + lv_coord_t y = PARA_UI_POS_Y; + lv_screen_menu_item(scr, machine_menu.AccelerationConf, PARA_UI_POS_X, y, event_handler, ID_MACHINE_ACCELERATION, 0); + y += PARA_UI_POS_Y; + lv_screen_menu_item(scr, machine_menu.MaxFeedRateConf, PARA_UI_POS_X, y, event_handler, ID_MACHINE_FEEDRATE, 1); #if HAS_CLASSIC_JERK - lv_screen_menu_item(scr, machine_menu.JerkConf, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_MACHINE_JERK, 2); + y += PARA_UI_POS_Y; + lv_screen_menu_item(scr, machine_menu.JerkConf, PARA_UI_POS_X, y, event_handler, ID_MACHINE_JERK, 2); #endif - lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACL_POS_X + 10, PARA_UI_BACL_POS_Y, event_handler, ID_MACHINE_RETURN, true); + lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACK_POS_X + 10, PARA_UI_BACK_POS_Y, event_handler, ID_MACHINE_RETURN, true); } void lv_clear_machine_settings() { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_max_feedrate_settings.cpp b/Marlin/src/lcd/extui/mks_ui/draw_max_feedrate_settings.cpp index 1dd6a93d62..592acd346b 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_max_feedrate_settings.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_max_feedrate_settings.cpp @@ -105,7 +105,7 @@ void lv_draw_max_feedrate_settings() { lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.previous, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_FEED_UP, true); } - lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, event_handler, ID_FEED_RETURN, true); + lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACK_POS_X, PARA_UI_BACK_POS_Y, event_handler, ID_FEED_RETURN, true); } void lv_clear_max_feedrate_settings() { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_motor_settings.cpp b/Marlin/src/lcd/extui/mks_ui/draw_motor_settings.cpp index 7367cec1c2..df17ac7687 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_motor_settings.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_motor_settings.cpp @@ -86,7 +86,7 @@ void lv_draw_motor_settings() { index++; #endif #endif - lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACL_POS_X + 10, PARA_UI_BACL_POS_Y, event_handler, ID_MOTOR_RETURN, true); + lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACK_POS_X + 10, PARA_UI_BACK_POS_Y, event_handler, ID_MOTOR_RETURN, true); } void lv_clear_motor_settings() { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_pause_position.cpp b/Marlin/src/lcd/extui/mks_ui/draw_pause_position.cpp index 8e107d4cee..7231cbfabd 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_pause_position.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_pause_position.cpp @@ -72,7 +72,7 @@ void lv_draw_pause_position() { dtostrf(gCfgItems.pausePosZ, 1, 1, public_buf_l); lv_screen_menu_item_1_edit(scr, machine_menu.zPos, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_PAUSE_Z, 2, public_buf_l); - lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, event_handler, ID_PAUSE_RETURN, true); + lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACK_POS_X, PARA_UI_BACK_POS_Y, event_handler, ID_PAUSE_RETURN, true); } void lv_clear_pause_position() { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_preHeat.cpp b/Marlin/src/lcd/extui/mks_ui/draw_preHeat.cpp index ab95ce3a83..fe651133c3 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_preHeat.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_preHeat.cpp @@ -188,7 +188,7 @@ void disp_add_dec() { } void lv_draw_preHeat() { - scr = lv_screen_create(PRE_HEAT_UI); + scr = lv_screen_create(PREHEAT_UI); // Create image buttons disp_add_dec(); diff --git a/Marlin/src/lcd/extui/mks_ui/draw_step_settings.cpp b/Marlin/src/lcd/extui/mks_ui/draw_step_settings.cpp index fc920728b4..4807a63a2c 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_step_settings.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_step_settings.cpp @@ -104,7 +104,7 @@ void lv_draw_step_settings() { lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.previous, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_STEP_UP, true); } - lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, event_handler, ID_STEP_RETURN, true); + lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACK_POS_X, PARA_UI_BACK_POS_Y, event_handler, ID_STEP_RETURN, true); } void lv_clear_step_settings() { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_tmc_current_settings.cpp b/Marlin/src/lcd/extui/mks_ui/draw_tmc_current_settings.cpp index 60a3562b9d..9ec8f1501a 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_tmc_current_settings.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_tmc_current_settings.cpp @@ -54,29 +54,19 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { draw_return_ui(); return; #if AXIS_IS_TMC(X) - case ID_TMC_CURRENT_X: - value = Xcurrent; - break; + case ID_TMC_CURRENT_X: value = Xcurrent; break; #endif #if AXIS_IS_TMC(Y) - case ID_TMC_CURRENT_Y: - value = Ycurrent; - break; + case ID_TMC_CURRENT_Y: value = Ycurrent; break; #endif #if AXIS_IS_TMC(Z) - case ID_TMC_CURRENT_Z: - value = Zcurrent; - break; + case ID_TMC_CURRENT_Z: value = Zcurrent; break; #endif #if AXIS_IS_TMC(E0) - case ID_TMC_CURRENT_E0: - value = E0current; - break; + case ID_TMC_CURRENT_E0: value = E0current; break; #endif #if AXIS_IS_TMC(E1) - case ID_TMC_CURRENT_E1: - value = E1current; - break; + case ID_TMC_CURRENT_E1: value = E1current; break; #endif case ID_TMC_CURRENT_UP: @@ -143,7 +133,7 @@ void lv_draw_tmc_current_settings() { lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.previous, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_TMC_CURRENT_UP, true); } - lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, event_handler, ID_TMC_CURRENT_RETURN, true); + lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACK_POS_X, PARA_UI_BACK_POS_Y, event_handler, ID_TMC_CURRENT_RETURN, true); } void lv_clear_tmc_current_settings() { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_tmc_step_mode_settings.cpp b/Marlin/src/lcd/extui/mks_ui/draw_tmc_step_mode_settings.cpp index f25f850c2a..990cdda7e6 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_tmc_step_mode_settings.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_tmc_step_mode_settings.cpp @@ -122,7 +122,7 @@ void lv_draw_tmc_step_mode_settings() { lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.previous, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_TMC_MODE_UP, true); } - lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, event_handler, ID_TMC_MODE_RETURN, true); + lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACK_POS_X, PARA_UI_BACK_POS_Y, event_handler, ID_TMC_MODE_RETURN, true); } void lv_clear_tmc_step_mode_settings() { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_tramming_pos_settings.cpp b/Marlin/src/lcd/extui/mks_ui/draw_tramming_pos_settings.cpp index d6e52606c0..d5501a3a45 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_tramming_pos_settings.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_tramming_pos_settings.cpp @@ -105,7 +105,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { void lv_draw_tramming_pos_settings() { char buf2[50]; - scr = lv_screen_create(MANUAL_LEVELING_POSIGION_UI, machine_menu.LevelingParaConfTitle); + scr = lv_screen_create(MANUAL_LEVELING_POSITION_UI, machine_menu.LevelingParaConfTitle); if (!uiCfg.para_ui_page) { itoa(gCfgItems.trammingPos[0].x, public_buf_l, 10); @@ -134,7 +134,7 @@ void lv_draw_tramming_pos_settings() { lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.previous, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_MANUAL_POS_UP, true); } - lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACL_POS_X + 10, PARA_UI_BACL_POS_Y, event_handler, ID_MANUAL_POS_RETURN, true); + lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACK_POS_X + 10, PARA_UI_BACK_POS_Y, event_handler, ID_MANUAL_POS_RETURN, true); } void lv_clear_tramming_pos_settings() { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp b/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp index c44bdfea93..37b06356e0 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp @@ -475,7 +475,7 @@ char *getDispText(int index) { case EXTRUSION_UI: strcpy(public_buf_l, extrude_menu.title); break; case CHANGE_SPEED_UI: strcpy(public_buf_l, speed_menu.title); break; case FAN_UI: strcpy(public_buf_l, fan_menu.title); break; - case PRE_HEAT_UI: + case PREHEAT_UI: switch (disp_state_stack._disp_state[disp_state_stack._disp_index]) { case OPERATE_UI: strcpy(public_buf_l, preheat_menu.adjust_title); default: strcpy(public_buf_l, preheat_menu.title); break; @@ -500,7 +500,7 @@ char *getDispText(int index) { case TOOL_UI: strcpy(public_buf_l, tool_menu.title); break; case WIFI_LIST_UI: TERN_(MKS_WIFI_MODULE, strcpy(public_buf_l, list_menu.title)); break; case MACHINE_PARA_UI: strcpy(public_buf_l, MachinePara_menu.title); break; - case BABY_STEP_UI: strcpy(public_buf_l, operation_menu.babystep); break; + case BABYSTEP_UI: strcpy(public_buf_l, operation_menu.babystep); break; case EEPROM_SETTINGS_UI: strcpy(public_buf_l, eeprom_menu.title); break; case MEDIA_SELECT_UI: strcpy(public_buf_l, media_select_menu.title); break; default: break; @@ -742,7 +742,7 @@ void GUI_RefreshPage() { disp_hotend_temp(); } break; - case PRE_HEAT_UI: + case PREHEAT_UI: if (temps_update_flag) { temps_update_flag = false; disp_desire_temp(); @@ -822,7 +822,7 @@ void GUI_RefreshPage() { case WIFI_TIPS_UI: switch (wifi_tips_type) { case TIPS_TYPE_JOINING: - if (wifi_link_state == WIFI_CONNECTED && strcmp((const char *)wifi_list.wifiConnectedName,(const char *)wifi_list.wifiName[wifi_list.nameIndex]) == 0) { + if (wifi_link_state == WIFI_CONNECTED && strcmp((const char *)wifi_list.wifiConnectedName, (const char *)wifi_list.wifiName[wifi_list.nameIndex]) == 0) { tips_disp.timer = TIPS_TIMER_STOP; tips_disp.timer_count = 0; @@ -864,7 +864,7 @@ void GUI_RefreshPage() { break; #endif - case BABY_STEP_UI: + case BABYSTEP_UI: if (temps_update_flag) { temps_update_flag = false; disp_z_offset_value(); @@ -888,7 +888,7 @@ void clear_cur_ui() { case OPERATE_UI: lv_clear_operation(); break; case PAUSE_UI: break; case EXTRUSION_UI: lv_clear_extrusion(); break; - case PRE_HEAT_UI: lv_clear_preHeat(); break; + case PREHEAT_UI: lv_clear_preHeat(); break; case CHANGE_SPEED_UI: lv_clear_change_speed(); break; case FAN_UI: lv_clear_fan(); break; case SET_UI: lv_clear_set(); break; @@ -929,15 +929,14 @@ void clear_cur_ui() { case MACHINE_SETTINGS_UI: lv_clear_machine_settings(); break; case TEMPERATURE_SETTINGS_UI: break; case MOTOR_SETTINGS_UI: lv_clear_motor_settings(); break; - case MACHINETYPE_UI: break; + case MACHINE_TYPE_UI: break; case STROKE_UI: break; case HOME_DIR_UI: break; case ENDSTOP_TYPE_UI: break; case FILAMENT_SETTINGS_UI: break; - case LEVELING_SETTIGNS_UI: break; case LEVELING_PARA_UI: lv_clear_level_settings(); break; case DELTA_LEVELING_PARA_UI: break; - case MANUAL_LEVELING_POSIGION_UI: lv_clear_tramming_pos_settings(); break; + case MANUAL_LEVELING_POSITION_UI: lv_clear_tramming_pos_settings(); break; case MAXFEEDRATE_UI: lv_clear_max_feedrate_settings(); break; case STEPS_UI: lv_clear_step_settings(); break; case ACCELERATION_UI: lv_clear_acceleration_settings(); break; @@ -950,7 +949,7 @@ void clear_cur_ui() { case DOUBLE_Z_UI: break; case ENABLE_INVERT_UI: break; case NUMBER_KEY_UI: lv_clear_number_key(); break; - case BABY_STEP_UI: lv_clear_baby_stepping(); break; + case BABYSTEP_UI: lv_clear_baby_stepping(); break; case PAUSE_POS_UI: lv_clear_pause_position(); break; #if HAS_TRINAMIC_CONFIG case TMC_CURRENT_UI: lv_clear_tmc_current_settings(); break; @@ -997,7 +996,7 @@ void draw_return_ui() { case OPERATE_UI: lv_draw_operation(); break; case PAUSE_UI: break; case EXTRUSION_UI: lv_draw_extrusion(); break; - case PRE_HEAT_UI: lv_draw_preHeat(); break; + case PREHEAT_UI: lv_draw_preHeat(); break; case CHANGE_SPEED_UI: lv_draw_change_speed(); break; case FAN_UI: lv_draw_fan(); break; case SET_UI: lv_draw_set(); break; @@ -1037,15 +1036,14 @@ void draw_return_ui() { case MACHINE_SETTINGS_UI: lv_draw_machine_settings(); break; case TEMPERATURE_SETTINGS_UI: break; case MOTOR_SETTINGS_UI: lv_draw_motor_settings(); break; - case MACHINETYPE_UI: break; + case MACHINE_TYPE_UI: break; case STROKE_UI: break; case HOME_DIR_UI: break; case ENDSTOP_TYPE_UI: break; case FILAMENT_SETTINGS_UI: lv_draw_filament_settings(); break; - case LEVELING_SETTIGNS_UI: break; case LEVELING_PARA_UI: lv_draw_level_settings(); break; case DELTA_LEVELING_PARA_UI: break; - case MANUAL_LEVELING_POSIGION_UI: lv_draw_tramming_pos_settings(); break; + case MANUAL_LEVELING_POSITION_UI: lv_draw_tramming_pos_settings(); break; case MAXFEEDRATE_UI: lv_draw_max_feedrate_settings(); break; case STEPS_UI: lv_draw_step_settings(); break; case ACCELERATION_UI: lv_draw_acceleration_settings(); break; @@ -1061,7 +1059,7 @@ void draw_return_ui() { case ENABLE_INVERT_UI: break; case NUMBER_KEY_UI: lv_draw_number_key(); break; case DIALOG_UI: break; - case BABY_STEP_UI: lv_draw_baby_stepping(); break; + case BABYSTEP_UI: lv_draw_baby_stepping(); break; case PAUSE_POS_UI: lv_draw_pause_position(); break; #if HAS_TRINAMIC_CONFIG case TMC_CURRENT_UI: lv_draw_tmc_current_settings(); break; diff --git a/Marlin/src/lcd/extui/mks_ui/draw_ui.h b/Marlin/src/lcd/extui/mks_ui/draw_ui.h index edb513a8b5..a74d7e1ae2 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_ui.h +++ b/Marlin/src/lcd/extui/mks_ui/draw_ui.h @@ -143,8 +143,8 @@ #define PARA_UI_ARROW_V 12 - #define PARA_UI_BACL_POS_X 400 - #define PARA_UI_BACL_POS_Y 270 + #define PARA_UI_BACK_POS_X 400 + #define PARA_UI_BACK_POS_Y 270 #define PARA_UI_TURN_PAGE_POS_X 320 #define PARA_UI_TURN_PAGE_POS_Y 270 @@ -270,7 +270,7 @@ typedef enum { PAUSE_UI, EXTRUSION_UI, FAN_UI, - PRE_HEAT_UI, + PREHEAT_UI, CHANGE_SPEED_UI, TEMP_UI, SET_UI, @@ -304,15 +304,14 @@ typedef enum { MACHINE_SETTINGS_UI, TEMPERATURE_SETTINGS_UI, MOTOR_SETTINGS_UI, - MACHINETYPE_UI, + MACHINE_TYPE_UI, STROKE_UI, HOME_DIR_UI, ENDSTOP_TYPE_UI, FILAMENT_SETTINGS_UI, - LEVELING_SETTIGNS_UI, LEVELING_PARA_UI, DELTA_LEVELING_PARA_UI, - MANUAL_LEVELING_POSIGION_UI, + MANUAL_LEVELING_POSITION_UI, MAXFEEDRATE_UI, STEPS_UI, ACCELERATION_UI, @@ -325,7 +324,7 @@ typedef enum { DOUBLE_Z_UI, ENABLE_INVERT_UI, NUMBER_KEY_UI, - BABY_STEP_UI, + BABYSTEP_UI, ERROR_MESSAGE_UI, PAUSE_POS_UI, TMC_CURRENT_UI, @@ -336,7 +335,7 @@ typedef enum { ENCODER_SETTINGS_UI, TOUCH_CALIBRATION_UI, GCODE_UI, - MEDIA_SELECT_UI, + MEDIA_SELECT_UI } DISP_STATE; typedef struct { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_wifi_settings.cpp b/Marlin/src/lcd/extui/mks_ui/draw_wifi_settings.cpp index e087f74286..fb9fb4f9eb 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_wifi_settings.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_wifi_settings.cpp @@ -130,7 +130,7 @@ void lv_draw_wifi_settings() { lv_obj_t *buttonConfig = lv_imgbtn_create(scr, "F:/bmp_back70x40.bin", PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_WIFI_CONFIG); lv_obj_t *labelConfig = lv_label_create_empty(buttonConfig); - lv_obj_t *buttonBack = lv_imgbtn_create(scr, "F:/bmp_back70x40.bin", PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, event_handler, ID_WIFI_RETURN); + lv_obj_t *buttonBack = lv_imgbtn_create(scr, "F:/bmp_back70x40.bin", PARA_UI_BACK_POS_X, PARA_UI_BACK_POS_Y, event_handler, ID_WIFI_RETURN); lv_obj_t *label_Back = lv_label_create_empty(buttonBack); if (gCfgItems.multiple_language) { diff --git a/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp b/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp index 20d4720d00..f56d68366c 100644 --- a/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp +++ b/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp @@ -2026,12 +2026,12 @@ void get_wifi_commands() { #if DISABLED(EMERGENCY_PARSER) // Process critical commands early - if (strcmp(command, "M108") == 0) { + if (strcmp_P(command, PSTR("M108")) == 0) { wait_for_heatup = false; TERN_(HAS_LCD_MENU, wait_for_user = false); } - if (strcmp(command, "M112") == 0) kill(FPSTR(M112_KILL_STR), nullptr, true); - if (strcmp(command, "M410") == 0) quickstop_stepper(); + if (strcmp_P(command, PSTR("M112")) == 0) kill(FPSTR(M112_KILL_STR), nullptr, true); + if (strcmp_P(command, PSTR("M410")) == 0) quickstop_stepper(); #endif // Add the command to the queue From 741e70541d5ba0e8a7cfd2c402b306dfab4b77ee Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 17 Oct 2021 20:24:41 -0500 Subject: [PATCH 013/125] =?UTF-8?q?=F0=9F=9A=B8=20Tweak=20MKS=20UI=20G-cod?= =?UTF-8?q?e=20console?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/queue.h | 2 +- Marlin/src/lcd/extui/mks_ui/draw_gcode.cpp | 2 -- Marlin/src/lcd/extui/mks_ui/draw_keyboard.cpp | 10 +++++----- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Marlin/src/gcode/queue.h b/Marlin/src/gcode/queue.h index 2e3e26d179..82e2a7a0e4 100644 --- a/Marlin/src/gcode/queue.h +++ b/Marlin/src/gcode/queue.h @@ -133,7 +133,7 @@ public: * Enqueue command(s) to run from SRAM. Drained by process_injected_command(). * Aborts the current SRAM queue so only use for one or two commands. */ - static inline void inject(char * const gcode) { + static inline void inject(const char * const gcode) { strncpy(injected_commands, gcode, sizeof(injected_commands) - 1); } diff --git a/Marlin/src/lcd/extui/mks_ui/draw_gcode.cpp b/Marlin/src/lcd/extui/mks_ui/draw_gcode.cpp index effd49bff8..8a3366e01d 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_gcode.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_gcode.cpp @@ -82,8 +82,6 @@ void lv_serial_capt_hook(void * userPointer, uint8_t c) { void lv_eom_hook(void *) { // Message is done, let's remove the hook now MYSERIAL1.setHook(); - // We are back from the keyboard, so let's redraw ourselves - draw_return_ui(); } void lv_draw_gcode(bool clear) { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_keyboard.cpp b/Marlin/src/lcd/extui/mks_ui/draw_keyboard.cpp index df5ebc8f22..6d7bdc2aa7 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_keyboard.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_keyboard.cpp @@ -164,13 +164,13 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) { draw_return_ui(); break; case GCodeCommand: - if (!queue.ring_buffer.full(3)) { - // Hook anything that goes to the serial port + if (ret_ta_txt[0] && !queue.ring_buffer.full(3)) { + // Hook for the next bytes to arrive from the serial port MYSERIAL1.setHook(lv_serial_capt_hook, lv_eom_hook, 0); - queue.enqueue_one_now(ret_ta_txt); + // Run the command as soon as possible + queue.inject(ret_ta_txt); } - lv_clear_keyboard(); - // draw_return_ui is called in the end of message hook + goto_previous_ui(); break; default: break; } From d2b0939118827c49610058c41f521b789c827477 Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Mon, 18 Oct 2021 02:01:28 -0400 Subject: [PATCH 014/125] Fix Tool Change Park (#22968) --- Marlin/src/module/tool_change.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index 81d85573af..285b4cba84 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -954,7 +954,7 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0. #if ENABLED(TOOLCHANGE_NO_RETURN) const float temp = destination.z; destination = current_position; - destination.z = temp.z; + destination.z = temp; #endif prepare_internal_move_to_destination(TERN(TOOLCHANGE_NO_RETURN, planner.settings.max_feedrate_mm_s[Z_AXIS], MMM_TO_MMS(TOOLCHANGE_PARK_XY_FEEDRATE))); } From b93c3301f2146bed7287ad097b95b53507c35420 Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Mon, 18 Oct 2021 02:03:01 -0400 Subject: [PATCH 015/125] Fix JyersUI ZOffset Multiplication (#22975) --- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 6fe3db438d..a4e05cace9 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -419,7 +419,7 @@ void CrealityDWINClass::Draw_Float(float value, uint8_t row, bool selected/*=fal if (isnan(value)) DWIN_Draw_String(true, DWIN_FONT_MENU, Color_White, bColor, xpos - 8, MBASE(row), F(" NaN")); else { - DWIN_Draw_FloatValue(true, true, 0, DWIN_FONT_MENU, Color_White, bColor, digits - log10(minunit) + 1, log10(minunit), xpos, MBASE(row), (value < 0 ? -value : value) * minunit); + DWIN_Draw_FloatValue(true, true, 0, DWIN_FONT_MENU, Color_White, bColor, digits - log10(minunit) + 1, log10(minunit), xpos, MBASE(row), (value < 0 ? -value : value)); DWIN_Draw_String(true, DWIN_FONT_MENU, Color_White, bColor, xpos - 8, MBASE(row), value < 0 ? F("-") : F(" ")); } } @@ -871,7 +871,7 @@ void CrealityDWINClass::Draw_Status_Area(bool icons/*=false*/) { } if (zoffsetvalue != offset) { offset = zoffsetvalue; - DWIN_Draw_FloatValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 2, 2, 207, 417, (zoffsetvalue < 0 ? -zoffsetvalue : zoffsetvalue) * 100); + DWIN_Draw_FloatValue(true, true, 0, DWIN_FONT_STAT, GetColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 2, 2, 207, 417, (zoffsetvalue < 0 ? -zoffsetvalue : zoffsetvalue)); DWIN_Draw_String(true, DWIN_FONT_MENU, GetColor(eeprom_settings.status_area_text, Color_White), Color_Bg_Black, 205, 419, zoffsetvalue < 0 ? F("-") : F(" ")); } #endif From ad4a8a68c2125f74124225813fe978c31677b3e5 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 18 Oct 2021 01:49:35 -0500 Subject: [PATCH 016/125] =?UTF-8?q?=E2=9C=85=20Warn=20about=20dummy=20ther?= =?UTF-8?q?mistors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/Conditionals_adv.h | 16 +++-- Marlin/src/inc/SanityCheck.h | 70 +++------------------- Marlin/src/inc/Warnings.cpp | 3 + Marlin/src/module/temperature.cpp | 16 ++--- Marlin/src/module/thermistor/thermistors.h | 12 ---- 5 files changed, 25 insertions(+), 92 deletions(-) diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index e2ee8d914a..dd2d6ed748 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -132,17 +132,15 @@ #define HID_E6 6 #define HID_E7 7 -#define ANY_TEMP_SENSOR_IS(n) (n == TEMP_SENSOR_0 || n == TEMP_SENSOR_1 || n == TEMP_SENSOR_2 || n == TEMP_SENSOR_3 \ - || n == TEMP_SENSOR_4 || n == TEMP_SENSOR_5 || n == TEMP_SENSOR_6 || n == TEMP_SENSOR_7 \ - || n == TEMP_SENSOR_BED \ - || n == TEMP_SENSOR_PROBE \ - || n == TEMP_SENSOR_CHAMBER \ - || n == TEMP_SENSOR_COOLER \ - || n == TEMP_SENSOR_REDUNDANT ) -#if ANY_TEMP_SENSOR_IS(1000) +#define _SENSOR_IS(I,N) || (TEMP_SENSOR_##N == I) +#define _E_SENSOR_IS(I,N) _SENSOR_IS(N,I) +#define ANY_THERMISTOR_IS(N) (0 REPEAT2(HOTENDS, _E_SENSOR_IS, N) \ + _SENSOR_IS(N,BED) _SENSOR_IS(N,PROBE) _SENSOR_IS(N,CHAMBER) \ + _SENSOR_IS(N,COOLER) _SENSOR_IS(N,BOARD) _SENSOR_IS(N,REDUNDANT) ) + +#if ANY_THERMISTOR_IS(1000) #define HAS_USER_THERMISTORS 1 #endif -#undef ANY_TEMP_SENSOR_IS #if TEMP_SENSOR_REDUNDANT #define _HEATER_ID(M) HID_##M diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 0aa5bd9f2d..7d1629a67e 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -2193,68 +2193,12 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #elif !PIN_EXISTS(TEMP_7) && !TEMP_SENSOR_7_IS_DUMMY #error "TEMP_7_PIN not defined for this board." #endif - #elif TEMP_SENSOR_7 != 0 - #error "TEMP_SENSOR_7 shouldn't be set with only 7 HOTENDS." - #endif - #elif TEMP_SENSOR_6 != 0 - #error "TEMP_SENSOR_6 shouldn't be set with only 6 HOTENDS." - #elif TEMP_SENSOR_7 != 0 - #error "TEMP_SENSOR_7 shouldn't be set with only 6 HOTENDS." - #endif - #elif TEMP_SENSOR_5 != 0 - #error "TEMP_SENSOR_5 shouldn't be set with only 5 HOTENDS." - #elif TEMP_SENSOR_6 != 0 - #error "TEMP_SENSOR_6 shouldn't be set with only 5 HOTENDS." - #elif TEMP_SENSOR_7 != 0 - #error "TEMP_SENSOR_7 shouldn't be set with only 5 HOTENDS." - #endif - #elif TEMP_SENSOR_4 != 0 - #error "TEMP_SENSOR_4 shouldn't be set with only 4 HOTENDS." - #elif TEMP_SENSOR_5 != 0 - #error "TEMP_SENSOR_5 shouldn't be set with only 4 HOTENDS." - #elif TEMP_SENSOR_6 != 0 - #error "TEMP_SENSOR_6 shouldn't be set with only 4 HOTENDS." - #elif TEMP_SENSOR_7 != 0 - #error "TEMP_SENSOR_7 shouldn't be set with only 4 HOTENDS." - #endif - #elif TEMP_SENSOR_3 != 0 - #error "TEMP_SENSOR_3 shouldn't be set with only 3 HOTENDS." - #elif TEMP_SENSOR_4 != 0 - #error "TEMP_SENSOR_4 shouldn't be set with only 3 HOTENDS." - #elif TEMP_SENSOR_5 != 0 - #error "TEMP_SENSOR_5 shouldn't be set with only 3 HOTENDS." - #elif TEMP_SENSOR_6 != 0 - #error "TEMP_SENSOR_6 shouldn't be set with only 3 HOTENDS." - #elif TEMP_SENSOR_7 != 0 - #error "TEMP_SENSOR_7 shouldn't be set with only 3 HOTENDS." - #endif - #elif TEMP_SENSOR_2 != 0 - #error "TEMP_SENSOR_2 shouldn't be set with only 2 HOTENDS." - #elif TEMP_SENSOR_3 != 0 - #error "TEMP_SENSOR_3 shouldn't be set with only 2 HOTENDS." - #elif TEMP_SENSOR_4 != 0 - #error "TEMP_SENSOR_4 shouldn't be set with only 2 HOTENDS." - #elif TEMP_SENSOR_5 != 0 - #error "TEMP_SENSOR_5 shouldn't be set with only 2 HOTENDS." - #elif TEMP_SENSOR_6 != 0 - #error "TEMP_SENSOR_6 shouldn't be set with only 2 HOTENDS." - #elif TEMP_SENSOR_7 != 0 - #error "TEMP_SENSOR_7 shouldn't be set with only 2 HOTENDS." - #endif -#elif TEMP_SENSOR_1 != 0 - #error "TEMP_SENSOR_1 shouldn't be set with only 1 HOTEND." -#elif TEMP_SENSOR_2 != 0 - #error "TEMP_SENSOR_2 shouldn't be set with only 1 HOTEND." -#elif TEMP_SENSOR_3 != 0 - #error "TEMP_SENSOR_3 shouldn't be set with only 1 HOTEND." -#elif TEMP_SENSOR_4 != 0 - #error "TEMP_SENSOR_4 shouldn't be set with only 1 HOTEND." -#elif TEMP_SENSOR_5 != 0 - #error "TEMP_SENSOR_5 shouldn't be set with only 1 HOTEND." -#elif TEMP_SENSOR_6 != 0 - #error "TEMP_SENSOR_6 shouldn't be set with only 1 HOTEND." -#elif TEMP_SENSOR_7 != 0 - #error "TEMP_SENSOR_7 shouldn't be set with only 1 HOTEND." + #endif // HOTENDS > 7 + #endif // HOTENDS > 6 + #endif // HOTENDS > 5 + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 #endif // HAS_MULTI_HOTEND /** @@ -3292,7 +3236,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #if HAS_MOTOR_CURRENT_I2C #if BOTH(DIGIPOT_MCP4018, DIGIPOT_MCP4451) #error "Enable only one of DIGIPOT_MCP4018 or DIGIPOT_MCP4451." -#elif !MB(MKS_SBASE, AZTEEG_X5_GT, AZTEEG_X5_MINI, AZTEEG_X5_MINI_WIFI) \ + #elif !MB(MKS_SBASE, AZTEEG_X5_GT, AZTEEG_X5_MINI, AZTEEG_X5_MINI_WIFI) \ && (!defined(DIGIPOTS_I2C_SDA_X) || !defined(DIGIPOTS_I2C_SDA_Y) || !defined(DIGIPOTS_I2C_SDA_Z) || !defined(DIGIPOTS_I2C_SDA_E0) || !defined(DIGIPOTS_I2C_SDA_E1)) #error "DIGIPOT_MCP4018/4451 requires DIGIPOTS_I2C_SDA_* pins to be defined." #endif diff --git a/Marlin/src/inc/Warnings.cpp b/Marlin/src/inc/Warnings.cpp index e5e9d57fc6..a0affac56a 100644 --- a/Marlin/src/inc/Warnings.cpp +++ b/Marlin/src/inc/Warnings.cpp @@ -51,6 +51,9 @@ #if HAS_COOLER && DISABLED(THERMAL_PROTECTION_COOLER) #warning "Safety Alert! Enable THERMAL_PROTECTION_COOLER for the final build!" #endif +#if ANY_THERMISTOR_IS(998) || ANY_THERMISTOR_IS(999) + #warning "Warning! Don't use dummy thermistors (998/999) for final build!" +#endif #if NONE(HAS_RESUME_CONTINUE, HOST_PROMPT_SUPPORT) #warning "Your Configuration provides no method to acquire user feedback!" diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 3130914451..4320a530c5 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -2207,22 +2207,22 @@ void Temperature::init() { // Thermistor activation by MCU pin #if PIN_EXISTS(TEMP_0_TR_ENABLE) - OUT_WRITE(TEMP_0_TR_ENABLE_PIN, + OUT_WRITE(TEMP_0_TR_ENABLE_PIN, ( #if TEMP_SENSOR_IS_ANY_MAX_TC(0) - 1 + HIGH #else - 0 + LOW #endif - ); + )); #endif #if PIN_EXISTS(TEMP_1_TR_ENABLE) - OUT_WRITE(TEMP_1_TR_ENABLE_PIN, + OUT_WRITE(TEMP_1_TR_ENABLE_PIN, ( #if TEMP_SENSOR_IS_ANY_MAX_TC(1) - 1 + HIGH #else - 0 + LOW #endif - ); + )); #endif #if HAS_HEATER_0 diff --git a/Marlin/src/module/thermistor/thermistors.h b/Marlin/src/module/thermistor/thermistors.h index 28a1e2f90f..85f4449636 100644 --- a/Marlin/src/module/thermistor/thermistors.h +++ b/Marlin/src/module/thermistor/thermistors.h @@ -42,18 +42,6 @@ #define OV_SCALE(N) (N) #define OV(N) int16_t(OV_SCALE(N) * (OVERSAMPLENR) * (THERMISTOR_TABLE_SCALE)) -#define TEMP_SENSOR_IS(n,H) (n == TEMP_SENSOR_##H) -#define ANY_THERMISTOR_IS(n) ( TEMP_SENSOR_IS(n, 0) || TEMP_SENSOR_IS(n, 1) \ - || TEMP_SENSOR_IS(n, 2) || TEMP_SENSOR_IS(n, 3) \ - || TEMP_SENSOR_IS(n, 4) || TEMP_SENSOR_IS(n, 5) \ - || TEMP_SENSOR_IS(n, 6) || TEMP_SENSOR_IS(n, 7) \ - || TEMP_SENSOR_IS(n, BED) \ - || TEMP_SENSOR_IS(n, CHAMBER) \ - || TEMP_SENSOR_IS(n, COOLER) \ - || TEMP_SENSOR_IS(n, PROBE) \ - || TEMP_SENSOR_IS(n, BOARD) \ - || TEMP_SENSOR_IS(n, REDUNDANT) ) - typedef struct { int16_t value; celsius_t celsius; } temp_entry_t; // Pt1000 and Pt100 handling From 2e0bde37d77c8c0d8274d74f18cb27be2c232278 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 17 Oct 2021 22:10:08 -0500 Subject: [PATCH 017/125] =?UTF-8?q?=F0=9F=8E=A8=20Add=20MKS=20UI=20goto=5F?= =?UTF-8?q?previous=5Fui?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/extui/mks_ui/draw_about.cpp | 3 +- .../lcd/extui/mks_ui/draw_baby_stepping.cpp | 3 +- .../lcd/extui/mks_ui/draw_change_speed.cpp | 3 +- .../src/lcd/extui/mks_ui/draw_cloud_bind.cpp | 3 +- Marlin/src/lcd/extui/mks_ui/draw_dialog.cpp | 30 +++++++------------ .../src/lcd/extui/mks_ui/draw_extrusion.cpp | 3 +- Marlin/src/lcd/extui/mks_ui/draw_fan.cpp | 2 +- .../lcd/extui/mks_ui/draw_filament_change.cpp | 3 +- Marlin/src/lcd/extui/mks_ui/draw_home.cpp | 3 +- Marlin/src/lcd/extui/mks_ui/draw_keyboard.cpp | 12 +++----- .../src/lcd/extui/mks_ui/draw_move_motor.cpp | 3 +- .../src/lcd/extui/mks_ui/draw_number_key.cpp | 3 +- .../src/lcd/extui/mks_ui/draw_operation.cpp | 3 +- Marlin/src/lcd/extui/mks_ui/draw_preHeat.cpp | 3 +- .../extui/mks_ui/draw_touch_calibration.cpp | 3 +- .../mks_ui/draw_tramming_pos_settings.cpp | 3 +- Marlin/src/lcd/extui/mks_ui/draw_ui.cpp | 5 ++++ Marlin/src/lcd/extui/mks_ui/draw_ui.h | 1 + .../lcd/extui/mks_ui/draw_wifi_settings.cpp | 3 +- 19 files changed, 35 insertions(+), 57 deletions(-) diff --git a/Marlin/src/lcd/extui/mks_ui/draw_about.cpp b/Marlin/src/lcd/extui/mks_ui/draw_about.cpp index 3424bf7a0e..49ee6eee73 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_about.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_about.cpp @@ -39,8 +39,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { if (event != LV_EVENT_RELEASED) return; switch (obj->mks_obj_id) { case ID_A_RETURN: - clear_cur_ui(); - draw_return_ui(); + goto_previous_ui(); break; } } diff --git a/Marlin/src/lcd/extui/mks_ui/draw_baby_stepping.cpp b/Marlin/src/lcd/extui/mks_ui/draw_baby_stepping.cpp index bcc075ae64..1a6767dcc1 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_baby_stepping.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_baby_stepping.cpp @@ -107,8 +107,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { TERN_(EEPROM_SETTINGS, (void)settings.save()); has_adjust_z = 0; } - clear_cur_ui(); - draw_return_ui(); + goto_previous_ui(); break; } } diff --git a/Marlin/src/lcd/extui/mks_ui/draw_change_speed.cpp b/Marlin/src/lcd/extui/mks_ui/draw_change_speed.cpp index 5248816f54..6b07d4b719 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_change_speed.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_change_speed.cpp @@ -110,8 +110,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { disp_speed_step(); break; case ID_C_RETURN: - clear_cur_ui(); - draw_return_ui(); + goto_previous_ui(); break; } } diff --git a/Marlin/src/lcd/extui/mks_ui/draw_cloud_bind.cpp b/Marlin/src/lcd/extui/mks_ui/draw_cloud_bind.cpp index 1d0ae7775b..1dae0ebe22 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_cloud_bind.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_cloud_bind.cpp @@ -49,8 +49,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) { if (event != LV_EVENT_RELEASED) return; switch (obj->mks_obj_id) { case ID_CLOUD_BIND_RETURN: - clear_cur_ui(); - draw_return_ui(); + goto_previous_ui(); break; case ID_CLOUD_RELEASE_BIND: if (cloud_para.state == 0x12) { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_dialog.cpp b/Marlin/src/lcd/extui/mks_ui/draw_dialog.cpp index 3cdb07b608..a69c54bcff 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_dialog.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_dialog.cpp @@ -136,19 +136,16 @@ static void btn_ok_event_cb(lv_obj_t *btn, lv_event_t event) { else if (DIALOG_IS(PAUSE_MESSAGE_OPTION)) pause_menu_response = PAUSE_RESPONSE_EXTRUDE_MORE; else if (DIALOG_IS(PAUSE_MESSAGE_RESUME)) { - clear_cur_ui(); - draw_return_ui(); + goto_previous_ui(); } #endif else if (DIALOG_IS(STORE_EEPROM_TIPS)) { TERN_(EEPROM_SETTINGS, (void)settings.save()); - clear_cur_ui(); - draw_return_ui(); + goto_previous_ui(); } else if (DIALOG_IS(READ_EEPROM_TIPS)) { TERN_(EEPROM_SETTINGS, (void)settings.load()); - clear_cur_ui(); - draw_return_ui(); + goto_previous_ui(); } else if (DIALOG_IS(REVERT_EEPROM_TIPS)) { TERN_(EEPROM_SETTINGS, (void)settings.reset()); @@ -166,27 +163,23 @@ static void btn_ok_event_cb(lv_obj_t *btn, lv_event_t event) { } else if (DIALOG_IS(WIFI_CONFIG_TIPS)) { uiCfg.configWifi = true; - clear_cur_ui(); - draw_return_ui(); + goto_previous_ui(); } else if (DIALOG_IS(TYPE_FILAMENT_HEAT_LOAD_COMPLETED)) uiCfg.filament_heat_completed_load = true; else if (DIALOG_IS(TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED)) uiCfg.filament_heat_completed_unload = true; else if (DIALOG_IS(TYPE_FILAMENT_LOAD_COMPLETED, TYPE_FILAMENT_UNLOAD_COMPLETED)) { - clear_cur_ui(); - draw_return_ui(); + goto_previous_ui(); } #if ENABLED(MKS_WIFI_MODULE) else if (DIALOG_IS(TYPE_UNBIND)) { cloud_unbind(); - clear_cur_ui(); - draw_return_ui(); + goto_previous_ui(); } #endif else { - clear_cur_ui(); - draw_return_ui(); + goto_previous_ui(); } } @@ -197,8 +190,7 @@ static void btn_cancel_event_cb(lv_obj_t *btn, lv_event_t event) { } else if (DIALOG_IS(TYPE_FILAMENT_LOAD_HEAT, TYPE_FILAMENT_UNLOAD_HEAT, TYPE_FILAMENT_HEAT_LOAD_COMPLETED, TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED)) { thermalManager.setTargetHotend(uiCfg.hotendTargetTempBak, uiCfg.extruderIndex); - clear_cur_ui(); - draw_return_ui(); + goto_previous_ui(); } else if (DIALOG_IS(TYPE_FILAMENT_LOADING, TYPE_FILAMENT_UNLOADING)) { queue.enqueue_one(F("M410")); @@ -210,12 +202,10 @@ static void btn_cancel_event_cb(lv_obj_t *btn, lv_event_t event) { uiCfg.filament_unloading_time_flg = false; uiCfg.filament_unloading_time_cnt = 0; thermalManager.setTargetHotend(uiCfg.hotendTargetTempBak, uiCfg.extruderIndex); - clear_cur_ui(); - draw_return_ui(); + goto_previous_ui(); } else { - clear_cur_ui(); - draw_return_ui(); + goto_previous_ui(); } } diff --git a/Marlin/src/lcd/extui/mks_ui/draw_extrusion.cpp b/Marlin/src/lcd/extui/mks_ui/draw_extrusion.cpp index f3204eb962..85894a5e92 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_extrusion.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_extrusion.cpp @@ -106,8 +106,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { disp_ext_speed(); break; case ID_E_RETURN: - clear_cur_ui(); - draw_return_ui(); + goto_previous_ui(); break; } } diff --git a/Marlin/src/lcd/extui/mks_ui/draw_fan.cpp b/Marlin/src/lcd/extui/mks_ui/draw_fan.cpp index b2107709a4..12b47d9e94 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_fan.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_fan.cpp @@ -55,7 +55,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { case ID_F_HIGH: fanPercent = 100; break; case ID_F_MID: fanPercent = 50; break; case ID_F_OFF: fanPercent = 0; break; - case ID_F_RETURN: clear_cur_ui(); draw_return_ui(); return; + case ID_F_RETURN: goto_previous_ui(); return; } thermalManager.set_fan_speed(0, map(fanPercent, 0, 100, 0, 255)); if (obj->mks_obj_id != ID_F_RETURN) disp_fan_value(); diff --git a/Marlin/src/lcd/extui/mks_ui/draw_filament_change.cpp b/Marlin/src/lcd/extui/mks_ui/draw_filament_change.cpp index 61d212303b..be70fa9b4e 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_filament_change.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_filament_change.cpp @@ -101,8 +101,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { planner.set_e_position_mm((destination.e = current_position.e = uiCfg.current_e_position_bak)); thermalManager.setTargetHotend(uiCfg.hotendTargetTempBak, uiCfg.extruderIndex); - clear_cur_ui(); - draw_return_ui(); + goto_previous_ui(); break; } } diff --git a/Marlin/src/lcd/extui/mks_ui/draw_home.cpp b/Marlin/src/lcd/extui/mks_ui/draw_home.cpp index 04ebd95a09..a819fffacd 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_home.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_home.cpp @@ -67,8 +67,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { queue.inject(F("M84XY")); break; case ID_H_RETURN: - clear_cur_ui(); - draw_return_ui(); + goto_previous_ui(); break; } } diff --git a/Marlin/src/lcd/extui/mks_ui/draw_keyboard.cpp b/Marlin/src/lcd/extui/mks_ui/draw_keyboard.cpp index 6d7bdc2aa7..90b181d6b5 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_keyboard.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_keyboard.cpp @@ -105,8 +105,7 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) { } else if (strcmp_P(txt, PSTR(LV_SYMBOL_CLOSE)) == 0) { if (kb->event_cb != lv_kb_def_event_cb) { - lv_clear_keyboard(); - draw_return_ui(); + goto_previous_ui(); } else { lv_kb_set_ta(kb, nullptr); // De-assign the text area to hide its cursor if needed @@ -122,13 +121,11 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) { #if ENABLED(MKS_WIFI_MODULE) case wifiName: memcpy(uiCfg.wifi_name, ret_ta_txt, sizeof(uiCfg.wifi_name)); - lv_clear_keyboard(); - draw_return_ui(); + goto_previous_ui(); break; case wifiPassWord: memcpy(uiCfg.wifi_key, ret_ta_txt, sizeof(uiCfg.wifi_name)); - lv_clear_keyboard(); - draw_return_ui(); + goto_previous_ui(); break; case wifiConfig: ZERO(uiCfg.wifi_name); @@ -160,8 +157,7 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) { uint8_t buf[100]; strncpy((char *)buf, ret_ta_txt, sizeof(buf)); update_gcode_command(AUTO_LEVELING_COMMAND_ADDR, buf); - lv_clear_keyboard(); - draw_return_ui(); + goto_previous_ui(); break; case GCodeCommand: if (ret_ta_txt[0] && !queue.ring_buffer.full(3)) { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_move_motor.cpp b/Marlin/src/lcd/extui/mks_ui/draw_move_motor.cpp index baa8d48da3..635421b4c3 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_move_motor.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_move_motor.cpp @@ -83,8 +83,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { disp_move_dist(); break; case ID_M_RETURN: - clear_cur_ui(); - draw_return_ui(); + goto_previous_ui(); return; } disp_cur_pos(); diff --git a/Marlin/src/lcd/extui/mks_ui/draw_number_key.cpp b/Marlin/src/lcd/extui/mks_ui/draw_number_key.cpp index 630bb4efef..deed037248 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_number_key.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_number_key.cpp @@ -453,8 +453,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { case ID_NUM_CONFIRM: last_disp_state = NUMBER_KEY_UI; if (strlen(key_value) != 0) set_value_confirm(); - lv_clear_number_key(); - draw_return_ui(); + goto_previous_ui(); break; } } diff --git a/Marlin/src/lcd/extui/mks_ui/draw_operation.cpp b/Marlin/src/lcd/extui/mks_ui/draw_operation.cpp index 8be74c6b9a..ffe714fca9 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_operation.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_operation.cpp @@ -90,8 +90,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { lv_draw_change_speed(); break; case ID_O_RETURN: - clear_cur_ui(); - draw_return_ui(); + goto_previous_ui(); break; case ID_O_POWER_OFF: if (gCfgItems.finish_power_off) { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_preHeat.cpp b/Marlin/src/lcd/extui/mks_ui/draw_preHeat.cpp index fe651133c3..fe289d8cad 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_preHeat.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_preHeat.cpp @@ -159,8 +159,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { disp_desire_temp(); break; case ID_P_RETURN: - clear_cur_ui(); - draw_return_ui(); + goto_previous_ui(); break; case ID_P_ABS: if (uiCfg.curTempType == 0) { diff --git a/Marlin/src/lcd/extui/mks_ui/draw_touch_calibration.cpp b/Marlin/src/lcd/extui/mks_ui/draw_touch_calibration.cpp index c7e2d5bc31..e0c663e282 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_touch_calibration.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_touch_calibration.cpp @@ -99,8 +99,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { switch (obj->mks_obj_id) { case ID_TC_RETURN: TERN_(MKS_TEST, current_disp_ui = 1); - lv_clear_touch_calibration_screen(); - draw_return_ui(); + goto_previous_ui(); break; } } diff --git a/Marlin/src/lcd/extui/mks_ui/draw_tramming_pos_settings.cpp b/Marlin/src/lcd/extui/mks_ui/draw_tramming_pos_settings.cpp index d5501a3a45..845ef1d807 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_tramming_pos_settings.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_tramming_pos_settings.cpp @@ -54,8 +54,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { switch (obj->mks_obj_id) { case ID_MANUAL_POS_RETURN: uiCfg.para_ui_page = false; - lv_clear_tramming_pos_settings(); - draw_return_ui(); + goto_previous_ui(); return; case ID_MANUAL_POS_X1: value = level_pos_x1; diff --git a/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp b/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp index 37b06356e0..66b2deda66 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp @@ -1082,6 +1082,11 @@ void draw_return_ui() { } } +void goto_previous_ui() { + clear_cur_ui(); + draw_return_ui(); +} + // Set the same image for both Released and Pressed void lv_imgbtn_set_src_both(lv_obj_t *imgbtn, const void *src) { lv_imgbtn_set_src(imgbtn, LV_BTN_STATE_REL, src); diff --git a/Marlin/src/lcd/extui/mks_ui/draw_ui.h b/Marlin/src/lcd/extui/mks_ui/draw_ui.h index a74d7e1ae2..55ea6220e0 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_ui.h +++ b/Marlin/src/lcd/extui/mks_ui/draw_ui.h @@ -467,6 +467,7 @@ void lv_eom_hook(void *); void GUI_RefreshPage(); void clear_cur_ui(); void draw_return_ui(); +void goto_previous_ui(); void sd_detection(); void gCfg_to_spiFlah(); void print_time_count(); diff --git a/Marlin/src/lcd/extui/mks_ui/draw_wifi_settings.cpp b/Marlin/src/lcd/extui/mks_ui/draw_wifi_settings.cpp index fb9fb4f9eb..cf086b45b1 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_wifi_settings.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_wifi_settings.cpp @@ -47,8 +47,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { if (event != LV_EVENT_RELEASED) return; switch (obj->mks_obj_id) { case ID_WIFI_RETURN: - lv_clear_wifi_settings(); - draw_return_ui(); + goto_previous_ui(); break; case ID_WIFI_MODEL: if (gCfgItems.wifi_mode_sel == AP_MODEL) { From 28e2c358d1238d2d0db9e74b23e83f6e3bff89d4 Mon Sep 17 00:00:00 2001 From: Mike La Spina Date: Mon, 18 Oct 2021 02:40:47 -0500 Subject: [PATCH 018/125] =?UTF-8?q?=F0=9F=8E=A8=20Suppress=20type=20warnin?= =?UTF-8?q?g=20(#22976)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/controllerfan.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/feature/controllerfan.cpp b/Marlin/src/feature/controllerfan.cpp index 5efddbb111..03ef31e414 100644 --- a/Marlin/src/feature/controllerfan.cpp +++ b/Marlin/src/feature/controllerfan.cpp @@ -58,7 +58,7 @@ void ControllerFan::update() { // - At least one stepper driver is enabled // - The heated bed is enabled // - TEMP_SENSOR_BOARD is reporting >= CONTROLLER_FAN_MIN_BOARD_TEMP - const ena_mask_t axis_mask = TERN(CONTROLLER_FAN_USE_Z_ONLY, _BV(Z_AXIS), ~TERN0(CONTROLLER_FAN_IGNORE_Z, _BV(Z_AXIS))); + const ena_mask_t axis_mask = TERN(CONTROLLER_FAN_USE_Z_ONLY, _BV(Z_AXIS), (ena_mask_t)~TERN0(CONTROLLER_FAN_IGNORE_Z, _BV(Z_AXIS))); if ( (stepper.axis_enabled.bits & axis_mask) || TERN0(HAS_HEATED_BED, thermalManager.temp_bed.soft_pwm_amount > 0) || TERN0(HAS_CONTROLLER_FAN_MIN_BOARD_TEMP, thermalManager.wholeDegBoard() >= CONTROLLER_FAN_MIN_BOARD_TEMP) From d3a84bc584875dc3e022f2d9fd8065207caef204 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 019/125] =?UTF-8?q?=E2=9C=A8=20=20BTT=20Octopus=20Pro=20V1?= =?UTF-8?q?.0=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 dd08f6a1b4..86fe878837 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -384,25 +384,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 111038d875..6e5a2e51eb 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -615,6 +615,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 7ab8012d88..655e65da47 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 4544bf56a0..f4968a55e4 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 ec57879c595ceffff8c136bf8acd5b4bce33a44a Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Mon, 18 Oct 2021 20:54:20 +1300 Subject: [PATCH 020/125] =?UTF-8?q?=F0=9F=90=9B=20Fix=20MMU1=20compile=20(?= =?UTF-8?q?#22965)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/MarlinCore.cpp | 4 ++++ Marlin/src/feature/mmu/mmu.cpp | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 2e9f6a6fc2..eb57835f96 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -216,6 +216,10 @@ #include "feature/controllerfan.h" #endif +#if HAS_PRUSA_MMU1 + #include "feature/mmu/mmu.h" +#endif + #if HAS_PRUSA_MMU2 #include "feature/mmu/mmu2.h" #endif diff --git a/Marlin/src/feature/mmu/mmu.cpp b/Marlin/src/feature/mmu/mmu.cpp index 6340f3c301..58c49ed224 100644 --- a/Marlin/src/feature/mmu/mmu.cpp +++ b/Marlin/src/feature/mmu/mmu.cpp @@ -24,9 +24,9 @@ #if HAS_PRUSA_MMU1 -#include "../MarlinCore.h" -#include "../module/planner.h" -#include "../module/stepper.h" +#include "../../MarlinCore.h" +#include "../../module/planner.h" +#include "../../module/stepper.h" void mmu_init() { SET_OUTPUT(E_MUX0_PIN); From 7bab1c92e72f8e1bdb5c04287c4ee82a89dba600 Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Mon, 18 Oct 2021 00:57:54 -0700 Subject: [PATCH 021/125] =?UTF-8?q?=F0=9F=90=9B=20Fix=20I2C=20EEPROM=20SDA?= =?UTF-8?q?/SCL=20aliases=20with=20SKR=20Mini=20E3=20V2=20(#22955)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h index c22409923b..2ab7a61e0b 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h @@ -30,8 +30,8 @@ #define I2C_EEPROM #define SOFT_I2C_EEPROM #define MARLIN_EEPROM_SIZE 0x1000 // 4KB - #define I2C_SDA_PIN SDA - #define I2C_SCL_PIN SCL + #define I2C_SDA_PIN PB7 + #define I2C_SCL_PIN PB6 #undef NO_EEPROM_SELECTED #endif From 357fb8d98458883144e29a39e9f4d5c033f803a3 Mon Sep 17 00:00:00 2001 From: Jason Smith Date: Mon, 18 Oct 2021 01:11:16 -0700 Subject: [PATCH 022/125] =?UTF-8?q?=F0=9F=90=9B=20Fix=20max=20chamber=20fa?= =?UTF-8?q?n=20speed=20(#22977)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/temperature.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 4320a530c5..5e8f4c9d95 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -1494,8 +1494,8 @@ void Temperature::manage_heater() { #elif CHAMBER_FAN_MODE == 3 fan_chamber_pwm = CHAMBER_FAN_BASE + _MAX((CHAMBER_FAN_FACTOR) * (temp_chamber.celsius - temp_chamber.target), 0); #endif - NOMORE(fan_chamber_pwm, 225); - set_fan_speed(CHAMBER_FAN_INDEX, fan_chamber_pwm); // TODO: instead of fan 2, set to chamber fan + NOMORE(fan_chamber_pwm, 255); + set_fan_speed(CHAMBER_FAN_INDEX, fan_chamber_pwm); #endif #if ENABLED(CHAMBER_VENT) From 3a77894efd579955968a4bcf023b6d8ae937ae05 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 19 Oct 2021 01:06:11 +0000 Subject: [PATCH 023/125] [cron] Bump distribution date (2021-10-19) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index f0f467ba58..f88ecddddc 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-10-18" +//#define STRING_DISTRIBUTION_DATE "2021-10-19" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 6341981970..eb6f967756 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-10-18" + #define STRING_DISTRIBUTION_DATE "2021-10-19" #endif /** From c91451d215506b3c3977b9ae4b146c98b48acdeb Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 19 Oct 2021 02:49:35 -0500 Subject: [PATCH 024/125] =?UTF-8?q?=F0=9F=94=A8=20Update=20'pio=20vscode?= =?UTF-8?q?=20init'=20detection?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PlatformIO/scripts/common-dependencies.py | 9 ++++++--- .../PlatformIO/scripts/download_mks_assets.py | 15 ++++++++++----- buildroot/share/PlatformIO/scripts/pioutil.py | 8 ++++++++ .../share/PlatformIO/scripts/preflight-checks.py | 11 ++++++----- 4 files changed, 30 insertions(+), 13 deletions(-) create mode 100644 buildroot/share/PlatformIO/scripts/pioutil.py diff --git a/buildroot/share/PlatformIO/scripts/common-dependencies.py b/buildroot/share/PlatformIO/scripts/common-dependencies.py index 83dfeca879..f523b12069 100644 --- a/buildroot/share/PlatformIO/scripts/common-dependencies.py +++ b/buildroot/share/PlatformIO/scripts/common-dependencies.py @@ -2,7 +2,12 @@ # common-dependencies.py # Convenience script to check dependencies and add libs and sources for Marlin Enabled Features # -import subprocess,os,re +import subprocess,os,re,pioutil +Import("env") + +# Detect that 'vscode init' is running +if pioutil.is_vscode_init(): + env.Exit(0) PIO_VERSION_MIN = (5, 0, 3) try: @@ -31,8 +36,6 @@ except: from platformio.package.meta import PackageSpec from platformio.project.config import ProjectConfig -Import("env") - #print(env.Dump()) try: diff --git a/buildroot/share/PlatformIO/scripts/download_mks_assets.py b/buildroot/share/PlatformIO/scripts/download_mks_assets.py index e922fed2be..251a74a4cc 100644 --- a/buildroot/share/PlatformIO/scripts/download_mks_assets.py +++ b/buildroot/share/PlatformIO/scripts/download_mks_assets.py @@ -3,10 +3,15 @@ # Added by HAS_TFT_LVGL_UI to download assets from Makerbase repo # Import("env") -import os,requests,zipfile,tempfile,shutil +import os,requests,zipfile,tempfile,shutil,pioutil -url = "https://github.com/makerbase-mks/Mks-Robin-Nano-Marlin2.0-Firmware/archive/master.zip" -zip_path = os.path.join(env.Dictionary("PROJECT_LIBDEPS_DIR"), "mks-assets.zip") +# Detect that 'vscode init' is running +if pioutil.is_vscode_init(): + env.Exit(0) + +url = "https://github.com/makerbase-mks/Mks-Robin-Nano-Marlin2.0-Firmware/archive/0263cdaccf.zip" +deps_path = env.Dictionary("PROJECT_LIBDEPS_DIR") +zip_path = os.path.join(deps_path, "mks-assets.zip") assets_path = os.path.join(env.Dictionary("PROJECT_BUILD_DIR"), env.Dictionary("PIOENV"), "assets") def download_mks_assets(): @@ -14,8 +19,8 @@ def download_mks_assets(): r = requests.get(url, stream=True) # the user may have a very clean workspace, # so create the PROJECT_LIBDEPS_DIR directory if not exits - if os.path.exists(env.Dictionary("PROJECT_LIBDEPS_DIR")) == False: - os.mkdir(env.Dictionary("PROJECT_LIBDEPS_DIR")) + if os.path.exists(deps_path) == False: + os.mkdir(deps_path) with open(zip_path, 'wb') as fd: for chunk in r.iter_content(chunk_size=128): fd.write(chunk) diff --git a/buildroot/share/PlatformIO/scripts/pioutil.py b/buildroot/share/PlatformIO/scripts/pioutil.py new file mode 100644 index 0000000000..f0c021fca7 --- /dev/null +++ b/buildroot/share/PlatformIO/scripts/pioutil.py @@ -0,0 +1,8 @@ +# +# buildroot/share/PlatformIO/scripts/pioutil.py +# + +# Detect that 'vscode init' is running +def is_vscode_init(): + from SCons.Script import COMMAND_LINE_TARGETS + return "idedata" in COMMAND_LINE_TARGETS or "_idedata" in COMMAND_LINE_TARGETS diff --git a/buildroot/share/PlatformIO/scripts/preflight-checks.py b/buildroot/share/PlatformIO/scripts/preflight-checks.py index b949df97c8..0dab3e4b1f 100644 --- a/buildroot/share/PlatformIO/scripts/preflight-checks.py +++ b/buildroot/share/PlatformIO/scripts/preflight-checks.py @@ -2,9 +2,13 @@ # preflight-checks.py # Check for common issues prior to compiling # -import os,re,sys +import os,re,sys,pioutil Import("env") +# Detect that 'vscode init' is running +if pioutil.is_vscode_init(): + env.Exit(0) + def get_envs_for_board(board): with open(os.path.join("Marlin", "src", "pins", "pins.h"), "r") as file: @@ -94,7 +98,4 @@ def sanity_check_target(): err = "ERROR: Old files fell into your Marlin folder. Remove %s and try again" % ", ".join(mixedin) raise SystemExit(err) -# Detect that 'vscode init' is running -from SCons.Script import COMMAND_LINE_TARGETS -if "idedata" not in COMMAND_LINE_TARGETS: - sanity_check_target() +sanity_check_target() From 6cf6c4cd852bd09c509407057e81e37e36bad52e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 19 Oct 2021 02:56:44 -0500 Subject: [PATCH 025/125] =?UTF-8?q?=F0=9F=94=A8=20Delete=20after=20encrypt?= =?UTF-8?q?.=20Lerdge=20encrypt=20only=20once?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/share/PlatformIO/scripts/lerdge.py | 47 ++++++++++---------- buildroot/share/PlatformIO/scripts/marlin.py | 16 ++++--- ini/stm32f4.ini | 4 +- 3 files changed, 34 insertions(+), 33 deletions(-) diff --git a/buildroot/share/PlatformIO/scripts/lerdge.py b/buildroot/share/PlatformIO/scripts/lerdge.py index 654f0ad4df..144ab64a9a 100644 --- a/buildroot/share/PlatformIO/scripts/lerdge.py +++ b/buildroot/share/PlatformIO/scripts/lerdge.py @@ -12,37 +12,36 @@ from SCons.Script import DefaultEnvironment board = DefaultEnvironment().BoardConfig() def encryptByte(byte): - byte = 0xFF & ((byte << 6) | (byte >> 2)) - i = 0x58 + byte - j = 0x05 + byte + (i >> 8) - byte = (0xF8 & i) | (0x07 & j) - return byte + byte = 0xFF & ((byte << 6) | (byte >> 2)) + i = 0x58 + byte + j = 0x05 + byte + (i >> 8) + byte = (0xF8 & i) | (0x07 & j) + return byte def encrypt_file(input, output_file, file_length): - input_file = bytearray(input.read()) - for i in range(len(input_file)): - result = encryptByte(input_file[i]) - input_file[i] = result - - output_file.write(input_file) - return + input_file = bytearray(input.read()) + for i in range(len(input_file)): + input_file[i] = encryptByte(input_file[i]) + output_file.write(input_file) # Encrypt ${PROGNAME}.bin and save it with the name given in build.encrypt def encrypt(source, target, env): - fwname = board.get("build.encrypt") - print("Encrypting %s to %s" % (target[0].path, fwname)) - firmware = open(target[0].path, "rb") - renamed = open(target[0].dir.path + "/" + fwname, "wb") - length = os.path.getsize(target[0].path) + fwpath = target[0].path + enname = board.get("build.encrypt") + print("Encrypting %s to %s" % (fwpath, enname)) + fwfile = open(fwpath, "rb") + enfile = open(target[0].dir.path + "/" + enname, "wb") + length = os.path.getsize(fwpath) - encrypt_file(firmware, renamed, length) + encrypt_file(fwfile, enfile, length) - firmware.close() - renamed.close() + fwfile.close() + enfile.close() + os.remove(fwpath) if 'encrypt' in board.get("build").keys(): - if board.get("build.encrypt") != "": - marlin.add_post_action(encrypt) + if board.get("build.encrypt") != "": + marlin.add_post_action(encrypt) else: - print("LERDGE builds require output file via board_build.encrypt = 'filename' parameter") - exit(1) + print("LERDGE builds require output file via board_build.encrypt = 'filename' parameter") + exit(1) diff --git a/buildroot/share/PlatformIO/scripts/marlin.py b/buildroot/share/PlatformIO/scripts/marlin.py index 3949037904..caa0c89749 100644 --- a/buildroot/share/PlatformIO/scripts/marlin.py +++ b/buildroot/share/PlatformIO/scripts/marlin.py @@ -48,22 +48,24 @@ def encrypt_mks(source, target, env, new_name): key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E] - firmware = open(target[0].path, "rb") - renamed = open(target[0].dir.path + "/" + new_name, "wb") - length = os.path.getsize(target[0].path) + fwpath = target[0].path + fwfile = open(fwpath, "rb") + enfile = open(target[0].dir.path + "/" + new_name, "wb") + length = os.path.getsize(fwpath) position = 0 try: while position < length: - byte = firmware.read(1) + byte = fwfile.read(1) if position >= 320 and position < 31040: byte = chr(ord(byte) ^ key[position & 31]) if sys.version_info[0] > 2: byte = bytes(byte, 'latin1') - renamed.write(byte) + enfile.write(byte) position += 1 finally: - firmware.close() - renamed.close() + fwfile.close() + enfile.close() + os.remove(fwpath) def add_post_action(action): env.AddPostAction(join("$BUILD_DIR", "${PROGNAME}.bin"), action); diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index f4968a55e4..a6bc125d21 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -263,13 +263,13 @@ platform = ${common_stm32.platform} extends = stm32_variant board = marlin_STM32F407ZGT6 board_build.variant = MARLIN_LERDGE -board_build.encrypt = firmware.bin board_build.offset = 0x10000 build_flags = ${stm32_variant.build_flags} -DSTM32F4 -DSTM32F4xx -DTARGET_STM32F4 -DDISABLE_GENERIC_SERIALUSB -DARDUINO_ARCH_STM32 -DLERDGE_TFT35 build_unflags = ${stm32_variant.build_unflags} -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483 -extra_scripts = ${stm32_variant.extra_scripts} +extra_scripts = ${common_stm32.extra_scripts} + pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py buildroot/share/PlatformIO/scripts/lerdge.py # From f8ec8e5bf6df342a27e5dc9e39d6605c50f64194 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 19 Oct 2021 04:03:03 -0500 Subject: [PATCH 026/125] =?UTF-8?q?=F0=9F=92=A1=20Sub-include=20pins=20lab?= =?UTF-8?q?els?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/lpc1769/pins_BTT_SKR_V1_4_TURBO.h | 2 +- Marlin/src/pins/ramps/pins_AZTEEG_X3.h | 2 +- Marlin/src/pins/ramps/pins_BQ_ZUM_MEGA_3D.h | 2 +- Marlin/src/pins/ramps/pins_K8200.h | 2 +- Marlin/src/pins/ramps/pins_K8400.h | 2 +- Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h | 2 +- Marlin/src/pins/ramps/pins_MKS_BASE_10.h | 2 +- Marlin/src/pins/ramps/pins_MKS_BASE_14.h | 2 +- Marlin/src/pins/ramps/pins_MKS_BASE_15.h | 2 +- Marlin/src/pins/ramps/pins_MKS_BASE_16.h | 2 +- Marlin/src/pins/ramps/pins_MKS_BASE_HEROIC.h | 2 +- Marlin/src/pins/ramps/pins_RIGIDBOARD_V2.h | 2 +- Marlin/src/pins/ramps/pins_TRIGORILLA_13.h | 2 +- Marlin/src/pins/ramps/pins_ZRIB_V20.h | 2 +- Marlin/src/pins/ramps/pins_ZRIB_V52.h | 2 +- Marlin/src/pins/sanguino/pins_AZTEEG_X1.h | 2 +- Marlin/src/pins/sanguino/pins_MELZI.h | 2 +- Marlin/src/pins/sanguino/pins_MELZI_CREALITY.h | 2 +- Marlin/src/pins/sanguino/pins_MELZI_MAKR3D.h | 2 +- Marlin/src/pins/sanguino/pins_MELZI_MALYAN.h | 2 +- Marlin/src/pins/sanguino/pins_MELZI_TRONXY.h | 2 +- Marlin/src/pins/sanguino/pins_MELZI_V2.h | 2 +- Marlin/src/pins/sanguino/pins_STB_11.h | 2 +- Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_MZ_V1_0.h | 2 +- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D_V1_1.h | 2 +- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_V1_1.h | 2 +- 26 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Marlin/src/pins/lpc1769/pins_BTT_SKR_V1_4_TURBO.h b/Marlin/src/pins/lpc1769/pins_BTT_SKR_V1_4_TURBO.h index 2b847d339f..7f428fc918 100644 --- a/Marlin/src/pins/lpc1769/pins_BTT_SKR_V1_4_TURBO.h +++ b/Marlin/src/pins/lpc1769/pins_BTT_SKR_V1_4_TURBO.h @@ -31,4 +31,4 @@ // Include SKR 1.4 pins // #define REQUIRE_LPC1769 -#include "../lpc1768/pins_BTT_SKR_V1_4.h" +#include "../lpc1768/pins_BTT_SKR_V1_4.h" // ... BTT_SKR_common diff --git a/Marlin/src/pins/ramps/pins_AZTEEG_X3.h b/Marlin/src/pins/ramps/pins_AZTEEG_X3.h index 07af61e693..ee8cafa897 100644 --- a/Marlin/src/pins/ramps/pins_AZTEEG_X3.h +++ b/Marlin/src/pins/ramps/pins_AZTEEG_X3.h @@ -43,7 +43,7 @@ #define SERVO0_PIN 44 // SERVO1 port #define SERVO1_PIN 55 // SERVO2 port -#include "pins_RAMPS_13.h" +#include "pins_RAMPS_13.h" // ... RAMPS // // LCD / Controller diff --git a/Marlin/src/pins/ramps/pins_BQ_ZUM_MEGA_3D.h b/Marlin/src/pins/ramps/pins_BQ_ZUM_MEGA_3D.h index 64d881866b..523ab7678f 100644 --- a/Marlin/src/pins/ramps/pins_BQ_ZUM_MEGA_3D.h +++ b/Marlin/src/pins/ramps/pins_BQ_ZUM_MEGA_3D.h @@ -115,7 +115,7 @@ // // Import RAMPS 1.3 pins // -#include "pins_RAMPS_13.h" +#include "pins_RAMPS_13.h" // ... RAMPS // // Used by the Hephestos 2 heated bed upgrade kit diff --git a/Marlin/src/pins/ramps/pins_K8200.h b/Marlin/src/pins/ramps/pins_K8200.h index df685e0f0c..395e1ccca5 100644 --- a/Marlin/src/pins/ramps/pins_K8200.h +++ b/Marlin/src/pins/ramps/pins_K8200.h @@ -30,4 +30,4 @@ #define DEFAULT_MACHINE_NAME "K8200" #define DEFAULT_SOURCE_CODE_URL "github.com/CONSULitAS/Marlin-K8200" -#include "pins_3DRAG.h" +#include "pins_3DRAG.h" // ... RAMPS diff --git a/Marlin/src/pins/ramps/pins_K8400.h b/Marlin/src/pins/ramps/pins_K8400.h index bed2238162..36c438aca2 100644 --- a/Marlin/src/pins/ramps/pins_K8400.h +++ b/Marlin/src/pins/ramps/pins_K8400.h @@ -50,7 +50,7 @@ #define X_STOP_PIN 3 #define Y_STOP_PIN 14 -#include "pins_3DRAG.h" +#include "pins_3DRAG.h" // ... RAMPS // // Heaters / Fans diff --git a/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h b/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h index ccf7ab6793..6b48e3cbd6 100644 --- a/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h +++ b/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h @@ -117,4 +117,4 @@ // Other RAMPS 1.3 pins // #define IS_RAMPS_EFB // Override autodetection. Bed will be undefined. -#include "pins_RAMPS_13.h" +#include "pins_RAMPS_13.h" // ... RAMPS diff --git a/Marlin/src/pins/ramps/pins_MKS_BASE_10.h b/Marlin/src/pins/ramps/pins_MKS_BASE_10.h index 0be58653aa..c40cabe325 100644 --- a/Marlin/src/pins/ramps/pins_MKS_BASE_10.h +++ b/Marlin/src/pins/ramps/pins_MKS_BASE_10.h @@ -34,4 +34,4 @@ #define BOARD_INFO_NAME "MKS BASE 1.0" #define MKS_BASE_VERSION 10 -#include "pins_MKS_BASE_common.h" +#include "pins_MKS_BASE_common.h" // ... RAMPS diff --git a/Marlin/src/pins/ramps/pins_MKS_BASE_14.h b/Marlin/src/pins/ramps/pins_MKS_BASE_14.h index 3612f9b894..992ab92ee9 100644 --- a/Marlin/src/pins/ramps/pins_MKS_BASE_14.h +++ b/Marlin/src/pins/ramps/pins_MKS_BASE_14.h @@ -58,7 +58,7 @@ #define CASE_LIGHT_PIN 11 // PB5 ** Pin24 ** PWM11 #endif -#include "pins_MKS_BASE_common.h" +#include "pins_MKS_BASE_common.h" // ... RAMPS /* Available connectors on MKS BASE v1.4 diff --git a/Marlin/src/pins/ramps/pins_MKS_BASE_15.h b/Marlin/src/pins/ramps/pins_MKS_BASE_15.h index 9e670d1bbd..2b0c2bb883 100644 --- a/Marlin/src/pins/ramps/pins_MKS_BASE_15.h +++ b/Marlin/src/pins/ramps/pins_MKS_BASE_15.h @@ -32,4 +32,4 @@ #define BOARD_INFO_NAME "MKS BASE 1.5" #define MKS_BASE_VERSION 15 -#include "pins_MKS_BASE_common.h" +#include "pins_MKS_BASE_common.h" // ... RAMPS diff --git a/Marlin/src/pins/ramps/pins_MKS_BASE_16.h b/Marlin/src/pins/ramps/pins_MKS_BASE_16.h index a4dfca21b4..31a8fdab8d 100644 --- a/Marlin/src/pins/ramps/pins_MKS_BASE_16.h +++ b/Marlin/src/pins/ramps/pins_MKS_BASE_16.h @@ -56,4 +56,4 @@ #define PS_ON_PIN -1 #endif -#include "pins_MKS_BASE_common.h" +#include "pins_MKS_BASE_common.h" // ... RAMPS diff --git a/Marlin/src/pins/ramps/pins_MKS_BASE_HEROIC.h b/Marlin/src/pins/ramps/pins_MKS_BASE_HEROIC.h index 3ce138b975..973f924e7c 100644 --- a/Marlin/src/pins/ramps/pins_MKS_BASE_HEROIC.h +++ b/Marlin/src/pins/ramps/pins_MKS_BASE_HEROIC.h @@ -25,7 +25,7 @@ * MKS BASE with Heroic HR4982 stepper drivers */ -#include "pins_MKS_BASE_15.h" +#include "pins_MKS_BASE_15.h" // ... MKS_BASE_common ... RAMPS /** * Some new boards use HR4982 (Heroic) instead of the A4982 (Allegro) stepper drivers. diff --git a/Marlin/src/pins/ramps/pins_RIGIDBOARD_V2.h b/Marlin/src/pins/ramps/pins_RIGIDBOARD_V2.h index 5a6bba3c08..8242f1a772 100644 --- a/Marlin/src/pins/ramps/pins_RIGIDBOARD_V2.h +++ b/Marlin/src/pins/ramps/pins_RIGIDBOARD_V2.h @@ -27,7 +27,7 @@ #define BOARD_INFO_NAME "RigidBoard V2" -#include "pins_RIGIDBOARD.h" +#include "pins_RIGIDBOARD.h" // ... RAMPS // // Steppers diff --git a/Marlin/src/pins/ramps/pins_TRIGORILLA_13.h b/Marlin/src/pins/ramps/pins_TRIGORILLA_13.h index ce9e4e5466..eee0dcd3d2 100644 --- a/Marlin/src/pins/ramps/pins_TRIGORILLA_13.h +++ b/Marlin/src/pins/ramps/pins_TRIGORILLA_13.h @@ -41,4 +41,4 @@ #define E0_AUTO_FAN_PIN 9 #endif -#include "pins_RAMPS_13.h" +#include "pins_RAMPS_13.h" // ... RAMPS diff --git a/Marlin/src/pins/ramps/pins_ZRIB_V20.h b/Marlin/src/pins/ramps/pins_ZRIB_V20.h index 6c4b28d0b8..e9328ca7ba 100644 --- a/Marlin/src/pins/ramps/pins_ZRIB_V20.h +++ b/Marlin/src/pins/ramps/pins_ZRIB_V20.h @@ -26,7 +26,7 @@ * V2 and V3 Boards only differ in USB controller, nothing affecting the pins. */ -#include "pins_MKS_GEN_13.h" +#include "pins_MKS_GEN_13.h" // ... RAMPS #define ZRIB_V20_D6_PIN 6 // Fan #define ZRIB_V20_D9_PIN 9 // Fan2 diff --git a/Marlin/src/pins/ramps/pins_ZRIB_V52.h b/Marlin/src/pins/ramps/pins_ZRIB_V52.h index f4db07ef8d..a6e9175b62 100644 --- a/Marlin/src/pins/ramps/pins_ZRIB_V52.h +++ b/Marlin/src/pins/ramps/pins_ZRIB_V52.h @@ -48,7 +48,7 @@ #define E2_ENABLE_PIN 22 #define HEATER_1_PIN 7 -#include "pins_MKS_BASE_common.h" +#include "pins_MKS_BASE_common.h" // ... RAMPS /* Available connectors on MKS BASE v1.4 (Basically same as ZRIB V5.2) diff --git a/Marlin/src/pins/sanguino/pins_AZTEEG_X1.h b/Marlin/src/pins/sanguino/pins_AZTEEG_X1.h index c3c38eb6f3..3edb14ec41 100644 --- a/Marlin/src/pins/sanguino/pins_AZTEEG_X1.h +++ b/Marlin/src/pins/sanguino/pins_AZTEEG_X1.h @@ -27,4 +27,4 @@ #define BOARD_INFO_NAME "Azteeg X1" -#include "pins_SANGUINOLOLU_12.h" +#include "pins_SANGUINOLOLU_12.h" // ... SANGUINOLOLU_11 diff --git a/Marlin/src/pins/sanguino/pins_MELZI.h b/Marlin/src/pins/sanguino/pins_MELZI.h index 852ad5a34b..e24636c8e0 100644 --- a/Marlin/src/pins/sanguino/pins_MELZI.h +++ b/Marlin/src/pins/sanguino/pins_MELZI.h @@ -44,4 +44,4 @@ #endif #endif -#include "pins_SANGUINOLOLU_12.h" +#include "pins_SANGUINOLOLU_12.h" // ... SANGUINOLOLU_11 diff --git a/Marlin/src/pins/sanguino/pins_MELZI_CREALITY.h b/Marlin/src/pins/sanguino/pins_MELZI_CREALITY.h index 36e26980f4..1b37940e2a 100644 --- a/Marlin/src/pins/sanguino/pins_MELZI_CREALITY.h +++ b/Marlin/src/pins/sanguino/pins_MELZI_CREALITY.h @@ -42,7 +42,7 @@ #define BOARD_ST7920_DELAY_3 125 #endif -#include "pins_MELZI.h" +#include "pins_MELZI.h" // ... SANGUINOLOLU_12 ... SANGUINOLOLU_11 // // For the stock CR-10 enable CR10_STOCKDISPLAY in Configuration.h diff --git a/Marlin/src/pins/sanguino/pins_MELZI_MAKR3D.h b/Marlin/src/pins/sanguino/pins_MELZI_MAKR3D.h index 0e09c1f005..447eca7e3c 100644 --- a/Marlin/src/pins/sanguino/pins_MELZI_MAKR3D.h +++ b/Marlin/src/pins/sanguino/pins_MELZI_MAKR3D.h @@ -26,4 +26,4 @@ */ #define BOARD_INFO_NAME "Melzi (ATmega1284)" -#include "pins_MELZI.h" +#include "pins_MELZI.h" // ... SANGUINOLOLU_12 ... SANGUINOLOLU_11 diff --git a/Marlin/src/pins/sanguino/pins_MELZI_MALYAN.h b/Marlin/src/pins/sanguino/pins_MELZI_MALYAN.h index 3bf8f80457..a0421dcf5c 100644 --- a/Marlin/src/pins/sanguino/pins_MELZI_MALYAN.h +++ b/Marlin/src/pins/sanguino/pins_MELZI_MALYAN.h @@ -27,7 +27,7 @@ #define BOARD_INFO_NAME "Melzi (Malyan)" -#include "pins_MELZI.h" +#include "pins_MELZI.h" // ... SANGUINOLOLU_12 ... SANGUINOLOLU_11 #undef LCD_SDSS #undef LCD_PINS_RS diff --git a/Marlin/src/pins/sanguino/pins_MELZI_TRONXY.h b/Marlin/src/pins/sanguino/pins_MELZI_TRONXY.h index 81bd78b7a0..3f7b36765f 100644 --- a/Marlin/src/pins/sanguino/pins_MELZI_TRONXY.h +++ b/Marlin/src/pins/sanguino/pins_MELZI_TRONXY.h @@ -34,7 +34,7 @@ #define BOARD_ST7920_DELAY_3 0 #endif -#include "pins_MELZI.h" +#include "pins_MELZI.h" // ... SANGUINOLOLU_12 ... SANGUINOLOLU_11 #undef Z_ENABLE_PIN #undef LCD_PINS_RS diff --git a/Marlin/src/pins/sanguino/pins_MELZI_V2.h b/Marlin/src/pins/sanguino/pins_MELZI_V2.h index a3ab5ff61b..e49eb57b11 100644 --- a/Marlin/src/pins/sanguino/pins_MELZI_V2.h +++ b/Marlin/src/pins/sanguino/pins_MELZI_V2.h @@ -34,4 +34,4 @@ #define BOARD_ST7920_DELAY_3 0 #endif -#include "pins_MELZI.h" +#include "pins_MELZI.h" // ... SANGUINOLOLU_12 ... SANGUINOLOLU_11 diff --git a/Marlin/src/pins/sanguino/pins_STB_11.h b/Marlin/src/pins/sanguino/pins_STB_11.h index b10a09840a..ea36211f3b 100644 --- a/Marlin/src/pins/sanguino/pins_STB_11.h +++ b/Marlin/src/pins/sanguino/pins_STB_11.h @@ -27,4 +27,4 @@ #define BOARD_INFO_NAME "STB V1.1" -#include "pins_SANGUINOLOLU_12.h" +#include "pins_SANGUINOLOLU_12.h" // ... SANGUINOLOLU_11 diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_MZ_V1_0.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_MZ_V1_0.h index 96420cf322..8133955224 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_MZ_V1_0.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_MZ_V1_0.h @@ -23,4 +23,4 @@ #define BOARD_INFO_NAME "BTT SKR Mini MZ V1.0" -#include "pins_BTT_SKR_MINI_E3_V2_0.h" +#include "pins_BTT_SKR_MINI_E3_V2_0.h" // ... BTT_SKR_MINI_E3_common diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D_V1_1.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D_V1_1.h index 0d927cf7cb..718f9dc27a 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D_V1_1.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D_V1_1.h @@ -64,4 +64,4 @@ #endif #endif -#include "pins_MKS_ROBIN_E3_V1_1_common.h" +#include "pins_MKS_ROBIN_E3_V1_1_common.h" // ... MKS_ROBIN_E3_common diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_V1_1.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_V1_1.h index 002c35fe54..30720e0c7f 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_V1_1.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_V1_1.h @@ -33,4 +33,4 @@ #define BOARD_INFO_NAME "MKS Robin E3 V1.1" #endif -#include "pins_MKS_ROBIN_E3_V1_1_common.h" +#include "pins_MKS_ROBIN_E3_V1_1_common.h" // ... MKS_ROBIN_E3_common From e77df7230023cc0ac4eb4cce08fae70ff1427dce Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 19 Oct 2021 05:51:49 -0500 Subject: [PATCH 027/125] =?UTF-8?q?=F0=9F=8E=A8=20Fix=20pinsDebug=5Flist?= =?UTF-8?q?=20warnings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/pinsDebug_list.h | 298 ++++++++++++++++++------------- 1 file changed, 171 insertions(+), 127 deletions(-) diff --git a/Marlin/src/pins/pinsDebug_list.h b/Marlin/src/pins/pinsDebug_list.h index fe670cca29..8a4350d90e 100644 --- a/Marlin/src/pins/pinsDebug_list.h +++ b/Marlin/src/pins/pinsDebug_list.h @@ -26,9 +26,9 @@ // If the new pin name is over 28 characters long then pinsDebug.h will need to be modified. #if TARGET_LPC1768 - #define ANALOG_OK(PN) ((PN) == P0_02 || (PN) == P0_03 || (PN) == P0_23 || (PN) == P0_24 || (PN) == P0_25 || (PN) == P0_26 || (PN) == P1_30 || (PN) == P1_31) + #define ANALOG_OK(PN) (WITHIN(PN, P0_02, P0_03) || WITHIN(PN, P0_23, P0_26) || WITHIN(PN, P1_30, P1_31)) #else - #define ANALOG_OK(PN) ((PN) >= 0 && (PN) < NUM_ANALOG_INPUTS) + #define ANALOG_OK(PN) WITHIN(PN, 0, NUM_ANALOG_INPUTS - 1) #endif #line 35 // set __LINE__ to a known value for both passes @@ -37,86 +37,130 @@ // Analog Pin Assignments // -#if defined(EXT_AUX_A0) && ANALOG_OK(EXT_AUX_A0) +#define _EXISTS(PN,V...) (defined(PN##V) && PN##V >= 0) + +#if _EXISTS(EXT_AUX_A0) + #if ANALOG_OK(EXT_AUX_A0) REPORT_NAME_ANALOG(__LINE__, EXT_AUX_A0) #endif -#if defined(EXT_AUX_A1) && ANALOG_OK(EXT_AUX_A0) - REPORT_NAME_ANALOG(__LINE__, EXT_AUX_A1) #endif -#if defined(EXT_AUX_A2) && ANALOG_OK(EXT_AUX_A0) - REPORT_NAME_ANALOG(__LINE__, EXT_AUX_A2) +#if _EXISTS(EXT_AUX_A1) + #if ANALOG_OK(EXT_AUX_A0) + REPORT_NAME_ANALOG(__LINE__, EXT_AUX_A0) + #endif #endif -#if defined(EXT_AUX_A3) && ANALOG_OK(EXT_AUX_A0) - REPORT_NAME_ANALOG(__LINE__, EXT_AUX_A3) +#if _EXISTS(EXT_AUX_A2) + #if ANALOG_OK(EXT_AUX_A0) + REPORT_NAME_ANALOG(__LINE__, EXT_AUX_A0) + #endif #endif -#if defined(EXT_AUX_A4) && ANALOG_OK(EXT_AUX_A0) - REPORT_NAME_ANALOG(__LINE__, EXT_AUX_A4) +#if _EXISTS(EXT_AUX_A3) + #if ANALOG_OK(EXT_AUX_A0) + REPORT_NAME_ANALOG(__LINE__, EXT_AUX_A0) + #endif #endif -#if PIN_EXISTS(FILWIDTH) && ANALOG_OK(FILWIDTH_PIN) - REPORT_NAME_ANALOG(__LINE__, FILWIDTH_PIN) +#if _EXISTS(EXT_AUX_A4) + #if ANALOG_OK(EXT_AUX_A0) + REPORT_NAME_ANALOG(__LINE__, EXT_AUX_A0) + #endif #endif -#if PIN_EXISTS(MAIN_VOLTAGE_MEASURE) && ANALOG_OK(MAIN_VOLTAGE_MEASURE_PIN) - REPORT_NAME_ANALOG(__LINE__, MAIN_VOLTAGE_MEASURE_PIN) +#if PIN_EXISTS(FILWIDTH) + #if ANALOG_OK(FILWIDTH_PIN) + REPORT_NAME_ANALOG(__LINE__, FILWIDTH_PIN) + #endif +#endif +#if PIN_EXISTS(MAIN_VOLTAGE_MEASURE) + #if ANALOG_OK(MAIN_VOLTAGE_MEASURE_PIN) + REPORT_NAME_ANALOG(__LINE__, MAIN_VOLTAGE_MEASURE_PIN) + #endif #endif #if !defined(ARDUINO_ARCH_SAM) && !defined(ARDUINO_ARCH_SAMD) // TC1 & TC2 are macros in the SAM/SAMD tool chain - #if defined(TC1) && ANALOG_OK(TC1) + #if _EXISTS(TC1) + #if ANALOG_OK(TC1) REPORT_NAME_ANALOG(__LINE__, TC1) #endif - #if defined(TC2) && ANALOG_OK(TC1) - REPORT_NAME_ANALOG(__LINE__, TC2) + #endif + #if _EXISTS(TC2) + #if ANALOG_OK(TC1) + REPORT_NAME_ANALOG(__LINE__, TC1) + #endif #endif #endif -#if PIN_EXISTS(TEMP_0) && ANALOG_OK(TEMP_0_PIN) - REPORT_NAME_ANALOG(__LINE__, TEMP_0_PIN) +#if PIN_EXISTS(TEMP_0) + #if ANALOG_OK(TEMP_0_PIN) + REPORT_NAME_ANALOG(__LINE__, TEMP_0_PIN) + #endif #endif -#if PIN_EXISTS(TEMP_1) && ANALOG_OK(TEMP_1_PIN) - REPORT_NAME_ANALOG(__LINE__, TEMP_1_PIN) +#if PIN_EXISTS(TEMP_1) + #if ANALOG_OK(TEMP_1_PIN) + REPORT_NAME_ANALOG(__LINE__, TEMP_1_PIN) + #endif #endif -#if PIN_EXISTS(TEMP_2) && ANALOG_OK(TEMP_2_PIN) - REPORT_NAME_ANALOG(__LINE__, TEMP_2_PIN) +#if PIN_EXISTS(TEMP_2) + #if ANALOG_OK(TEMP_2_PIN) + REPORT_NAME_ANALOG(__LINE__, TEMP_2_PIN) + #endif #endif -#if PIN_EXISTS(TEMP_3) && ANALOG_OK(TEMP_3_PIN) - REPORT_NAME_ANALOG(__LINE__, TEMP_3_PIN) +#if PIN_EXISTS(TEMP_3) + #if ANALOG_OK(TEMP_3_PIN) + REPORT_NAME_ANALOG(__LINE__, TEMP_3_PIN) + #endif #endif -#if PIN_EXISTS(TEMP_4) && ANALOG_OK(TEMP_4_PIN) - REPORT_NAME_ANALOG(__LINE__, TEMP_4_PIN) +#if PIN_EXISTS(TEMP_4) + #if ANALOG_OK(TEMP_4_PIN) + REPORT_NAME_ANALOG(__LINE__, TEMP_4_PIN) + #endif #endif -#if PIN_EXISTS(TEMP_5) && ANALOG_OK(TEMP_5_PIN) - REPORT_NAME_ANALOG(__LINE__, TEMP_5_PIN) +#if PIN_EXISTS(TEMP_5) + #if ANALOG_OK(TEMP_5_PIN) + REPORT_NAME_ANALOG(__LINE__, TEMP_5_PIN) + #endif #endif -#if PIN_EXISTS(TEMP_6) && ANALOG_OK(TEMP_6_PIN) - REPORT_NAME_ANALOG(__LINE__, TEMP_6_PIN) +#if PIN_EXISTS(TEMP_6) + #if ANALOG_OK(TEMP_6_PIN) + REPORT_NAME_ANALOG(__LINE__, TEMP_6_PIN) + #endif #endif -#if PIN_EXISTS(TEMP_7) && ANALOG_OK(TEMP_7_PIN) - REPORT_NAME_ANALOG(__LINE__, TEMP_7_PIN) +#if PIN_EXISTS(TEMP_7) + #if ANALOG_OK(TEMP_7_PIN) + REPORT_NAME_ANALOG(__LINE__, TEMP_7_PIN) + #endif #endif -#if PIN_EXISTS(TEMP_BED) && ANALOG_OK(TEMP_BED_PIN) - REPORT_NAME_ANALOG(__LINE__, TEMP_BED_PIN) +#if PIN_EXISTS(TEMP_BED) + #if ANALOG_OK(TEMP_BED_PIN) + REPORT_NAME_ANALOG(__LINE__, TEMP_BED_PIN) + #endif #endif -#if PIN_EXISTS(TEMP_CHAMBER) && ANALOG_OK(TEMP_CHAMBER_PIN) - REPORT_NAME_ANALOG(__LINE__, TEMP_CHAMBER_PIN) +#if PIN_EXISTS(TEMP_CHAMBER) + #if ANALOG_OK(TEMP_CHAMBER_PIN) + REPORT_NAME_ANALOG(__LINE__, TEMP_CHAMBER_PIN) + #endif #endif -#if PIN_EXISTS(TEMP_COOLER) && ANALOG_OK(TEMP_COOLER_PIN) - REPORT_NAME_ANALOG(__LINE__, TEMP_COOLER_PIN) +#if PIN_EXISTS(TEMP_COOLER) + #if ANALOG_OK(TEMP_COOLER_PIN) + REPORT_NAME_ANALOG(__LINE__, TEMP_COOLER_PIN) + #endif #endif -#if PIN_EXISTS(ADC_KEYPAD) && ANALOG_OK(ADC_KEYPAD_PIN) - REPORT_NAME_ANALOG(__LINE__, ADC_KEYPAD_PIN) +#if PIN_EXISTS(ADC_KEYPAD) + #if ANALOG_OK(ADC_KEYPAD_PIN) + REPORT_NAME_ANALOG(__LINE__, ADC_KEYPAD_PIN) + #endif #endif // // Digital Pin Assignments // -#if defined(__FD) && __FD >= 0 +#if _EXISTS(__FD) REPORT_NAME_DIGITAL(__LINE__, __FD) #endif -#if defined(__FS) && __FS >= 0 +#if _EXISTS(__FS) REPORT_NAME_DIGITAL(__LINE__, __FS) #endif -#if defined(__GD) && __GD >= 0 +#if _EXISTS(__GD) REPORT_NAME_DIGITAL(__LINE__, __GD) #endif -#if defined(__GS) && __GS >= 0 +#if _EXISTS(__GS) REPORT_NAME_DIGITAL(__LINE__, __GS) #endif #if PIN_EXISTS(AVR_MISO) @@ -137,46 +181,46 @@ #if PIN_EXISTS(BEEPER) REPORT_NAME_DIGITAL(__LINE__, BEEPER_PIN) #endif -#if defined(BTN_BACK) && BTN_BACK >= 0 +#if _EXISTS(BTN_BACK) REPORT_NAME_DIGITAL(__LINE__, BTN_BACK) #endif -#if defined(BTN_CENTER) && BTN_CENTER >= 0 +#if _EXISTS(BTN_CENTER) REPORT_NAME_DIGITAL(__LINE__, BTN_CENTER) #endif -#if defined(BTN_DOWN) && BTN_DOWN >= 0 +#if _EXISTS(BTN_DOWN) REPORT_NAME_DIGITAL(__LINE__, BTN_DOWN) #endif -#if defined(BTN_DWN) && BTN_DWN >= 0 +#if _EXISTS(BTN_DWN) REPORT_NAME_DIGITAL(__LINE__, BTN_DWN) #endif -#if defined(BTN_EN1) && BTN_EN1 >= 0 +#if _EXISTS(BTN_EN1) REPORT_NAME_DIGITAL(__LINE__, BTN_EN1) #endif -#if defined(BTN_EN2) && BTN_EN2 >= 0 +#if _EXISTS(BTN_EN2) REPORT_NAME_DIGITAL(__LINE__, BTN_EN2) #endif -#if defined(BTN_ENC_EN) && BTN_ENC_EN >= 0 +#if _EXISTS(BTN_ENC_EN) REPORT_NAME_DIGITAL(__LINE__, BTN_ENC_EN) #endif -#if defined(BTN_ENC) && BTN_ENC >= 0 +#if _EXISTS(BTN_ENC) REPORT_NAME_DIGITAL(__LINE__, BTN_ENC) #endif -#if defined(BTN_HOME) && BTN_HOME >= 0 +#if _EXISTS(BTN_HOME) REPORT_NAME_DIGITAL(__LINE__, BTN_HOME) #endif -#if defined(BTN_LEFT) && BTN_LEFT >= 0 +#if _EXISTS(BTN_LEFT) REPORT_NAME_DIGITAL(__LINE__, BTN_LEFT) #endif -#if defined(BTN_LFT) && BTN_LFT >= 0 +#if _EXISTS(BTN_LFT) REPORT_NAME_DIGITAL(__LINE__, BTN_LFT) #endif -#if defined(BTN_RIGHT) && BTN_RIGHT >= 0 +#if _EXISTS(BTN_RIGHT) REPORT_NAME_DIGITAL(__LINE__, BTN_RIGHT) #endif -#if defined(BTN_RT) && BTN_RT >= 0 +#if _EXISTS(BTN_RT) REPORT_NAME_DIGITAL(__LINE__, BTN_RT) #endif -#if defined(BTN_UP) && BTN_UP >= 0 +#if _EXISTS(BTN_UP) REPORT_NAME_DIGITAL(__LINE__, BTN_UP) #endif #if PIN_EXISTS(JOY_X) @@ -287,10 +331,10 @@ #if PIN_EXISTS(CUTOFF_TEST) REPORT_NAME_DIGITAL(__LINE__, CUTOFF_TEST_PIN) #endif -#if defined(D57) && D57 >= 0 +#if _EXISTS(D57) REPORT_NAME_DIGITAL(__LINE__, D57) #endif -#if defined(D58) && D58 >= 0 +#if _EXISTS(D58) REPORT_NAME_DIGITAL(__LINE__, D58) #endif #if PIN_EXISTS(DAC_DISABLE) @@ -305,49 +349,49 @@ #if PIN_EXISTS(DEBUG) REPORT_NAME_DIGITAL(__LINE__, DEBUG_PIN) #endif -#if defined(DIGIPOTS_I2C_SCL) && DIGIPOTS_I2C_SCL >= 0 +#if _EXISTS(DIGIPOTS_I2C_SCL) REPORT_NAME_DIGITAL(__LINE__, DIGIPOTS_I2C_SCL) #endif -#if defined(DIGIPOTS_I2C_SDA_E0) && DIGIPOTS_I2C_SDA_E0 >= 0 +#if _EXISTS(DIGIPOTS_I2C_SDA_E0) REPORT_NAME_DIGITAL(__LINE__, DIGIPOTS_I2C_SDA_E0) #endif -#if defined(DIGIPOTS_I2C_SDA_E1) && DIGIPOTS_I2C_SDA_E1 >= 0 +#if _EXISTS(DIGIPOTS_I2C_SDA_E1) REPORT_NAME_DIGITAL(__LINE__, DIGIPOTS_I2C_SDA_E1) #endif -#if defined(DIGIPOTS_I2C_SDA_X) && DIGIPOTS_I2C_SDA_X >= 0 +#if _EXISTS(DIGIPOTS_I2C_SDA_X) REPORT_NAME_DIGITAL(__LINE__, DIGIPOTS_I2C_SDA_X) #endif -#if defined(DIGIPOTS_I2C_SDA_Y) && DIGIPOTS_I2C_SDA_Y >= 0 +#if _EXISTS(DIGIPOTS_I2C_SDA_Y) REPORT_NAME_DIGITAL(__LINE__, DIGIPOTS_I2C_SDA_Y) #endif -#if defined(DIGIPOTS_I2C_SDA_Z) && DIGIPOTS_I2C_SDA_Z >= 0 +#if _EXISTS(DIGIPOTS_I2C_SDA_Z) REPORT_NAME_DIGITAL(__LINE__, DIGIPOTS_I2C_SDA_Z) #endif #if PIN_EXISTS(DIGIPOTSS) REPORT_NAME_DIGITAL(__LINE__, DIGIPOTSS_PIN) #endif -#if defined(DOGLCD_A0) && DOGLCD_A0 >= 0 +#if _EXISTS(DOGLCD_A0) REPORT_NAME_DIGITAL(__LINE__, DOGLCD_A0) #endif -#if defined(DOGLCD_CS) && DOGLCD_CS >= 0 +#if _EXISTS(DOGLCD_CS) REPORT_NAME_DIGITAL(__LINE__, DOGLCD_CS) #endif -#if defined(DOGLCD_MOSI) && DOGLCD_MOSI >= 0 +#if _EXISTS(DOGLCD_MOSI) REPORT_NAME_DIGITAL(__LINE__, DOGLCD_MOSI) #endif -#if defined(DOGLCD_SCK) && DOGLCD_SCK >= 0 +#if _EXISTS(DOGLCD_SCK) REPORT_NAME_DIGITAL(__LINE__, DOGLCD_SCK) #endif -#if defined(TMC_SW_MISO) && TMC_SW_MISO >= 0 +#if _EXISTS(TMC_SW_MISO) REPORT_NAME_DIGITAL(__LINE__, TMC_SW_MISO) #endif -#if defined(TMC_SW_MOSI) && TMC_SW_MOSI >= 0 +#if _EXISTS(TMC_SW_MOSI) REPORT_NAME_DIGITAL(__LINE__, TMC_SW_MOSI) #endif -#if defined(TMC_SW_SCK) && TMC_SW_SCK >= 0 +#if _EXISTS(TMC_SW_SCK) REPORT_NAME_DIGITAL(__LINE__, TMC_SW_SCK) #endif -#if defined(TFTGLCD_CS) && TFTGLCD_CS >= 0 +#if _EXISTS(TFTGLCD_CS) REPORT_NAME_DIGITAL(__LINE__, TFTGLCD_CS) #endif #if PIN_EXISTS(E_MUX0) @@ -557,71 +601,71 @@ #if PIN_EXISTS(E7_STEP) REPORT_NAME_DIGITAL(__LINE__, E7_STEP_PIN) #endif -#if defined(ENET_CRS) && ENET_CRS >= 0 +#if _EXISTS(ENET_CRS) REPORT_NAME_DIGITAL(__LINE__, ENET_CRS) #endif -#if defined(ENET_MDIO) && ENET_MDIO >= 0 +#if _EXISTS(ENET_MDIO) REPORT_NAME_DIGITAL(__LINE__, ENET_MDIO) #endif -#if defined(ENET_MOC) && ENET_MOC >= 0 +#if _EXISTS(ENET_MOC) REPORT_NAME_DIGITAL(__LINE__, ENET_MOC) #endif -#if defined(ENET_RX_ER) && ENET_RX_ER >= 0 +#if _EXISTS(ENET_RX_ER) REPORT_NAME_DIGITAL(__LINE__, ENET_RX_ER) #endif -#if defined(ENET_RXD0) && ENET_RXD0 >= 0 +#if _EXISTS(ENET_RXD0) REPORT_NAME_DIGITAL(__LINE__, ENET_RXD0) #endif -#if defined(ENET_RXD1) && ENET_RXD1 >= 0 +#if _EXISTS(ENET_RXD1) REPORT_NAME_DIGITAL(__LINE__, ENET_RXD1) #endif -#if defined(ENET_TX_EN) && ENET_TX_EN >= 0 +#if _EXISTS(ENET_TX_EN) REPORT_NAME_DIGITAL(__LINE__, ENET_TX_EN) #endif -#if defined(ENET_TXD0) && ENET_TXD0 >= 0 +#if _EXISTS(ENET_TXD0) REPORT_NAME_DIGITAL(__LINE__, ENET_TXD0) #endif -#if defined(ENET_TXD1) && ENET_TXD1 >= 0 +#if _EXISTS(ENET_TXD1) REPORT_NAME_DIGITAL(__LINE__, ENET_TXD1) #endif #if PIN_EXISTS(EXP_VOLTAGE_LEVEL) REPORT_NAME_DIGITAL(__LINE__, EXP_VOLTAGE_LEVEL_PIN) #endif -#if defined(EXT_AUX_A0_IO) && EXT_AUX_A0_IO >= 0 +#if _EXISTS(EXT_AUX_A0_IO) REPORT_NAME_DIGITAL(__LINE__, EXT_AUX_A0_IO) #endif -#if defined(EXT_AUX_A1_IO) && EXT_AUX_A1_IO >= 0 +#if _EXISTS(EXT_AUX_A1_IO) REPORT_NAME_DIGITAL(__LINE__, EXT_AUX_A1_IO) #endif -#if defined(EXT_AUX_A2_IO) && EXT_AUX_A2_IO >= 0 +#if _EXISTS(EXT_AUX_A2_IO) REPORT_NAME_DIGITAL(__LINE__, EXT_AUX_A2_IO) #endif -#if defined(EXT_AUX_A3_IO) && EXT_AUX_A3_IO >= 0 +#if _EXISTS(EXT_AUX_A3_IO) REPORT_NAME_DIGITAL(__LINE__, EXT_AUX_A3_IO) #endif -#if defined(EXT_AUX_A4_IO) && EXT_AUX_A4_IO >= 0 +#if _EXISTS(EXT_AUX_A4_IO) REPORT_NAME_DIGITAL(__LINE__, EXT_AUX_A4_IO) #endif -#if defined(EXT_AUX_PWM_D24) && EXT_AUX_PWM_D24 >= 0 +#if _EXISTS(EXT_AUX_PWM_D24) REPORT_NAME_DIGITAL(__LINE__, EXT_AUX_PWM_D24) #endif -#if defined(EXT_AUX_RX1_D2) && EXT_AUX_RX1_D2 >= 0 +#if _EXISTS(EXT_AUX_RX1_D2) REPORT_NAME_DIGITAL(__LINE__, EXT_AUX_RX1_D2) #endif -#if defined(EXT_AUX_SCL_D0) && EXT_AUX_SCL_D0 >= 0 +#if _EXISTS(EXT_AUX_SCL_D0) REPORT_NAME_DIGITAL(__LINE__, EXT_AUX_SCL_D0) #endif -#if defined(EXT_AUX_SDA_D1) && EXT_AUX_SDA_D1 >= 0 +#if _EXISTS(EXT_AUX_SDA_D1) REPORT_NAME_DIGITAL(__LINE__, EXT_AUX_SDA_D1) #endif -#if defined(EXT_AUX_TX1_D3) && EXT_AUX_TX1_D3 >= 0 +#if _EXISTS(EXT_AUX_TX1_D3) REPORT_NAME_DIGITAL(__LINE__, EXT_AUX_TX1_D3) #endif -#if defined(EXTRUDER_0_AUTO_FAN) && EXTRUDER_0_AUTO_FAN >= 0 +#if _EXISTS(EXTRUDER_0_AUTO_FAN) REPORT_NAME_DIGITAL(__LINE__, EXTRUDER_0_AUTO_FAN) #endif -#if defined(EXTRUDER_1_AUTO_FAN) && EXTRUDER_1_AUTO_FAN >= 0 +#if _EXISTS(EXTRUDER_1_AUTO_FAN) REPORT_NAME_DIGITAL(__LINE__, EXTRUDER_1_AUTO_FAN) #endif #if PIN_EXISTS(FAN) @@ -735,25 +779,25 @@ #if PIN_EXISTS(LCD_BACKLIGHT) REPORT_NAME_DIGITAL(__LINE__, LCD_BACKLIGHT_PIN) #endif -#if defined(LCD_PINS_D4) && LCD_PINS_D4 >= 0 +#if _EXISTS(LCD_PINS_D4) REPORT_NAME_DIGITAL(__LINE__, LCD_PINS_D4) #endif -#if defined(LCD_PINS_D5) && LCD_PINS_D5 >= 0 +#if _EXISTS(LCD_PINS_D5) REPORT_NAME_DIGITAL(__LINE__, LCD_PINS_D5) #endif -#if defined(LCD_PINS_D6) && LCD_PINS_D6 >= 0 +#if _EXISTS(LCD_PINS_D6) REPORT_NAME_DIGITAL(__LINE__, LCD_PINS_D6) #endif -#if defined(LCD_PINS_D7) && LCD_PINS_D7 >= 0 +#if _EXISTS(LCD_PINS_D7) REPORT_NAME_DIGITAL(__LINE__, LCD_PINS_D7) #endif -#if defined(LCD_PINS_ENABLE) && LCD_PINS_ENABLE >= 0 +#if _EXISTS(LCD_PINS_ENABLE) REPORT_NAME_DIGITAL(__LINE__, LCD_PINS_ENABLE) #endif -#if defined(LCD_PINS_RS) && LCD_PINS_RS >= 0 +#if _EXISTS(LCD_PINS_RS) REPORT_NAME_DIGITAL(__LINE__, LCD_PINS_RS) #endif -#if defined(LCD_SDSS) && LCD_SDSS >= 0 +#if _EXISTS(LCD_SDSS) REPORT_NAME_DIGITAL(__LINE__, LCD_SDSS) #endif #if PIN_EXISTS(LED_GREEN) @@ -799,9 +843,9 @@ REPORT_NAME_DIGITAL(__LINE__, MAX7219_LOAD_PIN) #endif -// #if defined(MISO) && MISO >= 0 -// REPORT_NAME_DIGITAL(__LINE__, MISO) -// #endif +//#if _EXISTS(MISO) +// REPORT_NAME_DIGITAL(__LINE__, MISO) +//#endif #if PIN_EXISTS(MISO) REPORT_NAME_DIGITAL(__LINE__, SD_MISO_PIN) #endif @@ -817,9 +861,9 @@ #if PIN_EXISTS(MOSFET_D) REPORT_NAME_DIGITAL(__LINE__, MOSFET_D_PIN) #endif -// #if defined(MOSI) && MOSI >= 0 -// REPORT_NAME_DIGITAL(__LINE__, MOSI) -// #endif +//#if _EXISTS(MOSI) +// REPORT_NAME_DIGITAL(__LINE__, MOSI) +//#endif #if PIN_EXISTS(MOSI) REPORT_NAME_DIGITAL(__LINE__, SD_MOSI_PIN) #endif @@ -862,7 +906,7 @@ #if PIN_EXISTS(PWM_2) REPORT_NAME_DIGITAL(__LINE__, PWM_2_PIN) #endif -#if defined(REF_CLK) && REF_CLK >= 0 +#if _EXISTS(REF_CLK) REPORT_NAME_DIGITAL(__LINE__, REF_CLK) #endif #if PIN_EXISTS(RAMPS_D10) @@ -898,28 +942,28 @@ #if PIN_EXISTS(SAFETY_TRIGGERED) REPORT_NAME_DIGITAL(__LINE__, SAFETY_TRIGGERED_PIN) #endif -// #if defined(SCK) && SCK >= 0 -// REPORT_NAME_DIGITAL(__LINE__, SCK) -// #endif +//#if _EXISTS(SCK) +// REPORT_NAME_DIGITAL(__LINE__, SCK) +//#endif #if PIN_EXISTS(SCK) REPORT_NAME_DIGITAL(__LINE__, SD_SCK_PIN) #endif -// #if defined(SCL) && SCL >= 0 -// REPORT_NAME_DIGITAL(__LINE__, SCL) -// #endif +//#if _EXISTS(SCL) +// REPORT_NAME_DIGITAL(__LINE__, SCL) +//#endif #if PIN_EXISTS(SD_DETECT) REPORT_NAME_DIGITAL(__LINE__, SD_DETECT_PIN) #endif -// #if defined(SDA) && SDA >= 0 -// REPORT_NAME_DIGITAL(__LINE__, SDA) -// #endif +//#if _EXISTS(SDA) +// REPORT_NAME_DIGITAL(__LINE__, SDA) +//#endif #if PIN_EXISTS(SDPOWER) REPORT_NAME_DIGITAL(__LINE__, SDPOWER_PIN) #endif -#if defined(SDSS) && SDSS >= 0 +#if _EXISTS(SDSS) REPORT_NAME_DIGITAL(__LINE__, SDSS) #endif -#if defined(SERVO0) && SERVO0 >= 0 +#if _EXISTS(SERVO0) REPORT_NAME_DIGITAL(__LINE__, SERVO0) #endif #if PIN_EXISTS(SERVO0) @@ -976,7 +1020,7 @@ #if PIN_EXISTS(SOL7) REPORT_NAME_DIGITAL(__LINE__, SOL7_PIN) #endif -#if defined(SPARE_IO) && SPARE_IO >= 0 +#if _EXISTS(SPARE_IO) REPORT_NAME_DIGITAL(__LINE__, SPARE_IO) #endif #if PIN_EXISTS(SPI_EEPROM1_CS) @@ -1015,7 +1059,7 @@ #if PIN_EXISTS(STAT_LED_BLUE) REPORT_NAME_DIGITAL(__LINE__, STAT_LED_BLUE_PIN) #endif -#if defined(STAT_LED_RED_LED) && STAT_LED_RED_LED >= 0 +#if _EXISTS(STAT_LED_RED_LED) REPORT_NAME_DIGITAL(__LINE__, STAT_LED_RED_LED) #endif #if PIN_EXISTS(STAT_LED_RED) @@ -1069,13 +1113,13 @@ #if PIN_EXISTS(TX_ENABLE) REPORT_NAME_DIGITAL(__LINE__, TX_ENABLE_PIN) #endif -#if defined(UI1) && UI1 >= 0 +#if _EXISTS(UI1) REPORT_NAME_DIGITAL(__LINE__, UI1) #endif -#if defined(UI2) && UI2 >= 0 +#if _EXISTS(UI2) REPORT_NAME_DIGITAL(__LINE__, UI2) #endif -#if defined(UNUSED_PWM) && UNUSED_PWM >= 0 +#if _EXISTS(UNUSED_PWM) REPORT_NAME_DIGITAL(__LINE__, UNUSED_PWM) #endif #if PIN_EXISTS(X_ATT) From 1f3f9cb68ce9c9adad55a98ccea07e491d7b9785 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 19 Oct 2021 05:52:41 -0500 Subject: [PATCH 028/125] =?UTF-8?q?=F0=9F=8E=A8=20Pragma=20GCC=20cleanup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/AVR/HAL.h | 6 ++---- Marlin/src/HAL/DUE/HAL.h | 6 ++---- Marlin/src/HAL/ESP32/HAL.h | 6 ++---- Marlin/src/HAL/LINUX/HAL.h | 6 ++---- Marlin/src/HAL/LPC1768/HAL.h | 6 ++---- Marlin/src/HAL/SAMD51/HAL.h | 6 ++---- Marlin/src/HAL/TEENSY31_32/HAL.h | 6 ++---- Marlin/src/HAL/TEENSY35_36/HAL.h | 6 ++---- Marlin/src/HAL/TEENSY40_41/HAL.h | 6 ++---- Marlin/src/lcd/dogm/status_screen_DOGM.cpp | 6 ++---- .../lcd/extui/ftdi_eve_touch_ui/generic/string_format.cpp | 6 ++---- Marlin/src/libs/duration_t.h | 6 ++---- Marlin/src/module/endstops.cpp | 6 ++---- 13 files changed, 26 insertions(+), 52 deletions(-) diff --git a/Marlin/src/HAL/AVR/HAL.h b/Marlin/src/HAL/AVR/HAL.h index a22daf9b5c..ecb566ed46 100644 --- a/Marlin/src/HAL/AVR/HAL.h +++ b/Marlin/src/HAL/AVR/HAL.h @@ -157,16 +157,14 @@ inline uint8_t HAL_get_reset_source() { return MCUSR; } void HAL_reboot(); +#pragma GCC diagnostic push #if GCC_VERSION <= 50000 - #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-function" #endif extern "C" int freeMemory(); -#if GCC_VERSION <= 50000 - #pragma GCC diagnostic pop -#endif +#pragma GCC diagnostic pop // ADC #ifdef DIDR2 diff --git a/Marlin/src/HAL/DUE/HAL.h b/Marlin/src/HAL/DUE/HAL.h index 92e26bcf43..fb90c40aa7 100644 --- a/Marlin/src/HAL/DUE/HAL.h +++ b/Marlin/src/HAL/DUE/HAL.h @@ -168,16 +168,14 @@ void HAL_init(); // void _delay_ms(const int delay); +#pragma GCC diagnostic push #if GCC_VERSION <= 50000 - #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-function" #endif int freeMemory(); -#if GCC_VERSION <= 50000 - #pragma GCC diagnostic pop -#endif +#pragma GCC diagnostic pop #ifdef __cplusplus extern "C" { diff --git a/Marlin/src/HAL/ESP32/HAL.h b/Marlin/src/HAL/ESP32/HAL.h index bc0ce4e037..8a8f6df640 100644 --- a/Marlin/src/HAL/ESP32/HAL.h +++ b/Marlin/src/HAL/ESP32/HAL.h @@ -105,16 +105,14 @@ void HAL_reboot(); void _delay_ms(int delay); +#pragma GCC diagnostic push #if GCC_VERSION <= 50000 - #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-function" #endif int freeMemory(); -#if GCC_VERSION <= 50000 - #pragma GCC diagnostic pop -#endif +#pragma GCC diagnostic pop void analogWrite(pin_t pin, int value); diff --git a/Marlin/src/HAL/LINUX/HAL.h b/Marlin/src/HAL/LINUX/HAL.h index 79639f4993..b80fe210f8 100644 --- a/Marlin/src/HAL/LINUX/HAL.h +++ b/Marlin/src/HAL/LINUX/HAL.h @@ -79,16 +79,14 @@ extern MSerialT usb_serial; inline void HAL_init() {} // Utility functions +#pragma GCC diagnostic push #if GCC_VERSION <= 50000 - #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-function" #endif int freeMemory(); -#if GCC_VERSION <= 50000 - #pragma GCC diagnostic pop -#endif +#pragma GCC diagnostic pop // ADC #define HAL_ADC_VREF 5.0 diff --git a/Marlin/src/HAL/LPC1768/HAL.h b/Marlin/src/HAL/LPC1768/HAL.h index f241249804..348ea6b21a 100644 --- a/Marlin/src/HAL/LPC1768/HAL.h +++ b/Marlin/src/HAL/LPC1768/HAL.h @@ -123,16 +123,14 @@ extern DefaultSerial1 USBSerial; // // Utility functions // +#pragma GCC diagnostic push #if GCC_VERSION <= 50000 - #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-function" #endif int freeMemory(); -#if GCC_VERSION <= 50000 - #pragma GCC diagnostic pop -#endif +#pragma GCC diagnostic pop // // ADC API diff --git a/Marlin/src/HAL/SAMD51/HAL.h b/Marlin/src/HAL/SAMD51/HAL.h index 491c3f82c4..775a9240e1 100644 --- a/Marlin/src/HAL/SAMD51/HAL.h +++ b/Marlin/src/HAL/SAMD51/HAL.h @@ -153,16 +153,14 @@ void HAL_idletask(); // FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); } +#pragma GCC diagnostic push #if GCC_VERSION <= 50000 - #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-function" #endif int freeMemory(); -#if GCC_VERSION <= 50000 - #pragma GCC diagnostic pop -#endif +#pragma GCC diagnostic pop #ifdef __cplusplus extern "C" { diff --git a/Marlin/src/HAL/TEENSY31_32/HAL.h b/Marlin/src/HAL/TEENSY31_32/HAL.h index aa195845fb..7235f5ef0e 100644 --- a/Marlin/src/HAL/TEENSY31_32/HAL.h +++ b/Marlin/src/HAL/TEENSY31_32/HAL.h @@ -98,16 +98,14 @@ void HAL_reboot(); FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); } +#pragma GCC diagnostic push #if GCC_VERSION <= 50000 - #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-function" #endif extern "C" int freeMemory(); -#if GCC_VERSION <= 50000 - #pragma GCC diagnostic pop -#endif +#pragma GCC diagnostic pop // ADC diff --git a/Marlin/src/HAL/TEENSY35_36/HAL.h b/Marlin/src/HAL/TEENSY35_36/HAL.h index 0093294a2a..8892ffec45 100644 --- a/Marlin/src/HAL/TEENSY35_36/HAL.h +++ b/Marlin/src/HAL/TEENSY35_36/HAL.h @@ -105,16 +105,14 @@ void HAL_reboot(); FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); } +#pragma GCC diagnostic push #if GCC_VERSION <= 50000 - #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-function" #endif extern "C" int freeMemory(); -#if GCC_VERSION <= 50000 - #pragma GCC diagnostic pop -#endif +#pragma GCC diagnostic pop // ADC diff --git a/Marlin/src/HAL/TEENSY40_41/HAL.h b/Marlin/src/HAL/TEENSY40_41/HAL.h index ea51f15ba1..c9716eacde 100644 --- a/Marlin/src/HAL/TEENSY40_41/HAL.h +++ b/Marlin/src/HAL/TEENSY40_41/HAL.h @@ -125,16 +125,14 @@ void HAL_reboot(); FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); } +#pragma GCC diagnostic push #if GCC_VERSION <= 50000 - #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-function" #endif extern "C" uint32_t freeMemory(); -#if GCC_VERSION <= 50000 - #pragma GCC diagnostic pop -#endif +#pragma GCC diagnostic pop // ADC diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp index 847c13d3ac..52554e5df8 100644 --- a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp +++ b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp @@ -862,17 +862,15 @@ void MarlinUI::draw_status_screen() { mix_label = PSTR("Mx"); } + #pragma GCC diagnostic push #if GCC_VERSION <= 50000 - #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-overflow" #endif sprintf_P(mixer_messages, PSTR(S_FMT " %d;%d%% "), mix_label, int(mixer.mix[0]), int(mixer.mix[1])); lcd_put_u8str(X_LABEL_POS, XYZ_BASELINE, mixer_messages); - #if GCC_VERSION <= 50000 - #pragma GCC diagnostic pop - #endif + #pragma GCC diagnostic pop #else diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/string_format.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/string_format.cpp index ed24a9d9ed..a952028277 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/string_format.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/string_format.cpp @@ -27,8 +27,8 @@ #define ROUND(val) uint16_t((val)+0.5) +#pragma GCC diagnostic push #if GCC_VERSION <= 50000 - #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wno-format" #endif @@ -105,8 +105,6 @@ void format_position(char *str, float x, float y, float z) { sprintf_P(str, PSTR("%s; %s; %s " S_FMT), num1, num2, num3, GET_TEXT(MSG_UNITS_MM)); } -#if GCC_VERSION <= 50000 - #pragma GCC diagnostic pop -#endif +#pragma GCC diagnostic pop #endif // TOUCH_UI_FTDI_EVE diff --git a/Marlin/src/libs/duration_t.h b/Marlin/src/libs/duration_t.h index 4d722a296c..2528bcdbff 100644 --- a/Marlin/src/libs/duration_t.h +++ b/Marlin/src/libs/duration_t.h @@ -106,8 +106,8 @@ struct duration_t { return this->value; } + #pragma GCC diagnostic push #if GCC_VERSION <= 50000 - #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-overflow" #endif @@ -170,7 +170,5 @@ struct duration_t { } } - #if GCC_VERSION <= 50000 - #pragma GCC diagnostic pop - #endif + #pragma GCC diagnostic pop }; diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index da5a0073cf..332becfb73 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -478,8 +478,8 @@ void Endstops::event_handler() { } } +#pragma GCC diagnostic push #if GCC_VERSION <= 50000 - #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-function" #endif @@ -489,9 +489,7 @@ static void print_es_state(const bool is_hit, FSTR_P const flabel=nullptr) { SERIAL_ECHOLNF(is_hit ? F(STR_ENDSTOP_HIT) : F(STR_ENDSTOP_OPEN)); } -#if GCC_VERSION <= 50000 - #pragma GCC diagnostic pop -#endif +#pragma GCC diagnostic pop void _O2 Endstops::report_states() { TERN_(BLTOUCH, bltouch._set_SW_mode()); From b69971f06aed8e2811ffcede0f153251f06775dc Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 19 Oct 2021 05:53:34 -0500 Subject: [PATCH 029/125] =?UTF-8?q?=F0=9F=94=A8=20Fix=20older=20GCC=20CXXF?= =?UTF-8?q?LAGS=20warning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/share/PlatformIO/scripts/common-cxxflags.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/buildroot/share/PlatformIO/scripts/common-cxxflags.py b/buildroot/share/PlatformIO/scripts/common-cxxflags.py index 856a246fba..26bff515a6 100644 --- a/buildroot/share/PlatformIO/scripts/common-cxxflags.py +++ b/buildroot/share/PlatformIO/scripts/common-cxxflags.py @@ -3,13 +3,16 @@ # Convenience script to apply customizations to CPP flags # Import("env") -env.Append(CXXFLAGS=[ - "-Wno-register" + +cxxflags = [ #"-Wno-incompatible-pointer-types", #"-Wno-unused-const-variable", #"-Wno-maybe-uninitialized", #"-Wno-sign-compare" -]) +] +if "teensy" not in env['PIOENV']: + cxxflags += ["-Wno-register"] +env.Append(CXXFLAGS=cxxflags) # # Add CPU frequency as a compile time constant instead of a runtime variable From 5f7c92dfbb0af65610d88ea48d48f00fd04505c2 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 19 Oct 2021 05:59:48 -0500 Subject: [PATCH 030/125] =?UTF-8?q?=F0=9F=8E=A8=20Refactor=20MOSFET=20pins?= =?UTF-8?q?=20layout=20(#22983)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/SanityCheck.h | 2 + Marlin/src/pins/linux/pins_RAMPS_LINUX.h | 71 +++++++---------- Marlin/src/pins/lpc1768/pins_AZSMZ_MINI.h | 4 +- Marlin/src/pins/lpc1768/pins_MKS_SBASE.h | 4 +- Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h | 77 ++++++++----------- Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h | 62 ++++++--------- Marlin/src/pins/pins.h | 20 +++-- Marlin/src/pins/pinsDebug_list.h | 9 --- Marlin/src/pins/ramps/pins_3DRAG.h | 4 +- Marlin/src/pins/ramps/pins_BQ_ZUM_MEGA_3D.h | 6 +- Marlin/src/pins/ramps/pins_FORMBOT_RAPTOR.h | 17 ---- .../src/pins/ramps/pins_FORMBOT_TREX2PLUS.h | 17 ---- Marlin/src/pins/ramps/pins_K8600.h | 1 - Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h | 1 - Marlin/src/pins/ramps/pins_RAMPS.h | 71 +++++++---------- Marlin/src/pins/ramps/pins_RAMPS_ENDER_4.h | 2 +- Marlin/src/pins/ramps/pins_RAMPS_PLUS.h | 4 +- Marlin/src/pins/ramps/pins_RIGIDBOARD.h | 4 +- Marlin/src/pins/ramps/pins_SAINSMART_2IN1.h | 8 +- Marlin/src/pins/ramps/pins_TRIGORILLA_13.h | 3 +- Marlin/src/pins/ramps/pins_TRIGORILLA_14.h | 72 ++++++++--------- Marlin/src/pins/ramps/pins_VORON.h | 2 +- Marlin/src/pins/ramps/pins_ZRIB_V52.h | 3 +- 23 files changed, 175 insertions(+), 289 deletions(-) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 7d1629a67e..4259bf5271 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -595,6 +595,8 @@ #error "ARC_SUPPORT now requires MIN_ARC_SEGMENT_MM and MAX_ARC_SEGMENT_MM." #elif defined(SPINDLE_LASER_PWM) #error "SPINDLE_LASER_PWM (true) is now set with SPINDLE_LASER_USE_PWM (enabled)." +#elif ANY(IS_RAMPS_EEB, IS_RAMPS_EEF, IS_RAMPS_EFB, IS_RAMPS_EFF, IS_RAMPS_SF) + #error "The IS_RAMPS_* conditionals (for heater/fan/bed pins) are now called FET_ORDER_*." #endif #if MB(DUE3DOM_MINI) && PIN_EXISTS(TEMP_2) && DISABLED(TEMP_SENSOR_BOARD) diff --git a/Marlin/src/pins/linux/pins_RAMPS_LINUX.h b/Marlin/src/pins/linux/pins_RAMPS_LINUX.h index 04f9afaad2..20bd5ef8cc 100644 --- a/Marlin/src/pins/linux/pins_RAMPS_LINUX.h +++ b/Marlin/src/pins/linux/pins_RAMPS_LINUX.h @@ -57,8 +57,6 @@ #define MARLIN_EEPROM_SIZE 0x1000 // 4KB #endif -#define IS_RAMPS_EFB - // // Servos // @@ -144,58 +142,41 @@ #define TEMP_0_CS_PIN 66 // Don't use 49 (SD_DETECT_PIN) #endif -// -// Augmentation for auto-assigning RAMPS plugs -// -#if NONE(IS_RAMPS_EEB, IS_RAMPS_EEF, IS_RAMPS_EFB, IS_RAMPS_EFF, IS_RAMPS_SF) && !PIN_EXISTS(MOSFET_D) - #if HAS_MULTI_HOTEND - #if TEMP_SENSOR_BED - #define IS_RAMPS_EEB - #else - #define IS_RAMPS_EEF - #endif - #elif TEMP_SENSOR_BED - #define IS_RAMPS_EFB - #else - #define IS_RAMPS_EFF - #endif -#endif - // // Heaters / Fans // +#ifndef MOSFET_A_PIN + #define MOSFET_A_PIN 10 +#endif +#ifndef MOSFET_B_PIN + #define MOSFET_B_PIN 9 +#endif +#ifndef MOSFET_C_PIN + #define MOSFET_C_PIN 8 +#endif #ifndef MOSFET_D_PIN #define MOSFET_D_PIN -1 #endif -#ifndef RAMPS_D8_PIN - #define RAMPS_D8_PIN 8 -#endif -#ifndef RAMPS_D9_PIN - #define RAMPS_D9_PIN 9 -#endif -#ifndef RAMPS_D10_PIN - #define RAMPS_D10_PIN 10 -#endif -#define HEATER_0_PIN RAMPS_D10_PIN +#define HEATER_0_PIN MOSFET_A_PIN -#if ENABLED(IS_RAMPS_EFB) // Hotend, Fan, Bed - #define FAN_PIN RAMPS_D9_PIN - #define HEATER_BED_PIN RAMPS_D8_PIN -#elif ENABLED(IS_RAMPS_EEF) // Hotend, Hotend, Fan - #define HEATER_1_PIN RAMPS_D9_PIN - #define FAN_PIN RAMPS_D8_PIN -#elif ENABLED(IS_RAMPS_EEB) // Hotend, Hotend, Bed - #define HEATER_1_PIN RAMPS_D9_PIN - #define HEATER_BED_PIN RAMPS_D8_PIN -#elif ENABLED(IS_RAMPS_EFF) // Hotend, Fan, Fan - #define FAN_PIN RAMPS_D9_PIN - #define FAN1_PIN RAMPS_D8_PIN -#elif ENABLED(IS_RAMPS_SF) // Spindle, Fan - #define FAN_PIN RAMPS_D8_PIN +#if FET_ORDER_EFB // Hotend, Fan, Bed + #define FAN_PIN MOSFET_B_PIN + #define HEATER_BED_PIN MOSFET_C_PIN +#elif FET_ORDER_EEF // Hotend, Hotend, Fan + #define HEATER_1_PIN MOSFET_B_PIN + #define FAN_PIN MOSFET_C_PIN +#elif FET_ORDER_EEB // Hotend, Hotend, Bed + #define HEATER_1_PIN MOSFET_B_PIN + #define HEATER_BED_PIN MOSFET_C_PIN +#elif FET_ORDER_EFF // Hotend, Fan, Fan + #define FAN_PIN MOSFET_B_PIN + #define FAN1_PIN MOSFET_C_PIN +#elif FET_ORDER_SF // Spindle, Fan + #define FAN_PIN MOSFET_C_PIN #else // Non-specific are "EFB" (i.e., "EFBF" or "EFBE") - #define FAN_PIN RAMPS_D9_PIN - #define HEATER_BED_PIN RAMPS_D8_PIN + #define FAN_PIN MOSFET_B_PIN + #define HEATER_BED_PIN MOSFET_C_PIN #if HOTENDS == 1 && DISABLED(HEATERS_PARALLEL) #define FAN1_PIN MOSFET_D_PIN #else diff --git a/Marlin/src/pins/lpc1768/pins_AZSMZ_MINI.h b/Marlin/src/pins/lpc1768/pins_AZSMZ_MINI.h index ff36796207..4d1dbecf2e 100644 --- a/Marlin/src/pins/lpc1768/pins_AZSMZ_MINI.h +++ b/Marlin/src/pins/lpc1768/pins_AZSMZ_MINI.h @@ -145,9 +145,9 @@ * PWM1.4 DIO53 SDSS(SSEL0) J3-5 AUX-3 * PWM1.4 DIO46 Z_STEP_PIN * PWM1.5 DIO3 X_MIN_PIN 10K PULLUP TO 3.3v, 1K SERIES - * PWM1.5 DIO9 RAMPS_D9_PIN + * PWM1.5 DIO9 MOSFET_B_PIN * PWM1.6 DIO14 Y_MIN_PIN 10K PULLUP TO 3.3v, 1K SERIES - * PWM1.6 DIO10 RAMPS_D10_PIN + * PWM1.6 DIO10 MOSFET_A_PIN */ /** diff --git a/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h b/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h index 258ecd107b..406e65d295 100644 --- a/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h +++ b/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h @@ -363,9 +363,9 @@ * PWM1.4 P1_23 SDSS(SSEL0) J3-5 AUX-3 * PWM1.4 P2_03 Z_STEP_PIN * PWM1.5 P1_24 X_MIN_PIN 10K PULLUP TO 3.3v, 1K SERIES - * PWM1.5 P2_04 RAMPS_D9_PIN + * PWM1.5 P2_04 MOSFET_B_PIN * PWM1.6 P1_26 Y_MIN_PIN 10K PULLUP TO 3.3v, 1K SERIES - * PWM1.6 P2_05 RAMPS_D10_PIN + * PWM1.6 P2_05 MOSFET_A_PIN */ /** diff --git a/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h b/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h index ce5d5ad7c6..934b74cbb1 100644 --- a/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h +++ b/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h @@ -168,52 +168,35 @@ //#define ?? P0_03_A6 // A6 - ( 0) - RXD0 - J4-4 & AUX-1 #define FILWIDTH_PIN P0_02_A7 // A7 - ( 1) - TXD0 - J4-5 & AUX-1 -// -// Augmentation for auto-assigning RAMPS plugs -// -#if NONE(IS_RAMPS_EEB, IS_RAMPS_EEF, IS_RAMPS_EFB, IS_RAMPS_EFF, IS_RAMPS_SF) && !PIN_EXISTS(MOSFET_D) - #if HAS_MULTI_HOTEND - #if TEMP_SENSOR_BED - #define IS_RAMPS_EEB - #else - #define IS_RAMPS_EEF - #endif - #elif TEMP_SENSOR_BED - #define IS_RAMPS_EFB - #else - #define IS_RAMPS_EFF - #endif -#endif - // // Heaters / Fans // +#ifndef MOSFET_A_PIN + #define MOSFET_A_PIN P2_05 +#endif +#ifndef MOSFET_B_PIN + #define MOSFET_B_PIN P2_04 +#endif +#ifndef MOSFET_C_PIN + #define MOSFET_C_PIN P2_07 +#endif #ifndef MOSFET_D_PIN #define MOSFET_D_PIN -1 #endif -#ifndef RAMPS_D8_PIN - #define RAMPS_D8_PIN P2_07 // (8) -#endif -#ifndef RAMPS_D9_PIN - #define RAMPS_D9_PIN P2_04 // (9) -#endif -#ifndef RAMPS_D10_PIN - #define RAMPS_D10_PIN P2_05 // (10) -#endif -#define HEATER_0_PIN RAMPS_D10_PIN +#define HEATER_0_PIN MOSFET_A_PIN -#if ENABLED(IS_RAMPS_EFB) // Hotend, Fan, Bed - #define HEATER_BED_PIN RAMPS_D8_PIN -#elif ENABLED(IS_RAMPS_EEF) // Hotend, Hotend, Fan - #define HEATER_1_PIN RAMPS_D9_PIN -#elif ENABLED(IS_RAMPS_EEB) // Hotend, Hotend, Bed - #define HEATER_1_PIN RAMPS_D9_PIN - #define HEATER_BED_PIN RAMPS_D8_PIN -#elif ENABLED(IS_RAMPS_EFF) // Hotend, Fan, Fan - #define FAN1_PIN RAMPS_D8_PIN -#elif DISABLED(IS_RAMPS_SF) // Not Spindle, Fan (i.e., "EFBF" or "EFBE") - #define HEATER_BED_PIN RAMPS_D8_PIN +#if FET_ORDER_EFB // Hotend, Fan, Bed + #define HEATER_BED_PIN MOSFET_C_PIN +#elif FET_ORDER_EEF // Hotend, Hotend, Fan + #define HEATER_1_PIN MOSFET_B_PIN +#elif FET_ORDER_EEB // Hotend, Hotend, Bed + #define HEATER_1_PIN MOSFET_B_PIN + #define HEATER_BED_PIN MOSFET_C_PIN +#elif FET_ORDER_EFF // Hotend, Fan, Fan + #define FAN1_PIN MOSFET_C_PIN +#elif DISABLED(FET_ORDER_SF) // Not Spindle, Fan (i.e., "EFBF" or "EFBE") + #define HEATER_BED_PIN MOSFET_C_PIN #if HOTENDS == 1 && DISABLED(HEATERS_PARALLEL) #define FAN1_PIN MOSFET_D_PIN #else @@ -222,14 +205,14 @@ #endif #ifndef FAN_PIN - #if EITHER(IS_RAMPS_EFB, IS_RAMPS_EFF) // Hotend, Fan, Bed or Hotend, Fan, Fan - #define FAN_PIN RAMPS_D9_PIN - #elif EITHER(IS_RAMPS_EEF, IS_RAMPS_SF) // Hotend, Hotend, Fan or Spindle, Fan - #define FAN_PIN RAMPS_D8_PIN - #elif ENABLED(IS_RAMPS_EEB) // Hotend, Hotend, Bed + #if EITHER(FET_ORDER_EFB, FET_ORDER_EFF) // Hotend, Fan, Bed or Hotend, Fan, Fan + #define FAN_PIN MOSFET_B_PIN + #elif EITHER(FET_ORDER_EEF, FET_ORDER_SF) // Hotend, Hotend, Fan or Spindle, Fan + #define FAN_PIN MOSFET_C_PIN + #elif FET_ORDER_EEB // Hotend, Hotend, Bed #define FAN_PIN P1_18 // (4) IO pin. Buffer needed #else // Non-specific are "EFB" (i.e., "EFBF" or "EFBE") - #define FAN_PIN RAMPS_D9_PIN + #define FAN_PIN MOSFET_B_PIN #endif #endif @@ -484,14 +467,14 @@ * All Fast PWMs have a 50Hz rate. * * The following pins/signals use the direct method. All other pins use the - * the interrupt method. Note that SERVO2_PIN and RAMPS_D8_PIN use the + * the interrupt method. Note that SERVO2_PIN and MOSFET_C_PIN use the * interrupt method. * * P1_20 (11) SERVO0_PIN * P1_21 ( 6) SERVO1_PIN J5-1 * P0_18 ( 4) SERVO3_PIN 5V output - * *P2_04 ( 9) RAMPS_D9_PIN - * *P2_05 (10) RAMPS_D10_PIN + * *P2_04 ( 9) MOSFET_B_PIN + * *P2_05 (10) MOSFET_A_PIN * * * - If used as a heater driver then a Fast PWM is NOT assigned. If used as * a fan driver then enabling FAST_PWM_FAN assigns a Fast PWM to it. diff --git a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h index aea05134a8..d5122e46a9 100644 --- a/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h +++ b/Marlin/src/pins/mega/pins_MIGHTYBOARD_REVE.h @@ -151,54 +151,43 @@ // With no heated bed, an additional 24V fan is possible. // -// Labels from the schematic: -#define EX1_HEAT_PIN 6 // H3 -#define EX1_FAN_PIN 7 // H4 -#define EX2_HEAT_PIN 11 // B5 -#define EX2_FAN_PIN 12 // B6 -#define HBP_PIN 45 // L4 -#define EXTRA_FET_PIN 44 // L5 - -#if HAS_MULTI_HOTEND - #if TEMP_SENSOR_BED - #define IS_EEB - #else - #define IS_EEF - #endif -#elif TEMP_SENSOR_BED - #define IS_EFB -#else - #define IS_EFF -#endif +#define MOSFET_A_PIN 6 // H3 EX1_HEAT_PIN +#define MOSFET_B_PIN 11 // B5 EX2_HEAT_PIN +#define MOSFET_C_PIN 45 // L4 HBP_PIN +#define MOSFET_D_PIN 44 // L5 EXTRA_FET_PIN // // Heaters / Fans (24V) // -#define HEATER_0_PIN EX1_HEAT_PIN +#define HEATER_0_PIN MOSFET_A_PIN -#if ENABLED(IS_EFB) // Hotend, Fan, Bed - #define HEATER_BED_PIN HBP_PIN -#elif ENABLED(IS_EEF) // Hotend, Hotend, Fan - #define HEATER_1_PIN EX2_HEAT_PIN -#elif ENABLED(IS_EEB) // Hotend, Hotend, Bed - #define HEATER_1_PIN EX2_HEAT_PIN - #define HEATER_BED_PIN HBP_PIN -#elif ENABLED(IS_EFF) // Hotend, Fan, Fan - #define FAN1_PIN HBP_PIN +#if FET_ORDER_EFB // Hotend, Fan, Bed + #define HEATER_BED_PIN MOSFET_C_PIN +#elif FET_ORDER_EEF // Hotend, Hotend, Fan + #define HEATER_1_PIN MOSFET_B_PIN +#elif FET_ORDER_EEB // Hotend, Hotend, Bed + #define HEATER_1_PIN MOSFET_B_PIN + #define HEATER_BED_PIN MOSFET_C_PIN +#elif FET_ORDER_EFF // Hotend, Fan, Fan + #define FAN1_PIN MOSFET_C_PIN #endif #ifndef FAN_PIN - #if EITHER(IS_EFB, IS_EFF) // Hotend, Fan, Bed or Hotend, Fan, Fan - #define FAN_PIN EX2_HEAT_PIN - #elif EITHER(IS_EEF, IS_SF) // Hotend, Hotend, Fan or Spindle, Fan - #define FAN_PIN HBP_PIN + #if EITHER(FET_ORDER_EFB, FET_ORDER_EFF) // Hotend, Fan, Bed or Hotend, Fan, Fan + #define FAN_PIN MOSFET_B_PIN + #elif EITHER(FET_ORDER_EEF, FET_ORDER_SF) // Hotend, Hotend, Fan or Spindle, Fan + #define FAN_PIN MOSFET_C_PIN #else - #define FAN_PIN EXTRA_FET_PIN + #define FAN_PIN MOSFET_D_PIN #endif #endif +#ifndef FAN1_PIN + #define FAN1_PIN 7 // H4 EX1_FAN_PIN +#endif + #ifndef CONTROLLER_FAN_PIN - #define CONTROLLER_FAN_PIN EX2_FAN_PIN + #define CONTROLLER_FAN_PIN 12 // B6 EX2_FAN_PIN #endif // @@ -268,9 +257,6 @@ #define SDSS 53 // B0 #define SD_DETECT_PIN 9 // H6 -// -// TMC 220x -// #if HAS_TMC_UART /** * TMC220x stepper drivers diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 6e5a2e51eb..8df379f853 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -38,15 +38,23 @@ #define MAX_E_STEPPERS 8 #if MB(RAMPS_13_EFB, RAMPS_14_EFB, RAMPS_PLUS_EFB, RAMPS_14_RE_ARM_EFB, RAMPS_SMART_EFB, RAMPS_DUO_EFB, RAMPS4DUE_EFB) - #define IS_RAMPS_EFB + #define FET_ORDER_EFB 1 #elif MB(RAMPS_13_EEB, RAMPS_14_EEB, RAMPS_PLUS_EEB, RAMPS_14_RE_ARM_EEB, RAMPS_SMART_EEB, RAMPS_DUO_EEB, RAMPS4DUE_EEB) - #define IS_RAMPS_EEB + #define FET_ORDER_EEB 1 #elif MB(RAMPS_13_EFF, RAMPS_14_EFF, RAMPS_PLUS_EFF, RAMPS_14_RE_ARM_EFF, RAMPS_SMART_EFF, RAMPS_DUO_EFF, RAMPS4DUE_EFF) - #define IS_RAMPS_EFF + #define FET_ORDER_EFF 1 #elif MB(RAMPS_13_EEF, RAMPS_14_EEF, RAMPS_PLUS_EEF, RAMPS_14_RE_ARM_EEF, RAMPS_SMART_EEF, RAMPS_DUO_EEF, RAMPS4DUE_EEF) - #define IS_RAMPS_EEF -#elif MB(RAMPS_13_SF, RAMPS_14_SF, RAMPS_PLUS_SF, RAMPS_14_RE_ARM_SF, RAMPS_SMART_SF, RAMPS_DUO_SF, RAMPS4DUE_SF) - #define IS_RAMPS_SF + #define FET_ORDER_EEF 1 +#elif MB(RAMPS_13_SF, RAMPS_14_SF, RAMPS_PLUS_SF, RAMPS_14_RE_ARM_SF, RAMPS_SMART_SF, RAMPS_DUO_SF, RAMPS4DUE_SF) || EITHER(SPINDLE_FEATURE, LASER_FEATURE) + #define FET_ORDER_SF 1 +#elif HAS_MULTI_HOTEND && TEMP_SENSOR_BED + #define FET_ORDER_EEB 1 +#elif HAS_MULTI_HOTEND + #define FET_ORDER_EEF 1 +#elif TEMP_SENSOR_BED + #define FET_ORDER_EFB 1 +#else + #define FET_ORDER_EFF 1 #endif #if !(BOTH(IS_ULTRA_LCD, IS_NEWPANEL) && ANY(PANEL_ONE, VIKI2, miniVIKI, WYH_L12864, MINIPANEL, REPRAPWORLD_KEYPAD)) diff --git a/Marlin/src/pins/pinsDebug_list.h b/Marlin/src/pins/pinsDebug_list.h index 8a4350d90e..f07b1cf025 100644 --- a/Marlin/src/pins/pinsDebug_list.h +++ b/Marlin/src/pins/pinsDebug_list.h @@ -909,15 +909,6 @@ #if _EXISTS(REF_CLK) REPORT_NAME_DIGITAL(__LINE__, REF_CLK) #endif -#if PIN_EXISTS(RAMPS_D10) - REPORT_NAME_DIGITAL(__LINE__, RAMPS_D10_PIN) -#endif -#if PIN_EXISTS(RAMPS_D8) - REPORT_NAME_DIGITAL(__LINE__, RAMPS_D8_PIN) -#endif -#if PIN_EXISTS(RAMPS_D9) - REPORT_NAME_DIGITAL(__LINE__, RAMPS_D9_PIN) -#endif #if PIN_EXISTS(NEOPIXEL) REPORT_NAME_DIGITAL(__LINE__, NEOPIXEL_PIN) #endif diff --git a/Marlin/src/pins/ramps/pins_3DRAG.h b/Marlin/src/pins/ramps/pins_3DRAG.h index 4ff6e2d7e5..48eeacd5c4 100644 --- a/Marlin/src/pins/ramps/pins_3DRAG.h +++ b/Marlin/src/pins/ramps/pins_3DRAG.h @@ -62,8 +62,8 @@ // // Heaters / Fans // -#define RAMPS_D8_PIN 9 -#define RAMPS_D9_PIN 8 +#define MOSFET_B_PIN 8 +#define MOSFET_C_PIN 9 #define MOSFET_D_PIN 12 // diff --git a/Marlin/src/pins/ramps/pins_BQ_ZUM_MEGA_3D.h b/Marlin/src/pins/ramps/pins_BQ_ZUM_MEGA_3D.h index 523ab7678f..4a54b85ae0 100644 --- a/Marlin/src/pins/ramps/pins_BQ_ZUM_MEGA_3D.h +++ b/Marlin/src/pins/ramps/pins_BQ_ZUM_MEGA_3D.h @@ -68,9 +68,9 @@ // // Heaters / Fans // -#define RAMPS_D8_PIN 10 -#define RAMPS_D9_PIN 12 -#define RAMPS_D10_PIN 9 +#define MOSFET_A_PIN 9 +#define MOSFET_B_PIN 12 +#define MOSFET_C_PIN 10 #define MOSFET_D_PIN 7 // diff --git a/Marlin/src/pins/ramps/pins_FORMBOT_RAPTOR.h b/Marlin/src/pins/ramps/pins_FORMBOT_RAPTOR.h index 34a4ceb27d..845e2d65ec 100644 --- a/Marlin/src/pins/ramps/pins_FORMBOT_RAPTOR.h +++ b/Marlin/src/pins/ramps/pins_FORMBOT_RAPTOR.h @@ -121,23 +121,6 @@ #define TEMP_0_CS_PIN 66 // Don't use 49 (SD_DETECT_PIN) #endif -// -// Augmentation for auto-assigning RAMPS plugs -// -#if NONE(IS_RAMPS_EEB, IS_RAMPS_EEF, IS_RAMPS_EFB, IS_RAMPS_EFF, IS_RAMPS_SF) && !PIN_EXISTS(MOSFET_D) - #if HAS_MULTI_HOTEND - #if TEMP_SENSOR_BED - #define IS_RAMPS_EEB - #else - #define IS_RAMPS_EEF - #endif - #elif TEMP_SENSOR_BED - #define IS_RAMPS_EFB - #else - #define IS_RAMPS_EFF - #endif -#endif - // // Heaters / Fans // diff --git a/Marlin/src/pins/ramps/pins_FORMBOT_TREX2PLUS.h b/Marlin/src/pins/ramps/pins_FORMBOT_TREX2PLUS.h index f15c89e4f8..7a12831862 100644 --- a/Marlin/src/pins/ramps/pins_FORMBOT_TREX2PLUS.h +++ b/Marlin/src/pins/ramps/pins_FORMBOT_TREX2PLUS.h @@ -118,23 +118,6 @@ #define TEMP_0_CS_PIN 66 // Don't use 49 (SD_DETECT_PIN) #endif -// -// Augmentation for auto-assigning RAMPS plugs -// -#if NONE(IS_RAMPS_EEB, IS_RAMPS_EEF, IS_RAMPS_EFB, IS_RAMPS_EFF, IS_RAMPS_SF) && !PIN_EXISTS(MOSFET_D) - #if HAS_MULTI_HOTEND - #if TEMP_SENSOR_BED - #define IS_RAMPS_EEB - #else - #define IS_RAMPS_EEF - #endif - #elif TEMP_SENSOR_BED - #define IS_RAMPS_EFB - #else - #define IS_RAMPS_EFF - #endif -#endif - // // Heaters / Fans // diff --git a/Marlin/src/pins/ramps/pins_K8600.h b/Marlin/src/pins/ramps/pins_K8600.h index d312490dbe..f37516b710 100644 --- a/Marlin/src/pins/ramps/pins_K8600.h +++ b/Marlin/src/pins/ramps/pins_K8600.h @@ -59,7 +59,6 @@ // // Other RAMPS pins // -#define IS_RAMPS_EFB // Override autodetection. Bed will be undefined. #include "pins_RAMPS.h" // diff --git a/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h b/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h index 6b48e3cbd6..3b2639b431 100644 --- a/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h +++ b/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h @@ -116,5 +116,4 @@ // // Other RAMPS 1.3 pins // -#define IS_RAMPS_EFB // Override autodetection. Bed will be undefined. #include "pins_RAMPS_13.h" // ... RAMPS diff --git a/Marlin/src/pins/ramps/pins_RAMPS.h b/Marlin/src/pins/ramps/pins_RAMPS.h index e90c3d03fc..4697ff61b2 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS.h +++ b/Marlin/src/pins/ramps/pins_RAMPS.h @@ -189,52 +189,35 @@ #define TEMP_0_CS_PIN 66 // Don't use 53 if using Display/SD card (SDSS) or 49 (SD_DETECT_PIN) #endif -// -// Augmentation for auto-assigning RAMPS plugs -// -#if NONE(IS_RAMPS_EEB, IS_RAMPS_EEF, IS_RAMPS_EFB, IS_RAMPS_EFF, IS_RAMPS_SF) && !PIN_EXISTS(MOSFET_D) - #if HAS_MULTI_HOTEND - #if TEMP_SENSOR_BED - #define IS_RAMPS_EEB - #else - #define IS_RAMPS_EEF - #endif - #elif TEMP_SENSOR_BED - #define IS_RAMPS_EFB - #else - #define IS_RAMPS_EFF - #endif -#endif - // // Heaters / Fans // +#ifndef MOSFET_A_PIN + #define MOSFET_A_PIN 10 +#endif +#ifndef MOSFET_B_PIN + #define MOSFET_B_PIN 9 +#endif +#ifndef MOSFET_C_PIN + #define MOSFET_C_PIN 8 +#endif #ifndef MOSFET_D_PIN #define MOSFET_D_PIN -1 #endif -#ifndef RAMPS_D8_PIN - #define RAMPS_D8_PIN 8 -#endif -#ifndef RAMPS_D9_PIN - #define RAMPS_D9_PIN 9 -#endif -#ifndef RAMPS_D10_PIN - #define RAMPS_D10_PIN 10 -#endif -#define HEATER_0_PIN RAMPS_D10_PIN +#define HEATER_0_PIN MOSFET_A_PIN -#if ENABLED(IS_RAMPS_EFB) // Hotend, Fan, Bed - #define HEATER_BED_PIN RAMPS_D8_PIN -#elif ENABLED(IS_RAMPS_EEF) // Hotend, Hotend, Fan - #define HEATER_1_PIN RAMPS_D9_PIN -#elif ENABLED(IS_RAMPS_EEB) // Hotend, Hotend, Bed - #define HEATER_1_PIN RAMPS_D9_PIN - #define HEATER_BED_PIN RAMPS_D8_PIN -#elif ENABLED(IS_RAMPS_EFF) // Hotend, Fan, Fan - #define FAN1_PIN RAMPS_D8_PIN -#elif DISABLED(IS_RAMPS_SF) // Not Spindle, Fan (i.e., "EFBF" or "EFBE") - #define HEATER_BED_PIN RAMPS_D8_PIN +#if FET_ORDER_EFB // Hotend, Fan, Bed + #define HEATER_BED_PIN MOSFET_C_PIN +#elif FET_ORDER_EEF // Hotend, Hotend, Fan + #define HEATER_1_PIN MOSFET_B_PIN +#elif FET_ORDER_EEB // Hotend, Hotend, Bed + #define HEATER_1_PIN MOSFET_B_PIN + #define HEATER_BED_PIN MOSFET_C_PIN +#elif FET_ORDER_EFF // Hotend, Fan, Fan + #define FAN1_PIN MOSFET_C_PIN +#elif DISABLED(FET_ORDER_SF) // Not Spindle, Fan (i.e., "EFBF" or "EFBE") + #define HEATER_BED_PIN MOSFET_C_PIN #if EITHER(HAS_MULTI_HOTEND, HEATERS_PARALLEL) #define HEATER_1_PIN MOSFET_D_PIN #else @@ -243,14 +226,14 @@ #endif #ifndef FAN_PIN - #if EITHER(IS_RAMPS_EFB, IS_RAMPS_EFF) // Hotend, Fan, Bed or Hotend, Fan, Fan - #define FAN_PIN RAMPS_D9_PIN - #elif EITHER(IS_RAMPS_EEF, IS_RAMPS_SF) // Hotend, Hotend, Fan or Spindle, Fan - #define FAN_PIN RAMPS_D8_PIN - #elif ENABLED(IS_RAMPS_EEB) // Hotend, Hotend, Bed + #if EITHER(FET_ORDER_EFB, FET_ORDER_EFF) // Hotend, Fan, Bed or Hotend, Fan, Fan + #define FAN_PIN MOSFET_B_PIN + #elif EITHER(FET_ORDER_EEF, FET_ORDER_SF) // Hotend, Hotend, Fan or Spindle, Fan + #define FAN_PIN MOSFET_C_PIN + #elif FET_ORDER_EEB // Hotend, Hotend, Bed #define FAN_PIN 4 // IO pin. Buffer needed #else // Non-specific are "EFB" (i.e., "EFBF" or "EFBE") - #define FAN_PIN RAMPS_D9_PIN + #define FAN_PIN MOSFET_B_PIN #endif #endif diff --git a/Marlin/src/pins/ramps/pins_RAMPS_ENDER_4.h b/Marlin/src/pins/ramps/pins_RAMPS_ENDER_4.h index d9964242dd..ebd0bdc0c6 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS_ENDER_4.h +++ b/Marlin/src/pins/ramps/pins_RAMPS_ENDER_4.h @@ -36,6 +36,6 @@ #if ENABLED(CASE_LIGHT_ENABLE) #undef FAN_PIN #ifndef CASE_LIGHT_PIN - #define CASE_LIGHT_PIN RAMPS_D9_PIN + #define CASE_LIGHT_PIN MOSFET_B_PIN #endif #endif diff --git a/Marlin/src/pins/ramps/pins_RAMPS_PLUS.h b/Marlin/src/pins/ramps/pins_RAMPS_PLUS.h index af91f63bdb..a69572dee7 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS_PLUS.h +++ b/Marlin/src/pins/ramps/pins_RAMPS_PLUS.h @@ -41,8 +41,8 @@ #define BOARD_INFO_NAME "RAMPS 1.4 Plus" -#define RAMPS_D8_PIN 10 -#define RAMPS_D10_PIN 8 +#define MOSFET_A_PIN 8 +#define MOSFET_C_PIN 10 // // Steppers diff --git a/Marlin/src/pins/ramps/pins_RIGIDBOARD.h b/Marlin/src/pins/ramps/pins_RIGIDBOARD.h index 0263c78b06..2d68577f7c 100644 --- a/Marlin/src/pins/ramps/pins_RIGIDBOARD.h +++ b/Marlin/src/pins/ramps/pins_RIGIDBOARD.h @@ -51,8 +51,8 @@ // // MOSFET changes // -#define RAMPS_D9_PIN 8 // FAN (by default) -#define RAMPS_D10_PIN 9 // EXTRUDER 1 +#define MOSFET_A_PIN 9 // EXTRUDER 1 +#define MOSFET_B_PIN 8 // FAN (by default) #define MOSFET_D_PIN 12 // EXTRUDER 2 or FAN #include "pins_RAMPS.h" diff --git a/Marlin/src/pins/ramps/pins_SAINSMART_2IN1.h b/Marlin/src/pins/ramps/pins_SAINSMART_2IN1.h index e15fc94ac4..85defdf1bd 100644 --- a/Marlin/src/pins/ramps/pins_SAINSMART_2IN1.h +++ b/Marlin/src/pins/ramps/pins_SAINSMART_2IN1.h @@ -34,9 +34,9 @@ // // Heaters / Fans // -#define RAMPS_D10_PIN 9 // E -#define RAMPS_D9_PIN 7 // F PART FAN in front of board next to Extruder heat - // RAMPS_D8_PIN 8 // B -#define MOSFET_D_PIN 10 // F / E +#define MOSFET_A_PIN 9 // E +#define MOSFET_B_PIN 7 // F PART FAN in front of board next to Extruder heat + // MOSFET_C_PIN 8 // B +#define MOSFET_D_PIN 10 // F / E #include "pins_RAMPS.h" diff --git a/Marlin/src/pins/ramps/pins_TRIGORILLA_13.h b/Marlin/src/pins/ramps/pins_TRIGORILLA_13.h index eee0dcd3d2..71dfb8c704 100644 --- a/Marlin/src/pins/ramps/pins_TRIGORILLA_13.h +++ b/Marlin/src/pins/ramps/pins_TRIGORILLA_13.h @@ -27,8 +27,7 @@ #define BOARD_INFO_NAME "Anycubic RAMPS 1.3" -#define IS_RAMPS_EFB -#define RAMPS_D9_PIN 44 +#define MOSFET_B_PIN 44 #define E1_STEP_PIN -1 #define E1_DIR_PIN -1 diff --git a/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h b/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h index 54d91cee6a..994a54297f 100644 --- a/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h +++ b/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h @@ -27,16 +27,6 @@ #define BOARD_INFO_NAME "Anycubic RAMPS 1.4" -// Board labeled pins: - -#define TG_HEATER_BED_PIN 8 -#define TG_HEATER_0_PIN 10 -#define TG_HEATER_1_PIN 45 // Anycubic Kossel: Unused - -#define TG_FAN0_PIN 9 // Anycubic Kossel: Usually the part cooling fan -#define TG_FAN1_PIN 7 // Anycubic Kossel: Unused -#define TG_FAN2_PIN 44 // Anycubic Kossel: Hotend fan - // // Servos // @@ -47,45 +37,45 @@ #define SERVO3_PIN 6 #endif -// Remap MOSFET pins to common usages: - -#define RAMPS_D10_PIN TG_HEATER_0_PIN // HEATER_0_PIN is always RAMPS_D10_PIN in pins_RAMPS.h - -#if HAS_MULTI_HOTEND // EEF and EEB - #define RAMPS_D9_PIN TG_HEATER_1_PIN - #if !TEMP_SENSOR_BED - // EEF - #define RAMPS_D8_PIN TG_FAN0_PIN - #else - // EEB - #define RAMPS_D8_PIN TG_HEATER_BED_PIN - #define FAN_PIN TG_FAN0_PIN // Override pin 4 in pins_RAMPS.h - #endif -#elif TEMP_SENSOR_BED - // EFB (Anycubic Kossel default) - #define RAMPS_D9_PIN TG_FAN0_PIN - #if ENABLED(ANYCUBIC_LCD_CHIRON) - #define RAMPS_D8_PIN TG_HEATER_1_PIN // Heated bed is connected to HEATER1 output - #else - #define RAMPS_D8_PIN TG_HEATER_BED_PIN - #endif +// +// PWM FETS +// +#if EITHER(FET_ORDER_EEF, FET_ORDER_EEB) + #define MOSFET_B_PIN 45 // HEATER1 +#elif FET_ORDER_EFB + #define MOSFET_B_PIN 9 // FAN0 #else - // EFF - #define RAMPS_D9_PIN TG_FAN1_PIN - #define RAMPS_D8_PIN TG_FAN0_PIN + #define MOSFET_B_PIN 7 // FAN1 #endif -#if HAS_MULTI_HOTEND || TEMP_SENSOR_BED // EEF, EEB, EFB - #define FAN1_PIN TG_FAN1_PIN +#if FET_ORDER_EEB + #define MOSFET_C_PIN 8 // BED +#elif FET_ORDER_EFB + #if DISABLED(ANYCUBIC_LCD_CHIRON) + #define MOSFET_C_PIN 8 + #else + #define MOSFET_C_PIN 45 + #endif +#else // EEF, EFF + #define MOSFET_C_PIN 9 #endif -#define FAN2_PIN TG_FAN2_PIN +#if FET_ORDER_EEB + #define FAN_PIN 9 // Override pin 4 in pins_RAMPS.h +#endif + +// +// Heaters / Fans +// +#if ANY(FET_ORDER_EEF, FET_ORDER_EEB, FET_ORDER_EFB) + #define FAN1_PIN 7 +#endif +#define FAN2_PIN 44 #ifndef E0_AUTO_FAN_PIN - #define E0_AUTO_FAN_PIN TG_FAN2_PIN // Used in Anycubic Kossel example config + #define E0_AUTO_FAN_PIN 44 // Used in Anycubic Kossel example config #endif - #if ENABLED(ANYCUBIC_LCD_I3MEGA) - #define CONTROLLER_FAN_PIN TG_FAN1_PIN + #define CONTROLLER_FAN_PIN 7 #endif // diff --git a/Marlin/src/pins/ramps/pins_VORON.h b/Marlin/src/pins/ramps/pins_VORON.h index 9ab6573468..9390381010 100644 --- a/Marlin/src/pins/ramps/pins_VORON.h +++ b/Marlin/src/pins/ramps/pins_VORON.h @@ -28,7 +28,7 @@ #define BOARD_INFO_NAME "VORON Design v2" -#define RAMPS_D8_PIN 11 +#define MOSFET_C_PIN 11 #include "pins_RAMPS.h" diff --git a/Marlin/src/pins/ramps/pins_ZRIB_V52.h b/Marlin/src/pins/ramps/pins_ZRIB_V52.h index a6e9175b62..27f043914f 100644 --- a/Marlin/src/pins/ramps/pins_ZRIB_V52.h +++ b/Marlin/src/pins/ramps/pins_ZRIB_V52.h @@ -32,11 +32,11 @@ #define BOARD_INFO_NAME "ZRIB V5.2" #define MKS_BASE_VERSION 14 -#define IS_RAMPS_EFB // // Heaters / Fans // +#define HEATER_1_PIN 7 #define FAN_PIN 9 // PH6 ** Pin18 ** PWM9 #define FAN1_PIN 6 @@ -46,7 +46,6 @@ #define E2_STEP_PIN 4 #define E2_DIR_PIN 5 #define E2_ENABLE_PIN 22 -#define HEATER_1_PIN 7 #include "pins_MKS_BASE_common.h" // ... RAMPS From 52edc543bd72bfacb4ac6eb47eae2e466dcce62d Mon Sep 17 00:00:00 2001 From: Mike La Spina Date: Tue, 19 Oct 2021 06:05:23 -0500 Subject: [PATCH 031/125] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20pragma=20ignored?= =?UTF-8?q?=20for=20older=20GCC=20(#22978)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/gcode.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 5a030e97ab..ef21935185 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -1095,14 +1095,15 @@ void GcodeSuite::process_next_command() { process_parsed_command(); } +#pragma GCC diagnostic push +#if GCC_VERSION >= 80000 + #pragma GCC diagnostic ignored "-Wstringop-truncation" +#endif + /** * Run a series of commands, bypassing the command queue to allow * G-code "macros" to be called from within other G-code handlers. */ - -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wstringop-truncation" - void GcodeSuite::process_subcommands_now(FSTR_P fgcode) { PGM_P pgcode = FTOP(fgcode); char * const saved_cmd = parser.command_ptr; // Save the parser state From a6a838084d69435f2113deb5d783b96d909be085 Mon Sep 17 00:00:00 2001 From: Augusto Zanellato Date: Tue, 19 Oct 2021 17:24:22 +0200 Subject: [PATCH 032/125] =?UTF-8?q?=E2=9C=A8=20Eryone=20Ery32=20mini=20(ST?= =?UTF-8?q?M32F103VET6)=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 86fe878837..ab8383ddb5 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 8df379f853..64cebc42e7 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -579,6 +579,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 a05b66a9503ea89cbb967f50c8680856c40c724f Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Wed, 20 Oct 2021 01:05:51 +0000 Subject: [PATCH 033/125] [cron] Bump distribution date (2021-10-20) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index f88ecddddc..00f73bbb4f 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-10-19" +//#define STRING_DISTRIBUTION_DATE "2021-10-20" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index eb6f967756..fdb1328611 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-10-19" + #define STRING_DISTRIBUTION_DATE "2021-10-20" #endif /** From 566ce56a2d6c572d9d4700dad95a330b2459cb32 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Thu, 21 Oct 2021 01:08:58 +0000 Subject: [PATCH 034/125] [cron] Bump distribution date (2021-10-21) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 00f73bbb4f..b8abeb8838 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-10-20" +//#define STRING_DISTRIBUTION_DATE "2021-10-21" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index fdb1328611..654ccb4b08 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-10-20" + #define STRING_DISTRIBUTION_DATE "2021-10-21" #endif /** From a309a9535db532457b0aca8e861f5b8ed9f8dd93 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Fri, 22 Oct 2021 01:12:18 +0000 Subject: [PATCH 035/125] [cron] Bump distribution date (2021-10-22) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index b8abeb8838..8fbfd2b6d5 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-10-21" +//#define STRING_DISTRIBUTION_DATE "2021-10-22" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 654ccb4b08..582347a78b 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-10-21" + #define STRING_DISTRIBUTION_DATE "2021-10-22" #endif /** From f62890d889f51e07e3281e065d93445afe7b6566 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 036/125] =?UTF-8?q?=F0=9F=90=9B=20Fix=20E3V2=20width/heigh?= =?UTF-8?q?t=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 11b065e420..37b1525ba3 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 9a19ea50d8451fc0970843cc896bd2553e0f987e Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Fri, 22 Oct 2021 08:52:31 -0700 Subject: [PATCH 037/125] =?UTF-8?q?=E2=9C=A8=20BigTreeTech=20TFT35=20SPI?= =?UTF-8?q?=20V1.0=20(#22986)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration.h | 21 +++++++----- Marlin/src/core/macros.h | 32 ++++++++++++++++++- Marlin/src/inc/Conditionals_LCD.h | 12 +++---- Marlin/src/inc/SanityCheck.h | 8 +++-- .../dogm/u8g_dev_tft_upscale_from_128x64.cpp | 14 ++++---- .../ftdi_eve_touch_ui/ftdi_eve_lib/compat.h | 28 ++++++++++++++++ .../src/lcd/extui/mks_ui/SPIFlashStorage.cpp | 4 +++ Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h | 3 +- .../pins/stm32f4/pins_BTT_SKR_V2_0_common.h | 21 ++++++++++++ 9 files changed, 118 insertions(+), 25 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index ab1565d343..e6b81bfed8 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -2642,32 +2642,32 @@ */ // -// 480x320, 3.5", SPI Display From MKS -// Normally used in MKS Robin Nano V2 +// 480x320, 3.5", SPI Display with Rotary Encoder from MKS +// Usually paired with MKS Robin Nano V2 & V3 // //#define MKS_TS35_V2_0 // // 320x240, 2.4", FSMC Display From MKS -// Normally used in MKS Robin Nano V1.2 +// Usually paired with MKS Robin Nano V1.2 // //#define MKS_ROBIN_TFT24 // // 320x240, 2.8", FSMC Display From MKS -// Normally used in MKS Robin Nano V1.2 +// Usually paired with MKS Robin Nano V1.2 // //#define MKS_ROBIN_TFT28 // // 320x240, 3.2", FSMC Display From MKS -// Normally used in MKS Robin Nano V1.2 +// Usually paired with MKS Robin Nano V1.2 // //#define MKS_ROBIN_TFT32 // // 480x320, 3.5", FSMC Display From MKS -// Normally used in MKS Robin Nano V1.2 +// Usually paired with MKS Robin Nano V1.2 // //#define MKS_ROBIN_TFT35 @@ -2678,7 +2678,7 @@ // // 320x240, 3.2", FSMC Display From MKS -// Normally used in MKS Robin +// Usually paired with MKS Robin // //#define MKS_ROBIN_TFT_V1_1R @@ -2708,10 +2708,15 @@ //#define ANET_ET5_TFT35 // -// 1024x600, 7", RGB Stock Display from BIQU-BX +// 1024x600, 7", RGB Stock Display with Rotary Encoder from BIQU-BX // //#define BIQU_BX_TFT70 +// +// 480x320, 3.5", SPI Stock Display with Rotary Encoder from BIQU B1 SE Series +// +//#define BTT_TFT35_SPI_V1_0 + // // Generic TFT with detailed options // diff --git a/Marlin/src/core/macros.h b/Marlin/src/core/macros.h index 22c3767e1d..d8a15b910d 100644 --- a/Marlin/src/core/macros.h +++ b/Marlin/src/core/macros.h @@ -160,7 +160,7 @@ #endif -// Macros to chain up to 14 conditions +// Macros to chain up to 40 conditions #define _DO_1(W,C,A) (_##W##_1(A)) #define _DO_2(W,C,A,B) (_##W##_1(A) C _##W##_1(B)) #define _DO_3(W,C,A,V...) (_##W##_1(A) C _DO_2(W,C,V)) @@ -176,6 +176,31 @@ #define _DO_13(W,C,A,V...) (_##W##_1(A) C _DO_12(W,C,V)) #define _DO_14(W,C,A,V...) (_##W##_1(A) C _DO_13(W,C,V)) #define _DO_15(W,C,A,V...) (_##W##_1(A) C _DO_14(W,C,V)) +#define _DO_16(W,C,A,V...) (_##W##_1(A) C _DO_15(W,C,V)) +#define _DO_17(W,C,A,V...) (_##W##_1(A) C _DO_16(W,C,V)) +#define _DO_18(W,C,A,V...) (_##W##_1(A) C _DO_17(W,C,V)) +#define _DO_19(W,C,A,V...) (_##W##_1(A) C _DO_18(W,C,V)) +#define _DO_20(W,C,A,V...) (_##W##_1(A) C _DO_19(W,C,V)) +#define _DO_21(W,C,A,V...) (_##W##_1(A) C _DO_20(W,C,V)) +#define _DO_22(W,C,A,V...) (_##W##_1(A) C _DO_21(W,C,V)) +#define _DO_23(W,C,A,V...) (_##W##_1(A) C _DO_22(W,C,V)) +#define _DO_24(W,C,A,V...) (_##W##_1(A) C _DO_23(W,C,V)) +#define _DO_25(W,C,A,V...) (_##W##_1(A) C _DO_24(W,C,V)) +#define _DO_26(W,C,A,V...) (_##W##_1(A) C _DO_25(W,C,V)) +#define _DO_27(W,C,A,V...) (_##W##_1(A) C _DO_26(W,C,V)) +#define _DO_28(W,C,A,V...) (_##W##_1(A) C _DO_27(W,C,V)) +#define _DO_29(W,C,A,V...) (_##W##_1(A) C _DO_28(W,C,V)) +#define _DO_30(W,C,A,V...) (_##W##_1(A) C _DO_29(W,C,V)) +#define _DO_31(W,C,A,V...) (_##W##_1(A) C _DO_30(W,C,V)) +#define _DO_32(W,C,A,V...) (_##W##_1(A) C _DO_31(W,C,V)) +#define _DO_33(W,C,A,V...) (_##W##_1(A) C _DO_32(W,C,V)) +#define _DO_34(W,C,A,V...) (_##W##_1(A) C _DO_33(W,C,V)) +#define _DO_35(W,C,A,V...) (_##W##_1(A) C _DO_34(W,C,V)) +#define _DO_36(W,C,A,V...) (_##W##_1(A) C _DO_35(W,C,V)) +#define _DO_37(W,C,A,V...) (_##W##_1(A) C _DO_36(W,C,V)) +#define _DO_38(W,C,A,V...) (_##W##_1(A) C _DO_37(W,C,V)) +#define _DO_39(W,C,A,V...) (_##W##_1(A) C _DO_38(W,C,V)) +#define _DO_40(W,C,A,V...) (_##W##_1(A) C _DO_39(W,C,V)) #define __DO_N(W,C,N,V...) _DO_##N(W,C,V) #define _DO_N(W,C,N,V...) __DO_N(W,C,N,V) #define DO(W,C,V...) (_DO_N(W,C,NUM_ARGS(V),V)) @@ -251,6 +276,11 @@ memcpy(&a[0],&b[0],_MIN(sizeof(a),sizeof(b))); \ }while(0) +#define CODE_16( A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,...) A; B; C; D; E; F; G; H; I; J; K; L; M; N; O; P +#define CODE_15( A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,...) A; B; C; D; E; F; G; H; I; J; K; L; M; N; O +#define CODE_14( A,B,C,D,E,F,G,H,I,J,K,L,M,N,...) A; B; C; D; E; F; G; H; I; J; K; L; M; N +#define CODE_13( A,B,C,D,E,F,G,H,I,J,K,L,M,...) A; B; C; D; E; F; G; H; I; J; K; L; M +#define CODE_12( A,B,C,D,E,F,G,H,I,J,K,L,...) A; B; C; D; E; F; G; H; I; J; K; L #define CODE_11( A,B,C,D,E,F,G,H,I,J,K,...) A; B; C; D; E; F; G; H; I; J; K #define CODE_10( A,B,C,D,E,F,G,H,I,J,...) A; B; C; D; E; F; G; H; I; J #define CODE_9( A,B,C,D,E,F,G,H,I,...) A; B; C; D; E; F; G; H; I diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index e80dd3ed69..c9ef448162 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -1244,20 +1244,20 @@ * - TFT_COLOR * - GRAPHICAL_TFT_UPSCALE */ -#if ENABLED(MKS_TS35_V2_0) // ST7796 +#if EITHER(MKS_TS35_V2_0, BTT_TFT35_SPI_V1_0) // ST7796 #define TFT_DEFAULT_DRIVER ST7796 #define TFT_DEFAULT_ORIENTATION TFT_EXCHANGE_XY #define TFT_RES_480x320 #define TFT_INTERFACE_SPI -#elif EITHER(LERDGE_TFT35, ANET_ET5_TFT35) // ST7796 +#elif EITHER(LERDGE_TFT35, ANET_ET5_TFT35) // ST7796 #define TFT_DEFAULT_ORIENTATION TFT_EXCHANGE_XY #define TFT_RES_480x320 #define TFT_INTERFACE_FSMC -#elif ANY(ANET_ET4_TFT28, MKS_ROBIN_TFT24, MKS_ROBIN_TFT28, MKS_ROBIN_TFT32) // ST7789 +#elif ANY(ANET_ET4_TFT28, MKS_ROBIN_TFT24, MKS_ROBIN_TFT28, MKS_ROBIN_TFT32) // ST7789 #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_Y) #define TFT_RES_320x240 #define TFT_INTERFACE_FSMC -#elif ANY(MKS_ROBIN_TFT35, TFT_TRONXY_X5SA, ANYCUBIC_TFT35) // ILI9488 +#elif ANY(MKS_ROBIN_TFT35, TFT_TRONXY_X5SA, ANYCUBIC_TFT35) // ILI9488 #define TFT_DRIVER ILI9488 #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y) #define TFT_RES_480x320 @@ -1267,11 +1267,11 @@ #define TFT_DEFAULT_ORIENTATION 0 #define TFT_RES_480x272 #define TFT_INTERFACE_FSMC -#elif ANY(MKS_ROBIN_TFT_V1_1R, LONGER_LK_TFT28) // ILI9328 or R61505 +#elif ANY(MKS_ROBIN_TFT_V1_1R, LONGER_LK_TFT28) // ILI9328 or R61505 #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y) #define TFT_RES_320x240 #define TFT_INTERFACE_FSMC -#elif ENABLED(BIQU_BX_TFT70) // RGB +#elif ENABLED(BIQU_BX_TFT70) // RGB #define TFT_DEFAULT_ORIENTATION TFT_EXCHANGE_XY #define TFT_RES_1024x600 #define TFT_INTERFACE_LTDC diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 4259bf5271..e406093a98 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -2619,7 +2619,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS + COUNT_ENABLED(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1, FYSETC_GENERIC_12864_1_1) \ + COUNT_ENABLED(LCD_SAINSMART_I2C_1602, LCD_SAINSMART_I2C_2004) \ + COUNT_ENABLED(MKS_12864OLED, MKS_12864OLED_SSD1306) \ - + COUNT_ENABLED(MKS_TS35_V2_0, MKS_ROBIN_TFT24, MKS_ROBIN_TFT28, MKS_ROBIN_TFT32, MKS_ROBIN_TFT35, MKS_ROBIN_TFT43, MKS_ROBIN_TFT_V1_1R, ANET_ET4_TFT28, ANET_ET5_TFT35) \ + + COUNT_ENABLED(MKS_TS35_V2_0, MKS_ROBIN_TFT24, MKS_ROBIN_TFT28, MKS_ROBIN_TFT32, MKS_ROBIN_TFT35, MKS_ROBIN_TFT43, MKS_ROBIN_TFT_V1_1R, ANET_ET4_TFT28, ANET_ET5_TFT35, BIQU_BX_TFT70, BTT_TFT35_SPI_V1_0) \ + COUNT_ENABLED(TFTGLCD_PANEL_SPI, TFTGLCD_PANEL_I2C) \ + COUNT_ENABLED(VIKI2, miniVIKI) \ + ENABLED(WYH_L12864) \ @@ -2670,7 +2670,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #undef IS_U8GLIB_SSD1306 #undef IS_EXTUI -#if ANY(TFT_GENERIC, MKS_TS35_V2_0, MKS_ROBIN_TFT24, MKS_ROBIN_TFT28, MKS_ROBIN_TFT32, MKS_ROBIN_TFT35, MKS_ROBIN_TFT43, MKS_ROBIN_TFT_V1_1R, TFT_TRONXY_X5SA, ANYCUBIC_TFT35, ANYCUBIC_TFT35, LONGER_LK_TFT28, ANET_ET4_TFT28, ANET_ET5_TFT35, BIQU_BX_TFT70) +#if ANY(TFT_GENERIC, MKS_TS35_V2_0, MKS_ROBIN_TFT24, MKS_ROBIN_TFT28, MKS_ROBIN_TFT32, MKS_ROBIN_TFT35, MKS_ROBIN_TFT43, MKS_ROBIN_TFT_V1_1R, TFT_TRONXY_X5SA, ANYCUBIC_TFT35, ANYCUBIC_TFT35, LONGER_LK_TFT28, ANET_ET4_TFT28, ANET_ET5_TFT35, BIQU_BX_TFT70, BTT_TFT35_SPI_V1_0) #if NONE(TFT_COLOR_UI, TFT_CLASSIC_UI, TFT_LVGL_UI) #error "TFT_COLOR_UI, TFT_CLASSIC_UI, TFT_LVGL_UI is required for your TFT. Please enable one." #elif MANY(TFT_COLOR_UI, TFT_CLASSIC_UI, TFT_LVGL_UI) @@ -2712,6 +2712,10 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "Please select only one of CHIRON_TFT_STANDARD or CHIRON_TFT_NEW." #endif +#if EITHER(MKS_TS35_V2_0, BTT_TFT35_SPI_V1_0) && SD_CONNECTION_IS(LCD) + #error "SDCARD_CONNECTION cannot be set to LCD for the enabled TFT. No available SD card reader." +#endif + /** * Ender 3 V2 controller has some limitations */ diff --git a/Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp b/Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp index df7b4000a9..4a794f5000 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp @@ -78,13 +78,13 @@ TFT_IO tftio; #include "../marlinui.h" #endif -#if HAS_TOUCH_BUTTONS - #include "../touch/touch_buttons.h" - #if HAS_TOUCH_SLEEP - #define HAS_TOUCH_BUTTONS_SLEEP 1 - #endif +#if HAS_TOUCH_BUTTONS && HAS_TOUCH_SLEEP + #define HAS_TOUCH_BUTTONS_SLEEP 1 #endif +#include "../touch/touch_buttons.h" +#include "../scaled_tft.h" + #define X_HI (UPSCALE(TFT_PIXEL_OFFSET_X, WIDTH) - 1) #define Y_HI (UPSCALE(TFT_PIXEL_OFFSET_Y, HEIGHT) - 1) @@ -325,6 +325,7 @@ static bool preinit = true; static uint8_t page; #if HAS_TOUCH_BUTTONS + static bool redrawTouchButtons = true; static void drawTouchButtons(u8g_t *u8g, u8g_dev_t *dev) { if (!redrawTouchButtons) return; @@ -343,6 +344,7 @@ static uint8_t page; setWindow(u8g, dev, BUTTONC_X_LO, BUTTON_Y_LO, BUTTONC_X_HI, BUTTON_Y_HI); drawImage(buttonC, u8g, dev, BUTTON_DRAW_WIDTH, BUTTON_DRAW_HEIGHT, TFT_BTOKMENU_COLOR); } + #endif // HAS_TOUCH_BUTTONS static void u8g_upscale_clear_lcd(u8g_t *u8g, u8g_dev_t *dev, uint16_t *buffer) { @@ -395,7 +397,7 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u if (!sleepCleared) { sleepCleared = true; u8g_upscale_clear_lcd(u8g, dev, buffer); - IF_ENABLED(HAS_TOUCH_BUTTONS, redrawTouchButtons = true); + TERN_(HAS_TOUCH_BUTTONS, redrawTouchButtons = true); } break; } diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/compat.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/compat.h index 4e11c73226..b8e687147b 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/compat.h +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/compat.h @@ -255,6 +255,34 @@ #define _DO_10(W,C,A,V...) (_##W##_1(A) C _DO_9(W,C,V)) #define _DO_11(W,C,A,V...) (_##W##_1(A) C _DO_10(W,C,V)) #define _DO_12(W,C,A,V...) (_##W##_1(A) C _DO_11(W,C,V)) + #define _DO_13(W,C,A,V...) (_##W##_1(A) C _DO_12(W,C,V)) + #define _DO_14(W,C,A,V...) (_##W##_1(A) C _DO_13(W,C,V)) + #define _DO_15(W,C,A,V...) (_##W##_1(A) C _DO_14(W,C,V)) + #define _DO_16(W,C,A,V...) (_##W##_1(A) C _DO_15(W,C,V)) + #define _DO_17(W,C,A,V...) (_##W##_1(A) C _DO_16(W,C,V)) + #define _DO_18(W,C,A,V...) (_##W##_1(A) C _DO_17(W,C,V)) + #define _DO_19(W,C,A,V...) (_##W##_1(A) C _DO_18(W,C,V)) + #define _DO_20(W,C,A,V...) (_##W##_1(A) C _DO_19(W,C,V)) + #define _DO_21(W,C,A,V...) (_##W##_1(A) C _DO_20(W,C,V)) + #define _DO_22(W,C,A,V...) (_##W##_1(A) C _DO_21(W,C,V)) + #define _DO_23(W,C,A,V...) (_##W##_1(A) C _DO_22(W,C,V)) + #define _DO_24(W,C,A,V...) (_##W##_1(A) C _DO_23(W,C,V)) + #define _DO_25(W,C,A,V...) (_##W##_1(A) C _DO_24(W,C,V)) + #define _DO_26(W,C,A,V...) (_##W##_1(A) C _DO_25(W,C,V)) + #define _DO_27(W,C,A,V...) (_##W##_1(A) C _DO_26(W,C,V)) + #define _DO_28(W,C,A,V...) (_##W##_1(A) C _DO_27(W,C,V)) + #define _DO_29(W,C,A,V...) (_##W##_1(A) C _DO_28(W,C,V)) + #define _DO_30(W,C,A,V...) (_##W##_1(A) C _DO_29(W,C,V)) + #define _DO_31(W,C,A,V...) (_##W##_1(A) C _DO_30(W,C,V)) + #define _DO_32(W,C,A,V...) (_##W##_1(A) C _DO_31(W,C,V)) + #define _DO_33(W,C,A,V...) (_##W##_1(A) C _DO_32(W,C,V)) + #define _DO_34(W,C,A,V...) (_##W##_1(A) C _DO_33(W,C,V)) + #define _DO_35(W,C,A,V...) (_##W##_1(A) C _DO_34(W,C,V)) + #define _DO_36(W,C,A,V...) (_##W##_1(A) C _DO_35(W,C,V)) + #define _DO_37(W,C,A,V...) (_##W##_1(A) C _DO_36(W,C,V)) + #define _DO_38(W,C,A,V...) (_##W##_1(A) C _DO_37(W,C,V)) + #define _DO_39(W,C,A,V...) (_##W##_1(A) C _DO_38(W,C,V)) + #define _DO_40(W,C,A,V...) (_##W##_1(A) C _DO_39(W,C,V)) #define __DO_N(W,C,N,V...) _DO_##N(W,C,V) #define _DO_N(W,C,N,V...) __DO_N(W,C,N,V) #define DO(W,C,V...) _DO_N(W,C,NUM_ARGS(V),V) diff --git a/Marlin/src/lcd/extui/mks_ui/SPIFlashStorage.cpp b/Marlin/src/lcd/extui/mks_ui/SPIFlashStorage.cpp index 2fb28415a1..6f2351bba6 100644 --- a/Marlin/src/lcd/extui/mks_ui/SPIFlashStorage.cpp +++ b/Marlin/src/lcd/extui/mks_ui/SPIFlashStorage.cpp @@ -27,6 +27,10 @@ #include "../../../inc/MarlinConfig.h" #include "SPIFlashStorage.h" +#if !HAS_SPI_FLASH + #error "HAS_SPI_FLASH is required with TFT_LVGL_UI." +#endif + extern W25QXXFlash W25QXX; uint8_t SPIFlashStorage::m_pageData[SPI_FLASH_PageSize]; diff --git a/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h b/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h index 6717455692..3b7a4e4402 100644 --- a/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h +++ b/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h @@ -69,14 +69,13 @@ // SPI Flash #define HAS_SPI_FLASH 1 -#define SPI_FLASH_SIZE 0x1000000 // 16MB - #if HAS_SPI_FLASH // SPI 2 #define SPI_FLASH_CS_PIN PB12 // SPI2_NSS / Flash chip-select #define SPI_FLASH_MOSI_PIN PB15 #define SPI_FLASH_MISO_PIN PB14 #define SPI_FLASH_SCK_PIN PB13 + #define SPI_FLASH_SIZE 0x1000000 // 16MB #endif // diff --git a/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h b/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h index 95cfb1234d..d3b59e03b8 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h @@ -495,6 +495,27 @@ #endif #endif +#if HAS_SPI_TFT + // + // e.g., BTT_TFT35_SPI_V1_0 (480x320, 3.5", SPI Stock Display with Rotary Encoder in BIQU B1 SE) + // + #define TFT_CS_PIN EXP2_07_PIN + #define TFT_A0_PIN EXP2_04_PIN + #define TFT_SCK_PIN EXP2_09_PIN + #define TFT_MISO_PIN EXP2_10_PIN + #define TFT_MOSI_PIN EXP2_05_PIN + + #define TOUCH_INT_PIN EXP1_04_PIN + #define TOUCH_MISO_PIN EXP1_05_PIN + #define TOUCH_MOSI_PIN EXP1_08_PIN + #define TOUCH_SCK_PIN EXP1_06_PIN + #define TOUCH_CS_PIN EXP1_07_PIN + + #define BTN_EN1 EXP2_08_PIN + #define BTN_EN2 EXP2_06_PIN + #define BTN_ENC EXP1_09_PIN +#endif + // // NeoPixel LED // From de3c563a990e72533fb9ea9f376c53595c3e986b Mon Sep 17 00:00:00 2001 From: tome9111991 <57866234+tome9111991@users.noreply.github.com> Date: Fri, 22 Oct 2021 18:16:07 +0200 Subject: [PATCH 038/125] =?UTF-8?q?=F0=9F=90=9B=20Fix=20SHOW=5FREMAINING?= =?UTF-8?q?=5FTIME=20option=20for=20JyersUI=20(#22999)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 2 +- Marlin/src/inc/Conditionals_LCD.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 9d119eac84..e934ed92c3 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1306,7 +1306,7 @@ // LCD Print Progress options #if EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY) - #if ANY(HAS_MARLINUI_U8GLIB, EXTENSIBLE_UI, HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL, IS_DWIN_MARLINUI) + #if CAN_SHOW_REMAINING_TIME //#define SHOW_REMAINING_TIME // Display estimated time to completion #if ENABLED(SHOW_REMAINING_TIME) //#define USE_M73_REMAINING_TIME // Use remaining time from M73 command instead of estimation diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index c9ef448162..7b0c992868 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -542,6 +542,10 @@ #define HAS_LCD_MENU 1 #endif +#if ANY(HAS_MARLINUI_U8GLIB, EXTENSIBLE_UI, HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL, IS_DWIN_MARLINUI, DWIN_CREALITY_LCD_JYERSUI) + #define CAN_SHOW_REMAINING_TIME 1 +#endif + #if HAS_MARLINUI_U8GLIB #ifndef LCD_PIXEL_WIDTH #define LCD_PIXEL_WIDTH 128 From 9c055621a0944e7f65051c0c72d117d13b7fe05b 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 039/125] =?UTF-8?q?=F0=9F=90=9B=20Fix=20probe=20temp=20com?= =?UTF-8?q?pensation=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 | 65 +++++++++++--------- Marlin/src/feature/probe_temp_comp.h | 8 +-- Marlin/src/gcode/calibrate/G76_M192_M871.cpp | 2 +- 3 files changed, 41 insertions(+), 34 deletions(-) diff --git a/Marlin/src/feature/probe_temp_comp.cpp b/Marlin/src/feature/probe_temp_comp.cpp index 05b204ae6b..5f3bc985e6 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) - offset = 0.0f; - else if (idx > measurements - 2) - offset = static_cast(data[measurements - 1]); + #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 (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)); + if (temp < start_temp) + offset = 0.0f; + else if (temp >= end_temp) + offset = static_cast(data[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 2408f44ac4..0fc41ed929 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 3ec0213dbc34152e18eb5b4225e02a12d6cdc8e5 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sat, 23 Oct 2021 01:04:09 +0000 Subject: [PATCH 040/125] [cron] Bump distribution date (2021-10-23) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 8fbfd2b6d5..fa6761ea6f 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-10-22" +//#define STRING_DISTRIBUTION_DATE "2021-10-23" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 582347a78b..9974c63a42 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-10-22" + #define STRING_DISTRIBUTION_DATE "2021-10-23" #endif /** From e5e872c2e2ff87a4bef0c0565aec97cc12355dc7 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sun, 24 Oct 2021 01:02:51 +0000 Subject: [PATCH 041/125] [cron] Bump distribution date (2021-10-24) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index fa6761ea6f..410304f25c 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-10-23" +//#define STRING_DISTRIBUTION_DATE "2021-10-24" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 9974c63a42..d70399ee1a 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-10-23" + #define STRING_DISTRIBUTION_DATE "2021-10-24" #endif /** From 22d3a993e7d5d2499517ddda8de5b8450735ab56 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Mon, 25 Oct 2021 01:03:57 +0000 Subject: [PATCH 042/125] [cron] Bump distribution date (2021-10-25) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 410304f25c..c158f2732e 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-10-24" +//#define STRING_DISTRIBUTION_DATE "2021-10-25" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index d70399ee1a..5dea5c709c 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-10-24" + #define STRING_DISTRIBUTION_DATE "2021-10-25" #endif /** From 6a6bf0fd1b04f79215ee6d64596fdb1dcd72ccaa Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 24 Oct 2021 23:33:27 -0500 Subject: [PATCH 043/125] =?UTF-8?q?=F0=9F=94=A7=20Fewer=20alerts=20about?= =?UTF-8?q?=20Z=5FSAFE=5FHOMING?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/SanityCheck.h | 4 ---- Marlin/src/inc/Warnings.cpp | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index e406093a98..d342b6c76a 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1660,10 +1660,6 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "Z_PROBE_LOW_POINT must be less than or equal to 0." #endif - #if HOMING_Z_WITH_PROBE && IS_CARTESIAN && DISABLED(Z_SAFE_HOMING) - #error "Z_SAFE_HOMING is recommended when homing with a probe. Enable it or comment out this line to continue." - #endif - #if ENABLED(PROBE_ACTIVATION_SWITCH) #ifndef PROBE_ACTIVATION_SWITCH_STATE #error "PROBE_ACTIVATION_SWITCH_STATE is required for PROBE_ACTIVATION_SWITCH." diff --git a/Marlin/src/inc/Warnings.cpp b/Marlin/src/inc/Warnings.cpp index a0affac56a..d258aefd82 100644 --- a/Marlin/src/inc/Warnings.cpp +++ b/Marlin/src/inc/Warnings.cpp @@ -484,3 +484,7 @@ #if ENABLED(EMIT_CREALITY_422_WARNING) || MB(CREALITY_V4) #warning "Creality 4.2.2 boards may have A4988 or TMC2208_STANDALONE drivers. Check your board and make sure to select the correct DRIVER_TYPE!" #endif + +#if HOMING_Z_WITH_PROBE && IS_CARTESIAN && DISABLED(Z_SAFE_HOMING) + #error "Z_SAFE_HOMING is recommended when homing with a probe. Enable Z_SAFE_HOMING or comment out this line to continue." +#endif From f8968ed13c217ffa8db13d15c1d136e8d3864c1e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 24 Oct 2021 23:32:34 -0500 Subject: [PATCH 044/125] =?UTF-8?q?=F0=9F=90=9B=20More=20explicit=20alloca?= =?UTF-8?q?tion=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 e6b81bfed8..d8ced232b4 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 9dfc7b187a..41a2ab3938 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -1635,9 +1635,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)) @@ -1652,9 +1649,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 @@ -1670,9 +1664,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 @@ -1688,9 +1679,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 @@ -1706,9 +1694,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 @@ -1724,9 +1709,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 @@ -1742,9 +1724,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 @@ -1760,9 +1739,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) @@ -1772,6 +1748,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 d342b6c76a..8ad184ecf1 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1241,7 +1241,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 444f27dfa0bba82b73b428b7adcc50d44b99775a Mon Sep 17 00:00:00 2001 From: tombrazier <68918209+tombrazier@users.noreply.github.com> Date: Mon, 25 Oct 2021 06:33:40 +0100 Subject: [PATCH 045/125] =?UTF-8?q?=F0=9F=90=9B=20Add=20USE=5FTEMP=5FEXT?= =?UTF-8?q?=5FCOMPENSATION=20options=20(#23007)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 8 +++++++- Marlin/src/feature/probe_temp_comp.h | 20 +++++++++++++++++--- Marlin/src/gcode/bedlevel/abl/G29.cpp | 2 +- Marlin/src/inc/SanityCheck.h | 16 ++++++++++++++++ 4 files changed, 41 insertions(+), 5 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index e934ed92c3..fbf2c41943 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -2006,7 +2006,7 @@ #define PTC_PROBE_POS { 90, 100 } // Enable additional compensation using hotend temperature - // Note: this values cannot be calibrated automatically but have to be set manually + // Note: this values cannot be calibrated automatically but have to be set manually via M871. //#define USE_TEMP_EXT_COMPENSATION // Probe temperature calibration generates a table of values starting at PTC_SAMPLE_START @@ -2022,6 +2022,12 @@ //#define BTC_SAMPLE_RES 5 // (°C) //#define BTC_SAMPLE_COUNT 10 + #if ENABLED(USE_TEMP_EXT_COMPENSATION) + //#define ETC_SAMPLE_START 180 // (°C) + //#define ETC_SAMPLE_RES 5 // (°C) + //#define ETC_SAMPLE_COUNT 20 + #endif + // The temperature the probe should be at while taking measurements during bed temperature // calibration. //#define BTC_PROBE_TEMP 30 // (°C) diff --git a/Marlin/src/feature/probe_temp_comp.h b/Marlin/src/feature/probe_temp_comp.h index f24b9acd9b..e5d459b8e8 100644 --- a/Marlin/src/feature/probe_temp_comp.h +++ b/Marlin/src/feature/probe_temp_comp.h @@ -72,6 +72,20 @@ typedef struct { #endif #define BTC_SAMPLE_END (BTC_SAMPLE_START + (BTC_SAMPLE_COUNT) * BTC_SAMPLE_RES) +// Extruder temperature calibration constants +#if ENABLED(USE_TEMP_EXT_COMPENSATION) + #ifndef ETC_SAMPLE_COUNT + #define ETC_SAMPLE_COUNT 20 + #endif + #ifndef ETC_SAMPLE_RES + #define ETC_SAMPLE_RES 5 + #endif + #ifndef ETC_SAMPLE_START + #define ETC_SAMPLE_START 180 + #endif + #define ETC_SAMPLE_END (ETC_SAMPLE_START + (ETC_SAMPLE_COUNT) * ETC_SAMPLE_RES) +#endif + #ifndef PTC_PROBE_HEATING_OFFSET #define PTC_PROBE_HEATING_OFFSET 0.5f #endif @@ -81,10 +95,10 @@ typedef struct { #endif static constexpr temp_calib_t cali_info_init[TSI_COUNT] = { - { PTC_SAMPLE_COUNT, PTC_SAMPLE_RES, PTC_SAMPLE_START, PTC_SAMPLE_END }, // Probe - { BTC_SAMPLE_COUNT, BTC_SAMPLE_RES, BTC_SAMPLE_START, BTC_SAMPLE_END }, // Bed + { PTC_SAMPLE_COUNT, PTC_SAMPLE_RES, PTC_SAMPLE_START, PTC_SAMPLE_END }, // Probe + { BTC_SAMPLE_COUNT, BTC_SAMPLE_RES, BTC_SAMPLE_START, BTC_SAMPLE_END }, // Bed #if ENABLED(USE_TEMP_EXT_COMPENSATION) - { 20, 5, 180, 180 + 5 * 20 } // Extruder + { ETC_SAMPLE_COUNT, ETC_SAMPLE_RES, ETC_SAMPLE_START, ETC_SAMPLE_END }, // Extruder #endif }; diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index f7afd93c81..5d94797f16 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -648,7 +648,7 @@ G29_TYPE GcodeSuite::G29() { #if ENABLED(PROBE_TEMP_COMPENSATION) temp_comp.compensate_measurement(TSI_BED, thermalManager.degBed(), abl.measured_z); temp_comp.compensate_measurement(TSI_PROBE, thermalManager.degProbe(), abl.measured_z); - TERN_(USE_TEMP_EXT_COMPENSATION, temp_comp.compensate_measurement(TSI_EXT, thermalManager.degHotend(), abl.measured_z)); + TERN_(USE_TEMP_EXT_COMPENSATION, temp_comp.compensate_measurement(TSI_EXT, thermalManager.degHotend(0), abl.measured_z)); #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 8ad184ecf1..60238e6c80 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -648,6 +648,22 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L constexpr decltype(_btc_probe_temp) _test_btc_probe_temp = 12.3f; static_assert(_test_btc_probe_temp != 12.3f, "BTC_PROBE_TEMP must be a whole number."); #endif + #if ENABLED(USE_TEMP_EXT_COMPENSATION) + #ifdef ETC_SAMPLE_START + constexpr auto _etc_sample_start = ETC_SAMPLE_START; + constexpr decltype(_etc_sample_start) _test_etc_sample_start = 12.3f; + static_assert(_test_etc_sample_start != 12.3f, "ETC_SAMPLE_START must be a whole number."); + #endif + #ifdef ETC_SAMPLE_RES + constexpr auto _etc_sample_res = ETC_SAMPLE_RES; + constexpr decltype(_etc_sample_res) _test_etc_sample_res = 12.3f; + static_assert(_test_etc_sample_res != 12.3f, "ETC_SAMPLE_RES must be a whole number."); + #endif + #endif + + #if ENABLED(USE_TEMP_EXT_COMPENSATION) && EXTRUDERS != 1 + #error "USE_TEMP_EXT_COMPENSATION only works with a single extruder." + #endif #endif /** From f6c7fbd1ab62b0c3aa70c971ad6c30d062d3252a Mon Sep 17 00:00:00 2001 From: Dennis Date: Mon, 25 Oct 2021 07:35:11 +0200 Subject: [PATCH 046/125] =?UTF-8?q?=F0=9F=90=9B=20Fix=20JyersUI=20current?= =?UTF-8?q?=20positions=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 a4e05cace9..691c03af0d 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -904,21 +904,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 d79ea20dcd139ae0073051fd15405fef5b40dbf4 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 047/125] =?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 ab8383ddb5..82c68f3171 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 64cebc42e7..4de4446cf5 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -563,6 +563,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 5ef0468251b24fae5d2053691ff986b95fcd1631 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 048/125] =?UTF-8?q?=F0=9F=9A=B8=20E3V2=20Enhanced=20cosmet?= =?UTF-8?q?ic=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 f9f2da5a4c..1bea3ceb15 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 d874db79ca..8d6b5fa2c0 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 6270df927ea271c67aa4a34b89ab3c80a3a805ae Mon Sep 17 00:00:00 2001 From: Miguel Risco-Castillo Date: Mon, 25 Oct 2021 01:08:15 -0500 Subject: [PATCH 049/125] =?UTF-8?q?=F0=9F=90=9B=20Fix=20Emder-3=20V2=20Enh?= =?UTF-8?q?anced=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 1bea3ceb15..b861b0274a 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 f41c78d178d7f51c73b20ff6494a03b0fb202d52 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 050/125] =?UTF-8?q?=F0=9F=90=9B=20Fix=20b=C3=B8rken=20E=5F?= =?UTF-8?q?DUAL=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 41a2ab3938..6a70a5ce54 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -1636,7 +1636,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 e374b85d7a..a54bf53c49 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 2b19dc3232817fea94bb7ed741641879ae34cc4d 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 051/125] =?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 4de4446cf5..3b83e14d62 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -628,7 +628,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 70863058cd91b155a9d299680c34430c8d9a4192 Mon Sep 17 00:00:00 2001 From: Miguel Risco-Castillo Date: Mon, 25 Oct 2021 01:08:15 -0500 Subject: [PATCH 052/125] =?UTF-8?q?=F0=9F=90=9B=20Fix=20Ender-3=20V2=20Enh?= =?UTF-8?q?anced=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 1bea3ceb15..b861b0274a 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 b619a7184406a3fff2d67d33f1f82159721bb1bc 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 053/125] =?UTF-8?q?=F0=9F=90=9B=20Fix=20b=C3=B8rken=20E=5F?= =?UTF-8?q?DUAL=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 41a2ab3938..6a70a5ce54 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -1636,7 +1636,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 e374b85d7a..a54bf53c49 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 90716eb7ce6ffd315b923e85a19d3bca65b78ff0 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 054/125] =?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 4de4446cf5..3b83e14d62 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -628,7 +628,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 930cb7c3175eb85866bb673a861f8945c3c18726 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 055/125] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20Add'l=20PCINTs=20f?= =?UTF-8?q?or=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 73875cf9ccd4b23bbe2a46bb57192109b7d1a7c6 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 056/125] =?UTF-8?q?=F0=9F=9A=B8=20Default=20T0=20for=20M56?= =?UTF-8?q?9,=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 a74365e84d..d058ce5501 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 2803c44592..cb33d46d25 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 74596831d3..f28718c831 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 6e177960ef..3f83558fd4 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 ef21935185..30c7d926e0 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 21f0d3942f..5ad4750fe4 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); From 79626062d03f2f336b43378cc950ead9bffc8703 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 26 Oct 2021 00:59:45 +0000 Subject: [PATCH 057/125] [cron] Bump distribution date (2021-10-26) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index c158f2732e..311c36aa31 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-10-25" +//#define STRING_DISTRIBUTION_DATE "2021-10-26" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 5dea5c709c..39fc8dc233 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-10-25" + #define STRING_DISTRIBUTION_DATE "2021-10-26" #endif /** From 9338b7f06e03fd27ac8b2babb96e92a2701700ad Mon Sep 17 00:00:00 2001 From: woisy00 Date: Wed, 27 Oct 2021 01:05:34 +0200 Subject: [PATCH 058/125] =?UTF-8?q?=F0=9F=90=9B=20Fix=20AUTOTEMP=20bug=20(?= =?UTF-8?q?thermal=20runaway)=20(#23025)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Regression from 9823a37 --- Marlin/Configuration_adv.h | 2 +- Marlin/src/module/planner.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index fbf2c41943..d6217ba940 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -414,7 +414,7 @@ */ #define AUTOTEMP #if ENABLED(AUTOTEMP) - #define AUTOTEMP_OLDWEIGHT 0.98 + #define AUTOTEMP_OLDWEIGHT 0.98 // Factor used to weight previous readings (0.0 < value < 1.0) // Turn on AUTOTEMP on M104/M109 by default using proportions set here //#define AUTOTEMP_PROPORTIONAL #if ENABLED(AUTOTEMP_PROPORTIONAL) diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index b89a313f2b..2552efc69a 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -1457,7 +1457,7 @@ void Planner::check_axes_activity() { float t = autotemp_min + high * autotemp_factor; LIMIT(t, autotemp_min, autotemp_max); - if (t < oldt) t *= (1.0f - (AUTOTEMP_OLDWEIGHT)) + oldt * (AUTOTEMP_OLDWEIGHT); + if (t < oldt) t = t * (1.0f - (AUTOTEMP_OLDWEIGHT)) + oldt * (AUTOTEMP_OLDWEIGHT); oldt = t; thermalManager.setTargetHotend(t, active_extruder); } From 65dfc407a5a57eaaa036475b079153efdd1a51da Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 26 Oct 2021 19:36:16 -0500 Subject: [PATCH 059/125] =?UTF-8?q?=F0=9F=9A=B8=20Tweaks=20to=20UBL=20G29?= =?UTF-8?q?=20Q?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index d78a5e2578..df83923fef 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -346,13 +346,14 @@ void unified_bed_leveling::G29() { if (parser.seen('Q')) { const int16_t test_pattern = parser.has_value() ? parser.value_int() : -99; - if (!WITHIN(test_pattern, -1, 2)) { - SERIAL_ECHOLNPGM("Invalid test_pattern value. (-1 to 2)\n"); + if (!WITHIN(test_pattern, TERN0(UBL_DEVEL_DEBUGGING, -1), 2)) { + SERIAL_ECHOLNPGM("?Invalid (Q) test pattern. (" TERN(UBL_DEVEL_DEBUGGING, "-1", "0") " to 2)\n"); return; } - SERIAL_ECHOLNPGM("Loading test_pattern values.\n"); + SERIAL_ECHOLNPGM("Applying test pattern.\n"); switch (test_pattern) { + default: case -1: TERN_(UBL_DEVEL_DEBUGGING, g29_eeprom_dump()); break; case 0: From de6dfc9abc9aed3769c92ab89e35ee598424c3fe Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Wed, 27 Oct 2021 01:02:46 +0000 Subject: [PATCH 060/125] [cron] Bump distribution date (2021-10-27) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 311c36aa31..8bfe27d29e 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-10-26" +//#define STRING_DISTRIBUTION_DATE "2021-10-27" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 39fc8dc233..904e519c20 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-10-26" + #define STRING_DISTRIBUTION_DATE "2021-10-27" #endif /** From 2199ae77c80aa419a580f9ed8dc2f11ecddd6912 Mon Sep 17 00:00:00 2001 From: tome9111991 <57866234+tome9111991@users.noreply.github.com> Date: Wed, 27 Oct 2021 21:58:32 +0200 Subject: [PATCH 061/125] =?UTF-8?q?=F0=9F=90=9B=20Fix=20E3V2=20(CrealityUI?= =?UTF-8?q?)=20position=20display=20(#23023)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #23005, #22778 --- Marlin/src/lcd/e3v2/creality/dwin.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/src/lcd/e3v2/creality/dwin.cpp b/Marlin/src/lcd/e3v2/creality/dwin.cpp index 3326ccb1f3..0f8a739728 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.cpp +++ b/Marlin/src/lcd/e3v2/creality/dwin.cpp @@ -1659,7 +1659,7 @@ void _update_axis_value(const AxisEnum axis, const uint16_t x, const uint16_t y, else if (blink && draw_empty) DWIN_Draw_String(true, font8x16, Color_White, Color_Bg_Black, x, y, F(" ")); else - DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, x, y, p * 10); + DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, x, y, p); } } @@ -1769,11 +1769,11 @@ void update_variable() { if (BABY_Z_VAR != _offset) { _offset = BABY_Z_VAR; if (BABY_Z_VAR < 0) { - Draw_Stat_Float(207, 417, -_offset * 100); + Draw_Stat_Float(207, 417, -_offset); DWIN_Draw_String(true, font8x16, Color_White, Color_Bg_Black, 205, 419, F("-")); } else { - Draw_Stat_Float(207, 417, _offset * 100); + Draw_Stat_Float(207, 417, _offset); DWIN_Draw_String(true, font8x16, Color_White, Color_Bg_Black, 205, 419, F(" ")); } } From 3f6c8d5dc56938f95edaecddf20e9b76aec6df29 Mon Sep 17 00:00:00 2001 From: somehibs Date: Wed, 27 Oct 2021 21:00:02 +0100 Subject: [PATCH 062/125] =?UTF-8?q?=F0=9F=90=9B=20Fix=20serial=20PORT=5FRE?= =?UTF-8?q?STORE=20(and=20BUFFER=5FMONITORING)=20(#23022)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/serial.h | 2 +- Marlin/src/gcode/queue.cpp | 2 +- Marlin/src/libs/autoreport.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/src/core/serial.h b/Marlin/src/core/serial.h index e058f1e5cd..aee4d4d43d 100644 --- a/Marlin/src/core/serial.h +++ b/Marlin/src/core/serial.h @@ -87,7 +87,7 @@ extern uint8_t marlin_debug_flags; // interface with the ability to output to multiple serial ports. #if HAS_MULTI_SERIAL #define _PORT_REDIRECT(n,p) REMEMBER(n,multiSerial.portMask,p) - #define _PORT_RESTORE(n,p) RESTORE(n) + #define _PORT_RESTORE(n) RESTORE(n) #define SERIAL_ASSERT(P) if (multiSerial.portMask!=(P)) { debugger(); } // If we have a catchall, use that directly #ifdef SERIAL_CATCHALL diff --git a/Marlin/src/gcode/queue.cpp b/Marlin/src/gcode/queue.cpp index cc072e51a1..fd98a39cd6 100644 --- a/Marlin/src/gcode/queue.cpp +++ b/Marlin/src/gcode/queue.cpp @@ -719,7 +719,7 @@ void GCodeQueue::advance() { if (auto_buffer_report_interval && ELAPSED(ms, next_buffer_report_ms)) { next_buffer_report_ms = ms + 1000UL * auto_buffer_report_interval; - PORT_REDIRECT(SERIAL_BOTH); + PORT_REDIRECT(SerialMask::All); report_buffer_statistics(); PORT_RESTORE(); } diff --git a/Marlin/src/libs/autoreport.h b/Marlin/src/libs/autoreport.h index a6bc5adbf7..9aa74ab81e 100644 --- a/Marlin/src/libs/autoreport.h +++ b/Marlin/src/libs/autoreport.h @@ -44,7 +44,7 @@ struct AutoReporter { next_report_ms = ms + SEC_TO_MS(report_interval); PORT_REDIRECT(report_port_mask); Helper::report(); - //PORT_RESTORE(); + PORT_RESTORE(); } } }; From 11f1335efb448c5774c92ca14a72e6dbec9dac23 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Thu, 28 Oct 2021 09:06:06 +1300 Subject: [PATCH 063/125] =?UTF-8?q?=F0=9F=A9=B9=20Retain=20LCD=20pins=20wi?= =?UTF-8?q?th=20motor=20expansion=20(#23024)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h index dc82a2857f..a072242adc 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h @@ -281,7 +281,7 @@ #define BEEPER_PIN EXP1_05_PIN #endif -#elif HAS_WIRED_LCD && !BTT_MOTOR_EXPANSION +#elif HAS_WIRED_LCD #if ENABLED(ANET_FULL_GRAPHICS_LCD_ALT_WIRING) #error "CAUTION! ANET_FULL_GRAPHICS_LCD_ALT_WIRING requires wiring modifications. See 'pins_BTT_SKR_V1_4.h' for details. Comment out this line to continue." From c0337da6334923ea7b65bcd4f9c1ea08c8b33cf2 Mon Sep 17 00:00:00 2001 From: Zlopi Date: Wed, 27 Oct 2021 23:10:46 +0300 Subject: [PATCH 064/125] =?UTF-8?q?=F0=9F=9A=B8=20Scroll=20long=20filename?= =?UTF-8?q?=20on=20MKS=20TFT=20(#23031)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/tft/ui_common.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Marlin/src/lcd/tft/ui_common.cpp b/Marlin/src/lcd/tft/ui_common.cpp index e152ceab50..8c503d2c9e 100644 --- a/Marlin/src/lcd/tft/ui_common.cpp +++ b/Marlin/src/lcd/tft/ui_common.cpp @@ -167,8 +167,7 @@ void MenuEditItemBase::draw(const bool sel, const uint8_t row, PGM_P const pstr, void MenuItem_static::draw(const uint8_t row, PGM_P const pstr, const uint8_t style/*=SS_DEFAULT*/, const char * const vstr/*=nullptr*/) { menu_item(row); tft_string.set(pstr, itemIndex, itemString); - if (vstr) - tft_string.add(vstr); + if (vstr) tft_string.add(vstr); tft.add_text(tft_string.center(TFT_WIDTH), MENU_TEXT_Y_OFFSET, COLOR_YELLOW, tft_string); } @@ -176,9 +175,9 @@ void MenuItem_static::draw(const uint8_t row, PGM_P const pstr, const uint8_t st void MenuItem_sdbase::draw(const bool sel, const uint8_t row, PGM_P const, CardReader &theCard, const bool isDir) { menu_item(row, sel); - if (isDir) - tft.add_image(MENU_ITEM_ICON_X, MENU_ITEM_ICON_Y, imgDirectory, COLOR_MENU_TEXT, sel ? COLOR_SELECTION_BG : COLOR_BACKGROUND); - tft.add_text(MENU_ITEM_ICON_SPACE, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, theCard.longest_filename()); + if (isDir) tft.add_image(MENU_ITEM_ICON_X, MENU_ITEM_ICON_Y, imgDirectory, COLOR_MENU_TEXT, sel ? COLOR_SELECTION_BG : COLOR_BACKGROUND); + constexpr uint8_t maxlen = (MENU_ITEM_HEIGHT) - (MENU_TEXT_Y_OFFSET) + 1; + tft.add_text(MENU_ITEM_ICON_SPACE, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, ui.scrolled_filename(theCard, maxlen, row, sel)); } #endif From fbc125b06c0858d1dbdd29908ad862ed25918b3b Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Thu, 28 Oct 2021 01:00:14 +0000 Subject: [PATCH 065/125] [cron] Bump distribution date (2021-10-28) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 8bfe27d29e..e61ec1b4e7 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-10-27" +//#define STRING_DISTRIBUTION_DATE "2021-10-28" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 904e519c20..a1ad05bd3a 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-10-27" + #define STRING_DISTRIBUTION_DATE "2021-10-28" #endif /** From aa2c6387e95bdab955499627e3890561842f0a6a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 26 Oct 2021 21:54:43 -0500 Subject: [PATCH 066/125] =?UTF-8?q?=F0=9F=8E=A8=20Apply=20HAS=5FMULTI=5FHO?= =?UTF-8?q?TEND=20conditional?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lcd/e3v2/marlinui/ui_status_480x272.cpp | 15 +++---- .../src/lcd/extui/dgus/DGUSScreenHandler.cpp | 8 ++-- .../lcd/extui/dgus/fysetc/DGUSDisplayDef.cpp | 12 ++--- .../extui/dgus/fysetc/DGUSScreenHandler.cpp | 4 +- .../lcd/extui/dgus/hiprecy/DGUSDisplayDef.cpp | 44 ++++++++----------- .../extui/dgus/hiprecy/DGUSScreenHandler.cpp | 6 +-- .../src/lcd/extui/dgus/mks/DGUSDisplayDef.cpp | 10 ++--- .../lcd/extui/dgus/origin/DGUSDisplayDef.cpp | 10 ++--- .../extui/dgus/origin/DGUSScreenHandler.cpp | 6 +-- .../lcd/extui/dgus_reloaded/DGUSRxHandler.cpp | 12 ++--- .../lcd/extui/dgus_reloaded/DGUSTxHandler.cpp | 8 ++-- .../extui/dgus_reloaded/config/DGUS_Addr.h | 4 +- .../dgus_reloaded/definition/DGUS_VPList.cpp | 4 +- Marlin/src/lcd/menu/menu_temperature.cpp | 7 +-- Marlin/src/lcd/tft/ui_common.h | 4 +- Marlin/src/pins/esp32/pins_E4D.h | 2 +- Marlin/src/pins/esp32/pins_FYSETC_E4.h | 2 +- Marlin/src/pins/esp32/pins_MRR_ESPA.h | 2 +- Marlin/src/pins/esp32/pins_MRR_ESPE.h | 2 +- Marlin/src/pins/ramps/pins_K8600.h | 2 +- Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h | 2 +- Marlin/src/pins/ramps/pins_RAMPS_ENDER_4.h | 2 +- .../src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h | 2 +- Marlin/src/pins/stm32f1/pins_CREALITY_V4.h | 2 +- Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h | 2 +- Marlin/src/pins/stm32f1/pins_CREALITY_V452.h | 2 +- Marlin/src/pins/stm32f1/pins_CREALITY_V453.h | 2 +- Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h | 2 +- .../src/pins/stm32f1/pins_JGAURORA_A5S_A1.h | 2 +- Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h | 2 +- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3.h | 2 +- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D.h | 2 +- .../pins/stm32f1/pins_MKS_ROBIN_E3D_V1_1.h | 2 +- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h | 2 +- .../src/pins/stm32f1/pins_MKS_ROBIN_E3_V1_1.h | 2 +- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE.h | 2 +- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h | 2 +- Marlin/src/pins/stm32f4/pins_ANET_ET4.h | 2 +- .../src/pins/stm32f4/pins_BTT_BTT002_V1_0.h | 2 +- Marlin/src/pins/stm32f4/pins_LERDGE_X.h | 2 +- Marlin/src/pins/stm32f7/pins_REMRAM_V1.h | 2 +- 41 files changed, 100 insertions(+), 106 deletions(-) diff --git a/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp b/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp index 703db2ee45..306e9044f7 100644 --- a/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp @@ -132,20 +132,19 @@ FORCE_INLINE void _draw_fan_status(const uint16_t x, const uint16_t y) { } } -#if HOTENDS > 2 - #define HOTEND_STATS 3 -#elif HOTENDS > 1 - #define HOTEND_STATS 2 -#elif HAS_HOTEND - #define HOTEND_STATS 1 -#endif - /** * Draw a single heater icon with current and target temperature, at the given XY */ FORCE_INLINE void _draw_heater_status(const heater_id_t heater, const uint16_t x, const uint16_t y) { #if HAS_HOTEND + #if HOTENDS > 2 + #define HOTEND_STATS 3 + #elif HOTENDS > 1 + #define HOTEND_STATS 2 + #elif HAS_HOTEND + #define HOTEND_STATS 1 + #endif static celsius_t old_temp[HOTEND_STATS] = ARRAY_N_1(HOTEND_STATS, 500), old_target[HOTEND_STATS] = ARRAY_N_1(HOTEND_STATS, 500); static bool old_on[HOTEND_STATS] = ARRAY_N_1(HOTEND_STATS, false); diff --git a/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp index c9e7268f04..be08b074ff 100644 --- a/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp @@ -185,7 +185,7 @@ void DGUSScreenHandler::DGUSLCD_SendStringToDisplayPGM(DGUS_VP_Variable &var) { case VP_E0_PID_I: valuesend = unscalePID_i(value); break; case VP_E0_PID_D: valuesend = unscalePID_d(value); break; #endif - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND case VP_E1_PID_P: valuesend = value; break; case VP_E1_PID_I: valuesend = unscalePID_i(value); break; case VP_E1_PID_D: valuesend = unscalePID_d(value); break; @@ -400,7 +400,7 @@ void DGUSScreenHandler::HandleTemperatureChanged(DGUS_VP_Variable &var, void *va acceptedvalue = thermalManager.degTargetHotend(0); break; #endif - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND case VP_T_E1_Set: NOMORE(newvalue, HEATER_1_MAXTEMP); thermalManager.setTargetHotend(newvalue, 1); @@ -551,7 +551,7 @@ void DGUSScreenHandler::HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, vo sprintf_P(buf, PSTR("M303 E%d C5 S210 U1"), ExtUI::extruder_t::E0); break; #endif - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND case VP_PID_AUTOTUNE_E1: sprintf_P(buf, PSTR("M303 E%d C5 S210 U1"), ExtUI::extruder_t::E1); break; @@ -598,7 +598,7 @@ void DGUSScreenHandler::HandleHeaterControl(DGUS_VP_Variable &var, void *val_ptr switch (var.VP) { #if HAS_HOTEND case VP_E0_CONTROL: - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND case VP_E1_CONTROL: #if HOTENDS >= 3 case VP_E2_CONTROL: diff --git a/Marlin/src/lcd/extui/dgus/fysetc/DGUSDisplayDef.cpp b/Marlin/src/lcd/extui/dgus/fysetc/DGUSDisplayDef.cpp index d73a7ea552..a4c0997bf8 100644 --- a/Marlin/src/lcd/extui/dgus/fysetc/DGUSDisplayDef.cpp +++ b/Marlin/src/lcd/extui/dgus/fysetc/DGUSDisplayDef.cpp @@ -51,7 +51,7 @@ const uint16_t VPList_Main[] PROGMEM = { #if HAS_HOTEND VP_T_E0_Is, VP_T_E0_Set, VP_E0_STATUS, #endif - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND VP_T_E1_Is, VP_T_E1_Set, #endif #if HAS_HEATED_BED @@ -73,7 +73,7 @@ const uint16_t VPList_Temp[] PROGMEM = { #if HAS_HOTEND VP_T_E0_Is, VP_T_E0_Set, #endif - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND VP_T_E1_Is, VP_T_E1_Set, #endif #if HAS_HEATED_BED @@ -87,7 +87,7 @@ const uint16_t VPList_Status[] PROGMEM = { #if HAS_HOTEND VP_T_E0_Is, VP_T_E0_Set, #endif - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND VP_T_E1_Is, VP_T_E1_Set, #endif #if HAS_HEATED_BED @@ -120,7 +120,7 @@ const uint16_t VPList_Preheat[] PROGMEM = { #if HAS_HOTEND VP_T_E0_Is, VP_T_E0_Set, #endif - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND VP_T_E1_Is, VP_T_E1_Set, #endif #if HAS_HEATED_BED @@ -187,7 +187,7 @@ const uint16_t VPList_SD_PrintManipulation[] PROGMEM = { #if HAS_HOTEND VP_T_E0_Is, VP_T_E0_Set, #endif - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND VP_T_E1_Is, VP_T_E1_Set, #endif #if HAS_HEATED_BED @@ -379,7 +379,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = { VPHELPER(VP_E0_FILAMENT_LOAD_UNLOAD, nullptr, ScreenHandler.HandleFilamentOption, ScreenHandler.HandleFilamentLoadUnload), #endif #endif - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND VPHELPER(VP_T_E1_Is, &thermalManager.temp_hotend[1].celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>), VPHELPER(VP_T_E1_Set, &thermalManager.temp_hotend[1].target, ScreenHandler.HandleTemperatureChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay), VPHELPER(VP_Flowrate_E1, &planner.flow_percentage[ExtUI::extruder_t::E1], ScreenHandler.HandleFlowRateChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay), // ERROR: Flow is per-extruder, not per-hotend diff --git a/Marlin/src/lcd/extui/dgus/fysetc/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/fysetc/DGUSScreenHandler.cpp index 2f08136cbb..750acece1c 100644 --- a/Marlin/src/lcd/extui/dgus/fysetc/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/fysetc/DGUSScreenHandler.cpp @@ -256,7 +256,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { case VP_E0_PID_I: newvalue = scalePID_i(value); break; case VP_E0_PID_D: newvalue = scalePID_d(value); break; #endif - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND case VP_E1_PID_P: newvalue = value; break; case VP_E1_PID_I: newvalue = scalePID_i(value); break; case VP_E1_PID_D: newvalue = scalePID_d(value); break; @@ -334,7 +334,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { #if HAS_HOTEND thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E0); #endif - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E1); #endif GotoScreen(DGUSLCD_SCREEN_UTILITY); diff --git a/Marlin/src/lcd/extui/dgus/hiprecy/DGUSDisplayDef.cpp b/Marlin/src/lcd/extui/dgus/hiprecy/DGUSDisplayDef.cpp index bdcff47ae8..f3f361f84e 100644 --- a/Marlin/src/lcd/extui/dgus/hiprecy/DGUSDisplayDef.cpp +++ b/Marlin/src/lcd/extui/dgus/hiprecy/DGUSDisplayDef.cpp @@ -50,7 +50,7 @@ const uint16_t VPList_Main[] PROGMEM = { // VP_M117, for completeness, but it cannot be auto-uploaded. #if HAS_HOTEND VP_T_E0_Is, VP_T_E0_Set, VP_E0_STATUS, - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND VP_T_E1_Is, VP_T_E1_Set, #endif #endif @@ -72,7 +72,7 @@ const uint16_t VPList_Main[] PROGMEM = { const uint16_t VPList_Temp[] PROGMEM = { #if HAS_HOTEND VP_T_E0_Is, VP_T_E0_Set, - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND VP_T_E1_Is, VP_T_E1_Set, #endif #endif @@ -86,7 +86,7 @@ const uint16_t VPList_Status[] PROGMEM = { // VP_M117, for completeness, but it cannot be auto-uploaded #if HAS_HOTEND VP_T_E0_Is, VP_T_E0_Set, - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND VP_T_E1_Is, VP_T_E1_Set, #endif #endif @@ -107,7 +107,7 @@ const uint16_t VPList_Status2[] PROGMEM = { // VP_M117, for completeness, but it cannot be auto-uploaded #if HAS_HOTEND VP_Flowrate_E0, - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND VP_Flowrate_E1, #endif #endif @@ -119,7 +119,7 @@ const uint16_t VPList_Status2[] PROGMEM = { const uint16_t VPList_Preheat[] PROGMEM = { #if HAS_HOTEND VP_T_E0_Is, VP_T_E0_Set, - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND VP_T_E1_Is, VP_T_E1_Set, #endif #endif @@ -137,7 +137,7 @@ const uint16_t VPList_ManualMove[] PROGMEM = { const uint16_t VPList_ManualExtrude[] PROGMEM = { #if HAS_HOTEND VP_T_E0_Is, VP_T_E0_Set, - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND VP_T_E1_Is, VP_T_E1_Set, #endif #endif @@ -159,7 +159,7 @@ const uint16_t VPList_Filament_heating[] PROGMEM = { #if HAS_HOTEND VP_T_E0_Is, VP_T_E0_Set, VP_E0_FILAMENT_LOAD_UNLOAD, - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND VP_T_E1_Is, VP_T_E1_Set, #endif #endif @@ -169,7 +169,7 @@ const uint16_t VPList_Filament_heating[] PROGMEM = { const uint16_t VPList_Filament_load_unload[] PROGMEM = { #if HAS_HOTEND VP_E0_FILAMENT_LOAD_UNLOAD, - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND VP_E1_FILAMENT_LOAD_UNLOAD, #endif #endif @@ -185,7 +185,7 @@ const uint16_t VPList_SD_PrintManipulation[] PROGMEM = { VP_PrintProgress_Percentage, VP_PrintTime, #if HAS_HOTEND VP_T_E0_Is, VP_T_E0_Set, - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND VP_T_E1_Is, VP_T_E1_Set, #endif #endif @@ -205,7 +205,7 @@ const uint16_t VPList_SD_PrintManipulation[] PROGMEM = { const uint16_t VPList_SDPrintTune[] PROGMEM = { #if HAS_HOTEND VP_T_E0_Is, VP_T_E0_Set, - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND VP_T_E1_Is, VP_T_E1_Set, #endif #endif @@ -222,23 +222,17 @@ const uint16_t VPList_SDPrintTune[] PROGMEM = { }; const uint16_t VPList_StepPerMM[] PROGMEM = { - VP_X_STEP_PER_MM, - VP_Y_STEP_PER_MM, - VP_Z_STEP_PER_MM, - #if HAS_HOTEND - VP_E0_STEP_PER_MM, - #if HOTENDS >= 2 - VP_E1_STEP_PER_MM, - #endif - #endif - 0x0000 + VP_X_STEP_PER_MM + , VP_Y_STEP_PER_MM + , VP_Z_STEP_PER_MM + OPTARG(HAS_HOTEND, VP_E0_STEP_PER_MM) + OPTARG(HAS_MULTI_HOTEND, VP_E1_STEP_PER_MM) + , 0x0000 }; const uint16_t VPList_PIDE0[] PROGMEM = { #if ENABLED(PIDTEMP) - VP_E0_PID_P, - VP_E0_PID_I, - VP_E0_PID_D, + VP_E0_PID_P, VP_E0_PID_I, VP_E0_PID_D, #endif 0x0000 }; @@ -382,7 +376,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = { VPHELPER(VP_PID_AUTOTUNE_E0, nullptr, ScreenHandler.HandlePIDAutotune, nullptr), #endif #endif - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND VPHELPER(VP_T_E1_Is, &thermalManager.temp_hotend[1].celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>), VPHELPER(VP_T_E1_Set, &thermalManager.temp_hotend[1].target, ScreenHandler.HandleTemperatureChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay), VPHELPER(VP_Flowrate_E1, nullptr, ScreenHandler.HandleFlowRateChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay), @@ -435,7 +429,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = { VPHELPER(VP_Z_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Z_AXIS], ScreenHandler.HandleStepPerMMChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>), #if HAS_HOTEND VPHELPER(VP_E0_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(0)], ScreenHandler.HandleStepPerMMExtruderChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>), - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND VPHELPER(VP_E1_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(1)], ScreenHandler.HandleStepPerMMExtruderChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>), #endif #endif diff --git a/Marlin/src/lcd/extui/dgus/hiprecy/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/hiprecy/DGUSScreenHandler.cpp index f72a9f439d..79a3cb9103 100644 --- a/Marlin/src/lcd/extui/dgus/hiprecy/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/hiprecy/DGUSScreenHandler.cpp @@ -256,7 +256,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { case VP_E0_PID_I: newvalue = scalePID_i(value); break; case VP_E0_PID_D: newvalue = scalePID_d(value); break; #endif - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND case VP_E1_PID_P: newvalue = value; break; case VP_E1_PID_I: newvalue = scalePID_i(value); break; case VP_E1_PID_D: newvalue = scalePID_d(value); break; @@ -333,7 +333,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { if (filament_data.action == 0) { // Go back to utility screen #if HAS_HOTEND thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E0); - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E1); #endif #endif @@ -348,7 +348,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { thermalManager.setTargetHotend(e_temp, filament_data.extruder); break; #endif - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND case VP_E1_FILAMENT_LOAD_UNLOAD: filament_data.extruder = ExtUI::extruder_t::E1; thermalManager.setTargetHotend(e_temp, filament_data.extruder); diff --git a/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.cpp b/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.cpp index 9ecfb57397..ff013967c0 100644 --- a/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.cpp +++ b/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.cpp @@ -122,7 +122,7 @@ const uint16_t VPList_Main[] PROGMEM = { // VP_M117, for completeness, but it cannot be auto-uploaded. #if HAS_HOTEND MKSLIST_E_ITEM(0) VP_E0_STATUS, - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND MKSLIST_E_ITEM(1) VP_E1_STATUS, #endif #endif @@ -567,7 +567,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = { #endif #endif - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND VPHELPER(VP_T_E1_Is, &thermalManager.temp_hotend[1].celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>), VPHELPER(VP_T_E1_Set, &thermalManager.temp_hotend[1].target, ScreenHandler.HandleTemperatureChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay), VPHELPER(VP_Flowrate_E1, &planner.flow_percentage[ExtUI::extruder_t::E1], ScreenHandler.HandleFlowRateChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay), @@ -656,7 +656,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = { #if HAS_HOTEND VPHELPER(VP_E0_MAX_SPEED, &planner.settings.max_feedrate_mm_s[E_AXIS_N(0)], ScreenHandler.HandleExtruderMaxSpeedChange_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>), - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND VPHELPER(VP_E1_MAX_SPEED, &planner.settings.max_feedrate_mm_s[E_AXIS_N(1)], ScreenHandler.HandleExtruderMaxSpeedChange_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>), #endif #endif @@ -667,7 +667,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = { #if HAS_HOTEND VPHELPER(VP_E0_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(0)], ScreenHandler.HandleExtruderAccChange_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay), - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND VPHELPER(VP_E1_ACC_MAX_SPEED, (uint16_t *)&planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(1)], ScreenHandler.HandleExtruderAccChange_MKS, ScreenHandler.DGUSLCD_SendWordValueToDisplay), #endif #endif @@ -744,7 +744,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = { #if HAS_HOTEND VPHELPER(VP_E0_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(0)], ScreenHandler.HandleStepPerMMExtruderChanged_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>), - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND VPHELPER(VP_E1_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(1)], ScreenHandler.HandleStepPerMMExtruderChanged_MKS, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<0>), #endif #endif diff --git a/Marlin/src/lcd/extui/dgus/origin/DGUSDisplayDef.cpp b/Marlin/src/lcd/extui/dgus/origin/DGUSDisplayDef.cpp index 2f5e2787d6..0115d3b8c1 100644 --- a/Marlin/src/lcd/extui/dgus/origin/DGUSDisplayDef.cpp +++ b/Marlin/src/lcd/extui/dgus/origin/DGUSDisplayDef.cpp @@ -57,7 +57,7 @@ const uint16_t VPList_Main[] PROGMEM = { const uint16_t VPList_Temp[] PROGMEM = { #if HAS_HOTEND VP_T_E0_Is, VP_T_E0_Set, - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND VP_T_E1_Is, VP_T_E1_Set, #endif #endif @@ -71,7 +71,7 @@ const uint16_t VPList_Status[] PROGMEM = { // VP_M117, for completeness, but it cannot be auto-uploaded #if HAS_HOTEND VP_T_E0_Is, VP_T_E0_Set, - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND VP_T_E1_Is, VP_T_E1_Set, #endif #endif @@ -92,7 +92,7 @@ const uint16_t VPList_Status2[] PROGMEM = { // VP_M117, for completeness, but it cannot be auto-uploaded #if HAS_HOTEND VP_Flowrate_E0, - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND VP_Flowrate_E1, #endif #endif @@ -182,7 +182,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = { VPHELPER(VP_E0_FILAMENT_LOAD_UNLOAD, nullptr, ScreenHandler.HandleFilamentOption, ScreenHandler.HandleFilamentLoadUnload), #endif #endif - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND VPHELPER(VP_T_E1_Is, &thermalManager.temp_hotend[1].celsius, nullptr, ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<0>), VPHELPER(VP_T_E1_Set, &thermalManager.temp_hotend[1].target, ScreenHandler.HandleTemperatureChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay), VPHELPER(VP_Flowrate_E1, nullptr, ScreenHandler.HandleFlowRateChanged, ScreenHandler.DGUSLCD_SendWordValueToDisplay), @@ -237,7 +237,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = { VPHELPER(VP_Z_STEP_PER_MM, &planner.settings.axis_steps_per_mm[Z_AXIS], ScreenHandler.HandleStepPerMMChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>), #if HAS_HOTEND VPHELPER(VP_E0_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(0)], ScreenHandler.HandleStepPerMMExtruderChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>), - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND VPHELPER(VP_E1_STEP_PER_MM, &planner.settings.axis_steps_per_mm[E_AXIS_N(1)], ScreenHandler.HandleStepPerMMExtruderChanged, ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<1>), #endif #endif diff --git a/Marlin/src/lcd/extui/dgus/origin/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/origin/DGUSScreenHandler.cpp index 82404ead94..b77c92b7eb 100644 --- a/Marlin/src/lcd/extui/dgus/origin/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/origin/DGUSScreenHandler.cpp @@ -256,7 +256,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { case VP_E0_PID_I: newvalue = scalePID_i(value); break; case VP_E0_PID_D: newvalue = scalePID_d(value); break; #endif - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND case VP_E1_PID_P: newvalue = value; break; case VP_E1_PID_I: newvalue = scalePID_i(value); break; case VP_E1_PID_D: newvalue = scalePID_d(value); break; @@ -333,7 +333,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { if (filament_data.action == 0) { // Go back to utility screen #if HAS_HOTEND thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E0); - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E1); #endif #endif @@ -348,7 +348,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) { thermalManager.setTargetHotend(e_temp, filament_data.extruder); break; #endif - #if HOTENDS >= 2 + #if HAS_MULTI_HOTEND case VP_E1_FILAMENT_LOAD_UNLOAD: filament_data.extruder = ExtUI::extruder_t::E1; thermalManager.setTargetHotend(e_temp, filament_data.extruder); diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp index f0844dc785..cf95bb1d76 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp @@ -327,7 +327,7 @@ void DGUSRxHandler::TempTarget(DGUS_VP &vp, void *data_ptr) { case DGUS_Addr::TEMP_SetTarget_H0: ExtUI::setTargetTemp_celsius(temp, ExtUI::H0); break; - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND case DGUS_Addr::TEMP_SetTarget_H1: ExtUI::setTargetTemp_celsius(temp, ExtUI::H1); break; @@ -347,7 +347,7 @@ void DGUSRxHandler::TempCool(DGUS_VP &vp, void *data_ptr) { case DGUS_Data::Heater::ALL: ExtUI::setTargetTemp_celsius(0, ExtUI::BED); ExtUI::setTargetTemp_celsius(0, ExtUI::H0); - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND ExtUI::setTargetTemp_celsius(0, ExtUI::H1); #endif break; @@ -357,7 +357,7 @@ void DGUSRxHandler::TempCool(DGUS_VP &vp, void *data_ptr) { case DGUS_Data::Heater::H0: ExtUI::setTargetTemp_celsius(0, ExtUI::H0); break; - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND case DGUS_Data::Heater::H1: ExtUI::setTargetTemp_celsius(0, ExtUI::H1); break; @@ -827,7 +827,7 @@ void DGUSRxHandler::PIDSelect(DGUS_VP &vp, void *data_ptr) { dgus_screen_handler.pid_heater = heater; break; case DGUS_Data::Heater::H0: - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND case DGUS_Data::Heater::H1: #endif dgus_screen_handler.pid_temp = DGUS_PLA_TEMP_HOTEND; @@ -858,7 +858,7 @@ void DGUSRxHandler::PIDSetTemp(DGUS_VP &vp, void *data_ptr) { case DGUS_Data::Heater::H0: temp = constrain(temp, HEATER_0_MINTEMP, (HEATER_0_MAXTEMP - HOTEND_OVERSHOOT)); break; - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND case DGUS_Data::Heater::H1: temp = constrain(temp, HEATER_1_MINTEMP, (HEATER_1_MAXTEMP - HOTEND_OVERSHOOT)); break; @@ -900,7 +900,7 @@ void DGUSRxHandler::PIDRun(DGUS_VP &vp, void *data_ptr) { dgus_screen_handler.SetStatusMessage(F("PID disabled")); return; #endif - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND case DGUS_Data::Heater::H1: #if ENABLED(PIDTEMP) heater = H_E1; diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.cpp index 3fc48d2ebb..8d57038765 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSTxHandler.cpp @@ -275,7 +275,7 @@ void DGUSTxHandler::TempMax(DGUS_VP &vp) { case DGUS_Addr::TEMP_Max_H0: temp = HEATER_0_MAXTEMP - HOTEND_OVERSHOOT; break; - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND case DGUS_Addr::TEMP_Max_H1: temp = HEATER_1_MAXTEMP - HOTEND_OVERSHOOT; break; @@ -428,7 +428,7 @@ void DGUSTxHandler::PIDKp(DGUS_VP &vp) { case DGUS_Data::Heater::H0: value = ExtUI::getPIDValues_Kp(ExtUI::E0); break; - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND case DGUS_Data::Heater::H1: value = ExtUI::getPIDValues_Kp(ExtUI::E1); break; @@ -454,7 +454,7 @@ void DGUSTxHandler::PIDKi(DGUS_VP &vp) { case DGUS_Data::Heater::H0: value = ExtUI::getPIDValues_Ki(ExtUI::E0); break; - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND case DGUS_Data::Heater::H1: value = ExtUI::getPIDValues_Ki(ExtUI::E1); break; @@ -480,7 +480,7 @@ void DGUSTxHandler::PIDKd(DGUS_VP &vp) { case DGUS_Data::Heater::H0: value = ExtUI::getPIDValues_Kd(ExtUI::E0); break; - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND case DGUS_Data::Heater::H1: value = ExtUI::getPIDValues_Kd(ExtUI::E1); break; diff --git a/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Addr.h b/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Addr.h index 4207119c87..39e97156d0 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Addr.h +++ b/Marlin/src/lcd/extui/dgus_reloaded/config/DGUS_Addr.h @@ -64,7 +64,7 @@ enum class DGUS_Addr : uint16_t { TEMP_Preset = 0x2010, // Popup / Data: DGUS_Data::TempPreset TEMP_SetTarget_Bed = 0x2011, // Type: Integer (16 bits signed) TEMP_SetTarget_H0 = 0x2012, // Type: Integer (16 bits signed) - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND TEMP_SetTarget_H1 = 0x2013, // Type: Integer (16 bits signed) #endif TEMP_Cool = 0x2014, // Data: DGUS_Data::Heater @@ -123,7 +123,7 @@ enum class DGUS_Addr : uint16_t { TEMP_Current_H0 = 0x30FF, // Type: Integer (16 bits signed) TEMP_Target_H0 = 0x3100, // Type: Integer (16 bits signed) TEMP_Max_H0 = 0x3101, // Type: Integer (16 bits unsigned) - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND TEMP_Current_H1 = 0x3102, // Type: Integer (16 bits signed) TEMP_Target_H1 = 0x3103, // Type: Integer (16 bits signed) TEMP_Max_H1 = 0x3104, // Type: Integer (16 bits unsigned) diff --git a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.cpp b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.cpp index 27b6d9036c..e77aa45011 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/definition/DGUS_VPList.cpp @@ -102,7 +102,7 @@ const struct DGUS_VP vp_list[] PROGMEM = { VP_HELPER_RX(DGUS_Addr::TEMP_Preset, &DGUSRxHandler::TempPreset), VP_HELPER_RX(DGUS_Addr::TEMP_SetTarget_Bed, &DGUSRxHandler::TempTarget), VP_HELPER_RX(DGUS_Addr::TEMP_SetTarget_H0, &DGUSRxHandler::TempTarget), - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND VP_HELPER_RX(DGUS_Addr::TEMP_SetTarget_H1, &DGUSRxHandler::TempTarget), #endif VP_HELPER_RX(DGUS_Addr::TEMP_Cool, &DGUSRxHandler::TempCool), @@ -217,7 +217,7 @@ const struct DGUS_VP vp_list[] PROGMEM = { &thermalManager.temp_hotend[ExtUI::heater_t::H0].target, &DGUSTxHandler::ExtraToInteger), VP_HELPER_TX(DGUS_Addr::TEMP_Max_H0, &DGUSTxHandler::TempMax), - #if HOTENDS > 1 + #if HAS_MULTI_HOTEND VP_HELPER_TX_AUTO(DGUS_Addr::TEMP_Current_H1, &thermalManager.temp_hotend[ExtUI::heater_t::H1].celsius, &DGUSTxHandler::ExtraToInteger), diff --git a/Marlin/src/lcd/menu/menu_temperature.cpp b/Marlin/src/lcd/menu/menu_temperature.cpp index 65cef5b76d..3abb2e9c20 100644 --- a/Marlin/src/lcd/menu/menu_temperature.cpp +++ b/Marlin/src/lcd/menu/menu_temperature.cpp @@ -122,7 +122,8 @@ void Temperature::lcd_preheat(const uint8_t e, const int8_t indh, const int8_t i HOTEND_LOOP() PREHEAT_ITEMS(editable.int8, e); ACTION_ITEM_S(ui.get_preheat_label(m), MSG_PREHEAT_M_ALL, []() { - HOTEND_LOOP() thermalManager.setTargetHotend(ui.material_preset[editable.int8].hotend_temp, e); + const celsius_t t = ui.material_preset[editable.int8].hotend_temp; + HOTEND_LOOP() thermalManager.setTargetHotend(t, e); TERN(HAS_HEATED_BED, _preheat_bed(editable.int8), ui.return_to_status()); }); @@ -268,7 +269,7 @@ void menu_temperature() { // LOOP_L_N(m, PREHEAT_COUNT) { editable.int8 = m; - #if HOTENDS > 1 || HAS_HEATED_BED + #if HAS_MULTI_HOTEND || HAS_HEATED_BED SUBMENU_S(ui.get_preheat_label(m), MSG_PREHEAT_M, menu_preheat_m); #elif HAS_HOTEND ACTION_ITEM_S(ui.get_preheat_label(m), MSG_PREHEAT_M, do_preheat_end_m); @@ -295,7 +296,7 @@ void menu_temperature() { LOOP_L_N(m, PREHEAT_COUNT) { editable.int8 = m; - #if HOTENDS > 1 || HAS_HEATED_BED + #if HAS_MULTI_HOTEND || HAS_HEATED_BED SUBMENU_S(ui.get_preheat_label(m), MSG_PREHEAT_M, menu_preheat_m); #else ACTION_ITEM_S(ui.get_preheat_label(m), MSG_PREHEAT_M, do_preheat_end_m); diff --git a/Marlin/src/lcd/tft/ui_common.h b/Marlin/src/lcd/tft/ui_common.h index d3ffd4bc31..7329c31a52 100644 --- a/Marlin/src/lcd/tft/ui_common.h +++ b/Marlin/src/lcd/tft/ui_common.h @@ -57,7 +57,7 @@ void menu_item(const uint8_t row, bool sel = false); #define ABSOLUTE_ZERO -273.15 -#if HAS_TEMP_CHAMBER && HOTENDS > 1 +#if HAS_TEMP_CHAMBER && HAS_MULTI_HOTEND #define ITEM_E0 0 #define ITEM_E1 1 #define ITEM_BED 2 @@ -74,7 +74,7 @@ void menu_item(const uint8_t row, bool sel = false); #define ITEM_COOLER 0 #define ITEM_FAN 1 #define ITEMS_COUNT 2 -#elif HOTENDS > 1 +#elif HAS_MULTI_HOTEND #define ITEM_E0 0 #define ITEM_E1 1 #define ITEM_BED 2 diff --git a/Marlin/src/pins/esp32/pins_E4D.h b/Marlin/src/pins/esp32/pins_E4D.h index 54621f36c1..02a5fe4e33 100644 --- a/Marlin/src/pins/esp32/pins_E4D.h +++ b/Marlin/src/pins/esp32/pins_E4D.h @@ -32,7 +32,7 @@ #if EXTRUDERS > 1 || E_STEPPERS > 1 #error "E4d@box only supports one E Stepper. Comment out this line to continue." -#elif HOTENDS > 1 +#elif HAS_MULTI_HOTEND #error "E4d@box only supports one hotend / E-stepper. Comment out this line to continue." #endif diff --git a/Marlin/src/pins/esp32/pins_FYSETC_E4.h b/Marlin/src/pins/esp32/pins_FYSETC_E4.h index 2b2fe40c4a..4e71a66a22 100644 --- a/Marlin/src/pins/esp32/pins_FYSETC_E4.h +++ b/Marlin/src/pins/esp32/pins_FYSETC_E4.h @@ -32,7 +32,7 @@ #if EXTRUDERS > 1 || E_STEPPERS > 1 #error "FYSETC E4 only supports one E Stepper. Comment out this line to continue." -#elif HOTENDS > 1 +#elif HAS_MULTI_HOTEND #error "FYSETC E4 only supports one hotend / E-stepper. Comment out this line to continue." #endif diff --git a/Marlin/src/pins/esp32/pins_MRR_ESPA.h b/Marlin/src/pins/esp32/pins_MRR_ESPA.h index ab4f401f26..a5f70e8159 100644 --- a/Marlin/src/pins/esp32/pins_MRR_ESPA.h +++ b/Marlin/src/pins/esp32/pins_MRR_ESPA.h @@ -32,7 +32,7 @@ #if EXTRUDERS > 1 || E_STEPPERS > 1 #error "MRR ESPA only supports one E Stepper. Comment out this line to continue." -#elif HOTENDS > 1 +#elif HAS_MULTI_HOTEND #error "MRR ESPA only supports one hotend / E-stepper. Comment out this line to continue." #endif diff --git a/Marlin/src/pins/esp32/pins_MRR_ESPE.h b/Marlin/src/pins/esp32/pins_MRR_ESPE.h index 1f829b7755..ae4f0c6e36 100644 --- a/Marlin/src/pins/esp32/pins_MRR_ESPE.h +++ b/Marlin/src/pins/esp32/pins_MRR_ESPE.h @@ -33,7 +33,7 @@ #if EXTRUDERS > 2 || E_STEPPERS > 2 #error "MRR ESPE only supports two E Steppers. Comment out this line to continue." -#elif HOTENDS > 1 +#elif HAS_MULTI_HOTEND #error "MRR ESPE only supports one hotend / E-stepper. Comment out this line to continue." #endif diff --git a/Marlin/src/pins/ramps/pins_K8600.h b/Marlin/src/pins/ramps/pins_K8600.h index f37516b710..0155129927 100644 --- a/Marlin/src/pins/ramps/pins_K8600.h +++ b/Marlin/src/pins/ramps/pins_K8600.h @@ -25,7 +25,7 @@ * VERTEX NANO Arduino Mega with RAMPS EFB v1.4 pin assignments. */ -#if HOTENDS > 1 +#if HAS_MULTI_HOTEND #error "Only 1 hotend is supported for Vertex Nano." #endif diff --git a/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h b/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h index 3b2639b431..75ee01946a 100644 --- a/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h +++ b/Marlin/src/pins/ramps/pins_LONGER3D_LKx_PRO.h @@ -28,7 +28,7 @@ #define REQUIRE_MEGA2560 #include "env_validate.h" -#if HOTENDS > 1 || E_STEPPERS > 1 +#if HAS_MULTI_HOTEND || E_STEPPERS > 1 #error "Longer3D LGT KIT V1.0 board only supports one hotend / E-stepper. Comment out this line to continue." #endif diff --git a/Marlin/src/pins/ramps/pins_RAMPS_ENDER_4.h b/Marlin/src/pins/ramps/pins_RAMPS_ENDER_4.h index ebd0bdc0c6..3583958906 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS_ENDER_4.h +++ b/Marlin/src/pins/ramps/pins_RAMPS_ENDER_4.h @@ -21,7 +21,7 @@ */ #pragma once -#if HOTENDS > 1 || E_STEPPERS > 1 +#if HAS_MULTI_HOTEND || E_STEPPERS > 1 #error "Ender-4 only supports one hotend / E-stepper. Comment out this line to continue." #endif diff --git a/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h b/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h index f8e3e76ada..b0b201f1d5 100644 --- a/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h +++ b/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h @@ -23,7 +23,7 @@ #include "env_validate.h" -#if HOTENDS > 1 || E_STEPPERS > 1 +#if HAS_MULTI_HOTEND || E_STEPPERS > 1 #error "CCROBOT-ONLINE MEEB_3DP only supports one hotend / E-stepper. Comment out this line to continue." #endif diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h index ea58b5b3a9..bf2a55fc7b 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h @@ -27,7 +27,7 @@ #include "env_validate.h" -#if HOTENDS > 1 || E_STEPPERS > 1 +#if HAS_MULTI_HOTEND || E_STEPPERS > 1 #error "Creality V4 only supports one hotend / E-stepper. Comment out this line to continue." #endif diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h index 52ebdecc35..ae54805a94 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h @@ -27,7 +27,7 @@ #include "env_validate.h" -#if HOTENDS > 1 || E_STEPPERS > 1 +#if HAS_MULTI_HOTEND || E_STEPPERS > 1 #error "CREALITY supports up to 1 hotends / E-steppers. Comment out this line to continue." #endif diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V452.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V452.h index 64e07a0bc8..a2add81c8b 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V452.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V452.h @@ -25,7 +25,7 @@ * Creality v4.5.2 (STM32F103RET6) board pin assignments */ -#if HOTENDS > 1 || E_STEPPERS > 1 +#if HAS_MULTI_HOTEND || E_STEPPERS > 1 #error "Creality v4.5.2 only supports one hotend / E-stepper. Comment out this line to continue." #endif diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V453.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V453.h index ca437312c8..7b8c3280d2 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V453.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V453.h @@ -25,7 +25,7 @@ * Creality v4.5.3 (STM32F103RET6) board pin assignments */ -#if HOTENDS > 1 || E_STEPPERS > 1 +#if HAS_MULTI_HOTEND || E_STEPPERS > 1 #error "Creality v4.5.3 only supports one hotend / E-stepper. Comment out this line to continue." #endif diff --git a/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h b/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h index 3b7a4e4402..e19d330092 100644 --- a/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h +++ b/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h @@ -31,7 +31,7 @@ #if NOT_TARGET(__STM32F1__, STM32F1xx) #error "Oops! Select an STM32F1 board in 'Tools > Board.'" -#elif HOTENDS > 1 || E_STEPPERS > 1 +#elif HAS_MULTI_HOTEND || E_STEPPERS > 1 #error "FLSUN HiSpeedV1 only supports one hotend / E-stepper. Comment out this line to continue." #endif diff --git a/Marlin/src/pins/stm32f1/pins_JGAURORA_A5S_A1.h b/Marlin/src/pins/stm32f1/pins_JGAURORA_A5S_A1.h index 98465a8607..beae0a3bf0 100644 --- a/Marlin/src/pins/stm32f1/pins_JGAURORA_A5S_A1.h +++ b/Marlin/src/pins/stm32f1/pins_JGAURORA_A5S_A1.h @@ -32,7 +32,7 @@ #include "env_validate.h" -#if HOTENDS > 1 || E_STEPPERS > 1 +#if HAS_MULTI_HOTEND || E_STEPPERS > 1 #error "JGAurora A5S A1 only supports one hotend / E-stepper. Comment out this line to continue." #endif diff --git a/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h b/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h index 34fbdaf02f..7585a6e289 100644 --- a/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h +++ b/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h @@ -27,7 +27,7 @@ #if NOT_TARGET(__STM32F1__, STM32F1xx) #error "Oops! Select a STM32F1 board in 'Tools > Board.'" -#elif HOTENDS > 1 || E_STEPPERS > 1 +#elif HAS_MULTI_HOTEND || E_STEPPERS > 1 #error "Longer3D only supports one hotend / E-stepper. Comment out this line to continue." #endif diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3.h index 89ace3493f..6b05bb7a74 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3.h @@ -25,7 +25,7 @@ * MKS Robin E3 (STM32F103RCT6) board pin assignments */ -#if HOTENDS > 1 || E_STEPPERS > 1 +#if HAS_MULTI_HOTEND || E_STEPPERS > 1 #error "MKS Robin E3 only supports one hotend / E-stepper. Comment out this line to continue." #endif diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D.h index a629bce9f3..9d11af43ef 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D.h @@ -25,7 +25,7 @@ * MKS Robin E3D (STM32F103RCT6) board pin assignments */ -#if HOTENDS > 1 || E_STEPPERS > 1 +#if HAS_MULTI_HOTEND || E_STEPPERS > 1 #error "MKS Robin E3D only supports one hotend / E-stepper. Comment out this line to continue." #endif diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D_V1_1.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D_V1_1.h index 718f9dc27a..930ef9722d 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D_V1_1.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3D_V1_1.h @@ -25,7 +25,7 @@ * MKS Robin E3D v1.1 (STM32F103RCT6) board pin assignments */ -#if HOTENDS > 1 || E_STEPPERS > 1 +#if HAS_MULTI_HOTEND || E_STEPPERS > 1 #error "MKS Robin E3D v1.1 only supports one hotend / E-stepper. Comment out this line to continue." #endif diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h index c5080b5227..06b9721403 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h @@ -27,7 +27,7 @@ #include "env_validate.h" -#if HOTENDS > 1 || E_STEPPERS > 1 +#if HAS_MULTI_HOTEND || E_STEPPERS > 1 #error "MKS Robin E3P only supports one hotend / E-stepper. Comment out this line to continue." #elif HAS_FSMC_TFT #error "MKS Robin E3P doesn't support FSMC-based TFT displays." diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_V1_1.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_V1_1.h index 30720e0c7f..7a38507c76 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_V1_1.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_V1_1.h @@ -25,7 +25,7 @@ * MKS Robin E3 v1.1 (STM32F103RCT6) board pin assignments */ -#if HOTENDS > 1 || E_STEPPERS > 1 +#if HAS_MULTI_HOTEND || E_STEPPERS > 1 #error "MKS Robin E3 v1.1 only supports one hotend / E-stepper. Comment out this line to continue." #endif diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE.h index 3767748e53..94f7313996 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE.h @@ -23,7 +23,7 @@ #include "env_validate.h" -#if HOTENDS > 1 || E_STEPPERS > 1 +#if HAS_MULTI_HOTEND || E_STEPPERS > 1 #error "MKS Robin Lite only supports one hotend / E-stepper. Comment out this line to continue." #endif diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h index ae45d8b6d1..c981fdc00a 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h @@ -27,7 +27,7 @@ #include "env_validate.h" -#if HOTENDS > 1 || E_STEPPERS > 1 +#if HAS_MULTI_HOTEND || E_STEPPERS > 1 #error "MKS Robin mini only supports one hotend / E-stepper. Comment out this line to continue." #endif diff --git a/Marlin/src/pins/stm32f4/pins_ANET_ET4.h b/Marlin/src/pins/stm32f4/pins_ANET_ET4.h index 8343010432..eb3af65f32 100644 --- a/Marlin/src/pins/stm32f4/pins_ANET_ET4.h +++ b/Marlin/src/pins/stm32f4/pins_ANET_ET4.h @@ -23,7 +23,7 @@ #include "env_validate.h" -#if HOTENDS > 1 || E_STEPPERS > 1 +#if HAS_MULTI_HOTEND || E_STEPPERS > 1 #error "Anet ET4 only supports one hotend / E-stepper. Comment out this line to continue." #endif diff --git a/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h b/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h index d054e354f7..44485b0776 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h @@ -23,7 +23,7 @@ #include "env_validate.h" -#if HOTENDS > 1 || E_STEPPERS > 1 +#if HAS_MULTI_HOTEND || E_STEPPERS > 1 #error "BIGTREE BTT002 V1.0 only supports one hotend / E-stepper. Comment out this line to continue." #endif diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_X.h b/Marlin/src/pins/stm32f4/pins_LERDGE_X.h index 12e47e35cc..7f35c0f5dd 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_X.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_X.h @@ -24,7 +24,7 @@ #define ALLOW_STM32DUINO #include "env_validate.h" -#if HOTENDS > 1 || E_STEPPERS > 1 +#if HAS_MULTI_HOTEND || E_STEPPERS > 1 #error "LERDGE X only supports one hotend / E-stepper. Comment out this line to continue." #endif diff --git a/Marlin/src/pins/stm32f7/pins_REMRAM_V1.h b/Marlin/src/pins/stm32f7/pins_REMRAM_V1.h index 133dcd2935..dbf2593c48 100644 --- a/Marlin/src/pins/stm32f7/pins_REMRAM_V1.h +++ b/Marlin/src/pins/stm32f7/pins_REMRAM_V1.h @@ -32,7 +32,7 @@ #define SRAM_EEPROM_EMULATION // Emulate the EEPROM using Backup SRAM #endif -#if HOTENDS > 1 || E_STEPPERS > 1 +#if HAS_MULTI_HOTEND || E_STEPPERS > 1 #error "RemRam only supports one hotend / E-stepper. Comment out this line to continue." #endif From a1c4aad1472bb418bc0c0bc52322032b68df3a1f Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Thu, 28 Oct 2021 03:26:05 -0700 Subject: [PATCH 067/125] =?UTF-8?q?=F0=9F=90=9B=20Fix=20MKS=20Robin=20E3/E?= =?UTF-8?q?3D=20Z=20Stop/Probe=20pins=20(#23034)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h index dd1008ee3a..a221ce94c5 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h @@ -54,8 +54,14 @@ // #define X_STOP_PIN PA12 #define Y_STOP_PIN PA11 -#define Z_MIN_PIN PC6 -#define Z_MAX_PIN PB1 +#define Z_STOP_PIN PC6 + +// +// Z Probe +// +#ifndef Z_MIN_PROBE_PIN + #define Z_MIN_PROBE_PIN PB1 +#endif // // Steppers From 5d04c7496cec3b8a564ac302da116e3783c4b1d3 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 28 Oct 2021 19:22:35 -0500 Subject: [PATCH 068/125] =?UTF-8?q?=F0=9F=90=9B=20Fix=20EZBoard=20V2=20boa?= =?UTF-8?q?rd=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/boards.h | 2 +- Marlin/src/pins/pins.h | 7 +++++-- ...{pins_TH3D_EZBOARD_LITE_V2.h => pins_TH3D_EZBOARD_V2.h} | 2 +- .../PeripheralPins.c | 0 .../PinNamesVar.h | 0 .../hal_conf_extra.h | 0 .../ldscript.ld | 0 .../variant.cpp | 0 .../variant.h | 0 ini/stm32f4.ini | 6 +++--- 10 files changed, 10 insertions(+), 7 deletions(-) rename Marlin/src/pins/stm32f4/{pins_TH3D_EZBOARD_LITE_V2.h => pins_TH3D_EZBOARD_V2.h} (99%) rename buildroot/share/PlatformIO/variants/{MARLIN_TH3D_EZBOARD_LITE_V2 => MARLIN_TH3D_EZBOARD_V2}/PeripheralPins.c (100%) rename buildroot/share/PlatformIO/variants/{MARLIN_TH3D_EZBOARD_LITE_V2 => MARLIN_TH3D_EZBOARD_V2}/PinNamesVar.h (100%) rename buildroot/share/PlatformIO/variants/{MARLIN_TH3D_EZBOARD_LITE_V2 => MARLIN_TH3D_EZBOARD_V2}/hal_conf_extra.h (100%) rename buildroot/share/PlatformIO/variants/{MARLIN_TH3D_EZBOARD_LITE_V2 => MARLIN_TH3D_EZBOARD_V2}/ldscript.ld (100%) rename buildroot/share/PlatformIO/variants/{MARLIN_TH3D_EZBOARD_LITE_V2 => MARLIN_TH3D_EZBOARD_V2}/variant.cpp (100%) rename buildroot/share/PlatformIO/variants/{MARLIN_TH3D_EZBOARD_LITE_V2 => MARLIN_TH3D_EZBOARD_V2}/variant.h (100%) diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 82c68f3171..6e116888bc 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -402,7 +402,7 @@ #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_TH3D_EZBOARD_V2 4233 // TH3D EZBoard 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) diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 3b83e14d62..1a05f55fdc 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -659,8 +659,8 @@ #include "stm32f4/pins_FYSETC_CHEETAH_V20.h" // STM32F4 env:FYSETC_CHEETAH_V20 #elif MB(MKS_MONSTER8) #include "stm32f4/pins_MKS_MONSTER8.h" // STM32F4 env:mks_monster8 env:mks_monster8_usb_flash_drive env:mks_monster8_usb_flash_drive_msc -#elif MB(TH3D_EZBOARD_LITE_V2) - #include "stm32f4/pins_TH3D_EZBOARD_LITE_V2.h" // STM32F4 env:TH3D_EZBoard_Lite_V2 +#elif MB(TH3D_EZBOARD_V2) + #include "stm32f4/pins_TH3D_EZBOARD_V2.h" // STM32F4 env:TH3D_EZBoard_V2 #elif MB(INDEX_REV03) #include "stm32f4/pins_INDEX_REV03.h" // STM32F4 env:Index_Mobo_Rev03 #elif MB(MKS_ROBIN_NANO_V1_3_F4) @@ -752,6 +752,7 @@ #define BOARD_RAMPS_DAGOMA -1020 #define BOARD_RAMPS_LONGER3D_LK4PRO -1021 #define BOARD_BTT_SKR_V2_0 -1022 + #define BOARD_TH3D_EZBOARD_LITE_V2 -1023 #if MB(MKS_13) #error "BOARD_MKS_13 has been renamed BOARD_MKS_GEN_13. Please update your configuration." @@ -801,6 +802,8 @@ #error "BOARD_RAMPS_LONGER3D_LK4PRO is now BOARD_LONGER3D_LKx_PRO. Please update your configuration." #elif MB(BTT_SKR_V2_0) #error "BTT_SKR_V2_0 is now BTT_SKR_V2_0_REV_A or BTT_SKR_V2_0_REV_B. See https://bit.ly/3t5d9JQ for more information. Please update your configuration." + #elif MB(BOARD_TH3D_EZBOARD_LITE_V2) + #error "BOARD_TH3D_EZBOARD_LITE_V2 is now BOARD_TH3D_EZBOARD_V2. Please update your configuration." #elif defined(MOTHERBOARD) #error "Unknown MOTHERBOARD value set in Configuration.h." #else diff --git a/Marlin/src/pins/stm32f4/pins_TH3D_EZBOARD_LITE_V2.h b/Marlin/src/pins/stm32f4/pins_TH3D_EZBOARD_V2.h similarity index 99% rename from Marlin/src/pins/stm32f4/pins_TH3D_EZBOARD_LITE_V2.h rename to Marlin/src/pins/stm32f4/pins_TH3D_EZBOARD_V2.h index bff3f5b6ee..6368142c34 100644 --- a/Marlin/src/pins/stm32f4/pins_TH3D_EZBOARD_LITE_V2.h +++ b/Marlin/src/pins/stm32f4/pins_TH3D_EZBOARD_V2.h @@ -24,7 +24,7 @@ #define ALLOW_STM32DUINO #include "env_validate.h" -#define BOARD_INFO_NAME "TH3D EZBoard Lite V2" +#define BOARD_INFO_NAME "TH3D EZBoard V2" #define BOARD_WEBSITE_URL "th3dstudio.com" //#define V3_EZABL_ON_SERVO // As in TH3D Firmware Config diff --git a/buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_LITE_V2/PeripheralPins.c b/buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_V2/PeripheralPins.c similarity index 100% rename from buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_LITE_V2/PeripheralPins.c rename to buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_V2/PeripheralPins.c diff --git a/buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_LITE_V2/PinNamesVar.h b/buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_V2/PinNamesVar.h similarity index 100% rename from buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_LITE_V2/PinNamesVar.h rename to buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_V2/PinNamesVar.h diff --git a/buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_LITE_V2/hal_conf_extra.h b/buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_V2/hal_conf_extra.h similarity index 100% rename from buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_LITE_V2/hal_conf_extra.h rename to buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_V2/hal_conf_extra.h diff --git a/buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_LITE_V2/ldscript.ld b/buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_V2/ldscript.ld similarity index 100% rename from buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_LITE_V2/ldscript.ld rename to buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_V2/ldscript.ld diff --git a/buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_LITE_V2/variant.cpp b/buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_V2/variant.cpp similarity index 100% rename from buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_LITE_V2/variant.cpp rename to buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_V2/variant.cpp diff --git a/buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_LITE_V2/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_V2/variant.h similarity index 100% rename from buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_LITE_V2/variant.h rename to buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_V2/variant.h diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 3e0c400a6b..3d7f4d2d02 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -521,13 +521,13 @@ build_flags = ${env:mks_monster8_usb_flash_drive.build_flags} build_unflags = -DUSBD_USE_CDC # -# TH3D EZBoard Lite v2.0 (STM32F405RGT6 ARM Cortex-M4) +# TH3D EZBoard v2.0 (STM32F405RGT6 ARM Cortex-M4) # -[env:TH3D_EZBoard_Lite_V2] +[env:TH3D_EZBoard_V2] platform = ${common_stm32.platform} extends = stm32_variant board = genericSTM32F405RG -board_build.variant = MARLIN_TH3D_EZBOARD_LITE_V2 +board_build.variant = MARLIN_TH3D_EZBOARD_V2 board_build.offset = 0xC000 board_upload.offset_address = 0x0800C000 build_flags = ${stm32_variant.build_flags} -DHSE_VALUE=12000000U -O0 From 2c8dce69e16daa08de4a62f115b06fe68c0db17d Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Fri, 29 Oct 2021 00:58:40 +0000 Subject: [PATCH 069/125] [cron] Bump distribution date (2021-10-29) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index e61ec1b4e7..e0165a280f 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-10-28" +//#define STRING_DISTRIBUTION_DATE "2021-10-29" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index a1ad05bd3a..f61066e58f 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-10-28" + #define STRING_DISTRIBUTION_DATE "2021-10-29" #endif /** From 3b9bea6f80f02b76f6b71c6c1dcdb751e3611d8e Mon Sep 17 00:00:00 2001 From: tome9111991 <57866234+tome9111991@users.noreply.github.com> Date: Sat, 30 Oct 2021 00:49:12 +0200 Subject: [PATCH 070/125] =?UTF-8?q?=F0=9F=90=9B=20Fix=20E3V2=20(CrealityUI?= =?UTF-8?q?)=20Tune/Prepare=20>=20Zoffset=20(#23040)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/e3v2/creality/dwin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/lcd/e3v2/creality/dwin.cpp b/Marlin/src/lcd/e3v2/creality/dwin.cpp index 0f8a739728..5114e8a38a 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.cpp +++ b/Marlin/src/lcd/e3v2/creality/dwin.cpp @@ -615,7 +615,7 @@ void Draw_Edit_Float3(const uint8_t row, const uint16_t value, const bool active } void Draw_Edit_Signed_Float2(const uint8_t row, const float value, const bool active=false) { - DWIN_Draw_Signed_Float(font8x16, active ? Select_Color : Color_Bg_Black, 2, UNITFDIGITS, 220 + 8 - UNITFDIGITS * 8, EBASE(row), value); + DWIN_Draw_Signed_Float(font8x16, active ? Select_Color : Color_Bg_Black, 2, UNITFDIGITS + 1, 220 + 8 - UNITFDIGITS * 8, EBASE(row), value); } void Draw_Edit_Signed_Float3(const uint8_t row, const float value, const bool active=false) { From 1d80464ba77bc576426f15af28a633bf48d769ad Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 27 Oct 2021 21:15:58 -0500 Subject: [PATCH 071/125] =?UTF-8?q?=F0=9F=8E=A8=20Define=20HAS=5FPREHEAT?= =?UTF-8?q?=20conditional?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/bedlevel/G26.cpp | 6 +- Marlin/src/gcode/gcode.cpp | 2 +- Marlin/src/gcode/gcode.h | 2 +- Marlin/src/gcode/lcd/M145.cpp | 4 +- Marlin/src/gcode/temp/M104_M109.cpp | 2 +- Marlin/src/gcode/temp/M106_M107.cpp | 4 +- Marlin/src/gcode/temp/M140_M190.cpp | 2 +- Marlin/src/inc/Conditionals_post.h | 6 +- Marlin/src/lcd/e3v2/creality/dwin.cpp | 153 ++++++++++--------- Marlin/src/lcd/e3v2/creality/dwin.h | 11 +- Marlin/src/lcd/e3v2/enhanced/dwin.cpp | 12 +- Marlin/src/lcd/e3v2/enhanced/dwin.h | 21 +-- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 6 +- Marlin/src/lcd/extui/nextion/nextion_tft.cpp | 4 +- Marlin/src/lcd/extui/ui_api.cpp | 2 +- Marlin/src/lcd/extui/ui_api.h | 2 +- Marlin/src/lcd/language/language_an.h | 2 +- Marlin/src/lcd/language/language_bg.h | 2 +- Marlin/src/lcd/language/language_ca.h | 2 +- Marlin/src/lcd/language/language_cz.h | 4 +- Marlin/src/lcd/language/language_da.h | 2 +- Marlin/src/lcd/language/language_de.h | 4 +- Marlin/src/lcd/language/language_el.h | 2 +- Marlin/src/lcd/language/language_el_gr.h | 2 +- Marlin/src/lcd/language/language_en.h | 2 +- Marlin/src/lcd/language/language_es.h | 4 +- Marlin/src/lcd/language/language_eu.h | 4 +- Marlin/src/lcd/language/language_fi.h | 2 +- Marlin/src/lcd/language/language_fr.h | 4 +- Marlin/src/lcd/language/language_gl.h | 4 +- Marlin/src/lcd/language/language_hr.h | 2 +- Marlin/src/lcd/language/language_hu.h | 2 +- Marlin/src/lcd/language/language_it.h | 4 +- Marlin/src/lcd/language/language_jp_kana.h | 2 +- Marlin/src/lcd/language/language_ko_KR.h | 2 +- Marlin/src/lcd/language/language_nl.h | 2 +- Marlin/src/lcd/language/language_pl.h | 2 +- Marlin/src/lcd/language/language_pt.h | 2 +- Marlin/src/lcd/language/language_pt_br.h | 4 +- Marlin/src/lcd/language/language_ro.h | 4 +- Marlin/src/lcd/language/language_ru.h | 2 +- Marlin/src/lcd/language/language_sk.h | 2 +- Marlin/src/lcd/language/language_sv.h | 2 +- Marlin/src/lcd/language/language_tr.h | 4 +- Marlin/src/lcd/language/language_uk.h | 2 +- Marlin/src/lcd/language/language_vi.h | 4 +- Marlin/src/lcd/language/language_zh_CN.h | 4 +- Marlin/src/lcd/language/language_zh_TW.h | 4 +- Marlin/src/lcd/marlinui.cpp | 2 +- Marlin/src/lcd/marlinui.h | 4 +- Marlin/src/lcd/menu/menu_configuration.cpp | 4 +- Marlin/src/lcd/menu/menu_filament.cpp | 2 +- Marlin/src/lcd/menu/menu_temperature.cpp | 6 +- Marlin/src/lcd/menu/menu_ubl.cpp | 8 +- Marlin/src/module/settings.cpp | 10 +- 55 files changed, 183 insertions(+), 182 deletions(-) diff --git a/Marlin/src/gcode/bedlevel/G26.cpp b/Marlin/src/gcode/bedlevel/G26.cpp index e111bcd8aa..728771d580 100644 --- a/Marlin/src/gcode/bedlevel/G26.cpp +++ b/Marlin/src/gcode/bedlevel/G26.cpp @@ -520,7 +520,7 @@ void GcodeSuite::G26() { g26.keep_heaters_on = parser.boolval('K'); // Accept 'I' if temperature presets are defined - #if PREHEAT_COUNT + #if HAS_PREHEAT const uint8_t preset_index = parser.seenval('I') ? _MIN(parser.value_byte(), PREHEAT_COUNT - 1) + 1 : 0; #endif @@ -530,7 +530,7 @@ void GcodeSuite::G26() { celsius_t bedtemp = 0; // Use the 'I' index if temperature presets are defined - #if PREHEAT_COUNT + #if HAS_PREHEAT if (preset_index) bedtemp = ui.material_preset[preset_index - 1].bed_temp; #endif @@ -613,7 +613,7 @@ void GcodeSuite::G26() { celsius_t noztemp = 0; // Accept 'I' if temperature presets are defined - #if PREHEAT_COUNT + #if HAS_PREHEAT if (preset_index) noztemp = ui.material_preset[preset_index - 1].hotend_temp; #endif diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 30c7d926e0..fb1669c1ea 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -640,7 +640,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 120: M120(); break; // M120: Enable endstops case 121: M121(); break; // M121: Disable endstops - #if PREHEAT_COUNT + #if HAS_PREHEAT case 145: M145(); break; // M145: Set material heatup parameters #endif diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 5ad4750fe4..8de15fc9c7 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -749,7 +749,7 @@ private: static void M193(); #endif - #if PREHEAT_COUNT + #if HAS_PREHEAT static void M145(); static void M145_report(const bool forReplay=true); #endif diff --git a/Marlin/src/gcode/lcd/M145.cpp b/Marlin/src/gcode/lcd/M145.cpp index 2dba238d3f..8dbe2fb07e 100644 --- a/Marlin/src/gcode/lcd/M145.cpp +++ b/Marlin/src/gcode/lcd/M145.cpp @@ -22,7 +22,7 @@ #include "../../inc/MarlinConfig.h" -#if PREHEAT_COUNT +#if HAS_PREHEAT #include "../gcode.h" #include "../../lcd/marlinui.h" @@ -79,4 +79,4 @@ void GcodeSuite::M145_report(const bool forReplay/*=true*/) { } } -#endif // PREHEAT_COUNT +#endif // HAS_PREHEAT diff --git a/Marlin/src/gcode/temp/M104_M109.cpp b/Marlin/src/gcode/temp/M104_M109.cpp index efda04def5..baaac02100 100644 --- a/Marlin/src/gcode/temp/M104_M109.cpp +++ b/Marlin/src/gcode/temp/M104_M109.cpp @@ -88,7 +88,7 @@ void GcodeSuite::M104_M109(const bool isM109) { celsius_t temp = 0; // Accept 'I' if temperature presets are defined - #if PREHEAT_COUNT + #if HAS_PREHEAT got_temp = parser.seenval('I'); if (got_temp) { const uint8_t index = parser.value_byte(); diff --git a/Marlin/src/gcode/temp/M106_M107.cpp b/Marlin/src/gcode/temp/M106_M107.cpp index 3f85c53d78..98e87c415d 100644 --- a/Marlin/src/gcode/temp/M106_M107.cpp +++ b/Marlin/src/gcode/temp/M106_M107.cpp @@ -32,7 +32,7 @@ #include "../../module/planner.h" #endif -#if PREHEAT_COUNT +#if HAS_PREHEAT #include "../../lcd/marlinui.h" #endif @@ -75,7 +75,7 @@ void GcodeSuite::M106() { uint16_t speed = dspeed; // Accept 'I' if temperature presets are defined - #if PREHEAT_COUNT + #if HAS_PREHEAT const bool got_preset = parser.seenval('I'); if (got_preset) speed = ui.material_preset[_MIN(parser.value_byte(), PREHEAT_COUNT - 1)].fan_speed; #else diff --git a/Marlin/src/gcode/temp/M140_M190.cpp b/Marlin/src/gcode/temp/M140_M190.cpp index edc15b9cba..7532defccd 100644 --- a/Marlin/src/gcode/temp/M140_M190.cpp +++ b/Marlin/src/gcode/temp/M140_M190.cpp @@ -63,7 +63,7 @@ void GcodeSuite::M140_M190(const bool isM190) { celsius_t temp = 0; // Accept 'I' if temperature presets are defined - #if PREHEAT_COUNT + #if HAS_PREHEAT got_temp = parser.seenval('I'); if (got_temp) { const uint8_t index = parser.value_byte(); diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 6a70a5ce54..c8b6d504e2 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -2876,10 +2876,14 @@ #elif defined(PREHEAT_1_LABEL) #define PREHEAT_COUNT 1 #endif + #if PREHEAT_COUNT && ANY(HAS_HOTEND, HAS_HEATED_BED, HAS_FAN) + #define HAS_PREHEAT 1 + #endif #endif -#if !PREHEAT_COUNT +#if !HAS_PREHEAT #undef PREHEAT_SHORTCUT_MENU_ITEM + #undef DGUS_PREHEAT_UI #endif /** diff --git a/Marlin/src/lcd/e3v2/creality/dwin.cpp b/Marlin/src/lcd/e3v2/creality/dwin.cpp index 5114e8a38a..a27762d71e 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.cpp +++ b/Marlin/src/lcd/e3v2/creality/dwin.cpp @@ -165,14 +165,9 @@ typedef struct { } select_t; select_t select_page{0}, select_file{0}, select_print{0}, select_prepare{0} - , select_control{0}, select_axis{0}, select_temp{0}, select_motion{0}, select_tune{0} - , select_advset{0}, select_PLA{0}, select_ABS{0} - , select_speed{0} - , select_acc{0} - , select_jerk{0} - , select_step{0} - , select_item{0} - ; + , select_control{0}, select_axis{0}, select_temp{0}, select_motion{0}, select_tune{0} + , select_advset{0}, select_PLA{0}, select_ABS{0} + , select_speed{0}, select_acc{0}, select_jerk{0}, select_step{0}, select_item{0}; uint8_t index_file = MROWS, index_prepare = MROWS, @@ -700,7 +695,7 @@ void Item_Prepare_Home(const uint8_t row) { #endif -#if HAS_HOTEND +#if HAS_PREHEAT void Item_Prepare_PLA(const uint8_t row) { if (HMI_IsChinese()) Item_AreaCopy(100, 89, 151, 101, row); @@ -715,22 +710,22 @@ void Item_Prepare_Home(const uint8_t row) { Draw_Menu_Line(row, ICON_PLAPreheat); } - void Item_Prepare_ABS(const uint8_t row) { - if (HMI_IsChinese()) - Item_AreaCopy(180, 89, 233, 100, row); - else { - #ifdef USE_STRING_TITLES - DWIN_Draw_Label(row, F("Preheat " PREHEAT_2_LABEL)); - #else - Item_AreaCopy(108, 76, 155, 87, row); // "Preheat" - say_abs_en(52, row); // "ABS" - #endif + #if PREHEAT_COUNT > 1 + void Item_Prepare_ABS(const uint8_t row) { + if (HMI_IsChinese()) + Item_AreaCopy(180, 89, 233, 100, row); + else { + #ifdef USE_STRING_TITLES + DWIN_Draw_Label(row, F("Preheat " PREHEAT_2_LABEL)); + #else + Item_AreaCopy(108, 76, 155, 87, row); // "Preheat" + say_abs_en(52, row); // "ABS" + #endif + } + Draw_Menu_Line(row, ICON_ABSPreheat); } - Draw_Menu_Line(row, ICON_ABSPreheat); - } -#endif + #endif -#if HAS_PREHEAT void Item_Prepare_Cool(const uint8_t row) { if (HMI_IsChinese()) Item_AreaCopy(1, 104, 56, 117, row); @@ -785,11 +780,11 @@ void Draw_Prepare_Menu() { #if HAS_ZOFFSET_ITEM if (PVISI(PREPARE_CASE_ZOFF)) Item_Prepare_Offset(PSCROL(PREPARE_CASE_ZOFF)); // Edit Z-Offset / Babystep / Set Home Offset #endif - #if HAS_HOTEND - if (PVISI(PREPARE_CASE_PLA)) Item_Prepare_PLA(PSCROL(PREPARE_CASE_PLA)); // Preheat PLA - if (PVISI(PREPARE_CASE_ABS)) Item_Prepare_ABS(PSCROL(PREPARE_CASE_ABS)); // Preheat ABS - #endif #if HAS_PREHEAT + if (PVISI(PREPARE_CASE_PLA)) Item_Prepare_PLA(PSCROL(PREPARE_CASE_PLA)); // Preheat PLA + #if PREHEAT_COUNT > 1 + if (PVISI(PREPARE_CASE_ABS)) Item_Prepare_ABS(PSCROL(PREPARE_CASE_ABS)); // Preheat ABS + #endif if (PVISI(PREPARE_CASE_COOL)) Item_Prepare_Cool(PSCROL(PREPARE_CASE_COOL)); // Cooldown #endif if (PVISI(PREPARE_CASE_LANG)) Item_Prepare_Lang(PSCROL(PREPARE_CASE_LANG)); // Language CN/EN @@ -1425,25 +1420,34 @@ void HMI_Move_Z() { uint8_t temp_line; switch (HMI_ValueStruct.show_mode) { case -1: temp_line = TEMP_CASE_TEMP; break; - case -2: temp_line = PREHEAT_CASE_TEMP; break; - case -3: temp_line = PREHEAT_CASE_TEMP; break; + #if HAS_PREHEAT + case -2: temp_line = PREHEAT_CASE_TEMP; break; + #if PREHEAT_COUNT > 1 + case -3: temp_line = PREHEAT_CASE_TEMP; break; + #endif + #endif default: temp_line = TUNE_CASE_TEMP + MROWS - index_tune; } if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.E_Temp)) { EncoderRate.enabled = false; - if (HMI_ValueStruct.show_mode == -2) { - checkkey = PLAPreheat; - ui.material_preset[0].hotend_temp = HMI_ValueStruct.E_Temp; - Draw_Edit_Integer3(temp_line, ui.material_preset[0].hotend_temp); - return; - } - else if (HMI_ValueStruct.show_mode == -3) { - checkkey = ABSPreheat; - ui.material_preset[1].hotend_temp = HMI_ValueStruct.E_Temp; - Draw_Edit_Integer3(temp_line, ui.material_preset[1].hotend_temp); - return; - } - else if (HMI_ValueStruct.show_mode == -1) // Temperature + #if HAS_PREHEAT + if (HMI_ValueStruct.show_mode == -2) { + checkkey = PLAPreheat; + ui.material_preset[0].hotend_temp = HMI_ValueStruct.E_Temp; + Draw_Edit_Integer3(temp_line, ui.material_preset[0].hotend_temp); + return; + } + #if PREHEAT_COUNT > 1 + if (HMI_ValueStruct.show_mode == -3) { + checkkey = ABSPreheat; + ui.material_preset[1].hotend_temp = HMI_ValueStruct.E_Temp; + Draw_Edit_Integer3(temp_line, ui.material_preset[1].hotend_temp); + return; + } + #endif + #endif + + if (HMI_ValueStruct.show_mode == -1) // Temperature checkkey = TemperatureID; else checkkey = Tune; @@ -1467,28 +1471,33 @@ void HMI_Move_Z() { uint8_t bed_line; switch (HMI_ValueStruct.show_mode) { case -1: bed_line = TEMP_CASE_BED; break; - case -2: bed_line = PREHEAT_CASE_BED; break; - case -3: bed_line = PREHEAT_CASE_BED; break; + #if HAS_PREHEAT + case -2: bed_line = PREHEAT_CASE_BED; break; + #if PREHEAT_COUNT > 1 + case -3: bed_line = PREHEAT_CASE_BED; break; + #endif + #endif default: bed_line = TUNE_CASE_BED + MROWS - index_tune; } if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Bed_Temp)) { EncoderRate.enabled = false; - if (HMI_ValueStruct.show_mode == -2) { - checkkey = PLAPreheat; - ui.material_preset[0].bed_temp = HMI_ValueStruct.Bed_Temp; - Draw_Edit_Integer3(bed_line, ui.material_preset[0].bed_temp); - return; - } - else if (HMI_ValueStruct.show_mode == -3) { - checkkey = ABSPreheat; - ui.material_preset[1].bed_temp = HMI_ValueStruct.Bed_Temp; - Draw_Edit_Integer3(bed_line, ui.material_preset[1].bed_temp); - return; - } - else if (HMI_ValueStruct.show_mode == -1) - checkkey = TemperatureID; - else - checkkey = Tune; + #if HAS_PREHEAT + if (HMI_ValueStruct.show_mode == -2) { + checkkey = PLAPreheat; + ui.material_preset[0].bed_temp = HMI_ValueStruct.Bed_Temp; + Draw_Edit_Integer3(bed_line, ui.material_preset[0].bed_temp); + return; + } + #if PREHEAT_COUNT > 1 + if (HMI_ValueStruct.show_mode == -3) { + checkkey = ABSPreheat; + ui.material_preset[1].bed_temp = HMI_ValueStruct.Bed_Temp; + Draw_Edit_Integer3(bed_line, ui.material_preset[1].bed_temp); + return; + } + #endif + #endif + checkkey = HMI_ValueStruct.show_mode == -1 ? TemperatureID : Tune; Draw_Edit_Integer3(bed_line, HMI_ValueStruct.Bed_Temp); thermalManager.setTargetBed(HMI_ValueStruct.Bed_Temp); return; @@ -1522,16 +1531,15 @@ void HMI_Move_Z() { Draw_Edit_Integer3(fan_line, ui.material_preset[0].fan_speed); return; } - else if (HMI_ValueStruct.show_mode == -3) { - checkkey = ABSPreheat; - ui.material_preset[1].fan_speed = HMI_ValueStruct.Fan_speed; - Draw_Edit_Integer3(fan_line, ui.material_preset[1].fan_speed); - return; - } - else if (HMI_ValueStruct.show_mode == -1) - checkkey = TemperatureID; - else - checkkey = Tune; + #if PREHEAT_COUNT > 1 + if (HMI_ValueStruct.show_mode == -3) { + checkkey = ABSPreheat; + ui.material_preset[1].fan_speed = HMI_ValueStruct.Fan_speed; + Draw_Edit_Integer3(fan_line, ui.material_preset[1].fan_speed); + return; + } + #endif + checkkey = HMI_ValueStruct.show_mode == -1 ? TemperatureID : Tune; Draw_Edit_Integer3(fan_line, HMI_ValueStruct.Fan_speed); thermalManager.set_fan_speed(0, HMI_ValueStruct.Fan_speed); return; @@ -3068,7 +3076,7 @@ void HMI_Temperature() { EncoderRate.enabled = true; break; #endif - #if HAS_HOTEND + #if HAS_PREHEAT case TEMP_CASE_PLA: { checkkey = PLAPreheat; select_PLA.reset(); @@ -3145,7 +3153,8 @@ void HMI_Temperature() { Draw_Menu_Line(++i, ICON_WriteEEPROM); #endif } break; - + #endif + #if PREHEAT_COUNT > 1 case TEMP_CASE_ABS: { // ABS preheat setting checkkey = ABSPreheat; select_ABS.reset(); diff --git a/Marlin/src/lcd/e3v2/creality/dwin.h b/Marlin/src/lcd/e3v2/creality/dwin.h index d9ac0aa5fa..3122a6fcba 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.h +++ b/Marlin/src/lcd/e3v2/creality/dwin.h @@ -31,13 +31,6 @@ #include "../../../inc/MarlinConfigPre.h" -#if ANY(HAS_HOTEND, HAS_HEATED_BED, HAS_FAN) && PREHEAT_COUNT - #define HAS_PREHEAT 1 - #if PREHEAT_COUNT < 2 - #error "Creality DWIN requires two material preheat presets." - #endif -#endif - enum processID : uint8_t { // Process ID MainMenu, @@ -53,7 +46,9 @@ enum processID : uint8_t { Tune, #if HAS_PREHEAT PLAPreheat, - ABSPreheat, + #if PREHEAT_COUNT > 1 + ABSPreheat, + #endif #endif MaxSpeed, MaxSpeed_value, diff --git a/Marlin/src/lcd/e3v2/enhanced/dwin.cpp b/Marlin/src/lcd/e3v2/enhanced/dwin.cpp index b861b0274a..22de4d720b 100644 --- a/Marlin/src/lcd/e3v2/enhanced/dwin.cpp +++ b/Marlin/src/lcd/e3v2/enhanced/dwin.cpp @@ -3124,12 +3124,14 @@ void Draw_Prepare_Menu() { ADDMENUITEM(ICON_SetHome, GET_TEXT_F(MSG_SET_HOME_OFFSETS), onDrawHomeOffset, SetHome); #endif #endif - #if HAS_HOTEND - ADDMENUITEM(ICON_PLAPreheat, GET_TEXT_F(MSG_PREHEAT_1), onDrawPreheat1, SetPreheat0); - ADDMENUITEM(ICON_ABSPreheat, PSTR("Preheat " PREHEAT_2_LABEL), onDrawPreheat2, SetPreheat1); - ADDMENUITEM(ICON_CustomPreheat, GET_TEXT_F(MSG_PREHEAT_CUSTOM), onDrawMenuItem, SetPreheat2); - #endif #if HAS_PREHEAT + ADDMENUITEM(ICON_PLAPreheat, GET_TEXT_F(MSG_PREHEAT_1), onDrawPreheat1, SetPreheat0); + #if PREHEAT_COUNT > 1 + ADDMENUITEM(ICON_ABSPreheat, PSTR("Preheat " PREHEAT_2_LABEL), onDrawPreheat2, SetPreheat1); + #endif + #if PREHEAT_COUNT > 2 + ADDMENUITEM(ICON_CustomPreheat, GET_TEXT_F(MSG_PREHEAT_CUSTOM), onDrawMenuItem, SetPreheat2); + #endif ADDMENUITEM(ICON_Cool, GET_TEXT_F(MSG_COOLDOWN), onDrawCooldown, SetCoolDown); #endif ADDMENUITEM(ICON_Language, PSTR("UI Language"), onDrawLanguage, SetLanguage); diff --git a/Marlin/src/lcd/e3v2/enhanced/dwin.h b/Marlin/src/lcd/e3v2/enhanced/dwin.h index 0908417117..c2220c68a8 100644 --- a/Marlin/src/lcd/e3v2/enhanced/dwin.h +++ b/Marlin/src/lcd/e3v2/enhanced/dwin.h @@ -33,13 +33,6 @@ #include "../common/encoder.h" #include "../../../libs/BL24CXX.h" -#if ANY(HAS_HOTEND, HAS_HEATED_BED, HAS_FAN) && PREHEAT_COUNT - #define HAS_PREHEAT 1 - #if PREHEAT_COUNT < 2 - #error "Creality DWIN requires two material preheat presets." - #endif -#endif - #if ANY(AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT) && DISABLED(PROBE_MANUALLY) #define HAS_ONESTEP_LEVELING 1 #endif @@ -123,12 +116,14 @@ typedef struct { uint16_t Barfill_Color = Def_Barfill_Color; uint16_t Indicator_Color = Def_Indicator_Color; uint16_t Coordinate_Color = Def_Coordinate_Color; - #if HAS_HOTEND - int16_t HotendPidT = PREHEAT_1_TEMP_HOTEND; - int16_t PidCycles = 10; - #endif - #ifdef PREHEAT_1_TEMP_BED - int16_t BedPidT = PREHEAT_1_TEMP_BED; + #if HAS_PREHEAT + #ifdef PREHEAT_1_TEMP_HOTEND + int16_t HotendPidT = PREHEAT_1_TEMP_HOTEND; + int16_t PidCycles = 10; + #endif + #ifdef PREHEAT_1_TEMP_BED + int16_t BedPidT = PREHEAT_1_TEMP_BED; + #endif #endif #if ENABLED(PREVENT_COLD_EXTRUSION) int16_t ExtMinT = EXTRUDE_MINTEMP; diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 691c03af0d..9cecf202b2 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -76,10 +76,6 @@ #include "../../../module/probe.h" #endif -#if ANY(HAS_HOTEND, HAS_HEATED_BED, HAS_FAN) && PREHEAT_COUNT - #define HAS_PREHEAT 1 -#endif - #if ENABLED(POWER_LOSS_RECOVERY) #include "../../../feature/powerloss.h" #endif @@ -1593,7 +1589,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #define PREHEAT_BACK 0 #define PREHEAT_MODE (PREHEAT_BACK + 1) - #define PREHEAT_1 (PREHEAT_MODE + (PREHEAT_COUNT >= 1)) + #define PREHEAT_1 (PREHEAT_MODE + 1) #define PREHEAT_2 (PREHEAT_1 + (PREHEAT_COUNT >= 2)) #define PREHEAT_3 (PREHEAT_2 + (PREHEAT_COUNT >= 3)) #define PREHEAT_4 (PREHEAT_3 + (PREHEAT_COUNT >= 4)) diff --git a/Marlin/src/lcd/extui/nextion/nextion_tft.cpp b/Marlin/src/lcd/extui/nextion/nextion_tft.cpp index 99211a220c..2c1bde245c 100644 --- a/Marlin/src/lcd/extui/nextion/nextion_tft.cpp +++ b/Marlin/src/lcd/extui/nextion/nextion_tft.cpp @@ -335,7 +335,7 @@ void NextionTFT::PanelInfo(uint8_t req) { break; case 29: // Preheat - #if PREHEAT_COUNT + #if HAS_PREHEAT if (!isPrinting()) { // Preheat PLA if (nextion_command[4] == 'P') { @@ -560,7 +560,7 @@ void NextionTFT::PanelAction(uint8_t req) { break; case 63: // Preheat // Temps defined in configuration.h - #if PREHEAT_COUNT + #if HAS_PREHEAT if (!isPrinting()) switch (nextion_command[4]) { // Preheat PLA case 'P': diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index 72dab6f35e..7358cbce23 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -705,7 +705,7 @@ namespace ExtUI { uint8_t getIDEX_Mode() { return dual_x_carriage_mode; } #endif - #if PREHEAT_COUNT + #if HAS_PREHEAT uint16_t getMaterial_preset_E(const uint16_t index) { return ui.material_preset[index].hotend_temp; } #if HAS_HEATED_BED uint16_t getMaterial_preset_B(const uint16_t index) { return ui.material_preset[index].bed_temp; } diff --git a/Marlin/src/lcd/extui/ui_api.h b/Marlin/src/lcd/extui/ui_api.h index 7e899221ad..04a298ba58 100644 --- a/Marlin/src/lcd/extui/ui_api.h +++ b/Marlin/src/lcd/extui/ui_api.h @@ -148,7 +148,7 @@ namespace ExtUI { uint32_t getProgress_seconds_elapsed(); - #if PREHEAT_COUNT + #if HAS_PREHEAT uint16_t getMaterial_preset_E(const uint16_t); #if HAS_HEATED_BED uint16_t getMaterial_preset_B(const uint16_t); diff --git a/Marlin/src/lcd/language/language_an.h b/Marlin/src/lcd/language/language_an.h index 4669f0c233..8e4ff0e95c 100644 --- a/Marlin/src/lcd/language/language_an.h +++ b/Marlin/src/lcd/language/language_an.h @@ -56,7 +56,7 @@ namespace Language_an { LSTR MSG_SET_HOME_OFFSETS = _UxGT("Achustar desfases"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Desfase aplicau"); LSTR MSG_SET_ORIGIN = _UxGT("Establir orichen"); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Precalentar ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Precalentar ") PREHEAT_1_LABEL " ~"; LSTR MSG_PREHEAT_1_END = _UxGT("Precal. ") PREHEAT_1_LABEL _UxGT(" Boquilla"); diff --git a/Marlin/src/lcd/language/language_bg.h b/Marlin/src/lcd/language/language_bg.h index 3d332ca058..05209f7718 100644 --- a/Marlin/src/lcd/language/language_bg.h +++ b/Marlin/src/lcd/language/language_bg.h @@ -45,7 +45,7 @@ namespace Language_bg { LSTR MSG_AUTO_HOME = _UxGT("Паркиране"); LSTR MSG_SET_HOME_OFFSETS = _UxGT("Задай Начало"); LSTR MSG_SET_ORIGIN = _UxGT("Изходна точка"); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Подгряване ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Подгряване ") PREHEAT_1_LABEL " ~"; LSTR MSG_PREHEAT_1_END = _UxGT("Подгряване ") PREHEAT_1_LABEL _UxGT(" Дюза"); diff --git a/Marlin/src/lcd/language/language_ca.h b/Marlin/src/lcd/language/language_ca.h index c8f0d26a32..6fba76a552 100644 --- a/Marlin/src/lcd/language/language_ca.h +++ b/Marlin/src/lcd/language/language_ca.h @@ -54,7 +54,7 @@ namespace Language_ca { LSTR MSG_SET_HOME_OFFSETS = _UxGT("Ajusta decalatge"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Decalatge aplicat"); LSTR MSG_SET_ORIGIN = _UxGT("Estableix origen"); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Preescalfa ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Preescalfa ") PREHEAT_1_LABEL " ~"; LSTR MSG_PREHEAT_1_END = _UxGT("Preescalfa ") PREHEAT_1_LABEL _UxGT(" End"); diff --git a/Marlin/src/lcd/language/language_cz.h b/Marlin/src/lcd/language/language_cz.h index fd064b0834..596591e0f6 100644 --- a/Marlin/src/lcd/language/language_cz.h +++ b/Marlin/src/lcd/language/language_cz.h @@ -78,7 +78,7 @@ namespace Language_cz { LSTR MSG_SET_HOME_OFFSETS = _UxGT("Nastavit ofsety"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Ofsety nastaveny"); LSTR MSG_SET_ORIGIN = _UxGT("Nastavit počátek"); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Zahřát ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Zahřát ") PREHEAT_1_LABEL " ~"; LSTR MSG_PREHEAT_1_END = _UxGT("Zahřát ") PREHEAT_1_LABEL _UxGT(" end"); @@ -153,7 +153,7 @@ namespace Language_cz { LSTR MSG_UBL_DONE_EDITING_MESH = _UxGT("Konec úprav sítě"); LSTR MSG_UBL_BUILD_CUSTOM_MESH = _UxGT("Vlastní síť"); LSTR MSG_UBL_BUILD_MESH_MENU = _UxGT("Vytvořit síť"); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_UBL_BUILD_MESH_M = _UxGT("Síť bodů $"); LSTR MSG_UBL_VALIDATE_MESH_M = _UxGT("Kontrola sítě $"); #endif diff --git a/Marlin/src/lcd/language/language_da.h b/Marlin/src/lcd/language/language_da.h index ef11906ed6..e032605578 100644 --- a/Marlin/src/lcd/language/language_da.h +++ b/Marlin/src/lcd/language/language_da.h @@ -48,7 +48,7 @@ namespace Language_da { LSTR MSG_SET_HOME_OFFSETS = _UxGT("Sæt forsk. af home"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Forsk. er nu aktiv"); LSTR MSG_SET_ORIGIN = _UxGT("Sæt origin"); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Forvarm ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Forvarm ") PREHEAT_1_LABEL " ~"; LSTR MSG_PREHEAT_1_END = _UxGT("Forvarm ") PREHEAT_1_LABEL _UxGT(" end"); diff --git a/Marlin/src/lcd/language/language_de.h b/Marlin/src/lcd/language/language_de.h index 8160ad4724..613880caa6 100644 --- a/Marlin/src/lcd/language/language_de.h +++ b/Marlin/src/lcd/language/language_de.h @@ -69,7 +69,7 @@ namespace Language_de { LSTR MSG_SET_HOME_OFFSETS = _UxGT("Setze Homeversatz"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Homeversatz aktiv"); LSTR MSG_SET_ORIGIN = _UxGT("Setze Nullpunkte"); //"G92 X0 Y0 Z0" commented out in marlinui.cpp - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = PREHEAT_1_LABEL _UxGT(" Vorwärmen"); LSTR MSG_PREHEAT_1_H = PREHEAT_1_LABEL _UxGT(" Vorwärmen ~"); LSTR MSG_PREHEAT_1_END = PREHEAT_1_LABEL _UxGT(" Extr. Vorwärmen"); @@ -144,7 +144,7 @@ namespace Language_de { LSTR MSG_UBL_DONE_EDITING_MESH = _UxGT("Bearbeitung beendet"); LSTR MSG_UBL_BUILD_CUSTOM_MESH = _UxGT("Eigenes Netz erst."); LSTR MSG_UBL_BUILD_MESH_MENU = _UxGT("Netz erstellen"); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_UBL_BUILD_MESH_M = _UxGT("$ Netz erstellen"); LSTR MSG_UBL_VALIDATE_MESH_M = _UxGT("$ Netz validieren"); #endif diff --git a/Marlin/src/lcd/language/language_el.h b/Marlin/src/lcd/language/language_el.h index 21f5ca6503..3d1a79ea92 100644 --- a/Marlin/src/lcd/language/language_el.h +++ b/Marlin/src/lcd/language/language_el.h @@ -65,7 +65,7 @@ namespace Language_el { LSTR MSG_SET_HOME_OFFSETS = _UxGT("Ορισμός μετατοπίσεων"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Εφαρμογή μετατοπίσεων"); LSTR MSG_SET_ORIGIN = _UxGT("Ορισμός προέλευσης"); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Προθέρμανση ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Προθέρμανση ") PREHEAT_1_LABEL " ~"; LSTR MSG_PREHEAT_1_END = _UxGT("Προθέρμανση ") PREHEAT_1_LABEL _UxGT(" End"); diff --git a/Marlin/src/lcd/language/language_el_gr.h b/Marlin/src/lcd/language/language_el_gr.h index 5259962f02..53e3ee3b94 100644 --- a/Marlin/src/lcd/language/language_el_gr.h +++ b/Marlin/src/lcd/language/language_el_gr.h @@ -54,7 +54,7 @@ namespace Language_el_gr { LSTR MSG_SET_HOME_OFFSETS = _UxGT("Ορισμός βασικών μετατοπίσεων"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Εφαρμόστηκαν οι μετατοπίσεις"); LSTR MSG_SET_ORIGIN = _UxGT("Ορισμός προέλευσης"); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Προθέρμανση ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Προθέρμανση ") PREHEAT_1_LABEL " ~"; LSTR MSG_PREHEAT_1_END = _UxGT("Προθέρμανση ") PREHEAT_1_LABEL _UxGT(" End"); diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index c9413d3cea..8af60c1642 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -104,7 +104,7 @@ namespace Language_en { LSTR MSG_TRAMMING_WIZARD = _UxGT("Tramming Wizard"); LSTR MSG_SELECT_ORIGIN = _UxGT("Select Origin"); LSTR MSG_LAST_VALUE_SP = _UxGT("Last value "); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Preheat ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Preheat ") PREHEAT_1_LABEL " ~"; LSTR MSG_PREHEAT_1_END = _UxGT("Preheat ") PREHEAT_1_LABEL _UxGT(" End"); diff --git a/Marlin/src/lcd/language/language_es.h b/Marlin/src/lcd/language/language_es.h index 62dd69b526..38f21985ec 100644 --- a/Marlin/src/lcd/language/language_es.h +++ b/Marlin/src/lcd/language/language_es.h @@ -73,7 +73,7 @@ namespace Language_es { LSTR MSG_SET_HOME_OFFSETS = _UxGT("Ajustar desfases"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Desfase aplicada"); LSTR MSG_SET_ORIGIN = _UxGT("Establecer origen"); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Precal. ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Precal. ") PREHEAT_1_LABEL " ~"; LSTR MSG_PREHEAT_1_END = _UxGT("Precal. ") PREHEAT_1_LABEL _UxGT(" Fusor"); @@ -147,7 +147,7 @@ namespace Language_es { LSTR MSG_UBL_DONE_EDITING_MESH = _UxGT("Term. edici. Mallado"); LSTR MSG_UBL_BUILD_CUSTOM_MESH = _UxGT("Crear Mallado Pers."); LSTR MSG_UBL_BUILD_MESH_MENU = _UxGT("Crear Mallado"); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_UBL_BUILD_MESH_M = _UxGT("Crear Mallado ($)"); LSTR MSG_UBL_VALIDATE_MESH_M = _UxGT("Valid. Mall. ($)"); #endif diff --git a/Marlin/src/lcd/language/language_eu.h b/Marlin/src/lcd/language/language_eu.h index fc8f2e0f62..adc812f6ff 100644 --- a/Marlin/src/lcd/language/language_eu.h +++ b/Marlin/src/lcd/language/language_eu.h @@ -57,7 +57,7 @@ namespace Language_eu { LSTR MSG_SET_HOME_OFFSETS = _UxGT("Etxe. offset eza."); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Offsetak ezarrita"); LSTR MSG_SET_ORIGIN = _UxGT("Hasiera ipini"); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Berotu ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Berotu ") PREHEAT_1_LABEL " ~"; LSTR MSG_PREHEAT_1_END = _UxGT("Berotu ") PREHEAT_1_LABEL _UxGT(" Amaia"); @@ -100,7 +100,7 @@ namespace Language_eu { LSTR MSG_UBL_MESH_EDIT = _UxGT("Sarea editatu"); LSTR MSG_UBL_DONE_EDITING_MESH = _UxGT("Sarea editatzea eginda"); LSTR MSG_UBL_BUILD_MESH_MENU = _UxGT("Sarea sortu"); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_UBL_BUILD_MESH_M = _UxGT("$ sarea sortu"); LSTR MSG_UBL_VALIDATE_MESH_M = _UxGT("$ sarea balioetsi"); #endif diff --git a/Marlin/src/lcd/language/language_fi.h b/Marlin/src/lcd/language/language_fi.h index 075b5b2744..62f3aae807 100644 --- a/Marlin/src/lcd/language/language_fi.h +++ b/Marlin/src/lcd/language/language_fi.h @@ -44,7 +44,7 @@ namespace Language_fi { LSTR MSG_DISABLE_STEPPERS = _UxGT("Vapauta moottorit"); LSTR MSG_AUTO_HOME = _UxGT("Aja referenssiin"); LSTR MSG_SET_ORIGIN = _UxGT("Aseta origo"); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Esilämmitä ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Esilämmitä ") PREHEAT_1_LABEL " ~"; LSTR MSG_PREHEAT_1_END = _UxGT("Esilä. ") PREHEAT_1_LABEL _UxGT("Suutin"); diff --git a/Marlin/src/lcd/language/language_fr.h b/Marlin/src/lcd/language/language_fr.h index 77472e4fbb..e9c55ed401 100644 --- a/Marlin/src/lcd/language/language_fr.h +++ b/Marlin/src/lcd/language/language_fr.h @@ -82,7 +82,7 @@ namespace Language_fr { LSTR MSG_TRAMMING_WIZARD = _UxGT("Assistant Molettes"); LSTR MSG_SELECT_ORIGIN = _UxGT("Molette du lit"); // Not a selection of the origin LSTR MSG_LAST_VALUE_SP = _UxGT("Ecart origine "); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Préchauffage ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Préchauffage ") PREHEAT_1_LABEL " ~"; LSTR MSG_PREHEAT_1_END = _UxGT("Préch. ") PREHEAT_1_LABEL _UxGT(" buse"); @@ -162,7 +162,7 @@ namespace Language_fr { LSTR MSG_UBL_FINE_TUNE_MESH = _UxGT("Réglage fin"); LSTR MSG_UBL_DONE_EDITING_MESH = _UxGT("Terminer"); LSTR MSG_UBL_BUILD_MESH_MENU = _UxGT("Créer la grille"); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_UBL_BUILD_MESH_M = _UxGT("Créer grille $"); LSTR MSG_UBL_VALIDATE_MESH_M = _UxGT("Impr. grille $"); #endif diff --git a/Marlin/src/lcd/language/language_gl.h b/Marlin/src/lcd/language/language_gl.h index 0252cf30ec..c17faa7014 100644 --- a/Marlin/src/lcd/language/language_gl.h +++ b/Marlin/src/lcd/language/language_gl.h @@ -70,7 +70,7 @@ namespace Language_gl { LSTR MSG_SET_HOME_OFFSETS = _UxGT("Axustar Desfases"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Desfases aplicados"); LSTR MSG_SET_ORIGIN = _UxGT("Fixar orixe"); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Prequentar ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Prequentar ") PREHEAT_1_LABEL " ~"; LSTR MSG_PREHEAT_1_END = _UxGT("Preque. ") PREHEAT_1_LABEL _UxGT(" Bico"); @@ -144,7 +144,7 @@ namespace Language_gl { LSTR MSG_UBL_DONE_EDITING_MESH = _UxGT("Fin Edición da Malla"); LSTR MSG_UBL_BUILD_CUSTOM_MESH = _UxGT("Crear Malla Person."); LSTR MSG_UBL_BUILD_MESH_MENU = _UxGT("Crear Malla"); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_UBL_BUILD_MESH_M = _UxGT("Crear Malla ($)"); LSTR MSG_UBL_VALIDATE_MESH_M = _UxGT("Validar Malla ($)"); #endif diff --git a/Marlin/src/lcd/language/language_hr.h b/Marlin/src/lcd/language/language_hr.h index e828b489f6..23be8abbb1 100644 --- a/Marlin/src/lcd/language/language_hr.h +++ b/Marlin/src/lcd/language/language_hr.h @@ -54,7 +54,7 @@ namespace Language_hr { LSTR MSG_SET_HOME_OFFSETS = _UxGT("Postavi home offsete"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Offsets postavljeni"); LSTR MSG_SET_ORIGIN = _UxGT("Postavi ishodište"); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Predgrij ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Predgrij ") PREHEAT_1_LABEL " ~"; LSTR MSG_PREHEAT_1_END = _UxGT("Predgrij ") PREHEAT_1_LABEL _UxGT(" Dizna"); diff --git a/Marlin/src/lcd/language/language_hu.h b/Marlin/src/lcd/language/language_hu.h index 4028ab10cd..faa313e48a 100644 --- a/Marlin/src/lcd/language/language_hu.h +++ b/Marlin/src/lcd/language/language_hu.h @@ -89,7 +89,7 @@ namespace Language_hu { LSTR MSG_TRAMMING_WIZARD = _UxGT("Elektromos varázsló"); LSTR MSG_SELECT_ORIGIN = _UxGT("Eredeti választása"); LSTR MSG_LAST_VALUE_SP = _UxGT("Utolsó érték "); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Fütés ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Fütés ") PREHEAT_1_LABEL " ~"; LSTR MSG_PREHEAT_1_END = _UxGT("Fütés ") PREHEAT_1_LABEL _UxGT(" Fej"); diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index 2e2529a845..44ae49b519 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -95,7 +95,7 @@ namespace Language_it { LSTR MSG_TRAMMING_WIZARD = _UxGT("Wizard Tramming"); LSTR MSG_SELECT_ORIGIN = _UxGT("Selez. origine"); LSTR MSG_LAST_VALUE_SP = _UxGT("Ultimo valore "); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Preriscalda ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Preriscalda ") PREHEAT_1_LABEL " ~"; LSTR MSG_PREHEAT_1_END = _UxGT("Preris.") PREHEAT_1_LABEL _UxGT(" Ugello"); @@ -186,7 +186,7 @@ namespace Language_it { LSTR MSG_UBL_DONE_EDITING_MESH = _UxGT("Modif.Mesh fatta"); LSTR MSG_UBL_BUILD_CUSTOM_MESH = _UxGT("Crea Mesh personal."); LSTR MSG_UBL_BUILD_MESH_MENU = _UxGT("Crea Mesh"); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_UBL_BUILD_MESH_M = _UxGT("Crea Mesh ($)"); LSTR MSG_UBL_VALIDATE_MESH_M = _UxGT("Valida Mesh ($)"); #endif diff --git a/Marlin/src/lcd/language/language_jp_kana.h b/Marlin/src/lcd/language/language_jp_kana.h index 1d291ed3ad..16e605cc25 100644 --- a/Marlin/src/lcd/language/language_jp_kana.h +++ b/Marlin/src/lcd/language/language_jp_kana.h @@ -62,7 +62,7 @@ namespace Language_jp_kana { LSTR MSG_SET_HOME_OFFSETS = _UxGT("キジュンオフセットセッテイ"); // "Set home offsets" LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("オフセットガテキヨウサレマシタ"); // "Offsets applied" LSTR MSG_SET_ORIGIN = _UxGT("キジュンセット"); // "Set origin" - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = PREHEAT_1_LABEL _UxGT(" ヨネツ"); // "Preheat " PREHEAT_1_LABEL LSTR MSG_PREHEAT_1_H = PREHEAT_1_LABEL _UxGT(" ヨネツ ~"); // "Preheat " PREHEAT_1_LABEL LSTR MSG_PREHEAT_1_END = PREHEAT_1_LABEL _UxGT(" ヨネツノズル"); // " Nozzle" diff --git a/Marlin/src/lcd/language/language_ko_KR.h b/Marlin/src/lcd/language/language_ko_KR.h index 4ecdd5bb2d..50c73f69e9 100644 --- a/Marlin/src/lcd/language/language_ko_KR.h +++ b/Marlin/src/lcd/language/language_ko_KR.h @@ -54,7 +54,7 @@ namespace Language_ko_KR { LSTR MSG_LEVEL_BED_WAITING = _UxGT("누르면 시작합니다"); LSTR MSG_LEVEL_BED_NEXT_POINT = _UxGT("다음 Point"); LSTR MSG_LEVEL_BED_DONE = _UxGT("레벨링 완료!"); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("예열하기 - ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("예열하기 - ") PREHEAT_1_LABEL " ~"; LSTR MSG_PREHEAT_1_END = _UxGT("예열하기 - ") PREHEAT_1_LABEL _UxGT(" 노즐"); diff --git a/Marlin/src/lcd/language/language_nl.h b/Marlin/src/lcd/language/language_nl.h index b44d09d07c..42df92b880 100644 --- a/Marlin/src/lcd/language/language_nl.h +++ b/Marlin/src/lcd/language/language_nl.h @@ -54,7 +54,7 @@ namespace Language_nl { LSTR MSG_SET_HOME_OFFSETS = _UxGT("Zet home offsets"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("H offset toegep."); LSTR MSG_SET_ORIGIN = _UxGT("Nulpunt instellen"); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = PREHEAT_1_LABEL _UxGT(" voorverwarmen"); LSTR MSG_PREHEAT_1_H = PREHEAT_1_LABEL _UxGT(" voorverw. ~"); LSTR MSG_PREHEAT_1_END = PREHEAT_1_LABEL _UxGT(" voorverw. Einde"); diff --git a/Marlin/src/lcd/language/language_pl.h b/Marlin/src/lcd/language/language_pl.h index 2dde747378..9105f58bdb 100644 --- a/Marlin/src/lcd/language/language_pl.h +++ b/Marlin/src/lcd/language/language_pl.h @@ -83,7 +83,7 @@ namespace Language_pl { LSTR MSG_SET_ORIGIN = _UxGT("Ustaw punkt zero"); LSTR MSG_SELECT_ORIGIN = _UxGT("Wybierz punkt zero"); LSTR MSG_LAST_VALUE_SP = _UxGT("Poprzednia wartość "); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Rozgrzej ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Rozgrzej ") PREHEAT_1_LABEL " ~"; LSTR MSG_PREHEAT_1_END = _UxGT("Rozgrzej ") PREHEAT_1_LABEL _UxGT(" Dysza"); diff --git a/Marlin/src/lcd/language/language_pt.h b/Marlin/src/lcd/language/language_pt.h index 13f62f693b..524c2c97d8 100644 --- a/Marlin/src/lcd/language/language_pt.h +++ b/Marlin/src/lcd/language/language_pt.h @@ -53,7 +53,7 @@ namespace Language_pt { LSTR MSG_SET_HOME_OFFSETS = _UxGT("Definir desvio"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Offsets aplicados"); LSTR MSG_SET_ORIGIN = _UxGT("Definir origem"); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Pre-aquecer ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Pre-aquecer ") PREHEAT_1_LABEL " ~"; LSTR MSG_PREHEAT_1_END = _UxGT("Pre-aquecer ") PREHEAT_1_LABEL _UxGT(" Bico"); diff --git a/Marlin/src/lcd/language/language_pt_br.h b/Marlin/src/lcd/language/language_pt_br.h index 7d97d48336..c66f717f9d 100644 --- a/Marlin/src/lcd/language/language_pt_br.h +++ b/Marlin/src/lcd/language/language_pt_br.h @@ -68,7 +68,7 @@ namespace Language_pt_br { LSTR MSG_SET_HOME_OFFSETS = _UxGT("Compensar origem"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Alteração aplicada"); LSTR MSG_SET_ORIGIN = _UxGT("Ajustar Origem"); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Pre-aquecer ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Pre-aquecer ") PREHEAT_1_LABEL " ~"; LSTR MSG_PREHEAT_1_END = _UxGT("Extrusora ") PREHEAT_1_LABEL; @@ -133,7 +133,7 @@ namespace Language_pt_br { LSTR MSG_UBL_DONE_EDITING_MESH = _UxGT("Fim da Edição"); LSTR MSG_UBL_BUILD_CUSTOM_MESH = _UxGT("Montar Malha Custom"); LSTR MSG_UBL_BUILD_MESH_MENU = _UxGT("Montar "); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_UBL_BUILD_MESH_M = _UxGT("Montar $"); LSTR MSG_UBL_VALIDATE_MESH_M = _UxGT("Checar $"); #endif diff --git a/Marlin/src/lcd/language/language_ro.h b/Marlin/src/lcd/language/language_ro.h index 2eb4c0b996..fee63dc2ad 100644 --- a/Marlin/src/lcd/language/language_ro.h +++ b/Marlin/src/lcd/language/language_ro.h @@ -69,7 +69,7 @@ namespace Language_ro { LSTR MSG_SET_HOME_OFFSETS = _UxGT("Seteaza Offseturile Acasa"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Offseturi Aplicate"); LSTR MSG_SET_ORIGIN = _UxGT("Seteaza Originea"); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Preincalzeste ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Preincalzeste ") PREHEAT_1_LABEL " ~"; LSTR MSG_PREHEAT_1_END = _UxGT("Preincalzeste ") PREHEAT_1_LABEL _UxGT(" Capatul"); @@ -143,7 +143,7 @@ namespace Language_ro { LSTR MSG_UBL_DONE_EDITING_MESH = _UxGT("Done Editing Mesh"); LSTR MSG_UBL_BUILD_CUSTOM_MESH = _UxGT("Build Custom Mesh"); LSTR MSG_UBL_BUILD_MESH_MENU = _UxGT("Build Mesh"); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_UBL_BUILD_MESH_M = _UxGT("Build Mesh ($)"); LSTR MSG_UBL_VALIDATE_MESH_M = _UxGT("Validate Mesh ($)"); #endif diff --git a/Marlin/src/lcd/language/language_ru.h b/Marlin/src/lcd/language/language_ru.h index 2de45e7d8d..e33018b034 100644 --- a/Marlin/src/lcd/language/language_ru.h +++ b/Marlin/src/lcd/language/language_ru.h @@ -106,7 +106,7 @@ namespace Language_ru { #else LSTR MSG_LAST_VALUE_SP = _UxGT("Послед. знач. "); #endif - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Преднагрев ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Нагрев ") PREHEAT_1_LABEL " ~"; LSTR MSG_PREHEAT_1_END = _UxGT("Нагрев ") PREHEAT_1_LABEL _UxGT(" сопло"); diff --git a/Marlin/src/lcd/language/language_sk.h b/Marlin/src/lcd/language/language_sk.h index 81fb9a3d01..76e7f7fbd7 100644 --- a/Marlin/src/lcd/language/language_sk.h +++ b/Marlin/src/lcd/language/language_sk.h @@ -107,7 +107,7 @@ namespace Language_sk { LSTR MSG_TRAMMING_WIZARD = _UxGT("Spriev. vyrovn."); LSTR MSG_SELECT_ORIGIN = _UxGT("Vyberte začiatok"); LSTR MSG_LAST_VALUE_SP = _UxGT("Posl. hodnota "); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Zahriať ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Zahriať ") PREHEAT_1_LABEL " ~"; LSTR MSG_PREHEAT_1_END = _UxGT("Zahriať ") PREHEAT_1_LABEL _UxGT(" hotend"); diff --git a/Marlin/src/lcd/language/language_sv.h b/Marlin/src/lcd/language/language_sv.h index 3b4d6c24c1..cdb902aef0 100644 --- a/Marlin/src/lcd/language/language_sv.h +++ b/Marlin/src/lcd/language/language_sv.h @@ -78,7 +78,7 @@ namespace Language_sv { LSTR MSG_SELECT_ORIGIN = _UxGT("Välj Origo"); LSTR MSG_LAST_VALUE_SP = _UxGT("Senaste värde "); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Förvärmning ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Förvärmning ") PREHEAT_1_LABEL " ~"; LSTR MSG_PREHEAT_1_END = _UxGT("Förvärmning ") PREHEAT_1_LABEL _UxGT(" Stoppa"); diff --git a/Marlin/src/lcd/language/language_tr.h b/Marlin/src/lcd/language/language_tr.h index d6f2f52a0c..4c2bbfa0dc 100644 --- a/Marlin/src/lcd/language/language_tr.h +++ b/Marlin/src/lcd/language/language_tr.h @@ -73,7 +73,7 @@ namespace Language_tr { LSTR MSG_SET_HOME_OFFSETS = _UxGT("Ofset Ayarla"); LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Ofset Tamam"); LSTR MSG_SET_ORIGIN = _UxGT("Sıfır Belirle"); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Ön Isınma ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Ön Isınma ") PREHEAT_1_LABEL " ~"; LSTR MSG_PREHEAT_1_END = _UxGT("Ön Isınma ") PREHEAT_1_LABEL _UxGT(" Nozul"); @@ -146,7 +146,7 @@ namespace Language_tr { LSTR MSG_UBL_DONE_EDITING_MESH = _UxGT("Mesh Düzenleme Tamam"); LSTR MSG_UBL_BUILD_CUSTOM_MESH = _UxGT("Özel Mesh Oluştur"); LSTR MSG_UBL_BUILD_MESH_MENU = _UxGT("Mesh Oluştur"); - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_UBL_BUILD_MESH_M = _UxGT("Mesh Oluştur ($)"); LSTR MSG_UBL_VALIDATE_MESH_M = _UxGT("Doğrulama Mesh ($)"); #endif diff --git a/Marlin/src/lcd/language/language_uk.h b/Marlin/src/lcd/language/language_uk.h index 581a501b49..afba537008 100644 --- a/Marlin/src/lcd/language/language_uk.h +++ b/Marlin/src/lcd/language/language_uk.h @@ -108,7 +108,7 @@ namespace Language_uk { #else LSTR MSG_LAST_VALUE_SP = _UxGT("Останнє знач. "); #endif - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Нагрів ") PREHEAT_1_LABEL; LSTR MSG_PREHEAT_1_H = _UxGT("Нагрів ") PREHEAT_1_LABEL " ~"; LSTR MSG_PREHEAT_1_END = _UxGT("Нагрів ") PREHEAT_1_LABEL _UxGT(" сопло"); diff --git a/Marlin/src/lcd/language/language_vi.h b/Marlin/src/lcd/language/language_vi.h index 9a4ef464b5..ae0babbf8b 100644 --- a/Marlin/src/lcd/language/language_vi.h +++ b/Marlin/src/lcd/language/language_vi.h @@ -64,7 +64,7 @@ namespace Language_vi { LSTR MSG_SET_HOME_OFFSETS = _UxGT("Đặt bù đắp nhà"); // Set home offsets LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("Bù đắp được áp dụng"); // Offsets applied LSTR MSG_SET_ORIGIN = _UxGT("Đặt nguồn gốc"); // Set origin - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("Làm nóng ") PREHEAT_1_LABEL _UxGT(" trước"); // Preheat LSTR MSG_PREHEAT_1_H = _UxGT("Làm nóng ") PREHEAT_1_LABEL _UxGT(" trước ~"); // Preheat LSTR MSG_PREHEAT_1_END = _UxGT("Làm nóng ") PREHEAT_1_LABEL _UxGT(" Đầu"); @@ -126,7 +126,7 @@ namespace Language_vi { LSTR MSG_UBL_DONE_EDITING_MESH = _UxGT("Chỉnh sửa xong lưới"); // Done Editing Mesh LSTR MSG_UBL_BUILD_CUSTOM_MESH = _UxGT("Xây dựng lưới tự chọn"); // Build Custom Mesh LSTR MSG_UBL_BUILD_MESH_MENU = _UxGT("Xây dựng lưới"); // Build Mesh - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_UBL_BUILD_MESH_M = _UxGT("Xây dựng lưới ($)"); LSTR MSG_UBL_VALIDATE_MESH_M = _UxGT("Thẩm tra lưới ($)"); #endif diff --git a/Marlin/src/lcd/language/language_zh_CN.h b/Marlin/src/lcd/language/language_zh_CN.h index afa51689cf..d61634e431 100644 --- a/Marlin/src/lcd/language/language_zh_CN.h +++ b/Marlin/src/lcd/language/language_zh_CN.h @@ -68,7 +68,7 @@ namespace Language_zh_CN { LSTR MSG_SET_HOME_OFFSETS = _UxGT("设置原点偏移"); // "Set home offsets" LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("偏移已启用"); // "Offsets applied" LSTR MSG_SET_ORIGIN = _UxGT("设置原点"); // "Set origin" - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("预热 ") PREHEAT_1_LABEL; // "Preheat PREHEAT_2_LABEL" LSTR MSG_PREHEAT_1_H = _UxGT("预热 ") PREHEAT_1_LABEL " ~"; // "Preheat PREHEAT_2_LABEL" LSTR MSG_PREHEAT_1_END = _UxGT("预热 ") PREHEAT_1_LABEL _UxGT(" 喷嘴"); //MSG_PREHEAT_1 " " @@ -142,7 +142,7 @@ namespace Language_zh_CN { LSTR MSG_UBL_DONE_EDITING_MESH = _UxGT("完成编辑网格"); // "Done Editing Mesh" LSTR MSG_UBL_BUILD_CUSTOM_MESH = _UxGT("创设客户网格"); // "Build Custom Mesh" LSTR MSG_UBL_BUILD_MESH_MENU = _UxGT("创设网格"); // "Build Mesh" - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_UBL_BUILD_MESH_M = _UxGT("创设 $ 网格"); // "Build PREHEAT_1_LABEL Mesh" LSTR MSG_UBL_VALIDATE_MESH_M = _UxGT("批准 $ 网格"); // "Validate PREHEAT_1_LABEL Mesh" #endif diff --git a/Marlin/src/lcd/language/language_zh_TW.h b/Marlin/src/lcd/language/language_zh_TW.h index 01b11225e3..7680721b00 100644 --- a/Marlin/src/lcd/language/language_zh_TW.h +++ b/Marlin/src/lcd/language/language_zh_TW.h @@ -66,7 +66,7 @@ namespace Language_zh_TW { LSTR MSG_SET_HOME_OFFSETS = _UxGT("設置原點偏移"); // "Set home offsets" LSTR MSG_HOME_OFFSETS_APPLIED = _UxGT("偏移已啟用"); // "Offsets applied" LSTR MSG_SET_ORIGIN = _UxGT("設置原點"); // "Set origin" - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_PREHEAT_1 = _UxGT("預熱 ") PREHEAT_1_LABEL; // "Preheat PREHEAT_1_LABEL" LSTR MSG_PREHEAT_1_H = _UxGT("預熱 ") PREHEAT_1_LABEL " ~"; // "Preheat PREHEAT_1_LABEL" LSTR MSG_PREHEAT_1_END = _UxGT("預熱 ") PREHEAT_1_LABEL _UxGT(" 噴嘴"); //MSG_PREHEAT_1 " " @@ -139,7 +139,7 @@ namespace Language_zh_TW { LSTR MSG_UBL_DONE_EDITING_MESH = _UxGT("完成編輯網格"); // "Done Editing Mesh" LSTR MSG_UBL_BUILD_CUSTOM_MESH = _UxGT("創設客戶網格"); // "Build Custom Mesh" LSTR MSG_UBL_BUILD_MESH_MENU = _UxGT("創設網格"); // "Build Mesh" - #if PREHEAT_COUNT + #if HAS_PREHEAT LSTR MSG_UBL_BUILD_MESH_M = _UxGT("創設 $ 網格"); // "Build PREHEAT_1_LABEL Mesh" LSTR MSG_UBL_VALIDATE_MESH_M = _UxGT("批准 $ 網格"); // "Validate PREHEAT_1_LABEL Mesh" #endif diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index ae169cdab6..2757e6d47a 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -134,7 +134,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; } #endif -#if PREHEAT_COUNT +#if HAS_PREHEAT preheat_t MarlinUI::material_preset[PREHEAT_COUNT]; // Initialized by settings.load() PGM_P MarlinUI::get_preheat_label(const uint8_t m) { #define _PDEF(N) static PGMSTR(preheat_##N##_label, PREHEAT_##N##_LABEL); diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index 883850d6e0..63e1eb5b0d 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -116,7 +116,7 @@ }; #endif -#if PREHEAT_COUNT +#if HAS_PREHEAT typedef struct { #if HAS_HOTEND celsius_t hotend_temp; @@ -497,7 +497,7 @@ public: static const char * scrolled_filename(CardReader &theCard, const uint8_t maxlen, uint8_t hash, const bool doScroll); #endif - #if PREHEAT_COUNT + #if HAS_PREHEAT static preheat_t material_preset[PREHEAT_COUNT]; static PGM_P get_preheat_label(const uint8_t m); #endif diff --git a/Marlin/src/lcd/menu/menu_configuration.cpp b/Marlin/src/lcd/menu/menu_configuration.cpp index 0e11cd211a..9e1f455a64 100644 --- a/Marlin/src/lcd/menu/menu_configuration.cpp +++ b/Marlin/src/lcd/menu/menu_configuration.cpp @@ -310,7 +310,7 @@ void menu_advanced_settings(); #endif -#if PREHEAT_COUNT && DISABLED(SLIM_LCD_MENUS) +#if HAS_PREHEAT && DISABLED(SLIM_LCD_MENUS) void _menu_configuration_preheat_settings() { #define _MINTEMP_ITEM(N) HEATER_##N##_MINTEMP, @@ -547,7 +547,7 @@ void menu_configuration() { #endif // Preheat configurations - #if PREHEAT_COUNT && DISABLED(SLIM_LCD_MENUS) + #if HAS_PREHEAT && DISABLED(SLIM_LCD_MENUS) LOOP_L_N(m, PREHEAT_COUNT) SUBMENU_N_S(m, ui.get_preheat_label(m), MSG_PREHEAT_M_SETTINGS, _menu_configuration_preheat_settings); #endif diff --git a/Marlin/src/lcd/menu/menu_filament.cpp b/Marlin/src/lcd/menu/menu_filament.cpp index 7d0d2dc72c..e7365744e9 100644 --- a/Marlin/src/lcd/menu/menu_filament.cpp +++ b/Marlin/src/lcd/menu/menu_filament.cpp @@ -90,7 +90,7 @@ void _menu_temp_filament_op(const PauseMode mode, const int8_t extruder) { START_MENU(); if (LCD_HEIGHT >= 4) STATIC_ITEM_P(change_filament_header(mode), SS_DEFAULT|SS_INVERT); BACK_ITEM(MSG_BACK); - #if PREHEAT_COUNT + #if HAS_PREHEAT LOOP_L_N(m, PREHEAT_COUNT) ACTION_ITEM_N_S(m, ui.get_preheat_label(m), MSG_PREHEAT_M, _change_filament_with_preset); #endif diff --git a/Marlin/src/lcd/menu/menu_temperature.cpp b/Marlin/src/lcd/menu/menu_temperature.cpp index 3abb2e9c20..5524793b19 100644 --- a/Marlin/src/lcd/menu/menu_temperature.cpp +++ b/Marlin/src/lcd/menu/menu_temperature.cpp @@ -69,7 +69,7 @@ void Temperature::lcd_preheat(const uint8_t e, const int8_t indh, const int8_t i ui.return_to_status(); } -#if PREHEAT_COUNT +#if HAS_PREHEAT #if HAS_TEMP_HOTEND inline void _preheat_end(const uint8_t m, const uint8_t e) { thermalManager.lcd_preheat(e, m, -1); } @@ -138,7 +138,7 @@ void Temperature::lcd_preheat(const uint8_t e, const int8_t indh, const int8_t i #endif // HAS_MULTI_HOTEND || HAS_HEATED_BED -#endif // PREHEAT_COUNT +#endif // HAS_PREHEAT #if HAS_TEMP_HOTEND || HAS_HEATED_BED @@ -263,7 +263,7 @@ void menu_temperature() { #endif // HAS_FAN - #if PREHEAT_COUNT + #if HAS_PREHEAT // // Preheat for all Materials // diff --git a/Marlin/src/lcd/menu/menu_ubl.cpp b/Marlin/src/lcd/menu/menu_ubl.cpp index 8dea7d943d..a08eceed77 100644 --- a/Marlin/src/lcd/menu/menu_ubl.cpp +++ b/Marlin/src/lcd/menu/menu_ubl.cpp @@ -208,7 +208,7 @@ void _lcd_ubl_edit_mesh() { void _lcd_ubl_validate_mesh() { START_MENU(); BACK_ITEM(MSG_UBL_TOOLS); - #if PREHEAT_COUNT + #if HAS_PREHEAT #if HAS_HEATED_BED #define VALIDATE_MESH_GCODE_ITEM(M) \ GCODES_ITEM_N_S(M, ui.get_preheat_label(M), MSG_UBL_VALIDATE_MESH_M, PSTR("G28\nG26CPI" STRINGIFY(M))) @@ -230,7 +230,7 @@ void _lcd_ubl_edit_mesh() { #endif #endif #endif - #endif // PREHEAT_COUNT + #endif // HAS_PREHEAT ACTION_ITEM(MSG_UBL_VALIDATE_CUSTOM_MESH, _lcd_ubl_validate_custom_mesh); ACTION_ITEM(MSG_INFO_SCREEN, ui.return_to_status); END_MENU(); @@ -324,7 +324,7 @@ void _lcd_ubl_invalidate() { void _lcd_ubl_build_mesh() { START_MENU(); BACK_ITEM(MSG_UBL_TOOLS); - #if PREHEAT_COUNT + #if HAS_PREHEAT #if HAS_HEATED_BED #define PREHEAT_BED_GCODE(M) "M190I" STRINGIFY(M) "\n" #else @@ -352,7 +352,7 @@ void _lcd_ubl_build_mesh() { #endif #endif #endif - #endif // PREHEAT_COUNT + #endif // HAS_PREHEAT SUBMENU(MSG_UBL_BUILD_CUSTOM_MESH, _lcd_ubl_custom_mesh); GCODES_ITEM(MSG_UBL_BUILD_COLD_MESH, PSTR("G29NP1")); diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 6b7143e82a..c82f5aad0d 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -317,7 +317,7 @@ typedef struct SettingsDataStruct { // // Material Presets // - #if PREHEAT_COUNT + #if HAS_PREHEAT preheat_t ui_material_preset[PREHEAT_COUNT]; // M145 S0 H B F #endif @@ -918,7 +918,7 @@ void MarlinSettings::postprocess() { // // LCD Preheat settings // - #if PREHEAT_COUNT + #if HAS_PREHEAT _FIELD_TEST(ui_material_preset); EEPROM_WRITE(ui.material_preset); #endif @@ -1786,7 +1786,7 @@ void MarlinSettings::postprocess() { // // LCD Preheat settings // - #if PREHEAT_COUNT + #if HAS_PREHEAT _FIELD_TEST(ui_material_preset); EEPROM_READ(ui.material_preset); #endif @@ -2796,7 +2796,7 @@ void MarlinSettings::reset() { // // Preheat parameters // - #if PREHEAT_COUNT + #if HAS_PREHEAT #define _PITEM(N,T) PREHEAT_##N##_##T, #if HAS_HOTEND constexpr uint16_t hpre[] = { REPEAT2_S(1, INCREMENT(PREHEAT_COUNT), _PITEM, TEMP_HOTEND) }; @@ -3181,7 +3181,7 @@ void MarlinSettings::reset() { // // LCD Preheat Settings // - #if PREHEAT_COUNT + #if HAS_PREHEAT gcode.M145_report(forReplay); #endif From b09038fcc72bc8df4ec8a7014597586e0b0390ca Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 27 Oct 2021 20:01:44 -0500 Subject: [PATCH 072/125] =?UTF-8?q?=F0=9F=8E=A8=20Standard=20material=20pr?= =?UTF-8?q?esets=20behavior?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/e3v2/creality/dwin.cpp | 211 ++++++++++-------- Marlin/src/lcd/e3v2/enhanced/dwin.cpp | 18 +- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 110 +++------ .../src/lcd/extui/dgus/DGUSScreenHandler.cpp | 54 +---- Marlin/src/lcd/extui/ui_api.cpp | 5 +- Marlin/src/lcd/marlinui.cpp | 11 + Marlin/src/lcd/marlinui.h | 8 +- 7 files changed, 178 insertions(+), 239 deletions(-) diff --git a/Marlin/src/lcd/e3v2/creality/dwin.cpp b/Marlin/src/lcd/e3v2/creality/dwin.cpp index a27762d71e..82623d7c7d 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.cpp +++ b/Marlin/src/lcd/e3v2/creality/dwin.cpp @@ -166,8 +166,14 @@ typedef struct { select_t select_page{0}, select_file{0}, select_print{0}, select_prepare{0} , select_control{0}, select_axis{0}, select_temp{0}, select_motion{0}, select_tune{0} - , select_advset{0}, select_PLA{0}, select_ABS{0} - , select_speed{0}, select_acc{0}, select_jerk{0}, select_step{0}, select_item{0}; + , select_advset{0}, select_speed{0}, select_acc{0}, select_jerk{0}, select_step{0}, select_item{0}; + +#if HAS_PREHEAT + select_t select_PLA{0}; + #if PREHEAT_COUNT > 1 + select_t select_ABS{0}; + #endif +#endif uint8_t index_file = MROWS, index_prepare = MROWS, @@ -492,8 +498,8 @@ inline bool Apply_Encoder(const EncoderState &encoder_diffState, T &valref) { #define PREPARE_CASE_DISA 2 #define PREPARE_CASE_HOME 3 #define PREPARE_CASE_ZOFF (PREPARE_CASE_HOME + ENABLED(HAS_ZOFFSET_ITEM)) -#define PREPARE_CASE_PLA (PREPARE_CASE_ZOFF + ENABLED(HAS_HOTEND)) -#define PREPARE_CASE_ABS (PREPARE_CASE_PLA + ENABLED(HAS_HOTEND)) +#define PREPARE_CASE_PLA (PREPARE_CASE_ZOFF + ENABLED(HAS_PREHEAT)) +#define PREPARE_CASE_ABS (PREPARE_CASE_PLA + (TERN0(HAS_PREHEAT, PREHEAT_COUNT > 1))) #define PREPARE_CASE_COOL (PREPARE_CASE_ABS + EITHER(HAS_HOTEND, HAS_HEATED_BED)) #define PREPARE_CASE_LANG (PREPARE_CASE_COOL + 1) #define PREPARE_CASE_TOTAL PREPARE_CASE_LANG @@ -517,8 +523,8 @@ inline bool Apply_Encoder(const EncoderState &encoder_diffState, T &valref) { #define TEMP_CASE_TEMP (0 + ENABLED(HAS_HOTEND)) #define TEMP_CASE_BED (TEMP_CASE_TEMP + ENABLED(HAS_HEATED_BED)) #define TEMP_CASE_FAN (TEMP_CASE_BED + ENABLED(HAS_FAN)) -#define TEMP_CASE_PLA (TEMP_CASE_FAN + ENABLED(HAS_HOTEND)) -#define TEMP_CASE_ABS (TEMP_CASE_PLA + ENABLED(HAS_HOTEND)) +#define TEMP_CASE_PLA (TEMP_CASE_FAN + ENABLED(HAS_PREHEAT)) +#define TEMP_CASE_ABS (TEMP_CASE_PLA + (TERN0(HAS_PREHEAT, PREHEAT_COUNT > 1))) #define TEMP_CASE_TOTAL TEMP_CASE_ABS #define PREHEAT_CASE_TEMP (0 + ENABLED(HAS_HOTEND)) @@ -785,6 +791,8 @@ void Draw_Prepare_Menu() { #if PREHEAT_COUNT > 1 if (PVISI(PREPARE_CASE_ABS)) Item_Prepare_ABS(PSCROL(PREPARE_CASE_ABS)); // Preheat ABS #endif + #endif + #if HAS_HOTEND || HAS_HEATED_BED if (PVISI(PREPARE_CASE_COOL)) Item_Prepare_Cool(PSCROL(PREPARE_CASE_COOL)); // Cooldown #endif if (PVISI(PREPARE_CASE_LANG)) Item_Prepare_Lang(PSCROL(PREPARE_CASE_LANG)); // Language CN/EN @@ -2664,10 +2672,10 @@ void HMI_Prepare() { // Draw "More" icon for sub-menus if (index_prepare < 7) Draw_More_Icon(MROWS - index_prepare + 1); - #if HAS_HOTEND + #if PREHEAT_COUNT > 1 if (index_prepare == PREPARE_CASE_ABS) Item_Prepare_ABS(MROWS); #endif - #if HAS_PREHEAT + #if HAS_HOTEND || HAS_HEATED_BED if (index_prepare == PREPARE_CASE_COOL) Item_Prepare_Cool(MROWS); #endif if (index_prepare == PREPARE_CASE_LANG) Item_Prepare_Lang(MROWS); @@ -2743,16 +2751,13 @@ void HMI_Prepare() { break; #endif #if HAS_PREHEAT - case PREPARE_CASE_PLA: - TERN_(HAS_HOTEND, thermalManager.setTargetHotend(ui.material_preset[0].hotend_temp, 0)); - TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(ui.material_preset[0].bed_temp)); - TERN_(HAS_FAN, thermalManager.set_fan_speed(0, ui.material_preset[0].fan_speed)); - break; - case PREPARE_CASE_ABS: - TERN_(HAS_HOTEND, thermalManager.setTargetHotend(ui.material_preset[1].hotend_temp, 0)); - TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(ui.material_preset[1].bed_temp)); - TERN_(HAS_FAN, thermalManager.set_fan_speed(0, ui.material_preset[1].fan_speed)); - break; + case PREPARE_CASE_PLA: ui.preheat_all(0); break; + #if PREHEAT_COUNT > 1 + case PREPARE_CASE_ABS: ui.preheat_all(1); break; + #endif + #endif + + #if HAS_HOTEND || HAS_HEATED_BED case PREPARE_CASE_COOL: TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); #if HAS_HOTEND || HAS_HEATED_BED @@ -2760,6 +2765,7 @@ void HMI_Prepare() { #endif break; #endif + case PREPARE_CASE_LANG: HMI_ToggleLanguage(); Draw_Prepare_Menu(); @@ -2784,9 +2790,11 @@ void Draw_Temperature_Menu() { #if HAS_FAN Item_AreaCopy(115, 134, 170, 146, TEMP_CASE_FAN); #endif - #if HAS_HOTEND + #if HAS_PREHEAT Item_AreaCopy(100, 89, 178, 101, TEMP_CASE_PLA); - Item_AreaCopy(180, 89, 260, 100, TEMP_CASE_ABS); + #if PREHEAT_COUNT > 1 + Item_AreaCopy(180, 89, 260, 100, TEMP_CASE_ABS); + #endif #endif } else { @@ -2805,30 +2813,33 @@ void Draw_Temperature_Menu() { #if HAS_FAN DWIN_Draw_Label(TEMP_CASE_FAN, GET_TEXT_F(MSG_FAN_SPEED)); #endif - #if HAS_HOTEND + #if HAS_PREHEAT DWIN_Draw_Label(TEMP_CASE_PLA, F(PREHEAT_1_LABEL " Preheat Settings")); - DWIN_Draw_Label(TEMP_CASE_ABS, F(PREHEAT_2_LABEL " Preheat Settings")); + #if PREHEAT_COUNT > 1 + DWIN_Draw_Label(TEMP_CASE_ABS, F(PREHEAT_2_LABEL " Preheat Settings")); + #endif #endif #else #if HAS_HOTEND - Item_AreaCopy(197, 104, 238, 114, TEMP_CASE_TEMP); // "Nozzle" - Item_AreaCopy(1, 89, 83, 101, TEMP_CASE_TEMP, 44); // "Temperature" + Item_AreaCopy(197, 104, 238, 114, TEMP_CASE_TEMP); // "Nozzle" + Item_AreaCopy(1, 89, 83, 101, TEMP_CASE_TEMP, 44); // "Temperature" #endif #if HAS_HEATED_BED - Item_AreaCopy(240, 104, 264, 114, TEMP_CASE_BED); // "Bed" - Item_AreaCopy(1, 89, 83, 101, TEMP_CASE_BED, 27); // "Temperature" + Item_AreaCopy(240, 104, 264, 114, TEMP_CASE_BED); // "Bed" + Item_AreaCopy(1, 89, 83, 101, TEMP_CASE_BED, 27); // "Temperature" #endif #if HAS_FAN - Item_AreaCopy( 1, 119, 61, 132, TEMP_CASE_FAN); // "Fan speed" + Item_AreaCopy( 1, 119, 61, 132, TEMP_CASE_FAN); // "Fan speed" #endif - #if HAS_HOTEND - Item_AreaCopy(107, 76, 156, 86, TEMP_CASE_PLA); // "Preheat" - say_pla_en(52, TEMP_CASE_PLA); // "PLA" - Item_AreaCopy(150, 135, 202, 148, TEMP_CASE_PLA, 79); // "Settings" - - Item_AreaCopy(107, 76, 156, 86, TEMP_CASE_ABS); // "Preheat" - say_abs_en(52, TEMP_CASE_ABS); // "ABS" - Item_AreaCopy(150, 135, 202, 148, TEMP_CASE_ABS, 81); // "Settings" + #if HAS_PREHEAT + Item_AreaCopy(107, 76, 156, 86, TEMP_CASE_PLA); // "Preheat" + say_pla_en(52, TEMP_CASE_PLA); // "PLA" + Item_AreaCopy(150, 135, 202, 148, TEMP_CASE_PLA, 79); // "Settings" + #if PREHEAT_COUNT > 1 + Item_AreaCopy(107, 76, 156, 86, TEMP_CASE_ABS); // "Preheat" + say_abs_en(52, TEMP_CASE_ABS); // "ABS" + Item_AreaCopy(150, 135, 202, 148, TEMP_CASE_ABS, 81); // "Settings" + #endif #endif #endif } @@ -2851,12 +2862,12 @@ void Draw_Temperature_Menu() { _TMENU_ICON(TEMP_CASE_FAN); Draw_Edit_Integer3(i, thermalManager.fan_speed[0]); #endif - #if HAS_HOTEND + #if HAS_PREHEAT // PLA/ABS items have submenus - _TMENU_ICON(TEMP_CASE_PLA); - Draw_More_Icon(i); - _TMENU_ICON(TEMP_CASE_ABS); - Draw_More_Icon(i); + _TMENU_ICON(TEMP_CASE_PLA); Draw_More_Icon(i); + #if PREHEAT_COUNT > 1 + _TMENU_ICON(TEMP_CASE_ABS); Draw_More_Icon(i); + #endif #endif } @@ -3076,6 +3087,7 @@ void HMI_Temperature() { EncoderRate.enabled = true; break; #endif + #if HAS_PREHEAT case TEMP_CASE_PLA: { checkkey = PLAPreheat; @@ -3153,7 +3165,8 @@ void HMI_Temperature() { Draw_Menu_Line(++i, ICON_WriteEEPROM); #endif } break; - #endif + #endif // HAS_PREHEAT + #if PREHEAT_COUNT > 1 case TEMP_CASE_ABS: { // ABS preheat setting checkkey = ABSPreheat; @@ -3236,7 +3249,7 @@ void HMI_Temperature() { } break; - #endif // HAS_HOTEND + #endif // PREHEAT_COUNT > 1 } } DWIN_UpdateLCD(); @@ -3579,14 +3592,12 @@ void HMI_AdvSet() { #if HAS_HOTEND case ADVSET_CASE_HEPID: - thermalManager.setTargetHotend(ui.material_preset[0].hotend_temp, 0); thermalManager.PID_autotune(ui.material_preset[0].hotend_temp, H_E0, 10, true); break; #endif #if HAS_HEATED_BED case ADVSET_CASE_BEDPID: - thermalManager.setTargetBed(ui.material_preset[0].bed_temp); thermalManager.PID_autotune(ui.material_preset[0].bed_temp, H_BED, 10, true); break; #endif @@ -3881,63 +3892,65 @@ void HMI_Tune() { DWIN_UpdateLCD(); } - // ABS Preheat - void HMI_ABSPreheatSetting() { - EncoderState encoder_diffState = get_encoder_state(); - if (encoder_diffState == ENCODER_DIFF_NO) return; + #if PREHEAT_COUNT > 1 + // ABS Preheat + void HMI_ABSPreheatSetting() { + EncoderState encoder_diffState = get_encoder_state(); + if (encoder_diffState == ENCODER_DIFF_NO) return; - // Avoid flicker by updating only the previous menu - if (encoder_diffState == ENCODER_DIFF_CW) { - if (select_ABS.inc(1 + PREHEAT_CASE_TOTAL)) Move_Highlight(1, select_ABS.now); - } - else if (encoder_diffState == ENCODER_DIFF_CCW) { - if (select_ABS.dec()) Move_Highlight(-1, select_ABS.now); - } - else if (encoder_diffState == ENCODER_DIFF_ENTER) { - switch (select_ABS.now) { - case CASE_BACK: - checkkey = TemperatureID; - select_temp.now = TEMP_CASE_ABS; - HMI_ValueStruct.show_mode = -1; - Draw_Temperature_Menu(); - break; - #if HAS_HOTEND - case PREHEAT_CASE_TEMP: - checkkey = ETemp; - HMI_ValueStruct.E_Temp = ui.material_preset[1].hotend_temp; - Draw_Edit_Integer3(PREHEAT_CASE_TEMP, ui.material_preset[1].hotend_temp, true); - EncoderRate.enabled = true; - break; - #endif - #if HAS_HEATED_BED - case PREHEAT_CASE_BED: - checkkey = BedTemp; - HMI_ValueStruct.Bed_Temp = ui.material_preset[1].bed_temp; - Draw_Edit_Integer3(PREHEAT_CASE_BED, ui.material_preset[1].bed_temp, true); - EncoderRate.enabled = true; - break; - #endif - #if HAS_FAN - case PREHEAT_CASE_FAN: - checkkey = FanSpeed; - HMI_ValueStruct.Fan_speed = ui.material_preset[1].fan_speed; - Draw_Edit_Integer3(PREHEAT_CASE_FAN, ui.material_preset[1].fan_speed, true); - EncoderRate.enabled = true; - break; - #endif - #if ENABLED(EEPROM_SETTINGS) - case PREHEAT_CASE_SAVE: { - const bool success = settings.save(); - HMI_AudioFeedback(success); - } break; - #endif - default: break; + // Avoid flicker by updating only the previous menu + if (encoder_diffState == ENCODER_DIFF_CW) { + if (select_ABS.inc(1 + PREHEAT_CASE_TOTAL)) Move_Highlight(1, select_ABS.now); } + else if (encoder_diffState == ENCODER_DIFF_CCW) { + if (select_ABS.dec()) Move_Highlight(-1, select_ABS.now); + } + else if (encoder_diffState == ENCODER_DIFF_ENTER) { + switch (select_ABS.now) { + case CASE_BACK: + checkkey = TemperatureID; + select_temp.now = TEMP_CASE_ABS; + HMI_ValueStruct.show_mode = -1; + Draw_Temperature_Menu(); + break; + #if HAS_HOTEND + case PREHEAT_CASE_TEMP: + checkkey = ETemp; + HMI_ValueStruct.E_Temp = ui.material_preset[1].hotend_temp; + Draw_Edit_Integer3(PREHEAT_CASE_TEMP, ui.material_preset[1].hotend_temp, true); + EncoderRate.enabled = true; + break; + #endif + #if HAS_HEATED_BED + case PREHEAT_CASE_BED: + checkkey = BedTemp; + HMI_ValueStruct.Bed_Temp = ui.material_preset[1].bed_temp; + Draw_Edit_Integer3(PREHEAT_CASE_BED, ui.material_preset[1].bed_temp, true); + EncoderRate.enabled = true; + break; + #endif + #if HAS_FAN + case PREHEAT_CASE_FAN: + checkkey = FanSpeed; + HMI_ValueStruct.Fan_speed = ui.material_preset[1].fan_speed; + Draw_Edit_Integer3(PREHEAT_CASE_FAN, ui.material_preset[1].fan_speed, true); + EncoderRate.enabled = true; + break; + #endif + #if ENABLED(EEPROM_SETTINGS) + case PREHEAT_CASE_SAVE: { + const bool success = settings.save(); + HMI_AudioFeedback(success); + } break; + #endif + default: break; + } + } + DWIN_UpdateLCD(); } - DWIN_UpdateLCD(); - } + #endif // PREHEAT_COUNT > 1 -#endif +#endif // HAS_PREHEAT // Max Speed void HMI_MaxSpeed() { @@ -4241,7 +4254,9 @@ void DWIN_HandleScreen() { case Tune: HMI_Tune(); break; #if HAS_PREHEAT case PLAPreheat: HMI_PLAPreheatSetting(); break; - case ABSPreheat: HMI_ABSPreheatSetting(); break; + #if PREHEAT_COUNT > 1 + case ABSPreheat: HMI_ABSPreheatSetting(); break; + #endif #endif case MaxSpeed: HMI_MaxSpeed(); break; case MaxAcceleration: HMI_MaxAcceleration(); break; diff --git a/Marlin/src/lcd/e3v2/enhanced/dwin.cpp b/Marlin/src/lcd/e3v2/enhanced/dwin.cpp index 22de4d720b..3d5a56c869 100644 --- a/Marlin/src/lcd/e3v2/enhanced/dwin.cpp +++ b/Marlin/src/lcd/e3v2/enhanced/dwin.cpp @@ -2116,21 +2116,15 @@ void SetHome() { #endif #if HAS_PREHEAT - void SetPreheat(const uint8_t i) { - TERN_(HAS_HOTEND, thermalManager.setTargetHotend(ui.material_preset[i].hotend_temp, 0)); - TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(ui.material_preset[i].bed_temp)); - TERN_(HAS_FAN, thermalManager.set_fan_speed(0, ui.material_preset[i].fan_speed)); - } - void SetPreheat0() { SetPreheat(0); } - void SetPreheat1() { SetPreheat(1); } - void SetPreheat2() { SetPreheat(2); } - void SetCoolDown() { TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); #if HAS_HOTEND || HAS_HEATED_BED thermalManager.disable_all_heaters(); #endif } + void DoPreheat0() { ui.preheat_all(0); } + void DoPreheat1() { ui.preheat_all(1); } + void DoPreheat2() { ui.preheat_all(2); } #endif void SetLanguage() { @@ -3125,12 +3119,12 @@ void Draw_Prepare_Menu() { #endif #endif #if HAS_PREHEAT - ADDMENUITEM(ICON_PLAPreheat, GET_TEXT_F(MSG_PREHEAT_1), onDrawPreheat1, SetPreheat0); + ADDMENUITEM(ICON_PLAPreheat, GET_TEXT_F(MSG_PREHEAT_1), onDrawPreheat1, DoPreheat0); #if PREHEAT_COUNT > 1 - ADDMENUITEM(ICON_ABSPreheat, PSTR("Preheat " PREHEAT_2_LABEL), onDrawPreheat2, SetPreheat1); + ADDMENUITEM(ICON_ABSPreheat, PSTR("Preheat " PREHEAT_2_LABEL), onDrawPreheat2, DoPreheat1); #endif #if PREHEAT_COUNT > 2 - ADDMENUITEM(ICON_CustomPreheat, GET_TEXT_F(MSG_PREHEAT_CUSTOM), onDrawMenuItem, SetPreheat2); + ADDMENUITEM(ICON_CustomPreheat, GET_TEXT_F(MSG_PREHEAT_CUSTOM), onDrawMenuItem, DoPreheat2); #endif ADDMENUITEM(ICON_Cool, GET_TEXT_F(MSG_COOLDOWN), onDrawCooldown, SetCoolDown); #endif diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 9cecf202b2..54266e717b 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -1584,9 +1584,9 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ } break; #endif - #if HAS_PREHEAT - case Preheat: + #if HAS_PREHEAT + case Preheat: { #define PREHEAT_BACK 0 #define PREHEAT_MODE (PREHEAT_BACK + 1) #define PREHEAT_1 (PREHEAT_MODE + 1) @@ -1596,6 +1596,13 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #define PREHEAT_5 (PREHEAT_4 + (PREHEAT_COUNT >= 5)) #define PREHEAT_TOTAL PREHEAT_5 + auto do_preheat = [](const uint8_t m) { + thermalManager.disable_all_heaters(); + TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); + if (preheatmode == 0 || preheatmode == 1) { ui.preheat_hotend_and_fan(m); } + if (preheatmode == 0 || preheatmode == 2) ui.preheat_bed(m); + }; + switch (item) { case PREHEAT_BACK: if (draw) @@ -1616,17 +1623,8 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ case PREHEAT_1: if (draw) Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_1_LABEL)); - else { - thermalManager.disable_all_heaters(); - TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); - if (preheatmode == 0 || preheatmode == 1) { - TERN_(HAS_HOTEND, thermalManager.setTargetHotend(ui.material_preset[0].hotend_temp, 0)); - TERN_(HAS_FAN, thermalManager.set_fan_speed(0, ui.material_preset[0].fan_speed)); - } - #if HAS_HEATED_BED - if (preheatmode == 0 || preheatmode == 2) thermalManager.setTargetBed(ui.material_preset[0].bed_temp); - #endif - } + else + do_preheat(0); break; #endif @@ -1634,17 +1632,8 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ case PREHEAT_2: if (draw) Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_2_LABEL)); - else { - thermalManager.disable_all_heaters(); - TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); - if (preheatmode == 0 || preheatmode == 1) { - TERN_(HAS_HOTEND, thermalManager.setTargetHotend(ui.material_preset[1].hotend_temp, 0)); - TERN_(HAS_FAN, thermalManager.set_fan_speed(0, ui.material_preset[1].fan_speed)); - } - #if HAS_HEATED_BED - if (preheatmode == 0 || preheatmode == 2) thermalManager.setTargetBed(ui.material_preset[1].bed_temp); - #endif - } + else + do_preheat(1); break; #endif @@ -1652,17 +1641,8 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ case PREHEAT_3: if (draw) Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_3_LABEL)); - else { - thermalManager.disable_all_heaters(); - TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); - if (preheatmode == 0 || preheatmode == 1) { - TERN_(HAS_HOTEND, thermalManager.setTargetHotend(ui.material_preset[2].hotend_temp, 0)); - TERN_(HAS_FAN, thermalManager.set_fan_speed(0, ui.material_preset[2].fan_speed)); - } - #if HAS_HEATED_BED - if (preheatmode == 0 || preheatmode == 2) thermalManager.setTargetBed(ui.material_preset[2].bed_temp); - #endif - } + else + do_preheat(2); break; #endif @@ -1670,17 +1650,8 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ case PREHEAT_4: if (draw) Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_4_LABEL)); - else { - thermalManager.disable_all_heaters(); - TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); - if (preheatmode == 0 || preheatmode == 1) { - TERN_(HAS_HOTEND, thermalManager.setTargetHotend(ui.material_preset[3].hotend_temp, 0)); - TERN_(HAS_FAN, thermalManager.set_fan_speed(0, ui.material_preset[3].fan_speed)); - } - #if HAS_HEATED_BED - if (preheatmode == 0 || preheatmode == 2) thermalManager.setTargetBed(ui.material_preset[3].bed_temp); - #endif - } + else + do_preheat(3); break; #endif @@ -1688,22 +1659,13 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ case PREHEAT_5: if (draw) Draw_Menu_Item(row, ICON_Temperature, F(PREHEAT_5_LABEL)); - else { - thermalManager.disable_all_heaters(); - TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); - if (preheatmode == 0 || preheatmode == 1) { - TERN_(HAS_HOTEND, thermalManager.setTargetHotend(ui.material_preset[4].hotend_temp, 0)); - TERN_(HAS_FAN, thermalManager.set_fan_speed(0, ui.material_preset[4].fan_speed)); - } - #if HAS_HEATED_BED - if (preheatmode == 0 || preheatmode == 2) thermalManager.setTargetBed(ui.material_preset[4].bed_temp); - #endif - } + else + do_preheat(4); break; #endif } - break; - #endif + } break; + #endif // HAS_PREHEAT #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) case ChangeFilament: @@ -3964,50 +3926,40 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ case PREHEATHOTEND_1: if (draw) 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); - } + else + ui.preheat_hotend_and_fan(0); break; #endif #if PREHEAT_COUNT >= 2 case PREHEATHOTEND_2: if (draw) 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); - } + else + ui.preheat_hotend_and_fan(1); break; #endif #if PREHEAT_COUNT >= 3 case PREHEATHOTEND_3: if (draw) 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); - } + else + ui.preheat_hotend_and_fan(2); break; #endif #if PREHEAT_COUNT >= 4 case PREHEATHOTEND_4: if (draw) 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); - } + else + ui.preheat_hotend_and_fan(3); break; #endif #if PREHEAT_COUNT >= 5 case PREHEATHOTEND_5: if (draw) 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); - } + else + ui.preheat_hotend_and_fan(4); break; #endif case PREHEATHOTEND_CUSTOM: diff --git a/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp index be08b074ff..be00b9c73a 100644 --- a/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp @@ -621,55 +621,19 @@ void DGUSScreenHandler::HandleHeaterControl(DGUS_VP_Variable &var, void *val_ptr void DGUSScreenHandler::HandlePreheat(DGUS_VP_Variable &var, void *val_ptr) { DEBUG_ECHOLNPGM("HandlePreheat"); - uint8_t e_temp = 0; - #if HAS_HEATED_BED - uint8_t bed_temp = 0; - #endif const uint16_t preheat_option = swap16(*(uint16_t*)val_ptr); switch (preheat_option) { default: - case 0: // Preheat PLA - #if defined(PREHEAT_1_TEMP_HOTEND) && defined(PREHEAT_1_TEMP_BED) - e_temp = PREHEAT_1_TEMP_HOTEND; - TERN_(HAS_HEATED_BED, bed_temp = PREHEAT_1_TEMP_BED); - #endif - break; - case 1: // Preheat ABS - #if defined(PREHEAT_2_TEMP_HOTEND) && defined(PREHEAT_2_TEMP_BED) - e_temp = PREHEAT_2_TEMP_HOTEND; - TERN_(HAS_HEATED_BED, bed_temp = PREHEAT_2_TEMP_BED); - #endif - break; - case 2: // Preheat PET - #if defined(PREHEAT_3_TEMP_HOTEND) && defined(PREHEAT_3_TEMP_BED) - e_temp = PREHEAT_3_TEMP_HOTEND; - TERN_(HAS_HEATED_BED, bed_temp = PREHEAT_3_TEMP_BED); - #endif - break; - case 3: // Preheat FLEX - #if defined(PREHEAT_4_TEMP_HOTEND) && defined(PREHEAT_4_TEMP_BED) - e_temp = PREHEAT_4_TEMP_HOTEND; - TERN_(HAS_HEATED_BED, bed_temp = PREHEAT_4_TEMP_BED); - #endif - break; + switch (var.VP) { + default: return; + case VP_E0_BED_PREHEAT: TERN_(HAS_HOTEND, ui.preheat_all(0)); break; + case VP_E1_BED_PREHEAT: TERN_(HAS_MULTI_HOTEND, ui.preheat_all(1)); break; + } case 7: break; // Custom preheat - case 9: break; // Cool down - } - - switch (var.VP) { - default: return; - #if HAS_HOTEND - case VP_E0_BED_PREHEAT: - thermalManager.setTargetHotend(e_temp, 0); - TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(bed_temp)); - break; - #endif - #if HOTENDS >= 2 - case VP_E1_BED_PREHEAT: - thermalManager.setTargetHotend(e_temp, 1); - TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(bed_temp)); - break; - #endif + case 9: // Cool down + thermalManager.zero_fan_speeds(); + thermalManager.disable_all_heaters(); + break; } // Go to the preheat screen to show the heating progress diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index 7358cbce23..7ce89c922a 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -1035,10 +1035,7 @@ namespace ExtUI { void setFeedrate_percent(const_float_t value) { feedrate_percentage = constrain(value, 10, 500); } void coolDown() { - #if HAS_HOTEND - HOTEND_LOOP() thermalManager.setTargetHotend(0, e); - #endif - TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(0)); + thermalManager.disable_all_heaters(); TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); } diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 2757e6d47a..925e1c1618 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -135,7 +135,10 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; #endif #if HAS_PREHEAT + #include "../module/temperature.h" + preheat_t MarlinUI::material_preset[PREHEAT_COUNT]; // Initialized by settings.load() + PGM_P MarlinUI::get_preheat_label(const uint8_t m) { #define _PDEF(N) static PGMSTR(preheat_##N##_label, PREHEAT_##N##_LABEL); #define _PLBL(N) preheat_##N##_label, @@ -143,6 +146,14 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; static PGM_P const preheat_labels[PREHEAT_COUNT] PROGMEM = { REPEAT_1(PREHEAT_COUNT, _PLBL) }; return (PGM_P)pgm_read_ptr(&preheat_labels[m]); } + + void MarlinUI::apply_preheat(const uint8_t m, const uint8_t pmask, const uint8_t e/*=active_extruder*/) { + const preheat_t &pre = material_preset[m]; + TERN_(HAS_HOTEND, if (TEST(pmask, PM_HOTEND)) thermalManager.setTargetHotend(pre.hotend_temp, e)); + TERN_(HAS_HEATED_BED, if (TEST(pmask, PM_BED)) thermalManager.setTargetBed(pre.bed_temp)); + //TERN_(HAS_HEATED_CHAMBER, if (TEST(pmask, PM_CHAMBER)) thermalManager.setTargetBed(pre.chamber_temp)); + TERN_(HAS_FAN, if (TEST(pmask, PM_FAN)) thermalManager.set_fan_speed(0, pre.fan_speed)); + } #endif #if EITHER(HAS_LCD_MENU, EXTENSIBLE_UI) diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index 63e1eb5b0d..4f797d899d 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -56,7 +56,6 @@ #if ENABLED(ADVANCED_PAUSE_FEATURE) && ANY(HAS_LCD_MENU, EXTENSIBLE_UI, HAS_DWIN_E3V2) #include "../feature/pause.h" - #include "../module/motion.h" // for active_extruder #endif #if ENABLED(DWIN_CREALITY_LCD) @@ -498,8 +497,15 @@ public: #endif #if HAS_PREHEAT + enum PreheatMask : uint8_t { PM_HOTEND = _BV(0), PM_BED = _BV(1), PM_FAN = _BV(2), PM_CHAMBER = _BV(3) }; static preheat_t material_preset[PREHEAT_COUNT]; static PGM_P get_preheat_label(const uint8_t m); + static void apply_preheat(const uint8_t m, const uint8_t pmask, const uint8_t e=active_extruder); + static inline void preheat_set_fan(const uint8_t m) { TERN_(HAS_FAN, apply_preheat(m, PM_FAN)); } + static inline void preheat_hotend(const uint8_t m, const uint8_t e=active_extruder) { TERN_(HAS_HOTEND, apply_preheat(m, PM_HOTEND)); } + static inline void preheat_hotend_and_fan(const uint8_t m, const uint8_t e=active_extruder) { preheat_hotend(m, e); preheat_set_fan(m); } + static inline void preheat_bed(const uint8_t m) { TERN_(HAS_HEATED_BED, apply_preheat(m, PM_BED)); } + static inline void preheat_all(const uint8_t m) { apply_preheat(m, 0xFF); } #endif #if SCREENS_CAN_TIME_OUT From 70e31bff45165dd07375cd6140fc0a72468e0894 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 27 Oct 2021 21:36:06 -0500 Subject: [PATCH 073/125] =?UTF-8?q?=F0=9F=8E=A8=20Standard=20'cooldown'=20?= =?UTF-8?q?method?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/control/M80_M81.cpp | 3 +-- Marlin/src/lcd/e3v2/creality/dwin.cpp | 10 ++++---- Marlin/src/lcd/e3v2/enhanced/dwin.cpp | 13 ++++------- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 23 ++++++++----------- .../src/lcd/extui/dgus/DGUSScreenHandler.cpp | 7 ++---- Marlin/src/lcd/extui/ui_api.cpp | 5 +--- Marlin/src/lcd/menu/menu_temperature.cpp | 3 +-- Marlin/src/module/temperature.h | 8 +++++++ 8 files changed, 31 insertions(+), 41 deletions(-) diff --git a/Marlin/src/gcode/control/M80_M81.cpp b/Marlin/src/gcode/control/M80_M81.cpp index 2a1b3b34b9..b8be9daa40 100644 --- a/Marlin/src/gcode/control/M80_M81.cpp +++ b/Marlin/src/gcode/control/M80_M81.cpp @@ -74,13 +74,12 @@ * This code should ALWAYS be available for FULL SHUTDOWN! */ void GcodeSuite::M81() { - thermalManager.disable_all_heaters(); planner.finish_and_disable(); + thermalManager.cooldown(); print_job_timer.stop(); #if HAS_FAN - thermalManager.zero_fan_speeds(); #if ENABLED(PROBING_FANS_OFF) thermalManager.fans_paused = false; ZERO(thermalManager.saved_fan_speed); diff --git a/Marlin/src/lcd/e3v2/creality/dwin.cpp b/Marlin/src/lcd/e3v2/creality/dwin.cpp index 82623d7c7d..adf8f3771f 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.cpp +++ b/Marlin/src/lcd/e3v2/creality/dwin.cpp @@ -2735,6 +2735,7 @@ void HMI_Prepare() { queue.inject_P(G28_STR); // G28 will set home_flag Popup_Window_Home(); break; + #if HAS_ZOFFSET_ITEM case PREPARE_CASE_ZOFF: #if EITHER(HAS_BED_PROBE, BABYSTEPPING) @@ -2750,6 +2751,7 @@ void HMI_Prepare() { #endif break; #endif + #if HAS_PREHEAT case PREPARE_CASE_PLA: ui.preheat_all(0); break; #if PREHEAT_COUNT > 1 @@ -2758,18 +2760,14 @@ void HMI_Prepare() { #endif #if HAS_HOTEND || HAS_HEATED_BED - case PREPARE_CASE_COOL: - TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); - #if HAS_HOTEND || HAS_HEATED_BED - thermalManager.disable_all_heaters(); - #endif - break; + case PREPARE_CASE_COOL: thermalManager.cooldown(); break; #endif case PREPARE_CASE_LANG: HMI_ToggleLanguage(); Draw_Prepare_Menu(); break; + default: break; } } diff --git a/Marlin/src/lcd/e3v2/enhanced/dwin.cpp b/Marlin/src/lcd/e3v2/enhanced/dwin.cpp index 3d5a56c869..787cf717eb 100644 --- a/Marlin/src/lcd/e3v2/enhanced/dwin.cpp +++ b/Marlin/src/lcd/e3v2/enhanced/dwin.cpp @@ -1787,8 +1787,7 @@ void DWIN_Print_Started(const bool sd) { // Ended print job void DWIN_Print_Finished() { if (checkkey == PrintProcess || printingIsActive()) { - thermalManager.disable_all_heaters(); - thermalManager.zero_fan_speeds(); + thermalManager.cooldown(); HMI_flag.print_finish = true; } } @@ -2116,17 +2115,13 @@ void SetHome() { #endif #if HAS_PREHEAT - void SetCoolDown() { - TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); - #if HAS_HOTEND || HAS_HEATED_BED - thermalManager.disable_all_heaters(); - #endif - } void DoPreheat0() { ui.preheat_all(0); } void DoPreheat1() { ui.preheat_all(1); } void DoPreheat2() { ui.preheat_all(2); } #endif +void DoCoolDown() { thermalManager.cooldown(); } + void SetLanguage() { HMI_ToggleLanguage(); CurrentMenu = nullptr; // Invalidate menu to full redraw @@ -3126,8 +3121,8 @@ void Draw_Prepare_Menu() { #if PREHEAT_COUNT > 2 ADDMENUITEM(ICON_CustomPreheat, GET_TEXT_F(MSG_PREHEAT_CUSTOM), onDrawMenuItem, DoPreheat2); #endif - ADDMENUITEM(ICON_Cool, GET_TEXT_F(MSG_COOLDOWN), onDrawCooldown, SetCoolDown); #endif + ADDMENUITEM(ICON_Cool, GET_TEXT_F(MSG_COOLDOWN), onDrawCooldown, DoCoolDown); ADDMENUITEM(ICON_Language, PSTR("UI Language"), onDrawLanguage, SetLanguage); } CurrentMenu->draw(); diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 54266e717b..80ef88d0b2 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -1030,7 +1030,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #define PREPARE_MANUALLEVEL (PREPARE_HOME + 1) #define PREPARE_ZOFFSET (PREPARE_MANUALLEVEL + ENABLED(HAS_ZOFFSET_ITEM)) #define PREPARE_PREHEAT (PREPARE_ZOFFSET + ENABLED(HAS_PREHEAT)) - #define PREPARE_COOLDOWN (PREPARE_PREHEAT + ENABLED(HAS_PREHEAT)) + #define PREPARE_COOLDOWN (PREPARE_PREHEAT + EITHER(HAS_HOTEND, HAS_HEATED_BED)) #define PREPARE_CHANGEFIL (PREPARE_COOLDOWN + ENABLED(ADVANCED_PAUSE_FEATURE)) #define PREPARE_TOTAL PREPARE_CHANGEFIL @@ -1096,13 +1096,14 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ else Draw_Menu(Preheat); break; + #endif + + #if HAS_HOTEND || HAS_HEATED_BED case PREPARE_COOLDOWN: if (draw) Draw_Menu_Item(row, ICON_Cool, F("Cooldown")); - else { - TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); - thermalManager.disable_all_heaters(); - } + else + thermalManager.cooldown(); break; #endif @@ -1597,8 +1598,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ #define PREHEAT_TOTAL PREHEAT_5 auto do_preheat = [](const uint8_t m) { - thermalManager.disable_all_heaters(); - TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); + thermalManager.cooldown(); if (preheatmode == 0 || preheatmode == 1) { ui.preheat_hotend_and_fan(m); } if (preheatmode == 0 || preheatmode == 2) ui.preheat_bed(m); }; @@ -4496,8 +4496,7 @@ void CrealityDWINClass::Popup_Control() { TERN_(HAS_HOTEND, pausetemp = thermalManager.temp_hotend[0].target); TERN_(HAS_HEATED_BED, pausebed = thermalManager.temp_bed.target); TERN_(HAS_FAN, pausefan = thermalManager.fan_speed[0]); - thermalManager.disable_all_heaters(); - TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); + thermalManager.cooldown(); #endif } else { @@ -4510,8 +4509,7 @@ void CrealityDWINClass::Popup_Control() { if (selection == 0) { if (sdprint) { ui.abort_print(); - TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); - thermalManager.disable_all_heaters(); + thermalManager.cooldown(); } else { TERN_(HOST_ACTION_COMMANDS, hostui.cancel()); @@ -4741,8 +4739,7 @@ void CrealityDWINClass::Start_Print(bool sd) { void CrealityDWINClass::Stop_Print() { printing = false; sdprint = false; - TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); - thermalManager.disable_all_heaters(); + thermalManager.cooldown(); TERN_(LCD_SET_PROGRESS_MANUALLY, ui.set_progress(100 * (PROGRESS_SCALE))); TERN_(USE_M73_REMAINING_TIME, ui.set_remaining_time(0)); Draw_Print_confirm(); diff --git a/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp index be00b9c73a..2b00fd16f8 100644 --- a/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp @@ -626,14 +626,11 @@ void DGUSScreenHandler::HandleHeaterControl(DGUS_VP_Variable &var, void *val_ptr default: switch (var.VP) { default: return; - case VP_E0_BED_PREHEAT: TERN_(HAS_HOTEND, ui.preheat_all(0)); break; + case VP_E0_BED_PREHEAT: TERN_(HAS_HOTEND, ui.preheat_all(0)); break; case VP_E1_BED_PREHEAT: TERN_(HAS_MULTI_HOTEND, ui.preheat_all(1)); break; } case 7: break; // Custom preheat - case 9: // Cool down - thermalManager.zero_fan_speeds(); - thermalManager.disable_all_heaters(); - break; + case 9: thermalManager.cooldown(); break; // Cool down } // Go to the preheat screen to show the heating progress diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index 7ce89c922a..54e7db55c2 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -1034,10 +1034,7 @@ namespace ExtUI { void setFeedrate_percent(const_float_t value) { feedrate_percentage = constrain(value, 10, 500); } - void coolDown() { - thermalManager.disable_all_heaters(); - TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); - } + void coolDown() { thermalManager.cooldown(); } bool awaitingUserConfirm() { return TERN0(HAS_RESUME_CONTINUE, wait_for_user) || getHostKeepaliveIsPaused(); diff --git a/Marlin/src/lcd/menu/menu_temperature.cpp b/Marlin/src/lcd/menu/menu_temperature.cpp index 5524793b19..0e36884858 100644 --- a/Marlin/src/lcd/menu/menu_temperature.cpp +++ b/Marlin/src/lcd/menu/menu_temperature.cpp @@ -143,8 +143,7 @@ void Temperature::lcd_preheat(const uint8_t e, const int8_t indh, const int8_t i #if HAS_TEMP_HOTEND || HAS_HEATED_BED void lcd_cooldown() { - thermalManager.zero_fan_speeds(); - thermalManager.disable_all_heaters(); + thermalManager.cooldown(); ui.return_to_status(); } diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index 5579f71172..0e66f23110 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -848,6 +848,14 @@ class Temperature { */ static void disable_all_heaters(); + /** + * Cooldown, as from the LCD. Disables all heaters and fans. + */ + static inline void cooldown() { + zero_fan_speeds(); + disable_all_heaters(); + } + #if ENABLED(PRINTJOB_TIMER_AUTOSTART) /** * Methods to check if heaters are enabled, indicating an active job From 67b075fd39e530c5d7e8a09ee6b3dba81d8548d0 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sat, 30 Oct 2021 00:58:37 +0000 Subject: [PATCH 074/125] [cron] Bump distribution date (2021-10-30) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index e0165a280f..d1bff6ba10 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-10-29" +//#define STRING_DISTRIBUTION_DATE "2021-10-30" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index f61066e58f..9a90feeb88 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-10-29" + #define STRING_DISTRIBUTION_DATE "2021-10-30" #endif /** From 18a924d4e26539c270dc08677d4319e5b012c723 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 29 Oct 2021 20:42:52 -0500 Subject: [PATCH 075/125] =?UTF-8?q?=F0=9F=94=A7=20Configuration=20version?= =?UTF-8?q?=2002000903?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration.h | 2 +- Marlin/Configuration_adv.h | 2 +- Marlin/src/inc/Version.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index d8ced232b4..0a51019b67 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -35,7 +35,7 @@ * * Advanced settings can be found in Configuration_adv.h */ -#define CONFIGURATION_H_VERSION 02000902 +#define CONFIGURATION_H_VERSION 02000903 //=========================================================================== //============================= Getting Started ============================= diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index d6217ba940..b713371a60 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -30,7 +30,7 @@ * * Basic settings can be found in Configuration.h */ -#define CONFIGURATION_ADV_H_VERSION 02000902 +#define CONFIGURATION_ADV_H_VERSION 02000903 //=========================================================================== //============================= Thermal Settings ============================ diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 9a90feeb88..9e87e765d5 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -52,7 +52,7 @@ * to alert users to major changes. */ -#define MARLIN_HEX_VERSION 02000902 +#define MARLIN_HEX_VERSION 02000903 #ifndef REQUIRED_CONFIGURATION_H_VERSION #define REQUIRED_CONFIGURATION_H_VERSION MARLIN_HEX_VERSION #endif From aa4e32555dd247c391356a2e1449dd9820beeab6 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 29 Oct 2021 20:46:55 -0500 Subject: [PATCH 076/125] =?UTF-8?q?=E2=9C=A8=20"Rutilea"=20ESP32=20board?= =?UTF-8?q?=20(#22880)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/ESP32/i2s.cpp | 30 ++++---- Marlin/src/core/boards.h | 7 +- Marlin/src/pins/esp32/pins_ESPA_common.h | 89 ++++++++++++++++++++++ Marlin/src/pins/esp32/pins_FYSETC_E4.h | 57 +------------- Marlin/src/pins/esp32/pins_MRR_ESPA.h | 53 +------------ Marlin/src/pins/esp32/pins_MRR_ESPE.h | 1 - Marlin/src/pins/esp32/pins_RESP32_CUSTOM.h | 37 +++++++++ Marlin/src/pins/pins.h | 2 + 8 files changed, 148 insertions(+), 128 deletions(-) create mode 100644 Marlin/src/pins/esp32/pins_ESPA_common.h create mode 100644 Marlin/src/pins/esp32/pins_RESP32_CUSTOM.h diff --git a/Marlin/src/HAL/ESP32/i2s.cpp b/Marlin/src/HAL/ESP32/i2s.cpp index 557ea319e6..3e77b65836 100644 --- a/Marlin/src/HAL/ESP32/i2s.cpp +++ b/Marlin/src/HAL/ESP32/i2s.cpp @@ -64,12 +64,9 @@ uint32_t i2s_port_data = 0; #define I2S_EXIT_CRITICAL() portEXIT_CRITICAL(&i2s_spinlock[i2s_num]) static inline void gpio_matrix_out_check(uint32_t gpio, uint32_t signal_idx, bool out_inv, bool oen_inv) { - //if pin = -1, do not need to configure - if (gpio != -1) { - PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[gpio], PIN_FUNC_GPIO); - gpio_set_direction((gpio_num_t)gpio, (gpio_mode_t)GPIO_MODE_DEF_OUTPUT); - gpio_matrix_out(gpio, signal_idx, out_inv, oen_inv); - } + PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[gpio], PIN_FUNC_GPIO); + gpio_set_direction((gpio_num_t)gpio, (gpio_mode_t)GPIO_MODE_DEF_OUTPUT); + gpio_matrix_out(gpio, signal_idx, out_inv, oen_inv); } static esp_err_t i2s_reset_fifo(i2s_port_t i2s_num) { @@ -256,13 +253,7 @@ int i2s_init() { I2S0.fifo_conf.dscr_en = 0; - I2S0.conf_chan.tx_chan_mod = ( - #if ENABLED(I2S_STEPPER_SPLIT_STREAM) - 4 - #else - 0 - #endif - ); + I2S0.conf_chan.tx_chan_mod = TERN(I2S_STEPPER_SPLIT_STREAM, 4, 0); I2S0.fifo_conf.tx_fifo_mod = 0; I2S0.conf.tx_mono = 0; @@ -313,9 +304,16 @@ int i2s_init() { xTaskCreatePinnedToCore(stepperTask, "StepperTask", 10000, nullptr, 1, nullptr, CONFIG_ARDUINO_RUNNING_CORE); // run I2S stepper task on same core as rest of Marlin // Route the i2s pins to the appropriate GPIO - gpio_matrix_out_check(I2S_DATA, I2S0O_DATA_OUT23_IDX, 0, 0); - gpio_matrix_out_check(I2S_BCK, I2S0O_BCK_OUT_IDX, 0, 0); - gpio_matrix_out_check(I2S_WS, I2S0O_WS_OUT_IDX, 0, 0); + // If a pin is not defined, no need to configure + #if defined(I2S_DATA) && I2S_DATA >= 0 + gpio_matrix_out_check(I2S_DATA, I2S0O_DATA_OUT23_IDX, 0, 0); + #endif + #if defined(I2S_BCK) && I2S_BCK >= 0 + gpio_matrix_out_check(I2S_BCK, I2S0O_BCK_OUT_IDX, 0, 0); + #endif + #if defined(I2S_WS) && I2S_WS >= 0 + gpio_matrix_out_check(I2S_WS, I2S0O_WS_OUT_IDX, 0, 0); + #endif // Start the I2S peripheral return i2s_start(I2S_NUM_0); diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 6e116888bc..2341e6577b 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -425,9 +425,10 @@ #define BOARD_MRR_ESPA 6001 // MRR ESPA based on ESP32 (native pins only) #define BOARD_MRR_ESPE 6002 // MRR ESPE based on ESP32 (with I2S stepper stream) #define BOARD_E4D_BOX 6003 // E4d@BOX -#define BOARD_FYSETC_E4 6004 // FYSETC E4 -#define BOARD_PANDA_ZHU 6005 // Panda_ZHU -#define BOARD_PANDA_M4 6006 // Panda_M4 +#define BOARD_RESP32_CUSTOM 6004 // Rutilea ESP32 custom board +#define BOARD_FYSETC_E4 6005 // FYSETC E4 +#define BOARD_PANDA_ZHU 6006 // Panda_ZHU +#define BOARD_PANDA_M4 6007 // Panda_M4 // // SAMD51 ARM Cortex M4 diff --git a/Marlin/src/pins/esp32/pins_ESPA_common.h b/Marlin/src/pins/esp32/pins_ESPA_common.h new file mode 100644 index 0000000000..2fcacb3002 --- /dev/null +++ b/Marlin/src/pins/esp32/pins_ESPA_common.h @@ -0,0 +1,89 @@ +/** + * 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 + +/** + * ESPA-like pin assignments + * Supports 4 stepper drivers, heated bed, single hotend. + */ + +#include "env_validate.h" + +#ifndef DEFAULT_MACHINE_NAME + #define DEFAULT_MACHINE_NAME BOARD_INFO_NAME +#endif + +// +// Disable I2S stepper stream, by default +// +#undef I2S_STEPPER_STREAM +#undef I2S_WS +#undef I2S_BCK +#undef I2S_DATA + +// +// Limit Switches +// +#define X_STOP_PIN 34 +#define Y_STOP_PIN 35 +#define Z_STOP_PIN 15 + +// +// Steppers +// +#define X_STEP_PIN 27 +#define X_DIR_PIN 26 +#define X_ENABLE_PIN 25 + +#define Y_STEP_PIN 33 +#define Y_DIR_PIN 32 +#define Y_ENABLE_PIN X_ENABLE_PIN + +#define Z_STEP_PIN 14 +#define Z_DIR_PIN 12 +#define Z_ENABLE_PIN X_ENABLE_PIN + +#define E0_STEP_PIN 16 +#define E0_DIR_PIN 17 +#define E0_ENABLE_PIN X_ENABLE_PIN + +// +// Temperature Sensors +// +#define TEMP_0_PIN 36 // Analog Input +#define TEMP_BED_PIN 39 // Analog Input + +// +// Heaters / Fans +// +#define HEATER_0_PIN 2 +#define FAN_PIN 13 +#define HEATER_BED_PIN 4 + +// +// MicroSD card +// +#define SD_MOSI_PIN 23 +#define SD_MISO_PIN 19 +#define SD_SCK_PIN 18 +#define SDSS 5 +#define USES_SHARED_SPI // SPI is shared by SD card with TMC SPI drivers diff --git a/Marlin/src/pins/esp32/pins_FYSETC_E4.h b/Marlin/src/pins/esp32/pins_FYSETC_E4.h index 4e71a66a22..e75b6ece28 100644 --- a/Marlin/src/pins/esp32/pins_FYSETC_E4.h +++ b/Marlin/src/pins/esp32/pins_FYSETC_E4.h @@ -37,41 +37,8 @@ #endif #define BOARD_INFO_NAME "FYSETC_E4" -#define DEFAULT_MACHINE_NAME BOARD_INFO_NAME -// -// Disable I2S stepper stream -// -#undef I2S_STEPPER_STREAM -#define I2S_WS -1 -#define I2S_BCK -1 -#define I2S_DATA -1 - -// -// Limit Switches -// -#define X_STOP_PIN 34 -#define Y_STOP_PIN 35 -#define Z_STOP_PIN 15 - -// -// Steppers -// -#define X_STEP_PIN 27 -#define X_DIR_PIN 26 -#define X_ENABLE_PIN 25 - -#define Y_STEP_PIN 33 -#define Y_DIR_PIN 32 -#define Y_ENABLE_PIN X_ENABLE_PIN - -#define Z_STEP_PIN 14 -#define Z_DIR_PIN 12 -#define Z_ENABLE_PIN X_ENABLE_PIN - -#define E0_STEP_PIN 16 -#define E0_DIR_PIN 17 -#define E0_ENABLE_PIN X_ENABLE_PIN +#include "pins_ESPA_common.h" #if HAS_TMC_UART // @@ -89,28 +56,6 @@ #define TMC_BAUD_RATE 115200 #endif -// -// Temperature Sensors -// -#define TEMP_0_PIN 36 // Analog Input -#define TEMP_BED_PIN 39 // Analog Input - -// -// Heaters / Fans -// -#define HEATER_0_PIN 2 -#define FAN_PIN 13 -#define HEATER_BED_PIN 4 - -// -// MicroSD card -// -#define SD_MOSI_PIN 23 -#define SD_MISO_PIN 19 -#define SD_SCK_PIN 18 -#define SDSS 5 -#define USES_SHARED_SPI // SPI is shared by SD card with TMC SPI drivers - /** * Hardware serial pins * diff --git a/Marlin/src/pins/esp32/pins_MRR_ESPA.h b/Marlin/src/pins/esp32/pins_MRR_ESPA.h index a5f70e8159..cc67bc025c 100644 --- a/Marlin/src/pins/esp32/pins_MRR_ESPA.h +++ b/Marlin/src/pins/esp32/pins_MRR_ESPA.h @@ -38,68 +38,17 @@ #define BOARD_INFO_NAME "MRR ESPA" #define BOARD_WEBSITE_URL "github.com/maplerainresearch/MRR_ESPA" -#define DEFAULT_MACHINE_NAME BOARD_INFO_NAME -// -// Disable I2S stepper stream -// -#undef I2S_STEPPER_STREAM -#undef I2S_WS -#undef I2S_BCK -#undef I2S_DATA - -// -// Limit Switches -// -#define X_STOP_PIN 34 -#define Y_STOP_PIN 35 -#define Z_STOP_PIN 15 +#include "pins_ESPA_common.h" // // Steppers // -#define X_STEP_PIN 27 -#define X_DIR_PIN 26 -#define X_ENABLE_PIN 25 //#define X_CS_PIN 21 - -#define Y_STEP_PIN 33 -#define Y_DIR_PIN 32 -#define Y_ENABLE_PIN X_ENABLE_PIN //#define Y_CS_PIN 22 - -#define Z_STEP_PIN 14 -#define Z_DIR_PIN 12 -#define Z_ENABLE_PIN X_ENABLE_PIN //#define Z_CS_PIN 5 // SS_PIN - -#define E0_STEP_PIN 16 -#define E0_DIR_PIN 17 -#define E0_ENABLE_PIN X_ENABLE_PIN //#define E0_CS_PIN 21 -// -// Temperature Sensors -// -#define TEMP_0_PIN 36 // Analog Input -#define TEMP_BED_PIN 39 // Analog Input - -// -// Heaters / Fans -// -#define HEATER_0_PIN 2 -#define FAN_PIN 13 -#define HEATER_BED_PIN 4 - -// -// MicroSD card -// -#define SD_MOSI_PIN 23 -#define SD_MISO_PIN 19 -#define SD_SCK_PIN 18 -#define SDSS 5 -#define USES_SHARED_SPI // SPI is shared by SD card with TMC SPI drivers - // Hardware serial pins // Add the following to Configuration.h or Configuration_adv.h to assign // specific pins to hardware Serial1. diff --git a/Marlin/src/pins/esp32/pins_MRR_ESPE.h b/Marlin/src/pins/esp32/pins_MRR_ESPE.h index ae4f0c6e36..60c8405dfe 100644 --- a/Marlin/src/pins/esp32/pins_MRR_ESPE.h +++ b/Marlin/src/pins/esp32/pins_MRR_ESPE.h @@ -51,7 +51,6 @@ // // Enable I2S stepper stream // -#undef I2S_STEPPER_STREAM #define I2S_STEPPER_STREAM #define I2S_WS 26 #define I2S_BCK 25 diff --git a/Marlin/src/pins/esp32/pins_RESP32_CUSTOM.h b/Marlin/src/pins/esp32/pins_RESP32_CUSTOM.h new file mode 100644 index 0000000000..5d3f75574d --- /dev/null +++ b/Marlin/src/pins/esp32/pins_RESP32_CUSTOM.h @@ -0,0 +1,37 @@ +/** + * 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 + +/** + * Rutilea ESP32 (Tensilica Xtensa LX6) pin assignments + */ + +#include "env_validate.h" + +#define BOARD_INFO_NAME "Rutilea ESP32" + +#include "pins_ESPA_common.h" + +// +// I2S (steppers & other output-only pins) +// +#define I2S_STEPPER_STREAM diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 1a05f55fdc..49d06590e9 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -695,6 +695,8 @@ #include "esp32/pins_MRR_ESPE.h" // ESP32 env:esp32 #elif MB(E4D_BOX) #include "esp32/pins_E4D.h" // ESP32 env:esp32 +#elif MB(RESP32_CUSTOM) + #include "esp32/pins_RESP32_CUSTOM.h" // ESP32 env:esp32 #elif MB(FYSETC_E4) #include "esp32/pins_FYSETC_E4.h" // ESP32 env:FYSETC_E4 #elif MB(PANDA_ZHU) From 75e0b7f8ff668217889b770a83990c532998ca95 Mon Sep 17 00:00:00 2001 From: aalku Date: Sat, 30 Oct 2021 07:17:20 +0200 Subject: [PATCH 077/125] =?UTF-8?q?=E2=9C=A8=20Shutdown=20Host=20Action=20?= =?UTF-8?q?(#22908)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/Configuration_adv.h | 3 ++- Marlin/src/feature/host_actions.cpp | 4 ++++ Marlin/src/feature/host_actions.h | 3 +++ Marlin/src/inc/Conditionals_adv.h | 3 +++ Marlin/src/lcd/language/language_en.h | 2 ++ Marlin/src/lcd/menu/menu_bed_corners.cpp | 2 +- Marlin/src/lcd/menu/menu_cancelobject.cpp | 2 +- Marlin/src/lcd/menu/menu_configuration.cpp | 11 +++------ Marlin/src/lcd/menu/menu_main.cpp | 27 ++++++++++++++-------- Marlin/src/lcd/menu/menu_media.cpp | 2 +- Marlin/src/lcd/menu/menu_motion.cpp | 2 +- Marlin/src/lcd/menu/menu_tramming.cpp | 2 +- 12 files changed, 40 insertions(+), 23 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index b713371a60..4efab8193c 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -3844,7 +3844,8 @@ #if ENABLED(HOST_ACTION_COMMANDS) //#define HOST_PAUSE_M76 //#define HOST_PROMPT_SUPPORT - //#define HOST_START_MENU_ITEM // Add a menu item that tells the host to start + //#define HOST_START_MENU_ITEM // Add a menu item that tells the host to start + //#define HOST_SHUTDOWN_MENU_ITEM // Add a menu item that tells the host to shut down #endif /** diff --git a/Marlin/src/feature/host_actions.cpp b/Marlin/src/feature/host_actions.cpp index 6a1faf81c0..be7b055b55 100644 --- a/Marlin/src/feature/host_actions.cpp +++ b/Marlin/src/feature/host_actions.cpp @@ -80,6 +80,10 @@ void HostUI::action(FSTR_P const fstr, const bool eol) { #endif #endif +#ifdef SHUTDOWN_ACTION + void HostUI::shutdown() { action(F(SHUTDOWN_ACTION)); } +#endif + #if ENABLED(HOST_PROMPT_SUPPORT) PromptReason HostUI::host_prompt_reason = PROMPT_NOT_DEFINED; diff --git a/Marlin/src/feature/host_actions.h b/Marlin/src/feature/host_actions.h index 6671072139..45379afc29 100644 --- a/Marlin/src/feature/host_actions.h +++ b/Marlin/src/feature/host_actions.h @@ -71,6 +71,9 @@ class HostUI { #ifdef ACTION_ON_START static void start(); #endif + #ifdef SHUTDOWN_ACTION + static void shutdown(); + #endif #if ENABLED(G29_RETRY_AND_RECOVER) #ifdef ACTION_ON_G29_RECOVER diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index dd2d6ed748..efb9db420d 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -701,6 +701,9 @@ #ifndef ACTION_ON_KILL #define ACTION_ON_KILL "poweroff" #endif + #ifndef SHUTDOWN_ACTION + #define SHUTDOWN_ACTION "shutdown" + #endif #if HAS_FILAMENT_SENSOR #ifndef ACTION_ON_FILAMENT_RUNOUT #define ACTION_ON_FILAMENT_RUNOUT "filament_runout" diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 8af60c1642..9a92a7e268 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -745,6 +745,8 @@ namespace Language_en { LSTR MSG_SD_CARD = _UxGT("SD Card"); LSTR MSG_USB_DISK = _UxGT("USB Disk"); + LSTR MSG_HOST_SHUTDOWN = _UxGT("Host Shutdown"); + // These strings can be the same in all languages LSTR MSG_MARLIN = _UxGT("Marlin"); LSTR MSG_SHORT_DAY = _UxGT("d"); // One character only diff --git a/Marlin/src/lcd/menu/menu_bed_corners.cpp b/Marlin/src/lcd/menu/menu_bed_corners.cpp index 79193fbef3..872b9b3840 100644 --- a/Marlin/src/lcd/menu/menu_bed_corners.cpp +++ b/Marlin/src/lcd/menu/menu_bed_corners.cpp @@ -213,7 +213,7 @@ static void _lcd_level_bed_corners_get_next_position() { if (!ui.should_draw()) return; MenuItem_confirm::confirm_screen( []{ queue.inject(TERN(HAS_LEVELING, F("G29N"), FPSTR(G28_STR))); ui.return_to_status(); } - , []{ ui.goto_previous_screen_no_defer(); } + , ui.goto_previous_screen_no_defer , GET_TEXT(MSG_BED_TRAMMING_IN_RANGE) , (const char*)nullptr, PSTR("?") ); diff --git a/Marlin/src/lcd/menu/menu_cancelobject.cpp b/Marlin/src/lcd/menu/menu_cancelobject.cpp index a8ced05759..f2a06ecf6a 100644 --- a/Marlin/src/lcd/menu/menu_cancelobject.cpp +++ b/Marlin/src/lcd/menu/menu_cancelobject.cpp @@ -47,7 +47,7 @@ static void lcd_cancel_object_confirm() { ui.completion_feedback(); ui.goto_previous_screen(); }, - ui.goto_previous_screen, + nullptr, GET_TEXT(MSG_CANCEL_OBJECT), item_num, PSTR("?") ); } diff --git a/Marlin/src/lcd/menu/menu_configuration.cpp b/Marlin/src/lcd/menu/menu_configuration.cpp index 9e1f455a64..6d6b0228fb 100644 --- a/Marlin/src/lcd/menu/menu_configuration.cpp +++ b/Marlin/src/lcd/menu/menu_configuration.cpp @@ -64,9 +64,7 @@ void menu_advanced_settings(); static int8_t bar_percent = 0; if (ui.use_click()) { ui.goto_previous_screen(); - #if HAS_MARLINUI_HD44780 - ui.set_custom_characters(CHARSET_MENU); - #endif + TERN_(HAS_MARLINUI_HD44780, ui.set_custom_characters(CHARSET_MENU)); return; } bar_percent += (int8_t)ui.encoderPosition; @@ -79,9 +77,7 @@ void menu_advanced_settings(); void _progress_bar_test() { ui.goto_screen(progress_bar_test); - #if HAS_MARLINUI_HD44780 - ui.set_custom_characters(CHARSET_INFO); - #endif + TERN_(HAS_MARLINUI_HD44780, ui.set_custom_characters(CHARSET_INFO)); } #endif // LCD_PROGRESS_BAR_TEST @@ -363,8 +359,7 @@ void menu_advanced_settings(); #define _CUSTOM_ITEM_CONF_CONFIRM(N) \ SUBMENU_P(PSTR(CONFIG_MENU_ITEM_##N##_DESC), []{ \ MenuItem_confirm::confirm_screen( \ - GCODE_LAMBDA_CONF(N), \ - ui.goto_previous_screen, \ + GCODE_LAMBDA_CONF(N), nullptr, \ PSTR(CONFIG_MENU_ITEM_##N##_DESC "?") \ ); \ }) diff --git a/Marlin/src/lcd/menu/menu_main.cpp b/Marlin/src/lcd/menu/menu_main.cpp index 172f9daf7a..aca10edc6a 100644 --- a/Marlin/src/lcd/menu/menu_main.cpp +++ b/Marlin/src/lcd/menu/menu_main.cpp @@ -58,7 +58,7 @@ #include "../../feature/password/password.h" #endif -#if ENABLED(HOST_START_MENU_ITEM) && defined(ACTION_ON_START) +#if (ENABLED(HOST_START_MENU_ITEM) && defined(ACTION_ON_START)) || (ENABLED(HOST_SHUTDOWN_MENU_ITEM) && defined(SHUTDOWN_ACTION)) #include "../../feature/host_actions.h" #endif @@ -128,8 +128,7 @@ void menu_configuration(); #define _CUSTOM_ITEM_MAIN_CONFIRM(N) \ SUBMENU_P(PSTR(MAIN_MENU_ITEM_##N##_DESC), []{ \ MenuItem_confirm::confirm_screen( \ - GCODE_LAMBDA_MAIN(N), \ - ui.goto_previous_screen, \ + GCODE_LAMBDA_MAIN(N), nullptr, \ PSTR(MAIN_MENU_ITEM_##N##_DESC "?") \ ); \ }) @@ -274,7 +273,7 @@ void menu_main() { SUBMENU(MSG_STOP_PRINT, []{ MenuItem_confirm::select_screen( GET_TEXT(MSG_BUTTON_STOP), GET_TEXT(MSG_BACK), - ui.abort_print, ui.goto_previous_screen, + ui.abort_print, nullptr, GET_TEXT(MSG_STOP_PRINT), (const char *)nullptr, PSTR("?") ); }); @@ -346,7 +345,7 @@ void menu_main() { #if ENABLED(ADVANCED_PAUSE_FEATURE) #if E_STEPPERS == 1 && DISABLED(FILAMENT_LOAD_UNLOAD_GCODES) YESNO_ITEM(MSG_FILAMENTCHANGE, - menu_change_filament, ui.goto_previous_screen, + menu_change_filament, nullptr, GET_TEXT(MSG_FILAMENTCHANGE), (const char *)nullptr, PSTR("?") ); #else @@ -370,7 +369,7 @@ void menu_main() { #if ENABLED(PS_OFF_CONFIRM) CONFIRM_ITEM(MSG_SWITCH_PS_OFF, MSG_YES, MSG_NO, - ui.poweroff, ui.goto_previous_screen, + ui.poweroff, nullptr, GET_TEXT(MSG_SWITCH_PS_OFF), (const char *)nullptr, PSTR("?") ); #else @@ -394,21 +393,21 @@ void menu_main() { #if SERVICE_INTERVAL_1 > 0 CONFIRM_ITEM_P(PSTR(SERVICE_NAME_1), MSG_BUTTON_RESET, MSG_BUTTON_CANCEL, - []{ _service_reset(1); }, ui.goto_previous_screen, + []{ _service_reset(1); }, nullptr, GET_TEXT(MSG_SERVICE_RESET), F(SERVICE_NAME_1), PSTR("?") ); #endif #if SERVICE_INTERVAL_2 > 0 CONFIRM_ITEM_P(PSTR(SERVICE_NAME_2), MSG_BUTTON_RESET, MSG_BUTTON_CANCEL, - []{ _service_reset(2); }, ui.goto_previous_screen, + []{ _service_reset(2); }, nullptr, GET_TEXT(MSG_SERVICE_RESET), F(SERVICE_NAME_2), PSTR("?") ); #endif #if SERVICE_INTERVAL_3 > 0 CONFIRM_ITEM_P(PSTR(SERVICE_NAME_3), MSG_BUTTON_RESET, MSG_BUTTON_CANCEL, - []{ _service_reset(3); }, ui.goto_previous_screen, + []{ _service_reset(3); }, nullptr, GET_TEXT(MSG_SERVICE_RESET), F(SERVICE_NAME_3), PSTR("?") ); #endif @@ -442,6 +441,16 @@ void menu_main() { SUBMENU(LANGUAGE, menu_language); #endif + #if ENABLED(HOST_SHUTDOWN_MENU_ITEM) && defined(SHUTDOWN_ACTION) + SUBMENU(MSG_HOST_SHUTDOWN, []{ + MenuItem_confirm::select_screen( + GET_TEXT(MSG_BUTTON_PROCEED), GET_TEXT(MSG_BUTTON_CANCEL), + []{ ui.return_to_status(); hostui.shutdown(); }, nullptr, + GET_TEXT(MSG_HOST_SHUTDOWN), (const char *)nullptr, PSTR("?") + ); + }); + #endif + END_MENU(); } diff --git a/Marlin/src/lcd/menu/menu_media.cpp b/Marlin/src/lcd/menu/menu_media.cpp index 213ad257b8..4ce0a396d4 100644 --- a/Marlin/src/lcd/menu/menu_media.cpp +++ b/Marlin/src/lcd/menu/menu_media.cpp @@ -79,7 +79,7 @@ class MenuItem_sdfile : public MenuItem_sdbase { strcpy(buffer + 1, longest); MenuItem_confirm::select_screen( GET_TEXT(MSG_BUTTON_PRINT), GET_TEXT(MSG_BUTTON_CANCEL), - sdcard_start_selected_file, ui.goto_previous_screen, + sdcard_start_selected_file, nullptr, GET_TEXT(MSG_START_PRINT), buffer, PSTR("?") ); }); diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index 7191e637d1..cddb7ede74 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -210,7 +210,7 @@ void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int ui.goto_screen([]{ MenuItem_confirm::select_screen( GET_TEXT(MSG_BUTTON_PROCEED), GET_TEXT(MSG_BACK), - _goto_menu_move_distance_e, ui.goto_previous_screen, + _goto_menu_move_distance_e, nullptr, GET_TEXT(MSG_HOTEND_TOO_COLD), (const char *)nullptr, PSTR("!") ); }); diff --git a/Marlin/src/lcd/menu/menu_tramming.cpp b/Marlin/src/lcd/menu/menu_tramming.cpp index 5cdcf75c1e..8e9d4b3942 100644 --- a/Marlin/src/lcd/menu/menu_tramming.cpp +++ b/Marlin/src/lcd/menu/menu_tramming.cpp @@ -66,7 +66,7 @@ static void _menu_single_probe() { STATIC_ITEM(MSG_BED_TRAMMING, SS_LEFT); STATIC_ITEM(MSG_LAST_VALUE_SP, SS_LEFT, z_isvalid[tram_index] ? ftostr42_52(z_measured[reference_index] - z_measured[tram_index]) : "---"); ACTION_ITEM(MSG_UBL_BC_INSERT2, []{ if (probe_single_point()) ui.refresh(); }); - ACTION_ITEM(MSG_BUTTON_DONE, []{ ui.goto_previous_screen(); }); + ACTION_ITEM(MSG_BUTTON_DONE, ui.goto_previous_screen); END_MENU(); } From be412e3e2b07664f95eec21dc8a63a66f25d26a6 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 30 Oct 2021 01:39:33 -0500 Subject: [PATCH 078/125] =?UTF-8?q?=F0=9F=8E=A8=20Adjust=20Ender-3=20V2=20?= =?UTF-8?q?DWIN=20options?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration.h | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 0a51019b67..8ab3929c41 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -2770,23 +2770,11 @@ // // Ender-3 v2 OEM display. A DWIN display with Rotary Encoder. // -//#define DWIN_CREALITY_LCD - -// -// Ender-3 v2 OEM display, enhanced. -// -//#define DWIN_CREALITY_LCD_ENHANCED - -// -// Ender-3 v2 OEM display with enhancements by Jacob Myers -// -//#define DWIN_CREALITY_LCD_JYERSUI - -// -// MarlinUI for Creality's DWIN display (and others) -// -//#define DWIN_MARLINUI_PORTRAIT -//#define DWIN_MARLINUI_LANDSCAPE +//#define DWIN_CREALITY_LCD // Creality UI +//#define DWIN_CREALITY_LCD_ENHANCED // Enhanced UI +//#define DWIN_CREALITY_LCD_JYERSUI // Jyers UI by Jacob Myers +//#define DWIN_MARLINUI_PORTRAIT // MarlinUI (portrait orientation) +//#define DWIN_MARLINUI_LANDSCAPE // MarlinUI (landscape orientation) // // Touch Screen Settings From 4dd1f0928688c68c6c334e1fb1a8e13be2dc351a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 30 Oct 2021 04:16:37 -0500 Subject: [PATCH 079/125] =?UTF-8?q?=F0=9F=92=9A=20Update=20Ender-3=20V2=20?= =?UTF-8?q?config=20path?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MarlinFirmware/Configurations#600 --- buildroot/tests/STM32F103RET6_creality | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/buildroot/tests/STM32F103RET6_creality b/buildroot/tests/STM32F103RET6_creality index d530f7b851..ca7573cf16 100755 --- a/buildroot/tests/STM32F103RET6_creality +++ b/buildroot/tests/STM32F103RET6_creality @@ -9,21 +9,21 @@ set -e # # Build with configs included in the PR # -use_example_configs "Creality/Ender-3 V2/CrealityUI" +use_example_configs "Creality/Ender-3 V2/CrealityV422/CrealityUI" opt_enable MARLIN_DEV_MODE BUFFER_MONITORING BLTOUCH AUTO_BED_LEVELING_BILINEAR Z_SAFE_HOMING exec_test $1 $2 "Ender 3 v2 with CrealityUI" "$3" -use_example_configs "Creality/Ender-3 V2/CrealityUI" +use_example_configs "Creality/Ender-3 V2/CrealityV422/CrealityUI" opt_disable DWIN_CREALITY_LCD opt_enable DWIN_CREALITY_LCD_ENHANCED BLTOUCH AUTO_BED_LEVELING_UBL Z_SAFE_HOMING exec_test $1 $2 "Ender 3 v2 with Enhanced UI" "$3" -use_example_configs "Creality/Ender-3 V2/CrealityUI" +use_example_configs "Creality/Ender-3 V2/CrealityV422/CrealityUI" opt_disable DWIN_CREALITY_LCD opt_enable DWIN_CREALITY_LCD_JYERSUI AUTO_BED_LEVELING_BILINEAR PROBE_MANUALLY exec_test $1 $2 "Ender 3 v2 with JyersUI" "$3" -use_example_configs "Creality/Ender-3 V2/MarlinUI" +use_example_configs "Creality/Ender-3 V2/CrealityV422/MarlinUI" opt_add SDCARD_EEPROM_EMULATION AUTO_BED_LEVELING_BILINEAR Z_SAFE_HOMING exec_test $1 $2 "Ender 3 v2 with MarlinUI" "$3" From b88612f9761601e985f8ec8db5d3b91214c39555 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sun, 31 Oct 2021 01:03:08 +0000 Subject: [PATCH 080/125] [cron] Bump distribution date (2021-10-31) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index d1bff6ba10..a638379ef4 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-10-30" +//#define STRING_DISTRIBUTION_DATE "2021-10-31" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 9e87e765d5..a086f1797e 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-10-30" + #define STRING_DISTRIBUTION_DATE "2021-10-31" #endif /** From ba0b772d84bad99604b0131e2142366544370646 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 30 Oct 2021 22:43:02 -0500 Subject: [PATCH 081/125] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20linker=20error=20(?= =?UTF-8?q?transfer=5Fport=5Findex)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/sd/cardreader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index 1ab6dcc7c6..513d682de6 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -72,8 +72,8 @@ char CardReader::filename[FILENAME_LENGTH], CardReader::longFilename[LONG_FILENA IF_DISABLED(NO_SD_AUTOSTART, uint8_t CardReader::autofile_index); // = 0 -#if BOTH(HAS_MULTI_SERIAL, BINARY_FILE_TRANSFER) - serial_index_t CardReader::transfer_port_index; +#if ENABLED(BINARY_FILE_TRANSFER) + serial_index_t IF_DISABLED(HAS_MULTI_SERIAL, constexpr) CardReader::transfer_port_index; #endif // private: From efe2e79ac8e6d35e80a7d29bfd266685a82dc546 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 30 Oct 2021 23:43:19 -0500 Subject: [PATCH 082/125] =?UTF-8?q?=F0=9F=94=A8=20Help=20for=20GDB=20remot?= =?UTF-8?q?e=20debugging?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 6 +-- Marlin/src/pins/pins.h | 4 +- .../share/PlatformIO/debugging/launch.json | 48 +++++++++++++++++++ ini/native.ini | 18 +------ ini/stm32f1-maple.ini | 2 +- ini/stm32f4.ini | 7 +++ 6 files changed, 60 insertions(+), 25 deletions(-) create mode 100644 buildroot/share/PlatformIO/debugging/launch.json diff --git a/.gitignore b/.gitignore index bc603ba38b..a83bfa4265 100755 --- a/.gitignore +++ b/.gitignore @@ -27,7 +27,7 @@ bdf2u8g # OS # applet/ -*.DS_Store +.DS_Store # # Misc @@ -167,7 +167,3 @@ __pycache__ # IOLogger logs *_log.csv - -# Simulation / Native -eeprom.dat -imgui.ini diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 49d06590e9..40bbe6b41b 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -620,9 +620,9 @@ #elif MB(BTT_E3_RRF) #include "stm32f4/pins_BTT_E3_RRF.h" // STM32F4 env:BIGTREE_E3_RRF #elif MB(BTT_SKR_V2_0_REV_A) - #include "stm32f4/pins_BTT_SKR_V2_0_REV_A.h" // STM32F4 env:BIGTREE_SKR_2 env:BIGTREE_SKR_2_USB + #include "stm32f4/pins_BTT_SKR_V2_0_REV_A.h" // STM32F4 env:BIGTREE_SKR_2 env:BIGTREE_SKR_2_USB env:BIGTREE_SKR_2_USB_debug #elif MB(BTT_SKR_V2_0_REV_B) - #include "stm32f4/pins_BTT_SKR_V2_0_REV_B.h" // STM32F4 env:BIGTREE_SKR_2 env:BIGTREE_SKR_2_USB + #include "stm32f4/pins_BTT_SKR_V2_0_REV_B.h" // STM32F4 env:BIGTREE_SKR_2 env:BIGTREE_SKR_2_USB env:BIGTREE_SKR_2_USB_debug #elif MB(BTT_OCTOPUS_V1_0) #include "stm32f4/pins_BTT_OCTOPUS_V1_0.h" // STM32F4 env:BIGTREE_OCTOPUS_V1 env:BIGTREE_OCTOPUS_V1_USB #elif MB(BTT_OCTOPUS_V1_1) diff --git a/buildroot/share/PlatformIO/debugging/launch.json b/buildroot/share/PlatformIO/debugging/launch.json new file mode 100644 index 0000000000..335c4c663e --- /dev/null +++ b/buildroot/share/PlatformIO/debugging/launch.json @@ -0,0 +1,48 @@ +/** + * Remote debugging on STM32 using the "Cortex Debug" extension. + * + * Copy one or more of the configurations items below into .vscode/launch.json + * to add those debug options to the PlatformIO IDE "Run & Debug" panel. + * + * Examples for BigTreeTech SKR 2 (USB) and Native Simulator. Modify for your own build. + * + * NOTE: The PlatformIO extension will remove items when regenerating launch.json. + */ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Debug STM32 (launch)", + "request": "launch", + "type": "cortex-debug", + "servertype": "openocd", + "cwd": "${workspaceRoot}", + "showDevDebugOutput": false, + "configFiles": [ "interface/stlink.cfg", "target/stm32f4x.cfg" ], + "device": "STM32F407", + "executable": ".pio/build/BIGTREE_SKR_2_USB_debug/firmware.elf", + }, + { + "name": "Debug STM32 (attach)", + "request": "attach", + "type": "cortex-debug", + "servertype": "openocd", + "cwd": "${workspaceRoot}", + "showDevDebugOutput": false, + "configFiles": [ "interface/stlink.cfg", "target/stm32f4x.cfg" ], + "device": "STM32F407", + "executable": ".pio/build/BIGTREE_SKR_2_USB_debug/firmware.elf", + }, + { + "name": "Debug Sim", + "request": "launch", + "type": "cppdbg", + "cwd": "${workspaceRoot}", + //"program": ".pio/build/simulator_linux_debug/MarlinSimulator", + //"program": ".pio/build/simulator_windows/MarlinSimulator", + "program": ".pio/build/simulator_macos_debug/MarlinSimulator", + "miDebuggerPath": "/opt/local/bin/ggdb", + "MIMode": "gdb" + } + ] +} diff --git a/ini/native.ini b/ini/native.ini index 981e93f996..fe5fe3a5d0 100644 --- a/ini/native.ini +++ b/ini/native.ini @@ -29,10 +29,7 @@ src_filter = ${common.default_src_filter} + # # Tested with Linux (Mint 20) : gcc [9.3.0, 10.2.0]: libsdl2-dev[2.0.10], libsdl2-net-dev[2.0.1], libglm-dev[0.9.9.7, 0.9.9.8] # -# Debugging with gdb in vscode is as easy as adding the launch task as usual, but platformio -# will randomly remove your task when it recreates its tasks from a template. Add your gdb -# launch task to '~/.platformio/penv/lib/python{PYTHON_VERSION}/site-packages/platformio/ide/tpls/vscode/.vscode' -# to avoid this until platformio updates. +# For VSCode debugging see buildroot/share/PlatformIO/debugging/launch.json # [simulator_common] platform = native @@ -43,7 +40,6 @@ release_flags = -g0 -O3 -flto debug_build_flags = -fstack-protector-strong -g -g3 -ggdb lib_compat_mode = off src_filter = ${common.default_src_filter} + - lib_deps = ${common.lib_deps} MarlinSimUI=https://github.com/p3p/MarlinSimUI/archive/master.zip Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/marlin_sim_native.zip @@ -51,7 +47,6 @@ lib_deps = ${common.lib_deps} extra_scripts = ${common.extra_scripts} pre:buildroot/share/PlatformIO/scripts/simulator.py - [simulator_linux] extends = simulator_common build_flags = ${simulator_common.build_flags} -ldl -lpthread -lSDL2 -lSDL2_net -lGL @@ -84,17 +79,6 @@ build_flags = ${simulator_linux.build_flags} ${simulator_linux.release_flags} # Use 'sudo port install mesa' to get a if no Xcode is installed. # If Xcode is installed be sure to run `xcode-select --install` first. # -# For VSCode debugging paste the block below near the top of launch.json. -# NOTE: The PlatformIO VSCode extension will remove it when regenerating launch.json. -# -# { "name": "Debug Sim", -# "type": "cppdbg", -# "request": "launch", -# "program": "${workspaceFolder}/.pio/build/simulator_macos/MarlinSimulator", -# "miDebuggerPath": "/opt/local/bin/ggdb", -# "MIMode": "gdb", -# "cwd": "${workspaceFolder}/.pio/build/simulator_macos" }, -# [simulator_macos] build_unflags = -lGL custom_verbose = 0 diff --git a/ini/stm32f1-maple.ini b/ini/stm32f1-maple.ini index f86bf98ebd..e0b4ad711a 100644 --- a/ini/stm32f1-maple.ini +++ b/ini/stm32f1-maple.ini @@ -410,7 +410,7 @@ 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 + -DMCU_STM32F103VE -DARDUINO_GENERIC_STM32F103V -DARDUINO_ARCH_STM32F1 -DDEBUG_LEVEL=DEBUG_NONE -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DSS_TIMER=4 board_build.variant = MARLIN_F103Vx diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 3d7f4d2d02..850807585f 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -220,6 +220,7 @@ build_flags = ${stm_flash_drive.build_flags} -DUSBD_IRQ_PRIO=5 -DUSBD_IRQ_SUBPRIO=6 -DHSE_VALUE=8000000U -DHAL_SD_MODULE_ENABLED -DPIN_SERIAL3_RX=PD_9 -DPIN_SERIAL3_TX=PD_8 +upload_protocol = stlink # # BigTreeTech SKR V2.0 (STM32F407VGT6 ARM Cortex-M4) with USB Media Share Support @@ -230,6 +231,12 @@ extends = env:BIGTREE_SKR_2 build_flags = ${env:BIGTREE_SKR_2.build_flags} -DUSBD_USE_CDC_MSC build_unflags = ${env:BIGTREE_SKR_2.build_unflags} -DUSBD_USE_CDC +[env:BIGTREE_SKR_2_USB_debug] +platform = ${common_stm32.platform} +extends = env:BIGTREE_SKR_2_USB +build_flags = ${env:BIGTREE_SKR_2_USB.build_flags} -O0 +build_unflags = ${env:BIGTREE_SKR_2_USB.build_unflags} -Os -NDEBUG + # # BigTreeTech Octopus V1.0/1.1 / Octopus Pro V1.0 (STM32F446ZET6 ARM Cortex-M4) # From 9176dcea6ee1e449aee8f4972739268d4e97f034 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 8 Jul 2021 01:17:16 -0500 Subject: [PATCH 083/125] =?UTF-8?q?=F0=9F=93=9D=20Tweak=20EXP=20comments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h b/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h index d3b59e03b8..50330932cf 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h @@ -294,14 +294,14 @@ #endif /** - * ----- ----- - * NC | 1 2 | GND 5V | 1 2 | GND - * RESET | 3 4 | PC4 (SD_DETECT) (LCD_D7) PE13 | 3 4 | PE12 (LCD_D6) - * (MOSI) PA7 | 5 6 PB2 (BTN_EN2) (LCD_D5) PE11 | 5 6 PE10 (LCD_D4) - * (SD_SS) PA4 | 7 8 | PE7 (BTN_EN1) (LCD_RS) PE9 | 7 8 | PB1 (LCD_EN) - * (SCK) PA5 | 9 10| PA6 (MISO) (BTN_ENC) PB0 | 9 10| PC5 (BEEPER) - * ----- ----- - * EXP2 EXP1 + * ------ ------ + * NC | 1 2 | GND 5V | 1 2 | GND + * RESET | 3 4 | PC4 (SD_DETECT) (LCD_D7) PE13 | 3 4 | PE12 (LCD_D6) + * (MOSI) PA7 | 5 6 PB2 (BTN_EN2) (LCD_D5) PE11 | 5 6 PE10 (LCD_D4) + * (SD_SS) PA4 | 7 8 | PE7 (BTN_EN1) (LCD_RS) PE9 | 7 8 | PB1 (LCD_EN) + * (SCK) PA5 | 9 10 | PA6 (MISO) (BTN_ENC) PB0 | 9 10 | PC5 (BEEPER) + * ------ ------ + * EXP2 EXP1 */ #define EXP1_03_PIN PE13 #define EXP1_04_PIN PE12 From 5e9b5bb4482bdc4e600c2d0302faca29d6487b42 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Mon, 1 Nov 2021 01:03:28 +0000 Subject: [PATCH 084/125] [cron] Bump distribution date (2021-11-01) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index a638379ef4..1eb431186e 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-10-31" +//#define STRING_DISTRIBUTION_DATE "2021-11-01" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index a086f1797e..aef8d8b60b 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-10-31" + #define STRING_DISTRIBUTION_DATE "2021-11-01" #endif /** From 296a6137cd06ce06f062767ab1b59f99ee95a094 Mon Sep 17 00:00:00 2001 From: tombrazier <68918209+tombrazier@users.noreply.github.com> Date: Mon, 1 Nov 2021 23:03:50 +0000 Subject: [PATCH 085/125] =?UTF-8?q?=F0=9F=9A=B8=20More=20flexible=20Probe?= =?UTF-8?q?=20Temperature=20Compensation=20(#23033)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 100 +++--- Marlin/src/feature/probe_temp_comp.cpp | 86 ++--- Marlin/src/feature/probe_temp_comp.h | 116 ++---- Marlin/src/gcode/bedlevel/abl/G29.cpp | 10 +- Marlin/src/gcode/calibrate/G76_M192_M871.cpp | 358 ------------------- Marlin/src/gcode/calibrate/G76_M871.cpp | 337 +++++++++++++++++ Marlin/src/gcode/gcode.cpp | 9 +- Marlin/src/gcode/gcode.h | 57 ++- Marlin/src/gcode/temp/M192.cpp | 56 +++ Marlin/src/inc/Conditionals_adv.h | 14 + Marlin/src/inc/SanityCheck.h | 78 ++-- Marlin/src/module/settings.cpp | 54 ++- buildroot/tests/rambo | 8 +- ini/features.ini | 9 +- platformio.ini | 3 +- 15 files changed, 672 insertions(+), 623 deletions(-) delete mode 100644 Marlin/src/gcode/calibrate/G76_M192_M871.cpp create mode 100644 Marlin/src/gcode/calibrate/G76_M871.cpp create mode 100644 Marlin/src/gcode/temp/M192.cpp diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 4efab8193c..aa6fffd44e 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1988,65 +1988,69 @@ /** * Thermal Probe Compensation - * Probe measurements are adjusted to compensate for temperature distortion. - * Use G76 to calibrate this feature. Use M871 to set values manually. - * For a more detailed explanation of the process see G76_M871.cpp. + * + * Adjust probe measurements to compensate for distortion associated with the temperature + * of the probe, bed, and/or hotend. + * Use G76 to automatically calibrate this feature for probe and bed temperatures. + * (Extruder temperature/offset values must be calibrated manually.) + * Use M871 to set temperature/offset values manually. + * For more details see https://marlinfw.org/docs/features/probe_temp_compensation.html */ -#if HAS_BED_PROBE && TEMP_SENSOR_PROBE && TEMP_SENSOR_BED - // Enable thermal first layer compensation using bed and probe temperatures - #define PROBE_TEMP_COMPENSATION +//#define PTC_PROBE // Compensate based on probe temperature +//#define PTC_BED // Compensate based on bed temperature +//#define PTC_HOTEND // Compensate based on hotend temperature - // Add additional compensation depending on hotend temperature - // Note: this values cannot be calibrated and have to be set manually - #if ENABLED(PROBE_TEMP_COMPENSATION) +#if ANY(PTC_PROBE, PTC_BED, PTC_HOTEND) + /** + * If the probe is outside the defined range, use linear extrapolation with the closest + * point and the point with index PTC_LINEAR_EXTRAPOLATION. e.g., If set to 4 it will use the + * linear extrapolation between data[0] and data[4] for values below PTC_PROBE_START. + */ + //#define PTC_LINEAR_EXTRAPOLATION 4 + + #if ENABLED(PTC_PROBE) + // Probe temperature calibration generates a table of values starting at PTC_PROBE_START + // (e.g., 30), in steps of PTC_PROBE_RES (e.g., 5) with PTC_PROBE_COUNT (e.g., 10) samples. + #define PTC_PROBE_START 30 // (°C) + #define PTC_PROBE_RES 5 // (°C) + #define PTC_PROBE_COUNT 10 + #define PTC_PROBE_ZOFFS { 0 } // (µm) Z adjustments per sample + #endif + + #if ENABLED(PTC_BED) + // Bed temperature calibration builds a similar table. + #define PTC_BED_START 60 // (°C) + #define PTC_BED_RES 5 // (°C) + #define PTC_BED_COUNT 10 + #define PTC_BED_ZOFFS { 0 } // (µm) Z adjustments per sample + #endif + + #if ENABLED(PTC_HOTEND) + // Note: There is no automatic calibration for the hotend. Use M871. + #define PTC_HOTEND_START 180 // (°C) + #define PTC_HOTEND_RES 5 // (°C) + #define PTC_HOTEND_COUNT 20 + #define PTC_HOTEND_ZOFFS { 0 } // (µm) Z adjustments per sample + #endif + + // G76 options + #if BOTH(PTC_PROBE, PTC_BED) // Park position to wait for probe cooldown #define PTC_PARK_POS { 0, 0, 100 } // Probe position to probe and wait for probe to reach target temperature + //#define PTC_PROBE_POS { 12.0f, 7.3f } // Example: MK52 magnetic heatbed #define PTC_PROBE_POS { 90, 100 } - // Enable additional compensation using hotend temperature - // Note: this values cannot be calibrated automatically but have to be set manually via M871. - //#define USE_TEMP_EXT_COMPENSATION - - // Probe temperature calibration generates a table of values starting at PTC_SAMPLE_START - // (e.g., 30), in steps of PTC_SAMPLE_RES (e.g., 5) with PTC_SAMPLE_COUNT (e.g., 10) samples. - - //#define PTC_SAMPLE_START 30 // (°C) - //#define PTC_SAMPLE_RES 5 // (°C) - //#define PTC_SAMPLE_COUNT 10 - - // Bed temperature calibration builds a similar table. - - //#define BTC_SAMPLE_START 60 // (°C) - //#define BTC_SAMPLE_RES 5 // (°C) - //#define BTC_SAMPLE_COUNT 10 - - #if ENABLED(USE_TEMP_EXT_COMPENSATION) - //#define ETC_SAMPLE_START 180 // (°C) - //#define ETC_SAMPLE_RES 5 // (°C) - //#define ETC_SAMPLE_COUNT 20 - #endif - - // The temperature the probe should be at while taking measurements during bed temperature - // calibration. - //#define BTC_PROBE_TEMP 30 // (°C) + // The temperature the probe should be at while taking measurements during + // bed temperature calibration. + #define PTC_PROBE_TEMP 30 // (°C) // Height above Z=0.0 to raise the nozzle. Lowering this can help the probe to heat faster. - // Note: the Z=0.0 offset is determined by the probe offset which can be set using M851. - //#define PTC_PROBE_HEATING_OFFSET 0.5 - - // Height to raise the Z-probe between heating and taking the next measurement. Some probes - // may fail to untrigger if they have been triggered for a long time, which can be solved by - // increasing the height the probe is raised to. - //#define PTC_PROBE_RAISE 15 - - // If the probe is outside of the defined range, use linear extrapolation using the closest - // point and the PTC_LINEAR_EXTRAPOLATION'th next point. E.g. if set to 4 it will use data[0] - // and data[4] to perform linear extrapolation for values below PTC_SAMPLE_START. - //#define PTC_LINEAR_EXTRAPOLATION 4 + // Note: The Z=0.0 offset is determined by the probe Z offset (e.g., as set with M851 Z). + #define PTC_PROBE_HEATING_OFFSET 0.5 #endif -#endif +#endif // PTC_PROBE || PTC_BED || PTC_HOTEND // @section extras diff --git a/Marlin/src/feature/probe_temp_comp.cpp b/Marlin/src/feature/probe_temp_comp.cpp index 5f3bc985e6..9a975d6763 100644 --- a/Marlin/src/feature/probe_temp_comp.cpp +++ b/Marlin/src/feature/probe_temp_comp.cpp @@ -22,39 +22,53 @@ #include "../inc/MarlinConfigPre.h" -#if ENABLED(PROBE_TEMP_COMPENSATION) +#if HAS_PTC //#define DEBUG_PTC // Print extra debug output with 'M871' #include "probe_temp_comp.h" #include -ProbeTempComp temp_comp; +ProbeTempComp ptc; -int16_t ProbeTempComp::z_offsets_probe[cali_info_init[TSI_PROBE].measurements], // = {0} - ProbeTempComp::z_offsets_bed[cali_info_init[TSI_BED].measurements]; // = {0} +#if ENABLED(PTC_PROBE) + constexpr int16_t z_offsets_probe_default[PTC_PROBE_COUNT] = PTC_PROBE_ZOFFS; + int16_t ProbeTempComp::z_offsets_probe[PTC_PROBE_COUNT] = PTC_PROBE_ZOFFS; +#endif -#if ENABLED(USE_TEMP_EXT_COMPENSATION) - int16_t ProbeTempComp::z_offsets_ext[cali_info_init[TSI_EXT].measurements]; // = {0} +#if ENABLED(PTC_BED) + constexpr int16_t z_offsets_bed_default[PTC_BED_COUNT] = PTC_BED_ZOFFS; + int16_t ProbeTempComp::z_offsets_bed[PTC_BED_COUNT] = PTC_BED_ZOFFS; +#endif + +#if ENABLED(PTC_HOTEND) + constexpr int16_t z_offsets_hotend_default[PTC_HOTEND_COUNT] = PTC_HOTEND_ZOFFS; + int16_t ProbeTempComp::z_offsets_hotend[PTC_HOTEND_COUNT] = PTC_HOTEND_ZOFFS; #endif int16_t *ProbeTempComp::sensor_z_offsets[TSI_COUNT] = { - ProbeTempComp::z_offsets_probe, ProbeTempComp::z_offsets_bed - OPTARG(USE_TEMP_EXT_COMPENSATION, ProbeTempComp::z_offsets_ext) + #if ENABLED(PTC_PROBE) + ProbeTempComp::z_offsets_probe, + #endif + #if ENABLED(PTC_BED) + ProbeTempComp::z_offsets_bed, + #endif + #if ENABLED(PTC_HOTEND) + ProbeTempComp::z_offsets_hotend, + #endif }; -const temp_calib_t ProbeTempComp::cali_info[TSI_COUNT] = { - cali_info_init[TSI_PROBE], cali_info_init[TSI_BED] - OPTARG(USE_TEMP_EXT_COMPENSATION, cali_info_init[TSI_EXT]) -}; - -constexpr xyz_pos_t ProbeTempComp::park_point; -constexpr xy_pos_t ProbeTempComp::measure_point; -constexpr celsius_t ProbeTempComp::probe_calib_bed_temp; +constexpr temp_calib_t ProbeTempComp::cali_info[TSI_COUNT]; uint8_t ProbeTempComp::calib_idx; // = 0 float ProbeTempComp::init_measurement; // = 0.0 +void ProbeTempComp::reset() { + TERN_(PTC_PROBE, LOOP_L_N(i, PTC_PROBE_COUNT) z_offsets_probe[i] = z_offsets_probe_default[i]); + TERN_(PTC_BED, LOOP_L_N(i, PTC_BED_COUNT) z_offsets_bed[i] = z_offsets_bed_default[i]); + TERN_(PTC_HOTEND, LOOP_L_N(i, PTC_HOTEND_COUNT) z_offsets_hotend[i] = z_offsets_hotend_default[i]); +} + void ProbeTempComp::clear_offsets(const TempSensorID tsi) { LOOP_L_N(i, cali_info[tsi].measurements) sensor_z_offsets[tsi][i] = 0; @@ -71,10 +85,9 @@ void ProbeTempComp::print_offsets() { LOOP_L_N(s, TSI_COUNT) { celsius_t temp = cali_info[s].start_temp; for (int16_t i = -1; i < cali_info[s].measurements; ++i) { - SERIAL_ECHOF(s == TSI_BED ? F("Bed") : - #if ENABLED(USE_TEMP_EXT_COMPENSATION) - s == TSI_EXT ? F("Extruder") : - #endif + SERIAL_ECHOF( + TERN_(PTC_BED, s == TSI_BED ? F("Bed") :) + TERN_(PTC_HOTEND, s == TSI_EXT ? F("Extruder") :) F("Probe") ); SERIAL_ECHOLNPGM( @@ -100,21 +113,13 @@ void ProbeTempComp::prepare_new_calibration(const_float_t init_meas_z) { } void ProbeTempComp::push_back_new_measurement(const TempSensorID tsi, const_float_t meas_z) { - switch (tsi) { - case TSI_PROBE: - case TSI_BED: - //case TSI_EXT: - if (calib_idx >= cali_info[tsi].measurements) return; - sensor_z_offsets[tsi][calib_idx++] = static_cast(meas_z * 1000.0f - init_measurement * 1000.0f); - default: break; - } + if (calib_idx >= cali_info[tsi].measurements) return; + sensor_z_offsets[tsi][calib_idx++] = static_cast((meas_z - init_measurement) * 1000.0f); } bool ProbeTempComp::finish_calibration(const TempSensorID tsi) { - if (tsi != TSI_PROBE && tsi != TSI_BED) return false; - - if (calib_idx < 3) { - SERIAL_ECHOLNPGM("!Insufficient measurements (min. 3)."); + if (!calib_idx) { + SERIAL_ECHOLNPGM("!No measurements."); clear_offsets(tsi); return false; } @@ -130,16 +135,15 @@ bool ProbeTempComp::finish_calibration(const TempSensorID tsi) { SERIAL_ECHOLNPGM("Got ", calib_idx, " measurements. "); if (linear_regression(tsi, k, d)) { SERIAL_ECHOPGM("Applying linear extrapolation"); - calib_idx--; for (; calib_idx < measurements; ++calib_idx) { - const celsius_float_t temp = start_temp + float(calib_idx) * res_temp; + const celsius_float_t temp = start_temp + float(calib_idx + 1) * res_temp; data[calib_idx] = static_cast(k * temp + d); } } else { // Simply use the last measured value for higher temperatures SERIAL_ECHOPGM("Failed to extrapolate"); - const int16_t last_val = data[calib_idx]; + const int16_t last_val = data[calib_idx-1]; for (; calib_idx < measurements; ++calib_idx) data[calib_idx] = last_val; } @@ -157,7 +161,7 @@ bool ProbeTempComp::finish_calibration(const TempSensorID tsi) { // Restrict the max. offset difference between two probings if (calib_idx > 0 && ABS(data[calib_idx - 1] - data[calib_idx]) > 800) { SERIAL_ECHOLNPGM("!Invalid Z-offset between two probings detected (0-0.8)."); - clear_offsets(TSI_PROBE); + clear_offsets(tsi); return false; } } @@ -168,8 +172,8 @@ bool ProbeTempComp::finish_calibration(const TempSensorID tsi) { void ProbeTempComp::compensate_measurement(const TempSensorID tsi, const celsius_t temp, float &meas_z) { const uint8_t measurements = cali_info[tsi].measurements; const celsius_t start_temp = cali_info[tsi].start_temp, - end_temp = cali_info[tsi].end_temp, - res_temp = cali_info[tsi].temp_resolution; + res_temp = cali_info[tsi].temp_resolution, + end_temp = start_temp + measurements * res_temp; const int16_t * const data = sensor_z_offsets[tsi]; // Given a data index, return { celsius, zoffset } in the form { x, y } @@ -208,9 +212,7 @@ void ProbeTempComp::compensate_measurement(const TempSensorID tsi, const celsius } bool ProbeTempComp::linear_regression(const TempSensorID tsi, float &k, float &d) { - if (tsi != TSI_PROBE && tsi != TSI_BED) return false; - - if (!WITHIN(calib_idx, 2, cali_info[tsi].measurements)) return false; + if (!WITHIN(calib_idx, 1, cali_info[tsi].measurements)) return false; const celsius_t start_temp = cali_info[tsi].start_temp, res_temp = cali_info[tsi].temp_resolution; @@ -243,4 +245,4 @@ bool ProbeTempComp::linear_regression(const TempSensorID tsi, float &k, float &d return true; } -#endif // PROBE_TEMP_COMPENSATION +#endif // HAS_PTC diff --git a/Marlin/src/feature/probe_temp_comp.h b/Marlin/src/feature/probe_temp_comp.h index e5d459b8e8..4579f2187c 100644 --- a/Marlin/src/feature/probe_temp_comp.h +++ b/Marlin/src/feature/probe_temp_comp.h @@ -24,9 +24,13 @@ #include "../inc/MarlinConfig.h" enum TempSensorID : uint8_t { - TSI_PROBE, - TSI_BED, - #if ENABLED(USE_TEMP_EXT_COMPENSATION) + #if ENABLED(PTC_PROBE) + TSI_PROBE, + #endif + #if ENABLED(PTC_BED) + TSI_BED, + #endif + #if ENABLED(PTC_HOTEND) TSI_EXT, #endif TSI_COUNT @@ -35,8 +39,7 @@ enum TempSensorID : uint8_t { typedef struct { 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; + start_temp; // Base measurement; z-offset == 0 } temp_calib_t; /** @@ -45,93 +48,40 @@ typedef struct { * measurement errors/shifts due to changed temperature. */ -// Probe temperature calibration constants -#ifndef PTC_SAMPLE_COUNT - #define PTC_SAMPLE_COUNT 10 -#endif -#ifndef PTC_SAMPLE_RES - #define PTC_SAMPLE_RES 5 -#endif -#ifndef PTC_SAMPLE_START - #define PTC_SAMPLE_START 30 -#endif -#define PTC_SAMPLE_END (PTC_SAMPLE_START + (PTC_SAMPLE_COUNT) * PTC_SAMPLE_RES) - -// Bed temperature calibration constants -#ifndef BTC_PROBE_TEMP - #define BTC_PROBE_TEMP 30 -#endif -#ifndef BTC_SAMPLE_COUNT - #define BTC_SAMPLE_COUNT 10 -#endif -#ifndef BTC_SAMPLE_RES - #define BTC_SAMPLE_RES 5 -#endif -#ifndef BTC_SAMPLE_START - #define BTC_SAMPLE_START 60 -#endif -#define BTC_SAMPLE_END (BTC_SAMPLE_START + (BTC_SAMPLE_COUNT) * BTC_SAMPLE_RES) - -// Extruder temperature calibration constants -#if ENABLED(USE_TEMP_EXT_COMPENSATION) - #ifndef ETC_SAMPLE_COUNT - #define ETC_SAMPLE_COUNT 20 - #endif - #ifndef ETC_SAMPLE_RES - #define ETC_SAMPLE_RES 5 - #endif - #ifndef ETC_SAMPLE_START - #define ETC_SAMPLE_START 180 - #endif - #define ETC_SAMPLE_END (ETC_SAMPLE_START + (ETC_SAMPLE_COUNT) * ETC_SAMPLE_RES) -#endif - -#ifndef PTC_PROBE_HEATING_OFFSET - #define PTC_PROBE_HEATING_OFFSET 0.5f -#endif - -#ifndef PTC_PROBE_RAISE - #define PTC_PROBE_RAISE 10 -#endif - -static constexpr temp_calib_t cali_info_init[TSI_COUNT] = { - { PTC_SAMPLE_COUNT, PTC_SAMPLE_RES, PTC_SAMPLE_START, PTC_SAMPLE_END }, // Probe - { BTC_SAMPLE_COUNT, BTC_SAMPLE_RES, BTC_SAMPLE_START, BTC_SAMPLE_END }, // Bed - #if ENABLED(USE_TEMP_EXT_COMPENSATION) - { ETC_SAMPLE_COUNT, ETC_SAMPLE_RES, ETC_SAMPLE_START, ETC_SAMPLE_END }, // Extruder - #endif -}; - class ProbeTempComp { public: - static const temp_calib_t cali_info[TSI_COUNT]; + static constexpr temp_calib_t cali_info[TSI_COUNT] = { + #if ENABLED(PTC_PROBE) + { PTC_PROBE_COUNT, PTC_PROBE_RES, PTC_PROBE_START }, // Probe + #endif + #if ENABLED(PTC_BED) + { PTC_BED_COUNT, PTC_BED_RES, PTC_BED_START }, // Bed + #endif + #if ENABLED(PTC_HOTEND) + { PTC_HOTEND_COUNT, PTC_HOTEND_RES, PTC_HOTEND_START }, // Extruder + #endif + }; - // Where to park nozzle to wait for probe cooldown - static constexpr xyz_pos_t park_point = PTC_PARK_POS; - - // XY coordinates of nozzle for probing the bed - static constexpr xy_pos_t measure_point = PTC_PROBE_POS; // Coordinates to probe - //measure_point = { 12.0f, 7.3f }; // Coordinates for the MK52 magnetic heatbed - - static constexpr celsius_t probe_calib_bed_temp = BED_MAX_TARGET, // Bed temperature while calibrating probe - bed_calib_probe_temp = BTC_PROBE_TEMP; // Probe temperature while calibrating bed - - static int16_t *sensor_z_offsets[TSI_COUNT], - z_offsets_probe[cali_info_init[TSI_PROBE].measurements], // (µm) - z_offsets_bed[cali_info_init[TSI_BED].measurements]; // (µm) - - #if ENABLED(USE_TEMP_EXT_COMPENSATION) - static int16_t z_offsets_ext[cali_info_init[TSI_EXT].measurements]; // (µm) + static int16_t *sensor_z_offsets[TSI_COUNT]; + #if ENABLED(PTC_PROBE) + static int16_t z_offsets_probe[PTC_PROBE_COUNT]; // (µm) + #endif + #if ENABLED(PTC_BED) + static int16_t z_offsets_bed[PTC_BED_COUNT]; // (µm) + #endif + #if ENABLED(PTC_HOTEND) + static int16_t z_offsets_hotend[PTC_HOTEND_COUNT]; // (µm) #endif static inline void reset_index() { calib_idx = 0; }; static inline uint8_t get_index() { return calib_idx; } + static void reset(); static void clear_offsets(const TempSensorID tsi); static inline void clear_all_offsets() { - clear_offsets(TSI_BED); - clear_offsets(TSI_PROBE); - TERN_(USE_TEMP_EXT_COMPENSATION, clear_offsets(TSI_EXT)); + TERN_(PTC_PROBE, clear_offsets(TSI_PROBE)); + TERN_(PTC_BED, clear_offsets(TSI_BED)); + TERN_(PTC_HOTEND, clear_offsets(TSI_EXT)); } static bool set_offset(const TempSensorID tsi, const uint8_t idx, const int16_t offset); static void print_offsets(); @@ -156,4 +106,4 @@ class ProbeTempComp { static bool linear_regression(const TempSensorID tsi, float &k, float &d); }; -extern ProbeTempComp temp_comp; +extern ProbeTempComp ptc; diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index 5d94797f16..14da38c8fe 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -36,7 +36,7 @@ #include "../../../module/probe.h" #include "../../queue.h" -#if ENABLED(PROBE_TEMP_COMPENSATION) +#if HAS_PTC #include "../../../feature/probe_temp_comp.h" #include "../../../module/temperature.h" #endif @@ -645,11 +645,9 @@ G29_TYPE GcodeSuite::G29() { break; // Breaks out of both loops } - #if ENABLED(PROBE_TEMP_COMPENSATION) - temp_comp.compensate_measurement(TSI_BED, thermalManager.degBed(), abl.measured_z); - temp_comp.compensate_measurement(TSI_PROBE, thermalManager.degProbe(), abl.measured_z); - TERN_(USE_TEMP_EXT_COMPENSATION, temp_comp.compensate_measurement(TSI_EXT, thermalManager.degHotend(0), abl.measured_z)); - #endif + TERN_(PTC_BED, ptc.compensate_measurement(TSI_BED, thermalManager.degBed(), abl.measured_z)); + TERN_(PTC_PROBE, ptc.compensate_measurement(TSI_PROBE, thermalManager.degProbe(), abl.measured_z)); + TERN_(PTC_HOTEND, ptc.compensate_measurement(TSI_EXT, thermalManager.degHotend(0), abl.measured_z)); #if ENABLED(AUTO_BED_LEVELING_LINEAR) diff --git a/Marlin/src/gcode/calibrate/G76_M192_M871.cpp b/Marlin/src/gcode/calibrate/G76_M192_M871.cpp deleted file mode 100644 index 0fc41ed929..0000000000 --- a/Marlin/src/gcode/calibrate/G76_M192_M871.cpp +++ /dev/null @@ -1,358 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -/** - * G76_M871.cpp - Temperature calibration/compensation for z-probing - */ - -#include "../../inc/MarlinConfig.h" - -#if ENABLED(PROBE_TEMP_COMPENSATION) - -#include "../gcode.h" -#include "../../module/motion.h" -#include "../../module/planner.h" -#include "../../module/probe.h" -#include "../../feature/bedlevel/bedlevel.h" -#include "../../module/temperature.h" -#include "../../module/probe.h" -#include "../../feature/probe_temp_comp.h" -#include "../../lcd/marlinui.h" - -/** - * G76: calibrate probe and/or bed temperature offsets - * Notes: - * - When calibrating probe, bed temperature is held constant. - * Compensation values are deltas to first probe measurement at probe temp. = 30°C. - * - When calibrating bed, probe temperature is held constant. - * Compensation values are deltas to first probe measurement at bed temp. = 60°C. - * - The hotend will not be heated at any time. - * - On my Průša MK3S clone I put a piece of paper between the probe and the hotend - * so the hotend fan would not cool my probe constantly. Alternatively you could just - * make sure the fan is not running while running the calibration process. - * - * Probe calibration: - * - Moves probe to cooldown point. - * - Heats up bed to 100°C. - * - Moves probe to probing point (1mm above heatbed). - * - Waits until probe reaches target temperature (30°C). - * - Does a z-probing (=base value) and increases target temperature by 5°C. - * - Waits until probe reaches increased target temperature. - * - Does a z-probing (delta to base value will be a compensation value) and increases target temperature by 5°C. - * - Repeats last two steps until max. temperature reached or timeout (i.e. probe does not heat up any further). - * - Compensation values of higher temperatures will be extrapolated (using linear regression first). - * While this is not exact by any means it is still better than simply using the last compensation value. - * - * Bed calibration: - * - Moves probe to cooldown point. - * - Heats up bed to 60°C. - * - Moves probe to probing point (1mm above heatbed). - * - Waits until probe reaches target temperature (30°C). - * - Does a z-probing (=base value) and increases bed temperature by 5°C. - * - Moves probe to cooldown point. - * - Waits until probe is below 30°C and bed has reached target temperature. - * - Moves probe to probing point and waits until it reaches target temperature (30°C). - * - Does a z-probing (delta to base value will be a compensation value) and increases bed temperature by 5°C. - * - Repeats last four points until max. bed temperature reached (110°C) or timeout. - * - Compensation values of higher temperatures will be extrapolated (using linear regression first). - * While this is not exact by any means it is still better than simply using the last compensation value. - * - * G76 [B | P] - * - no flag - Both calibration procedures will be run. - * - `B` - Run bed temperature calibration. - * - `P` - Run probe temperature calibration. - */ - -static void say_waiting_for() { SERIAL_ECHOPGM("Waiting for "); } -static void say_waiting_for_probe_heating() { say_waiting_for(); SERIAL_ECHOLNPGM("probe heating."); } -static void say_successfully_calibrated() { SERIAL_ECHOPGM("Successfully calibrated"); } -static void say_failed_to_calibrate() { SERIAL_ECHOPGM("!Failed to calibrate"); } - -void GcodeSuite::G76() { - // Check if heated bed is available and z-homing is done with probe - #if TEMP_SENSOR_BED == 0 || !(HOMING_Z_WITH_PROBE) - return; - #endif - - auto report_temps = [](millis_t &ntr, millis_t timeout=0) { - idle_no_sleep(); - const millis_t ms = millis(); - if (ELAPSED(ms, ntr)) { - ntr = ms + 1000; - thermalManager.print_heater_states(active_extruder); - } - return (timeout && ELAPSED(ms, timeout)); - }; - - auto wait_for_temps = [&](const celsius_t tb, const celsius_t tp, millis_t &ntr, const millis_t timeout=0) { - say_waiting_for(); SERIAL_ECHOLNPGM("bed and probe temperature."); - while (thermalManager.wholeDegBed() != tb || thermalManager.wholeDegProbe() > tp) - if (report_temps(ntr, timeout)) return true; - return false; - }; - - auto g76_probe = [](const TempSensorID sid, celsius_t &targ, const xy_pos_t &nozpos) { - do_z_clearance(5.0); // Raise nozzle before probing - const float measured_z = probe.probe_at_point(nozpos, PROBE_PT_STOW, 0, false); // verbose=0, probe_relative=false - if (isnan(measured_z)) - SERIAL_ECHOLNPGM("!Received NAN. Aborting."); - else { - SERIAL_ECHOLNPAIR_F("Measured: ", measured_z); - if (targ == cali_info_init[sid].start_temp) - temp_comp.prepare_new_calibration(measured_z); - else - temp_comp.push_back_new_measurement(sid, measured_z); - targ += cali_info_init[sid].temp_resolution; - } - return measured_z; - }; - - #if ENABLED(BLTOUCH) - // Make sure any BLTouch error condition is cleared - bltouch_command(BLTOUCH_RESET, BLTOUCH_RESET_DELAY); - set_bltouch_deployed(false); - #endif - - bool do_bed_cal = parser.boolval('B'), do_probe_cal = parser.boolval('P'); - if (!do_bed_cal && !do_probe_cal) do_bed_cal = do_probe_cal = true; - - // Synchronize with planner - planner.synchronize(); - - const xyz_pos_t parkpos = temp_comp.park_point, - probe_pos_xyz = xyz_pos_t(temp_comp.measure_point) + xyz_pos_t({ 0.0f, 0.0f, PTC_PROBE_HEATING_OFFSET }), - noz_pos_xyz = probe_pos_xyz - probe.offset_xy; // Nozzle position based on probe position - - if (do_bed_cal || do_probe_cal) { - // Ensure park position is reachable - bool reachable = position_is_reachable(parkpos) || WITHIN(parkpos.z, Z_MIN_POS - fslop, Z_MAX_POS + fslop); - if (!reachable) - SERIAL_ECHOLNPGM("!Park"); - else { - // Ensure probe position is reachable - reachable = probe.can_reach(probe_pos_xyz); - if (!reachable) SERIAL_ECHOLNPGM("!Probe"); - } - - if (!reachable) { - SERIAL_ECHOLNPGM(" position unreachable - aborting."); - return; - } - - process_subcommands_now(FPSTR(G28_STR)); - } - - remember_feedrate_scaling_off(); - - /****************************************** - * Calibrate bed temperature offsets - ******************************************/ - - // Report temperatures every second and handle heating timeouts - millis_t next_temp_report = millis() + 1000; - - auto report_targets = [&](const celsius_t tb, const celsius_t tp) { - SERIAL_ECHOLNPGM("Target Bed:", tb, " Probe:", tp); - }; - - if (do_bed_cal) { - - celsius_t target_bed = cali_info_init[TSI_BED].start_temp, - target_probe = temp_comp.bed_calib_probe_temp; - - say_waiting_for(); SERIAL_ECHOLNPGM(" cooling."); - while (thermalManager.wholeDegBed() > target_bed || thermalManager.wholeDegProbe() > target_probe) - report_temps(next_temp_report); - - // Disable leveling so it won't mess with us - TERN_(HAS_LEVELING, set_bed_leveling_enabled(false)); - - for (;;) { - thermalManager.setTargetBed(target_bed); - - report_targets(target_bed, target_probe); - - // Park nozzle - do_blocking_move_to(parkpos); - - // Wait for heatbed to reach target temp and probe to cool below target temp - if (wait_for_temps(target_bed, target_probe, next_temp_report, millis() + MIN_TO_MS(15))) { - SERIAL_ECHOLNPGM("!Bed heating timeout."); - break; - } - - // Move the nozzle to the probing point and wait for the probe to reach target temp - do_blocking_move_to(noz_pos_xyz); - say_waiting_for_probe_heating(); - SERIAL_EOL(); - while (thermalManager.wholeDegProbe() < target_probe) - report_temps(next_temp_report); - - const float measured_z = g76_probe(TSI_BED, target_bed, noz_pos_xyz); - if (isnan(measured_z) || target_bed > (BED_MAX_TARGET)) break; - } - - SERIAL_ECHOLNPGM("Retrieved measurements: ", temp_comp.get_index()); - if (temp_comp.finish_calibration(TSI_BED)) { - say_successfully_calibrated(); - SERIAL_ECHOLNPGM(" bed."); - } - else { - say_failed_to_calibrate(); - SERIAL_ECHOLNPGM(" bed. Values reset."); - } - - // Cleanup - thermalManager.setTargetBed(0); - TERN_(HAS_LEVELING, set_bed_leveling_enabled(true)); - } // do_bed_cal - - /******************************************** - * Calibrate probe temperature offsets - ********************************************/ - - if (do_probe_cal) { - - // Park nozzle - do_blocking_move_to(parkpos); - - // Initialize temperatures - const celsius_t target_bed = temp_comp.probe_calib_bed_temp; - thermalManager.setTargetBed(target_bed); - - celsius_t target_probe = cali_info_init[TSI_PROBE].start_temp; - - report_targets(target_bed, target_probe); - - // Wait for heatbed to reach target temp and probe to cool below target temp - wait_for_temps(target_bed, target_probe, next_temp_report); - - // Disable leveling so it won't mess with us - TERN_(HAS_LEVELING, set_bed_leveling_enabled(false)); - - bool timeout = false; - for (;;) { - // Move probe to probing point and wait for it to reach target temperature - do_blocking_move_to(noz_pos_xyz); - - say_waiting_for_probe_heating(); - SERIAL_ECHOLNPGM(" Bed:", target_bed, " Probe:", target_probe); - const millis_t probe_timeout_ms = millis() + SEC_TO_MS(900UL); - while (thermalManager.degProbe() < target_probe) { - if (report_temps(next_temp_report, probe_timeout_ms)) { - SERIAL_ECHOLNPGM("!Probe heating timed out."); - timeout = true; - break; - } - } - if (timeout) break; - - const float measured_z = g76_probe(TSI_PROBE, target_probe, noz_pos_xyz); - if (isnan(measured_z) || target_probe > cali_info_init[TSI_PROBE].end_temp) break; - } - - SERIAL_ECHOLNPGM("Retrieved measurements: ", temp_comp.get_index()); - if (temp_comp.finish_calibration(TSI_PROBE)) - say_successfully_calibrated(); - else - say_failed_to_calibrate(); - SERIAL_ECHOLNPGM(" probe."); - - // Cleanup - thermalManager.setTargetBed(0); - TERN_(HAS_LEVELING, set_bed_leveling_enabled(true)); - - SERIAL_ECHOLNPGM("Final compensation values:"); - temp_comp.print_offsets(); - } // do_probe_cal - - restore_feedrate_and_scaling(); -} - -/** - * M871: Report / reset temperature compensation offsets. - * Note: This does not affect values in EEPROM until M500. - * - * M871 [ R | B | P | E ] - * - * No Parameters - Print current offset values. - * - * Select only one of these flags: - * R - Reset all offsets to zero (i.e., disable compensation). - * B - Manually set offset for bed - * P - Manually set offset for probe - * E - Manually set offset for extruder - * - * With B, P, or E: - * I[index] - Index in the array - * V[value] - Adjustment in µm - */ -void GcodeSuite::M871() { - - if (parser.seen('R')) { - // Reset z-probe offsets to factory defaults - temp_comp.clear_all_offsets(); - SERIAL_ECHOLNPGM("Offsets reset to default."); - } - else if (parser.seen("BPE")) { - if (!parser.seenval('V')) return; - const int16_t offset_val = parser.value_int(); - if (!parser.seenval('I')) return; - const int16_t idx = parser.value_int(); - const TempSensorID mod = (parser.seen('B') ? TSI_BED : - #if ENABLED(USE_TEMP_EXT_COMPENSATION) - parser.seen('E') ? TSI_EXT : - #endif - TSI_PROBE - ); - if (idx > 0 && temp_comp.set_offset(mod, idx - 1, offset_val)) - SERIAL_ECHOLNPGM("Set value: ", offset_val); - else - SERIAL_ECHOLNPGM("!Invalid index. Failed to set value (note: value at index 0 is constant)."); - - } - else // Print current Z-probe adjustments. Note: Values in EEPROM might differ. - temp_comp.print_offsets(); -} - -/** - * M192: Wait for probe temperature sensor to reach a target - * - * Select only one of these flags: - * R - Wait for heating or cooling - * S - Wait only for heating - */ -void GcodeSuite::M192() { - if (DEBUGGING(DRYRUN)) return; - - const bool no_wait_for_cooling = parser.seenval('S'); - if (!no_wait_for_cooling && ! parser.seenval('R')) { - SERIAL_ERROR_MSG("No target temperature set."); - return; - } - - const celsius_t target_temp = parser.value_celsius(); - ui.set_status(thermalManager.isProbeBelowTemp(target_temp) ? GET_TEXT_F(MSG_PROBE_HEATING) : GET_TEXT_F(MSG_PROBE_COOLING)); - thermalManager.wait_for_probe(target_temp, no_wait_for_cooling); -} - -#endif // PROBE_TEMP_COMPENSATION diff --git a/Marlin/src/gcode/calibrate/G76_M871.cpp b/Marlin/src/gcode/calibrate/G76_M871.cpp new file mode 100644 index 0000000000..21bb2c7590 --- /dev/null +++ b/Marlin/src/gcode/calibrate/G76_M871.cpp @@ -0,0 +1,337 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * G76_M871.cpp - Temperature calibration/compensation for z-probing + */ + +#include "../../inc/MarlinConfig.h" + +#if HAS_PTC + +#include "../gcode.h" +#include "../../module/motion.h" +#include "../../module/planner.h" +#include "../../module/probe.h" +#include "../../feature/bedlevel/bedlevel.h" +#include "../../module/temperature.h" +#include "../../module/probe.h" +#include "../../feature/probe_temp_comp.h" +#include "../../lcd/marlinui.h" + +/** + * G76: calibrate probe and/or bed temperature offsets + * Notes: + * - When calibrating probe, bed temperature is held constant. + * Compensation values are deltas to first probe measurement at probe temp. = 30°C. + * - When calibrating bed, probe temperature is held constant. + * Compensation values are deltas to first probe measurement at bed temp. = 60°C. + * - The hotend will not be heated at any time. + * - On my Průša MK3S clone I put a piece of paper between the probe and the hotend + * so the hotend fan would not cool my probe constantly. Alternatively you could just + * make sure the fan is not running while running the calibration process. + * + * Probe calibration: + * - Moves probe to cooldown point. + * - Heats up bed to 100°C. + * - Moves probe to probing point (1mm above heatbed). + * - Waits until probe reaches target temperature (30°C). + * - Does a z-probing (=base value) and increases target temperature by 5°C. + * - Waits until probe reaches increased target temperature. + * - Does a z-probing (delta to base value will be a compensation value) and increases target temperature by 5°C. + * - Repeats last two steps until max. temperature reached or timeout (i.e. probe does not heat up any further). + * - Compensation values of higher temperatures will be extrapolated (using linear regression first). + * While this is not exact by any means it is still better than simply using the last compensation value. + * + * Bed calibration: + * - Moves probe to cooldown point. + * - Heats up bed to 60°C. + * - Moves probe to probing point (1mm above heatbed). + * - Waits until probe reaches target temperature (30°C). + * - Does a z-probing (=base value) and increases bed temperature by 5°C. + * - Moves probe to cooldown point. + * - Waits until probe is below 30°C and bed has reached target temperature. + * - Moves probe to probing point and waits until it reaches target temperature (30°C). + * - Does a z-probing (delta to base value will be a compensation value) and increases bed temperature by 5°C. + * - Repeats last four points until max. bed temperature reached (110°C) or timeout. + * - Compensation values of higher temperatures will be extrapolated (using linear regression first). + * While this is not exact by any means it is still better than simply using the last compensation value. + * + * G76 [B | P] + * - no flag - Both calibration procedures will be run. + * - `B` - Run bed temperature calibration. + * - `P` - Run probe temperature calibration. + */ + +static void say_waiting_for() { SERIAL_ECHOPGM("Waiting for "); } +static void say_waiting_for_probe_heating() { say_waiting_for(); SERIAL_ECHOLNPGM("probe heating."); } +static void say_successfully_calibrated() { SERIAL_ECHOPGM("Successfully calibrated"); } +static void say_failed_to_calibrate() { SERIAL_ECHOPGM("!Failed to calibrate"); } + +#if BOTH(PTC_PROBE, PTC_BED) + + void GcodeSuite::G76() { + auto report_temps = [](millis_t &ntr, millis_t timeout=0) { + idle_no_sleep(); + const millis_t ms = millis(); + if (ELAPSED(ms, ntr)) { + ntr = ms + 1000; + thermalManager.print_heater_states(active_extruder); + } + return (timeout && ELAPSED(ms, timeout)); + }; + + auto wait_for_temps = [&](const celsius_t tb, const celsius_t tp, millis_t &ntr, const millis_t timeout=0) { + say_waiting_for(); SERIAL_ECHOLNPGM("bed and probe temperature."); + while (thermalManager.wholeDegBed() != tb || thermalManager.wholeDegProbe() > tp) + if (report_temps(ntr, timeout)) return true; + return false; + }; + + auto g76_probe = [](const TempSensorID sid, celsius_t &targ, const xy_pos_t &nozpos) { + do_z_clearance(5.0); // Raise nozzle before probing + const float measured_z = probe.probe_at_point(nozpos, PROBE_PT_STOW, 0, false); // verbose=0, probe_relative=false + if (isnan(measured_z)) + SERIAL_ECHOLNPGM("!Received NAN. Aborting."); + else { + SERIAL_ECHOLNPAIR_F("Measured: ", measured_z); + if (targ == ProbeTempComp::cali_info[sid].start_temp) + ptc.prepare_new_calibration(measured_z); + else + ptc.push_back_new_measurement(sid, measured_z); + targ += ProbeTempComp::cali_info[sid].temp_resolution; + } + return measured_z; + }; + + #if ENABLED(BLTOUCH) + // Make sure any BLTouch error condition is cleared + bltouch_command(BLTOUCH_RESET, BLTOUCH_RESET_DELAY); + set_bltouch_deployed(false); + #endif + + bool do_bed_cal = parser.boolval('B'), do_probe_cal = parser.boolval('P'); + if (!do_bed_cal && !do_probe_cal) do_bed_cal = do_probe_cal = true; + + // Synchronize with planner + planner.synchronize(); + + #ifndef PTC_PROBE_HEATING_OFFSET + #define PTC_PROBE_HEATING_OFFSET 0 + #endif + const xyz_pos_t parkpos = PTC_PARK_POS, + probe_pos_xyz = xyz_pos_t(PTC_PROBE_POS) + xyz_pos_t({ 0.0f, 0.0f, PTC_PROBE_HEATING_OFFSET }), + noz_pos_xyz = probe_pos_xyz - probe.offset_xy; // Nozzle position based on probe position + + if (do_bed_cal || do_probe_cal) { + // Ensure park position is reachable + bool reachable = position_is_reachable(parkpos) || WITHIN(parkpos.z, Z_MIN_POS - fslop, Z_MAX_POS + fslop); + if (!reachable) + SERIAL_ECHOLNPGM("!Park"); + else { + // Ensure probe position is reachable + reachable = probe.can_reach(probe_pos_xyz); + if (!reachable) SERIAL_ECHOLNPGM("!Probe"); + } + + if (!reachable) { + SERIAL_ECHOLNPGM(" position unreachable - aborting."); + return; + } + + process_subcommands_now(FPSTR(G28_STR)); + } + + remember_feedrate_scaling_off(); + + /****************************************** + * Calibrate bed temperature offsets + ******************************************/ + + // Report temperatures every second and handle heating timeouts + millis_t next_temp_report = millis() + 1000; + + auto report_targets = [&](const celsius_t tb, const celsius_t tp) { + SERIAL_ECHOLNPGM("Target Bed:", tb, " Probe:", tp); + }; + + if (do_bed_cal) { + + celsius_t target_bed = PTC_BED_START, + target_probe = PTC_PROBE_TEMP; + + say_waiting_for(); SERIAL_ECHOLNPGM(" cooling."); + while (thermalManager.wholeDegBed() > target_bed || thermalManager.wholeDegProbe() > target_probe) + report_temps(next_temp_report); + + // Disable leveling so it won't mess with us + TERN_(HAS_LEVELING, set_bed_leveling_enabled(false)); + + for (uint8_t idx = 0; idx <= PTC_BED_COUNT; idx++) { + thermalManager.setTargetBed(target_bed); + + report_targets(target_bed, target_probe); + + // Park nozzle + do_blocking_move_to(parkpos); + + // Wait for heatbed to reach target temp and probe to cool below target temp + if (wait_for_temps(target_bed, target_probe, next_temp_report, millis() + MIN_TO_MS(15))) { + SERIAL_ECHOLNPGM("!Bed heating timeout."); + break; + } + + // Move the nozzle to the probing point and wait for the probe to reach target temp + do_blocking_move_to(noz_pos_xyz); + say_waiting_for_probe_heating(); + SERIAL_EOL(); + while (thermalManager.wholeDegProbe() < target_probe) + report_temps(next_temp_report); + + const float measured_z = g76_probe(TSI_BED, target_bed, noz_pos_xyz); + if (isnan(measured_z) || target_bed > (BED_MAX_TARGET)) break; + } + + SERIAL_ECHOLNPGM("Retrieved measurements: ", ptc.get_index()); + if (ptc.finish_calibration(TSI_BED)) { + say_successfully_calibrated(); + SERIAL_ECHOLNPGM(" bed."); + } + else { + say_failed_to_calibrate(); + SERIAL_ECHOLNPGM(" bed. Values reset."); + } + + // Cleanup + thermalManager.setTargetBed(0); + TERN_(HAS_LEVELING, set_bed_leveling_enabled(true)); + } // do_bed_cal + + /******************************************** + * Calibrate probe temperature offsets + ********************************************/ + + if (do_probe_cal) { + + // Park nozzle + do_blocking_move_to(parkpos); + + // Initialize temperatures + const celsius_t target_bed = BED_MAX_TARGET; + thermalManager.setTargetBed(target_bed); + + celsius_t target_probe = PTC_PROBE_START; + + report_targets(target_bed, target_probe); + + // Wait for heatbed to reach target temp and probe to cool below target temp + wait_for_temps(target_bed, target_probe, next_temp_report); + + // Disable leveling so it won't mess with us + TERN_(HAS_LEVELING, set_bed_leveling_enabled(false)); + + bool timeout = false; + for (uint8_t idx = 0; idx <= PTC_PROBE_COUNT; idx++) { + // Move probe to probing point and wait for it to reach target temperature + do_blocking_move_to(noz_pos_xyz); + + say_waiting_for_probe_heating(); + SERIAL_ECHOLNPGM(" Bed:", target_bed, " Probe:", target_probe); + const millis_t probe_timeout_ms = millis() + SEC_TO_MS(900UL); + while (thermalManager.degProbe() < target_probe) { + if (report_temps(next_temp_report, probe_timeout_ms)) { + SERIAL_ECHOLNPGM("!Probe heating timed out."); + timeout = true; + break; + } + } + if (timeout) break; + + const float measured_z = g76_probe(TSI_PROBE, target_probe, noz_pos_xyz); + if (isnan(measured_z)) break; + } + + SERIAL_ECHOLNPGM("Retrieved measurements: ", ptc.get_index()); + if (ptc.finish_calibration(TSI_PROBE)) + say_successfully_calibrated(); + else + say_failed_to_calibrate(); + SERIAL_ECHOLNPGM(" probe."); + + // Cleanup + thermalManager.setTargetBed(0); + TERN_(HAS_LEVELING, set_bed_leveling_enabled(true)); + + SERIAL_ECHOLNPGM("Final compensation values:"); + ptc.print_offsets(); + } // do_probe_cal + + restore_feedrate_and_scaling(); + } + +#endif // PTC_PROBE && PTC_BED + +/** + * M871: Report / reset temperature compensation offsets. + * Note: This does not affect values in EEPROM until M500. + * + * M871 [ R | B | P | E ] + * + * No Parameters - Print current offset values. + * + * Select only one of these flags: + * R - Reset all offsets to zero (i.e., disable compensation). + * B - Manually set offset for bed + * P - Manually set offset for probe + * E - Manually set offset for extruder + * + * With B, P, or E: + * I[index] - Index in the array + * V[value] - Adjustment in µm + */ +void GcodeSuite::M871() { + + if (parser.seen('R')) { + // Reset z-probe offsets to factory defaults + ptc.clear_all_offsets(); + SERIAL_ECHOLNPGM("Offsets reset to default."); + } + else if (parser.seen("BPE")) { + if (!parser.seenval('V')) return; + const int16_t offset_val = parser.value_int(); + if (!parser.seenval('I')) return; + const int16_t idx = parser.value_int(); + const TempSensorID mod = TERN_(PTC_BED, parser.seen_test('B') ? TSI_BED :) + TERN_(PTC_HOTEND, parser.seen_test('E') ? TSI_EXT :) + TERN_(PTC_PROBE, parser.seen_test('P') ? TSI_PROBE :) TSI_COUNT; + if (mod == TSI_COUNT) + SERIAL_ECHOLNPGM("!Invalid sensor."); + else if (idx > 0 && ptc.set_offset(mod, idx - 1, offset_val)) + SERIAL_ECHOLNPGM("Set value: ", offset_val); + else + SERIAL_ECHOLNPGM("!Invalid index. Failed to set value (note: value at index 0 is constant)."); + } + else // Print current Z-probe adjustments. Note: Values in EEPROM might differ. + ptc.print_offsets(); +} + +#endif // HAS_PTC diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index fb1669c1ea..b2cb26122f 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -424,7 +424,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 61: G61(); break; // G61: Apply/restore saved coordinates. #endif - #if ENABLED(PROBE_TEMP_COMPENSATION) + #if BOTH(PTC_PROBE, PTC_BED) case 76: G76(); break; // G76: Calibrate first layer compensation values #endif @@ -587,6 +587,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 191: M191(); break; // M191: Wait for chamber temperature to reach target #endif + #if HAS_TEMP_PROBE + case 192: M192(); break; // M192: Wait for probe temp + #endif + #if HAS_COOLER case 143: M143(); break; // M143: Set cooler temperature case 193: M193(); break; // M193: Wait for cooler temperature to reach target @@ -921,8 +925,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 852: M852(); break; // M852: Set Skew factors #endif - #if ENABLED(PROBE_TEMP_COMPENSATION) - case 192: M192(); break; // M192: Wait for probe temp + #if HAS_PTC case 871: M871(); break; // M871: Print/reset/clear first layer temperature offset values #endif diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 8de15fc9c7..09dd53d6f6 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -66,7 +66,7 @@ * G42 - Coordinated move to a mesh point (Requires MESH_BED_LEVELING, AUTO_BED_LEVELING_BLINEAR, or AUTO_BED_LEVELING_UBL) * G60 - Save current position. (Requires SAVED_POSITIONS) * G61 - Apply/restore saved coordinates. (Requires SAVED_POSITIONS) - * G76 - Calibrate first layer temperature offsets. (Requires PROBE_TEMP_COMPENSATION) + * G76 - Calibrate first layer temperature offsets. (Requires PTC_PROBE and PTC_BED) * G80 - Cancel current motion mode (Requires GCODE_MOTION_MODES) * G90 - Use Absolute Coordinates * G91 - Use Relative Coordinates @@ -88,6 +88,8 @@ * M16 - Expected printer check. (Requires EXPECTED_PRINTER_CHECK) * M17 - Enable/Power all stepper motors * M18 - Disable all stepper motors; same as M84 + * + *** Print from Media (SDSUPPORT) *** * M20 - List SD card. (Requires SDSUPPORT) * M21 - Init SD card. (Requires SDSUPPORT) * M22 - Release SD card. (Requires SDSUPPORT) @@ -100,30 +102,36 @@ * OR, with 'C' get the current filename. * M28 - Start SD write: "M28 /path/file.gco". (Requires SDSUPPORT) * M29 - Stop SD write. (Requires SDSUPPORT) - * M30 - Delete file from SD: "M30 /path/file.gco" + * M30 - Delete file from SD: "M30 /path/file.gco" (Requires SDSUPPORT) * M31 - Report time since last M109 or SD card start to serial. * M32 - Select file and start SD print: "M32 [S] !/path/file.gco#". (Requires SDSUPPORT) * Use P to run other files as sub-programs: "M32 P !filename#" * The '#' is necessary when calling from within sd files, as it stops buffer prereading * M33 - Get the longname version of a path. (Requires LONG_FILENAME_HOST_SUPPORT) * M34 - Set SD Card sorting options. (Requires SDCARD_SORT_ALPHA) + * * M42 - Change pin status via gcode: M42 P S. LED pin assumed if P is omitted. (Requires DIRECT_PIN_CONTROL) - * M43 - Display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins + * M43 - Display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins (Requires PINS_DEBUGGING) * M48 - Measure Z Probe repeatability: M48 P X Y V E L S. (Requires Z_MIN_PROBE_REPEATABILITY_TEST) + * * M73 - Set the progress percentage. (Requires LCD_SET_PROGRESS_MANUALLY) * M75 - Start the print job timer. * M76 - Pause the print job timer. * M77 - Stop the print job timer. * M78 - Show statistical information about the print jobs. (Requires PRINTCOUNTER) + * * M80 - Turn on Power Supply. (Requires PSU_CONTROL) * M81 - Turn off Power Supply. (Requires PSU_CONTROL) + * * M82 - Set E codes absolute (default). * M83 - Set E codes relative while in Absolute (G90) mode. * M84 - Disable steppers until next move, or use S to specify an idle * duration after which steppers should turn off. S0 disables the timeout. * M85 - Set inactivity shutdown timer with parameter S. To disable set zero (default) * M92 - Set planner.settings.axis_steps_per_mm for one or more axes. + * * M100 - Watch Free Memory (for debugging) (Requires M100_FREE_MEMORY_WATCHER) + * * M104 - Set extruder target temp. * M105 - Report current temperatures. * M106 - Set print fan speed. @@ -132,23 +140,29 @@ * M109 - S Wait for extruder current temp to reach target temp. ** Wait only when heating! ** * R Wait for extruder current temp to reach target temp. ** Wait for heating or cooling. ** * If AUTOTEMP is enabled, S B F. Exit autotemp by any M109 without F + * * M110 - Set the current line number. (Used by host printing) * M111 - Set debug flags: "M111 S". See flag bits defined in enum.h. * M112 - Full Shutdown. + * * M113 - Get or set the timeout interval for Host Keepalive "busy" messages. (Requires HOST_KEEPALIVE_FEATURE) * M114 - Report current position. * M115 - Report capabilities. (Extended capabilities requires EXTENDED_CAPABILITIES_REPORT) * M117 - Display a message on the controller screen. (Requires an LCD) * M118 - Display a message in the host console. + * * M119 - Report endstops status. * M120 - Enable endstops detection. * M121 - Disable endstops detection. + * * M122 - Debug stepper (Requires at least one _DRIVER_TYPE defined as TMC2130/2160/5130/5160/2208/2209/2660 or L6470) * M125 - Save current position and move to filament change position. (Requires PARK_HEAD_ON_PAUSE) + * * M126 - Solenoid Air Valve Open. (Requires BARICUDA) * M127 - Solenoid Air Valve Closed. (Requires BARICUDA) * M128 - EtoP Open. (Requires BARICUDA) * M129 - EtoP Closed. (Requires BARICUDA) + * * M140 - Set bed target temp. S * M141 - Set heated chamber target temp. S (Requires a chamber heater) * M143 - Set cooler target temp. S (Requires a laser cooling device) @@ -161,9 +175,9 @@ * M164 - Commit the mix and save to a virtual tool (current, or as specified by 'S'). (Requires MIXING_EXTRUDER) * M165 - Set the mix for the mixing extruder (and current virtual tool) with parameters ABCDHI. (Requires MIXING_EXTRUDER and DIRECT_MIXING_IN_G1) * M166 - Set the Gradient Mix for the mixing extruder. (Requires GRADIENT_MIX) - * M190 - S Wait for bed current temp to reach target temp. ** Wait only when heating! ** - * R Wait for bed current temp to reach target temp. ** Wait for heating or cooling. ** - * M193 - R Wait for cooler temp to reach target temp. ** Wait for cooling. ** + * M190 - Set bed target temperature and wait. R Set target temperature and wait. S Set, but only wait when heating. (Requires TEMP_SENSOR_BED) + * M192 - Wait for probe to reach target temperature. (Requires TEMP_SENSOR_PROBE) + * M193 - R Wait for cooler to reach target temp. ** Wait for cooling. ** * M200 - Set filament diameter, D, setting E axis units to cubic. (Use S0 to revert to linear units.) * M201 - Set max acceleration in units/s^2 for print moves: "M201 X Y Z E" * M202 - Set max acceleration in units/s^2 for travel moves: "M202 X Y Z E" ** UNUSED IN MARLIN! ** @@ -183,7 +197,7 @@ * M218 - Set/get a tool offset: "M218 T X Y". (Requires 2 or more extruders) * M220 - Set Feedrate Percentage: "M220 S" (i.e., "FR" on the LCD) * Use "M220 B" to back up the Feedrate Percentage and "M220 R" to restore it. (Requires an MMU_MODEL version 2 or 2S) - * M221 - Set Flow Percentage: "M221 S" + * M221 - Set Flow Percentage: "M221 S" (Requires an extruder) * M226 - Wait until a pin is in a given state: "M226 P S" (Requires DIRECT_PIN_CONTROL) * M240 - Trigger a camera to take a photograph. (Requires PHOTO_GCODE) * M250 - Set LCD contrast: "M250 C" (0-63). (Requires LCD support) @@ -230,9 +244,9 @@ * M502 - Revert to the default "factory settings". ** Does not write them to EEPROM! ** * M503 - Print the current settings (in memory): "M503 S". S0 specifies compact output. * M504 - Validate EEPROM contents. (Requires EEPROM_SETTINGS) - * M510 - Lock Printer - * M511 - Unlock Printer - * M512 - Set/Change/Remove Password + * M510 - Lock Printer (Requires PASSWORD_FEATURE) + * M511 - Unlock Printer (Requires PASSWORD_UNLOCK_GCODE) + * M512 - Set/Change/Remove Password (Requires PASSWORD_CHANGE_GCODE) * M524 - Abort the current SD print job started with M24. (Requires SDSUPPORT) * M540 - Enable/disable SD card abort on endstop hit: "M540 S". (Requires SD_ABORT_ON_ENDSTOP_HIT) * M552 - Get or set IP address. Enable/disable network interface. (Requires enabled Ethernet port) @@ -252,7 +266,9 @@ * M808 - Set or Goto a Repeat Marker (Requires GCODE_REPEAT_MARKERS) * M810-M819 - Define/execute a G-code macro (Requires GCODE_MACROS) * M851 - Set Z probe's XYZ offsets in current units. (Negative values: X=left, Y=front, Z=below) - * M852 - Set skew factors: "M852 [I] [J] [K]". (Requires SKEW_CORRECTION_GCODE, and SKEW_CORRECTION_FOR_Z for IJ) + * M852 - Set skew factors: "M852 [I] [J] [K]". (Requires SKEW_CORRECTION_GCODE, plus SKEW_CORRECTION_FOR_Z for IJ) + * + *** I2C_POSITION_ENCODERS *** * M860 - Report the position of position encoder modules. * M861 - Report the status of position encoder modules. * M862 - Perform an axis continuity test for position encoder modules. @@ -263,8 +279,8 @@ * M867 - Enable/disable or toggle error correction for position encoder modules. * M868 - Report or set position encoder module error correction threshold. * M869 - Report position encoder module error. - * M871 - Print/reset/clear first layer temperature offset values. (Requires PROBE_TEMP_COMPENSATION) - * M192 - Wait for probe temp (Requires PROBE_TEMP_COMPENSATION) + * + * M871 - Print/reset/clear first layer temperature offset values. (Requires PTC_PROBE, PTC_BED, or PTC_HOTEND) * M876 - Handle Prompt Response. (Requires HOST_PROMPT_SUPPORT and not EMERGENCY_PARSER) * M900 - Get or Set Linear Advance K-factor. (Requires LIN_ADVANCE) * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. (Requires at least one _DRIVER_TYPE defined as TMC2130/2160/5130/5160/2208/2209/2660 or L6470) @@ -282,13 +298,14 @@ * M951 - Set Magnetic Parking Extruder parameters. (Requires MAGNETIC_PARKING_EXTRUDER) * M7219 - Control Max7219 Matrix LEDs. (Requires MAX7219_GCODE) * + *** SCARA *** * M360 - SCARA calibration: Move to cal-position ThetaA (0 deg calibration) * M361 - SCARA calibration: Move to cal-position ThetaB (90 deg calibration - steps per degree) * M362 - SCARA calibration: Move to cal-position PsiA (0 deg calibration) * M363 - SCARA calibration: Move to cal-position PsiB (90 deg calibration - steps per degree) * M364 - SCARA calibration: Move to cal-position PSIC (90 deg to Theta calibration position) * - * ************ Custom codes - This can change to suit future G-code regulations + *** Custom codes (can be changed to suit future G-code standards) *** * G425 - Calibrate using a conductive object. (Requires CALIBRATION_GCODE) * M928 - Start SD logging: "M928 filename.gco". Stop with M29. (Requires SDSUPPORT) * M993 - Backup SPI Flash to SD @@ -296,10 +313,11 @@ * M995 - Touch screen calibration for TFT display * M997 - Perform in-application firmware update * M999 - Restart after being stopped by error + * * D... - Custom Development G-code. Add hooks to 'gcode_D.cpp' for developers to test features. (Requires MARLIN_DEV_MODE) * D576 - Set buffer monitoring options. (Requires BUFFER_MONITORING) * - * "T" Codes + *** "T" Codes *** * * T0-T3 - Select an extruder (tool) by index: "T F" */ @@ -551,7 +569,7 @@ private: static void G59(); #endif - #if ENABLED(PROBE_TEMP_COMPENSATION) + #if BOTH(PTC_PROBE, PTC_BED) static void G76(); #endif @@ -744,6 +762,10 @@ private: static void M191(); #endif + #if HAS_TEMP_PROBE + static void M192(); + #endif + #if HAS_COOLER static void M143(); static void M193(); @@ -1087,8 +1109,7 @@ private: FORCE_INLINE static void M869() { I2CPEM.M869(); } #endif - #if ENABLED(PROBE_TEMP_COMPENSATION) - static void M192(); + #if HAS_PTC static void M871(); #endif diff --git a/Marlin/src/gcode/temp/M192.cpp b/Marlin/src/gcode/temp/M192.cpp new file mode 100644 index 0000000000..a96e2d34a4 --- /dev/null +++ b/Marlin/src/gcode/temp/M192.cpp @@ -0,0 +1,56 @@ +/** + * 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 . + * + */ + +/** + * M192.cpp - Wait for probe to reach temperature + */ + +#include "../../inc/MarlinConfig.h" + +#if HAS_TEMP_PROBE + +#include "../gcode.h" +#include "../../module/temperature.h" +#include "../../lcd/marlinui.h" + +/** + * M192: Wait for probe temperature sensor to reach a target + * + * Select only one of these flags: + * R - Wait for heating or cooling + * S - Wait only for heating + */ +void GcodeSuite::M192() { + if (DEBUGGING(DRYRUN)) return; + + const bool no_wait_for_cooling = parser.seenval('S'); + if (!no_wait_for_cooling && !parser.seenval('R')) { + SERIAL_ERROR_MSG("No target temperature set."); + return; + } + + const celsius_t target_temp = parser.value_celsius(); + ui.set_status(thermalManager.isProbeBelowTemp(target_temp) ? GET_TEXT_F(MSG_PROBE_HEATING) : GET_TEXT_F(MSG_PROBE_COOLING)); + thermalManager.wait_for_probe(target_temp, no_wait_for_cooling); +} + +#endif // HAS_TEMP_PROBE diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index efb9db420d..49067a5606 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -550,6 +550,20 @@ #endif #endif +// Probe Temperature Compensation +#if !TEMP_SENSOR_PROBE + #undef PTC_PROBE +#endif +#if !TEMP_SENSOR_BED + #undef PTC_BED +#endif +#if !HAS_EXTRUDERS + #undef PTC_HOTEND +#endif +#if ANY(PTC_PROBE, PTC_BED, PTC_HOTEND) + #define HAS_PTC 1 +#endif + // Let SD_FINISHED_RELEASECOMMAND stand in for SD_FINISHED_STEPPERRELEASE #if ENABLED(SD_FINISHED_STEPPERRELEASE) #ifndef SD_FINISHED_RELEASECOMMAND diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 60238e6c80..c8d30a2718 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -597,6 +597,10 @@ #error "SPINDLE_LASER_PWM (true) is now set with SPINDLE_LASER_USE_PWM (enabled)." #elif ANY(IS_RAMPS_EEB, IS_RAMPS_EEF, IS_RAMPS_EFB, IS_RAMPS_EFF, IS_RAMPS_SF) #error "The IS_RAMPS_* conditionals (for heater/fan/bed pins) are now called FET_ORDER_*." +#elif defined(PROBE_TEMP_COMPENSATION) + #error "PROBE_TEMP_COMPENSATION is now set using the PTC_PROBE, PTC_BED, PTC_HOTEND options." +#elif defined(BTC_PROBE_TEMP) + #error "BTC_PROBE_TEMP is now PTC_PROBE_TEMP." #endif #if MB(DUE3DOM_MINI) && PIN_EXISTS(TEMP_2) && DISABLED(TEMP_SENSOR_BOARD) @@ -611,60 +615,60 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L /** * Probe temp compensation requirements */ - -#if ENABLED(PROBE_TEMP_COMPENSATION) - #if defined(PTC_PARK_POS_X) || defined(PTC_PARK_POS_Y) || defined(PTC_PARK_POS_Z) - #error "PTC_PARK_POS_[XYZ] is now PTC_PARK_POS (array)." - #elif !defined(PTC_PARK_POS) - #error "PROBE_TEMP_COMPENSATION requires PTC_PARK_POS." - #elif defined(PTC_PROBE_POS_X) || defined(PTC_PROBE_POS_Y) - #error "PTC_PROBE_POS_[XY] is now PTC_PROBE_POS (array)." - #elif !defined(PTC_PROBE_POS) - #error "PROBE_TEMP_COMPENSATION requires PTC_PROBE_POS." +#if HAS_PTC + #if TEMP_SENSOR_PROBE && TEMP_SENSOR_BED + #if defined(PTC_PARK_POS_X) || defined(PTC_PARK_POS_Y) || defined(PTC_PARK_POS_Z) + #error "PTC_PARK_POS_[XYZ] is now PTC_PARK_POS (array)." + #elif !defined(PTC_PARK_POS) + #error "PTC_PARK_POS is required for Probe Temperature Compensation." + #elif defined(PTC_PROBE_POS_X) || defined(PTC_PROBE_POS_Y) + #error "PTC_PROBE_POS_[XY] is now PTC_PROBE_POS (array)." + #elif !defined(PTC_PROBE_POS) + #error "PTC_PROBE_POS is required for Probe Temperature Compensation." + #endif #endif - #ifdef PTC_SAMPLE_START - constexpr auto _ptc_sample_start = PTC_SAMPLE_START; + #ifdef PTC_PROBE_START + constexpr auto _ptc_sample_start = PTC_PROBE_START; constexpr decltype(_ptc_sample_start) _test_ptc_sample_start = 12.3f; - static_assert(_test_ptc_sample_start != 12.3f, "PTC_SAMPLE_START must be a whole number."); + static_assert(_test_ptc_sample_start != 12.3f, "PTC_PROBE_START must be a whole number."); #endif - #ifdef PTC_SAMPLE_RES - constexpr auto _ptc_sample_res = PTC_SAMPLE_RES; + #ifdef PTC_PROBE_RES + constexpr auto _ptc_sample_res = PTC_PROBE_RES; constexpr decltype(_ptc_sample_res) _test_ptc_sample_res = 12.3f; - static_assert(_test_ptc_sample_res != 12.3f, "PTC_SAMPLE_RES must be a whole number."); + static_assert(_test_ptc_sample_res != 12.3f, "PTC_PROBE_RES must be a whole number."); #endif - #ifdef BTC_SAMPLE_START - constexpr auto _btc_sample_start = BTC_SAMPLE_START; + #ifdef PTC_BED_START + constexpr auto _btc_sample_start = PTC_BED_START; constexpr decltype(_btc_sample_start) _test_btc_sample_start = 12.3f; - static_assert(_test_btc_sample_start != 12.3f, "BTC_SAMPLE_START must be a whole number."); + static_assert(_test_btc_sample_start != 12.3f, "PTC_BED_START must be a whole number."); #endif - #ifdef BTC_SAMPLE_RES - constexpr auto _btc_sample_res = BTC_SAMPLE_RES; + #ifdef PTC_BED_RES + constexpr auto _btc_sample_res = PTC_BED_RES; constexpr decltype(_btc_sample_res) _test_btc_sample_res = 12.3f; - static_assert(_test_btc_sample_res != 12.3f, "BTC_SAMPLE_RES must be a whole number."); + static_assert(_test_btc_sample_res != 12.3f, "PTC_BED_RES must be a whole number."); #endif - #ifdef BTC_PROBE_TEMP - constexpr auto _btc_probe_temp = BTC_PROBE_TEMP; + #ifdef PTC_PROBE_TEMP + constexpr auto _btc_probe_temp = PTC_PROBE_TEMP; constexpr decltype(_btc_probe_temp) _test_btc_probe_temp = 12.3f; - static_assert(_test_btc_probe_temp != 12.3f, "BTC_PROBE_TEMP must be a whole number."); + static_assert(_test_btc_probe_temp != 12.3f, "PTC_PROBE_TEMP must be a whole number."); #endif - #if ENABLED(USE_TEMP_EXT_COMPENSATION) - #ifdef ETC_SAMPLE_START - constexpr auto _etc_sample_start = ETC_SAMPLE_START; + #if ENABLED(PTC_HOTEND) + #if EXTRUDERS != 1 + #error "PTC_HOTEND only works with a single extruder." + #endif + #ifdef PTC_HOTEND_START + constexpr auto _etc_sample_start = PTC_HOTEND_START; constexpr decltype(_etc_sample_start) _test_etc_sample_start = 12.3f; - static_assert(_test_etc_sample_start != 12.3f, "ETC_SAMPLE_START must be a whole number."); + static_assert(_test_etc_sample_start != 12.3f, "PTC_HOTEND_START must be a whole number."); #endif - #ifdef ETC_SAMPLE_RES - constexpr auto _etc_sample_res = ETC_SAMPLE_RES; + #ifdef PTC_HOTEND_RES + constexpr auto _etc_sample_res = PTC_HOTEND_RES; constexpr decltype(_etc_sample_res) _test_etc_sample_res = 12.3f; - static_assert(_test_etc_sample_res != 12.3f, "ETC_SAMPLE_RES must be a whole number."); + static_assert(_test_etc_sample_res != 12.3f, "PTC_HOTEND_RES must be a whole number."); #endif #endif - - #if ENABLED(USE_TEMP_EXT_COMPENSATION) && EXTRUDERS != 1 - #error "USE_TEMP_EXT_COMPENSATION only works with a single extruder." - #endif -#endif +#endif // HAS_PTC /** * Marlin release, version and default string diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index c82f5aad0d..01a5c47fd5 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -128,7 +128,7 @@ #include "../feature/tmc_util.h" #endif -#if ENABLED(PROBE_TEMP_COMPENSATION) +#if HAS_PTC #include "../feature/probe_temp_comp.h" #endif @@ -264,13 +264,16 @@ typedef struct SettingsDataStruct { // // Temperature first layer compensation values // - #if ENABLED(PROBE_TEMP_COMPENSATION) - int16_t z_offsets_probe[COUNT(temp_comp.z_offsets_probe)], // M871 P I V - z_offsets_bed[COUNT(temp_comp.z_offsets_bed)] // M871 B I V - #if ENABLED(USE_TEMP_EXT_COMPENSATION) - , z_offsets_ext[COUNT(temp_comp.z_offsets_ext)] // M871 E I V - #endif - ; + #if HAS_PTC + #if ENABLED(PTC_PROBE) + int16_t z_offsets_probe[COUNT(ptc.z_offsets_probe)]; // M871 P I V + #endif + #if ENABLED(PTC_BED) + int16_t z_offsets_bed[COUNT(ptc.z_offsets_bed)]; // M871 B I V + #endif + #if ENABLED(PTC_HOTEND) + int16_t z_offsets_hotend[COUNT(ptc.z_offsets_hotend)]; // M871 E I V + #endif #endif // @@ -844,11 +847,15 @@ void MarlinSettings::postprocess() { // // Thermal first layer compensation values // - #if ENABLED(PROBE_TEMP_COMPENSATION) - EEPROM_WRITE(temp_comp.z_offsets_probe); - EEPROM_WRITE(temp_comp.z_offsets_bed); - #if ENABLED(USE_TEMP_EXT_COMPENSATION) - EEPROM_WRITE(temp_comp.z_offsets_ext); + #if HAS_PTC + #if ENABLED(PTC_PROBE) + EEPROM_WRITE(ptc.z_offsets_probe); + #endif + #if ENABLED(PTC_BED) + EEPROM_WRITE(ptc.z_offsets_bed); + #endif + #if ENABLED(PTC_HOTEND) + EEPROM_WRITE(ptc.z_offsets_hotend); #endif #else // No placeholder data for this feature @@ -1710,13 +1717,17 @@ void MarlinSettings::postprocess() { // // Thermal first layer compensation values // - #if ENABLED(PROBE_TEMP_COMPENSATION) - EEPROM_READ(temp_comp.z_offsets_probe); - EEPROM_READ(temp_comp.z_offsets_bed); - #if ENABLED(USE_TEMP_EXT_COMPENSATION) - EEPROM_READ(temp_comp.z_offsets_ext); + #if HAS_PTC + #if ENABLED(PTC_PROBE) + EEPROM_READ(ptc.z_offsets_probe); #endif - temp_comp.reset_index(); + # if ENABLED(PTC_BED) + EEPROM_READ(ptc.z_offsets_bed); + #endif + #if ENABLED(PTC_HOTEND) + EEPROM_READ(ptc.z_offsets_hotend); + #endif + ptc.reset_index(); #else // No placeholder data for this feature #endif @@ -2728,6 +2739,11 @@ void MarlinSettings::reset() { // TERN_(EDITABLE_SERVO_ANGLES, COPY(servo_angles, base_servo_angles)); // When not editable only one copy of servo angles exists + // + // Probe Temperature Compensation + // + TERN_(HAS_PTC, ptc.reset()); + // // BLTOUCH // diff --git a/buildroot/tests/rambo b/buildroot/tests/rambo index a563bd4ed3..b7136e445e 100755 --- a/buildroot/tests/rambo +++ b/buildroot/tests/rambo @@ -18,7 +18,7 @@ opt_set MOTHERBOARD BOARD_RAMBO \ FANMUX0_PIN 53 opt_disable Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN USE_WATCHDOG opt_enable USE_ZMAX_PLUG REPRAP_DISCOUNT_SMART_CONTROLLER LCD_PROGRESS_BAR LCD_PROGRESS_BAR_TEST \ - FIX_MOUNTED_PROBE CODEPENDENT_XY_HOMING PIDTEMPBED PROBE_TEMP_COMPENSATION \ + FIX_MOUNTED_PROBE CODEPENDENT_XY_HOMING PIDTEMPBED PTC_PROBE PTC_BED \ PREHEAT_BEFORE_PROBING PROBING_HEATERS_OFF PROBING_FANS_OFF PROBING_STEPPERS_OFF WAIT_FOR_BED_HEATER \ EEPROM_SETTINGS SDSUPPORT SD_REPRINT_LAST_SELECTED_FILE BINARY_FILE_TRANSFER \ BLINKM PCA9533 PCA9632 RGB_LED RGB_LED_R_PIN RGB_LED_G_PIN RGB_LED_B_PIN LED_CONTROL_MENU \ @@ -61,16 +61,16 @@ opt_disable MIN_SOFTWARE_ENDSTOP_Z MAX_SOFTWARE_ENDSTOPS exec_test $1 $2 "Rambo CNC Configuration" "$3" # -# Rambo heated bed only +# Rambo heated bed and probe temp sensor # restore_configs -opt_set MOTHERBOARD BOARD_RAMBO EXTRUDERS 0 TEMP_SENSOR_BED 1 \ +opt_set MOTHERBOARD BOARD_RAMBO EXTRUDERS 0 TEMP_SENSOR_BED 1 TEMP_SENSOR_PROBE 1 TEMP_PROBE_PIN 12 \ DEFAULT_AXIS_STEPS_PER_UNIT '{ 80, 80, 4000 }' \ DEFAULT_MAX_FEEDRATE '{ 300, 300, 5 }' \ DEFAULT_MAX_ACCELERATION '{ 3000, 3000, 100 }' \ MANUAL_FEEDRATE '{ 50*60, 50*60, 4*60 }' \ AXIS_RELATIVE_MODES '{ false, false, false }' -opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER +opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER FIX_MOUNTED_PROBE Z_SAFE_HOMING exec_test $1 $2 "Rambo heated bed only" "$3" # diff --git a/ini/features.ini b/ini/features.ini index f54b645f85..4c14651298 100644 --- a/ini/features.ini +++ b/ini/features.ini @@ -136,20 +136,20 @@ ADVANCED_PAUSE_FEATURE = src_filter=+ + HAS_POWER_MONITOR = src_filter=+ + POWER_LOSS_RECOVERY = src_filter=+ + -PROBE_TEMP_COMPENSATION = src_filter=+ + +HAS_PTC = src_filter=+ + HAS_FILAMENT_SENSOR = src_filter=+ + (EXT|MANUAL)_SOLENOID.* = src_filter=+ + MK2_MULTIPLEXER = src_filter=+ HAS_CUTTER = src_filter=+ + HAS_DRIVER_SAFE_POWER_PROTECT = src_filter=+ EXPERIMENTAL_I2CBUS = src_filter=+ + -MECHANICAL_GANTRY_CAL.+ = src_filter=+ -Z_MULTI_ENDSTOPS = src_filter=+ -Z_STEPPER_AUTO_ALIGN = src_filter=+ + G26_MESH_VALIDATION = src_filter=+ ASSISTED_TRAMMING = src_filter=+ + HAS_MESH = src_filter=+ HAS_LEVELING = src_filter=+ + +MECHANICAL_GANTRY_CAL.+ = src_filter=+ +Z_MULTI_ENDSTOPS|Z_STEPPER_AUTO_ALIGN = src_filter=+ +Z_STEPPER_AUTO_ALIGN = src_filter=+ DELTA_AUTO_CALIBRATION = src_filter=+ CALIBRATION_GCODE = src_filter=+ Z_MIN_PROBE_REPEATABILITY_TEST = src_filter=+ @@ -209,6 +209,7 @@ SDSUPPORT = src_filter=+ + GCODE_REPEAT_MARKERS = src_filter=+ + HAS_EXTRUDERS = src_filter=+ + + +HAS_TEMP_PROBE = src_filter=+ HAS_COOLER = src_filter=+ HAS_COOLER|LASER_COOLANT_FLOW_METER = src_filter=+ AUTO_REPORT_TEMPERATURES = src_filter=+ diff --git a/platformio.ini b/platformio.ini index 106e454d10..a364e8920f 100644 --- a/platformio.ini +++ b/platformio.ini @@ -152,7 +152,7 @@ default_src_filter = + - - + - - - - - + - - - - @@ -229,6 +229,7 @@ default_src_filter = + - - + - - - + - - - - From 36e475b8beccd7bcc74335cbab69c5aa6ecbf61c Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Tue, 2 Nov 2021 12:34:53 +1300 Subject: [PATCH 086/125] =?UTF-8?q?=F0=9F=A9=B9=20Fill=20gaps=20in=20pinsD?= =?UTF-8?q?ebug=5Flist=20(#23051)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/pinsDebug_list.h | 98 ++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/Marlin/src/pins/pinsDebug_list.h b/Marlin/src/pins/pinsDebug_list.h index f07b1cf025..05756d6004 100644 --- a/Marlin/src/pins/pinsDebug_list.h +++ b/Marlin/src/pins/pinsDebug_list.h @@ -74,6 +74,16 @@ REPORT_NAME_ANALOG(__LINE__, MAIN_VOLTAGE_MEASURE_PIN) #endif #endif +#if PIN_EXISTS(POWER_MONITOR_CURRENT) + #if ANALOG_OK(POWER_MONITOR_CURRENT_PIN) + REPORT_NAME_ANALOG(__LINE__, POWER_MONITOR_CURRENT_PIN) + #endif +#endif +#if PIN_EXISTS(POWER_MONITOR_VOLTAGE) + #if ANALOG_OK(POWER_MONITOR_VOLTAGE_PIN) + REPORT_NAME_ANALOG(__LINE__, POWER_MONITOR_VOLTAGE_PIN) + #endif +#endif #if !defined(ARDUINO_ARCH_SAM) && !defined(ARDUINO_ARCH_SAMD) // TC1 & TC2 are macros in the SAM/SAMD tool chain #if _EXISTS(TC1) #if ANALOG_OK(TC1) @@ -131,6 +141,11 @@ REPORT_NAME_ANALOG(__LINE__, TEMP_BED_PIN) #endif #endif +#if PIN_EXISTS(TEMP_BOARD) + #if ANALOG_OK(TEMP_BOARD_PIN) + REPORT_NAME_ANALOG(__LINE__, TEMP_BOARD_PIN) + #endif +#endif #if PIN_EXISTS(TEMP_CHAMBER) #if ANALOG_OK(TEMP_CHAMBER_PIN) REPORT_NAME_ANALOG(__LINE__, TEMP_CHAMBER_PIN) @@ -141,6 +156,11 @@ REPORT_NAME_ANALOG(__LINE__, TEMP_COOLER_PIN) #endif #endif +#if PIN_EXISTS(TEMP_PROBE) + #if ANALOG_OK(TEMP_PROBE_PIN) + REPORT_NAME_ANALOG(__LINE__, TEMP_PROBE_PIN) + #endif +#endif #if PIN_EXISTS(ADC_KEYPAD) #if ANALOG_OK(ADC_KEYPAD_PIN) REPORT_NAME_ANALOG(__LINE__, ADC_KEYPAD_PIN) @@ -370,6 +390,9 @@ #if PIN_EXISTS(DIGIPOTSS) REPORT_NAME_DIGITAL(__LINE__, DIGIPOTSS_PIN) #endif +#if PIN_EXISTS(LCD_RESET) + REPORT_NAME_DIGITAL(__LINE__, LCD_RESET_PIN) +#endif #if _EXISTS(DOGLCD_A0) REPORT_NAME_DIGITAL(__LINE__, DOGLCD_A0) #endif @@ -433,6 +456,9 @@ #if PIN_EXISTS(E0_STEP) REPORT_NAME_DIGITAL(__LINE__, E0_STEP_PIN) #endif +#if PIN_EXISTS(E0_STDBY) + REPORT_NAME_DIGITAL(__LINE__, E0_STDBY_PIN) +#endif #if PIN_EXISTS(E1_AUTO_FAN) REPORT_NAME_DIGITAL(__LINE__, E1_AUTO_FAN_PIN) #endif @@ -457,6 +483,9 @@ #if PIN_EXISTS(E1_STEP) REPORT_NAME_DIGITAL(__LINE__, E1_STEP_PIN) #endif +#if PIN_EXISTS(E1_STDBY) + REPORT_NAME_DIGITAL(__LINE__, E1_STDBY_PIN) +#endif #if PIN_EXISTS(E2_AUTO_FAN) REPORT_NAME_DIGITAL(__LINE__, E2_AUTO_FAN_PIN) #endif @@ -481,6 +510,9 @@ #if PIN_EXISTS(E2_STEP) REPORT_NAME_DIGITAL(__LINE__, E2_STEP_PIN) #endif +#if PIN_EXISTS(E2_STDBY) + REPORT_NAME_DIGITAL(__LINE__, E2_STDBY_PIN) +#endif #if PIN_EXISTS(E3_AUTO_FAN) REPORT_NAME_DIGITAL(__LINE__, E3_AUTO_FAN_PIN) #endif @@ -505,6 +537,9 @@ #if PIN_EXISTS(E3_STEP) REPORT_NAME_DIGITAL(__LINE__, E3_STEP_PIN) #endif +#if PIN_EXISTS(E3_STDBY) + REPORT_NAME_DIGITAL(__LINE__, E3_STDBY_PIN) +#endif #if PIN_EXISTS(E4_AUTO_FAN) REPORT_NAME_DIGITAL(__LINE__, E4_AUTO_FAN_PIN) #endif @@ -529,6 +564,9 @@ #if PIN_EXISTS(E4_STEP) REPORT_NAME_DIGITAL(__LINE__, E4_STEP_PIN) #endif +#if PIN_EXISTS(E4_STDBY) + REPORT_NAME_DIGITAL(__LINE__, E4_STDBY_PIN) +#endif #if PIN_EXISTS(E5_AUTO_FAN) REPORT_NAME_DIGITAL(__LINE__, E5_AUTO_FAN_PIN) #endif @@ -553,6 +591,9 @@ #if PIN_EXISTS(E5_STEP) REPORT_NAME_DIGITAL(__LINE__, E5_STEP_PIN) #endif +#if PIN_EXISTS(E5_STDBY) + REPORT_NAME_DIGITAL(__LINE__, E5_STDBY_PIN) +#endif #if PIN_EXISTS(E6_AUTO_FAN) REPORT_NAME_DIGITAL(__LINE__, E6_AUTO_FAN_PIN) #endif @@ -577,6 +618,9 @@ #if PIN_EXISTS(E6_STEP) REPORT_NAME_DIGITAL(__LINE__, E6_STEP_PIN) #endif +#if PIN_EXISTS(E6_STDBY) + REPORT_NAME_DIGITAL(__LINE__, E6_STDBY_PIN) +#endif #if PIN_EXISTS(E7_AUTO_FAN) REPORT_NAME_DIGITAL(__LINE__, E7_AUTO_FAN_PIN) #endif @@ -601,6 +645,9 @@ #if PIN_EXISTS(E7_STEP) REPORT_NAME_DIGITAL(__LINE__, E7_STEP_PIN) #endif +#if PIN_EXISTS(E7_STDBY) + REPORT_NAME_DIGITAL(__LINE__, E7_STDBY_PIN) +#endif #if _EXISTS(ENET_CRS) REPORT_NAME_DIGITAL(__LINE__, ENET_CRS) #endif @@ -704,6 +751,9 @@ #if PIN_EXISTS(POWER_LOSS) REPORT_NAME_DIGITAL(__LINE__, POWER_LOSS_PIN) #endif +#if PIN_EXISTS(SAFE_POWER) + REPORT_NAME_DIGITAL(__LINE__, SAFE_POWER_PIN) +#endif #if PIN_EXISTS(FIL_RUNOUT) REPORT_NAME_DIGITAL(__LINE__, FIL_RUNOUT_PIN) #endif @@ -806,6 +856,15 @@ #if PIN_EXISTS(LED) REPORT_NAME_DIGITAL(__LINE__, LED_PIN) #endif +#if PIN_EXISTS(LED2) + REPORT_NAME_DIGITAL(__LINE__, LED2_PIN) +#endif +#if PIN_EXISTS(LED3) + REPORT_NAME_DIGITAL(__LINE__, LED3_PIN) +#endif +#if PIN_EXISTS(LED4) + REPORT_NAME_DIGITAL(__LINE__, LED4_PIN) +#endif #if PIN_EXISTS(LED_RED) REPORT_NAME_DIGITAL(__LINE__, LED_RED_PIN) #endif @@ -870,6 +929,12 @@ #if PIN_EXISTS(MOTOR_CURRENT_PWM_E) REPORT_NAME_DIGITAL(__LINE__, MOTOR_CURRENT_PWM_E_PIN) #endif +#if PIN_EXISTS(MOTOR_CURRENT_PWM_E0) + REPORT_NAME_DIGITAL(__LINE__, MOTOR_CURRENT_PWM_E0_PIN) +#endif +#if PIN_EXISTS(MOTOR_CURRENT_PWM_E1) + REPORT_NAME_DIGITAL(__LINE__, MOTOR_CURRENT_PWM_E1_PIN) +#endif #if PIN_EXISTS(MOTOR_CURRENT_PWM_X) REPORT_NAME_DIGITAL(__LINE__, MOTOR_CURRENT_PWM_X_PIN) #endif @@ -1146,6 +1211,9 @@ #if PIN_EXISTS(X_STEP) REPORT_NAME_DIGITAL(__LINE__, X_STEP_PIN) #endif +#if PIN_EXISTS(X_STDBY) + REPORT_NAME_DIGITAL(__LINE__, X_STDBY_PIN) +#endif #if PIN_EXISTS(X_STOP) REPORT_NAME_DIGITAL(__LINE__, X_STOP_PIN) #endif @@ -1209,6 +1277,9 @@ #if PIN_EXISTS(Y_STEP) REPORT_NAME_DIGITAL(__LINE__, Y_STEP_PIN) #endif +#if PIN_EXISTS(Y_STDBY) + REPORT_NAME_DIGITAL(__LINE__, Y_STDBY_PIN) +#endif #if PIN_EXISTS(Y_STOP) REPORT_NAME_DIGITAL(__LINE__, Y_STOP_PIN) #endif @@ -1272,6 +1343,9 @@ #if PIN_EXISTS(Z_STEP) REPORT_NAME_DIGITAL(__LINE__, Z_STEP_PIN) #endif +#if PIN_EXISTS(Z_STDBY) + REPORT_NAME_DIGITAL(__LINE__, Z_STDBY_PIN) +#endif #if PIN_EXISTS(Z_STOP) REPORT_NAME_DIGITAL(__LINE__, Z_STOP_PIN) #endif @@ -1290,6 +1364,9 @@ #if PIN_EXISTS(Z2_MIN) REPORT_NAME_DIGITAL(__LINE__, Z2_MIN_PIN) #endif +#if PIN_EXISTS(Z2_DIAG) + REPORT_NAME_DIGITAL(__LINE__, Z2_DIAG_PIN) +#endif #if PIN_EXISTS(Z2_MS1) REPORT_NAME_DIGITAL(__LINE__, Z2_MS1_PIN) #endif @@ -1302,6 +1379,9 @@ #if PIN_EXISTS(Z2_STEP) REPORT_NAME_DIGITAL(__LINE__, Z2_STEP_PIN) #endif +#if PIN_EXISTS(Z2_STOP) + REPORT_NAME_DIGITAL(__LINE__, Z2_STOP_PIN) +#endif #if PIN_EXISTS(Z3_CS) REPORT_NAME_DIGITAL(__LINE__, Z3_CS_PIN) #endif @@ -1584,6 +1664,24 @@ #if PIN_EXISTS(E7_SERIAL_RX) REPORT_NAME_DIGITAL(__LINE__, E7_SERIAL_RX_PIN) #endif +#if PIN_EXISTS(I_SERIAL_TX) + REPORT_NAME_DIGITAL(__LINE__, I_SERIAL_TX_PIN) +#endif +#if PIN_EXISTS(I_SERIAL_RX) + REPORT_NAME_DIGITAL(__LINE__, I_SERIAL_RX_PIN) +#endif +#if PIN_EXISTS(J_SERIAL_TX) + REPORT_NAME_DIGITAL(__LINE__, J_SERIAL_TX_PIN) +#endif +#if PIN_EXISTS(J_SERIAL_RX) + REPORT_NAME_DIGITAL(__LINE__, J_SERIAL_RX_PIN) +#endif +#if PIN_EXISTS(K_SERIAL_TX) + REPORT_NAME_DIGITAL(__LINE__, K_SERIAL_TX_PIN) +#endif +#if PIN_EXISTS(K_SERIAL_RX) + REPORT_NAME_DIGITAL(__LINE__, K_SERIAL_RX_PIN) +#endif #if PIN_EXISTS(L6470_CHAIN_SCK) REPORT_NAME_DIGITAL(__LINE__, L6470_CHAIN_SCK_PIN) #endif From 40477e031f16c2ecde535bc4ddae65c986060c9a Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Tue, 2 Nov 2021 12:36:22 +1300 Subject: [PATCH 087/125] =?UTF-8?q?=F0=9F=90=9B=20Fix=20Y=5FSERIAL=5FRX=5F?= =?UTF-8?q?PIN=20for=20FYSETC=20S6=20(#23055)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/stm32f4/pins_FYSETC_S6.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/pins/stm32f4/pins_FYSETC_S6.h b/Marlin/src/pins/stm32f4/pins_FYSETC_S6.h index e2454b578d..37a48cab7f 100644 --- a/Marlin/src/pins/stm32f4/pins_FYSETC_S6.h +++ b/Marlin/src/pins/stm32f4/pins_FYSETC_S6.h @@ -128,7 +128,7 @@ #define Y_SERIAL_TX_PIN PE14 #endif #ifndef Y_SERIAL_RX_PIN - #define Y_SERIAL_RX_PIN PE13 + #define Y_SERIAL_RX_PIN PC4 #endif #ifndef Z_SERIAL_TX_PIN #define Z_SERIAL_TX_PIN PD11 From 6af344c19329b51307d38463c4912651ac1dcdaa Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 2 Nov 2021 01:02:55 +0000 Subject: [PATCH 088/125] [cron] Bump distribution date (2021-11-02) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 1eb431186e..607561a87d 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-11-01" +//#define STRING_DISTRIBUTION_DATE "2021-11-02" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index aef8d8b60b..c0dbd45fa2 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-11-01" + #define STRING_DISTRIBUTION_DATE "2021-11-02" #endif /** From 7942f71d26b58630a841f2de2d4f2abaa4120395 Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Mon, 1 Nov 2021 20:23:24 -0700 Subject: [PATCH 089/125] =?UTF-8?q?=E2=9C=A8=20Artillery=20Ruby=20(STM32F4?= =?UTF-8?q?01RCT6)=20(#23029)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/STM32/HAL.cpp | 2 +- Marlin/src/core/boards.h | 1 + Marlin/src/pins/pins.h | 2 + Marlin/src/pins/stm32f4/pins_ARTILLERY_RUBY.h | 182 +++++++ .../boards/marlin_Artillery_Ruby.json | 60 +++ .../scripts/STM32F103RC_MEEB_3DP.py | 18 - .../PlatformIO/scripts/STM32F103RC_fysetc.py | 1 - .../MARLIN_ARTILLERY_RUBY/PeripheralPins.c | 247 +++++++++ .../MARLIN_ARTILLERY_RUBY/PinNamesVar.h | 33 ++ .../MARLIN_ARTILLERY_RUBY/hal_conf_custom.h | 496 ++++++++++++++++++ .../MARLIN_ARTILLERY_RUBY/ldscript.ld | 196 +++++++ .../MARLIN_ARTILLERY_RUBY/variant.cpp | 172 ++++++ .../variants/MARLIN_ARTILLERY_RUBY/variant.h | 148 ++++++ ini/stm32f4.ini | 14 + 14 files changed, 1552 insertions(+), 20 deletions(-) create mode 100644 Marlin/src/pins/stm32f4/pins_ARTILLERY_RUBY.h create mode 100644 buildroot/share/PlatformIO/boards/marlin_Artillery_Ruby.json create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_ARTILLERY_RUBY/PeripheralPins.c create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_ARTILLERY_RUBY/PinNamesVar.h create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_ARTILLERY_RUBY/hal_conf_custom.h create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_ARTILLERY_RUBY/ldscript.ld create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_ARTILLERY_RUBY/variant.cpp create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_ARTILLERY_RUBY/variant.h diff --git a/Marlin/src/HAL/STM32/HAL.cpp b/Marlin/src/HAL/STM32/HAL.cpp index a04a24c112..0920a72ec1 100644 --- a/Marlin/src/HAL/STM32/HAL.cpp +++ b/Marlin/src/HAL/STM32/HAL.cpp @@ -154,7 +154,7 @@ void HAL_adc_start_conversion(const uint8_t adc_pin) { HAL_adc_result = analogRe uint16_t HAL_adc_get_result() { return HAL_adc_result; } // Reset the system to initiate a firmware flash -void flashFirmware(const int16_t) { HAL_reboot(); } +WEAK void flashFirmware(const int16_t) { HAL_reboot(); } // Maple Compatibility volatile uint32_t systick_uptime_millis = 0; diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 2341e6577b..789512c4ef 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -406,6 +406,7 @@ #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) +#define BOARD_ARTILLERY_RUBY 4237 // Artillery Ruby (STM32F401RCT6) // // ARM Cortex M7 diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 40bbe6b41b..369a78be7a 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -667,6 +667,8 @@ #include "stm32f4/pins_MKS_ROBIN_NANO_V1_3_F4.h" // STM32F4 env:mks_robin_nano_v1_3_f4 #elif MB(MKS_EAGLE) #include "stm32f4/pins_MKS_EAGLE.h" // STM32F4 env:mks_eagle +#elif MB(ARTILLERY_RUBY) + #include "stm32f4/pins_ARTILLERY_RUBY.h" // STM32F4 env:Artillery_Ruby // // ARM Cortex M7 diff --git a/Marlin/src/pins/stm32f4/pins_ARTILLERY_RUBY.h b/Marlin/src/pins/stm32f4/pins_ARTILLERY_RUBY.h new file mode 100644 index 0000000000..4cf9768fbe --- /dev/null +++ b/Marlin/src/pins/stm32f4/pins_ARTILLERY_RUBY.h @@ -0,0 +1,182 @@ +/** + * 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 + +#include "env_validate.h" + +#if HOTENDS > 1 || E_STEPPERS > 1 + #error "Artillery Ruby supports up to 1 hotends / E-steppers." +#endif + +#define BOARD_INFO_NAME "Artillery Ruby" + +#define FLASH_EEPROM_EMULATION +//#define I2C_EEPROM +//#define E2END 0xFFF // 4KB + +#define HAL_TIMER_RATE F_CPU + +// +// Limit Switches +// +#if (X_HOME_DIR == 1) + #define X_MIN_PIN -1 + #define X_MAX_PIN PA2 +#else + #define X_MIN_PIN PA2 + #define X_MAX_PIN -1 +#endif +#if (Y_HOME_DIR == 1) + #define Y_MIN_PIN -1 + #define Y_MAX_PIN PA1 +#else + #define Y_MIN_PIN PA1 + #define Y_MAX_PIN -1 +#endif +#if (Z_HOME_DIR == 1) + #define Z_MIN_PIN PC2 + #define Z_MAX_PIN PA0 +#else + #define Z_MIN_PIN PA0 + #define Z_MAX_PIN PC2 +#endif + +// +// Steppers +// +#define X_STEP_PIN PB14 +#define X_DIR_PIN PB13 +#define X_ENABLE_PIN PB15 + +#define Y_STEP_PIN PB10 +#define Y_DIR_PIN PB2 +#define Y_ENABLE_PIN PB12 + +#define Z_STEP_PIN PB0 +#define Z_DIR_PIN PC5 +#define Z_ENABLE_PIN PB1 + +#define E0_STEP_PIN PA7 +#define E0_DIR_PIN PA6 +#define E0_ENABLE_PIN PC4 + +#define E1_STEP_PIN PA4 +#define E1_DIR_PIN PA3 +#define E1_ENABLE_PIN PA5 + +// +// Temperature Sensors +// +#define TEMP_0_PIN PC0 +#define TEMP_BED_PIN PC1 + +// +// Heaters / Fans +// +#ifndef HEATER_0_PIN + #define HEATER_0_PIN PC9 // Heater0 +#endif +#ifndef HEATER_BED_PIN + #define HEATER_BED_PIN PA8 // Hotbed +#endif +#ifndef FAN_PIN + #define FAN_PIN PC8 // Fan0 +#endif +#ifndef FAN1_PIN + #define FAN1_PIN PC7 // Fan1 +#endif +#ifndef FAN2_PIN + #define FAN2_PIN PC6 // Fan2 +#endif + +// +// Servos +// +#define SERVO0_PIN PC3 + +// +// SPI +// +#define SCK_PIN PC10 +#define MISO_PIN PC11 +#define MOSI_PIN PC12 + +// +// LCD / Controller +// +#if HAS_WIRED_LCD + #if EITHER(MKS_12864OLED, MKS_12864OLED_SSD1306) + #define LCD_PINS_DC PB8 // Set as output on init + #define LCD_PINS_RS PB9 // Pull low for 1s to init + // DOGM SPI LCD Support + #define DOGLCD_CS PC15 + #define DOGLCD_MOSI PB6 + #define DOGLCD_SCK PB5 + #define DOGLCD_A0 LCD_PINS_DC + #elif ENABLED(FYSETC_MINI_12864) + #define DOGLCD_CS PB6 + #define DOGLCD_A0 PC15 + + //#define FORCE_SOFT_SPI // Use this if default of hardware SPI causes display problems + // results in LCD soft SPI mode 3, SD soft SPI mode 0 + + #define LCD_RESET_PIN PB5 // Must be high or open for LCD to operate normally. + + #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) + #ifndef RGB_LED_R_PIN + #define RGB_LED_R_PIN PB9 + #endif + #ifndef RGB_LED_G_PIN + #define RGB_LED_G_PIN PB8 + #endif + #ifndef RGB_LED_B_PIN + #define RGB_LED_B_PIN PB7 + #endif + #elif ENABLED(FYSETC_MINI_12864_2_1) + #define NEOPIXEL_PIN PB9 + #endif + + #define DEFAULT_LCD_CONTRAST 255 + #else + #define LCD_PINS_RS PC15 + #define LCD_PINS_ENABLE PB6 + #define LCD_PINS_D4 PB5 + #define LCD_PINS_D5 PB9 + #define LCD_PINS_D6 PB8 + #endif + + #define LCD_PINS_D7 PB7 + + // + // Beeper, SD Card, Encoder + // + #define BEEPER_PIN PC13 + + #if ENABLED(SDSUPPORT) + #define SDSS PA15 + #define SD_DETECT_PIN PD2 + #endif + + #define BTN_EN1 PB4 + #define BTN_EN2 PB3 + #define BTN_ENC PC14 +#endif diff --git a/buildroot/share/PlatformIO/boards/marlin_Artillery_Ruby.json b/buildroot/share/PlatformIO/boards/marlin_Artillery_Ruby.json new file mode 100644 index 0000000000..e1c8333800 --- /dev/null +++ b/buildroot/share/PlatformIO/boards/marlin_Artillery_Ruby.json @@ -0,0 +1,60 @@ +{ + "build": { + "core": "stm32", + "cpu": "cortex-m4", + "extra_flags": "-DSTM32F401xx", + "f_cpu": "84000000L", + "hwids": [ + [ + "0x0483", + "0xDF11" + ] + ], + "mcu": "stm32f401rct6", + "variant": "MARLIN_ARTILLERY_RUBY" + }, + "debug": { + "jlink_device": "STM32F401RC", + "openocd_target": "stm32f4x", + "svd_path": "STM32F40x.svd", + "tools": { + "stlink": { + "server": { + "arguments": [ + "-f", + "scripts/interface/stlink.cfg", + "-c", + "transport select hla_swd", + "-f", + "scripts/target/stm32f4x.cfg", + "-c", + "reset_config none" + ], + "executable": "bin/openocd", + "package": "tool-openocd" + } + } + } + }, + "frameworks": [ + "arduino", + "stm32cube" + ], + "name": "STM32F401RC (64k RAM. 256k Flash)", + "upload": { + "disable_flushing": false, + "maximum_ram_size": 65536, + "maximum_size": 262144, + "protocol": "stlink", + "protocols": [ + "stlink", + "dfu", + "jlink" + ], + "require_upload_port": true, + "use_1200bps_touch": false, + "wait_for_upload_port": false + }, + "url": "https://www.st.com/en/evaluation-tools/steval-3dp001v1.html", + "vendor": "Generic" +} diff --git a/buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py b/buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py index 03e121c435..e059d44578 100644 --- a/buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py +++ b/buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py @@ -8,37 +8,19 @@ except ImportError: import os Import("env", "projenv") -# access to global build environment -print(env) -# access to project build environment (is used source files in "src" folder) -print(projenv) config = configparser.ConfigParser() config.read("platformio.ini") -#com_port = config.get("env:STM32F103RC_meeb", "upload_port") -#print('Use the {0:s} to reboot the board to dfu mode.'.format(com_port)) - # # Upload actions # - def before_upload(source, target, env): - print("before_upload") - # do some actions - # use com_port - # env.Execute("pwd") def after_upload(source, target, env): - print("after_upload") - # do some actions - # - # env.Execute("pwd") -print("Current build targets", map(str, BUILD_TARGETS)) - env.AddPreAction("upload", before_upload) env.AddPostAction("upload", after_upload) diff --git a/buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py b/buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py index 668475dc01..07f6548b18 100644 --- a/buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py +++ b/buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py @@ -1,7 +1,6 @@ # # buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py # -import os from os.path import join from os.path import expandvars Import("env") diff --git a/buildroot/share/PlatformIO/variants/MARLIN_ARTILLERY_RUBY/PeripheralPins.c b/buildroot/share/PlatformIO/variants/MARLIN_ARTILLERY_RUBY/PeripheralPins.c new file mode 100644 index 0000000000..b2783d8c31 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_ARTILLERY_RUBY/PeripheralPins.c @@ -0,0 +1,247 @@ +/* + ******************************************************************************* + * Copyright (c) 2019, STMicroelectronics + * All rights reserved. + * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ******************************************************************************* + * Automatically generated from STM32F401R(B-C)Tx.xml + */ +#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 +WEAK const PinMap PinMap_ADC[] = { + {PA_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC1_IN0 + {PA_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC1_IN1 + {PA_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC1_IN2 + {PA_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC1_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_6, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC1_IN6 + {PA_7, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC1_IN7 + {PB_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC1_IN8 + {PB_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC1_IN9 + {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 + {PC_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC1_IN15 + {NC, NP, 0} +}; +#endif + +//*** No DAC *** + +//*** I2C *** + +#ifdef HAL_I2C_MODULE_ENABLED +WEAK const PinMap PinMap_I2C_SDA[] = { + {PB_3, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF9_I2C2)}, + {PB_4, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF9_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_9, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_I2C_MODULE_ENABLED +WEAK 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)}, + {NC, NP, 0} +}; +#endif + +//*** PWM *** + +#ifdef HAL_TIM_MODULE_ENABLED +WEAK const PinMap PinMap_PWM[] = { + {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 + {PA_1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 2, 0)}, // TIM5_CH2 + {PA_2, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 + {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_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_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_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, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 + {PB_1, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N + {PB_1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 + {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_7, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2 + {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_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_15, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N + {PC_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + {PC_7, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_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 + {NC, NP, 0} +}; +#endif + +//*** SERIAL *** + +#ifdef HAL_UART_MODULE_ENABLED +WEAK const PinMap PinMap_UART_TX[] = { + {PA_2, 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)}, + {PA_11, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, + {PB_6, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PC_6, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +WEAK const PinMap PinMap_UART_RX[] = { + {PA_3, 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)}, + {PA_12, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, + {PB_7, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PC_7, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +WEAK 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)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +WEAK 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)}, + {NC, NP, 0} +}; +#endif + +//*** SPI *** + +#ifdef HAL_SPI_MODULE_ENABLED +WEAK const PinMap PinMap_SPI_MOSI[] = { + {PA_7, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {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_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 +WEAK 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 +WEAK const PinMap PinMap_SPI_SCLK[] = { + {PA_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {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_10, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +WEAK 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_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 + +//*** No CAN *** + +//*** No ETHERNET *** + +//*** No QUADSPI *** + +//*** USB *** + +#ifdef HAL_PCD_MODULE_ENABLED +WEAK 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, GPIO_AF_NONE)}, // 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} +}; +#endif + +//*** No USB_OTG_HS *** + +//*** SD *** + +#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 diff --git a/buildroot/share/PlatformIO/variants/MARLIN_ARTILLERY_RUBY/PinNamesVar.h b/buildroot/share/PlatformIO/variants/MARLIN_ARTILLERY_RUBY/PinNamesVar.h new file mode 100644 index 0000000000..3082f8842a --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_ARTILLERY_RUBY/PinNamesVar.h @@ -0,0 +1,33 @@ +/* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 +SYS_WKUP1 = PA_0, +#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_SOF = PA_8, +USB_OTG_FS_VBUS = PA_9, +USB_OTG_FS_ID = PA_10, +USB_OTG_FS_DM = PA_11, +USB_OTG_FS_DP = PA_12, +#endif diff --git a/buildroot/share/PlatformIO/variants/MARLIN_ARTILLERY_RUBY/hal_conf_custom.h b/buildroot/share/PlatformIO/variants/MARLIN_ARTILLERY_RUBY/hal_conf_custom.h new file mode 100644 index 0000000000..9fa98807d6 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_ARTILLERY_RUBY/hal_conf_custom.h @@ -0,0 +1,496 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_conf.h + * @brief HAL configuration file. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __STM32F4xx_HAL_CONF_CUSTOM +#define __STM32F4xx_HAL_CONF_CUSTOM + +#ifdef __cplusplus +extern "C" { +#endif + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ + +/* ########################## Module Selection ############################## */ + /** + * @brief This is the list of modules to be used in the HAL driver + */ +#define HAL_MODULE_ENABLED +#define HAL_ADC_MODULE_ENABLED +/* #define HAL_CAN_MODULE_ENABLED */ +/* #define HAL_CAN_LEGACY_MODULE_ENABLED */ +/* #define HAL_CRC_MODULE_ENABLED */ +/* #define HAL_CEC_MODULE_ENABLED */ +/* #define HAL_CRYP_MODULE_ENABLED */ +//#define HAL_DAC_MODULE_ENABLED +/* #define HAL_DCMI_MODULE_ENABLED */ +#define HAL_DMA_MODULE_ENABLED +/* #define HAL_DMA2D_MODULE_ENABLED */ +/* #define HAL_ETH_MODULE_ENABLED */ +#define HAL_FLASH_MODULE_ENABLED +/* #define HAL_NAND_MODULE_ENABLED */ +/* #define HAL_NOR_MODULE_ENABLED */ +/* #define HAL_PCCARD_MODULE_ENABLED */ +/* #define HAL_SRAM_MODULE_ENABLED */ +/* #define HAL_SDRAM_MODULE_ENABLED */ +/* #define HAL_HASH_MODULE_ENABLED */ +#define HAL_GPIO_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED +#define HAL_I2C_MODULE_ENABLED +/* #define HAL_SMBUS_MODULE_ENABLED */ +/* #define HAL_I2S_MODULE_ENABLED */ +/* #define HAL_IWDG_MODULE_ENABLED */ +/* #define HAL_LTDC_MODULE_ENABLED */ +/* #define HAL_DSI_MODULE_ENABLED */ +#define HAL_PWR_MODULE_ENABLED +/* #define HAL_QSPI_MODULE_ENABLED */ +#define HAL_RCC_MODULE_ENABLED +/* #define HAL_RNG_MODULE_ENABLED */ +/* #define HAL_RTC_MODULE_ENABLED */ +/* #define HAL_SAI_MODULE_ENABLED */ +/* #define HAL_SD_MODULE_ENABLED */ +#define HAL_SPI_MODULE_ENABLED +#define HAL_TIM_MODULE_ENABLED +/* #define HAL_UART_MODULE_ENABLED */ +/* #define HAL_USART_MODULE_ENABLED */ +/* #define HAL_IRDA_MODULE_ENABLED */ +/* #define HAL_SMARTCARD_MODULE_ENABLED */ +/* #define HAL_WWDG_MODULE_ENABLED */ +#define HAL_CORTEX_MODULE_ENABLED +#ifndef HAL_PCD_MODULE_ENABLED + #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) +#endif +/* #define HAL_HCD_MODULE_ENABLED */ +/* #define HAL_FMPI2C_MODULE_ENABLED */ +/* #define HAL_SPDIFRX_MODULE_ENABLED */ +/* #define HAL_DFSDM_MODULE_ENABLED */ +/* #define HAL_LPTIM_MODULE_ENABLED */ +/* #define HAL_MMC_MODULE_ENABLED */ + +/* ########################## HSE/HSI Values adaptation ##################### */ +/** + * @brief Adjust the value of External High Speed oscillator (HSE) used in your application. + * This value is used by the RCC HAL module to compute the system frequency + * (when HSE is used as system clock source, directly or through the PLL). + */ +#ifndef HSE_VALUE +#define HSE_VALUE 8000000U /*!< Value of the External oscillator in Hz */ +#endif /* HSE_VALUE */ + +#ifndef HSE_STARTUP_TIMEOUT +#define HSE_STARTUP_TIMEOUT 100U /*!< Time out for HSE start up, in ms */ +#endif /* HSE_STARTUP_TIMEOUT */ + +/** + * @brief Internal High Speed oscillator (HSI) value. + * This value is used by the RCC HAL module to compute the system frequency + * (when HSI is used as system clock source, directly or through the PLL). + */ +#ifndef HSI_VALUE +#define HSI_VALUE 16000000U /*!< Value of the Internal oscillator in Hz */ +#endif /* HSI_VALUE */ + +/** + * @brief Internal Low Speed oscillator (LSI) value. + */ +#ifndef LSI_VALUE +#define LSI_VALUE 32000U /*!< LSI Typical Value in Hz */ +#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz +The real value may vary depending on the variations +in voltage and temperature. */ +/** + * @brief External Low Speed oscillator (LSE) value. + */ +#ifndef LSE_VALUE +#define LSE_VALUE 32768U /*!< Value of the External Low Speed oscillator in Hz */ +#endif /* LSE_VALUE */ + +#ifndef LSE_STARTUP_TIMEOUT +#define LSE_STARTUP_TIMEOUT 5000U /*!< Time out for LSE start up, in ms */ +#endif /* LSE_STARTUP_TIMEOUT */ + +/** + * @brief External clock source for I2S peripheral + * This value is used by the I2S HAL module to compute the I2S clock source + * frequency, this source is inserted directly through I2S_CKIN pad. + */ +#ifndef EXTERNAL_CLOCK_VALUE +#define EXTERNAL_CLOCK_VALUE 12288000U /*!< Value of the External oscillator in Hz*/ +#endif /* EXTERNAL_CLOCK_VALUE */ + +/* Tip: To avoid modifying this file each time you need to use different HSE, + === you can define the HSE value in your toolchain compiler preprocessor. */ + +/* ########################### System Configuration ######################### */ +/** + * @brief This is the HAL system configuration section + */ +#if !defined (VDD_VALUE) +#define VDD_VALUE 3300U /*!< Value of VDD in mv */ +#endif +#if !defined (TICK_INT_PRIORITY) +#define TICK_INT_PRIORITY 0x00U /*!< tick interrupt priority */ +#endif +#if !defined (USE_RTOS) +#define USE_RTOS 0U +#endif +#if !defined (PREFETCH_ENABLE) +#define PREFETCH_ENABLE 1U +#endif +#if !defined (INSTRUCTION_CACHE_ENABLE) +#define INSTRUCTION_CACHE_ENABLE 1U +#endif +#if !defined (DATA_CACHE_ENABLE) +#define DATA_CACHE_ENABLE 1U +#endif + +#define USE_HAL_ADC_REGISTER_CALLBACKS 0U /* ADC register callback disabled */ +#define USE_HAL_CAN_REGISTER_CALLBACKS 0U /* CAN register callback disabled */ +#define USE_HAL_CEC_REGISTER_CALLBACKS 0U /* CEC register callback disabled */ +#define USE_HAL_CRYP_REGISTER_CALLBACKS 0U /* CRYP register callback disabled */ +#define USE_HAL_DAC_REGISTER_CALLBACKS 0U /* DAC register callback disabled */ +#define USE_HAL_DCMI_REGISTER_CALLBACKS 0U /* DCMI register callback disabled */ +#define USE_HAL_DFSDM_REGISTER_CALLBACKS 0U /* DFSDM register callback disabled */ +#define USE_HAL_DMA2D_REGISTER_CALLBACKS 0U /* DMA2D register callback disabled */ +#define USE_HAL_DSI_REGISTER_CALLBACKS 0U /* DSI register callback disabled */ +#define USE_HAL_ETH_REGISTER_CALLBACKS 0U /* ETH register callback disabled */ +#define USE_HAL_HASH_REGISTER_CALLBACKS 0U /* HASH register callback disabled */ +#define USE_HAL_HCD_REGISTER_CALLBACKS 0U /* HCD register callback disabled */ +#define USE_HAL_I2C_REGISTER_CALLBACKS 0U /* I2C register callback disabled */ +#define USE_HAL_FMPI2C_REGISTER_CALLBACKS 0U /* FMPI2C register callback disabled */ +#define USE_HAL_I2S_REGISTER_CALLBACKS 0U /* I2S register callback disabled */ +#define USE_HAL_IRDA_REGISTER_CALLBACKS 0U /* IRDA register callback disabled */ +#define USE_HAL_LPTIM_REGISTER_CALLBACKS 0U /* LPTIM register callback disabled */ +#define USE_HAL_LTDC_REGISTER_CALLBACKS 0U /* LTDC register callback disabled */ +#define USE_HAL_MMC_REGISTER_CALLBACKS 0U /* MMC register callback disabled */ +#define USE_HAL_NAND_REGISTER_CALLBACKS 0U /* NAND register callback disabled */ +#define USE_HAL_NOR_REGISTER_CALLBACKS 0U /* NOR register callback disabled */ +#define USE_HAL_PCCARD_REGISTER_CALLBACKS 0U /* PCCARD register callback disabled */ +#define USE_HAL_PCD_REGISTER_CALLBACKS 0U /* PCD register callback disabled */ +#define USE_HAL_QSPI_REGISTER_CALLBACKS 0U /* QSPI register callback disabled */ +#define USE_HAL_RNG_REGISTER_CALLBACKS 0U /* RNG register callback disabled */ +#define USE_HAL_RTC_REGISTER_CALLBACKS 0U /* RTC register callback disabled */ +#define USE_HAL_SAI_REGISTER_CALLBACKS 0U /* SAI register callback disabled */ +#define USE_HAL_SD_REGISTER_CALLBACKS 0U /* SD register callback disabled */ +#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U /* SMARTCARD register callback disabled */ +#define USE_HAL_SDRAM_REGISTER_CALLBACKS 0U /* SDRAM register callback disabled */ +#define USE_HAL_SRAM_REGISTER_CALLBACKS 0U /* SRAM register callback disabled */ +#define USE_HAL_SPDIFRX_REGISTER_CALLBACKS 0U /* SPDIFRX register callback disabled */ +#define USE_HAL_SMBUS_REGISTER_CALLBACKS 0U /* SMBUS register callback disabled */ +#define USE_HAL_SPI_REGISTER_CALLBACKS 0U /* SPI register callback disabled */ +#define USE_HAL_TIM_REGISTER_CALLBACKS 0U /* TIM register callback disabled */ +#define USE_HAL_UART_REGISTER_CALLBACKS 0U /* UART register callback disabled */ +#define USE_HAL_USART_REGISTER_CALLBACKS 0U /* USART register callback disabled */ +#define USE_HAL_WWDG_REGISTER_CALLBACKS 0U /* WWDG register callback disabled */ + +/* ########################## Assert Selection ############################## */ +/** + * @brief Uncomment the line below to expanse the "assert_param" macro in the + * HAL drivers code + */ +/* #define USE_FULL_ASSERT 1U */ + +/* ################## Ethernet peripheral configuration ##################### */ + +/* Section 1 : Ethernet peripheral configuration */ + +/* MAC ADDRESS: MAC_ADDR0:MAC_ADDR1:MAC_ADDR2:MAC_ADDR3:MAC_ADDR4:MAC_ADDR5 */ +#define MAC_ADDR0 2U +#define MAC_ADDR1 0U +#define MAC_ADDR2 0U +#define MAC_ADDR3 0U +#define MAC_ADDR4 0U +#define MAC_ADDR5 0U + +/* Definition of the Ethernet driver buffers size and count */ +#define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */ +#define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */ +#define ETH_RXBUFNB ((uint32_t)4U) /* 4 Rx buffers of size ETH_RX_BUF_SIZE */ +#define ETH_TXBUFNB ((uint32_t)4U) /* 4 Tx buffers of size ETH_TX_BUF_SIZE */ + +/* Section 2: PHY configuration section */ + +/* DP83848_PHY_ADDRESS Address*/ +#define DP83848_PHY_ADDRESS 0x01U +/* PHY Reset delay these values are based on a 1 ms Systick interrupt*/ +#define PHY_RESET_DELAY 0x000000FFU +/* PHY Configuration delay */ +#define PHY_CONFIG_DELAY 0x00000FFFU + +#define PHY_READ_TO 0x0000FFFFU +#define PHY_WRITE_TO 0x0000FFFFU + +/* Section 3: Common PHY Registers */ + +#define PHY_BCR ((uint16_t)0x0000) /*!< Transceiver Basic Control Register */ +#define PHY_BSR ((uint16_t)0x0001) /*!< Transceiver Basic Status Register */ + +#define PHY_RESET ((uint16_t)0x8000) /*!< PHY Reset */ +#define PHY_LOOPBACK ((uint16_t)0x4000) /*!< Select loop-back mode */ +#define PHY_FULLDUPLEX_100M ((uint16_t)0x2100) /*!< Set the full-duplex mode at 100 Mb/s */ +#define PHY_HALFDUPLEX_100M ((uint16_t)0x2000) /*!< Set the half-duplex mode at 100 Mb/s */ +#define PHY_FULLDUPLEX_10M ((uint16_t)0x0100) /*!< Set the full-duplex mode at 10 Mb/s */ +#define PHY_HALFDUPLEX_10M ((uint16_t)0x0000) /*!< Set the half-duplex mode at 10 Mb/s */ +#define PHY_AUTONEGOTIATION ((uint16_t)0x1000) /*!< Enable auto-negotiation function */ +#define PHY_RESTART_AUTONEGOTIATION ((uint16_t)0x0200) /*!< Restart auto-negotiation function */ +#define PHY_POWERDOWN ((uint16_t)0x0800) /*!< Select the power down mode */ +#define PHY_ISOLATE ((uint16_t)0x0400) /*!< Isolate PHY from MII */ + +#define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020) /*!< Auto-Negotiation process completed */ +#define PHY_LINKED_STATUS ((uint16_t)0x0004) /*!< Valid link established */ +#define PHY_JABBER_DETECTION ((uint16_t)0x0002) /*!< Jabber condition detected */ + +/* Section 4: Extended PHY Registers */ +#define PHY_SR ((uint16_t)0x10U) /*!< PHY status register Offset */ + +#define PHY_SPEED_STATUS ((uint16_t)0x0002U) /*!< PHY Speed mask */ +#define PHY_DUPLEX_STATUS ((uint16_t)0x0004U) /*!< PHY Duplex mask */ + +/* ################## SPI peripheral configuration ########################## */ + +/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver + * Activated: CRC code is present inside driver + * Deactivated: CRC code cleaned from driver + */ +#ifndef USE_SPI_CRC +#define USE_SPI_CRC 0U +#endif + +/* Includes ------------------------------------------------------------------*/ +/** + * @brief Include module's header file + */ + +#ifdef HAL_RCC_MODULE_ENABLED +#include "stm32f4xx_hal_rcc.h" +#endif /* HAL_RCC_MODULE_ENABLED */ + +#ifdef HAL_GPIO_MODULE_ENABLED +#include "stm32f4xx_hal_gpio.h" +#endif /* HAL_GPIO_MODULE_ENABLED */ + +#ifdef HAL_EXTI_MODULE_ENABLED +#include "stm32f4xx_hal_exti.h" +#endif /* HAL_EXTI_MODULE_ENABLED */ + +#ifdef HAL_DMA_MODULE_ENABLED +#include "stm32f4xx_hal_dma.h" +#endif /* HAL_DMA_MODULE_ENABLED */ + +#ifdef HAL_CORTEX_MODULE_ENABLED +#include "stm32f4xx_hal_cortex.h" +#endif /* HAL_CORTEX_MODULE_ENABLED */ + +#ifdef HAL_ADC_MODULE_ENABLED +#include "stm32f4xx_hal_adc.h" +#endif /* HAL_ADC_MODULE_ENABLED */ + +#ifdef HAL_CAN_MODULE_ENABLED +#include "stm32f4xx_hal_can.h" +#endif /* HAL_CAN_MODULE_ENABLED */ + +#ifdef HAL_CAN_LEGACY_MODULE_ENABLED +#include "stm32f4xx_hal_can_legacy.h" +#endif /* HAL_CAN_LEGACY_MODULE_ENABLED */ + +#ifdef HAL_CRC_MODULE_ENABLED +#include "stm32f4xx_hal_crc.h" +#endif /* HAL_CRC_MODULE_ENABLED */ + +#ifdef HAL_CRYP_MODULE_ENABLED +#include "stm32f4xx_hal_cryp.h" +#endif /* HAL_CRYP_MODULE_ENABLED */ + +#ifdef HAL_DMA2D_MODULE_ENABLED +#include "stm32f4xx_hal_dma2d.h" +#endif /* HAL_DMA2D_MODULE_ENABLED */ + +#ifdef HAL_DAC_MODULE_ENABLED +#include "stm32f4xx_hal_dac.h" +#endif /* HAL_DAC_MODULE_ENABLED */ + +#ifdef HAL_DCMI_MODULE_ENABLED +#include "stm32f4xx_hal_dcmi.h" +#endif /* HAL_DCMI_MODULE_ENABLED */ + +#ifdef HAL_ETH_MODULE_ENABLED +#include "stm32f4xx_hal_eth.h" +#endif /* HAL_ETH_MODULE_ENABLED */ + +#ifdef HAL_FLASH_MODULE_ENABLED +#include "stm32f4xx_hal_flash.h" +#endif /* HAL_FLASH_MODULE_ENABLED */ + +#ifdef HAL_SRAM_MODULE_ENABLED +#include "stm32f4xx_hal_sram.h" +#endif /* HAL_SRAM_MODULE_ENABLED */ + +#ifdef HAL_NOR_MODULE_ENABLED +#include "stm32f4xx_hal_nor.h" +#endif /* HAL_NOR_MODULE_ENABLED */ + +#ifdef HAL_NAND_MODULE_ENABLED +#include "stm32f4xx_hal_nand.h" +#endif /* HAL_NAND_MODULE_ENABLED */ + +#ifdef HAL_PCCARD_MODULE_ENABLED +#include "stm32f4xx_hal_pccard.h" +#endif /* HAL_PCCARD_MODULE_ENABLED */ + +#ifdef HAL_SDRAM_MODULE_ENABLED +#include "stm32f4xx_hal_sdram.h" +#endif /* HAL_SDRAM_MODULE_ENABLED */ + +#ifdef HAL_HASH_MODULE_ENABLED +#include "stm32f4xx_hal_hash.h" +#endif /* HAL_HASH_MODULE_ENABLED */ + +#ifdef HAL_I2C_MODULE_ENABLED +#include "stm32f4xx_hal_i2c.h" +#endif /* HAL_I2C_MODULE_ENABLED */ + +#ifdef HAL_SMBUS_MODULE_ENABLED +#include "stm32f4xx_hal_smbus.h" +#endif /* HAL_SMBUS_MODULE_ENABLED */ + +#ifdef HAL_I2S_MODULE_ENABLED +#include "stm32f4xx_hal_i2s.h" +#endif /* HAL_I2S_MODULE_ENABLED */ + +#ifdef HAL_IWDG_MODULE_ENABLED +#include "stm32f4xx_hal_iwdg.h" +#endif /* HAL_IWDG_MODULE_ENABLED */ + +#ifdef HAL_LTDC_MODULE_ENABLED +#include "stm32f4xx_hal_ltdc.h" +#endif /* HAL_LTDC_MODULE_ENABLED */ + +#ifdef HAL_PWR_MODULE_ENABLED +#include "stm32f4xx_hal_pwr.h" +#endif /* HAL_PWR_MODULE_ENABLED */ + +#ifdef HAL_RNG_MODULE_ENABLED +#include "stm32f4xx_hal_rng.h" +#endif /* HAL_RNG_MODULE_ENABLED */ + +#ifdef HAL_RTC_MODULE_ENABLED +#include "stm32f4xx_hal_rtc.h" +#endif /* HAL_RTC_MODULE_ENABLED */ + +#ifdef HAL_SAI_MODULE_ENABLED +#include "stm32f4xx_hal_sai.h" +#endif /* HAL_SAI_MODULE_ENABLED */ + +#ifdef HAL_SD_MODULE_ENABLED +#include "stm32f4xx_hal_sd.h" +#endif /* HAL_SD_MODULE_ENABLED */ + +#ifdef HAL_SPI_MODULE_ENABLED +#include "stm32f4xx_hal_spi.h" +#endif /* HAL_SPI_MODULE_ENABLED */ + +#ifdef HAL_TIM_MODULE_ENABLED +#include "stm32f4xx_hal_tim.h" +#endif /* HAL_TIM_MODULE_ENABLED */ + +#ifdef HAL_UART_MODULE_ENABLED +#include "stm32f4xx_hal_uart.h" +#endif /* HAL_UART_MODULE_ENABLED */ + +#ifdef HAL_USART_MODULE_ENABLED +#include "stm32f4xx_hal_usart.h" +#endif /* HAL_USART_MODULE_ENABLED */ + +#ifdef HAL_IRDA_MODULE_ENABLED +#include "stm32f4xx_hal_irda.h" +#endif /* HAL_IRDA_MODULE_ENABLED */ + +#ifdef HAL_SMARTCARD_MODULE_ENABLED +#include "stm32f4xx_hal_smartcard.h" +#endif /* HAL_SMARTCARD_MODULE_ENABLED */ + +#ifdef HAL_WWDG_MODULE_ENABLED +#include "stm32f4xx_hal_wwdg.h" +#endif /* HAL_WWDG_MODULE_ENABLED */ + +#ifdef HAL_PCD_MODULE_ENABLED +#include "stm32f4xx_hal_pcd.h" +#endif /* HAL_PCD_MODULE_ENABLED */ + +#ifdef HAL_HCD_MODULE_ENABLED +#include "stm32f4xx_hal_hcd.h" +#endif /* HAL_HCD_MODULE_ENABLED */ + +#ifdef HAL_DSI_MODULE_ENABLED +#include "stm32f4xx_hal_dsi.h" +#endif /* HAL_DSI_MODULE_ENABLED */ + +#ifdef HAL_QSPI_MODULE_ENABLED +#include "stm32f4xx_hal_qspi.h" +#endif /* HAL_QSPI_MODULE_ENABLED */ + +#ifdef HAL_CEC_MODULE_ENABLED +#include "stm32f4xx_hal_cec.h" +#endif /* HAL_CEC_MODULE_ENABLED */ + +#ifdef HAL_FMPI2C_MODULE_ENABLED +#include "stm32f4xx_hal_fmpi2c.h" +#endif /* HAL_FMPI2C_MODULE_ENABLED */ + +#ifdef HAL_SPDIFRX_MODULE_ENABLED +#include "stm32f4xx_hal_spdifrx.h" +#endif /* HAL_SPDIFRX_MODULE_ENABLED */ + +#ifdef HAL_DFSDM_MODULE_ENABLED +#include "stm32f4xx_hal_dfsdm.h" +#endif /* HAL_DFSDM_MODULE_ENABLED */ + +#ifdef HAL_LPTIM_MODULE_ENABLED +#include "stm32f4xx_hal_lptim.h" +#endif /* HAL_LPTIM_MODULE_ENABLED */ + +#ifdef HAL_MMC_MODULE_ENABLED +#include "stm32f4xx_hal_mmc.h" +#endif /* HAL_MMC_MODULE_ENABLED */ + +/* Exported macro ------------------------------------------------------------*/ +#ifdef USE_FULL_ASSERT +/** + * @brief The assert_param macro is used for function's parameters check. + * @param expr If expr is false, it calls assert_failed function + * which reports the name of the source file and the source + * line number of the call that failed. + * If expr is true, it returns no value. + * @retval None + */ +#define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__)) +/* Exported functions ------------------------------------------------------- */ +void assert_failed(uint8_t *file, uint32_t line); +#else +#define assert_param(expr) ((void)0U) +#endif /* USE_FULL_ASSERT */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F4xx_HAL_CONF_CUSTOM_H */ + + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/buildroot/share/PlatformIO/variants/MARLIN_ARTILLERY_RUBY/ldscript.ld b/buildroot/share/PlatformIO/variants/MARLIN_ARTILLERY_RUBY/ldscript.ld new file mode 100644 index 0000000000..57c01c8df8 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_ARTILLERY_RUBY/ldscript.ld @@ -0,0 +1,196 @@ +/* +***************************************************************************** +** +** File : ldscript.ld +** +** Abstract : Linker script for STM32F401RETx Device with +** 512KByte FLASH, 96KByte 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 = 0x20010000; /* 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 +{ +BOOT (rx) : ORIGIN = 0x08000000, LENGTH = 16K +EMULATED_EEPROM (rx) : ORIGIN = 0x08004000, LENGTH = 16K +FLASH (rx) : ORIGIN = 0x08008000, LENGTH = 256K - 16K * 2 +RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K +} + +/* Define output sections */ +SECTIONS +{ + /* The startup code goes first into FLASH */ + .isr_vector : + { + . = ALIGN(4); + KEEP(*(.isr_vector)) /* Startup code */ + . = ALIGN(4); + } >BOOT + + .boot : + { + . = ALIGN(4); + *(.text.Reset_Handler) + . = ALIGN(4); + } >BOOT + + /* The program code and other data goes into FLASH */ + .text : + { + . = 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); + *(.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 + + + /* 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(4); + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(4); + } >RAM + + + + /* Remove information from the standard libraries */ + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : { *(.ARM.attributes) } +} + + diff --git a/buildroot/share/PlatformIO/variants/MARLIN_ARTILLERY_RUBY/variant.cpp b/buildroot/share/PlatformIO/variants/MARLIN_ARTILLERY_RUBY/variant.cpp new file mode 100644 index 0000000000..8f24d68e2f --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_ARTILLERY_RUBY/variant.cpp @@ -0,0 +1,172 @@ +/* + 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_12, //D27 + PB_13, //D28 + PB_14, //D29 + PB_15, //D30 + PC_0, //D31 + PC_1, //D32 + PC_2, //D33 + PC_3, //D34 + PC_4, //D35 + PC_5, //D36 + PC_6, //D37 + PC_7, //D38 + PC_8, //D39 + PC_9, //D40 + PC_10, //D41 + PC_11, //D42 + PC_12, //D43 + PC_13, //D44 + PC_14, //D45 + PC_15, //D46 + PD_2, //D47 + PH_0, //D48 + PH_1, //D49 + + //Duplicated ADC Pins + PA_0, //D50/A0 + PA_1, //D51/A1 + PA_2, //D52/A2 + PA_3, //D53/A3 + PA_4, //D54/A4 + PA_5, //D55/A5 + PA_6, //D56/A6 + PA_7, //D57/A7 + PB_0, //D58/A8 + PB_1, //D59/A9 + PC_0, //D60/A10 + PC_1, //D61/A11 + PC_2, //D62/A12 + PC_3, //D63/A13 + PC_4, //D64/A14 + PC_5 //D65/A15 +}; + +#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) = 84000000 + * HCLK(Hz) = 84000000 + * AHB Prescaler = 1 + * APB1 Prescaler = 2 + * APB2 Prescaler = 1 + * HSE Frequency(Hz) = 8000000 + * PLL_M = 8 + * PLL_N = 336 + * PLL_P = 4 + * PLL_Q = 7 + * VDD(V) = 3.3 + * Main regulator output voltage = Scale2 mode + * Flash Latency(WS) = 2 + * @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_SCALE2); + + /* Enable HSI Oscillator and activate PLL with HSI 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_DIV4; + RCC_OscInitStruct.PLL.PLLQ = 7; + if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { + /* Initialization Error */ + while (1); + } + /* 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_DIV2; + RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; + if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) { + /* Initialization Error */ + while (1); + } +} + +#ifdef __cplusplus +} +#endif + +void flashFirmware(const int16_t) { + *((unsigned long *)0x2000FFF0) = 0xDEADBEEF; // End of RAM + NVIC_SystemReset(); +} diff --git a/buildroot/share/PlatformIO/variants/MARLIN_ARTILLERY_RUBY/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_ARTILLERY_RUBY/variant.h new file mode 100644 index 0000000000..0c66ae89b8 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_ARTILLERY_RUBY/variant.h @@ -0,0 +1,148 @@ +/* + 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 PB12 27 //D27 +#define PB13 28 //D28 +#define PB14 29 //D29 +#define PB15 30 //D30 +#define PC0 31 //D31 +#define PC1 32 //D32 +#define PC2 33 //D33 +#define PC3 34 //D34 +#define PC4 35 //D35 +#define PC5 36 //D36 +#define PC6 37 //D37 +#define PC7 38 //D38 +#define PC8 39 //D39 +#define PC9 40 //D40 +#define PC10 41 //D41 +#define PC11 42 //D42 +#define PC12 43 //D43 +#define PC13 44 //D44 +#define PC14 45 //D45 +#define PC15 46 //D46 +#define PD2 47 //D47 +#define PH0 48 //D48 +#define PH1 49 //D49 + +// This must be a literal +#define NUM_DIGITAL_PINS 66 +// This must be a literal with a value less than or equal to to MAX_ANALOG_INPUTS +#define NUM_ANALOG_INPUTS 16 +#define NUM_ANALOG_FIRST 50 + +/* +// PWM resolution +#define PWM_RESOLUTION 8 +#define PWM_FREQUENCY 20000 // >= 20 Khz => inaudible noise for fans +#define PWM_MAX_DUTY_CYCLE 255 +*/ + +// SPI Definitions +#define PIN_SPI_MOSI PC12 +#define PIN_SPI_MISO PC11 +#define PIN_SPI_SCK PC10 +#define PIN_SPI_SS PA15 + +// Timer Definitions +// TIM1 - Hardware PWM (HB) +// TIM2 - TIMER_SERVO +// TIM3 - Hardware PWM (FAN0/1/2, HE0) +// TIM4 - Hardware PWM (LED_R/G/B) +// TIM5 - TIMER_TONE +// TIM9 - STEP_TIMER +// TIM10 - TEMP_TIMER +// TIM11 - +#define TIMER_SERVO TIM2 +#define TIMER_TONE TIM5 + +// UART Definitions +#define SERIAL_UART_INSTANCE 1 + +// Default pin used for 'Serial' instance (ex: ST-Link) +// Mandatory for Firmata +#define PIN_SERIAL_RX PA10 +#define PIN_SERIAL_TX PA9 + +#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 Serial +#endif + +#endif /* _VARIANT_ARDUINO_STM32_ */ diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 850807585f..0e9b507c8b 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -564,3 +564,17 @@ build_unflags = ${stm32_variant.build_unflags} -DUSBCON -DUSBD_USE_CDC debug_tool = jlink upload_protocol = jlink + +# +# Artillery Ruby +# +[env:Artillery_Ruby] +platform = ${common_stm32.platform} +extends = common_stm32 +board = marlin_Artillery_Ruby +build_flags = ${common_stm32.build_flags} + -DSTM32F401xC -DTARGET_STM32F4 -DDISABLE_GENERIC_SERIALUSB -DARDUINO_ARCH_STM32 + -DUSBD_USE_CDC_COMPOSITE -DUSE_USB_FS + -DUSB_PRODUCT=\"Artillery_3D_Printer\" +extra_scripts = ${common_stm32.extra_scripts} + pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py From 498937967482faf7b299c2119c258c8ce7090ce9 Mon Sep 17 00:00:00 2001 From: Robby Candra Date: Tue, 2 Nov 2021 10:29:23 +0700 Subject: [PATCH 090/125] =?UTF-8?q?=F0=9F=8E=A8=20Fix=20redefine=20warning?= =?UTF-8?q?s=20(#23061)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/pins_postprocess.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Marlin/src/pins/pins_postprocess.h b/Marlin/src/pins/pins_postprocess.h index a2fe2b9af3..d1047db0d7 100644 --- a/Marlin/src/pins/pins_postprocess.h +++ b/Marlin/src/pins/pins_postprocess.h @@ -1260,22 +1260,22 @@ // Disable unused endstop / probe pins // #define _STOP_IN_USE(N) (X2_USE_ENDSTOP == N || Y2_USE_ENDSTOP == N || Z2_USE_ENDSTOP == N || Z3_USE_ENDSTOP == N || Z4_USE_ENDSTOP == N) -#if _STOP_IN_USE(_XMAX_) +#if !defined(USE_XMAX_PLUG) && _STOP_IN_USE(_XMAX_) #define USE_XMAX_PLUG #endif -#if _STOP_IN_USE(_YMAX_) +#if !defined(USE_YMAX_PLUG) && _STOP_IN_USE(_YMAX_) #define USE_YMAX_PLUG #endif -#if _STOP_IN_USE(_ZMAX_) +#if !defined(USE_ZMAX_PLUG) && _STOP_IN_USE(_ZMAX_) #define USE_ZMAX_PLUG #endif -#if _STOP_IN_USE(_XMIN_) +#if !defined(USE_XMIN_PLUG) && _STOP_IN_USE(_XMIN_) #define USE_XMIN_PLUG #endif -#if _STOP_IN_USE(_YMIN_) +#if !defined(USE_YMIN_PLUG) && _STOP_IN_USE(_YMIN_) #define USE_YMIN_PLUG #endif -#if _STOP_IN_USE(_ZMIN_) +#if !defined(USE_ZMIN_PLUG) && _STOP_IN_USE(_ZMIN_) #define USE_ZMIN_PLUG #endif #undef _STOP_IN_USE From a57355ee06e59fb3d89ab56f8749eb5549efbee3 Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Mon, 1 Nov 2021 21:23:54 -0700 Subject: [PATCH 091/125] =?UTF-8?q?=E2=9C=A8=20Allow=20Low=20EJERK=20with?= =?UTF-8?q?=20LA,=20optional=20(#23054)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 1 + Marlin/src/inc/SanityCheck.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index aa6fffd44e..934ceceafd 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1913,6 +1913,7 @@ #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed //#define LA_DEBUG // If enabled, this will generate debug information output over USB. //#define EXPERIMENTAL_SCURVE // Enable this option to permit S-Curve Acceleration + //#define ALLOW_LOW_EJERK // Allow a DEFAULT_EJERK value of <10. Recommended for direct drive hotends. #endif // @section leveling diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index c8d30a2718..b4eaf242b7 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1246,8 +1246,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "LIN_ADVANCE and S_CURVE_ACCELERATION may not play well together! Enable EXPERIMENTAL_SCURVE to continue." #elif ENABLED(DIRECT_STEPPING) #error "DIRECT_STEPPING is incompatible with LIN_ADVANCE. Enable in external planner if possible." - #elif !HAS_JUNCTION_DEVIATION && defined(DEFAULT_EJERK) - static_assert(DEFAULT_EJERK >= 10, "It is strongly recommended to set DEFAULT_EJERK >= 10 when using LIN_ADVANCE."); + #elif NONE(HAS_JUNCTION_DEVIATION, ALLOW_LOW_EJERK) && defined(DEFAULT_EJERK) + static_assert(DEFAULT_EJERK >= 10, "It is strongly recommended to set DEFAULT_EJERK >= 10 when using LIN_ADVANCE. Enable ALLOW_LOW_EJERK to bypass this alert (e.g., for direct drive)."); #endif #endif From 767a15d468ab6859eec19600541ad21dff757d1a Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Mon, 1 Nov 2021 22:43:40 -0700 Subject: [PATCH 092/125] =?UTF-8?q?=F0=9F=94=A7=20Endstop=20/=20DIAG=20hom?= =?UTF-8?q?ing=20conflict=20warning=20(#23050)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/gcode.h | 2 +- Marlin/src/inc/Warnings.cpp | 9 +++++++++ Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h | 4 +++- Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h | 2 ++ Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h | 2 ++ Marlin/src/pins/lpc1769/pins_BTT_SKR_E3_TURBO.h | 2 ++ Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h | 2 ++ Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h | 2 ++ Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h | 5 +++-- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h | 1 + Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h | 8 +++++--- Marlin/src/pins/stm32f4/pins_BTT_E3_RRF.h | 2 ++ Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h | 9 ++++----- Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h | 6 +++--- Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h | 5 +++-- Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h | 3 +-- Marlin/src/pins/stm32f4/pins_LERDGE_K.h | 3 +-- Marlin/src/pins/stm32f4/pins_LERDGE_S.h | 3 +-- Marlin/src/pins/stm32f4/pins_LERDGE_X.h | 3 +-- Marlin/src/pins/stm32f4/pins_MKS_MONSTER8.h | 4 ++-- Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h | 6 ++---- Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h | 3 +-- Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h | 3 +-- Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h | 3 +-- 24 files changed, 55 insertions(+), 37 deletions(-) diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 09dd53d6f6..d7bacaef32 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -1130,7 +1130,7 @@ private: static void M913(); static void M913_report(const bool forReplay=true); #endif - #if ENABLED(USE_SENSORLESS) + #if USE_SENSORLESS static void M914(); static void M914_report(const bool forReplay=true); #endif diff --git a/Marlin/src/inc/Warnings.cpp b/Marlin/src/inc/Warnings.cpp index d258aefd82..2510949010 100644 --- a/Marlin/src/inc/Warnings.cpp +++ b/Marlin/src/inc/Warnings.cpp @@ -488,3 +488,12 @@ #if HOMING_Z_WITH_PROBE && IS_CARTESIAN && DISABLED(Z_SAFE_HOMING) #error "Z_SAFE_HOMING is recommended when homing with a probe. Enable Z_SAFE_HOMING or comment out this line to continue." #endif + +// +// Warn users of potential endstop/DIAG pin conflicts to prevent homing issues when not using sensorless homing +// +#if !USE_SENSORLESS && ENABLED(USES_DIAG_JUMPERS) + #warning "Motherboard DIAG jumpers must be removed when SENSORLESS_HOMING is disabled." +#elif !USE_SENSORLESS && ENABLED(USES_DIAG_PINS) + #warning "Driver DIAG pins must be physically removed unless SENSORLESS_HOMING is enabled. (See https://bit.ly/2ZPRlt0)" +#endif diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h index ec8f31b854..97d78c0d24 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h @@ -26,7 +26,9 @@ */ #define BOARD_INFO_NAME "BTT SKR V1.3" -#define LPC1768_IS_SKRV1_3 1 + +#define LPC1768_IS_SKRV1_3 +#define USES_DIAG_JUMPERS // // Trinamic Stallguard pins diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h index a072242adc..b9dc845c5b 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h @@ -35,6 +35,8 @@ #define BOARD_CUSTOM_BUILD_FLAGS -DLPC_PINCFG_UART3_P4_28 #endif +#define USES_DIAG_PINS + // // EEPROM // diff --git a/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h b/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h index d6b1eeab46..15afe7e238 100644 --- a/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h +++ b/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h @@ -30,6 +30,8 @@ #define BOARD_INFO_NAME "MKS SGen-L" #define BOARD_WEBSITE_URL "github.com/makerbase-mks/MKS-SGEN_L" +#define USES_DIAG_JUMPERS + // // Servos // diff --git a/Marlin/src/pins/lpc1769/pins_BTT_SKR_E3_TURBO.h b/Marlin/src/pins/lpc1769/pins_BTT_SKR_E3_TURBO.h index 9c514f8ca3..bdc49fc236 100644 --- a/Marlin/src/pins/lpc1769/pins_BTT_SKR_E3_TURBO.h +++ b/Marlin/src/pins/lpc1769/pins_BTT_SKR_E3_TURBO.h @@ -31,6 +31,8 @@ #define BOARD_INFO_NAME "BTT SKR E3 Turbo" #endif +#define USES_DIAG_JUMPERS + // Onboard I2C EEPROM #define I2C_EEPROM #define MARLIN_EEPROM_SIZE 0x1000 // 4KB (AT24C32) diff --git a/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h b/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h index bb39009f09..8107f11937 100644 --- a/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h +++ b/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h @@ -30,6 +30,8 @@ #define BOARD_INFO_NAME "MKS SGEN_L V2" #define BOARD_WEBSITE_URL "github.com/makerbase-mks" +#define USES_DIAG_JUMPERS + // // EEPROM, MKS SGEN_L V2.0 hardware has 4K EEPROM on the board // diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h index 48d38e2213..c132691c20 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h @@ -26,6 +26,8 @@ // Release PB3/PB4 (E0 STP/DIR) from JTAG pins #define DISABLE_JTAG +#define USES_DIAG_JUMPERS + // Ignore temp readings during development. //#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000 diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h index a221ce94c5..a34099120e 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h @@ -27,10 +27,11 @@ #include "env_validate.h" -#define BOARD_NO_NATIVE_USB - #define BOARD_WEBSITE_URL "github.com/makerbase-mks" +#define BOARD_NO_NATIVE_USB +#define USES_DIAG_JUMPERS + //#define DISABLE_DEBUG #define DISABLE_JTAG diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h index 3df6727d03..1cdee92b08 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h @@ -36,6 +36,7 @@ #define BOARD_INFO_NAME "MKS Robin nano V2.0" #define BOARD_NO_NATIVE_USB +#define USES_DIAG_PINS // Avoid conflict with TIMER_SERVO when using the STM32 HAL #define TEMP_TIMER 5 diff --git a/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h b/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h index 44485b0776..b7ffcce4a8 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h @@ -29,6 +29,11 @@ #define BOARD_INFO_NAME "BTT BTT002 V1.0" +#define USES_DIAG_PINS + +// Ignore temp readings during development. +//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000 + // Use one of these or SDCard-based Emulation will be used #if NO_EEPROM_SELECTED //#define SRAM_EEPROM_EMULATION // Use BackSRAM-based EEPROM emulation @@ -41,9 +46,6 @@ #define FLASH_EEPROM_LEVELING #endif -// Ignore temp readings during development. -//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000 - // // Limit Switches // diff --git a/Marlin/src/pins/stm32f4/pins_BTT_E3_RRF.h b/Marlin/src/pins/stm32f4/pins_BTT_E3_RRF.h index bd483ecf0a..d1f38f5c80 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_E3_RRF.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_E3_RRF.h @@ -29,6 +29,8 @@ #define BOARD_INFO_NAME "BTT E3 RRF" #endif +#define USES_DIAG_JUMPERS + // Add-on board for IDEX conversion //#define BTT_E3_RRF_IDEX_BOARD diff --git a/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h b/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h index 95f74efe84..dfa9d8a7b9 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h @@ -31,15 +31,14 @@ #define BOARD_INFO_NAME "BTT GTR V1.0" +#define USES_DIAG_JUMPERS +#define HAS_OTG_USB_HOST_SUPPORT // USB Flash Drive support +#define M5_EXTENDER // The M5 extender is attached + // Onboard I2C EEPROM #define I2C_EEPROM #define MARLIN_EEPROM_SIZE 0x2000 // 8KB (24C64 ... 64Kb = 8KB) -// USB Flash Drive support -#define HAS_OTG_USB_HOST_SUPPORT - -#define M5_EXTENDER // The M5 extender is attached - // // Servos // 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 655e65da47..6dc90bf910 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h @@ -23,15 +23,15 @@ #include "env_validate.h" +#define HAS_OTG_USB_HOST_SUPPORT // USB Flash Drive support +#define USES_DIAG_JUMPERS + // Onboard I2C EEPROM #define I2C_EEPROM #define MARLIN_EEPROM_SIZE 0x8000 // 32KB (24C32A) #define I2C_SCL_PIN PB8 #define I2C_SDA_PIN PB9 -// USB Flash Drive support -#define HAS_OTG_USB_HOST_SUPPORT - // Avoid conflict with TIMER_TONE #define STEP_TIMER 10 diff --git a/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h b/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h index 3314d0154d..ac049baa21 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h @@ -23,6 +23,8 @@ #include "env_validate.h" +#define USES_DIAG_JUMPERS + // If you have the BigTreeTech driver expansion module, enable BTT_MOTOR_EXPANSION // https://github.com/bigtreetech/BTT-Expansion-module/tree/master/BTT%20EXP-MOT //#define BTT_MOTOR_EXPANSION @@ -47,8 +49,7 @@ #define FLASH_EEPROM_LEVELING #endif -// USB Flash Drive support -#define HAS_OTG_USB_HOST_SUPPORT +#define HAS_OTG_USB_HOST_SUPPORT // USB Flash Drive support // // Servos diff --git a/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h b/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h index 50330932cf..9a280eac16 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h @@ -47,8 +47,7 @@ #define FLASH_EEPROM_LEVELING #endif -// USB Flash Drive support -#define HAS_OTG_USB_HOST_SUPPORT +#define HAS_OTG_USB_HOST_SUPPORT // USB Flash Drive support // Avoid conflict with TIMER_TONE #define STEP_TIMER 10 diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h index 6ad3849d11..099b3b79a4 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h @@ -40,8 +40,7 @@ #define MARLIN_EEPROM_SIZE 0x10000 #endif -// USB Flash Drive support -#define HAS_OTG_USB_HOST_SUPPORT +#define HAS_OTG_USB_HOST_SUPPORT // USB Flash Drive support // // Servos diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h index 68e5636955..c686e19ccb 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h @@ -34,8 +34,7 @@ #define STEP_TIMER 4 #define TEMP_TIMER 2 -// USB Flash Drive support -#define HAS_OTG_USB_HOST_SUPPORT +#define HAS_OTG_USB_HOST_SUPPORT // USB Flash Drive support // // Servos diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_X.h b/Marlin/src/pins/stm32f4/pins_LERDGE_X.h index 7f35c0f5dd..93526db442 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_X.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_X.h @@ -39,8 +39,7 @@ #define I2C_SDA_PIN PB9 #define MARLIN_EEPROM_SIZE 0x10000 // FM24CL64 F-RAM 64K (8Kx8) -// USB Flash Drive support -#define HAS_OTG_USB_HOST_SUPPORT +#define HAS_OTG_USB_HOST_SUPPORT // USB Flash Drive support // // Servos diff --git a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8.h b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8.h index 8fa211dc95..a7f853185e 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8.h @@ -32,8 +32,8 @@ #define BOARD_INFO_NAME "MKS Monster8 V1.x" -// USB Flash Drive support -#define HAS_OTG_USB_HOST_SUPPORT +#define HAS_OTG_USB_HOST_SUPPORT // USB Flash Drive support +#define USES_DIAG_JUMPERS //#define DISABLE_DEBUG diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h index 4dc73e0312..02140865f9 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h @@ -32,22 +32,20 @@ #define BOARD_INFO_NAME "MKS Robin Nano V3" +#define USES_DIAG_JUMPERS + #ifndef X_CS_PIN #define X_CS_PIN PD5 #endif - #ifndef Y_CS_PIN #define Y_CS_PIN PD7 #endif - #ifndef Z_CS_PIN #define Z_CS_PIN PD4 #endif - #ifndef E0_CS_PIN #define E0_CS_PIN PD9 #endif - #ifndef E1_CS_PIN #define E1_CS_PIN PD8 #endif diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h index c3e3963b55..256439e654 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h @@ -26,8 +26,7 @@ // MKS Robin Nano V3, MKS Eagle pinmap // -// USB Flash Drive support -#define HAS_OTG_USB_HOST_SUPPORT +#define HAS_OTG_USB_HOST_SUPPORT // USB Flash Drive support // Avoid conflict with TIMER_TONE #define STEP_TIMER 10 diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h index 46dec71c11..68b2385254 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h @@ -39,8 +39,7 @@ #define I2C_EEPROM #define MARLIN_EEPROM_SIZE 0x1000 // 4KB -// USB Flash Drive support -#define HAS_OTG_USB_HOST_SUPPORT +#define HAS_OTG_USB_HOST_SUPPORT // USB Flash Drive support // // Release PB4 (Y_ENABLE_PIN) from JTAG NRST role diff --git a/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h b/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h index 991c611a89..9eb0acf144 100644 --- a/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h +++ b/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h @@ -32,8 +32,7 @@ #define I2C_EEPROM #define MARLIN_EEPROM_SIZE 0x1000 // 4KB (24C32 ... 32Kb = 4KB) -// USB Flash Drive support -#define HAS_OTG_USB_HOST_SUPPORT +#define HAS_OTG_USB_HOST_SUPPORT // USB Flash Drive support // // Limit Switches From da830e6ced7f7c7e509e748104245064d1c1b265 Mon Sep 17 00:00:00 2001 From: Andrei M <22990561+andrei-moraru@users.noreply.github.com> Date: Tue, 2 Nov 2021 01:47:16 -0400 Subject: [PATCH 093/125] =?UTF-8?q?=E2=9A=97=EF=B8=8F=20Use=20pwm=5Fset=5F?= =?UTF-8?q?duty=20over=20analogWrite=20to=20set=20PWM=20(#23048)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/HAL/AVR/HAL.h | 2 +- Marlin/src/HAL/AVR/fast_pwm.cpp | 64 +++++++++++++-------------- Marlin/src/HAL/DUE/HAL.h | 5 +++ Marlin/src/HAL/ESP32/HAL.h | 4 ++ Marlin/src/HAL/LINUX/HAL.h | 3 ++ Marlin/src/HAL/LPC1768/fast_pwm.cpp | 16 +++---- Marlin/src/HAL/NATIVE_SIM/HAL.h | 3 ++ Marlin/src/HAL/SAMD51/HAL.h | 5 +++ Marlin/src/HAL/STM32/fast_pwm.cpp | 37 ++++++++-------- Marlin/src/HAL/STM32F1/HAL.cpp | 3 +- Marlin/src/HAL/STM32F1/fast_pwm.cpp | 60 ++++++++++++------------- Marlin/src/HAL/TEENSY31_32/HAL.h | 6 +++ Marlin/src/HAL/TEENSY35_36/HAL.h | 6 +++ Marlin/src/HAL/TEENSY40_41/HAL.cpp | 10 ++--- Marlin/src/HAL/TEENSY40_41/HAL.h | 8 +++- Marlin/src/feature/caselight.cpp | 2 +- Marlin/src/feature/controllerfan.cpp | 7 +-- Marlin/src/feature/leds/leds.cpp | 10 ++--- Marlin/src/feature/spindle_laser.cpp | 6 +-- Marlin/src/gcode/control/M42.cpp | 4 +- Marlin/src/lcd/dogm/marlinui_DOGM.cpp | 2 +- Marlin/src/lcd/tft/ui_common.cpp | 2 +- Marlin/src/module/endstops.cpp | 2 +- Marlin/src/module/planner.cpp | 6 +-- Marlin/src/module/stepper.cpp | 2 +- Marlin/src/module/temperature.cpp | 10 ++--- 26 files changed, 159 insertions(+), 126 deletions(-) diff --git a/Marlin/src/HAL/AVR/HAL.h b/Marlin/src/HAL/AVR/HAL.h index ecb566ed46..ad1f47a4e6 100644 --- a/Marlin/src/HAL/AVR/HAL.h +++ b/Marlin/src/HAL/AVR/HAL.h @@ -221,7 +221,7 @@ void set_pwm_frequency(const pin_t pin, int f_desired); /** * set_pwm_duty - * Sets the PWM duty cycle of the provided pin to the provided value + * Set the PWM duty cycle of the provided pin to the provided value * Optionally allows inverting the duty cycle [default = false] * Optionally allows changing the maximum size of the provided value to enable finer PWM duty control [default = 255] */ diff --git a/Marlin/src/HAL/AVR/fast_pwm.cpp b/Marlin/src/HAL/AVR/fast_pwm.cpp index 238c1124ad..2556fa0441 100644 --- a/Marlin/src/HAL/AVR/fast_pwm.cpp +++ b/Marlin/src/HAL/AVR/fast_pwm.cpp @@ -22,11 +22,10 @@ #ifdef __AVR__ #include "../../inc/MarlinConfigPre.h" +#include "HAL.h" #if NEEDS_HARDWARE_PWM // Specific meta-flag for features that mandate PWM -#include "HAL.h" - struct Timer { volatile uint8_t* TCCRnQ[3]; // max 3 TCCR registers per timer volatile uint16_t* OCRnQ[3]; // max 3 OCR registers per timer @@ -153,7 +152,7 @@ Timer get_pwm_timer(const pin_t pin) { void set_pwm_frequency(const pin_t pin, int f_desired) { Timer timer = get_pwm_timer(pin); - if (timer.n == 0) return; // Don't proceed if protected timer or not recognised + if (timer.n == 0) return; // Don't proceed if protected timer or not recognized uint16_t size; if (timer.n == 2) size = 255; else size = 65535; @@ -243,40 +242,39 @@ void set_pwm_frequency(const pin_t pin, int f_desired) { _SET_ICRn(timer.ICRn, res); // Set ICRn value (TOP) = res } +#endif // NEEDS_HARDWARE_PWM + void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255*/, const bool invert/*=false*/) { - // If v is 0 or v_size (max), digitalWrite to LOW or HIGH. - // Note that digitalWrite also disables pwm output for us (sets COM bit to 0) - if (v == 0) - digitalWrite(pin, invert); - else if (v == v_size) - digitalWrite(pin, !invert); - else { - Timer timer = get_pwm_timer(pin); - if (timer.n == 0) return; // Don't proceed if protected timer or not recognised - // Set compare output mode to CLEAR -> SET or SET -> CLEAR (if inverted) - _SET_COMnQ(timer.TCCRnQ, (timer.q - #ifdef TCCR2 - + (timer.q == 2) // COM20 is on bit 4 of TCCR2, thus requires q + 1 in the macro - #endif - ), COM_CLEAR_SET + invert - ); + #if NEEDS_HARDWARE_PWM - uint16_t top; - if (timer.n == 2) { // if TIMER2 - top = ( - #if ENABLED(USE_OCR2A_AS_TOP) - *timer.OCRnQ[0] // top = OCR2A - #else - 255 // top = 0xFF (max) - #endif + // If v is 0 or v_size (max), digitalWrite to LOW or HIGH. + // Note that digitalWrite also disables pwm output for us (sets COM bit to 0) + if (v == 0) + digitalWrite(pin, invert); + else if (v == v_size) + digitalWrite(pin, !invert); + else { + Timer timer = get_pwm_timer(pin); + if (timer.n == 0) return; // Don't proceed if protected timer or not recognized + // Set compare output mode to CLEAR -> SET or SET -> CLEAR (if inverted) + _SET_COMnQ(timer.TCCRnQ, (timer.q + #ifdef TCCR2 + + (timer.q == 2) // COM20 is on bit 4 of TCCR2, thus requires q + 1 in the macro + #endif + ), COM_CLEAR_SET + invert ); - } - else - top = *timer.ICRn; // top = ICRn - _SET_OCRnQ(timer.OCRnQ, timer.q, v * float(top) / float(v_size)); // Scale 8/16-bit v to top value - } + uint16_t top = (timer.n == 2) ? TERN(USE_OCR2A_AS_TOP, *timer.OCRnQ[0], 255) : *timer.ICRn; + _SET_OCRnQ(timer.OCRnQ, timer.q, (v * top + v_size / 2) / v_size); // Scale 8/16-bit v to top value + } + + #else + + analogWrite(pin, v); + UNUSED(v_size); + UNUSED(invert); + + #endif } -#endif // NEEDS_HARDWARE_PWM #endif // __AVR__ diff --git a/Marlin/src/HAL/DUE/HAL.h b/Marlin/src/HAL/DUE/HAL.h index fb90c40aa7..96ab5d9808 100644 --- a/Marlin/src/HAL/DUE/HAL.h +++ b/Marlin/src/HAL/DUE/HAL.h @@ -144,6 +144,11 @@ inline void HAL_adc_init() {}//todo void HAL_adc_start_conversion(const uint8_t ch); uint16_t HAL_adc_get_result(); +// +// PWM +// +inline void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t=255, const bool=false) { analogWrite(pin, v); } + // // Pin Map // diff --git a/Marlin/src/HAL/ESP32/HAL.h b/Marlin/src/HAL/ESP32/HAL.h index 8a8f6df640..8473e3c4e4 100644 --- a/Marlin/src/HAL/ESP32/HAL.h +++ b/Marlin/src/HAL/ESP32/HAL.h @@ -129,6 +129,10 @@ void HAL_adc_init(); void HAL_adc_start_conversion(const uint8_t adc_pin); +// PWM +inline void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t=255, const bool=false) { analogWrite(pin, v); } + +// Pin Map #define GET_PIN_MAP_PIN(index) index #define GET_PIN_MAP_INDEX(pin) pin #define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval) diff --git a/Marlin/src/HAL/LINUX/HAL.h b/Marlin/src/HAL/LINUX/HAL.h index b80fe210f8..d7d3a92b73 100644 --- a/Marlin/src/HAL/LINUX/HAL.h +++ b/Marlin/src/HAL/LINUX/HAL.h @@ -101,6 +101,9 @@ void HAL_adc_enable_channel(const uint8_t ch); void HAL_adc_start_conversion(const uint8_t ch); uint16_t HAL_adc_get_result(); +// PWM +inline void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t=255, const bool=false) { analogWrite(pin, v); } + // Reset source inline void HAL_clear_reset_source(void) {} inline uint8_t HAL_get_reset_source(void) { return RST_POWER_ON; } diff --git a/Marlin/src/HAL/LPC1768/fast_pwm.cpp b/Marlin/src/HAL/LPC1768/fast_pwm.cpp index dd440b5e77..70fc0e333d 100644 --- a/Marlin/src/HAL/LPC1768/fast_pwm.cpp +++ b/Marlin/src/HAL/LPC1768/fast_pwm.cpp @@ -22,18 +22,18 @@ #ifdef TARGET_LPC1768 #include "../../inc/MarlinConfigPre.h" - -#if NEEDS_HARDWARE_PWM // Specific meta-flag for features that mandate PWM - #include -void set_pwm_frequency(const pin_t pin, int f_desired) { - LPC176x::pwm_set_frequency(pin, f_desired); -} - void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255*/, const bool invert/*=false*/) { LPC176x::pwm_write_ratio(pin, invert ? 1.0f - (float)v / v_size : (float)v / v_size); } -#endif // NEEDS_HARDWARE_PWM +#if NEEDS_HARDWARE_PWM // Specific meta-flag for features that mandate PWM + + void set_pwm_frequency(const pin_t pin, int f_desired) { + LPC176x::pwm_set_frequency(pin, f_desired); + } + +#endif + #endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/NATIVE_SIM/HAL.h b/Marlin/src/HAL/NATIVE_SIM/HAL.h index 235c24808c..915339468b 100644 --- a/Marlin/src/HAL/NATIVE_SIM/HAL.h +++ b/Marlin/src/HAL/NATIVE_SIM/HAL.h @@ -133,6 +133,9 @@ void HAL_adc_enable_channel(const uint8_t ch); void HAL_adc_start_conversion(const uint8_t ch); uint16_t HAL_adc_get_result(); +// PWM +inline void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t=255, const bool=false) { analogWrite(pin, v); } + // Reset source inline void HAL_clear_reset_source(void) {} inline uint8_t HAL_get_reset_source(void) { return RST_POWER_ON; } diff --git a/Marlin/src/HAL/SAMD51/HAL.h b/Marlin/src/HAL/SAMD51/HAL.h index 775a9240e1..c262752a8d 100644 --- a/Marlin/src/HAL/SAMD51/HAL.h +++ b/Marlin/src/HAL/SAMD51/HAL.h @@ -127,6 +127,11 @@ void HAL_adc_init(); void HAL_adc_start_conversion(const uint8_t adc_pin); +// +// PWM +// +inline void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t=255, const bool=false) { analogWrite(pin, v); } + // // Pin Map // diff --git a/Marlin/src/HAL/STM32/fast_pwm.cpp b/Marlin/src/HAL/STM32/fast_pwm.cpp index 917e12615f..d4d695b969 100644 --- a/Marlin/src/HAL/STM32/fast_pwm.cpp +++ b/Marlin/src/HAL/STM32/fast_pwm.cpp @@ -24,26 +24,9 @@ #ifdef HAL_STM32 -#include "../../inc/MarlinConfigPre.h" - -#if NEEDS_HARDWARE_PWM - -#include "HAL.h" +#include "../../inc/MarlinConfig.h" #include "timers.h" -void set_pwm_frequency(const pin_t pin, int f_desired) { - if (!PWM_PIN(pin)) return; // Don't proceed if no hardware timer - - PinName pin_name = digitalPinToPinName(pin); - TIM_TypeDef *Instance = (TIM_TypeDef *)pinmap_peripheral(pin_name, PinMap_PWM); // Get HAL timer instance - - LOOP_S_L_N(i, 0, NUM_HARDWARE_TIMERS) // Protect used timers - if (timer_instance[i] && timer_instance[i]->getHandle()->Instance == Instance) - return; - - pwm_start(pin_name, f_desired, 0, RESOLUTION_8B_COMPARE_FORMAT); -} - void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255*/, const bool invert/*=false*/) { PinName pin_name = digitalPinToPinName(pin); TIM_TypeDef *Instance = (TIM_TypeDef *)pinmap_peripheral(pin_name, PinMap_PWM); @@ -58,5 +41,21 @@ void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255 } } -#endif // NEEDS_HARDWARE_PWM +#if NEEDS_HARDWARE_PWM + + void set_pwm_frequency(const pin_t pin, int f_desired) { + if (!PWM_PIN(pin)) return; // Don't proceed if no hardware timer + + PinName pin_name = digitalPinToPinName(pin); + TIM_TypeDef *Instance = (TIM_TypeDef *)pinmap_peripheral(pin_name, PinMap_PWM); // Get HAL timer instance + + LOOP_S_L_N(i, 0, NUM_HARDWARE_TIMERS) // Protect used timers + if (timer_instance[i] && timer_instance[i]->getHandle()->Instance == Instance) + return; + + pwm_start(pin_name, f_desired, 0, RESOLUTION_8B_COMPARE_FORMAT); + } + +#endif + #endif // HAL_STM32 diff --git a/Marlin/src/HAL/STM32F1/HAL.cpp b/Marlin/src/HAL/STM32F1/HAL.cpp index df1ba33d4a..f29b305361 100644 --- a/Marlin/src/HAL/STM32F1/HAL.cpp +++ b/Marlin/src/HAL/STM32F1/HAL.cpp @@ -449,8 +449,7 @@ uint16_t analogRead(pin_t pin) { // Wrapper to maple unprotected analogWrite void analogWrite(pin_t pin, int pwm_val8) { - if (PWM_PIN(pin)) - analogWrite(uint8_t(pin), pwm_val8); + if (PWM_PIN(pin)) analogWrite(uint8_t(pin), pwm_val8); } void HAL_reboot() { nvic_sys_reset(); } diff --git a/Marlin/src/HAL/STM32F1/fast_pwm.cpp b/Marlin/src/HAL/STM32F1/fast_pwm.cpp index 884d482af5..6a9d7e8a19 100644 --- a/Marlin/src/HAL/STM32F1/fast_pwm.cpp +++ b/Marlin/src/HAL/STM32F1/fast_pwm.cpp @@ -23,40 +23,10 @@ #include "../../inc/MarlinConfigPre.h" -#if NEEDS_HARDWARE_PWM - #include #include "HAL.h" #include "timers.h" -void set_pwm_frequency(const pin_t pin, int f_desired) { - if (!PWM_PIN(pin)) return; // Don't proceed if no hardware timer - - timer_dev *timer = PIN_MAP[pin].timer_device; - uint8_t channel = PIN_MAP[pin].timer_channel; - - // Protect used timers - if (timer == get_timer_dev(TEMP_TIMER_NUM)) return; - if (timer == get_timer_dev(STEP_TIMER_NUM)) return; - #if PULSE_TIMER_NUM != STEP_TIMER_NUM - if (timer == get_timer_dev(PULSE_TIMER_NUM)) return; - #endif - - if (!(timer->regs.bas->SR & TIMER_CR1_CEN)) // Ensure the timer is enabled - timer_init(timer); - - timer_set_mode(timer, channel, TIMER_PWM); - uint16_t preload = 255; // Lock 255 PWM resolution for high frequencies - int32_t prescaler = (HAL_TIMER_RATE) / (preload + 1) / f_desired - 1; - if (prescaler > 65535) { // For low frequencies increase prescaler - prescaler = 65535; - preload = (HAL_TIMER_RATE) / (prescaler + 1) / f_desired - 1; - } - if (prescaler < 0) return; // Too high frequency - timer_set_reload(timer, preload); - timer_set_prescaler(timer, prescaler); -} - void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255*/, const bool invert/*=false*/) { timer_dev *timer = PIN_MAP[pin].timer_device; uint16_t max_val = timer->regs.bas->ARR * v / v_size; @@ -64,5 +34,35 @@ void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255 pwmWrite(pin, max_val); } +#if NEEDS_HARDWARE_PWM + + void set_pwm_frequency(const pin_t pin, int f_desired) { + if (!PWM_PIN(pin)) return; // Don't proceed if no hardware timer + + timer_dev *timer = PIN_MAP[pin].timer_device; + uint8_t channel = PIN_MAP[pin].timer_channel; + + // Protect used timers + if (timer == get_timer_dev(TEMP_TIMER_NUM)) return; + if (timer == get_timer_dev(STEP_TIMER_NUM)) return; + #if PULSE_TIMER_NUM != STEP_TIMER_NUM + if (timer == get_timer_dev(PULSE_TIMER_NUM)) return; + #endif + + if (!(timer->regs.bas->SR & TIMER_CR1_CEN)) // Ensure the timer is enabled + timer_init(timer); + + timer_set_mode(timer, channel, TIMER_PWM); + uint16_t preload = 255; // Lock 255 PWM resolution for high frequencies + int32_t prescaler = (HAL_TIMER_RATE) / (preload + 1) / f_desired - 1; + if (prescaler > 65535) { // For low frequencies increase prescaler + prescaler = 65535; + preload = (HAL_TIMER_RATE) / (prescaler + 1) / f_desired - 1; + } + if (prescaler < 0) return; // Too high frequency + timer_set_reload(timer, preload); + timer_set_prescaler(timer, prescaler); + } + #endif // NEEDS_HARDWARE_PWM #endif // __STM32F1__ diff --git a/Marlin/src/HAL/TEENSY31_32/HAL.h b/Marlin/src/HAL/TEENSY31_32/HAL.h index 7235f5ef0e..61d8b34604 100644 --- a/Marlin/src/HAL/TEENSY31_32/HAL.h +++ b/Marlin/src/HAL/TEENSY31_32/HAL.h @@ -122,6 +122,12 @@ void HAL_adc_init(); void HAL_adc_start_conversion(const uint8_t adc_pin); uint16_t HAL_adc_get_result(); +// PWM + +inline void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t=255, const bool=false) { analogWrite(pin, v); } + +// Pin Map + #define GET_PIN_MAP_PIN(index) index #define GET_PIN_MAP_INDEX(pin) pin #define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval) diff --git a/Marlin/src/HAL/TEENSY35_36/HAL.h b/Marlin/src/HAL/TEENSY35_36/HAL.h index 8892ffec45..892eb2d3c5 100644 --- a/Marlin/src/HAL/TEENSY35_36/HAL.h +++ b/Marlin/src/HAL/TEENSY35_36/HAL.h @@ -129,6 +129,12 @@ void HAL_adc_init(); void HAL_adc_start_conversion(const uint8_t adc_pin); uint16_t HAL_adc_get_result(); +// PWM + +inline void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t=255, const bool=false) { analogWrite(pin, v); } + +// Pin Map + #define GET_PIN_MAP_PIN(index) index #define GET_PIN_MAP_INDEX(pin) pin #define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval) diff --git a/Marlin/src/HAL/TEENSY40_41/HAL.cpp b/Marlin/src/HAL/TEENSY40_41/HAL.cpp index ccc8c2659c..270bee0dc9 100644 --- a/Marlin/src/HAL/TEENSY40_41/HAL.cpp +++ b/Marlin/src/HAL/TEENSY40_41/HAL.cpp @@ -106,17 +106,17 @@ void HAL_adc_init() { void HAL_clear_reset_source() { uint32_t reset_source = SRC_SRSR; SRC_SRSR = reset_source; - } +} uint8_t HAL_get_reset_source() { switch (SRC_SRSR & 0xFF) { case 1: return RST_POWER_ON; break; case 2: return RST_SOFTWARE; break; case 4: return RST_EXTERNAL; break; - // case 8: return RST_BROWN_OUT; break; + //case 8: return RST_BROWN_OUT; break; case 16: return RST_WATCHDOG; break; - case 64: return RST_JTAG; break; - // case 128: return RST_OVERTEMP; break; + case 64: return RST_JTAG; break; + //case 128: return RST_OVERTEMP; break; } return 0; } @@ -168,7 +168,7 @@ uint16_t HAL_adc_get_result() { return 0; } -bool is_output(uint8_t pin) { +bool is_output(pin_t pin) { const struct digital_pin_bitband_and_config_table_struct *p; p = digital_pin_to_info_PGM + pin; return (*(p->reg + 1) & p->mask); diff --git a/Marlin/src/HAL/TEENSY40_41/HAL.h b/Marlin/src/HAL/TEENSY40_41/HAL.h index c9716eacde..2b730768a8 100644 --- a/Marlin/src/HAL/TEENSY40_41/HAL.h +++ b/Marlin/src/HAL/TEENSY40_41/HAL.h @@ -150,8 +150,14 @@ void HAL_adc_init(); void HAL_adc_start_conversion(const uint8_t adc_pin); uint16_t HAL_adc_get_result(); +// PWM + +inline void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t=255, const bool=false) { analogWrite(pin, v); } + +// Pin Map + #define GET_PIN_MAP_PIN(index) index #define GET_PIN_MAP_INDEX(pin) pin #define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval) -bool is_output(uint8_t pin); +bool is_output(pin_t pin); diff --git a/Marlin/src/feature/caselight.cpp b/Marlin/src/feature/caselight.cpp index 1baef6d468..7c4755d0b5 100644 --- a/Marlin/src/feature/caselight.cpp +++ b/Marlin/src/feature/caselight.cpp @@ -70,7 +70,7 @@ void CaseLight::update(const bool sflag) { #if CASELIGHT_USES_BRIGHTNESS if (pin_is_pwm()) - analogWrite(pin_t(CASE_LIGHT_PIN), ( + set_pwm_duty(pin_t(CASE_LIGHT_PIN), ( #if CASE_LIGHT_MAX_PWM == 255 n10ct #else diff --git a/Marlin/src/feature/controllerfan.cpp b/Marlin/src/feature/controllerfan.cpp index 03ef31e414..330f3914f6 100644 --- a/Marlin/src/feature/controllerfan.cpp +++ b/Marlin/src/feature/controllerfan.cpp @@ -72,9 +72,10 @@ void ControllerFan::update() { ? settings.active_speed : settings.idle_speed ); - // Allow digital or PWM fan output (see M42 handling) - WRITE(CONTROLLER_FAN_PIN, speed); - analogWrite(pin_t(CONTROLLER_FAN_PIN), speed); + if (PWM_PIN(CONTROLLER_FAN_PIN)) + set_pwm_duty(pin_t(CONTROLLER_FAN_PIN), speed); + else + WRITE(CONTROLLER_FAN_PIN, speed); } } diff --git a/Marlin/src/feature/leds/leds.cpp b/Marlin/src/feature/leds/leds.cpp index 328daa626d..a371637f00 100644 --- a/Marlin/src/feature/leds/leds.cpp +++ b/Marlin/src/feature/leds/leds.cpp @@ -121,11 +121,11 @@ void LEDLights::set_color(const LEDColor &incol // This variant uses 3-4 separate pins for the RGB(W) components. // If the pins can do PWM then their intensity will be set. - #define _UPDATE_RGBW(C,c) do { \ - if (PWM_PIN(RGB_LED_##C##_PIN)) \ - analogWrite(pin_t(RGB_LED_##C##_PIN), c); \ - else \ - WRITE(RGB_LED_##C##_PIN, c ? HIGH : LOW); \ + #define _UPDATE_RGBW(C,c) do { \ + if (PWM_PIN(RGB_LED_##C##_PIN)) \ + set_pwm_duty(pin_t(RGB_LED_##C##_PIN), c); \ + else \ + WRITE(RGB_LED_##C##_PIN, c ? HIGH : LOW); \ }while(0) #define UPDATE_RGBW(C,c) _UPDATE_RGBW(C, TERN1(CASE_LIGHT_USE_RGB_LED, caselight.on) ? incol.c : 0) UPDATE_RGBW(R,r); UPDATE_RGBW(G,g); UPDATE_RGBW(B,b); diff --git a/Marlin/src/feature/spindle_laser.cpp b/Marlin/src/feature/spindle_laser.cpp index ea6fc4990e..9297e9b95c 100644 --- a/Marlin/src/feature/spindle_laser.cpp +++ b/Marlin/src/feature/spindle_laser.cpp @@ -66,7 +66,7 @@ void SpindleLaser::init() { #endif #if ENABLED(SPINDLE_LASER_USE_PWM) SET_PWM(SPINDLE_LASER_PWM_PIN); - analogWrite(pin_t(SPINDLE_LASER_PWM_PIN), SPINDLE_LASER_PWM_OFF); // Set to lowest speed + set_pwm_duty(pin_t(SPINDLE_LASER_PWM_PIN), SPINDLE_LASER_PWM_OFF); // Set to lowest speed #endif #if ENABLED(HAL_CAN_SET_PWM_FREQ) && defined(SPINDLE_LASER_FREQUENCY) set_pwm_frequency(pin_t(SPINDLE_LASER_PWM_PIN), SPINDLE_LASER_FREQUENCY); @@ -92,10 +92,8 @@ void SpindleLaser::init() { void SpindleLaser::_set_ocr(const uint8_t ocr) { #if NEEDS_HARDWARE_PWM && SPINDLE_LASER_FREQUENCY set_pwm_frequency(pin_t(SPINDLE_LASER_PWM_PIN), TERN(MARLIN_DEV_MODE, frequency, SPINDLE_LASER_FREQUENCY)); - set_pwm_duty(pin_t(SPINDLE_LASER_PWM_PIN), ocr ^ SPINDLE_LASER_PWM_OFF); - #else - analogWrite(pin_t(SPINDLE_LASER_PWM_PIN), ocr ^ SPINDLE_LASER_PWM_OFF); #endif + set_pwm_duty(pin_t(SPINDLE_LASER_PWM_PIN), ocr ^ SPINDLE_LASER_PWM_OFF); } void SpindleLaser::set_ocr(const uint8_t ocr) { diff --git a/Marlin/src/gcode/control/M42.cpp b/Marlin/src/gcode/control/M42.cpp index eead971a01..77c0ccc49b 100644 --- a/Marlin/src/gcode/control/M42.cpp +++ b/Marlin/src/gcode/control/M42.cpp @@ -126,10 +126,10 @@ void GcodeSuite::M42() { extDigitalWrite(pin, pin_status); #ifdef ARDUINO_ARCH_STM32 - // A simple I/O will be set to 0 by analogWrite() + // A simple I/O will be set to 0 by set_pwm_duty() if (pin_status <= 1 && !PWM_PIN(pin)) return; #endif - analogWrite(pin, pin_status); + set_pwm_duty(pin, pin_status); } #endif // DIRECT_PIN_CONTROL diff --git a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp index 5d4c30bbb4..f339cad706 100644 --- a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp +++ b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp @@ -342,7 +342,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop void MarlinUI::_set_brightness() { #if PIN_EXISTS(TFT_BACKLIGHT) if (PWM_PIN(TFT_BACKLIGHT_PIN)) - analogWrite(pin_t(TFT_BACKLIGHT_PIN), brightness); + set_pwm_duty(pin_t(TFT_BACKLIGHT_PIN), brightness); #endif } #endif diff --git a/Marlin/src/lcd/tft/ui_common.cpp b/Marlin/src/lcd/tft/ui_common.cpp index 8c503d2c9e..85ae21e867 100644 --- a/Marlin/src/lcd/tft/ui_common.cpp +++ b/Marlin/src/lcd/tft/ui_common.cpp @@ -213,7 +213,7 @@ void MarlinUI::clear_lcd() { void MarlinUI::_set_brightness() { #if PIN_EXISTS(TFT_BACKLIGHT) if (PWM_PIN(TFT_BACKLIGHT_PIN)) - analogWrite(pin_t(TFT_BACKLIGHT_PIN), brightness); + set_pwm_duty(pin_t(TFT_BACKLIGHT_PIN), brightness); #endif } #endif diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index 332becfb73..04f20ca3a4 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -1342,7 +1342,7 @@ void Endstops::update() { ES_REPORT_CHANGE(K_MAX); #endif SERIAL_ECHOLNPGM("\n"); - analogWrite(pin_t(LED_PIN), local_LED_status); + set_pwm_duty(pin_t(LED_PIN), local_LED_status); local_LED_status ^= 255; old_live_state_local = live_state_local; } diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 2552efc69a..11460fa67a 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -1270,7 +1270,7 @@ void Planner::recalculate() { #elif ENABLED(FAST_PWM_FAN) #define _FAN_SET(F) set_pwm_duty(FAN##F##_PIN, CALC_FAN_SPEED(F)); #else - #define _FAN_SET(F) analogWrite(pin_t(FAN##F##_PIN), CALC_FAN_SPEED(F)); + #define _FAN_SET(F) set_pwm_duty(pin_t(FAN##F##_PIN), CALC_FAN_SPEED(F)); #endif #define FAN_SET(F) do{ kickstart_fan(fan_speed, ms, F); _FAN_SET(F); }while(0) @@ -1393,8 +1393,8 @@ void Planner::check_axes_activity() { TERN_(AUTOTEMP, autotemp_task()); #if ENABLED(BARICUDA) - TERN_(HAS_HEATER_1, analogWrite(pin_t(HEATER_1_PIN), tail_valve_pressure)); - TERN_(HAS_HEATER_2, analogWrite(pin_t(HEATER_2_PIN), tail_e_to_p_pressure)); + TERN_(HAS_HEATER_1, set_pwm_duty(pin_t(HEATER_1_PIN), tail_valve_pressure)); + TERN_(HAS_HEATER_2, set_pwm_duty(pin_t(HEATER_2_PIN), tail_e_to_p_pressure)); #endif } diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index a54bf53c49..2c8933266f 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -3253,7 +3253,7 @@ void Stepper::report_positions() { #elif HAS_MOTOR_CURRENT_PWM - #define _WRITE_CURRENT_PWM(P) analogWrite(pin_t(MOTOR_CURRENT_PWM_## P ##_PIN), 255L * current / (MOTOR_CURRENT_PWM_RANGE)) + #define _WRITE_CURRENT_PWM(P) set_pwm_duty(pin_t(MOTOR_CURRENT_PWM_## P ##_PIN), 255L * current / (MOTOR_CURRENT_PWM_RANGE)) switch (driver) { case 0: #if PIN_EXISTS(MOTOR_CURRENT_PWM_X) diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 5e8f4c9d95..cef348c5f9 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -887,11 +887,11 @@ int16_t Temperature::getHeaterPower(const heater_id_t heater_id) { SBI(fanState, pgm_read_byte(&fanBit[COOLER_FAN_INDEX])); #endif - #define _UPDATE_AUTO_FAN(P,D,A) do{ \ - if (PWM_PIN(P##_AUTO_FAN_PIN) && A < 255) \ - analogWrite(pin_t(P##_AUTO_FAN_PIN), D ? A : 0); \ - else \ - WRITE(P##_AUTO_FAN_PIN, D); \ + #define _UPDATE_AUTO_FAN(P,D,A) do{ \ + if (PWM_PIN(P##_AUTO_FAN_PIN) && A < 255) \ + set_pwm_duty(pin_t(P##_AUTO_FAN_PIN), D ? A : 0); \ + else \ + WRITE(P##_AUTO_FAN_PIN, D); \ }while(0) uint8_t fanDone = 0; From 95357c33fb0d3ce6d84e59bd16e8354836997015 Mon Sep 17 00:00:00 2001 From: Sebastien BLAISOT Date: Tue, 2 Nov 2021 06:49:21 +0100 Subject: [PATCH 094/125] =?UTF-8?q?=F0=9F=90=9B=20Fix=20NEOPIXEL2=5FSEPARA?= =?UTF-8?q?TE=20default=20color=20(#23057)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/leds/leds.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/src/feature/leds/leds.cpp b/Marlin/src/feature/leds/leds.cpp index a371637f00..17d790b8cc 100644 --- a/Marlin/src/feature/leds/leds.cpp +++ b/Marlin/src/feature/leds/leds.cpp @@ -170,9 +170,9 @@ void LEDLights::set_color(const LEDColor &incol #if ENABLED(NEO2_COLOR_PRESETS) const LEDColor LEDLights2::defaultLEDColor = LEDColor( - LED_USER_PRESET_RED, LED_USER_PRESET_GREEN, LED_USER_PRESET_BLUE - OPTARG(HAS_WHITE_LED2, LED_USER_PRESET_WHITE) - OPTARG(NEOPIXEL_LED, LED_USER_PRESET_BRIGHTNESS) + NEO2_USER_PRESET_RED, NEO2_USER_PRESET_GREEN, NEO2_USER_PRESET_BLUE + OPTARG(HAS_WHITE_LED2, NEO2_USER_PRESET_WHITE) + OPTARG(NEOPIXEL_LED, NEO2_USER_PRESET_BRIGHTNESS) ); #endif From 0db9f9a828c43f978e37b5140f7b9bb6ca630667 Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Mon, 1 Nov 2021 23:15:29 -0700 Subject: [PATCH 095/125] =?UTF-8?q?=F0=9F=93=8C=20Default=20NeoPixel=20pin?= =?UTF-8?q?=20for=20MKS=20Robin=20E3/E3D=20(#23060)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h index a34099120e..025c65a38b 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h @@ -64,6 +64,11 @@ #define Z_MIN_PROBE_PIN PB1 #endif +// LED driving pin +#ifndef NEOPIXEL_PIN + #define NEOPIXEL_PIN PA2 +#endif + // // Steppers // From f632b72e8c58ea4c54676ca17e9b9c9ee4584be0 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 2 Nov 2021 01:28:00 -0500 Subject: [PATCH 096/125] =?UTF-8?q?=F0=9F=94=A8=20Support=20ABM=20in=20mf?= =?UTF-8?q?=20scripts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/share/git/mfinfo | 1 + 1 file changed, 1 insertion(+) diff --git a/buildroot/share/git/mfinfo b/buildroot/share/git/mfinfo index e17138e456..0f5d79a002 100755 --- a/buildroot/share/git/mfinfo +++ b/buildroot/share/git/mfinfo @@ -52,6 +52,7 @@ case "$REPO" in Marlin ) TARG=bugfix-2.0.x ; [[ $INDEX == 1 ]] && TARG=bugfix-1.1.x ; [[ $INDEX == 3 ]] && TARG=dev-2.1.x ;; Configurations ) TARG=import-2.0.x ;; MarlinDocumentation ) TARG=master ;; + AutoBuildMarlin ) TARG=master ;; esac [[ $BRANCH =~ ^[123]$ ]] && USAGE=1 From 627b67e27aa4de50c172e0ffc4a13fe3fb2d35f8 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Wed, 3 Nov 2021 01:00:15 +0000 Subject: [PATCH 097/125] [cron] Bump distribution date (2021-11-03) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 607561a87d..68c7d05299 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-11-02" +//#define STRING_DISTRIBUTION_DATE "2021-11-03" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index c0dbd45fa2..1e1977671b 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-11-02" + #define STRING_DISTRIBUTION_DATE "2021-11-03" #endif /** From cac42e24a581915176816c680a61396855660b19 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 3 Nov 2021 07:02:21 -0500 Subject: [PATCH 098/125] =?UTF-8?q?=F0=9F=94=A8=20Update=20git=20helper=20?= =?UTF-8?q?scripts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/share/git/mffp | 14 +++++++++----- buildroot/share/git/mfinfo | 28 ++++++++++++++++------------ buildroot/share/git/mfnew | 6 +++--- buildroot/share/git/mfpr | 6 +++--- buildroot/share/git/mfqp | 4 ++-- buildroot/share/git/mfrb | 4 ++-- 6 files changed, 35 insertions(+), 27 deletions(-) diff --git a/buildroot/share/git/mffp b/buildroot/share/git/mffp index 2663a4a137..0680b3dba5 100755 --- a/buildroot/share/git/mffp +++ b/buildroot/share/git/mffp @@ -1,19 +1,23 @@ #!/usr/bin/env bash # -# mffp [1|2|3] [commit-id] +# mffp [1|2] [ref] # # Push the given commit (or HEAD) upstream immediately. -# By default: `git push upstream HEAD:bugfix-1.1.x` +# By default: `git push upstream HEAD:bugfix-2.0.x` # -[[ $# < 3 && $1 != "-h" && $1 != "--help" ]] || { echo "usage: `basename $0` [1|2|3] [commit-id]" 1>&2 ; exit 1; } +usage() { echo "usage: `basename $0` [1|2] [ref]" 1>&2 } -if [[ $1 == '1' || $1 == '2' || $1 == '3' ]]; then +[[ $# < 3 && $1 != "-h" && $1 != "--help" ]] || { usage ; exit 1; } + +if [[ $1 == '1' || $1 == '2' ]]; then MFINFO=$(mfinfo "$1") || exit 1 REF=${2:-HEAD} -else +elif [[ $# == 1 ]]; then MFINFO=$(mfinfo) || exit 1 REF=${1:-HEAD} +else + usage fi IFS=' ' read -a INFO <<< "$MFINFO" diff --git a/buildroot/share/git/mfinfo b/buildroot/share/git/mfinfo index 0f5d79a002..0c2113d922 100755 --- a/buildroot/share/git/mfinfo +++ b/buildroot/share/git/mfinfo @@ -2,15 +2,19 @@ # # mfinfo # -# Provide the following info about the working directory: +# Print the following info about the working copy: # # - Remote (upstream) Org name (MarlinFirmware) # - Remote (origin) Org name (your Github username) # - Repo Name (Marlin, MarlinDocumentation) -# - PR Target branch (bugfix-1.1.x, bugfix-2.0.x, dev-2.1.x, etc.) +# - PR Target branch (e.g., bugfix-2.0.x) # - Branch Arg (the branch argument or current branch) # - Current Branch # +# Example output +# > mfinfo -q ongoing +# MarlinFirmware john.doe Marlin bugfix-2.0.x ongoing bugfix-2.0.x -q +# CURR=$(git branch 2>/dev/null | grep ^* | sed 's/\* //g') [[ -z $CURR ]] && { echo "No git repository here!" 1>&2 ; exit 1; } @@ -26,37 +30,37 @@ FORK=$(git remote get-url origin 2>/dev/null | sed -E 's/.*[\/:](.*)\/.*$/\1/') # Defaults if no arguments given BRANCH=$CURR -INDEX=1 +MORE="" +INDEX=2 +# Loop through arguments while [[ $# -gt 0 ]]; do + # Get an arg and maybe a val to go with it opt="$1" ; shift ; val="$1" + # Split up an arg containing = IFS='=' read -a PARTS <<<"$opt" [[ "${PARTS[1]}" != "" ]] && { EQUALS=1 ; opt="${PARTS[0]}" ; val="${PARTS[1]}" ; } - GOODVAL=1 if [[ "$val" =~ ^-{1,2}.* || ! "$opt" =~ ^-{1,2}.* ]]; then - GOODVAL=0 val="" fi case "$opt" in - -*|--*) MORE="$MORE$opt " ; [[ $EQUALS == 1 ]] && MORE="$MORE=$val" ;; - 1|2|3) INDEX=$opt ;; + -*|--*) MORE=" $MORE$opt" ; ((EQUALS)) && MORE="$MORE=$val" ;; + 1|2) INDEX=$opt ;; *) BRANCH="$opt" ;; esac done case "$REPO" in - Marlin ) TARG=bugfix-2.0.x ; [[ $INDEX == 1 ]] && TARG=bugfix-1.1.x ; [[ $INDEX == 3 ]] && TARG=dev-2.1.x ;; + Marlin ) TARG=bugfix-2.0.x ; ((INDEX == 1)) && TARG=bugfix-1.1.x ; [[ $BRANCH =~ ^[12]$ ]] && USAGE=1 ;; Configurations ) TARG=import-2.0.x ;; MarlinDocumentation ) TARG=master ;; AutoBuildMarlin ) TARG=master ;; esac -[[ $BRANCH =~ ^[123]$ ]] && USAGE=1 +[[ $USAGE == 1 ]] && { echo "usage: `basename $0` [1|2] [branch]" 1>&2 ; exit 1 ; } -[[ $USAGE == 1 ]] && { echo "usage: `basename $0` [1|2|3] [branch]" 1>&2 ; exit 1 ; } - -echo "$ORG $FORK $REPO $TARG $BRANCH $CURR $MORE" +echo "$ORG $FORK $REPO $TARG $BRANCH $CURR$MORE" diff --git a/buildroot/share/git/mfnew b/buildroot/share/git/mfnew index e491fea191..6d067a7f08 100755 --- a/buildroot/share/git/mfnew +++ b/buildroot/share/git/mfnew @@ -6,7 +6,7 @@ # usage() { - echo "usage: `basename $0` [1|2|3] [name]" 1>&2 + echo "usage: `basename $0` [1|2] [name]" 1>&2 } [[ $# < 3 && $1 != "-h" && $1 != "--help" ]] || { usage; exit 1; } @@ -19,12 +19,12 @@ BRANCH=pr_for_$TARG-$(date +"%G-%m-%d_%H.%M.%S") # BRANCH can be given as the last argument case "$#" in 1 ) case "$1" in - 1|2|3) ;; + 1|2) ;; *) BRANCH=$1 ;; esac ;; 2 ) case "$1" in - 1|2|3) BRANCH=$2 ;; + 1|2) BRANCH=$2 ;; *) usage ; exit 1 ;; esac ;; diff --git a/buildroot/share/git/mfpr b/buildroot/share/git/mfpr index b853c6929e..230bd2886c 100755 --- a/buildroot/share/git/mfpr +++ b/buildroot/share/git/mfpr @@ -1,11 +1,11 @@ #!/usr/bin/env bash # -# mfpr [1|2|3] +# mfpr [1|2] # -# Make a PR against bugfix-1.1.x or bugfix-2.0.x +# Make a PR targeted to MarlinFirmware/[repo] # -[[ $# < 2 && $1 != "-h" && $1 != "--help" ]] || { echo "usage: `basename $0` [1|2|3] [branch]" 1>&2 ; exit 1; } +[[ $# < 2 && $1 != "-h" && $1 != "--help" ]] || { echo "usage: `basename $0` [1|2] [branch]" 1>&2 ; exit 1; } MFINFO=$(mfinfo "$@") || exit 1 IFS=' ' read -a INFO <<< "$MFINFO" diff --git a/buildroot/share/git/mfqp b/buildroot/share/git/mfqp index f0c4446a21..6e36e6113a 100755 --- a/buildroot/share/git/mfqp +++ b/buildroot/share/git/mfqp @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# mfqp [1|2|3] +# mfqp [1|2] # # - git add . # - git commit --amend @@ -24,7 +24,7 @@ while [ $IND -lt ${#INFO[@]} ]; do let IND+=1 done -[[ $USAGE == 1 ]] && { echo "usage: `basename $0` [1|2|3]" 1>&2 ; exit 1 ; } +[[ $USAGE == 1 ]] && { echo "usage: `basename $0` [1|2]" 1>&2 ; exit 1 ; } [[ $FORCE != 1 && $CURR == $TARG && $REPO != "MarlinDocumentation" ]] && { echo "Don't alter the PR Target branch."; exit 1 ; } diff --git a/buildroot/share/git/mfrb b/buildroot/share/git/mfrb index 071b0b3d59..b55a34e010 100755 --- a/buildroot/share/git/mfrb +++ b/buildroot/share/git/mfrb @@ -2,7 +2,7 @@ # # mfrb # -# Do "git rebase -i" against the "target" branch (bugfix-1.1.x, bugfix-2.0.x, dev-2.1.x, or master) +# Do "git rebase -i" against the repo's "target" branch # MFINFO=$(mfinfo "$@") || exit 1 @@ -21,7 +21,7 @@ while [ $IND -lt ${#INFO[@]} ]; do let IND+=1 done -[[ $USAGE == 1 ]] && { echo "usage: `basename $0` [1|2|3]" 1>&2 ; exit 1 ; } +[[ $USAGE == 1 ]] && { echo "usage: `basename $0` [1|2]" 1>&2 ; exit 1 ; } [[ $QUICK ]] || git fetch upstream git rebase upstream/$TARG && git rebase -i upstream/$TARG From 02b6fb8025ef82c2d1290cdc1a98bc0c54f502c9 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 3 Nov 2021 07:06:31 -0500 Subject: [PATCH 099/125] =?UTF-8?q?=F0=9F=94=A8=20Script=20'mfprep'=20find?= =?UTF-8?q?s=20pending=20commits?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/share/git/mfprep | 64 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100755 buildroot/share/git/mfprep diff --git a/buildroot/share/git/mfprep b/buildroot/share/git/mfprep new file mode 100755 index 0000000000..7a8e05ee31 --- /dev/null +++ b/buildroot/share/git/mfprep @@ -0,0 +1,64 @@ +#!/usr/bin/env bash +# +# mfprep tag1 [tag2] +# +# Find commits in bugfix-2.0.x not yet in 2.0.x +# + +SED=$(which gsed sed | head -n1) +SELF=`basename "$0"` + +[[ $# < 1 || $# > 2 ]] && { echo "Usage $SELF tag1 [tag2]" ; exit 1 ; } + +TAG1=$1 +TAG2=${2:-"HEAD"} + +# Validate that the required tags exist + +MTAG=`git tag | grep -e "^bf-$TAG1\$"` +[[ -n $MTAG ]] || { echo "Can't find tag bf-$TAG1" ; exit 1 ; } +MTAG=`git tag | grep -e "^$TAG1\$"` +[[ -n $MTAG ]] || { echo "Can't find tag $TAG1" ; exit 1 ; } + +# Generate log of recent commits for bugfix-2.0.x and 2.0.x + +TMPDIR=`mktemp -d` +LOGB="$TMPDIR/log-bf.txt" +LOG2="$TMPDIR/log-20x.txt" +TMPF="$TMPDIR/tmp.txt" +SCRF="$TMPDIR/update-20x.sh" + +git checkout bugfix-2.0.x +git log --pretty="[%h] %s" bf-$TAG1..$TAG2 | grep -v '\[cron\]' | $SED '1!G;h;$!d' >"$LOGB" + +git checkout 2.0.x +git log --pretty="[%h] %s" $TAG1..$TAG2 | $SED '1!G;h;$!d' >"$LOG2" || { echo "Can't find tag bf-$TAG1" ; exit 1 ; } + +# Go through commit text from 2.0.x removing all matches from the bugfix log + +cat "$LOG2" | while read line; do + #echo "... $line" + if [[ $line =~ (\(#[0-9]{5}\))$ ]]; then + PATT=${BASH_REMATCH[1]} + #echo "... $PATT" + else + PATT=$( $SED -E 's/^\[[0-9a-f]{10}\]( . )?(.+)$/\2/' <<<"$line" ) + fi + [[ -n $PATT ]] && { grep -v "$PATT" "$LOGB" >"$TMPF" ; cp "$TMPF" "$LOGB" ; } +done + +# Convert remaining commits into git commands + +echo -e "#!/usr/bin/env bash\nset -e\ngit checkout 2.0.x\n" >"$TMPF" +cat "$LOGB" | while read line; do + if [[ $line =~ ^\[([0-9a-f]{10})\]\ *(.*)$ ]]; then + CID=${BASH_REMATCH[1]} + REST=${BASH_REMATCH[2]} + echo "git cherry-pick $CID ;# $REST" >>"$TMPF" + else + echo ";# $line" >>"$TMPF" + fi +done +mv "$TMPF" "$SCRF" + +open "$TMPDIR" From fef96bb556f19bf1e132368ec0675d1d2b12634d Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Thu, 4 Nov 2021 01:00:55 +0000 Subject: [PATCH 100/125] [cron] Bump distribution date (2021-11-04) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 68c7d05299..e562730ae3 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-11-03" +//#define STRING_DISTRIBUTION_DATE "2021-11-04" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 1e1977671b..f695d0a1b2 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-11-03" + #define STRING_DISTRIBUTION_DATE "2021-11-04" #endif /** From 399faa91b99dab0f8565396efd32f277965c93b2 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Thu, 4 Nov 2021 14:04:06 +1300 Subject: [PATCH 101/125] =?UTF-8?q?=F0=9F=93=8C=20'STOP'=20auto-assign,=20?= =?UTF-8?q?some=20Chitu=20V9=20pins=20(#22889)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/core/macros.h | 6 ++ Marlin/src/inc/Conditionals_post.h | 70 +++++++++++++++++++++-- Marlin/src/inc/Warnings.cpp | 48 ++++++++++++++++ Marlin/src/pins/pins_postprocess.h | 23 +++++++- Marlin/src/pins/stm32f1/pins_CHITU3D_V9.h | 4 ++ 5 files changed, 143 insertions(+), 8 deletions(-) diff --git a/Marlin/src/core/macros.h b/Marlin/src/core/macros.h index d8a15b910d..62675d1319 100644 --- a/Marlin/src/core/macros.h +++ b/Marlin/src/core/macros.h @@ -33,6 +33,12 @@ #define _AXIS(A) (A##_AXIS) +#define _XSTOP_ 0x01 +#define _YSTOP_ 0x02 +#define _ZSTOP_ 0x03 +#define _ISTOP_ 0x04 +#define _JSTOP_ 0x05 +#define _KSTOP_ 0x06 #define _XMIN_ 0x11 #define _YMIN_ 0x12 #define _ZMIN_ 0x13 diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index c8b6d504e2..8008461547 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -769,19 +769,25 @@ #define X2_MAX_ENDSTOP_INVERTING false #endif #endif - #ifndef X2_MAX_PIN + #if !defined(X2_MAX_PIN) && !defined(X2_STOP_PIN) #if X2_USE_ENDSTOP == _XMIN_ #define X2_MAX_PIN X_MIN_PIN #elif X2_USE_ENDSTOP == _XMAX_ #define X2_MAX_PIN X_MAX_PIN + #elif X2_USE_ENDSTOP == _XSTOP_ + #define X2_MAX_PIN X_STOP_PIN #elif X2_USE_ENDSTOP == _YMIN_ #define X2_MAX_PIN Y_MIN_PIN #elif X2_USE_ENDSTOP == _YMAX_ #define X2_MAX_PIN Y_MAX_PIN + #elif X2_USE_ENDSTOP == _YSTOP_ + #define X2_MAX_PIN Y_STOP_PIN #elif X2_USE_ENDSTOP == _ZMIN_ #define X2_MAX_PIN Z_MIN_PIN #elif X2_USE_ENDSTOP == _ZMAX_ #define X2_MAX_PIN Z_MAX_PIN + #elif X2_USE_ENDSTOP == _ZSTOP_ + #define X2_MAX_PIN Z_STOP_PIN #elif X2_USE_ENDSTOP == _XDIAG_ #define X2_MAX_PIN X_DIAG_PIN #elif X2_USE_ENDSTOP == _YDIAG_ @@ -827,19 +833,25 @@ #define X2_MIN_ENDSTOP_INVERTING false #endif #endif - #ifndef X2_MIN_PIN + #if !defined(X2_MIN_PIN) && !defined(X2_STOP_PIN) #if X2_USE_ENDSTOP == _XMIN_ #define X2_MIN_PIN X_MIN_PIN #elif X2_USE_ENDSTOP == _XMAX_ #define X2_MIN_PIN X_MAX_PIN + #elif X2_USE_ENDSTOP == _XSTOP_ + #define X2_MIN_PIN X_STOP_PIN #elif X2_USE_ENDSTOP == _YMIN_ #define X2_MIN_PIN Y_MIN_PIN #elif X2_USE_ENDSTOP == _YMAX_ #define X2_MIN_PIN Y_MAX_PIN + #elif X2_USE_ENDSTOP == _YSTOP_ + #define X2_MIN_PIN Y_STOP_PIN #elif X2_USE_ENDSTOP == _ZMIN_ #define X2_MIN_PIN Z_MIN_PIN #elif X2_USE_ENDSTOP == _ZMAX_ #define X2_MIN_PIN Z_MAX_PIN + #elif X2_USE_ENDSTOP == _ZSTOP_ + #define X2_MIN_PIN Z_STOP_PIN #elif X2_USE_ENDSTOP == _XDIAG_ #define X2_MIN_PIN X_DIAG_PIN #elif X2_USE_ENDSTOP == _YDIAG_ @@ -892,19 +904,25 @@ #define Y2_MAX_ENDSTOP_INVERTING false #endif #endif - #ifndef Y2_MAX_PIN + #if !defined(Y2_MAX_PIN) && !defined(Y2_STOP_PIN) #if Y2_USE_ENDSTOP == _XMIN_ #define Y2_MAX_PIN X_MIN_PIN #elif Y2_USE_ENDSTOP == _XMAX_ #define Y2_MAX_PIN X_MAX_PIN + #elif Y2_USE_ENDSTOP == _XSTOP_ + #define Y2_MAX_PIN X_STOP_PIN #elif Y2_USE_ENDSTOP == _YMIN_ #define Y2_MAX_PIN Y_MIN_PIN #elif Y2_USE_ENDSTOP == _YMAX_ #define Y2_MAX_PIN Y_MAX_PIN + #elif Y2_USE_ENDSTOP == _YSTOP_ + #define Y2_MAX_PIN Y_STOP_PIN #elif Y2_USE_ENDSTOP == _ZMIN_ #define Y2_MAX_PIN Z_MIN_PIN #elif Y2_USE_ENDSTOP == _ZMAX_ #define Y2_MAX_PIN Z_MAX_PIN + #elif Y2_USE_ENDSTOP == _ZSTOP_ + #define Y2_MAX_PIN Z_STOP_PIN #elif Y2_USE_ENDSTOP == _XDIAG_ #define Y2_MAX_PIN X_DIAG_PIN #elif Y2_USE_ENDSTOP == _YDIAG_ @@ -950,19 +968,25 @@ #define Y2_MIN_ENDSTOP_INVERTING false #endif #endif - #ifndef Y2_MIN_PIN + #if !defined(Y2_MIN_PIN) && !defined(Y2_STOP_PIN) #if Y2_USE_ENDSTOP == _XMIN_ #define Y2_MIN_PIN X_MIN_PIN #elif Y2_USE_ENDSTOP == _XMAX_ #define Y2_MIN_PIN X_MAX_PIN + #elif Y2_USE_ENDSTOP == _XSTOP_ + #define Y2_MIN_PIN X_STOP_PIN #elif Y2_USE_ENDSTOP == _YMIN_ #define Y2_MIN_PIN Y_MIN_PIN #elif Y2_USE_ENDSTOP == _YMAX_ #define Y2_MIN_PIN Y_MAX_PIN + #elif Y2_USE_ENDSTOP == _YSTOP_ + #define Y2_MIN_PIN Y_STOP_PIN #elif Y2_USE_ENDSTOP == _ZMIN_ #define Y2_MIN_PIN Z_MIN_PIN #elif Y2_USE_ENDSTOP == _ZMAX_ #define Y2_MIN_PIN Z_MAX_PIN + #elif Y2_USE_ENDSTOP == _ZSTOP_ + #define Y2_MIN_PIN Z_STOP_PIN #elif Y2_USE_ENDSTOP == _XDIAG_ #define Y2_MIN_PIN X_DIAG_PIN #elif Y2_USE_ENDSTOP == _YDIAG_ @@ -1016,19 +1040,25 @@ #define Z2_MAX_ENDSTOP_INVERTING false #endif #endif - #ifndef Z2_MAX_PIN + #if !defined(Z2_MAX_PIN) && !defined(Z2_STOP_PIN) #if Z2_USE_ENDSTOP == _XMIN_ #define Z2_MAX_PIN X_MIN_PIN #elif Z2_USE_ENDSTOP == _XMAX_ #define Z2_MAX_PIN X_MAX_PIN + #elif Z2_USE_ENDSTOP == _XSTOP_ + #define Z2_MAX_PIN X_STOP_PIN #elif Z2_USE_ENDSTOP == _YMIN_ #define Z2_MAX_PIN Y_MIN_PIN #elif Z2_USE_ENDSTOP == _YMAX_ #define Z2_MAX_PIN Y_MAX_PIN + #elif Z2_USE_ENDSTOP == _YSTOP_ + #define Z2_MAX_PIN Y_STOP_PIN #elif Z2_USE_ENDSTOP == _ZMIN_ #define Z2_MAX_PIN Z_MIN_PIN #elif Z2_USE_ENDSTOP == _ZMAX_ #define Z2_MAX_PIN Z_MAX_PIN + #elif Z2_USE_ENDSTOP == _ZSTOP_ + #define Z2_MAX_PIN Z_STOP_PIN #elif Z2_USE_ENDSTOP == _XDIAG_ #define Z2_MAX_PIN X_DIAG_PIN #elif Z2_USE_ENDSTOP == _YDIAG_ @@ -1079,14 +1109,20 @@ #define Z2_MIN_PIN X_MIN_PIN #elif Z2_USE_ENDSTOP == _XMAX_ #define Z2_MIN_PIN X_MAX_PIN + #elif Z2_USE_ENDSTOP == _XSTOP_ + #define Z2_MIN_PIN X_STOP_PIN #elif Z2_USE_ENDSTOP == _YMIN_ #define Z2_MIN_PIN Y_MIN_PIN #elif Z2_USE_ENDSTOP == _YMAX_ #define Z2_MIN_PIN Y_MAX_PIN + #elif Z2_USE_ENDSTOP == _YSTOP_ + #define Z2_MIN_PIN Y_STOP_PIN #elif Z2_USE_ENDSTOP == _ZMIN_ #define Z2_MIN_PIN Z_MIN_PIN #elif Z2_USE_ENDSTOP == _ZMAX_ #define Z2_MIN_PIN Z_MAX_PIN + #elif Z2_USE_ENDSTOP == _ZSTOP_ + #define Z2_MIN_PIN Z_STOP_PIN #elif Z2_USE_ENDSTOP == _XDIAG_ #define Z2_MIN_PIN X_DIAG_PIN #elif Z2_USE_ENDSTOP == _YDIAG_ @@ -1140,14 +1176,20 @@ #define Z3_MAX_PIN X_MIN_PIN #elif Z3_USE_ENDSTOP == _XMAX_ #define Z3_MAX_PIN X_MAX_PIN + #elif Z3_USE_ENDSTOP == _XSTOP_ + #define Z3_MAX_PIN X_STOP_PIN #elif Z3_USE_ENDSTOP == _YMIN_ #define Z3_MAX_PIN Y_MIN_PIN #elif Z3_USE_ENDSTOP == _YMAX_ #define Z3_MAX_PIN Y_MAX_PIN + #elif Z3_USE_ENDSTOP == _YSTOP_ + #define Z3_MAX_PIN Y_STOP_PIN #elif Z3_USE_ENDSTOP == _ZMIN_ #define Z3_MAX_PIN Z_MIN_PIN #elif Z3_USE_ENDSTOP == _ZMAX_ #define Z3_MAX_PIN Z_MAX_PIN + #elif Z3_USE_ENDSTOP == _ZSTOP_ + #define Z3_MAX_PIN Z_STOP_PIN #elif Z3_USE_ENDSTOP == _XDIAG_ #define Z3_MAX_PIN X_DIAG_PIN #elif Z3_USE_ENDSTOP == _YDIAG_ @@ -1198,14 +1240,20 @@ #define Z3_MIN_PIN X_MIN_PIN #elif Z3_USE_ENDSTOP == _XMAX_ #define Z3_MIN_PIN X_MAX_PIN + #elif Z3_USE_ENDSTOP == _XSTOP_ + #define Z3_MIN_PIN X_STOP_PIN #elif Z3_USE_ENDSTOP == _YMIN_ #define Z3_MIN_PIN Y_MIN_PIN #elif Z3_USE_ENDSTOP == _YMAX_ #define Z3_MIN_PIN Y_MAX_PIN + #elif Z3_USE_ENDSTOP == _YSTOP_ + #define Z3_MIN_PIN Y_STOP_PIN #elif Z3_USE_ENDSTOP == _ZMIN_ #define Z3_MIN_PIN Z_MIN_PIN #elif Z3_USE_ENDSTOP == _ZMAX_ #define Z3_MIN_PIN Z_MAX_PIN + #elif Z3_USE_ENDSTOP == _ZSTOP_ + #define Z3_MIN_PIN Z_STOP_PIN #elif Z3_USE_ENDSTOP == _XDIAG_ #define Z3_MIN_PIN X_DIAG_PIN #elif Z3_USE_ENDSTOP == _YDIAG_ @@ -1260,14 +1308,20 @@ #define Z4_MAX_PIN X_MIN_PIN #elif Z4_USE_ENDSTOP == _XMAX_ #define Z4_MAX_PIN X_MAX_PIN + #elif Z4_USE_ENDSTOP == _XSTOP_ + #define Z4_MAX_PIN X_STOP_PIN #elif Z4_USE_ENDSTOP == _YMIN_ #define Z4_MAX_PIN Y_MIN_PIN #elif Z4_USE_ENDSTOP == _YMAX_ #define Z4_MAX_PIN Y_MAX_PIN + #elif Z4_USE_ENDSTOP == _YSTOP_ + #define Z4_MAX_PIN Y_STOP_PIN #elif Z4_USE_ENDSTOP == _ZMIN_ #define Z4_MAX_PIN Z_MIN_PIN #elif Z4_USE_ENDSTOP == _ZMAX_ #define Z4_MAX_PIN Z_MAX_PIN + #elif Z4_USE_ENDSTOP == _ZSTOP_ + #define Z4_MAX_PIN Z_STOP_PIN #elif Z4_USE_ENDSTOP == _XDIAG_ #define Z4_MAX_PIN X_DIAG_PIN #elif Z4_USE_ENDSTOP == _YDIAG_ @@ -1318,14 +1372,20 @@ #define Z4_MIN_PIN X_MIN_PIN #elif Z4_USE_ENDSTOP == _XMAX_ #define Z4_MIN_PIN X_MAX_PIN + #elif Z4_USE_ENDSTOP == _XSTOP_ + #define Z4_MIN_PIN X_STOP_PIN #elif Z4_USE_ENDSTOP == _YMIN_ #define Z4_MIN_PIN Y_MIN_PIN #elif Z4_USE_ENDSTOP == _YMAX_ #define Z4_MIN_PIN Y_MAX_PIN + #elif Z4_USE_ENDSTOP == _YSTOP_ + #define Z4_MIN_PIN Y_STOP_PIN #elif Z4_USE_ENDSTOP == _ZMIN_ #define Z4_MIN_PIN Z_MIN_PIN #elif Z4_USE_ENDSTOP == _ZMAX_ #define Z4_MIN_PIN Z_MAX_PIN + #elif Z4_USE_ENDSTOP == _ZSTOP_ + #define Z4_MIN_PIN Z_STOP_PIN #elif Z4_USE_ENDSTOP == _XDIAG_ #define Z4_MIN_PIN X_DIAG_PIN #elif Z4_USE_ENDSTOP == _YDIAG_ diff --git a/Marlin/src/inc/Warnings.cpp b/Marlin/src/inc/Warnings.cpp index 2510949010..1976c09581 100644 --- a/Marlin/src/inc/Warnings.cpp +++ b/Marlin/src/inc/Warnings.cpp @@ -79,14 +79,20 @@ #warning "Auto-assigned X2_DIAG_PIN to X_MIN_PIN." #elif X2_USE_ENDSTOP == _XMAX_ #warning "Auto-assigned X2_DIAG_PIN to X_MAX_PIN." + #elif X2_USE_ENDSTOP == _XSTOP_ + #warning "Auto-assigned X2_DIAG_PIN to X_STOP_PIN." #elif X2_USE_ENDSTOP == _YMIN_ #warning "Auto-assigned X2_DIAG_PIN to Y_MIN_PIN." #elif X2_USE_ENDSTOP == _YMAX_ #warning "Auto-assigned X2_DIAG_PIN to Y_MAX_PIN." + #elif X2_USE_ENDSTOP == _YSTOP_ + #warning "Auto-assigned X2_DIAG_PIN to Y_STOP_PIN." #elif X2_USE_ENDSTOP == _ZMIN_ #warning "Auto-assigned X2_DIAG_PIN to Z_MIN_PIN." #elif X2_USE_ENDSTOP == _ZMAX_ #warning "Auto-assigned X2_DIAG_PIN to Z_MAX_PIN." + #elif X2_USE_ENDSTOP == _ZSTOP_ + #warning "Auto-assigned X2_DIAG_PIN to Z_STOP_PIN." #elif X2_USE_ENDSTOP == _XDIAG_ #warning "Auto-assigned X2_DIAG_PIN to X_DIAG_PIN." #elif X2_USE_ENDSTOP == _YDIAG_ @@ -131,14 +137,20 @@ #warning "Auto-assigned Y2_DIAG_PIN to X_MIN_PIN." #elif Y2_USE_ENDSTOP == _XMAX_ #warning "Auto-assigned Y2_DIAG_PIN to X_MAX_PIN." + #elif Y2_USE_ENDSTOP == _XSTOP_ + #warning "Auto-assigned Y2_DIAG_PIN to X_STOP_PIN." #elif Y2_USE_ENDSTOP == _YMIN_ #warning "Auto-assigned Y2_DIAG_PIN to Y_MIN_PIN." #elif Y2_USE_ENDSTOP == _YMAX_ #warning "Auto-assigned Y2_DIAG_PIN to Y_MAX_PIN." + #elif Y2_USE_ENDSTOP == _YSTOP_ + #warning "Auto-assigned Y2_DIAG_PIN to Y_STOP_PIN." #elif Y2_USE_ENDSTOP == _ZMIN_ #warning "Auto-assigned Y2_DIAG_PIN to Z_MIN_PIN." #elif Y2_USE_ENDSTOP == _ZMAX_ #warning "Auto-assigned Y2_DIAG_PIN to Z_MAX_PIN." + #elif Y2_USE_ENDSTOP == _ZSTOP_ + #warning "Auto-assigned Y2_DIAG_PIN to Z_STOP_PIN." #elif Y2_USE_ENDSTOP == _XDIAG_ #warning "Auto-assigned Y2_DIAG_PIN to X_DIAG_PIN." #elif Y2_USE_ENDSTOP == _YDIAG_ @@ -183,14 +195,20 @@ #warning "Auto-assigned Z2_DIAG_PIN to X_MIN_PIN." #elif Z2_USE_ENDSTOP == _XMAX_ #warning "Auto-assigned Z2_DIAG_PIN to X_MAX_PIN." + #elif Z2_USE_ENDSTOP == _XSTOP_ + #warning "Auto-assigned Z2_DIAG_PIN to X_STOP_PIN." #elif Z2_USE_ENDSTOP == _YMIN_ #warning "Auto-assigned Z2_DIAG_PIN to Y_MIN_PIN." #elif Z2_USE_ENDSTOP == _YMAX_ #warning "Auto-assigned Z2_DIAG_PIN to Y_MAX_PIN." + #elif Z2_USE_ENDSTOP == _YSTOP_ + #warning "Auto-assigned Z2_DIAG_PIN to Y_STOP_PIN." #elif Z2_USE_ENDSTOP == _ZMIN_ #warning "Auto-assigned Z2_DIAG_PIN to Z_MIN_PIN." #elif Z2_USE_ENDSTOP == _ZMAX_ #warning "Auto-assigned Z2_DIAG_PIN to Z_MAX_PIN." + #elif Z2_USE_ENDSTOP == _ZSTOP_ + #warning "Auto-assigned Z2_DIAG_PIN to Z_STOP_PIN." #elif Z2_USE_ENDSTOP == _XDIAG_ #warning "Auto-assigned Z2_DIAG_PIN to X_DIAG_PIN." #elif Z2_USE_ENDSTOP == _YDIAG_ @@ -235,14 +253,20 @@ #warning "Auto-assigned Z3_DIAG_PIN to X_MIN_PIN." #elif Z3_USE_ENDSTOP == _XMAX_ #warning "Auto-assigned Z3_DIAG_PIN to X_MAX_PIN." + #elif Z3_USE_ENDSTOP == _XSTOP_ + #warning "Auto-assigned Z3_DIAG_PIN to X_STOP_PIN." #elif Z3_USE_ENDSTOP == _YMIN_ #warning "Auto-assigned Z3_DIAG_PIN to Y_MIN_PIN." #elif Z3_USE_ENDSTOP == _YMAX_ #warning "Auto-assigned Z3_DIAG_PIN to Y_MAX_PIN." + #elif Z3_USE_ENDSTOP == _YSTOP_ + #warning "Auto-assigned Z3_DIAG_PIN to Y_STOP_PIN." #elif Z3_USE_ENDSTOP == _ZMIN_ #warning "Auto-assigned Z3_DIAG_PIN to Z_MIN_PIN." #elif Z3_USE_ENDSTOP == _ZMAX_ #warning "Auto-assigned Z3_DIAG_PIN to Z_MAX_PIN." + #elif Z3_USE_ENDSTOP == _ZSTOP_ + #warning "Auto-assigned Z3_DIAG_PIN to Z_STOP_PIN." #elif Z3_USE_ENDSTOP == _XDIAG_ #warning "Auto-assigned Z3_DIAG_PIN to X_DIAG_PIN." #elif Z3_USE_ENDSTOP == _YDIAG_ @@ -287,14 +311,20 @@ #warning "Auto-assigned Z4_DIAG_PIN to X_MIN_PIN." #elif Z4_USE_ENDSTOP == _XMAX_ #warning "Auto-assigned Z4_DIAG_PIN to X_MAX_PIN." + #elif Z4_USE_ENDSTOP == _XSTOP_ + #warning "Auto-assigned Z4_DIAG_PIN to X_STOP_PIN." #elif Z4_USE_ENDSTOP == _YMIN_ #warning "Auto-assigned Z4_DIAG_PIN to Y_MIN_PIN." #elif Z4_USE_ENDSTOP == _YMAX_ #warning "Auto-assigned Z4_DIAG_PIN to Y_MAX_PIN." + #elif Z4_USE_ENDSTOP == _YSTOP_ + #warning "Auto-assigned Z4_DIAG_PIN to Y_STOP_PIN." #elif Z4_USE_ENDSTOP == _ZMIN_ #warning "Auto-assigned Z4_DIAG_PIN to Z_MIN_PIN." #elif Z4_USE_ENDSTOP == _ZMAX_ #warning "Auto-assigned Z4_DIAG_PIN to Z_MAX_PIN." + #elif Z4_USE_ENDSTOP == _ZSTOP_ + #warning "Auto-assigned Z4_DIAG_PIN to Z_STOP_PIN." #elif Z4_USE_ENDSTOP == _XDIAG_ #warning "Auto-assigned Z4_DIAG_PIN to X_DIAG_PIN." #elif Z4_USE_ENDSTOP == _YDIAG_ @@ -339,14 +369,20 @@ #warning "Auto-assigned I_DIAG_PIN to X_MIN_PIN." #elif I_USE_ENDSTOP == _XMAX_ #warning "Auto-assigned I_DIAG_PIN to X_MAX_PIN." + #elif I_USE_ENDSTOP == _XSTOP_ + #warning "Auto-assigned I_DIAG_PIN to X_STOP_PIN." #elif I_USE_ENDSTOP == _YMIN_ #warning "Auto-assigned I_DIAG_PIN to Y_MIN_PIN." #elif I_USE_ENDSTOP == _YMAX_ #warning "Auto-assigned I_DIAG_PIN to Y_MAX_PIN." + #elif I_USE_ENDSTOP == _YSTOP_ + #warning "Auto-assigned I_DIAG_PIN to Y_STOP_PIN." #elif I_USE_ENDSTOP == _ZMIN_ #warning "Auto-assigned I_DIAG_PIN to Z_MIN_PIN." #elif I_USE_ENDSTOP == _ZMAX_ #warning "Auto-assigned I_DIAG_PIN to Z_MAX_PIN." + #elif I_USE_ENDSTOP == _ZSTOP_ + #warning "Auto-assigned I_DIAG_PIN to Z_STOP_PIN." #elif I_USE_ENDSTOP == _XDIAG_ #warning "Auto-assigned I_DIAG_PIN to X_DIAG_PIN." #elif I_USE_ENDSTOP == _YDIAG_ @@ -391,14 +427,20 @@ #warning "Auto-assigned J_DIAG_PIN to X_MIN_PIN." #elif J_USE_ENDSTOP == _XMAX_ #warning "Auto-assigned J_DIAG_PIN to X_MAX_PIN." + #elif J_USE_ENDSTOP == _XSTOP_ + #warning "Auto-assigned J_DIAG_PIN to X_STOP_PIN." #elif J_USE_ENDSTOP == _YMIN_ #warning "Auto-assigned J_DIAG_PIN to Y_MIN_PIN." #elif J_USE_ENDSTOP == _YMAX_ #warning "Auto-assigned J_DIAG_PIN to Y_MAX_PIN." + #elif J_USE_ENDSTOP == _YSTOP_ + #warning "Auto-assigned J_DIAG_PIN to Y_STOP_PIN." #elif J_USE_ENDSTOP == _ZMIN_ #warning "Auto-assigned J_DIAG_PIN to Z_MIN_PIN." #elif J_USE_ENDSTOP == _ZMAX_ #warning "Auto-assigned J_DIAG_PIN to Z_MAX_PIN." + #elif J_USE_ENDSTOP == _ZSTOP_ + #warning "Auto-assigned J_DIAG_PIN to Z_STOP_PIN." #elif J_USE_ENDSTOP == _XDIAG_ #warning "Auto-assigned J_DIAG_PIN to X_DIAG_PIN." #elif J_USE_ENDSTOP == _YDIAG_ @@ -443,14 +485,20 @@ #warning "Auto-assigned K_DIAG_PIN to X_MIN_PIN." #elif K_USE_ENDSTOP == _XMAX_ #warning "Auto-assigned K_DIAG_PIN to X_MAX_PIN." + #elif K_USE_ENDSTOP == _XSTOP_ + #warning "Auto-assigned K_DIAG_PIN to X_STOP_PIN." #elif K_USE_ENDSTOP == _YMIN_ #warning "Auto-assigned K_DIAG_PIN to Y_MIN_PIN." #elif K_USE_ENDSTOP == _YMAX_ #warning "Auto-assigned K_DIAG_PIN to Y_MAX_PIN." + #elif K_USE_ENDSTOP == _YSTOP_ + #warning "Auto-assigned K_DIAG_PIN to Y_STOP_PIN." #elif K_USE_ENDSTOP == _ZMIN_ #warning "Auto-assigned K_DIAG_PIN to Z_MIN_PIN." #elif K_USE_ENDSTOP == _ZMAX_ #warning "Auto-assigned K_DIAG_PIN to Z_MAX_PIN." + #elif K_USE_ENDSTOP == _ZSTOP_ + #warning "Auto-assigned K_DIAG_PIN to Z_STOP_PIN." #elif K_USE_ENDSTOP == _XDIAG_ #warning "Auto-assigned K_DIAG_PIN to X_DIAG_PIN." #elif K_USE_ENDSTOP == _YDIAG_ diff --git a/Marlin/src/pins/pins_postprocess.h b/Marlin/src/pins/pins_postprocess.h index d1047db0d7..1e6703fd4a 100644 --- a/Marlin/src/pins/pins_postprocess.h +++ b/Marlin/src/pins/pins_postprocess.h @@ -419,6 +419,9 @@ #else #define X_STOP_PIN X_MAX_PIN #endif +#if !defined(X2_USE_ENDSTOP) && ENABLED(X_DUAL_ENDSTOPS) && PIN_EXISTS(X_STOP) + #define X2_USE_ENDSTOP _XSTOP_ +#endif #if HAS_Y_AXIS #ifdef Y_STOP_PIN @@ -438,6 +441,9 @@ #else #define Y_STOP_PIN Y_MAX_PIN #endif + #if !defined(Y2_USE_ENDSTOP) && ENABLED(Y_DUAL_ENDSTOPS) && PIN_EXISTS(Y_STOP) + #define Y2_USE_ENDSTOP _YSTOP_ + #endif #endif #if HAS_Z_AXIS @@ -458,6 +464,17 @@ #else #define Z_STOP_PIN Z_MAX_PIN #endif + #if ENABLED(Z_MULTI_ENDSTOPS) && PIN_EXISTS(Z_STOP) + #ifndef Z2_USE_ENDSTOP + #define Z2_USE_ENDSTOP _ZSTOP_ + #endif + #if NUM_Z_STEPPER_DRIVERS >= 3 && !defined(Z3_USE_ENDSTOP) + #define Z3_USE_ENDSTOP _ZSTOP_ + #endif + #if NUM_Z_STEPPER_DRIVERS >= 4 && !defined(Z4_USE_ENDSTOP) + #define Z4_USE_ENDSTOP _ZSTOP_ + #endif + #endif #endif #if LINEAR_AXES >= 4 @@ -801,7 +818,7 @@ #endif #endif // Auto-assign pins for stallGuard sensorless homing - #if !defined(Z2_DIAG_PIN) && !defined(Z2_USE_ENDSTOP) && defined(Z2_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 2 && _PEXI(Z2_E_INDEX, DIAG) + #if !defined(Z2_DIAG_PIN) && !defined(Z2_USE_ENDSTOP) && defined(Z2_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && _PEXI(Z2_E_INDEX, DIAG) #define Z2_DIAG_PIN _EPIN(Z2_E_INDEX, DIAG) #if DIAG_REMAPPED(Z2, X_MIN) #define Z2_USE_ENDSTOP _XMIN_ @@ -886,7 +903,7 @@ #endif #endif // Auto-assign pins for stallGuard sensorless homing - #if !defined(Z3_DIAG_PIN) && !defined(Z3_USE_ENDSTOP) && defined(Z3_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3 && _PEXI(Z3_E_INDEX, DIAG) + #if !defined(Z3_DIAG_PIN) && !defined(Z3_USE_ENDSTOP) && defined(Z3_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && _PEXI(Z3_E_INDEX, DIAG) #define Z3_DIAG_PIN _EPIN(Z3_E_INDEX, DIAG) #if DIAG_REMAPPED(Z3, X_MIN) #define Z3_USE_ENDSTOP _XMIN_ @@ -971,7 +988,7 @@ #endif #endif // Auto-assign pins for stallGuard sensorless homing - #if !defined(Z4_DIAG_PIN) && !defined(Z4_USE_ENDSTOP) && defined(Z4_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 4 && _PEXI(Z4_E_INDEX, DIAG) + #if !defined(Z4_DIAG_PIN) && !defined(Z4_USE_ENDSTOP) && defined(Z4_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && _PEXI(Z4_E_INDEX, DIAG) #define Z4_DIAG_PIN _EPIN(Z4_E_INDEX, DIAG) #if DIAG_REMAPPED(Z4, X_MIN) #define Z4_USE_ENDSTOP _XMIN_ diff --git a/Marlin/src/pins/stm32f1/pins_CHITU3D_V9.h b/Marlin/src/pins/stm32f1/pins_CHITU3D_V9.h index eb7f91deab..0d02e1d5d9 100755 --- a/Marlin/src/pins/stm32f1/pins_CHITU3D_V9.h +++ b/Marlin/src/pins/stm32f1/pins_CHITU3D_V9.h @@ -28,7 +28,11 @@ #define Z2_ENABLE_PIN PF3 #define Z2_STEP_PIN PF5 #define Z2_DIR_PIN PF1 +#define Z2_STOP_PIN PA13 +#ifndef Z_MIN_PROBE_PIN + #define Z_MIN_PROBE_PIN PG9 +#endif #ifndef FIL_RUNOUT2_PIN #define FIL_RUNOUT2_PIN PF13 #endif From 4483b8aaf023576ea1c8ecfa84e7093ec26ad75a Mon Sep 17 00:00:00 2001 From: Robby Candra Date: Thu, 4 Nov 2021 17:28:42 +0700 Subject: [PATCH 102/125] =?UTF-8?q?=F0=9F=94=A8=20Fix=20IntelliSense=20/?= =?UTF-8?q?=20PIO=20conflicts=20(#23058)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/HAL/DUE/upload_extra_script.py | 19 +- Marlin/src/HAL/LPC1768/upload_extra_script.py | 200 +++--- Marlin/src/HAL/STM32F1/build_flags.py | 30 +- .../scripts/SAMD51_grandcentral_m4.py | 24 +- .../scripts/STM32F103RC_MEEB_3DP.py | 61 +- .../PlatformIO/scripts/STM32F103RC_fysetc.py | 43 +- .../scripts/STM32F1_create_variant.py | 40 +- .../share/PlatformIO/scripts/add_nanolib.py | 1 + .../share/PlatformIO/scripts/chitu_crypt.py | 167 ++--- .../PlatformIO/scripts/common-cxxflags.py | 60 +- .../scripts/common-dependencies-post.py | 22 +- .../PlatformIO/scripts/common-dependencies.py | 577 +++++++++--------- .../share/PlatformIO/scripts/custom_board.py | 20 +- .../PlatformIO/scripts/download_mks_assets.py | 84 ++- .../scripts/fix_framework_weakness.py | 47 +- .../scripts/generic_create_variant.py | 76 +-- .../jgaurora_a5s_a1_with_bootloader.py | 67 +- buildroot/share/PlatformIO/scripts/lerdge.py | 70 +-- buildroot/share/PlatformIO/scripts/marlin.py | 16 +- .../share/PlatformIO/scripts/mks_robin.py | 2 +- .../share/PlatformIO/scripts/mks_robin_e3.py | 2 +- .../share/PlatformIO/scripts/mks_robin_e3p.py | 2 +- .../PlatformIO/scripts/mks_robin_lite.py | 2 +- .../PlatformIO/scripts/mks_robin_lite3.py | 2 +- .../PlatformIO/scripts/mks_robin_mini.py | 2 +- .../PlatformIO/scripts/mks_robin_nano.py | 2 +- .../PlatformIO/scripts/mks_robin_nano35.py | 2 +- .../share/PlatformIO/scripts/mks_robin_pro.py | 2 +- .../PlatformIO/scripts/offset_and_rename.py | 80 +-- buildroot/share/PlatformIO/scripts/openblt.py | 28 +- buildroot/share/PlatformIO/scripts/pioutil.py | 8 +- .../PlatformIO/scripts/preflight-checks.py | 165 +++-- .../share/PlatformIO/scripts/random-bin.py | 10 +- buildroot/share/PlatformIO/scripts/robin.py | 16 +- .../share/PlatformIO/scripts/simulator.py | 68 ++- .../PlatformIO/scripts/stm32_serialbuffer.py | 98 +-- ini/stm32f1-maple.ini | 1 - 37 files changed, 1075 insertions(+), 1041 deletions(-) diff --git a/Marlin/src/HAL/DUE/upload_extra_script.py b/Marlin/src/HAL/DUE/upload_extra_script.py index d52a0a3642..4f7a494512 100644 --- a/Marlin/src/HAL/DUE/upload_extra_script.py +++ b/Marlin/src/HAL/DUE/upload_extra_script.py @@ -4,15 +4,16 @@ # Windows: bossac.exe # Other: leave unchanged # +import pioutil +if pioutil.is_pio_build(): + import platform + current_OS = platform.system() -import platform -current_OS = platform.system() + if current_OS == 'Windows': -if current_OS == 'Windows': + Import("env") - Import("env") - - # Use bossac.exe on Windows - env.Replace( - UPLOADCMD="bossac --info --unlock --write --verify --reset --erase -U false --boot $SOURCE" - ) + # Use bossac.exe on Windows + env.Replace( + UPLOADCMD="bossac --info --unlock --write --verify --reset --erase -U false --boot $SOURCE" + ) diff --git a/Marlin/src/HAL/LPC1768/upload_extra_script.py b/Marlin/src/HAL/LPC1768/upload_extra_script.py index fb3aaef7cd..7975f151f7 100755 --- a/Marlin/src/HAL/LPC1768/upload_extra_script.py +++ b/Marlin/src/HAL/LPC1768/upload_extra_script.py @@ -1,123 +1,127 @@ # -# sets output_port +# upload_extra_script.py +# set the output_port # if target_filename is found then that drive is used # else if target_drive is found then that drive is used # from __future__ import print_function -target_filename = "FIRMWARE.CUR" -target_drive = "REARM" +import pioutil +if pioutil.is_pio_build(): -import os,getpass,platform + target_filename = "FIRMWARE.CUR" + target_drive = "REARM" -current_OS = platform.system() -Import("env") + import os,getpass,platform -def print_error(e): - print('\nUnable to find destination disk (%s)\n' \ - 'Please select it in platformio.ini using the upload_port keyword ' \ - '(https://docs.platformio.org/en/latest/projectconf/section_env_upload.html) ' \ - 'or copy the firmware (.pio/build/%s/firmware.bin) manually to the appropriate disk\n' \ - %(e, env.get('PIOENV'))) + current_OS = platform.system() + Import("env") -def before_upload(source, target, env): - try: - # - # Find a disk for upload - # - upload_disk = 'Disk not found' - target_file_found = False - target_drive_found = False - if current_OS == 'Windows': + def print_error(e): + print('\nUnable to find destination disk (%s)\n' \ + 'Please select it in platformio.ini using the upload_port keyword ' \ + '(https://docs.platformio.org/en/latest/projectconf/section_env_upload.html) ' \ + 'or copy the firmware (.pio/build/%s/firmware.bin) manually to the appropriate disk\n' \ + %(e, env.get('PIOENV'))) + + def before_upload(source, target, env): + try: # - # platformio.ini will accept this for a Windows upload port designation: 'upload_port = L:' - # Windows - doesn't care about the disk's name, only cares about the drive letter - import subprocess,string - from ctypes import windll + # Find a disk for upload + # + upload_disk = 'Disk not found' + target_file_found = False + target_drive_found = False + if current_OS == 'Windows': + # + # platformio.ini will accept this for a Windows upload port designation: 'upload_port = L:' + # Windows - doesn't care about the disk's name, only cares about the drive letter + import subprocess,string + from ctypes import windll - # getting list of drives - # https://stackoverflow.com/questions/827371/is-there-a-way-to-list-all-the-available-drive-letters-in-python - drives = [] - bitmask = windll.kernel32.GetLogicalDrives() - for letter in string.ascii_uppercase: - if bitmask & 1: - drives.append(letter) - bitmask >>= 1 + # getting list of drives + # https://stackoverflow.com/questions/827371/is-there-a-way-to-list-all-the-available-drive-letters-in-python + drives = [] + bitmask = windll.kernel32.GetLogicalDrives() + for letter in string.ascii_uppercase: + if bitmask & 1: + drives.append(letter) + bitmask >>= 1 - for drive in drives: - final_drive_name = drive + ':\\' - # print ('disc check: {}'.format(final_drive_name)) - try: - volume_info = str(subprocess.check_output('cmd /C dir ' + final_drive_name, stderr=subprocess.STDOUT)) - except Exception as e: - print ('error:{}'.format(e)) - continue - else: - if target_drive in volume_info and not target_file_found: # set upload if not found target file yet - target_drive_found = True - upload_disk = final_drive_name - if target_filename in volume_info: - if not target_file_found: + for drive in drives: + final_drive_name = drive + ':\\' + # print ('disc check: {}'.format(final_drive_name)) + try: + volume_info = str(subprocess.check_output('cmd /C dir ' + final_drive_name, stderr=subprocess.STDOUT)) + except Exception as e: + print ('error:{}'.format(e)) + continue + else: + if target_drive in volume_info and not target_file_found: # set upload if not found target file yet + target_drive_found = True upload_disk = final_drive_name - target_file_found = True + if target_filename in volume_info: + if not target_file_found: + upload_disk = final_drive_name + target_file_found = True - elif current_OS == 'Linux': - # - # platformio.ini will accept this for a Linux upload port designation: 'upload_port = /media/media_name/drive' - # - drives = os.listdir(os.path.join(os.sep, 'media', getpass.getuser())) - if target_drive in drives: # If target drive is found, use it. - target_drive_found = True - upload_disk = os.path.join(os.sep, 'media', getpass.getuser(), target_drive) + os.sep - else: + elif current_OS == 'Linux': + # + # platformio.ini will accept this for a Linux upload port designation: 'upload_port = /media/media_name/drive' + # + drives = os.listdir(os.path.join(os.sep, 'media', getpass.getuser())) + if target_drive in drives: # If target drive is found, use it. + target_drive_found = True + upload_disk = os.path.join(os.sep, 'media', getpass.getuser(), target_drive) + os.sep + else: + for drive in drives: + try: + files = os.listdir(os.path.join(os.sep, 'media', getpass.getuser(), drive)) + except: + continue + else: + if target_filename in files: + upload_disk = os.path.join(os.sep, 'media', getpass.getuser(), drive) + os.sep + target_file_found = True + break + # + # set upload_port to drive if found + # + + if target_file_found or target_drive_found: + env.Replace( + UPLOAD_FLAGS="-P$UPLOAD_PORT" + ) + + elif current_OS == 'Darwin': # MAC + # + # platformio.ini will accept this for a OSX upload port designation: 'upload_port = /media/media_name/drive' + # + drives = os.listdir('/Volumes') # human readable names + if target_drive in drives and not target_file_found: # set upload if not found target file yet + target_drive_found = True + upload_disk = '/Volumes/' + target_drive + '/' for drive in drives: try: - files = os.listdir(os.path.join(os.sep, 'media', getpass.getuser(), drive)) + filenames = os.listdir('/Volumes/' + drive + '/') # will get an error if the drive is protected except: continue else: - if target_filename in files: - upload_disk = os.path.join(os.sep, 'media', getpass.getuser(), drive) + os.sep + if target_filename in filenames: + if not target_file_found: + upload_disk = '/Volumes/' + drive + '/' target_file_found = True - break - # - # set upload_port to drive if found - # + # + # Set upload_port to drive if found + # if target_file_found or target_drive_found: - env.Replace( - UPLOAD_FLAGS="-P$UPLOAD_PORT" - ) + env.Replace(UPLOAD_PORT=upload_disk) + print('\nUpload disk: ', upload_disk, '\n') + else: + print_error('Autodetect Error') - elif current_OS == 'Darwin': # MAC - # - # platformio.ini will accept this for a OSX upload port designation: 'upload_port = /media/media_name/drive' - # - drives = os.listdir('/Volumes') # human readable names - if target_drive in drives and not target_file_found: # set upload if not found target file yet - target_drive_found = True - upload_disk = '/Volumes/' + target_drive + '/' - for drive in drives: - try: - filenames = os.listdir('/Volumes/' + drive + '/') # will get an error if the drive is protected - except: - continue - else: - if target_filename in filenames: - if not target_file_found: - upload_disk = '/Volumes/' + drive + '/' - target_file_found = True + except Exception as e: + print_error(str(e)) - # - # Set upload_port to drive if found - # - if target_file_found or target_drive_found: - env.Replace(UPLOAD_PORT=upload_disk) - print('\nUpload disk: ', upload_disk, '\n') - else: - print_error('Autodetect Error') - - except Exception as e: - print_error(str(e)) - -env.AddPreAction("upload", before_upload) + env.AddPreAction("upload", before_upload) diff --git a/Marlin/src/HAL/STM32F1/build_flags.py b/Marlin/src/HAL/STM32F1/build_flags.py index d0848d1c64..970ca8b767 100755 --- a/Marlin/src/HAL/STM32F1/build_flags.py +++ b/Marlin/src/HAL/STM32F1/build_flags.py @@ -30,25 +30,27 @@ if __name__ == "__main__": # extra script for linker options else: - from SCons.Script import DefaultEnvironment - env = DefaultEnvironment() - env.Append( + import pioutil + if pioutil.is_pio_build(): + from SCons.Script import DefaultEnvironment + env = DefaultEnvironment() + env.Append( ARFLAGS=["rcs"], ASFLAGS=["-x", "assembler-with-cpp"], CXXFLAGS=[ - "-fabi-version=0", - "-fno-use-cxa-atexit", - "-fno-threadsafe-statics" + "-fabi-version=0", + "-fno-use-cxa-atexit", + "-fno-threadsafe-statics" ], LINKFLAGS=[ - "-Os", - "-mcpu=cortex-m3", - "-ffreestanding", - "-mthumb", - "--specs=nano.specs", - "--specs=nosys.specs", - "-u_printf_float", + "-Os", + "-mcpu=cortex-m3", + "-ffreestanding", + "-mthumb", + "--specs=nano.specs", + "--specs=nosys.specs", + "-u_printf_float", ], - ) + ) diff --git a/buildroot/share/PlatformIO/scripts/SAMD51_grandcentral_m4.py b/buildroot/share/PlatformIO/scripts/SAMD51_grandcentral_m4.py index 9e37024d11..be2c87266a 100644 --- a/buildroot/share/PlatformIO/scripts/SAMD51_grandcentral_m4.py +++ b/buildroot/share/PlatformIO/scripts/SAMD51_grandcentral_m4.py @@ -2,18 +2,20 @@ # SAMD51_grandcentral_m4.py # Customizations for env:SAMD51_grandcentral_m4 # -from os.path import join, isfile -import shutil -from pprint import pprint +import pioutil +if pioutil.is_pio_build(): + from os.path import join, isfile + import shutil + from pprint import pprint -Import("env") + Import("env") -mf = env["MARLIN_FEATURES"] -rxBuf = mf["RX_BUFFER_SIZE"] if "RX_BUFFER_SIZE" in mf else "0" -txBuf = mf["TX_BUFFER_SIZE"] if "TX_BUFFER_SIZE" in mf else "0" + mf = env["MARLIN_FEATURES"] + rxBuf = mf["RX_BUFFER_SIZE"] if "RX_BUFFER_SIZE" in mf else "0" + txBuf = mf["TX_BUFFER_SIZE"] if "TX_BUFFER_SIZE" in mf else "0" -serialBuf = str(max(int(rxBuf), int(txBuf), 350)) + serialBuf = str(max(int(rxBuf), int(txBuf), 350)) -build_flags = env.get('BUILD_FLAGS') -build_flags.append("-DSERIAL_BUFFER_SIZE=" + serialBuf) -env.Replace(BUILD_FLAGS=build_flags) + build_flags = env.get('BUILD_FLAGS') + build_flags.append("-DSERIAL_BUFFER_SIZE=" + serialBuf) + env.Replace(BUILD_FLAGS=build_flags) diff --git a/buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py b/buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py index e059d44578..eccee76068 100644 --- a/buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py +++ b/buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py @@ -1,40 +1,43 @@ # -# buildroot/share/PlatformIO/scripts/STM32F103RC_MEEB_3DP.py +# STM32F103RC_MEEB_3DP.py # -try: - import configparser -except ImportError: - import ConfigParser as configparser +import pioutil +if pioutil.is_pio_build(): -import os -Import("env", "projenv") + try: + import configparser + except ImportError: + import ConfigParser as configparser -config = configparser.ConfigParser() -config.read("platformio.ini") + import os + Import("env", "projenv") -# -# Upload actions -# -def before_upload(source, target, env): - env.Execute("pwd") + config = configparser.ConfigParser() + config.read("platformio.ini") -def after_upload(source, target, env): - env.Execute("pwd") + # + # Upload actions + # + def before_upload(source, target, env): + env.Execute("pwd") -env.AddPreAction("upload", before_upload) -env.AddPostAction("upload", after_upload) + def after_upload(source, target, env): + env.Execute("pwd") -flash_size = 0 -vect_tab_addr = 0 + env.AddPreAction("upload", before_upload) + env.AddPostAction("upload", after_upload) -for define in env['CPPDEFINES']: - if define[0] == "VECT_TAB_ADDR": - vect_tab_addr = define[1] - if define[0] == "STM32_FLASH_SIZE": - flash_size = define[1] + flash_size = 0 + vect_tab_addr = 0 -print('Use the {0:s} address as the marlin app entry point.'.format(vect_tab_addr)) -print('Use the {0:d}KB flash version of stm32f103rct6 chip.'.format(flash_size)) + for define in env['CPPDEFINES']: + if define[0] == "VECT_TAB_ADDR": + vect_tab_addr = define[1] + if define[0] == "STM32_FLASH_SIZE": + flash_size = define[1] -import marlin -marlin.custom_ld_script("STM32F103RC_MEEB_3DP.ld") + print('Use the {0:s} address as the marlin app entry point.'.format(vect_tab_addr)) + print('Use the {0:d}KB flash version of stm32f103rct6 chip.'.format(flash_size)) + + import marlin + marlin.custom_ld_script("STM32F103RC_MEEB_3DP.ld") diff --git a/buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py b/buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py index 07f6548b18..c9794702c3 100644 --- a/buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py +++ b/buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py @@ -1,25 +1,28 @@ # -# buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py +# STM32F103RC_fysetc.py # -from os.path import join -from os.path import expandvars -Import("env") +import pioutil +if pioutil.is_pio_build(): + import os + from os.path import join + from os.path import expandvars + Import("env") -# Custom HEX from ELF -env.AddPostAction( - join("$BUILD_DIR", "${PROGNAME}.elf"), - env.VerboseAction(" ".join([ - "$OBJCOPY", "-O ihex", "$TARGET", - "\"" + join("$BUILD_DIR", "${PROGNAME}.hex") + "\"", # Note: $BUILD_DIR is a full path - ]), "Building $TARGET")) + # Custom HEX from ELF + env.AddPostAction( + join("$BUILD_DIR", "${PROGNAME}.elf"), + env.VerboseAction(" ".join([ + "$OBJCOPY", "-O ihex", "$TARGET", + "\"" + join("$BUILD_DIR", "${PROGNAME}.hex") + "\"", # Note: $BUILD_DIR is a full path + ]), "Building $TARGET")) -# In-line command with arguments -UPLOAD_TOOL="stm32flash" -platform = env.PioPlatform() -if platform.get_package_dir("tool-stm32duino") != None: - UPLOAD_TOOL=expandvars("\"" + join(platform.get_package_dir("tool-stm32duino"),"stm32flash","stm32flash") + "\"") + # In-line command with arguments + UPLOAD_TOOL="stm32flash" + platform = env.PioPlatform() + if platform.get_package_dir("tool-stm32duino") != None: + UPLOAD_TOOL=expandvars("\"" + join(platform.get_package_dir("tool-stm32duino"),"stm32flash","stm32flash") + "\"") -env.Replace( - UPLOADER=UPLOAD_TOOL, - UPLOADCMD=expandvars(UPLOAD_TOOL + " -v -i rts,-dtr,dtr -R -b 115200 -g 0x8000000 -w \"" + join("$BUILD_DIR","${PROGNAME}.hex")+"\"" + " $UPLOAD_PORT") -) + env.Replace( + UPLOADER=UPLOAD_TOOL, + UPLOADCMD=expandvars(UPLOAD_TOOL + " -v -i rts,-dtr,dtr -R -b 115200 -g 0x8000000 -w \"" + join("$BUILD_DIR","${PROGNAME}.hex")+"\"" + " $UPLOAD_PORT") + ) diff --git a/buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py b/buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py index 0a38e1ceee..592fa50e5e 100644 --- a/buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py +++ b/buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py @@ -1,30 +1,32 @@ # # STM32F1_create_variant.py # -import os,shutil,marlin -from SCons.Script import DefaultEnvironment -from platformio import util +import pioutil +if pioutil.is_pio_build(): + import os,shutil,marlin + from SCons.Script import DefaultEnvironment + from platformio import util -env = DefaultEnvironment() -platform = env.PioPlatform() -board = env.BoardConfig() + env = DefaultEnvironment() + platform = env.PioPlatform() + board = env.BoardConfig() -FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoststm32-maple") -assert os.path.isdir(FRAMEWORK_DIR) + FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoststm32-maple") + assert os.path.isdir(FRAMEWORK_DIR) -source_root = os.path.join("buildroot", "share", "PlatformIO", "variants") -assert os.path.isdir(source_root) + source_root = os.path.join("buildroot", "share", "PlatformIO", "variants") + assert os.path.isdir(source_root) -variant = board.get("build.variant") -variant_dir = os.path.join(FRAMEWORK_DIR, "STM32F1", "variants", variant) + variant = board.get("build.variant") + variant_dir = os.path.join(FRAMEWORK_DIR, "STM32F1", "variants", variant) -source_dir = os.path.join(source_root, variant) -assert os.path.isdir(source_dir) + source_dir = os.path.join(source_root, variant) + assert os.path.isdir(source_dir) -if os.path.isdir(variant_dir): - shutil.rmtree(variant_dir) + if os.path.isdir(variant_dir): + shutil.rmtree(variant_dir) -if not os.path.isdir(variant_dir): - os.mkdir(variant_dir) + if not os.path.isdir(variant_dir): + os.mkdir(variant_dir) -marlin.copytree(source_dir, variant_dir) + marlin.copytree(source_dir, variant_dir) diff --git a/buildroot/share/PlatformIO/scripts/add_nanolib.py b/buildroot/share/PlatformIO/scripts/add_nanolib.py index 3b74b0d271..f5166d7d84 100644 --- a/buildroot/share/PlatformIO/scripts/add_nanolib.py +++ b/buildroot/share/PlatformIO/scripts/add_nanolib.py @@ -2,4 +2,5 @@ # add_nanolib.py # Import("env") + env.Append(LINKFLAGS=["--specs=nano.specs"]) diff --git a/buildroot/share/PlatformIO/scripts/chitu_crypt.py b/buildroot/share/PlatformIO/scripts/chitu_crypt.py index 23d81c1721..b28156bfb9 100644 --- a/buildroot/share/PlatformIO/scripts/chitu_crypt.py +++ b/buildroot/share/PlatformIO/scripts/chitu_crypt.py @@ -1,116 +1,117 @@ # -# buildroot/share/PlatformIO/scripts/chitu_crypt.py +# chitu_crypt.py # Customizations for Chitu boards # -import os,random,struct,uuid,marlin +import pioutil +if pioutil.is_pio_build(): + import os,random,struct,uuid,marlin + # Relocate firmware from 0x08000000 to 0x08008800 + marlin.relocate_firmware("0x08008800") -# Relocate firmware from 0x08000000 to 0x08008800 -marlin.relocate_firmware("0x08008800") + def calculate_crc(contents, seed): + accumulating_xor_value = seed; -def calculate_crc(contents, seed): - accumulating_xor_value = seed; + for i in range(0, len(contents), 4): + value = struct.unpack('> ip - # shift the xor_seed left by the bits in IP. - xor_seed = xor_seed >> ip + # load a byte into IP + ip = r0[loop_counter] - # load a byte into IP - ip = r0[loop_counter] + # XOR the seed with r7 + xor_seed = xor_seed ^ r7 - # XOR the seed with r7 - xor_seed = xor_seed ^ r7 + # and then with IP + xor_seed = xor_seed ^ ip - # and then with IP - xor_seed = xor_seed ^ ip + #Now store the byte back + r1[loop_counter] = xor_seed & 0xFF - #Now store the byte back - r1[loop_counter] = xor_seed & 0xFF + #increment the loop_counter + loop_counter = loop_counter + 1 - #increment the loop_counter - loop_counter = loop_counter + 1 + def encrypt_file(input, output_file, file_length): + input_file = bytearray(input.read()) + block_size = 0x800 + key_length = 0x18 -def encrypt_file(input, output_file, file_length): - input_file = bytearray(input.read()) - block_size = 0x800 - key_length = 0x18 + uid_value = uuid.uuid4() + file_key = int(uid_value.hex[0:8], 16) - uid_value = uuid.uuid4() - file_key = int(uid_value.hex[0:8], 16) + xor_crc = 0xEF3D4323; - xor_crc = 0xEF3D4323; + # the input file is exepcted to be in chunks of 0x800 + # so round the size + while len(input_file) % block_size != 0: + input_file.extend(b'0x0') - # the input file is exepcted to be in chunks of 0x800 - # so round the size - while len(input_file) % block_size != 0: - input_file.extend(b'0x0') + # write the file header + output_file.write(struct.pack(">I", 0x443D2D3F)) + # encrypt the contents using a known file header key - # write the file header - output_file.write(struct.pack(">I", 0x443D2D3F)) - # encrypt the contents using a known file header key + # write the file_key + output_file.write(struct.pack("= level: - print("[deps] %s" % str) + def validate_pio(): + PIO_VERSION_MIN = (5, 0, 3) + try: + from platformio import VERSION as PIO_VERSION + weights = (1000, 100, 1) + version_min = sum([x[0] * float(re.sub(r'[^0-9]', '.', str(x[1]))) for x in zip(weights, PIO_VERSION_MIN)]) + version_cur = sum([x[0] * float(re.sub(r'[^0-9]', '.', str(x[1]))) for x in zip(weights, PIO_VERSION)]) + if version_cur < version_min: + print() + print("**************************************************") + print("****** An update to PlatformIO is ******") + print("****** required to build Marlin Firmware. ******") + print("****** ******") + print("****** Minimum version: ", PIO_VERSION_MIN, " ******") + print("****** Current Version: ", PIO_VERSION, " ******") + print("****** ******") + print("****** Update PlatformIO and try again. ******") + print("**************************************************") + print() + exit(1) + except SystemExit: + exit(1) + except: + print("Can't detect PlatformIO Version") -FEATURE_CONFIG = {} + def blab(str,level=1): + if verbose >= level: + print("[deps] %s" % str) -def add_to_feat_cnf(feature, flines): + def add_to_feat_cnf(feature, flines): - try: - feat = FEATURE_CONFIG[feature] - except: - FEATURE_CONFIG[feature] = {} - - # Get a reference to the FEATURE_CONFIG under construction - feat = FEATURE_CONFIG[feature] - - # Split up passed lines on commas or newlines and iterate - # Add common options to the features config under construction - # For lib_deps replace a previous instance of the same library - atoms = re.sub(r',\\s*', '\n', flines).strip().split('\n') - for line in atoms: - parts = line.split('=') - name = parts.pop(0) - if name in ['build_flags', 'extra_scripts', 'src_filter', 'lib_ignore']: - feat[name] = '='.join(parts) - blab("[%s] %s=%s" % (feature, name, feat[name]), 3) - else: - for dep in re.split(r",\s*", line): - lib_name = re.sub(r'@([~^]|[<>]=?)?[\d.]+', '', dep.strip()).split('=').pop(0) - lib_re = re.compile('(?!^' + lib_name + '\\b)') - feat['lib_deps'] = list(filter(lib_re.match, feat['lib_deps'])) + [dep] - blab("[%s] lib_deps = %s" % (feature, dep), 3) - -def load_config(): - blab("========== Gather [features] entries...") - items = ProjectConfig().items('features') - for key in items: - feature = key[0].upper() - if not feature in FEATURE_CONFIG: - FEATURE_CONFIG[feature] = { 'lib_deps': [] } - add_to_feat_cnf(feature, key[1]) - - # Add options matching custom_marlin.MY_OPTION to the pile - blab("========== Gather custom_marlin entries...") - all_opts = env.GetProjectOptions() - for n in all_opts: - key = n[0] - mat = re.match(r'custom_marlin\.(.+)', key) - if mat: - try: - val = env.GetProjectOption(key) - except: - val = None - if val: - opt = mat.group(1).upper() - blab("%s.custom_marlin.%s = '%s'" % ( env['PIOENV'], opt, val )) - add_to_feat_cnf(opt, val) - -def get_all_known_libs(): - known_libs = [] - for feature in FEATURE_CONFIG: - feat = FEATURE_CONFIG[feature] - if not 'lib_deps' in feat: - continue - for dep in feat['lib_deps']: - known_libs.append(PackageSpec(dep).name) - return known_libs - -def get_all_env_libs(): - env_libs = [] - lib_deps = env.GetProjectOption('lib_deps') - for dep in lib_deps: - env_libs.append(PackageSpec(dep).name) - return env_libs - -def set_env_field(field, value): - proj = env.GetProjectConfig() - proj.set("env:" + env['PIOENV'], field, value) - -# All unused libs should be ignored so that if a library -# exists in .pio/lib_deps it will not break compilation. -def force_ignore_unused_libs(): - env_libs = get_all_env_libs() - known_libs = get_all_known_libs() - diff = (list(set(known_libs) - set(env_libs))) - lib_ignore = env.GetProjectOption('lib_ignore') + diff - blab("Ignore libraries: %s" % lib_ignore) - set_env_field('lib_ignore', lib_ignore) - -def apply_features_config(): - load_config() - blab("========== Apply enabled features...") - for feature in FEATURE_CONFIG: - if not env.MarlinFeatureIsEnabled(feature): - continue + try: + feat = FEATURE_CONFIG[feature] + except: + FEATURE_CONFIG[feature] = {} + # Get a reference to the FEATURE_CONFIG under construction feat = FEATURE_CONFIG[feature] - if 'lib_deps' in feat and len(feat['lib_deps']): - blab("========== Adding lib_deps for %s... " % feature, 2) + # Split up passed lines on commas or newlines and iterate + # Add common options to the features config under construction + # For lib_deps replace a previous instance of the same library + atoms = re.sub(r',\\s*', '\n', flines).strip().split('\n') + for line in atoms: + parts = line.split('=') + name = parts.pop(0) + if name in ['build_flags', 'extra_scripts', 'src_filter', 'lib_ignore']: + feat[name] = '='.join(parts) + blab("[%s] %s=%s" % (feature, name, feat[name]), 3) + else: + for dep in re.split(r",\s*", line): + lib_name = re.sub(r'@([~^]|[<>]=?)?[\d.]+', '', dep.strip()).split('=').pop(0) + lib_re = re.compile('(?!^' + lib_name + '\\b)') + feat['lib_deps'] = list(filter(lib_re.match, feat['lib_deps'])) + [dep] + blab("[%s] lib_deps = %s" % (feature, dep), 3) - # feat to add - deps_to_add = {} + def load_config(): + blab("========== Gather [features] entries...") + items = ProjectConfig().items('features') + for key in items: + feature = key[0].upper() + if not feature in FEATURE_CONFIG: + FEATURE_CONFIG[feature] = { 'lib_deps': [] } + add_to_feat_cnf(feature, key[1]) + + # Add options matching custom_marlin.MY_OPTION to the pile + blab("========== Gather custom_marlin entries...") + all_opts = env.GetProjectOptions() + for n in all_opts: + key = n[0] + mat = re.match(r'custom_marlin\.(.+)', key) + if mat: + try: + val = env.GetProjectOption(key) + except: + val = None + if val: + opt = mat.group(1).upper() + blab("%s.custom_marlin.%s = '%s'" % ( env['PIOENV'], opt, val )) + add_to_feat_cnf(opt, val) + + def get_all_known_libs(): + known_libs = [] + for feature in FEATURE_CONFIG: + feat = FEATURE_CONFIG[feature] + if not 'lib_deps' in feat: + continue for dep in feat['lib_deps']: - deps_to_add[PackageSpec(dep).name] = dep - blab("==================== %s... " % dep, 2) + known_libs.append(PackageSpec(dep).name) + return known_libs - # Does the env already have the dependency? - deps = env.GetProjectOption('lib_deps') - for dep in deps: - name = PackageSpec(dep).name - if name in deps_to_add: - del deps_to_add[name] + def get_all_env_libs(): + env_libs = [] + lib_deps = env.GetProjectOption('lib_deps') + for dep in lib_deps: + env_libs.append(PackageSpec(dep).name) + return env_libs - # Are there any libraries that should be ignored? - lib_ignore = env.GetProjectOption('lib_ignore') - for dep in deps: - name = PackageSpec(dep).name - if name in deps_to_add: - del deps_to_add[name] + def set_env_field(field, value): + proj = env.GetProjectConfig() + proj.set("env:" + env['PIOENV'], field, value) - # Is there anything left? - if len(deps_to_add) > 0: - # Only add the missing dependencies - set_env_field('lib_deps', deps + list(deps_to_add.values())) + # All unused libs should be ignored so that if a library + # exists in .pio/lib_deps it will not break compilation. + def force_ignore_unused_libs(): + env_libs = get_all_env_libs() + known_libs = get_all_known_libs() + diff = (list(set(known_libs) - set(env_libs))) + lib_ignore = env.GetProjectOption('lib_ignore') + diff + blab("Ignore libraries: %s" % lib_ignore) + set_env_field('lib_ignore', lib_ignore) - if 'build_flags' in feat: - f = feat['build_flags'] - blab("========== Adding build_flags for %s: %s" % (feature, f), 2) - new_flags = env.GetProjectOption('build_flags') + [ f ] - env.Replace(BUILD_FLAGS=new_flags) + def apply_features_config(): + load_config() + blab("========== Apply enabled features...") + for feature in FEATURE_CONFIG: + if not env.MarlinFeatureIsEnabled(feature): + continue - if 'extra_scripts' in feat: - blab("Running extra_scripts for %s... " % feature, 2) - env.SConscript(feat['extra_scripts'], exports="env") + feat = FEATURE_CONFIG[feature] - if 'src_filter' in feat: - blab("========== Adding src_filter for %s... " % feature, 2) - src_filter = ' '.join(env.GetProjectOption('src_filter')) - # first we need to remove the references to the same folder - my_srcs = re.findall(r'[+-](<.*?>)', feat['src_filter']) - cur_srcs = re.findall(r'[+-](<.*?>)', src_filter) - for d in my_srcs: - if d in cur_srcs: - src_filter = re.sub(r'[+-]' + d, '', src_filter) + if 'lib_deps' in feat and len(feat['lib_deps']): + blab("========== Adding lib_deps for %s... " % feature, 2) - src_filter = feat['src_filter'] + ' ' + src_filter - set_env_field('src_filter', [src_filter]) - env.Replace(SRC_FILTER=src_filter) + # feat to add + deps_to_add = {} + for dep in feat['lib_deps']: + deps_to_add[PackageSpec(dep).name] = dep + blab("==================== %s... " % dep, 2) - if 'lib_ignore' in feat: - blab("========== Adding lib_ignore for %s... " % feature, 2) - lib_ignore = env.GetProjectOption('lib_ignore') + [feat['lib_ignore']] - set_env_field('lib_ignore', lib_ignore) + # Does the env already have the dependency? + deps = env.GetProjectOption('lib_deps') + for dep in deps: + name = PackageSpec(dep).name + if name in deps_to_add: + del deps_to_add[name] -# -# Find a compiler, considering the OS -# -ENV_BUILD_PATH = os.path.join(env.Dictionary('PROJECT_BUILD_DIR'), env['PIOENV']) -GCC_PATH_CACHE = os.path.join(ENV_BUILD_PATH, ".gcc_path") -def search_compiler(): - try: - filepath = env.GetProjectOption('custom_gcc') - blab("Getting compiler from env") + # Are there any libraries that should be ignored? + lib_ignore = env.GetProjectOption('lib_ignore') + for dep in deps: + name = PackageSpec(dep).name + if name in deps_to_add: + del deps_to_add[name] + + # Is there anything left? + if len(deps_to_add) > 0: + # Only add the missing dependencies + set_env_field('lib_deps', deps + list(deps_to_add.values())) + + if 'build_flags' in feat: + f = feat['build_flags'] + blab("========== Adding build_flags for %s: %s" % (feature, f), 2) + new_flags = env.GetProjectOption('build_flags') + [ f ] + env.Replace(BUILD_FLAGS=new_flags) + + if 'extra_scripts' in feat: + blab("Running extra_scripts for %s... " % feature, 2) + env.SConscript(feat['extra_scripts'], exports="env") + + if 'src_filter' in feat: + blab("========== Adding src_filter for %s... " % feature, 2) + src_filter = ' '.join(env.GetProjectOption('src_filter')) + # first we need to remove the references to the same folder + my_srcs = re.findall(r'[+-](<.*?>)', feat['src_filter']) + cur_srcs = re.findall(r'[+-](<.*?>)', src_filter) + for d in my_srcs: + if d in cur_srcs: + src_filter = re.sub(r'[+-]' + d, '', src_filter) + + src_filter = feat['src_filter'] + ' ' + src_filter + set_env_field('src_filter', [src_filter]) + env.Replace(SRC_FILTER=src_filter) + + if 'lib_ignore' in feat: + blab("========== Adding lib_ignore for %s... " % feature, 2) + lib_ignore = env.GetProjectOption('lib_ignore') + [feat['lib_ignore']] + set_env_field('lib_ignore', lib_ignore) + + # + # Find a compiler, considering the OS + # + ENV_BUILD_PATH = os.path.join(env.Dictionary('PROJECT_BUILD_DIR'), env['PIOENV']) + GCC_PATH_CACHE = os.path.join(ENV_BUILD_PATH, ".gcc_path") + def search_compiler(): + try: + filepath = env.GetProjectOption('custom_gcc') + blab("Getting compiler from env") + return filepath + except: + pass + + if os.path.exists(GCC_PATH_CACHE): + with open(GCC_PATH_CACHE, 'r') as f: + return f.read() + + # Find the current platform compiler by searching the $PATH + # which will be in a platformio toolchain bin folder + path_regex = re.escape(env['PROJECT_PACKAGES_DIR']) + + # See if the environment provides a default compiler + try: + gcc = env.GetProjectOption('custom_deps_gcc') + except: + gcc = "g++" + + if env['PLATFORM'] == 'win32': + path_separator = ';' + path_regex += r'.*\\bin' + gcc += ".exe" + else: + path_separator = ':' + path_regex += r'/.+/bin' + + # Search for the compiler + for pathdir in env['ENV']['PATH'].split(path_separator): + if not re.search(path_regex, pathdir, re.IGNORECASE): + continue + for filepath in os.listdir(pathdir): + if not filepath.endswith(gcc): + continue + # Use entire path to not rely on env PATH + filepath = os.path.sep.join([pathdir, filepath]) + # Cache the g++ path to no search always + if os.path.exists(ENV_BUILD_PATH): + with open(GCC_PATH_CACHE, 'w+') as f: + f.write(filepath) + + return filepath + + filepath = env.get('CXX') + if filepath == 'CC': + filepath = gcc + blab("Couldn't find a compiler! Fallback to %s" % filepath) return filepath + + # + # Use the compiler to get a list of all enabled features + # + def load_marlin_features(): + if 'MARLIN_FEATURES' in env: + return + + # Process defines + build_flags = env.get('BUILD_FLAGS') + build_flags = env.ParseFlagsExtended(build_flags) + + cxx = search_compiler() + cmd = ['"' + cxx + '"'] + + # Build flags from board.json + #if 'BOARD' in env: + # cmd += [env.BoardConfig().get("build.extra_flags")] + for s in build_flags['CPPDEFINES']: + if isinstance(s, tuple): + cmd += ['-D' + s[0] + '=' + str(s[1])] + else: + cmd += ['-D' + s] + + cmd += ['-D__MARLIN_DEPS__ -w -dM -E -x c++ buildroot/share/PlatformIO/scripts/common-dependencies.h'] + cmd = ' '.join(cmd) + blab(cmd, 4) + define_list = subprocess.check_output(cmd, shell=True).splitlines() + marlin_features = {} + for define in define_list: + feature = define[8:].strip().decode().split(' ') + feature, definition = feature[0], ' '.join(feature[1:]) + marlin_features[feature] = definition + env['MARLIN_FEATURES'] = marlin_features + + # + # Return True if a matching feature is enabled + # + def MarlinFeatureIsEnabled(env, feature): + load_marlin_features() + r = re.compile('^' + feature + '$') + found = list(filter(r.match, env['MARLIN_FEATURES'])) + + # Defines could still be 'false' or '0', so check + some_on = False + if len(found): + for f in found: + val = env['MARLIN_FEATURES'][f] + if val in [ '', '1', 'true' ]: + some_on = True + elif val in env['MARLIN_FEATURES']: + some_on = env.MarlinFeatureIsEnabled(val) + + return some_on + + validate_pio() + + try: + verbose = int(env.GetProjectOption('custom_verbose')) except: pass - if os.path.exists(GCC_PATH_CACHE): - with open(GCC_PATH_CACHE, 'r') as f: - return f.read() + # Add a method for other PIO scripts to query enabled features + env.AddMethod(MarlinFeatureIsEnabled) - # Find the current platform compiler by searching the $PATH - # which will be in a platformio toolchain bin folder - path_regex = re.escape(env['PROJECT_PACKAGES_DIR']) - - # See if the environment provides a default compiler - try: - gcc = env.GetProjectOption('custom_deps_gcc') - except: - gcc = "g++" - - if env['PLATFORM'] == 'win32': - path_separator = ';' - path_regex += r'.*\\bin' - gcc += ".exe" - else: - path_separator = ':' - path_regex += r'/.+/bin' - - # Search for the compiler - for pathdir in env['ENV']['PATH'].split(path_separator): - if not re.search(path_regex, pathdir, re.IGNORECASE): - continue - for filepath in os.listdir(pathdir): - if not filepath.endswith(gcc): - continue - # Use entire path to not rely on env PATH - filepath = os.path.sep.join([pathdir, filepath]) - # Cache the g++ path to no search always - if os.path.exists(ENV_BUILD_PATH): - with open(GCC_PATH_CACHE, 'w+') as f: - f.write(filepath) - - return filepath - - filepath = env.get('CXX') - if filepath == 'CC': - filepath = gcc - blab("Couldn't find a compiler! Fallback to %s" % filepath) - return filepath - -# -# Use the compiler to get a list of all enabled features -# -def load_marlin_features(): - if 'MARLIN_FEATURES' in env: - return - - # Process defines - build_flags = env.get('BUILD_FLAGS') - build_flags = env.ParseFlagsExtended(build_flags) - - cxx = search_compiler() - cmd = ['"' + cxx + '"'] - - # Build flags from board.json - #if 'BOARD' in env: - # cmd += [env.BoardConfig().get("build.extra_flags")] - for s in build_flags['CPPDEFINES']: - if isinstance(s, tuple): - cmd += ['-D' + s[0] + '=' + str(s[1])] - else: - cmd += ['-D' + s] - - cmd += ['-D__MARLIN_DEPS__ -w -dM -E -x c++ buildroot/share/PlatformIO/scripts/common-dependencies.h'] - cmd = ' '.join(cmd) - blab(cmd, 4) - define_list = subprocess.check_output(cmd, shell=True).splitlines() - marlin_features = {} - for define in define_list: - feature = define[8:].strip().decode().split(' ') - feature, definition = feature[0], ' '.join(feature[1:]) - marlin_features[feature] = definition - env['MARLIN_FEATURES'] = marlin_features - -# -# Return True if a matching feature is enabled -# -def MarlinFeatureIsEnabled(env, feature): - load_marlin_features() - r = re.compile('^' + feature + '$') - found = list(filter(r.match, env['MARLIN_FEATURES'])) - - # Defines could still be 'false' or '0', so check - some_on = False - if len(found): - for f in found: - val = env['MARLIN_FEATURES'][f] - if val in [ '', '1', 'true' ]: - some_on = True - elif val in env['MARLIN_FEATURES']: - some_on = env.MarlinFeatureIsEnabled(val) - - return some_on - -# -# Add a method for other PIO scripts to query enabled features -# -env.AddMethod(MarlinFeatureIsEnabled) - -# -# Add dependencies for enabled Marlin features -# -apply_features_config() -force_ignore_unused_libs() + # Add dependencies for enabled Marlin features + apply_features_config() + force_ignore_unused_libs() diff --git a/buildroot/share/PlatformIO/scripts/custom_board.py b/buildroot/share/PlatformIO/scripts/custom_board.py index e462738190..da3bdca0bb 100644 --- a/buildroot/share/PlatformIO/scripts/custom_board.py +++ b/buildroot/share/PlatformIO/scripts/custom_board.py @@ -1,16 +1,18 @@ # -# buildroot/share/PlatformIO/scripts/custom_board.py +# custom_board.py # # - For build.address replace VECT_TAB_ADDR to relocate the firmware # - For build.ldscript use one of the linker scripts in buildroot/share/PlatformIO/ldscripts # -import marlin -board = marlin.env.BoardConfig() +import pioutil +if pioutil.is_pio_build(): + import marlin + board = marlin.env.BoardConfig() -address = board.get("build.address", "") -if address: - marlin.relocate_firmware(address) + address = board.get("build.address", "") + if address: + marlin.relocate_firmware(address) -ldscript = board.get("build.ldscript", "") -if ldscript: - marlin.custom_ld_script(ldscript) + ldscript = board.get("build.ldscript", "") + if ldscript: + marlin.custom_ld_script(ldscript) diff --git a/buildroot/share/PlatformIO/scripts/download_mks_assets.py b/buildroot/share/PlatformIO/scripts/download_mks_assets.py index 251a74a4cc..1990400222 100644 --- a/buildroot/share/PlatformIO/scripts/download_mks_assets.py +++ b/buildroot/share/PlatformIO/scripts/download_mks_assets.py @@ -1,51 +1,49 @@ # -# buildroot/share/PlatformIO/scripts/download_mks_assets.py +# download_mks_assets.py # Added by HAS_TFT_LVGL_UI to download assets from Makerbase repo # -Import("env") -import os,requests,zipfile,tempfile,shutil,pioutil +import pioutil +if pioutil.is_pio_build(): + Import("env") + import os,requests,zipfile,tempfile,shutil -# Detect that 'vscode init' is running -if pioutil.is_vscode_init(): - env.Exit(0) + url = "https://github.com/makerbase-mks/Mks-Robin-Nano-Marlin2.0-Firmware/archive/0263cdaccf.zip" + deps_path = env.Dictionary("PROJECT_LIBDEPS_DIR") + zip_path = os.path.join(deps_path, "mks-assets.zip") + assets_path = os.path.join(env.Dictionary("PROJECT_BUILD_DIR"), env.Dictionary("PIOENV"), "assets") -url = "https://github.com/makerbase-mks/Mks-Robin-Nano-Marlin2.0-Firmware/archive/0263cdaccf.zip" -deps_path = env.Dictionary("PROJECT_LIBDEPS_DIR") -zip_path = os.path.join(deps_path, "mks-assets.zip") -assets_path = os.path.join(env.Dictionary("PROJECT_BUILD_DIR"), env.Dictionary("PIOENV"), "assets") + def download_mks_assets(): + print("Downloading MKS Assets") + r = requests.get(url, stream=True) + # the user may have a very clean workspace, + # so create the PROJECT_LIBDEPS_DIR directory if not exits + if os.path.exists(deps_path) == False: + os.mkdir(deps_path) + with open(zip_path, 'wb') as fd: + for chunk in r.iter_content(chunk_size=128): + fd.write(chunk) -def download_mks_assets(): - print("Downloading MKS Assets") - r = requests.get(url, stream=True) - # the user may have a very clean workspace, - # so create the PROJECT_LIBDEPS_DIR directory if not exits - if os.path.exists(deps_path) == False: - os.mkdir(deps_path) - with open(zip_path, 'wb') as fd: - for chunk in r.iter_content(chunk_size=128): - fd.write(chunk) + def copy_mks_assets(): + print("Copying MKS Assets") + output_path = tempfile.mkdtemp() + zip_obj = zipfile.ZipFile(zip_path, 'r') + zip_obj.extractall(output_path) + zip_obj.close() + if os.path.exists(assets_path) == True and os.path.isdir(assets_path) == False: + os.unlink(assets_path) + if os.path.exists(assets_path) == False: + os.mkdir(assets_path) + base_path = '' + for filename in os.listdir(output_path): + base_path = filename + for filename in os.listdir(os.path.join(output_path, base_path, 'Firmware', 'mks_font')): + shutil.copy(os.path.join(output_path, base_path, 'Firmware', 'mks_font', filename), assets_path) + for filename in os.listdir(os.path.join(output_path, base_path, 'Firmware', 'mks_pic')): + shutil.copy(os.path.join(output_path, base_path, 'Firmware', 'mks_pic', filename), assets_path) + shutil.rmtree(output_path, ignore_errors=True) + + if os.path.exists(zip_path) == False: + download_mks_assets() -def copy_mks_assets(): - print("Copying MKS Assets") - output_path = tempfile.mkdtemp() - zip_obj = zipfile.ZipFile(zip_path, 'r') - zip_obj.extractall(output_path) - zip_obj.close() - if os.path.exists(assets_path) == True and os.path.isdir(assets_path) == False: - os.unlink(assets_path) if os.path.exists(assets_path) == False: - os.mkdir(assets_path) - base_path = '' - for filename in os.listdir(output_path): - base_path = filename - for filename in os.listdir(os.path.join(output_path, base_path, 'Firmware', 'mks_font')): - shutil.copy(os.path.join(output_path, base_path, 'Firmware', 'mks_font', filename), assets_path) - for filename in os.listdir(os.path.join(output_path, base_path, 'Firmware', 'mks_pic')): - shutil.copy(os.path.join(output_path, base_path, 'Firmware', 'mks_pic', filename), assets_path) - shutil.rmtree(output_path, ignore_errors=True) - -if os.path.exists(zip_path) == False: - download_mks_assets() - -if os.path.exists(assets_path) == False: - copy_mks_assets() + copy_mks_assets() diff --git a/buildroot/share/PlatformIO/scripts/fix_framework_weakness.py b/buildroot/share/PlatformIO/scripts/fix_framework_weakness.py index fa91b7bb70..663e7c76d9 100644 --- a/buildroot/share/PlatformIO/scripts/fix_framework_weakness.py +++ b/buildroot/share/PlatformIO/scripts/fix_framework_weakness.py @@ -1,32 +1,35 @@ # # fix_framework_weakness.py # -from os.path import join, isfile -import shutil -from pprint import pprint +import pioutil +if pioutil.is_pio_build(): -Import("env") + import shutil + from os.path import join, isfile + from pprint import pprint -if env.MarlinFeatureIsEnabled("POSTMORTEM_DEBUGGING"): - FRAMEWORK_DIR = env.PioPlatform().get_package_dir("framework-arduinoststm32-maple") - patchflag_path = join(FRAMEWORK_DIR, ".exc-patching-done") + Import("env") - # patch file only if we didn't do it before - if not isfile(patchflag_path): - print("Patching libmaple exception handlers") - original_file = join(FRAMEWORK_DIR, "STM32F1", "cores", "maple", "libmaple", "exc.S") - backup_file = join(FRAMEWORK_DIR, "STM32F1", "cores", "maple", "libmaple", "exc.S.bak") - src_file = join("buildroot", "share", "PlatformIO", "scripts", "exc.S") + if env.MarlinFeatureIsEnabled("POSTMORTEM_DEBUGGING"): + FRAMEWORK_DIR = env.PioPlatform().get_package_dir("framework-arduinoststm32-maple") + patchflag_path = join(FRAMEWORK_DIR, ".exc-patching-done") - assert isfile(original_file) and isfile(src_file) - shutil.copyfile(original_file, backup_file) - shutil.copyfile(src_file, original_file); + # patch file only if we didn't do it before + if not isfile(patchflag_path): + print("Patching libmaple exception handlers") + original_file = join(FRAMEWORK_DIR, "STM32F1", "cores", "maple", "libmaple", "exc.S") + backup_file = join(FRAMEWORK_DIR, "STM32F1", "cores", "maple", "libmaple", "exc.S.bak") + src_file = join("buildroot", "share", "PlatformIO", "scripts", "exc.S") - def _touch(path): - with open(path, "w") as fp: - fp.write("") + assert isfile(original_file) and isfile(src_file) + shutil.copyfile(original_file, backup_file) + shutil.copyfile(src_file, original_file); - env.Execute(lambda *args, **kwargs: _touch(patchflag_path)) - print("Done patching exception handler") + def _touch(path): + with open(path, "w") as fp: + fp.write("") - print("Libmaple modified and ready for post mortem debugging") + env.Execute(lambda *args, **kwargs: _touch(patchflag_path)) + print("Done patching exception handler") + + print("Libmaple modified and ready for post mortem debugging") diff --git a/buildroot/share/PlatformIO/scripts/generic_create_variant.py b/buildroot/share/PlatformIO/scripts/generic_create_variant.py index 7f76ef9426..52473c752a 100644 --- a/buildroot/share/PlatformIO/scripts/generic_create_variant.py +++ b/buildroot/share/PlatformIO/scripts/generic_create_variant.py @@ -5,50 +5,52 @@ # the appropriate framework variants folder, so that its contents # will be picked up by PlatformIO just like any other variant. # -import os,shutil,marlin -from SCons.Script import DefaultEnvironment -from platformio import util +import pioutil +if pioutil.is_pio_build(): + import os,shutil,marlin + from SCons.Script import DefaultEnvironment + from platformio import util -env = DefaultEnvironment() + env = DefaultEnvironment() -# -# Get the platform name from the 'platform_packages' option, -# or look it up by the platform.class.name. -# -platform = env.PioPlatform() + # + # Get the platform name from the 'platform_packages' option, + # or look it up by the platform.class.name. + # + platform = env.PioPlatform() -from platformio.package.meta import PackageSpec -platform_packages = env.GetProjectOption('platform_packages') -if len(platform_packages) == 0: - framewords = { - "Ststm32Platform": "framework-arduinoststm32", - "AtmelavrPlatform": "framework-arduino-avr" - } - platform_name = framewords[platform.__class__.__name__] -else: - platform_name = PackageSpec(platform_packages[0]).name + from platformio.package.meta import PackageSpec + platform_packages = env.GetProjectOption('platform_packages') + if len(platform_packages) == 0: + framewords = { + "Ststm32Platform": "framework-arduinoststm32", + "AtmelavrPlatform": "framework-arduino-avr" + } + platform_name = framewords[platform.__class__.__name__] + else: + platform_name = PackageSpec(platform_packages[0]).name -if platform_name in [ "usb-host-msc", "usb-host-msc-cdc-msc", "usb-host-msc-cdc-msc-2", "usb-host-msc-cdc-msc-3", "tool-stm32duino" ]: - platform_name = "framework-arduinoststm32" + if platform_name in [ "usb-host-msc", "usb-host-msc-cdc-msc", "usb-host-msc-cdc-msc-2", "usb-host-msc-cdc-msc-3", "tool-stm32duino" ]: + platform_name = "framework-arduinoststm32" -FRAMEWORK_DIR = platform.get_package_dir(platform_name) -assert os.path.isdir(FRAMEWORK_DIR) + FRAMEWORK_DIR = platform.get_package_dir(platform_name) + assert os.path.isdir(FRAMEWORK_DIR) -board = env.BoardConfig() + board = env.BoardConfig() -#mcu_type = board.get("build.mcu")[:-2] -variant = board.get("build.variant") -#series = mcu_type[:7].upper() + "xx" + #mcu_type = board.get("build.mcu")[:-2] + variant = board.get("build.variant") + #series = mcu_type[:7].upper() + "xx" -# Prepare a new empty folder at the destination -variant_dir = os.path.join(FRAMEWORK_DIR, "variants", variant) -if os.path.isdir(variant_dir): - shutil.rmtree(variant_dir) -if not os.path.isdir(variant_dir): - os.mkdir(variant_dir) + # Prepare a new empty folder at the destination + variant_dir = os.path.join(FRAMEWORK_DIR, "variants", variant) + if os.path.isdir(variant_dir): + shutil.rmtree(variant_dir) + if not os.path.isdir(variant_dir): + os.mkdir(variant_dir) -# Source dir is a local variant sub-folder -source_dir = os.path.join("buildroot/share/PlatformIO/variants", variant) -assert os.path.isdir(source_dir) + # Source dir is a local variant sub-folder + source_dir = os.path.join("buildroot/share/PlatformIO/variants", variant) + assert os.path.isdir(source_dir) -marlin.copytree(source_dir, variant_dir) + marlin.copytree(source_dir, variant_dir) diff --git a/buildroot/share/PlatformIO/scripts/jgaurora_a5s_a1_with_bootloader.py b/buildroot/share/PlatformIO/scripts/jgaurora_a5s_a1_with_bootloader.py index a4001a240c..0af9c1046d 100644 --- a/buildroot/share/PlatformIO/scripts/jgaurora_a5s_a1_with_bootloader.py +++ b/buildroot/share/PlatformIO/scripts/jgaurora_a5s_a1_with_bootloader.py @@ -1,39 +1,40 @@ # -# buildroot/share/PlatformIO/scripts/jgaurora_a5s_a1_with_bootloader.py +# jgaurora_a5s_a1_with_bootloader.py # Customizations for env:jgaurora_a5s_a1 # -import os,marlin +import pioutil +if pioutil.is_pio_build(): + import os,marlin + # Append ${PROGNAME}.bin firmware after bootloader and save it as 'jgaurora_firmware.bin' + def addboot(source, target, env): + firmware = open(target[0].path, "rb") + lengthfirmware = os.path.getsize(target[0].path) + bootloader_bin = "buildroot/share/PlatformIO/scripts/" + "jgaurora_bootloader.bin" + bootloader = open(bootloader_bin, "rb") + lengthbootloader = os.path.getsize(bootloader_bin) -# Append ${PROGNAME}.bin firmware after bootloader and save it as 'jgaurora_firmware.bin' -def addboot(source, target, env): - firmware = open(target[0].path, "rb") - lengthfirmware = os.path.getsize(target[0].path) - bootloader_bin = "buildroot/share/PlatformIO/scripts/" + "jgaurora_bootloader.bin" - bootloader = open(bootloader_bin, "rb") - lengthbootloader = os.path.getsize(bootloader_bin) + firmware_with_boothloader_bin = target[0].dir.path + '/firmware_with_bootloader.bin' + if os.path.exists(firmware_with_boothloader_bin): + os.remove(firmware_with_boothloader_bin) + firmwareimage = open(firmware_with_boothloader_bin, "wb") + position = 0 + while position < lengthbootloader: + byte = bootloader.read(1) + firmwareimage.write(byte) + position += 1 + position = 0 + while position < lengthfirmware: + byte = firmware.read(1) + firmwareimage.write(byte) + position += 1 + bootloader.close() + firmware.close() + firmwareimage.close() - firmware_with_boothloader_bin = target[0].dir.path + '/firmware_with_bootloader.bin' - if os.path.exists(firmware_with_boothloader_bin): - os.remove(firmware_with_boothloader_bin) - firmwareimage = open(firmware_with_boothloader_bin, "wb") - position = 0 - while position < lengthbootloader: - byte = bootloader.read(1) - firmwareimage.write(byte) - position += 1 - position = 0 - while position < lengthfirmware: - byte = firmware.read(1) - firmwareimage.write(byte) - position += 1 - bootloader.close() - firmware.close() - firmwareimage.close() + firmware_without_bootloader_bin = target[0].dir.path + '/firmware_for_sd_upload.bin' + if os.path.exists(firmware_without_bootloader_bin): + os.remove(firmware_without_bootloader_bin) + os.rename(target[0].path, firmware_without_bootloader_bin) + #os.rename(target[0].dir.path+'/firmware_with_bootloader.bin', target[0].dir.path+'/firmware.bin') - firmware_without_bootloader_bin = target[0].dir.path + '/firmware_for_sd_upload.bin' - if os.path.exists(firmware_without_bootloader_bin): - os.remove(firmware_without_bootloader_bin) - os.rename(target[0].path, firmware_without_bootloader_bin) - #os.rename(target[0].dir.path+'/firmware_with_bootloader.bin', target[0].dir.path+'/firmware.bin') - -marlin.add_post_action(addboot); + marlin.add_post_action(addboot); diff --git a/buildroot/share/PlatformIO/scripts/lerdge.py b/buildroot/share/PlatformIO/scripts/lerdge.py index 144ab64a9a..505a935560 100644 --- a/buildroot/share/PlatformIO/scripts/lerdge.py +++ b/buildroot/share/PlatformIO/scripts/lerdge.py @@ -1,47 +1,49 @@ # -# buildroot/share/PlatformIO/scripts/lerdge.py +# lerdge.py # Customizations for Lerdge build environments: # env:LERDGEX env:LERDGEX_usb_flash_drive # env:LERDGES env:LERDGES_usb_flash_drive # env:LERDGEK env:LERDGEK_usb_flash_drive # -import os,marlin -Import("env") +import pioutil +if pioutil.is_pio_build(): + import os,marlin + Import("env") -from SCons.Script import DefaultEnvironment -board = DefaultEnvironment().BoardConfig() + from SCons.Script import DefaultEnvironment + board = DefaultEnvironment().BoardConfig() -def encryptByte(byte): - byte = 0xFF & ((byte << 6) | (byte >> 2)) - i = 0x58 + byte - j = 0x05 + byte + (i >> 8) - byte = (0xF8 & i) | (0x07 & j) - return byte + def encryptByte(byte): + byte = 0xFF & ((byte << 6) | (byte >> 2)) + i = 0x58 + byte + j = 0x05 + byte + (i >> 8) + byte = (0xF8 & i) | (0x07 & j) + return byte -def encrypt_file(input, output_file, file_length): - input_file = bytearray(input.read()) - for i in range(len(input_file)): - input_file[i] = encryptByte(input_file[i]) - output_file.write(input_file) + def encrypt_file(input, output_file, file_length): + input_file = bytearray(input.read()) + for i in range(len(input_file)): + input_file[i] = encryptByte(input_file[i]) + output_file.write(input_file) -# Encrypt ${PROGNAME}.bin and save it with the name given in build.encrypt -def encrypt(source, target, env): - fwpath = target[0].path - enname = board.get("build.encrypt") - print("Encrypting %s to %s" % (fwpath, enname)) - fwfile = open(fwpath, "rb") - enfile = open(target[0].dir.path + "/" + enname, "wb") - length = os.path.getsize(fwpath) + # Encrypt ${PROGNAME}.bin and save it with the name given in build.encrypt + def encrypt(source, target, env): + fwpath = target[0].path + enname = board.get("build.encrypt") + print("Encrypting %s to %s" % (fwpath, enname)) + fwfile = open(fwpath, "rb") + enfile = open(target[0].dir.path + "/" + enname, "wb") + length = os.path.getsize(fwpath) - encrypt_file(fwfile, enfile, length) + encrypt_file(fwfile, enfile, length) - fwfile.close() - enfile.close() - os.remove(fwpath) + fwfile.close() + enfile.close() + os.remove(fwpath) -if 'encrypt' in board.get("build").keys(): - if board.get("build.encrypt") != "": - marlin.add_post_action(encrypt) -else: - print("LERDGE builds require output file via board_build.encrypt = 'filename' parameter") - exit(1) + if 'encrypt' in board.get("build").keys(): + if board.get("build.encrypt") != "": + marlin.add_post_action(encrypt) + else: + print("LERDGE builds require output file via board_build.encrypt = 'filename' parameter") + exit(1) diff --git a/buildroot/share/PlatformIO/scripts/marlin.py b/buildroot/share/PlatformIO/scripts/marlin.py index caa0c89749..b8a6283ced 100644 --- a/buildroot/share/PlatformIO/scripts/marlin.py +++ b/buildroot/share/PlatformIO/scripts/marlin.py @@ -1,5 +1,5 @@ # -# buildroot/share/PlatformIO/scripts/marlin.py +# marlin.py # Helper module with some commonly-used functions # import os,shutil @@ -10,13 +10,13 @@ env = DefaultEnvironment() from os.path import join def copytree(src, dst, symlinks=False, ignore=None): - for item in os.listdir(src): - s = join(src, item) - d = join(dst, item) - if os.path.isdir(s): - shutil.copytree(s, d, symlinks, ignore) - else: - shutil.copy2(s, d) + for item in os.listdir(src): + s = join(src, item) + d = join(dst, item) + if os.path.isdir(s): + shutil.copytree(s, d, symlinks, ignore) + else: + shutil.copy2(s, d) def replace_define(field, value): for define in env['CPPDEFINES']: diff --git a/buildroot/share/PlatformIO/scripts/mks_robin.py b/buildroot/share/PlatformIO/scripts/mks_robin.py index 2dea7c615f..7b423bedab 100644 --- a/buildroot/share/PlatformIO/scripts/mks_robin.py +++ b/buildroot/share/PlatformIO/scripts/mks_robin.py @@ -1,5 +1,5 @@ # -# buildroot/share/PlatformIO/scripts/mks_robin.py +# mks_robin.py # import robin robin.prepare("0x08007000", "mks_robin.ld", "Robin.bin") diff --git a/buildroot/share/PlatformIO/scripts/mks_robin_e3.py b/buildroot/share/PlatformIO/scripts/mks_robin_e3.py index 6ddeccbf80..645230c625 100644 --- a/buildroot/share/PlatformIO/scripts/mks_robin_e3.py +++ b/buildroot/share/PlatformIO/scripts/mks_robin_e3.py @@ -1,5 +1,5 @@ # -# buildroot/share/PlatformIO/scripts/mks_robin_e3.py +# mks_robin_e3.py # import robin robin.prepare("0x08005000", "mks_robin_e3.ld", "Robin_e3.bin") diff --git a/buildroot/share/PlatformIO/scripts/mks_robin_e3p.py b/buildroot/share/PlatformIO/scripts/mks_robin_e3p.py index 5eeb93c096..bb15cb5a70 100644 --- a/buildroot/share/PlatformIO/scripts/mks_robin_e3p.py +++ b/buildroot/share/PlatformIO/scripts/mks_robin_e3p.py @@ -1,5 +1,5 @@ # -# buildroot/share/PlatformIO/scripts/mks_robin_e3p.py +# mks_robin_e3p.py # import robin robin.prepare("0x08007000", "mks_robin_e3p.ld", "Robin_e3p.bin") diff --git a/buildroot/share/PlatformIO/scripts/mks_robin_lite.py b/buildroot/share/PlatformIO/scripts/mks_robin_lite.py index c2018336fd..123b043f7c 100644 --- a/buildroot/share/PlatformIO/scripts/mks_robin_lite.py +++ b/buildroot/share/PlatformIO/scripts/mks_robin_lite.py @@ -1,5 +1,5 @@ # -# buildroot/share/PlatformIO/scripts/mks_robin_lite.py +# mks_robin_lite.py # import robin robin.prepare("0x08005000", "mks_robin_lite.ld", "mksLite.bin") diff --git a/buildroot/share/PlatformIO/scripts/mks_robin_lite3.py b/buildroot/share/PlatformIO/scripts/mks_robin_lite3.py index 42c8fb18b6..092231eae8 100644 --- a/buildroot/share/PlatformIO/scripts/mks_robin_lite3.py +++ b/buildroot/share/PlatformIO/scripts/mks_robin_lite3.py @@ -1,5 +1,5 @@ # -# buildroot/share/PlatformIO/scripts/mks_robin_lite3.py +# mks_robin_lite3.py # import robin robin.prepare("0x08005000", "mks_robin_lite.ld", "mksLite3.bin") diff --git a/buildroot/share/PlatformIO/scripts/mks_robin_mini.py b/buildroot/share/PlatformIO/scripts/mks_robin_mini.py index b0d8388653..d1d175dd1c 100644 --- a/buildroot/share/PlatformIO/scripts/mks_robin_mini.py +++ b/buildroot/share/PlatformIO/scripts/mks_robin_mini.py @@ -1,5 +1,5 @@ # -# buildroot/share/PlatformIO/scripts/mks_robin_mini.py +# mks_robin_mini.py # import robin robin.prepare("0x08007000", "mks_robin_mini.ld", "Robin_mini.bin") diff --git a/buildroot/share/PlatformIO/scripts/mks_robin_nano.py b/buildroot/share/PlatformIO/scripts/mks_robin_nano.py index 35e99830c4..32d1af2366 100644 --- a/buildroot/share/PlatformIO/scripts/mks_robin_nano.py +++ b/buildroot/share/PlatformIO/scripts/mks_robin_nano.py @@ -1,5 +1,5 @@ # -# buildroot/share/PlatformIO/scripts/mks_robin_nano.py +# mks_robin_nano.py # import robin robin.prepare("0x08007000", "mks_robin_nano.ld", "Robin_nano.bin") diff --git a/buildroot/share/PlatformIO/scripts/mks_robin_nano35.py b/buildroot/share/PlatformIO/scripts/mks_robin_nano35.py index 4a5726ad5b..7e635bd6ec 100644 --- a/buildroot/share/PlatformIO/scripts/mks_robin_nano35.py +++ b/buildroot/share/PlatformIO/scripts/mks_robin_nano35.py @@ -1,5 +1,5 @@ # -# buildroot/share/PlatformIO/scripts/mks_robin_nano35.py +# mks_robin_nano35.py # import robin robin.prepare("0x08007000", "mks_robin_nano.ld", "Robin_nano35.bin") diff --git a/buildroot/share/PlatformIO/scripts/mks_robin_pro.py b/buildroot/share/PlatformIO/scripts/mks_robin_pro.py index 60e2482bb0..54526aeaef 100644 --- a/buildroot/share/PlatformIO/scripts/mks_robin_pro.py +++ b/buildroot/share/PlatformIO/scripts/mks_robin_pro.py @@ -1,5 +1,5 @@ # -# buildroot/share/PlatformIO/scripts/mks_robin_pro.py +# mks_robin_pro.py # import robin robin.prepare("0x08007000", "mks_robin_pro.ld", "Robin_pro.bin") diff --git a/buildroot/share/PlatformIO/scripts/offset_and_rename.py b/buildroot/share/PlatformIO/scripts/offset_and_rename.py index 9caed298e4..00803b722e 100644 --- a/buildroot/share/PlatformIO/scripts/offset_and_rename.py +++ b/buildroot/share/PlatformIO/scripts/offset_and_rename.py @@ -8,54 +8,56 @@ # # - For 'board_build.rename' add a post-action to rename the firmware file. # -import os,sys,marlin -Import("env") +import pioutil +if pioutil.is_pio_build(): + import os,sys,marlin + Import("env") -from SCons.Script import DefaultEnvironment -board = DefaultEnvironment().BoardConfig() + from SCons.Script import DefaultEnvironment + board = DefaultEnvironment().BoardConfig() -board_keys = board.get("build").keys() + board_keys = board.get("build").keys() -# -# For build.offset define LD_FLASH_OFFSET, used by ldscript.ld -# -if 'offset' in board_keys: - LD_FLASH_OFFSET = board.get("build.offset") - marlin.relocate_vtab(LD_FLASH_OFFSET) + # + # For build.offset define LD_FLASH_OFFSET, used by ldscript.ld + # + if 'offset' in board_keys: + LD_FLASH_OFFSET = board.get("build.offset") + marlin.relocate_vtab(LD_FLASH_OFFSET) - # Flash size - maximum_flash_size = int(board.get("upload.maximum_size") / 1024) - marlin.replace_define('STM32_FLASH_SIZE', maximum_flash_size) + # Flash size + maximum_flash_size = int(board.get("upload.maximum_size") / 1024) + marlin.replace_define('STM32_FLASH_SIZE', maximum_flash_size) - # Get upload.maximum_ram_size (defined by /buildroot/share/PlatformIO/boards/VARIOUS.json) - maximum_ram_size = board.get("upload.maximum_ram_size") + # Get upload.maximum_ram_size (defined by /buildroot/share/PlatformIO/boards/VARIOUS.json) + maximum_ram_size = board.get("upload.maximum_ram_size") - for i, flag in enumerate(env["LINKFLAGS"]): - if "-Wl,--defsym=LD_FLASH_OFFSET" in flag: - env["LINKFLAGS"][i] = "-Wl,--defsym=LD_FLASH_OFFSET=" + LD_FLASH_OFFSET - if "-Wl,--defsym=LD_MAX_DATA_SIZE" in flag: - env["LINKFLAGS"][i] = "-Wl,--defsym=LD_MAX_DATA_SIZE=" + str(maximum_ram_size - 40) + for i, flag in enumerate(env["LINKFLAGS"]): + if "-Wl,--defsym=LD_FLASH_OFFSET" in flag: + env["LINKFLAGS"][i] = "-Wl,--defsym=LD_FLASH_OFFSET=" + LD_FLASH_OFFSET + if "-Wl,--defsym=LD_MAX_DATA_SIZE" in flag: + env["LINKFLAGS"][i] = "-Wl,--defsym=LD_MAX_DATA_SIZE=" + str(maximum_ram_size - 40) -# -# For build.encrypt rename and encode the firmware file. -# -if 'encrypt' in board_keys: + # + # For build.encrypt rename and encode the firmware file. + # + if 'encrypt' in board_keys: - # Encrypt ${PROGNAME}.bin and save it with the name given in build.encrypt - def encrypt(source, target, env): - marlin.encrypt_mks(source, target, env, board.get("build.encrypt")) + # Encrypt ${PROGNAME}.bin and save it with the name given in build.encrypt + def encrypt(source, target, env): + marlin.encrypt_mks(source, target, env, board.get("build.encrypt")) - if board.get("build.encrypt") != "": - marlin.add_post_action(encrypt) + if board.get("build.encrypt") != "": + marlin.add_post_action(encrypt) -# -# For build.rename simply rename the firmware file. -# -if 'rename' in board_keys: + # + # For build.rename simply rename the firmware file. + # + if 'rename' in board_keys: - def rename_target(source, target, env): - firmware = os.path.join(target[0].dir.path, board.get("build.rename")) - import shutil - shutil.copy(target[0].path, firmware) + def rename_target(source, target, env): + firmware = os.path.join(target[0].dir.path, board.get("build.rename")) + import shutil + shutil.copy(target[0].path, firmware) - marlin.add_post_action(rename_target) + marlin.add_post_action(rename_target) diff --git a/buildroot/share/PlatformIO/scripts/openblt.py b/buildroot/share/PlatformIO/scripts/openblt.py index 6e71ca9eb8..61b38a5e87 100644 --- a/buildroot/share/PlatformIO/scripts/openblt.py +++ b/buildroot/share/PlatformIO/scripts/openblt.py @@ -1,18 +1,20 @@ # # Convert the ELF to an SREC file suitable for some bootloaders # -import os,sys -from os.path import join +import pioutil +if pioutil.is_pio_build(): + import os,sys + from os.path import join -Import("env") + Import("env") -board = env.BoardConfig() -board_keys = board.get("build").keys() -if 'encrypt' in board_keys: - env.AddPostAction( - join("$BUILD_DIR", "${PROGNAME}.bin"), - env.VerboseAction(" ".join([ - "$OBJCOPY", "-O", "srec", - "\"$BUILD_DIR/${PROGNAME}.elf\"", "\"" + join("$BUILD_DIR", board.get("build.encrypt")) + "\"" - ]), "Building $TARGET") - ) + board = env.BoardConfig() + board_keys = board.get("build").keys() + if 'encrypt' in board_keys: + env.AddPostAction( + join("$BUILD_DIR", "${PROGNAME}.bin"), + env.VerboseAction(" ".join([ + "$OBJCOPY", "-O", "srec", + "\"$BUILD_DIR/${PROGNAME}.elf\"", "\"" + join("$BUILD_DIR", board.get("build.encrypt")) + "\"" + ]), "Building $TARGET") + ) diff --git a/buildroot/share/PlatformIO/scripts/pioutil.py b/buildroot/share/PlatformIO/scripts/pioutil.py index f0c021fca7..b8c1e9cfca 100644 --- a/buildroot/share/PlatformIO/scripts/pioutil.py +++ b/buildroot/share/PlatformIO/scripts/pioutil.py @@ -1,8 +1,8 @@ # -# buildroot/share/PlatformIO/scripts/pioutil.py +# pioutil.py # -# Detect that 'vscode init' is running -def is_vscode_init(): +# Make sure 'vscode init' is not the current command +def is_pio_build(): from SCons.Script import COMMAND_LINE_TARGETS - return "idedata" in COMMAND_LINE_TARGETS or "_idedata" in COMMAND_LINE_TARGETS + return "idedata" not in COMMAND_LINE_TARGETS and "_idedata" not in COMMAND_LINE_TARGETS diff --git a/buildroot/share/PlatformIO/scripts/preflight-checks.py b/buildroot/share/PlatformIO/scripts/preflight-checks.py index 0dab3e4b1f..1837a7580d 100644 --- a/buildroot/share/PlatformIO/scripts/preflight-checks.py +++ b/buildroot/share/PlatformIO/scripts/preflight-checks.py @@ -2,100 +2,99 @@ # preflight-checks.py # Check for common issues prior to compiling # -import os,re,sys,pioutil -Import("env") +import pioutil +if pioutil.is_pio_build(): -# Detect that 'vscode init' is running -if pioutil.is_vscode_init(): - env.Exit(0) + import os,re,sys + Import("env") -def get_envs_for_board(board): - with open(os.path.join("Marlin", "src", "pins", "pins.h"), "r") as file: + def get_envs_for_board(board): + with open(os.path.join("Marlin", "src", "pins", "pins.h"), "r") as file: - if sys.platform == 'win32': - envregex = r"(?:env|win):" - elif sys.platform == 'darwin': - envregex = r"(?:env|mac|uni):" - elif sys.platform == 'linux': - envregex = r"(?:env|lin|uni):" - else: - envregex = r"(?:env):" + if sys.platform == 'win32': + envregex = r"(?:env|win):" + elif sys.platform == 'darwin': + envregex = r"(?:env|mac|uni):" + elif sys.platform == 'linux': + envregex = r"(?:env|lin|uni):" + else: + envregex = r"(?:env):" - r = re.compile(r"if\s+MB\((.+)\)") - if board.startswith("BOARD_"): - board = board[6:] + r = re.compile(r"if\s+MB\((.+)\)") + if board.startswith("BOARD_"): + board = board[6:] - for line in file: - mbs = r.findall(line) - if mbs and board in re.split(r",\s*", mbs[0]): - line = file.readline() - found_envs = re.match(r"\s*#include .+" + envregex, line) - if found_envs: - envlist = re.findall(envregex + r"(\w+)", line) - return [ "env:"+s for s in envlist ] - return [] + for line in file: + mbs = r.findall(line) + if mbs and board in re.split(r",\s*", mbs[0]): + line = file.readline() + found_envs = re.match(r"\s*#include .+" + envregex, line) + if found_envs: + envlist = re.findall(envregex + r"(\w+)", line) + return [ "env:"+s for s in envlist ] + return [] -def check_envs(build_env, board_envs, config): - if build_env in board_envs: - return True - ext = config.get(build_env, 'extends', default=None) - if ext: - if isinstance(ext, str): - return check_envs(ext, board_envs, config) - elif isinstance(ext, list): - for ext_env in ext: - if check_envs(ext_env, board_envs, config): - return True - return False + def check_envs(build_env, board_envs, config): + if build_env in board_envs: + return True + ext = config.get(build_env, 'extends', default=None) + if ext: + if isinstance(ext, str): + return check_envs(ext, board_envs, config) + elif isinstance(ext, list): + for ext_env in ext: + if check_envs(ext_env, board_envs, config): + return True + return False -def sanity_check_target(): - # Sanity checks: - if 'PIOENV' not in env: - raise SystemExit("Error: PIOENV is not defined. This script is intended to be used with PlatformIO") + def sanity_check_target(): + # Sanity checks: + if 'PIOENV' not in env: + raise SystemExit("Error: PIOENV is not defined. This script is intended to be used with PlatformIO") - if 'MARLIN_FEATURES' not in env: - raise SystemExit("Error: this script should be used after common Marlin scripts") + if 'MARLIN_FEATURES' not in env: + raise SystemExit("Error: this script should be used after common Marlin scripts") - if 'MOTHERBOARD' not in env['MARLIN_FEATURES']: - raise SystemExit("Error: MOTHERBOARD is not defined in Configuration.h") + if 'MOTHERBOARD' not in env['MARLIN_FEATURES']: + raise SystemExit("Error: MOTHERBOARD is not defined in Configuration.h") - build_env = env['PIOENV'] - motherboard = env['MARLIN_FEATURES']['MOTHERBOARD'] - board_envs = get_envs_for_board(motherboard) - config = env.GetProjectConfig() - result = check_envs("env:"+build_env, board_envs, config) + build_env = env['PIOENV'] + motherboard = env['MARLIN_FEATURES']['MOTHERBOARD'] + board_envs = get_envs_for_board(motherboard) + config = env.GetProjectConfig() + result = check_envs("env:"+build_env, board_envs, config) - if not result: - err = "Error: Build environment '%s' is incompatible with %s. Use one of these: %s" % \ - ( build_env, motherboard, ", ".join([ e[4:] for e in board_envs if e.startswith("env:") ]) ) - raise SystemExit(err) + if not result: + err = "Error: Build environment '%s' is incompatible with %s. Use one of these: %s" % \ + ( build_env, motherboard, ", ".join([ e[4:] for e in board_envs if e.startswith("env:") ]) ) + raise SystemExit(err) - # - # Check for Config files in two common incorrect places - # - for p in [ env['PROJECT_DIR'], os.path.join(env['PROJECT_DIR'], "config") ]: - for f in [ "Configuration.h", "Configuration_adv.h" ]: + # + # Check for Config files in two common incorrect places + # + for p in [ env['PROJECT_DIR'], os.path.join(env['PROJECT_DIR'], "config") ]: + for f in [ "Configuration.h", "Configuration_adv.h" ]: + if os.path.isfile(os.path.join(p, f)): + err = "ERROR: Config files found in directory %s. Please move them into the Marlin subfolder." % p + raise SystemExit(err) + + # + # Give warnings on every build + # + warnfile = os.path.join(env['PROJECT_BUILD_DIR'], build_env, "src", "src", "inc", "Warnings.cpp.o") + if os.path.exists(warnfile): + os.remove(warnfile) + + # + # Check for old files indicating an entangled Marlin (mixing old and new code) + # + mixedin = [] + p = os.path.join(env['PROJECT_DIR'], "Marlin", "src", "lcd", "dogm") + for f in [ "ultralcd_DOGM.cpp", "ultralcd_DOGM.h" ]: if os.path.isfile(os.path.join(p, f)): - err = "ERROR: Config files found in directory %s. Please move them into the Marlin subfolder." % p - raise SystemExit(err) + mixedin += [ f ] + if mixedin: + err = "ERROR: Old files fell into your Marlin folder. Remove %s and try again" % ", ".join(mixedin) + raise SystemExit(err) - # - # Give warnings on every build - # - warnfile = os.path.join(env['PROJECT_BUILD_DIR'], build_env, "src", "src", "inc", "Warnings.cpp.o") - if os.path.exists(warnfile): - os.remove(warnfile) - - # - # Check for old files indicating an entangled Marlin (mixing old and new code) - # - mixedin = [] - p = os.path.join(env['PROJECT_DIR'], "Marlin", "src", "lcd", "dogm") - for f in [ "ultralcd_DOGM.cpp", "ultralcd_DOGM.h" ]: - if os.path.isfile(os.path.join(p, f)): - mixedin += [ f ] - if mixedin: - err = "ERROR: Old files fell into your Marlin folder. Remove %s and try again" % ", ".join(mixedin) - raise SystemExit(err) - -sanity_check_target() + sanity_check_target() diff --git a/buildroot/share/PlatformIO/scripts/random-bin.py b/buildroot/share/PlatformIO/scripts/random-bin.py index c03b863448..5a88906c30 100644 --- a/buildroot/share/PlatformIO/scripts/random-bin.py +++ b/buildroot/share/PlatformIO/scripts/random-bin.py @@ -2,8 +2,8 @@ # random-bin.py # Set a unique firmware name based on current date and time # -Import("env") - -from datetime import datetime - -env['PROGNAME'] = datetime.now().strftime("firmware-%Y%m%d-%H%M%S") +import pioutil +if pioutil.is_pio_build(): + from datetime import datetime + Import("env") + env['PROGNAME'] = datetime.now().strftime("firmware-%Y%m%d-%H%M%S") diff --git a/buildroot/share/PlatformIO/scripts/robin.py b/buildroot/share/PlatformIO/scripts/robin.py index 50d0d92d2f..ffc9a43b90 100644 --- a/buildroot/share/PlatformIO/scripts/robin.py +++ b/buildroot/share/PlatformIO/scripts/robin.py @@ -1,12 +1,14 @@ # -# buildroot/share/PlatformIO/scripts/robin.py +# robin.py # -import marlin # Apply customizations for a MKS Robin def prepare(address, ldname, fwname): - def encrypt(source, target, env): - marlin.encrypt_mks(source, target, env, fwname) - marlin.relocate_firmware(address) - marlin.custom_ld_script(ldname) - marlin.add_post_action(encrypt); + import pioutil + if pioutil.is_pio_build(): + import marlin + def encrypt(source, target, env): + marlin.encrypt_mks(source, target, env, fwname) + marlin.relocate_firmware(address) + marlin.custom_ld_script(ldname) + marlin.add_post_action(encrypt); diff --git a/buildroot/share/PlatformIO/scripts/simulator.py b/buildroot/share/PlatformIO/scripts/simulator.py index fb9d93cceb..c6a5277b92 100644 --- a/buildroot/share/PlatformIO/scripts/simulator.py +++ b/buildroot/share/PlatformIO/scripts/simulator.py @@ -1,52 +1,54 @@ # +# simulator.py # PlatformIO pre: script for simulator builds # +import pioutil +if pioutil.is_pio_build(): + # Get the environment thus far for the build + Import("env") -# Get the environment thus far for the build -Import("env") + #print(env.Dump()) -#print(env.Dump()) + # + # Give the binary a distinctive name + # -# -# Give the binary a distinctive name -# + env['PROGNAME'] = "MarlinSimulator" -env['PROGNAME'] = "MarlinSimulator" + # + # If Xcode is installed add the path to its Frameworks folder, + # or if Mesa is installed try to use its GL/gl.h. + # -# -# If Xcode is installed add the path to its Frameworks folder, -# or if Mesa is installed try to use its GL/gl.h. -# + import sys + if sys.platform == 'darwin': -import sys -if sys.platform == 'darwin': + # + # Silence half of the ranlib warnings. (No equivalent for 'ARFLAGS') + # + env['RANLIBFLAGS'] += [ "-no_warning_for_no_symbols" ] - # - # Silence half of the ranlib warnings. (No equivalent for 'ARFLAGS') - # - env['RANLIBFLAGS'] += [ "-no_warning_for_no_symbols" ] + # Default paths for Xcode and a lucky GL/gl.h dropped by Mesa + xcode_path = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks" + mesa_path = "/opt/local/include/GL/gl.h" - # Default paths for Xcode and a lucky GL/gl.h dropped by Mesa - xcode_path = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks" - mesa_path = "/opt/local/include/GL/gl.h" + import os.path - import os.path + if os.path.exists(xcode_path): - if os.path.exists(xcode_path): + env['BUILD_FLAGS'] += [ "-F" + xcode_path ] + print("Using OpenGL framework headers from Xcode.app") - env['BUILD_FLAGS'] += [ "-F" + xcode_path ] - print("Using OpenGL framework headers from Xcode.app") + elif os.path.exists(mesa_path): - elif os.path.exists(mesa_path): + env['BUILD_FLAGS'] += [ '-D__MESA__' ] + print("Using OpenGL header from", mesa_path) - env['BUILD_FLAGS'] += [ '-D__MESA__' ] - print("Using OpenGL header from", mesa_path) + else: - else: + print("\n\nNo OpenGL headers found. Install Xcode for matching headers, or use 'sudo port install mesa' to get a GL/gl.h.\n\n") - print("\n\nNo OpenGL headers found. Install Xcode for matching headers, or use 'sudo port install mesa' to get a GL/gl.h.\n\n") + # Break out of the PIO build immediately + sys.exit(1) - # Break out of the PIO build immediately - sys.exit(1) - -env.AddCustomTarget("upload", "$BUILD_DIR/${PROGNAME}", "$BUILD_DIR/${PROGNAME}") + env.AddCustomTarget("upload", "$BUILD_DIR/${PROGNAME}", "$BUILD_DIR/${PROGNAME}") diff --git a/buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py b/buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py index c3779289e0..033803009e 100644 --- a/buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py +++ b/buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py @@ -1,59 +1,61 @@ # # stm32_serialbuffer.py # -Import("env") +import pioutil +if pioutil.is_pio_build(): + Import("env") -# Marlin uses the `RX_BUFFER_SIZE` \ `TX_BUFFER_SIZE` options to -# configure buffer sizes for receiving \ transmitting serial data. -# Stm32duino uses another set of defines for the same purpose, so this -# script gets the values from the configuration and uses them to define -# `SERIAL_RX_BUFFER_SIZE` and `SERIAL_TX_BUFFER_SIZE` as global build -# flags so they are available for use by the platform. -# -# The script will set the value as the default one (64 bytes) -# or the user-configured one, whichever is higher. -# -# Marlin's default buffer sizes are 128 for RX and 32 for TX. -# The highest value is taken (128/64). -# -# If MF_*_BUFFER_SIZE, SERIAL_*_BUFFER_SIZE, USART_*_BUF_SIZE, are -# defined, the first of these values will be used as the minimum. -build_flags = env.ParseFlags(env.get('BUILD_FLAGS'))["CPPDEFINES"] -mf = env["MARLIN_FEATURES"] + # Get a build flag's value or None + def getBuildFlagValue(name): + for flag in build_flags: + if isinstance(flag, list) and flag[0] == name: + return flag[1] -# Get a build flag's value or None -def getBuildFlagValue(name): - for flag in build_flags: - if isinstance(flag, list) and flag[0] == name: - return flag[1] + return None - return None + # Get an overriding buffer size for RX or TX from the build flags + def getInternalSize(side): + return getBuildFlagValue(f"MF_{side}_BUFFER_SIZE") or \ + getBuildFlagValue(f"SERIAL_{side}_BUFFER_SIZE") or \ + getBuildFlagValue(f"USART_{side}_BUF_SIZE") -# Get an overriding buffer size for RX or TX from the build flags -def getInternalSize(side): - return getBuildFlagValue(f"MF_{side}_BUFFER_SIZE") or \ - getBuildFlagValue(f"SERIAL_{side}_BUFFER_SIZE") or \ - getBuildFlagValue(f"USART_{side}_BUF_SIZE") + # Get the largest defined buffer size for RX or TX + def getBufferSize(side, default): + # Get a build flag value or fall back to the given default + internal = int(getInternalSize(side) or default) + flag = side + "_BUFFER_SIZE" + # Return the largest value + return max(int(mf[flag]), internal) if flag in mf else internal -# Get the largest defined buffer size for RX or TX -def getBufferSize(side, default): - # Get a build flag value or fall back to the given default - internal = int(getInternalSize(side) or default) - flag = side + "_BUFFER_SIZE" - # Return the largest value - return max(int(mf[flag]), internal) if flag in mf else internal + # Add a build flag if it's not already defined + def tryAddFlag(name, value): + if getBuildFlagValue(name) is None: + env.Append(BUILD_FLAGS=[f"-D{name}={value}"]) -# Add a build flag if it's not already defined -def tryAddFlag(name, value): - if getBuildFlagValue(name) is None: - env.Append(BUILD_FLAGS=[f"-D{name}={value}"]) + # Marlin uses the `RX_BUFFER_SIZE` \ `TX_BUFFER_SIZE` options to + # configure buffer sizes for receiving \ transmitting serial data. + # Stm32duino uses another set of defines for the same purpose, so this + # script gets the values from the configuration and uses them to define + # `SERIAL_RX_BUFFER_SIZE` and `SERIAL_TX_BUFFER_SIZE` as global build + # flags so they are available for use by the platform. + # + # The script will set the value as the default one (64 bytes) + # or the user-configured one, whichever is higher. + # + # Marlin's default buffer sizes are 128 for RX and 32 for TX. + # The highest value is taken (128/64). + # + # If MF_*_BUFFER_SIZE, SERIAL_*_BUFFER_SIZE, USART_*_BUF_SIZE, are + # defined, the first of these values will be used as the minimum. + build_flags = env.ParseFlags(env.get('BUILD_FLAGS'))["CPPDEFINES"] + mf = env["MARLIN_FEATURES"] -# Get the largest defined buffer sizes for RX or TX, using defaults for undefined -rxBuf = getBufferSize("RX", 128) -txBuf = getBufferSize("TX", 64) + # Get the largest defined buffer sizes for RX or TX, using defaults for undefined + rxBuf = getBufferSize("RX", 128) + txBuf = getBufferSize("TX", 64) -# Provide serial buffer sizes to the stm32duino platform -tryAddFlag("SERIAL_RX_BUFFER_SIZE", rxBuf) -tryAddFlag("SERIAL_TX_BUFFER_SIZE", txBuf) -tryAddFlag("USART_RX_BUF_SIZE", rxBuf) -tryAddFlag("USART_TX_BUF_SIZE", txBuf) + # Provide serial buffer sizes to the stm32duino platform + tryAddFlag("SERIAL_RX_BUFFER_SIZE", rxBuf) + tryAddFlag("SERIAL_TX_BUFFER_SIZE", txBuf) + tryAddFlag("USART_RX_BUF_SIZE", rxBuf) + tryAddFlag("USART_TX_BUF_SIZE", txBuf) diff --git a/ini/stm32f1-maple.ini b/ini/stm32f1-maple.ini index e0b4ad711a..969bb815da 100644 --- a/ini/stm32f1-maple.ini +++ b/ini/stm32f1-maple.ini @@ -326,7 +326,6 @@ platform = ${common_stm32f1.platform} extends = common_stm32f1 board = marlin_CHITU_F103 extra_scripts = ${common_stm32f1.extra_scripts} - pre:buildroot/share/PlatformIO/scripts/common-dependencies.py pre:buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py buildroot/share/PlatformIO/scripts/chitu_crypt.py build_flags = ${common_stm32f1.build_flags} From 7b792014703e778d8fc0b1760747d50ab8f340d1 Mon Sep 17 00:00:00 2001 From: BigTreeTech <38851044+bigtreetech@users.noreply.github.com> Date: Thu, 4 Nov 2021 18:54:38 +0800 Subject: [PATCH 103/125] =?UTF-8?q?=F0=9F=90=9B=20Fix=20Octopus-Pro=20Max3?= =?UTF-8?q?1865=20/=20SPI=20(#23072)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pins/stm32f4/pins_BTT_OCTOPUS_PRO_V1_0.h | 1 + .../src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) 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 index a93ed68201..fd367e87c0 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_PRO_V1_0.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_PRO_V1_0.h @@ -32,6 +32,7 @@ #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 + #define FORCE_SOFT_SPI #else #define TEMP_0_PIN PF4 // TH0 #endif 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 6dc90bf910..efeff04f25 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h @@ -168,13 +168,6 @@ #define POWER_LOSS_PIN PC0 // PWRDET #endif -// -// NeoPixel LED -// -#ifndef NEOPIXEL_PIN - #define NEOPIXEL_PIN PB0 -#endif - // // Steppers // @@ -524,6 +517,13 @@ #define BTN_ENC EXP1_09_PIN #endif +// +// NeoPixel LED +// +#ifndef NEOPIXEL_PIN + #define NEOPIXEL_PIN PB0 +#endif + // // WIFI // From a9dc737624cf45bceff1866ce4807bb2cc36ac44 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Thu, 4 Nov 2021 18:04:04 +0100 Subject: [PATCH 104/125] =?UTF-8?q?=F0=9F=90=9B=20Fix=20TFT=20backlight=20?= =?UTF-8?q?[STM32]=20(#23062)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/STM32/fast_pwm.cpp | 4 +++- Marlin/src/HAL/STM32F1/fast_pwm.cpp | 1 + Marlin/src/lcd/dogm/marlinui_DOGM.cpp | 4 +++- Marlin/src/lcd/tft/ui_common.cpp | 4 +++- Marlin/src/lcd/tft_io/tft_io.cpp | 3 +-- Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h | 14 +++++++++++--- 6 files changed, 22 insertions(+), 8 deletions(-) diff --git a/Marlin/src/HAL/STM32/fast_pwm.cpp b/Marlin/src/HAL/STM32/fast_pwm.cpp index d4d695b969..4d450374d3 100644 --- a/Marlin/src/HAL/STM32/fast_pwm.cpp +++ b/Marlin/src/HAL/STM32/fast_pwm.cpp @@ -28,11 +28,13 @@ #include "timers.h" void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255*/, const bool invert/*=false*/) { + if (!PWM_PIN(pin)) return; // Don't proceed if no hardware timer + PinName pin_name = digitalPinToPinName(pin); TIM_TypeDef *Instance = (TIM_TypeDef *)pinmap_peripheral(pin_name, PinMap_PWM); + uint16_t adj_val = Instance->ARR * v / v_size; if (invert) adj_val = Instance->ARR - adj_val; - switch (get_pwm_channel(pin_name)) { case TIM_CHANNEL_1: LL_TIM_OC_SetCompareCH1(Instance, adj_val); break; case TIM_CHANNEL_2: LL_TIM_OC_SetCompareCH2(Instance, adj_val); break; diff --git a/Marlin/src/HAL/STM32F1/fast_pwm.cpp b/Marlin/src/HAL/STM32F1/fast_pwm.cpp index 6a9d7e8a19..5171c11545 100644 --- a/Marlin/src/HAL/STM32F1/fast_pwm.cpp +++ b/Marlin/src/HAL/STM32F1/fast_pwm.cpp @@ -28,6 +28,7 @@ #include "timers.h" void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255*/, const bool invert/*=false*/) { + if (!PWM_PIN(pin)) return; timer_dev *timer = PIN_MAP[pin].timer_device; uint16_t max_val = timer->regs.bas->ARR * v / v_size; if (invert) max_val = v_size - max_val; diff --git a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp index f339cad706..59c74148ad 100644 --- a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp +++ b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp @@ -339,12 +339,14 @@ void MarlinUI::draw_kill_screen() { void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop #if HAS_LCD_BRIGHTNESS + void MarlinUI::_set_brightness() { #if PIN_EXISTS(TFT_BACKLIGHT) if (PWM_PIN(TFT_BACKLIGHT_PIN)) - set_pwm_duty(pin_t(TFT_BACKLIGHT_PIN), brightness); + analogWrite(pin_t(TFT_BACKLIGHT_PIN), backlight ? brightness : 0); #endif } + #endif #if HAS_LCD_MENU diff --git a/Marlin/src/lcd/tft/ui_common.cpp b/Marlin/src/lcd/tft/ui_common.cpp index 85ae21e867..acc91f51fa 100644 --- a/Marlin/src/lcd/tft/ui_common.cpp +++ b/Marlin/src/lcd/tft/ui_common.cpp @@ -210,12 +210,14 @@ void MarlinUI::clear_lcd() { } #if HAS_LCD_BRIGHTNESS + void MarlinUI::_set_brightness() { #if PIN_EXISTS(TFT_BACKLIGHT) if (PWM_PIN(TFT_BACKLIGHT_PIN)) - set_pwm_duty(pin_t(TFT_BACKLIGHT_PIN), brightness); + analogWrite(pin_t(TFT_BACKLIGHT_PIN), backlight ? brightness : 0); #endif } + #endif #if ENABLED(TOUCH_SCREEN_CALIBRATION) diff --git a/Marlin/src/lcd/tft_io/tft_io.cpp b/Marlin/src/lcd/tft_io/tft_io.cpp index 6ec3bedcdf..acb78c3e6e 100644 --- a/Marlin/src/lcd/tft_io/tft_io.cpp +++ b/Marlin/src/lcd/tft_io/tft_io.cpp @@ -152,8 +152,7 @@ if (lcd_id != 0xFFFFFFFF) return; #endif #if PIN_EXISTS(TFT_BACKLIGHT) && ENABLED(DELAYED_BACKLIGHT_INIT) - WRITE(TFT_BACKLIGHT_PIN, HIGH); - TERN_(HAS_LCD_BRIGHTNESS, ui._set_brightness()); + TERN(HAS_LCD_BRIGHTNESS, ui._set_brightness(), WRITE(TFT_BACKLIGHT_PIN, HIGH)); #endif } diff --git a/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h b/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h index 7585a6e289..3a8019a27e 100644 --- a/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h +++ b/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h @@ -89,9 +89,17 @@ #define HEATER_BED_PIN PA8 // pin 67 (Hot Bed Mosfet) #define FAN_PIN PA15 // pin 77 (4cm Fan) -#define FAN_SOFT_PWM // Required to avoid issues with heating or STLink -#define FAN_MIN_PWM 35 // Fan will not start in 1-30 range -#define FAN_MAX_PWM 255 +#ifdef MAPLE_STM32F1 + #define FAN_SOFT_PWM // Required to avoid issues with heating or STLink + #define FAN_MIN_PWM 35 // Fan will not start in 1-30 range + #define FAN_MAX_PWM 255 +#else + #define FAST_PWM_FAN // STM32 Variant allow TIMER2 Hardware PWM + #define FAST_PWM_FAN_FREQUENCY 31400 // This frequency allow a good range, fan starts at 3%, half noise at 50% + #define NEEDS_HARDWARE_PWM 1 + #define FAN_MIN_PWM 5 + #define FAN_MAX_PWM 255 +#endif //#define BEEPER_PIN PD13 // pin 60 (Servo PWM output 5V/GND on Board V0G+) made for BL-Touch sensor // Can drive a PC Buzzer, if connected between PWM and 5V pins From f53d627750ab0cf377ea1738bdcf792f2ef37de9 Mon Sep 17 00:00:00 2001 From: Skruppy Date: Thu, 4 Nov 2021 18:11:57 +0100 Subject: [PATCH 105/125] =?UTF-8?q?=F0=9F=90=9B=20Prevent=20AVR=20watchdog?= =?UTF-8?q?pile=20(#23075)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 3 +++ Marlin/src/HAL/AVR/HAL.cpp | 21 ++++++++++++++++++++- Marlin/src/HAL/AVR/HAL.h | 6 +++--- Marlin/src/inc/SanityCheck.h | 5 +++++ 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 934ceceafd..fc495a6ea6 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -4224,3 +4224,6 @@ */ //#define SOFT_RESET_VIA_SERIAL // 'KILL' and '^X' commands will soft-reset the controller //#define SOFT_RESET_ON_KILL // Use a digital button to soft-reset the controller after KILL + +// Report uncleaned reset reason from register r2 instead of MCUSR. Supported by Optiboot on AVR. +//#define OPTIBOOT_RESET_REASON diff --git a/Marlin/src/HAL/AVR/HAL.cpp b/Marlin/src/HAL/AVR/HAL.cpp index 708583b262..d7bf2a6f6f 100644 --- a/Marlin/src/HAL/AVR/HAL.cpp +++ b/Marlin/src/HAL/AVR/HAL.cpp @@ -35,12 +35,31 @@ // Public Variables // ------------------------ -//uint8_t MCUSR; +// Don't initialize/override variable (which would happen in .init4) +uint8_t reset_reason __attribute__((section(".noinit"))); // ------------------------ // Public functions // ------------------------ +__attribute__((naked)) // Don't output function pro- and epilogue +__attribute__((used)) // Output the function, even if "not used" +__attribute__((section(".init3"))) // Put in an early user definable section +void HAL_save_reset_reason() { + #if ENABLED(OPTIBOOT_RESET_REASON) + __asm__ __volatile__( + A("STS %0, r2") + : "=m"(reset_reason) + ); + #else + reset_reason = MCUSR; + #endif + + // Clear within 16ms since WDRF bit enables a 16ms watchdog timer -> Boot loop + MCUSR = 0; + wdt_disable(); +} + void HAL_init() { // Init Servo Pins #define INIT_SERVO(N) OUT_WRITE(SERVO##N##_PIN, LOW) diff --git a/Marlin/src/HAL/AVR/HAL.h b/Marlin/src/HAL/AVR/HAL.h index ad1f47a4e6..2217f239d6 100644 --- a/Marlin/src/HAL/AVR/HAL.h +++ b/Marlin/src/HAL/AVR/HAL.h @@ -91,7 +91,7 @@ typedef int8_t pin_t; // Public Variables // ------------------------ -//extern uint8_t MCUSR; +extern uint8_t reset_reason; // Serial ports #ifdef USBCON @@ -152,8 +152,8 @@ void HAL_init(); //void _delay_ms(const int delay); -inline void HAL_clear_reset_source() { MCUSR = 0; } -inline uint8_t HAL_get_reset_source() { return MCUSR; } +inline void HAL_clear_reset_source() { } +inline uint8_t HAL_get_reset_source() { return reset_reason; } void HAL_reboot(); diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index b4eaf242b7..fbdda2c127 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -2489,6 +2489,11 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "An encoder button is required or SOFT_RESET_ON_KILL will reset the printer without notice!" #endif +// Reset reason for AVR +#if ENABLED(OPTIBOOT_RESET_REASON) && !defined(__AVR__) + #error "OPTIBOOT_RESET_REASON only applies to AVR." +#endif + /** * I2C bus */ From f6147e038bbd4b4b96c8c188107b9e7d4f02d534 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 4 Nov 2021 12:18:23 -0500 Subject: [PATCH 106/125] =?UTF-8?q?=F0=9F=8D=BB=20Get/clear=20reset=20sour?= =?UTF-8?q?ce=20earlier?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #23075 --- Marlin/src/MarlinCore.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index eb57835f96..5e8881d1c6 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -1104,6 +1104,10 @@ void setup() { tmc_standby_setup(); // TMC Low Power Standby pins must be set early or they're not usable + // Check startup - does nothing if bootloader sets MCUSR to 0 + const byte mcu = HAL_get_reset_source(); + HAL_clear_reset_source(); + #if ENABLED(MARLIN_DEV_MODE) auto log_current_ms = [&](PGM_P const msg) { SERIAL_ECHO_START(); @@ -1232,15 +1236,14 @@ void setup() { SETUP_RUN(esp_wifi_init()); - // Check startup - does nothing if bootloader sets MCUSR to 0 - const byte mcu = HAL_get_reset_source(); + // Report Reset Reason if (mcu & RST_POWER_ON) SERIAL_ECHOLNPGM(STR_POWERUP); if (mcu & RST_EXTERNAL) SERIAL_ECHOLNPGM(STR_EXTERNAL_RESET); if (mcu & RST_BROWN_OUT) SERIAL_ECHOLNPGM(STR_BROWNOUT_RESET); if (mcu & RST_WATCHDOG) SERIAL_ECHOLNPGM(STR_WATCHDOG_RESET); if (mcu & RST_SOFTWARE) SERIAL_ECHOLNPGM(STR_SOFTWARE_RESET); - HAL_clear_reset_source(); + // Identify myself as Marlin x.x.x SERIAL_ECHOLNPGM("Marlin " SHORT_BUILD_VERSION); #if defined(STRING_DISTRIBUTION_DATE) && defined(STRING_CONFIG_H_AUTHOR) SERIAL_ECHO_MSG( From 3e8cdef36b42d4cae1efc8fe3272497827dcc440 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Fri, 5 Nov 2021 01:00:14 +0000 Subject: [PATCH 107/125] [cron] Bump distribution date (2021-11-05) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index e562730ae3..b94659a044 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-11-04" +//#define STRING_DISTRIBUTION_DATE "2021-11-05" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index f695d0a1b2..115eb4bbd2 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-11-04" + #define STRING_DISTRIBUTION_DATE "2021-11-05" #endif /** From f5284715fb7c35a5ba9caf98f45f533db709eeb4 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sat, 6 Nov 2021 00:58:50 +0000 Subject: [PATCH 108/125] [cron] Bump distribution date (2021-11-06) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index b94659a044..c3618ba586 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-11-05" +//#define STRING_DISTRIBUTION_DATE "2021-11-06" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 115eb4bbd2..670be92f4b 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-11-05" + #define STRING_DISTRIBUTION_DATE "2021-11-06" #endif /** From dfdffca2bddb2c7301b6befe5d453da5b84dc16f Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sun, 7 Nov 2021 01:06:43 +0000 Subject: [PATCH 109/125] [cron] Bump distribution date (2021-11-07) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index c3618ba586..ce8acbbc3e 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-11-06" +//#define STRING_DISTRIBUTION_DATE "2021-11-07" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 670be92f4b..7626b58e3e 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-11-06" + #define STRING_DISTRIBUTION_DATE "2021-11-07" #endif /** From c07aa875bc8c285adf7f967df656f6bf8a13bf92 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Sun, 7 Nov 2021 15:27:53 +1300 Subject: [PATCH 110/125] =?UTF-8?q?=F0=9F=90=9B=20Fix=20DGUS=20Reloaded=20?= =?UTF-8?q?status=20message=20(#23090)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp index 9bae2b95d3..17e7a38445 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp @@ -409,7 +409,7 @@ void DGUSScreenHandler::SetStatusMessage(const char* msg, const millis_t duratio } void DGUSScreenHandler::SetStatusMessage(FSTR_P const fmsg, const millis_t duration) { - dgus_display.WriteStringPGM((uint16_t)DGUS_Addr::MESSAGE_Status, FTOP(msg), DGUS_STATUS_LEN, false, true); + dgus_display.WriteStringPGM((uint16_t)DGUS_Addr::MESSAGE_Status, FTOP(fmsg), DGUS_STATUS_LEN, false, true); status_expire = (duration > 0 ? ExtUI::safe_millis() + duration : 0); } From 30a69f76a3dc9deaef6974d18107d7f759502092 Mon Sep 17 00:00:00 2001 From: dwzg <50058606+dwzg@users.noreply.github.com> Date: Sun, 7 Nov 2021 04:48:00 +0100 Subject: [PATCH 111/125] =?UTF-8?q?=F0=9F=90=9B=20Fix=20JyersUI=20scrollin?= =?UTF-8?q?g=20filename,=20etc.=20(#23082)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 50 +++++++++++++++------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 80ef88d0b2..4c838a2e21 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -678,31 +678,31 @@ void CrealityDWINClass::Draw_Print_Filename(const bool reset/*=false*/) { static uint8_t namescrl = 0; if (reset) namescrl = 0; if (process == Print) { - size_t len = strlen(filename); - int8_t pos = len; - if (pos > 30) { - pos -= namescrl; - len = _MIN(pos, 30); - char dispname[len + 1]; + constexpr int8_t maxlen = 30; + char *outstr = filename; + size_t slen = strlen(filename); + int8_t outlen = slen; + if (slen > maxlen) { + char dispname[maxlen + 1]; + int8_t pos = slen - namescrl, len = maxlen; if (pos >= 0) { + NOMORE(len, pos); LOOP_L_N(i, len) dispname[i] = filename[i + namescrl]; } else { - LOOP_L_N(i, 30 + pos) dispname[i] = ' '; - LOOP_S_L_N(i, 30 + pos, 30) dispname[i] = filename[i - (30 + pos)]; + const int8_t mp = maxlen + pos; + LOOP_L_N(i, mp) dispname[i] = ' '; + LOOP_S_L_N(i, mp, maxlen) dispname[i] = filename[i - mp]; + if (mp <= 0) namescrl = 0; } dispname[len] = '\0'; - DWIN_Draw_Rectangle(1, Color_Bg_Black, 8, 50, DWIN_WIDTH - 8, 80); - const int8_t npos = (DWIN_WIDTH - 30 * MENU_CHR_W) / 2; - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, npos, 60, dispname); - if (-pos >= 30) namescrl = 0; + outstr = dispname; + outlen = maxlen; namescrl++; } - else { - DWIN_Draw_Rectangle(1, Color_Bg_Black, 8, 50, DWIN_WIDTH - 8, 80); - const int8_t npos = (DWIN_WIDTH - strlen(filename) * MENU_CHR_W) / 2; - DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, npos, 60, filename); - } + DWIN_Draw_Rectangle(1, Color_Bg_Black, 8, 50, DWIN_WIDTH - 8, 80); + const int8_t npos = (DWIN_WIDTH - outlen * MENU_CHR_W) / 2; + DWIN_Draw_String(false, DWIN_FONT_MENU, Color_White, Color_Bg_Black, npos, 60, outstr); } } @@ -4702,7 +4702,7 @@ void CrealityDWINClass::Update_Status(const char * const text) { char header[4]; LOOP_L_N(i, 3) header[i] = text[i]; header[3] = '\0'; - if (strcmp_P(header,"") == 0) { + if (strcmp_P(header, PSTR("")) == 0) { LOOP_L_N(i, _MIN((size_t)LONG_FILENAME_LENGTH, strlen(text))) filename[i] = text[i + 3]; filename[_MIN((size_t)LONG_FILENAME_LENGTH - 1, strlen(text))] = '\0'; Draw_Print_Filename(true); @@ -4798,22 +4798,23 @@ void CrealityDWINClass::State_Update() { } void CrealityDWINClass::Screen_Update() { + const millis_t ms = millis(); static millis_t scrltime = 0; - if (ELAPSED(millis(), scrltime)) { - scrltime = millis() + 200; + if (ELAPSED(ms, scrltime)) { + scrltime = ms + 200; Update_Status_Bar(); if (process == Print) Draw_Print_Filename(); } static millis_t statustime = 0; - if (ELAPSED(millis(), statustime)) { - statustime = millis() + 500; + if (ELAPSED(ms, statustime)) { + statustime = ms + 500; Draw_Status_Area(); } static millis_t printtime = 0; - if (ELAPSED(millis(), printtime)) { - printtime = millis() + 1000; + if (ELAPSED(ms, printtime)) { + printtime = ms + 1000; if (process == Print) { Draw_Print_ProgressBar(); Draw_Print_ProgressElapsed(); @@ -5000,6 +5001,7 @@ void MarlinUI::init() { void MarlinUI::pause_show_message(const PauseMessage message, const PauseMode mode/*=PAUSE_MODE_SAME*/, const uint8_t extruder/*=active_extruder*/) { switch (message) { case PAUSE_MESSAGE_INSERT: CrealityDWIN.Confirm_Handler(FilInsert); break; + case PAUSE_MESSAGE_PURGE: case PAUSE_MESSAGE_OPTION: CrealityDWIN.Popup_Handler(PurgeMore); break; case PAUSE_MESSAGE_HEAT: CrealityDWIN.Confirm_Handler(HeaterTime); break; case PAUSE_MESSAGE_WAITING: CrealityDWIN.Draw_Print_Screen(); break; From 27220f09440e90ed490087273a2357b84a41663c Mon Sep 17 00:00:00 2001 From: Jin <3448324+jinhong-@users.noreply.github.com> Date: Sun, 7 Nov 2021 11:53:36 +0800 Subject: [PATCH 112/125] =?UTF-8?q?=F0=9F=8D=BB=20Preliminary=20fix=20for?= =?UTF-8?q?=20Max31865=20SPI=20(#22682)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/HAL/shared/Delay.h | 15 +++- Marlin/src/HAL/shared/Marduino.h | 2 +- Marlin/src/libs/MAX31865.cpp | 125 +++++++++++++++---------------- Marlin/src/libs/MAX31865.h | 11 ++- buildroot/tests/LPC1769 | 3 +- buildroot/tests/teensy41 | 5 +- 6 files changed, 90 insertions(+), 71 deletions(-) diff --git a/Marlin/src/HAL/shared/Delay.h b/Marlin/src/HAL/shared/Delay.h index 04df35d88d..df07881f01 100644 --- a/Marlin/src/HAL/shared/Delay.h +++ b/Marlin/src/HAL/shared/Delay.h @@ -92,6 +92,12 @@ void calibrate_delay_loop(); #define DELAY_CYCLES(X) do { SmartDelay _smrtdly_X(X); } while(0) + #if GCC_VERSION <= 70000 + #define DELAY_CYCLES_VAR(X) DelayCycleFnc(X) + #else + #define DELAY_CYCLES_VAR DELAY_CYCLES + #endif + // For delay in microseconds, no smart delay selection is required, directly call the delay function // Teensy compiler is too old and does not accept smart delay compile-time / run-time selection correctly #define DELAY_US(x) DelayCycleFnc((x) * ((F_CPU) / 1000000UL)) @@ -200,9 +206,12 @@ void calibrate_delay_loop(); #endif #if ENABLED(DELAY_NS_ROUND_DOWN) - #define DELAY_NS(x) DELAY_CYCLES((x) * ((F_CPU) / 1000000UL) / 1000UL) // floor + #define _NS_TO_CYCLES(x) ( (x) * ((F_CPU) / 1000000UL) / 1000UL) // floor #elif ENABLED(DELAY_NS_ROUND_CLOSEST) - #define DELAY_NS(x) DELAY_CYCLES(((x) * ((F_CPU) / 1000000UL) + 500) / 1000UL) // round + #define _NS_TO_CYCLES(x) (((x) * ((F_CPU) / 1000000UL) + 500) / 1000UL) // round #else - #define DELAY_NS(x) DELAY_CYCLES(((x) * ((F_CPU) / 1000000UL) + 999) / 1000UL) // "ceil" + #define _NS_TO_CYCLES(x) (((x) * ((F_CPU) / 1000000UL) + 999) / 1000UL) // "ceil" #endif + +#define DELAY_NS(x) DELAY_CYCLES(_NS_TO_CYCLES(x)) +#define DELAY_NS_VAR(x) DELAY_CYCLES_VAR(_NS_TO_CYCLES(x)) diff --git a/Marlin/src/HAL/shared/Marduino.h b/Marlin/src/HAL/shared/Marduino.h index 3b5a68a373..0e2a021a3c 100644 --- a/Marlin/src/HAL/shared/Marduino.h +++ b/Marlin/src/HAL/shared/Marduino.h @@ -39,7 +39,7 @@ #define DISABLED(V...) DO(DIS,&&,V) #undef _BV -#define _BV(b) (1UL << (b)) +#define _BV(b) (1 << (b)) #ifndef SBI #define SBI(A,B) (A |= _BV(B)) #endif diff --git a/Marlin/src/libs/MAX31865.cpp b/Marlin/src/libs/MAX31865.cpp index df0702b9fb..94048af208 100644 --- a/Marlin/src/libs/MAX31865.cpp +++ b/Marlin/src/libs/MAX31865.cpp @@ -48,20 +48,17 @@ #if HAS_MAX31865 && !USE_ADAFRUIT_MAX31865 -//#include // TODO: switch to SPIclass/SoftSPI #include "MAX31865.h" +#ifdef TARGET_LPC1768 + #include +#endif + // The maximum speed the MAX31865 can do is 5 MHz SPISettings MAX31865::spiConfig = SPISettings( - #if defined(TARGET_LPC1768) - SPI_QUARTER_SPEED - #elif defined(ARDUINO_ARCH_STM32) - SPI_CLOCK_DIV4 - #else - 500000 - #endif - , MSBFIRST - , SPI_MODE_1 // CPOL0 CPHA1 + TERN(TARGET_LPC1768, SPI_QUARTER_SPEED, TERN(ARDUINO_ARCH_STM32, SPI_CLOCK_DIV4, 500000)), + MSBFIRST, + SPI_MODE1 // CPOL0 CPHA1 ); #ifndef LARGE_PINMAP @@ -93,7 +90,7 @@ SPISettings MAX31865::spiConfig = SPISettings( _sclk = _miso = _mosi = -1; } -#else +#else // LARGE_PINMAP /** * Create the interface object using software (bitbang) SPI for PIN values @@ -106,9 +103,7 @@ SPISettings MAX31865::spiConfig = SPISettings( * @param spi_clk the SPI clock pin to use * @param pin_mapping set to 1 for positive pin values */ - MAX31865::MAX31865(uint32_t spi_cs, uint32_t spi_mosi, - uint32_t spi_miso, uint32_t spi_clk, - uint8_t pin_mapping) { + MAX31865::MAX31865(uint32_t spi_cs, uint32_t spi_mosi, uint32_t spi_miso, uint32_t spi_clk, uint8_t pin_mapping) { _cs = spi_cs; _mosi = spi_mosi; _miso = spi_miso; @@ -130,14 +125,12 @@ SPISettings MAX31865::spiConfig = SPISettings( #endif // LARGE_PINMAP - /** * * Instance & Class methods * */ - /** * Initialize the SPI interface and set the number of RTD wires used * @@ -152,22 +145,13 @@ void MAX31865::begin(max31865_numwires_t wires, float zero, float ref) { OUT_WRITE(_cs, HIGH); if (_sclk != TERN(LARGE_PINMAP, -1UL, -1)) { - // Define pin modes for Software SPI - #ifdef MAX31865_DEBUG - SERIAL_ECHOLN("Initializing MAX31865 Software SPI"); - #endif - - OUT_WRITE(_sclk, LOW); - SET_OUTPUT(_mosi); - SET_INPUT(_miso); + softSpiBegin(SPI_QUARTER_SPEED); // Define pin modes for Software SPI } else { - // Start and configure hardware SPI #ifdef MAX31865_DEBUG - SERIAL_ECHOLN("Initializing MAX31865 Hardware SPI"); + SERIAL_ECHOLNPGM("Initializing MAX31865 Hardware SPI"); #endif - - SPI.begin(); + SPI.begin(); // Start and configure hardware SPI } setWires(wires); @@ -176,25 +160,15 @@ void MAX31865::begin(max31865_numwires_t wires, float zero, float ref) { clearFault(); #ifdef MAX31865_DEBUG_SPI - #ifndef LARGE_PINMAP - SERIAL_ECHOLNPGM( - "Regular begin call with _cs: ", _cs, - " _miso: ", _miso, - " _sclk: ", _sclk, - " _mosi: ", _mosi - ); - #else - SERIAL_ECHOLNPGM( - "LARGE_PINMAP begin call with _cs: ", _cs, - " _miso: ", _miso, - " _sclk: ", _sclk, - " _mosi: ", _mosi - ); - #endif // LARGE_PINMAP - - SERIAL_ECHOLNPGM("config: ", readRegister8(MAX31856_CONFIG_REG)); - SERIAL_EOL(); - #endif // MAX31865_DEBUG_SPI + SERIAL_ECHOLNPGM( + TERN(LARGE_PINMAP, "LARGE_PINMAP", "Regular") + " begin call with _cs: ", _cs, + " _miso: ", _miso, + " _sclk: ", _sclk, + " _mosi: ", _mosi, + " config: ", readRegister8(MAX31856_CONFIG_REG) + ); + #endif } /** @@ -371,7 +345,6 @@ float MAX31865::temperature(float Rrtd) { // private: // - /** * Set a value in the configuration register. * @@ -432,10 +405,15 @@ void MAX31865::readRegisterN(uint8_t addr, uint8_t buffer[], uint8_t n) { WRITE(_sclk, LOW); WRITE(_cs, LOW); - spixfer(addr); + + #ifdef TARGET_LPC1768 + DELAY_CYCLES(_spi_speed); + #endif + + spiTransfer(addr); while (n--) { - buffer[0] = spixfer(0xFF); + buffer[0] = spiTransfer(0xFF); #ifdef MAX31865_DEBUG_SPI SERIAL_ECHOLNPGM("buffer read ", n, " data: ", buffer[0]); #endif @@ -462,8 +440,12 @@ void MAX31865::writeRegister8(uint8_t addr, uint8_t data) { WRITE(_cs, LOW); - spixfer(addr | 0x80); // make sure top bit is set - spixfer(data); + #ifdef TARGET_LPC1768 + DELAY_CYCLES(_spi_speed); + #endif + + spiTransfer(addr | 0x80); // make sure top bit is set + spiTransfer(data); if (_sclk == TERN(LARGE_PINMAP, -1UL, -1)) SPI.endTransaction(); @@ -480,21 +462,38 @@ void MAX31865::writeRegister8(uint8_t addr, uint8_t data) { * @param x an 8-bit chunk of data to write * @return the 8-bit response */ -uint8_t MAX31865::spixfer(uint8_t x) { +uint8_t MAX31865::spiTransfer(uint8_t x) { if (_sclk == TERN(LARGE_PINMAP, -1UL, -1)) return SPI.transfer(x); - uint8_t reply = 0; - for (int i = 7; i >= 0; i--) { - reply <<= 1; - WRITE(_sclk, HIGH); - WRITE(_mosi, x & (1 << i)); - WRITE(_sclk, LOW); - if (READ(_miso)) - reply |= 1; - } + #ifdef TARGET_LPC1768 + return swSpiTransfer(x, _spi_speed, _sclk, _miso, _mosi); + #else + uint8_t reply = 0; + for (int i = 7; i >= 0; i--) { + WRITE(_sclk, HIGH); DELAY_NS_VAR(_spi_delay); + reply <<= 1; + WRITE(_mosi, x & _BV(i)); DELAY_NS_VAR(_spi_delay); + if (READ(_miso)) reply |= 1; + WRITE(_sclk, LOW); DELAY_NS_VAR(_spi_delay); + } + return reply; + #endif +} - return reply; +void MAX31865::softSpiBegin(const uint8_t spi_speed) { + #ifdef MAX31865_DEBUG + SERIAL_ECHOLNPGM("Initializing MAX31865 Software SPI"); + #endif + #ifdef TARGET_LPC1768 + swSpiBegin(_sclk, _miso, _mosi); + _spi_speed = swSpiInit(spi_speed, _sclk, _mosi); + #else + _spi_delay = (100UL << spi_speed) / 3; // Calculate delay in ns. Top speed is ~10MHz, or 100ns delay between bits. + OUT_WRITE(_sclk, LOW); + SET_OUTPUT(_mosi); + SET_INPUT(_miso); + #endif } #endif // HAS_MAX31865 && !USE_ADAFRUIT_MAX31865 diff --git a/Marlin/src/libs/MAX31865.h b/Marlin/src/libs/MAX31865.h index 5d50e870ec..7610924c23 100644 --- a/Marlin/src/libs/MAX31865.h +++ b/Marlin/src/libs/MAX31865.h @@ -90,6 +90,13 @@ private: static SPISettings spiConfig; TERN(LARGE_PINMAP, uint32_t, uint8_t) _sclk, _miso, _mosi, _cs; + + #ifdef TARGET_LPC1768 + uint8_t _spi_speed; + #else + uint16_t _spi_delay; + #endif + float Rzero, Rref; void setConfig(uint8_t config, bool enable); @@ -99,7 +106,9 @@ private: uint16_t readRegister16(uint8_t addr); void writeRegister8(uint8_t addr, uint8_t reg); - uint8_t spixfer(uint8_t addr); + uint8_t spiTransfer(uint8_t addr); + + void softSpiBegin(const uint8_t spi_speed); public: #ifdef LARGE_PINMAP diff --git a/buildroot/tests/LPC1769 b/buildroot/tests/LPC1769 index f0dab630e5..3fe99734ca 100755 --- a/buildroot/tests/LPC1769 +++ b/buildroot/tests/LPC1769 @@ -14,11 +14,12 @@ exec_test $1 $2 "Azteeg X5GT Example Configuration" "$3" restore_configs opt_set MOTHERBOARD BOARD_SMOOTHIEBOARD \ - EXTRUDERS 2 TEMP_SENSOR_1 -1 TEMP_SENSOR_BED 5 \ + EXTRUDERS 2 TEMP_SENSOR_0 -5 TEMP_SENSOR_1 -1 TEMP_SENSOR_BED 5 TEMP_0_CS_PIN P1_29 \ GRID_MAX_POINTS_X 16 \ NOZZLE_CLEAN_START_POINT "{ { 10, 10, 3 }, { 10, 10, 3 } }" \ NOZZLE_CLEAN_END_POINT "{ { 10, 20, 3 }, { 10, 20, 3 } }" opt_enable TFTGLCD_PANEL_SPI SDSUPPORT ADAPTIVE_FAN_SLOWING NO_FAN_SLOWING_IN_PID_TUNING \ + MAX31865_SENSOR_OHMS_0 MAX31865_CALIBRATION_OHMS_0 \ FIX_MOUNTED_PROBE AUTO_BED_LEVELING_BILINEAR G29_RETRY_AND_RECOVER Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \ BABYSTEPPING BABYSTEP_XY BABYSTEP_ZPROBE_OFFSET LEVEL_CORNERS_USE_PROBE LEVEL_CORNERS_VERIFY_RAISED \ PRINTCOUNTER NOZZLE_PARK_FEATURE NOZZLE_CLEAN_FEATURE SLOW_PWM_HEATERS PIDTEMPBED EEPROM_SETTINGS INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT \ diff --git a/buildroot/tests/teensy41 b/buildroot/tests/teensy41 index fd89512ea5..1affd7c89e 100755 --- a/buildroot/tests/teensy41 +++ b/buildroot/tests/teensy41 @@ -15,12 +15,13 @@ exec_test $1 $2 "Teensy4.1 with default config" "$3" # restore_configs opt_set MOTHERBOARD BOARD_TEENSY41 \ - EXTRUDERS 2 TEMP_SENSOR_0 1 TEMP_SENSOR_1 5 TEMP_SENSOR_BED 1 \ + EXTRUDERS 2 TEMP_SENSOR_0 -5 TEMP_SENSOR_1 5 TEMP_SENSOR_BED 1 TEMP_0_CS_PIN 23 \ I2C_SLAVE_ADDRESS 63 \ GRID_MAX_POINTS_X 16 \ NOZZLE_CLEAN_START_POINT "{ { 10, 10, 3 }, { 10, 10, 3 } }" \ NOZZLE_CLEAN_END_POINT "{ { 10, 20, 3 }, { 10, 20, 3 } }" -opt_enable EXTENSIBLE_UI LCD_INFO_MENU SDSUPPORT SDCARD_SORT_ALPHA \ +opt_enable MAX31865_SENSOR_OHMS_0 MAX31865_CALIBRATION_OHMS_0 \ + EXTENSIBLE_UI LCD_INFO_MENU SDSUPPORT SDCARD_SORT_ALPHA \ FILAMENT_LCD_DISPLAY CALIBRATION_GCODE BAUD_RATE_GCODE \ FIX_MOUNTED_PROBE Z_SAFE_HOMING AUTO_BED_LEVELING_BILINEAR Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \ BABYSTEPPING BABYSTEP_XY BABYSTEP_ZPROBE_OFFSET \ From dc972990f35ed0f6c1ddc7d2d6c15df9e8a4cb3c Mon Sep 17 00:00:00 2001 From: Evgeniy Zhabotinskiy Date: Sun, 7 Nov 2021 07:16:18 +0300 Subject: [PATCH 113/125] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20M503=20report=20(#?= =?UTF-8?q?23084)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/config/M304.cpp | 2 +- Marlin/src/module/settings.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/src/gcode/config/M304.cpp b/Marlin/src/gcode/config/M304.cpp index 4bd415db1e..97dc4be25e 100644 --- a/Marlin/src/gcode/config/M304.cpp +++ b/Marlin/src/gcode/config/M304.cpp @@ -43,7 +43,7 @@ void GcodeSuite::M304() { void GcodeSuite::M304_report(const bool forReplay/*=true*/) { report_heading_etc(forReplay, F(STR_BED_PID)); - SERIAL_ECHO_MSG( + SERIAL_ECHOLNPGM( " M304 P", thermalManager.temp_bed.pid.Kp , " I", unscalePID_i(thermalManager.temp_bed.pid.Ki) , " D", unscalePID_d(thermalManager.temp_bed.pid.Kd) diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 01a5c47fd5..f4eba776b6 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -3068,9 +3068,9 @@ void MarlinSettings::reset() { // CONFIG_ECHO_HEADING("Linear Units"); #if ENABLED(INCH_MODE_SUPPORT) - SERIAL_ECHOPGM(" G2", AS_DIGIT(parser.linear_unit_factor == 1.0), " ;"); + SERIAL_ECHO_MSG(" G2", AS_DIGIT(parser.linear_unit_factor == 1.0), " ;"); #else - SERIAL_ECHOPGM(" G21 ;"); + SERIAL_ECHO_MSG(" G21 ;"); #endif gcode.say_units(); From e15f9fdcd9ccff010f188d6b0762cf00956a55c1 Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Sat, 6 Nov 2021 23:09:15 -0700 Subject: [PATCH 114/125] =?UTF-8?q?=F0=9F=9A=B8=20Indicate=20Preheating=20?= =?UTF-8?q?for=20probe=20/=20leveling=20(#23088)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/language/language_en.h | 1 + Marlin/src/module/probe.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 9a92a7e268..ecd5ef5660 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -531,6 +531,7 @@ namespace Language_en { LSTR MSG_ERR_MINTEMP = _UxGT("Err: MINTEMP"); LSTR MSG_HALTED = _UxGT("PRINTER HALTED"); LSTR MSG_PLEASE_RESET = _UxGT("Please Reset"); + LSTR MSG_PREHEATING = _UxGT("Preheating..."); LSTR MSG_HEATING = _UxGT("Heating..."); LSTR MSG_COOLING = _UxGT("Cooling..."); LSTR MSG_BED_HEATING = _UxGT("Bed Heating..."); diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index d9e52a9b43..984a3aabb5 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -362,6 +362,8 @@ FORCE_INLINE void probe_specific_action(const bool deploy) { #define WAIT_FOR_BED_HEAT #endif + LCD_MESSAGE(MSG_PREHEATING); + DEBUG_ECHOPGM("Preheating "); #if ENABLED(WAIT_FOR_NOZZLE_HEAT) From 030b66eb2710165a2081c625a7a0573a6d04b5ae Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 7 Nov 2021 01:11:51 -0600 Subject: [PATCH 115/125] =?UTF-8?q?=F0=9F=8E=A8=20Misc.=20code=20cleanup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/MarlinCore.cpp | 5 +++-- Marlin/src/feature/twibus.cpp | 2 +- .../src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h | 4 ++-- .../variant.cpp | 18 +++++++++--------- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 5e8881d1c6..8b6b278f1f 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -1554,6 +1554,7 @@ void setup() { #endif #if HAS_DWIN_E3V2_BASIC + SETUP_LOG("E3V2 Init"); Encoder_Configuration(); HMI_Init(); HMI_SetLanguageCache(); @@ -1562,7 +1563,7 @@ void setup() { #endif #if HAS_SERVICE_INTERVALS && !HAS_DWIN_E3V2_BASIC - ui.reset_status(true); // Show service messages or keep current status + SETUP_RUN(ui.reset_status(true)); // Show service messages or keep current status #endif #if ENABLED(MAX7219_DEBUG) @@ -1593,7 +1594,7 @@ void setup() { #endif #if BOTH(HAS_LCD_MENU, TOUCH_SCREEN_CALIBRATION) && EITHER(TFT_CLASSIC_UI, TFT_COLOR_UI) - ui.check_touch_calibration(); + SETUP_RUN(ui.check_touch_calibration()); #endif marlin_state = MF_RUNNING; diff --git a/Marlin/src/feature/twibus.cpp b/Marlin/src/feature/twibus.cpp index 0e23b48a40..e33581676c 100644 --- a/Marlin/src/feature/twibus.cpp +++ b/Marlin/src/feature/twibus.cpp @@ -98,7 +98,7 @@ void TWIBus::echodata(uint8_t bytes, FSTR_P const pref, uint8_t adr, const uint8 union TwoBytesToInt16 { uint8_t bytes[2]; int16_t integervalue; }; TwoBytesToInt16 ConversionUnion; - echoprefix(bytes, pref, adr); + echoprefix(bytes, pref, adr); while (bytes-- && Wire.available()) { int value = Wire.read(); diff --git a/Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h b/Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h index 7ce21a20af..fea5b00b50 100644 --- a/Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_ERYONE_ERY32_MINI.h @@ -54,7 +54,7 @@ // // Limit Switches -// +// #define X_STOP_PIN PD8 #define Y_STOP_PIN PD15 #define Z_MIN_PIN PA11 @@ -173,7 +173,7 @@ #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 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 index c8ed0d1e52..7979f3f804 100644 --- 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 @@ -190,12 +190,12 @@ WEAK void SystemClock_Config(void) /* 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 + + /* 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; @@ -209,19 +209,19 @@ WEAK void SystemClock_Config(void) { /* Initialization Error */ } - + if(HAL_PWREx_EnableOverDrive() != HAL_OK) { /* Initialization Error */ } - - /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 + + /* 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; + 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 */ From fa5bfca3678ef6e695e8e5d4a51af2bcd02e8e85 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Mon, 8 Nov 2021 01:01:19 +0000 Subject: [PATCH 116/125] [cron] Bump distribution date (2021-11-08) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index ce8acbbc3e..6cba2f4558 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-11-07" +//#define STRING_DISTRIBUTION_DATE "2021-11-08" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 7626b58e3e..a1c65c210f 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-11-07" + #define STRING_DISTRIBUTION_DATE "2021-11-08" #endif /** From 467e883e17dd8a67c26a3273f0586ce474e959f5 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 9 Nov 2021 01:01:17 +0000 Subject: [PATCH 117/125] [cron] Bump distribution date (2021-11-09) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 6cba2f4558..38c122bdb4 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-11-08" +//#define STRING_DISTRIBUTION_DATE "2021-11-09" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index a1c65c210f..45bf84a537 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-11-08" + #define STRING_DISTRIBUTION_DATE "2021-11-09" #endif /** From cee50552ab4dc3463717920b792a8825a783cd83 Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Tue, 9 Nov 2021 08:30:02 -0800 Subject: [PATCH 118/125] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20BTT002=20(STM32F40?= =?UTF-8?q?7VET6)=20variant,=20MK3=5FFAN=5FPINS=20flag=20(#23093)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/pins.h | 2 +- .../src/pins/stm32f4/pins_BTT_BTT002_V1_0.h | 20 +++++++- .../boards/marlin_BigTree_BTT002_VET6.json | 46 +++++++++++++++++++ ini/stm32f4.ini | 8 ++++ 4 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 buildroot/share/PlatformIO/boards/marlin_BigTree_BTT002_VET6.json diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 369a78be7a..57648b3e16 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -616,7 +616,7 @@ #elif MB(BTT_GTR_V1_0) #include "stm32f4/pins_BTT_GTR_V1_0.h" // STM32F4 env:BIGTREE_GTR_V1_0 env:BIGTREE_GTR_V1_0_usb_flash_drive #elif MB(BTT_BTT002_V1_0) - #include "stm32f4/pins_BTT_BTT002_V1_0.h" // STM32F4 env:BIGTREE_BTT002 + #include "stm32f4/pins_BTT_BTT002_V1_0.h" // STM32F4 env:BIGTREE_BTT002 env:BIGTREE_BTT002_VET6 #elif MB(BTT_E3_RRF) #include "stm32f4/pins_BTT_E3_RRF.h" // STM32F4 env:BIGTREE_E3_RRF #elif MB(BTT_SKR_V2_0_REV_A) diff --git a/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h b/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h index b7ffcce4a8..7b99352ef4 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h @@ -29,6 +29,8 @@ #define BOARD_INFO_NAME "BTT BTT002 V1.0" +//#define MK3_FAN_PINS + #define USES_DIAG_PINS // Ignore temp readings during development. @@ -169,8 +171,22 @@ // #define HEATER_0_PIN PE6 // Heater0 #define HEATER_BED_PIN PE5 // Hotbed -#define FAN_PIN PB8 // Fan1 -#define FAN1_PIN PB9 // Fan0 + +#ifndef FAN_PIN + #ifdef MK3_FAN_PINS + #define FAN_PIN PB8 // Fan1 + #else + #define FAN_PIN PB9 // Fan0 + #endif +#endif + +#ifndef FAN1_PIN + #ifdef MK3_FAN_PINS + #define FAN1_PIN PB9 // Fan0 + #else + #define FAN1_PIN PB8 // Fan1 + #endif +#endif /** * -----------------------------------BTT002 V1.0---------------------------------------- diff --git a/buildroot/share/PlatformIO/boards/marlin_BigTree_BTT002_VET6.json b/buildroot/share/PlatformIO/boards/marlin_BigTree_BTT002_VET6.json new file mode 100644 index 0000000000..77d3af0112 --- /dev/null +++ b/buildroot/share/PlatformIO/boards/marlin_BigTree_BTT002_VET6.json @@ -0,0 +1,46 @@ +{ + "build": { + "core": "stm32", + "cpu": "cortex-m4", + "extra_flags": "-DSTM32F4 -DSTM32F407xx -DSTM32F40_41xxx", + "f_cpu": "168000000L", + "hwids": [ + [ + "0x1EAF", + "0x0003" + ], + [ + "0x0483", + "0x3748" + ] + ], + "mcu": "stm32f407vet6", + "variant": "MARLIN_BIGTREE_BTT002" + }, + "debug": { + "jlink_device": "STM32F407VE", + "openocd_target": "stm32f4x", + "svd_path": "STM32F40x.svd" + }, + "frameworks": [ + "arduino" + ], + "name": "STM32F407VE (192k RAM. 512k Flash)", + "upload": { + "disable_flushing": false, + "maximum_ram_size": 131072, + "maximum_size": 524288, + "protocol": "stlink", + "protocols": [ + "stlink", + "dfu", + "jlink" + ], + "offset_address": "0x8008000", + "require_upload_port": true, + "use_1200bps_touch": false, + "wait_for_upload_port": false + }, + "url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f407ve.html", + "vendor": "ST" +} diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 0e9b507c8b..6fec1d46fc 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -204,6 +204,14 @@ build_flags = ${stm32_variant.build_flags} -DPIN_SERIAL2_RX=PD_6 -DPIN_SERIAL2_TX=PD_5 +# +# BigTreeTech BTT002 V1.x with 512k of flash (STM32F407VET6 ARM Cortex-M4) +# +[env:BIGTREE_BTT002_VET6] +platform = ${env:BIGTREE_BTT002.platform} +extends = env:BIGTREE_BTT002 +board = marlin_BigTree_BTT002_VET6 + # # BigTreeTech SKR V2.0 (STM32F407VGT6 ARM Cortex-M4) with USB Flash Drive Support # From e776fa1e93d5a8ac1d6ebd7c084e18e1a009ad6b Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Wed, 10 Nov 2021 01:01:08 +0000 Subject: [PATCH 119/125] [cron] Bump distribution date (2021-11-10) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 38c122bdb4..0f2136cbdd 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-11-09" +//#define STRING_DISTRIBUTION_DATE "2021-11-10" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 45bf84a537..e61948958d 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-11-09" + #define STRING_DISTRIBUTION_DATE "2021-11-10" #endif /** From 07befb545b2bc6ea284d444637a039127af6b4d1 Mon Sep 17 00:00:00 2001 From: BigTreeTech <38851044+bigtreetech@users.noreply.github.com> Date: Wed, 10 Nov 2021 23:56:10 +0800 Subject: [PATCH 120/125] =?UTF-8?q?=E2=9C=A8=20Support=20for=20BIQU=20B1-S?= =?UTF-8?q?E-Plus=20strain=20gauge=20probe=20(#23101)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/Configuration.h | 9 +++++++++ Marlin/src/module/endstops.cpp | 3 +++ Marlin/src/pins/pinsDebug_list.h | 9 +++++++++ Marlin/src/pins/stm32f1/pins_BTT_SKR_CR6.h | 4 +++- Marlin/src/pins/stm32f1/pins_CREALITY_V452.h | 5 ++++- Marlin/src/pins/stm32f1/pins_CREALITY_V453.h | 5 ++++- Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h | 7 +++++++ 7 files changed, 39 insertions(+), 3 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 8ab3929c41..2c53498d02 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1220,6 +1220,15 @@ #endif #endif +/** + * Probe Enable / Disable + * The probe only provides a triggered signal when enabled. + */ +//#define PROBE_ENABLE_DISABLE +#if ENABLED(PROBE_ENABLE_DISABLE) + //#define PROBE_ENABLE_PIN -1 // Override the default pin here +#endif + /** * Multiple Probing * diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index 04f20ca3a4..aa5907477e 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -392,6 +392,9 @@ void Endstops::not_homing() { #if HAS_BED_PROBE void Endstops::enable_z_probe(const bool onoff) { z_probe_enabled = onoff; + #if PIN_EXISTS(PROBE_ENABLE) + WRITE(PROBE_ENABLE_PIN, onoff); + #endif resync(); } #endif diff --git a/Marlin/src/pins/pinsDebug_list.h b/Marlin/src/pins/pinsDebug_list.h index 05756d6004..dc0d5225db 100644 --- a/Marlin/src/pins/pinsDebug_list.h +++ b/Marlin/src/pins/pinsDebug_list.h @@ -1439,6 +1439,15 @@ #if PIN_EXISTS(Z_MIN_PROBE) REPORT_NAME_DIGITAL(__LINE__, Z_MIN_PROBE_PIN) #endif +#if PIN_EXISTS(PROBE_ACTIVATION_SWITCH) + REPORT_NAME_DIGITAL(__LINE__, PROBE_ACTIVATION_SWITCH_PIN) +#endif +#if PIN_EXISTS(PROBE_ENABLE) + REPORT_NAME_DIGITAL(__LINE__, PROBE_ENABLE_PIN) +#endif +#if PIN_EXISTS(PROBE_TARE) + REPORT_NAME_DIGITAL(__LINE__, PROBE_TARE_PIN) +#endif #if PIN_EXISTS(I_ATT) REPORT_NAME_DIGITAL(__LINE__, I_ATT_PIN) #endif diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_CR6.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_CR6.h index 8bae916a46..8368fd03cd 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_CR6.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_CR6.h @@ -71,7 +71,9 @@ // Probe // #define PROBE_TARE_PIN PA1 -#define PROBE_ACTIVATION_SWITCH_PIN PC2 // Optoswitch to Enable Z Probe +#if ENABLED(PROBE_ACTIVATION_SWITCH) + #define PROBE_ACTIVATION_SWITCH_PIN PC2 // Optoswitch to Enable Z Probe +#endif // // Steppers diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V452.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V452.h index a2add81c8b..7d3140056a 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V452.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V452.h @@ -34,6 +34,9 @@ #define HEATER_0_PIN PA1 // HEATER1 #define HEATER_BED_PIN PA2 // HOT BED #define FAN_PIN PA0 // FAN -#define PROBE_ACTIVATION_SWITCH_PIN PC6 // Optoswitch to Enable Z Probe + +#if ENABLED(PROBE_ACTIVATION_SWITCH) + #define PROBE_ACTIVATION_SWITCH_PIN PC6 // Optoswitch to Enable Z Probe +#endif #include "pins_CREALITY_V45x.h" diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V453.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V453.h index 7b8c3280d2..b669887d1e 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V453.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V453.h @@ -34,6 +34,9 @@ #define HEATER_0_PIN PB14 // HEATER1 #define HEATER_BED_PIN PB13 // HOT BED #define FAN_PIN PB15 // FAN -#define PROBE_ACTIVATION_SWITCH_PIN PB2 // Optoswitch to Enable Z Probe + +#if ENABLED(PROBE_ACTIVATION_SWITCH) + #define PROBE_ACTIVATION_SWITCH_PIN PB2 // Optoswitch to Enable Z Probe +#endif #include "pins_CREALITY_V45x.h" diff --git a/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h b/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h index 9a280eac16..762e355626 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h @@ -132,6 +132,13 @@ #define Z_MIN_PROBE_PIN PE4 #endif +// +// Probe enable +// +#if ENABLED(PROBE_ENABLE_DISABLE) + #define PROBE_ENABLE_PIN SERVO0_PIN +#endif + // // Filament Runout Sensor // From 99df0b86fb3fdf8a671fd553301b7bb5acc4a0a5 Mon Sep 17 00:00:00 2001 From: George Fu Date: Wed, 10 Nov 2021 23:58:20 +0800 Subject: [PATCH 121/125] =?UTF-8?q?=F0=9F=90=9B=20Fix=20FYSETC=20Cheetah?= =?UTF-8?q?=202.0=20pins=20for=20production=20(#23104)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/stm32f4/pins_FYSETC_CHEETAH_V20.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_FYSETC_CHEETAH_V20.h b/Marlin/src/pins/stm32f4/pins_FYSETC_CHEETAH_V20.h index a604a71c4b..054da62754 100644 --- a/Marlin/src/pins/stm32f4/pins_FYSETC_CHEETAH_V20.h +++ b/Marlin/src/pins/stm32f4/pins_FYSETC_CHEETAH_V20.h @@ -38,9 +38,9 @@ #define FLASH_EEPROM_EMULATION #define FLASH_EEPROM_LEVELING - #define FLASH_SECTOR 2 + #define FLASH_SECTOR 1 #define FLASH_UNIT_SIZE 0x4000 // 16k - #define FLASH_ADDRESS_START 0x8008000 + #define FLASH_ADDRESS_START 0x8004000 #endif // @@ -57,7 +57,7 @@ // Limit Switches // #define X_STOP_PIN PB4 -#define Y_STOP_PIN PB3 +#define Y_STOP_PIN PC8 #define Z_STOP_PIN PB1 // @@ -111,9 +111,10 @@ #define HEATER_0_PIN PC6 #define HEATER_BED_PIN PC7 #ifndef FAN_PIN - #define FAN_PIN PA1 + #define FAN_PIN PA14 #endif -#define FAN1_PIN PC8 +#define FAN1_PIN PA13 +#define FAN2_PIN PA1 // // Temperature Sensors From b4b16b63ff40aaba9e482294e8f34403eb51e632 Mon Sep 17 00:00:00 2001 From: Miguel Risco-Castillo Date: Wed, 10 Nov 2021 11:31:35 -0500 Subject: [PATCH 122/125] =?UTF-8?q?=F0=9F=9A=B8=20Expose=20sub-options=20f?= =?UTF-8?q?or=20E3V2=20Enhanced=20(#23099)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 2 +- Marlin/src/MarlinCore.cpp | 1 - Marlin/src/lcd/e3v2/enhanced/dwin.cpp | 111 +++++++++++++++++++++----- Marlin/src/lcd/e3v2/enhanced/dwin.h | 4 +- Marlin/src/lcd/marlinui.cpp | 19 ++--- Marlin/src/lcd/marlinui.h | 7 +- 6 files changed, 105 insertions(+), 39 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index fc495a6ea6..fc9688edb7 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1280,7 +1280,7 @@ #endif // HAS_LCD_MENU -#if HAS_DISPLAY +#if EITHER(HAS_DISPLAY, DWIN_CREALITY_LCD_ENHANCED) // The timeout (in ms) to return to the status screen from sub-menus //#define LCD_TIMEOUT_TO_STATUS 15000 diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 8b6b278f1f..f2031cdfb9 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -1559,7 +1559,6 @@ void setup() { HMI_Init(); HMI_SetLanguageCache(); HMI_StartFrame(true); - DWIN_StatusChanged(GET_TEXT_F(WELCOME_MSG)); #endif #if HAS_SERVICE_INTERVALS && !HAS_DWIN_E3V2_BASIC diff --git a/Marlin/src/lcd/e3v2/enhanced/dwin.cpp b/Marlin/src/lcd/e3v2/enhanced/dwin.cpp index 787cf717eb..c92bfe57c3 100644 --- a/Marlin/src/lcd/e3v2/enhanced/dwin.cpp +++ b/Marlin/src/lcd/e3v2/enhanced/dwin.cpp @@ -170,6 +170,7 @@ select_t select_page{0}, select_file{0}, select_print{0}; uint8_t index_file = MROWS; bool dwin_abort_flag = false; // Flag to reset feedrate, return to Home +bool hash_changed = true; // Flag to know if message status was changed constexpr float default_max_feedrate[] = DEFAULT_MAX_FEEDRATE; constexpr float default_max_acceleration[] = DEFAULT_MAX_ACCELERATION; @@ -610,6 +611,86 @@ void Popup_window_PauseOrStop() { #endif +// Draw status line +void DWIN_DrawStatusLine(const uint16_t color, const uint16_t bgcolor, const char *text, const bool center = true) { + DWIN_Draw_Rectangle(1, bgcolor, 0, STATUS_Y, DWIN_WIDTH, STATUS_Y + 20); + if (text) { + if (center) DWINUI::Draw_CenteredString(color, STATUS_Y + 2, text); + else DWINUI::Draw_String(color, 0, STATUS_Y + 2, text); + } + DWIN_UpdateLCD(); +} +void DWIN_DrawStatusLine(const char *text, const bool center = true) { + DWIN_DrawStatusLine(HMI_data.StatusTxt_Color, HMI_data.StatusBg_Color, text, center); +} + +// Clear & reset status line +void DWIN_ResetStatusLine() { + ui.status_message[0] = 0; + DWIN_CheckStatusMessage(); +} + +// Djb2 hash algorithm +void DWIN_CheckStatusMessage() { + static uint32_t old_hash = 0; + char * str = &ui.status_message[0]; + uint32_t hash = 5381; + char c; + while ((c = *str++)) hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ + hash_changed = hash != old_hash; + old_hash = hash; +}; + +void DWIN_DrawStatusMessage() { + const uint8_t max_status_chars = DWIN_WIDTH / DWINUI::fontWidth(DWINUI::font); + + #if ENABLED(STATUS_MESSAGE_SCROLLING) + + // Get the UTF8 character count of the string + uint8_t slen = utf8_strlen(ui.status_message); + + // If the string fits the status line do not scroll it + if (slen <= max_status_chars) { + if (hash_changed) { + DWIN_DrawStatusLine(HMI_data.StatusTxt_Color, HMI_data.StatusBg_Color, ui.status_message); + hash_changed = false; + } + } + else { + // String is larger than the available line space + + // Get a pointer to the next valid UTF8 character + // and the string remaining length + uint8_t rlen; + const char *stat = MarlinUI::status_and_len(rlen); + DWIN_Draw_Rectangle(1, HMI_data.StatusBg_Color, 0, STATUS_Y, DWIN_WIDTH, STATUS_Y + 20); + DWINUI::MoveTo(0, STATUS_Y + 2); + DWINUI::Draw_String(stat, max_status_chars); + + // If the string doesn't completely fill the line... + if (rlen < max_status_chars) { + DWINUI::Draw_Char('.'); // Always at 1+ spaces left, draw a dot + uint8_t chars = max_status_chars - rlen; // Amount of space left in characters + if (--chars) { // Draw a second dot if there's space + DWINUI::Draw_Char('.'); + if (--chars) + DWINUI::Draw_String(ui.status_message, chars); // Print a second copy of the message + } + } + MarlinUI::advance_status_scroll(); + } + + #else + + if (hash_changed) { + ui.status_message[max_status_chars] = 0; + DWIN_DrawStatusLine(HMI_data.StatusTxt_Color, HMI_data.StatusBg_Color, ui.status_message); + hash_changed = false; + } + + #endif +} + void Draw_Print_Labels() { if (HMI_IsChinese()) { Title.FrameCopy(30, 1, 42, 14); // "Printing" @@ -713,7 +794,7 @@ void Draw_Main_Menu() { void Goto_Main_Menu() { checkkey = MainMenu; - DWIN_StatusChanged(); + ui.reset_status(true); Draw_Main_Menu(); } @@ -1077,6 +1158,7 @@ void Draw_Status_Area(const bool with_update) { void HMI_StartFrame(const bool with_update) { Goto_Main_Menu(); + DWIN_DrawStatusLine(nullptr); Draw_Status_Area(with_update); } @@ -1474,7 +1556,7 @@ void DWIN_Update() { } void EachMomentUpdate() { - static millis_t next_var_update_ms = 0, next_rts_update_ms = 0; + static millis_t next_var_update_ms = 0, next_rts_update_ms = 0, next_status_update_ms = 0; const millis_t ms = millis(); if (ELAPSED(ms, next_var_update_ms)) { @@ -1482,6 +1564,11 @@ void EachMomentUpdate() { update_variable(); } + if (ELAPSED(ms, next_status_update_ms)) { + next_status_update_ms = ms + 500; + DWIN_DrawStatusMessage(); + } + if (PENDING(ms, next_rts_update_ms)) return; next_rts_update_ms = ms + DWIN_SCROLL_UPDATE_INTERVAL; @@ -1745,7 +1832,7 @@ void Draw_Title(TitleClass* title) { void Draw_Menu(MenuClass* menu) { DWINUI::SetColors(HMI_data.Text_Color, HMI_data.Background_Color); DWIN_Draw_Rectangle(1, DWINUI::backcolor, 0, TITLE_HEIGHT, DWIN_WIDTH - 1, STATUS_Y - 1); - ui.set_status(""); + DWIN_ResetStatusLine(); } // Startup routines @@ -1758,23 +1845,6 @@ void DWIN_Startup() { HMI_SetLanguage(); } -void DWIN_DrawStatusLine(const uint16_t color, const uint16_t bgcolor, const char * const text/*=nullptr*/) { - DWIN_Draw_Rectangle(1, bgcolor, 0, STATUS_Y, DWIN_WIDTH, STATUS_Y + 20); - if (text) DWINUI::Draw_CenteredString(color, STATUS_Y + 2, text); - DWIN_UpdateLCD(); -} - -// Update Status line -void DWIN_StatusChanged(const char * const cstr/*=nullptr*/) { - DWIN_DrawStatusLine(HMI_data.StatusTxt_Color, HMI_data.StatusBg_Color, cstr); -} - -void DWIN_StatusChanged(FSTR_P const fstr) { - char str[strlen_P(FTOP(fstr)) + 1]; - strcpy_P(str, FTOP(fstr)); - DWIN_StatusChanged(str); -} - // Started a Print Job void DWIN_Print_Started(const bool sd) { sdprint = card.isPrinting() || sd; @@ -1866,7 +1936,6 @@ void DWIN_RebootScreen() { void DWIN_Redraw_screen() { Draw_Main_Area(); - DWIN_StatusChanged(ui.status_message); Draw_Status_Area(false); } diff --git a/Marlin/src/lcd/e3v2/enhanced/dwin.h b/Marlin/src/lcd/e3v2/enhanced/dwin.h index c2220c68a8..90b7ceacfa 100644 --- a/Marlin/src/lcd/e3v2/enhanced/dwin.h +++ b/Marlin/src/lcd/e3v2/enhanced/dwin.h @@ -174,9 +174,7 @@ void EachMomentUpdate(); void update_variable(); void DWIN_HandleScreen(); void DWIN_Update(); -void DWIN_DrawStatusLine(const uint16_t color, const uint16_t bgcolor, const char *text=nullptr); -void DWIN_StatusChanged(const char * const cstr=nullptr); -void DWIN_StatusChanged(FSTR_P const fstr); +void DWIN_CheckStatusMessage(); void DWIN_StartHoming(); void DWIN_CompletedHoming(); #if HAS_MESH diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 925e1c1618..57157d2c00 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -49,6 +49,7 @@ MarlinUI ui; #if ENABLED(DWIN_CREALITY_LCD) #include "e3v2/creality/dwin.h" #elif ENABLED(DWIN_CREALITY_LCD_ENHANCED) + #include "fontutils.h" #include "e3v2/enhanced/dwin.h" #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) #include "e3v2/jyersui/dwin.h" @@ -69,7 +70,7 @@ MarlinUI ui; constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; #if HAS_STATUS_MESSAGE - #if BOTH(HAS_WIRED_LCD, STATUS_MESSAGE_SCROLLING) + #if ENABLED(STATUS_MESSAGE_SCROLLING) && EITHER(HAS_WIRED_LCD, DWIN_CREALITY_LCD_ENHANCED) uint8_t MarlinUI::status_scroll_offset; // = 0 #endif char MarlinUI::status_message[MAX_MESSAGE_LENGTH + 1]; @@ -1481,11 +1482,9 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; void MarlinUI::finish_status(const bool persist) { - #if HAS_WIRED_LCD + UNUSED(persist); - #if !(BASIC_PROGRESS_BAR && (PROGRESS_MSG_EXPIRE) > 0) - UNUSED(persist); - #endif + #if HAS_WIRED_LCD #if BASIC_PROGRESS_BAR || BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT) const millis_t ms = millis(); @@ -1502,13 +1501,15 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; next_filament_display = ms + 5000UL; // Show status message for 5s #endif - TERN_(STATUS_MESSAGE_SCROLLING, status_scroll_offset = 0); - #else // HAS_WIRED_LCD - UNUSED(persist); + #endif + + #if ENABLED(STATUS_MESSAGE_SCROLLING) && EITHER(HAS_WIRED_LCD, DWIN_CREALITY_LCD_ENHANCED) + status_scroll_offset = 0; #endif TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged(status_message)); - TERN_(HAS_DWIN_E3V2_BASIC, DWIN_StatusChanged(status_message)); + TERN_(DWIN_CREALITY_LCD, DWIN_StatusChanged(status_message)); + TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_CheckStatusMessage()); TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWIN.Update_Status(status_message)); } diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index 4f797d899d..ed5b539eaf 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -356,6 +356,9 @@ public: #if EITHER(HAS_DISPLAY, DWIN_CREALITY_LCD_ENHANCED) static void kill_screen(FSTR_P const lcd_error, FSTR_P const lcd_component); + #if DISABLED(LIGHTWEIGHT_UI) + static void draw_status_message(const bool blink); + #endif #else static inline void kill_screen(FSTR_P const, FSTR_P const) {} #endif @@ -444,10 +447,6 @@ public: static inline void completion_feedback(const bool=true) { TERN_(HAS_TOUCH_SLEEP, wakeup_screen()); } #endif - #if DISABLED(LIGHTWEIGHT_UI) - static void draw_status_message(const bool blink); - #endif - #if ENABLED(ADVANCED_PAUSE_FEATURE) static void draw_hotend_status(const uint8_t row, const uint8_t extruder); #endif From 589a6d7f6bbf2254958aa92d8707c51fcbcd8dd3 Mon Sep 17 00:00:00 2001 From: Miguel Risco-Castillo Date: Wed, 10 Nov 2021 11:55:20 -0500 Subject: [PATCH 123/125] =?UTF-8?q?=F0=9F=9A=B8=20Fix=20up=20E3V2=20Enhanc?= =?UTF-8?q?ed=20(#23100)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/pause.cpp | 1 - Marlin/src/lcd/e3v2/enhanced/dwin.cpp | 106 ++++++++++---------- Marlin/src/lcd/e3v2/enhanced/dwin.h | 5 +- Marlin/src/lcd/e3v2/enhanced/dwin_lcd.cpp | 4 +- Marlin/src/lcd/e3v2/enhanced/dwin_lcd.h | 11 +- Marlin/src/lcd/e3v2/enhanced/dwinui.cpp | 18 ++-- Marlin/src/lcd/e3v2/enhanced/dwinui.h | 37 ++++--- Marlin/src/lcd/e3v2/enhanced/meshviewer.cpp | 41 ++++++-- Marlin/src/lcd/e3v2/enhanced/meshviewer.h | 4 +- Marlin/src/module/settings.cpp | 2 - Marlin/src/module/temperature.cpp | 3 +- 11 files changed, 128 insertions(+), 104 deletions(-) diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index d97ac2a0ac..191c0e4b08 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -254,7 +254,6 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE))); TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE), FPSTR(CONTINUE_STR))); - TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_Popup_Confirm(ICON_BLTouch, GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE), FPSTR(CONTINUE_STR))); wait_for_user = true; // A click or M108 breaks the purge_length loop for (float purge_count = purge_length; purge_count > 0 && wait_for_user; --purge_count) unscaled_e_move(1, ADVANCED_PAUSE_PURGE_FEEDRATE); diff --git a/Marlin/src/lcd/e3v2/enhanced/dwin.cpp b/Marlin/src/lcd/e3v2/enhanced/dwin.cpp index c92bfe57c3..d1a9ba7077 100644 --- a/Marlin/src/lcd/e3v2/enhanced/dwin.cpp +++ b/Marlin/src/lcd/e3v2/enhanced/dwin.cpp @@ -23,8 +23,8 @@ /** * DWIN UI Enhanced implementation * Author: Miguel A. Risco-Castillo - * Version: 3.6.3 - * Date: 2021/09/10 + * Version: 3.7.1 + * Date: 2021/11/09 */ #include "../../../inc/MarlinConfigPre.h" @@ -142,7 +142,7 @@ HMI_data_t HMI_data; millis_t dwin_heat_time = 0; -uint8_t checkkey = MainMenu, last_checkkey = MainMenu; +uint8_t checkkey = 255, last_checkkey = MainMenu; enum SelectItem : uint8_t { PAGE_PRINT = 0, @@ -387,15 +387,15 @@ void ICON_Stop() { ICON_Button(select_print.now == PRINT_STOP, ICON_Stop_0, ico, txt); } -void Draw_Menu_Cursor(const uint8_t line) { +void Draw_Menu_Cursor(const int8_t line) { DWIN_Draw_Rectangle(1, HMI_data.Cursor_color, 0, MBASE(line) - 18, 14, MBASE(line + 1) - 20); } -void Erase_Menu_Cursor(const uint8_t line) { +void Erase_Menu_Cursor(const int8_t line) { DWIN_Draw_Rectangle(1, HMI_data.Background_Color, 0, MBASE(line) - 18, 14, MBASE(line + 1) - 20); } -void Move_Highlight(const int16_t from, const uint16_t newline) { +void Move_Highlight(const int8_t from, const int8_t newline) { Erase_Menu_Cursor(newline - from); Draw_Menu_Cursor(newline); } @@ -578,6 +578,7 @@ void Popup_window_PauseOrStop() { DWINUI::Draw_Icon(ICON_Cancel_E, 146, 280); } Draw_Select_Highlight(true); + DWIN_UpdateLCD(); } #if HAS_HOTEND || HAS_HEATED_BED @@ -608,7 +609,6 @@ void Popup_window_PauseOrStop() { } } } - #endif // Draw status line @@ -752,6 +752,7 @@ void Draw_PrintProcess() { } void Goto_PrintProcess() { + if (checkkey == PrintProcess) return; checkkey = PrintProcess; Draw_PrintProcess(); } @@ -793,6 +794,7 @@ void Draw_Main_Menu() { } void Goto_Main_Menu() { + if (checkkey == MainMenu) return; checkkey = MainMenu; ui.reset_status(true); Draw_Main_Menu(); @@ -1239,10 +1241,10 @@ void HMI_MainMenu() { case PAGE_INFO_LEVELING: #if HAS_ONESTEP_LEVELING - queue.inject(F("G28XYO\nG28Z\nG29")); // TODO: 'G29' should be homing when needed. Does it make sense for every LCD to do this differently? + queue.inject(F("G28Z\nG29")); // Force to get the current Z home position #else - checkkey = Info; - Draw_Info_Menu(); + last_checkkey = MainMenu; + Goto_InfoMenu(); #endif break; } @@ -1327,7 +1329,7 @@ void HMI_SelectFile() { } } else if (encoder_diffState == ENCODER_DIFF_ENTER) { - if (select_file.now == 0) { + if (select_file.now == 0) { // Back select_page.set(PAGE_PRINT); Goto_Main_Menu(); } @@ -1523,7 +1525,6 @@ void Draw_Main_Area() { void HMI_ReturnScreen() { checkkey = last_checkkey; Draw_Main_Area(); - DWIN_UpdateLCD(); return; } @@ -2230,7 +2231,7 @@ void SetMoveZ() { HMI_value.axis = Z_AXIS; SetPFloatOnClick(Z_MIN_POS, Z_MAX_POS void SetMoveZto0() { char cmd[48] = ""; char str_1[5] = "", str_2[5] = ""; - sprintf_P(cmd, PSTR("G28OXY\nG28Z\nG0X%sY%sF5000\nG0Z0F300"), + sprintf_P(cmd, PSTR("G28Z\nG0X%sY%sF5000\nM420S0\nG0Z0F300"), #if ENABLED(MESH_BED_LEVELING) dtostrf(0, 1, 1, str_1), dtostrf(0, 1, 1, str_2) @@ -2413,7 +2414,7 @@ void LevBed(uint8_t point) { float xpos = 0, ypos = 0, zval = 0; float margin = PROBING_MARGIN; #else - #define fmt "M420 S0\nG28O\nG90\nG0 Z5 F300\nG0 X%i Y%i F5000\nG0 Z0 F300" + #define fmt "M420S0\nG28O\nG90\nG0Z5F300\nG0X%iY%iF5000\nG0Z0F300" int16_t xpos = 0, ypos = 0; int16_t margin = 30; #endif @@ -2469,7 +2470,7 @@ void LevBedC () { LevBed(4); } void ManualMeshStart(){ LCD_MESSAGE(MSG_UBL_BUILD_MESH_MENU); - gcode.process_subcommands_now(F("G28 XYO\nG28 Z\nM211 S0\nG29S1")); + gcode.process_subcommands_now(F("G28Z\nM211S0\nG29S1")); planner.synchronize(); #ifdef MANUAL_PROBE_START_Z const uint8_t line = CurrentMenu->line(MMeshMoveZItem->pos); @@ -2494,7 +2495,7 @@ void LevBedC () { LevBed(4); } void ManualMeshSave(){ LCD_MESSAGE(MSG_UBL_STORAGE_MESH_MENU); - queue.inject(F("M211 S1\nM500")); + queue.inject(F("M211S1\nM500")); } #endif // MESH_BED_LEVELING @@ -2810,7 +2811,7 @@ void onDrawSteps(MenuItemClass* menuitem, int8_t line) { #if ENABLED(MESH_BED_LEVELING) void onDrawMMeshMoveZ(MenuItemClass* menuitem, int8_t line) { if (HMI_IsChinese()) menuitem->SetFrame(1, 160, 118, 209, 132); - onDrawPFloatMenu(menuitem, line); + onDrawPFloat2Menu(menuitem, line); } #endif @@ -3096,11 +3097,11 @@ void HMI_SetIntNoDraw() { // Set an integer pointer variable using the encoder void HMI_SetPInt() { int8_t val = HMI_GetInt(HMI_value.MinValue, HMI_value.MaxValue); - if (!val) return; - else if (val == 2) { // Apply - *HMI_value.P_Int = HMI_value.Value; - if (HMI_value.Apply != nullptr) HMI_value.Apply(); - } else if (HMI_value.LiveUpdate != nullptr) HMI_value.LiveUpdate(); + switch (val) { + case 0: return; + case 1: if (HMI_value.LiveUpdate != nullptr) HMI_value.LiveUpdate(); break; + case 2: *HMI_value.P_Int = HMI_value.Value; if (HMI_value.Apply != nullptr) HMI_value.Apply(); break; + } } // Get a scaled float value using the encoder @@ -3140,17 +3141,16 @@ void HMI_SetFloat() { // Set a scaled float pointer variable using the encoder void HMI_SetPFloat() { const int8_t val = HMI_GetFloat(HMI_value.dp, HMI_value.MinValue, HMI_value.MaxValue); - if (!val) return; - if (val == 2) { // Apply - *HMI_value.P_Float = HMI_value.Value / POW(10, HMI_value.dp); - if (HMI_value.Apply != nullptr) HMI_value.Apply(); + switch (val) { + case 0: return; + case 1: if (HMI_value.LiveUpdate != nullptr) HMI_value.LiveUpdate(); break; + case 2: *HMI_value.P_Float = HMI_value.Value / POW(10, HMI_value.dp); if (HMI_value.Apply != nullptr) HMI_value.Apply(); break; } - else if (HMI_value.LiveUpdate != nullptr) HMI_value.LiveUpdate(); } // Menu Creation and Drawing functions ====================================================== -void SetMenuTitle(frame_rect_t cn, frame_rect_t en, const __FlashStringHelper* fstr) { +void SetMenuTitle(frame_rect_t cn, const __FlashStringHelper* fstr) { if (HMI_IsChinese() && (cn.w != 0)) CurrentMenu->MenuTitle.SetFrame(cn.x, cn.y, cn.w, cn.h); else @@ -3162,7 +3162,7 @@ void Draw_Prepare_Menu() { if (PrepareMenu == nullptr) PrepareMenu = new MenuClass(); if (CurrentMenu != PrepareMenu) { CurrentMenu = PrepareMenu; - SetMenuTitle({133, 1, 28, 13}, {179, 0, 48, 14}, GET_TEXT_F(MSG_PREPARE)); + SetMenuTitle({133, 1, 28, 13}, GET_TEXT_F(MSG_PREPARE)); DWINUI::MenuItemsPrepare(13); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Goto_Main_Menu); #if ENABLED(ADVANCED_PAUSE_FEATURE) @@ -3203,7 +3203,7 @@ void Draw_LevBedCorners_Menu() { if (LevBedMenu == nullptr) LevBedMenu = new MenuClass(); if (CurrentMenu != LevBedMenu) { CurrentMenu = LevBedMenu; - SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_BED_TRAMMING)); // TODO: Chinese, English "Bed Tramming" JPG + SetMenuTitle({0}, GET_TEXT_F(MSG_BED_TRAMMING)); // TODO: Chinese, English "Bed Tramming" JPG DWINUI::MenuItemsPrepare(6); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu); ADDMENUITEM(ICON_Axis, GET_TEXT_F(MSG_LEVBED_FL), onDrawMenuItem, LevBedFL); @@ -3220,7 +3220,7 @@ void Draw_Control_Menu() { if (ControlMenu == nullptr) ControlMenu = new MenuClass(); if (CurrentMenu != ControlMenu) { CurrentMenu = ControlMenu; - SetMenuTitle({103, 1, 28, 14}, {128, 2, 49, 11}, GET_TEXT_F(MSG_CONTROL)); + SetMenuTitle({103, 1, 28, 14}, GET_TEXT_F(MSG_CONTROL)); DWINUI::MenuItemsPrepare(9); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Goto_Main_Menu); ADDMENUITEM(ICON_Temperature, GET_TEXT_F(MSG_TEMPERATURE), onDrawTempSubMenu, Draw_Temperature_Menu); @@ -3242,8 +3242,8 @@ void Draw_AdvancedSettings_Menu() { if (AdvancedSettings == nullptr) AdvancedSettings = new MenuClass(); if (CurrentMenu != AdvancedSettings) { CurrentMenu = AdvancedSettings; - SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_ADVANCED_SETTINGS)); // TODO: Chinese, English "Advanced Settings" JPG - DWINUI::MenuItemsPrepare(11); + SetMenuTitle({0}, GET_TEXT_F(MSG_ADVANCED_SETTINGS)); // TODO: Chinese, English "Advanced Settings" JPG + DWINUI::MenuItemsPrepare(12); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Control_Menu); #if HAS_HOME_OFFSET ADDMENUITEM(ICON_HomeOffset, GET_TEXT_F(MSG_SET_HOME_OFFSETS), onDrawSubMenu, Draw_HomeOffset_Menu); @@ -3283,7 +3283,7 @@ void Draw_Move_Menu() { if (MoveMenu == nullptr) MoveMenu = new MenuClass(); if (CurrentMenu != MoveMenu) { CurrentMenu = MoveMenu; - SetMenuTitle({192, 1, 42, 14}, {231, 2, 35, 11}, GET_TEXT_F(MSG_MOVE_AXIS)); + SetMenuTitle({192, 1, 42, 14}, GET_TEXT_F(MSG_MOVE_AXIS)); DWINUI::MenuItemsPrepare(5); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu); ADDMENUITEM_P(ICON_MoveX, GET_TEXT_F(MSG_MOVE_X), onDrawMoveX, SetMoveX, ¤t_position.x); @@ -3303,7 +3303,7 @@ void Draw_Move_Menu() { if (HomeOffMenu == nullptr) HomeOffMenu = new MenuClass(); if (CurrentMenu != HomeOffMenu) { CurrentMenu = HomeOffMenu; - SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_SET_HOME_OFFSETS)); // TODO: Chinese, English "Set Home Offsets" JPG + SetMenuTitle({0}, GET_TEXT_F(MSG_SET_HOME_OFFSETS)); // TODO: Chinese, English "Set Home Offsets" JPG DWINUI::MenuItemsPrepare(4); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_AdvancedSettings_Menu); ADDMENUITEM_P(ICON_HomeOffsetX, GET_TEXT_F(MSG_HOME_OFFSET_X), onDrawPFloatMenu, SetHomeOffsetX, &home_offset[X_AXIS]); @@ -3320,7 +3320,7 @@ void Draw_Move_Menu() { if (ProbeSetMenu == nullptr) ProbeSetMenu = new MenuClass(); if (CurrentMenu != ProbeSetMenu) { CurrentMenu = ProbeSetMenu; - SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_ZPROBE_SETTINGS)); // TODO: Chinese, English "Probe Settings" JPG + SetMenuTitle({0}, GET_TEXT_F(MSG_ZPROBE_SETTINGS)); // TODO: Chinese, English "Probe Settings" JPG DWINUI::MenuItemsPrepare(5); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_AdvancedSettings_Menu); ADDMENUITEM_P(ICON_ProbeOffsetX, GET_TEXT_F(MSG_ZPROBE_XOFFSET), onDrawPFloatMenu, SetProbeOffsetX, &probe.offset.x); @@ -3364,7 +3364,7 @@ void Draw_SelectColors_Menu() { if (SelectColorMenu == nullptr) SelectColorMenu = new MenuClass(); if (CurrentMenu != SelectColorMenu) { CurrentMenu = SelectColorMenu; - SetMenuTitle({0}, {0}, F("Select Colors")); // TODO: Chinese, English "Select Color" JPG + SetMenuTitle({0}, F("Select Colors")); // TODO: Chinese, English "Select Color" JPG DWINUI::MenuItemsPrepare(20); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_AdvancedSettings_Menu); ADDMENUITEM(ICON_StockConfiguration, GET_TEXT_F(MSG_RESTORE_DEFAULTS), onDrawMenuItem, RestoreDefaultsColors); @@ -3395,7 +3395,7 @@ void Draw_GetColor_Menu() { if (GetColorMenu == nullptr) GetColorMenu = new MenuClass(); if (CurrentMenu != GetColorMenu) { CurrentMenu = GetColorMenu; - SetMenuTitle({0}, {0}, F("Get Color")); // TODO: Chinese, English "Get Color" JPG + SetMenuTitle({0}, F("Get Color")); // TODO: Chinese, English "Get Color" JPG DWINUI::MenuItemsPrepare(5); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, DWIN_ApplyColor); ADDMENUITEM(ICON_Cancel, GET_TEXT_F(MSG_BUTTON_CANCEL), onDrawMenuItem, Draw_SelectColors_Menu); @@ -3412,7 +3412,7 @@ void Draw_Tune_Menu() { if (TuneMenu == nullptr) TuneMenu = new MenuClass(); if (CurrentMenu != TuneMenu) { CurrentMenu = TuneMenu; - SetMenuTitle({73, 2, 28, 12}, {94, 2, 33, 11}, GET_TEXT_F(MSG_TUNE)); // TODO: Chinese, English "Tune" JPG + SetMenuTitle({73, 2, 28, 12}, GET_TEXT_F(MSG_TUNE)); // TODO: Chinese, English "Tune" JPG DWINUI::MenuItemsPrepare(10); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Goto_PrintProcess); ADDMENUITEM_P(ICON_Speed, GET_TEXT_F(MSG_SPEED), onDrawSpeedItem, SetSpeed, &feedrate_percentage); @@ -3445,7 +3445,7 @@ void Draw_Motion_Menu() { if (MotionMenu == nullptr) MotionMenu = new MenuClass(); if (CurrentMenu != MotionMenu) { CurrentMenu = MotionMenu; - SetMenuTitle({1, 16, 28, 13}, {144, 16, 46, 11}, GET_TEXT_F(MSG_MOTION)); // TODO: Chinese, English "Motion" JPG + SetMenuTitle({1, 16, 28, 13}, GET_TEXT_F(MSG_MOTION)); // TODO: Chinese, English "Motion" JPG DWINUI::MenuItemsPrepare(6); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Control_Menu); ADDMENUITEM(ICON_MaxSpeed, GET_TEXT_F(MSG_SPEED), onDrawSpeed, Draw_MaxSpeed_Menu); @@ -3465,7 +3465,7 @@ void Draw_Motion_Menu() { if (FilamentMenu == nullptr) FilamentMenu = new MenuClass(); if (CurrentMenu != FilamentMenu) { CurrentMenu = FilamentMenu; - SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_FILAMENT_MAN)); // TODO: Chinese, English "Filament Management" JPG + SetMenuTitle({0}, GET_TEXT_F(MSG_FILAMENT_MAN)); // TODO: Chinese, English "Filament Management" JPG DWINUI::MenuItemsPrepare(5); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu); ADDMENUITEM(ICON_Park, GET_TEXT_F(MSG_FILAMENT_PARK_ENABLED), onDrawMenuItem, ParkHead); @@ -3485,8 +3485,8 @@ void Draw_Motion_Menu() { if (ManualMesh == nullptr) ManualMesh = new MenuClass(); if (CurrentMenu != ManualMesh) { CurrentMenu = ManualMesh; - SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_MANUAL_MESH)); // TODO: Chinese, English "Manual Mesh Leveling" JPG - DWINUI::MenuItemsPrepare(5); + SetMenuTitle({0}, GET_TEXT_F(MSG_MANUAL_MESH)); // TODO: Chinese, English "Manual Mesh Leveling" JPG + DWINUI::MenuItemsPrepare(6); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu); ADDMENUITEM(ICON_ManualMesh, GET_TEXT_F(MSG_LEVEL_BED), onDrawMenuItem, ManualMeshStart); MMeshMoveZItem = ADDMENUITEM_P(ICON_Zoffset, GET_TEXT_F(MSG_MOVE_Z), onDrawMMeshMoveZ, SetMMeshMoveZ, ¤t_position.z); @@ -3500,11 +3500,11 @@ void Draw_Motion_Menu() { #if HAS_PREHEAT - void Draw_Preheat_Menu(frame_rect_t cn, frame_rect_t en, const __FlashStringHelper* fstr) { + void Draw_Preheat_Menu(frame_rect_t cn, const __FlashStringHelper* fstr) { checkkey = Menu; if (CurrentMenu != PreheatMenu) { CurrentMenu = PreheatMenu; - SetMenuTitle(cn, en, fstr); + SetMenuTitle(cn, fstr); DWINUI::MenuItemsPrepare(5); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Temperature_Menu); #if HAS_HOTEND @@ -3526,13 +3526,13 @@ void Draw_Motion_Menu() { void Draw_Preheat1_Menu() { HMI_value.Preheat = 0; if (PreheatMenu == nullptr) PreheatMenu = new MenuClass(); - Draw_Preheat_Menu({59, 16, 81, 14}, {56, 15, 85, 14}, F(PREHEAT_1_LABEL " Preheat Settings")); // TODO: English "PLA Settings" JPG + Draw_Preheat_Menu({59, 16, 81, 14}, F(PREHEAT_1_LABEL " Preheat Settings")); // TODO: English "PLA Settings" JPG } void Draw_Preheat2_Menu() { HMI_value.Preheat = 1; if (PreheatMenu == nullptr) PreheatMenu = new MenuClass(); - Draw_Preheat_Menu({142, 16, 82, 14}, {56, 15, 85, 14}, F(PREHEAT_2_LABEL " Preheat Settings")); // TODO: English "ABS Settings" JPG + Draw_Preheat_Menu({142, 16, 82, 14}, F(PREHEAT_2_LABEL " Preheat Settings")); // TODO: English "ABS Settings" JPG } #ifdef PREHEAT_3_LABEL @@ -3540,7 +3540,7 @@ void Draw_Motion_Menu() { HMI_value.Preheat = 2; if (PreheatMenu == nullptr) PreheatMenu = new MenuClass(); #define PREHEAT_3_TITLE PREHEAT_3_LABEL " Preheat Set." - Draw_Preheat_Menu({0}, {0}, F(PREHEAT_3_TITLE)); // TODO: Chinese, English "Custom Preheat Settings" JPG + Draw_Preheat_Menu({0}, F(PREHEAT_3_TITLE)); // TODO: Chinese, English "Custom Preheat Settings" JPG } #endif @@ -3551,7 +3551,7 @@ void Draw_Temperature_Menu() { if (TemperatureMenu == nullptr) TemperatureMenu = new MenuClass(); if (CurrentMenu != TemperatureMenu) { CurrentMenu = TemperatureMenu; - SetMenuTitle({236, 2, 28, 12}, {56, 15, 85, 14}, GET_TEXT_F(MSG_TEMPERATURE)); + SetMenuTitle({236, 2, 28, 12}, GET_TEXT_F(MSG_TEMPERATURE)); DWINUI::MenuItemsPrepare(7); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Control_Menu); #if HAS_HOTEND @@ -3579,7 +3579,7 @@ void Draw_MaxSpeed_Menu() { if (MaxSpeedMenu == nullptr) MaxSpeedMenu = new MenuClass(); if (CurrentMenu != MaxSpeedMenu) { CurrentMenu = MaxSpeedMenu; - SetMenuTitle({1, 16, 28, 13}, {144, 16, 46, 11}, GET_TEXT_F(MSG_MAXSPEED)); + SetMenuTitle({1, 16, 28, 13}, GET_TEXT_F(MSG_MAXSPEED)); DWINUI::MenuItemsPrepare(5); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Motion_Menu); ADDMENUITEM_P(ICON_MaxSpeedX, GET_TEXT_F(MSG_MAXSPEED_X), onDrawMaxSpeedX, SetMaxSpeedX, &planner.settings.max_feedrate_mm_s[X_AXIS]); @@ -3597,7 +3597,7 @@ void Draw_MaxAccel_Menu() { if (MaxAccelMenu == nullptr) MaxAccelMenu = new MenuClass(); if (CurrentMenu != MaxAccelMenu) { CurrentMenu = MaxAccelMenu; - SetMenuTitle({1, 16, 28, 13}, {144, 16, 46, 11}, GET_TEXT_F(MSG_ACCELERATION)); + SetMenuTitle({1, 16, 28, 13}, GET_TEXT_F(MSG_ACCELERATION)); DWINUI::MenuItemsPrepare(5); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Motion_Menu); ADDMENUITEM_P(ICON_MaxAccX, GET_TEXT_F(MSG_AMAX_A), onDrawMaxAccelX, SetMaxAccelX, &planner.settings.max_acceleration_mm_per_s2[X_AXIS]); @@ -3616,7 +3616,7 @@ void Draw_MaxAccel_Menu() { if (MaxJerkMenu == nullptr) MaxJerkMenu = new MenuClass(); if (CurrentMenu != MaxJerkMenu) { CurrentMenu = MaxJerkMenu; - SetMenuTitle({1, 16, 28, 13}, {144, 16, 46, 11}, GET_TEXT_F(MSG_JERK)); + SetMenuTitle({1, 16, 28, 13}, GET_TEXT_F(MSG_JERK)); DWINUI::MenuItemsPrepare(5); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Motion_Menu); ADDMENUITEM_P(ICON_MaxSpeedJerkX, GET_TEXT_F(MSG_VA_JERK), onDrawMaxJerkX, SetMaxJerkX, &planner.max_jerk[X_AXIS]); @@ -3635,7 +3635,7 @@ void Draw_Steps_Menu() { if (StepsMenu == nullptr) StepsMenu = new MenuClass(); if (CurrentMenu != StepsMenu) { CurrentMenu = StepsMenu; - SetMenuTitle({1, 16, 28, 13}, {144, 16, 46, 11}, GET_TEXT_F(MSG_STEPS_PER_MM)); + SetMenuTitle({1, 16, 28, 13}, GET_TEXT_F(MSG_STEPS_PER_MM)); DWINUI::MenuItemsPrepare(5); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Motion_Menu); ADDMENUITEM_P(ICON_StepX, GET_TEXT_F(MSG_A_STEPS), onDrawStepsX, SetStepsX, &planner.settings.axis_steps_per_mm[X_AXIS]); diff --git a/Marlin/src/lcd/e3v2/enhanced/dwin.h b/Marlin/src/lcd/e3v2/enhanced/dwin.h index 90b7ceacfa..05b81c1019 100644 --- a/Marlin/src/lcd/e3v2/enhanced/dwin.h +++ b/Marlin/src/lcd/e3v2/enhanced/dwin.h @@ -24,8 +24,8 @@ /** * DWIN UI Enhanced implementation * Author: Miguel A. Risco-Castillo - * Version: 3.6.3 - * Date: 2021/09/08 + * Version: 3.7.1 + * Date: 2021/11/09 */ #include "../../../inc/MarlinConfigPre.h" @@ -154,6 +154,7 @@ void HMI_SDCardUpdate(); // Other void Goto_PrintProcess(); void Goto_Main_Menu(); +void Goto_InfoMenu(); void Draw_Select_Highlight(const bool sel); void Draw_Status_Area(const bool with_update); // Status Area void Draw_Main_Area(); // Redraw main area; diff --git a/Marlin/src/lcd/e3v2/enhanced/dwin_lcd.cpp b/Marlin/src/lcd/e3v2/enhanced/dwin_lcd.cpp index 93477be0b8..681b318a15 100644 --- a/Marlin/src/lcd/e3v2/enhanced/dwin_lcd.cpp +++ b/Marlin/src/lcd/e3v2/enhanced/dwin_lcd.cpp @@ -23,8 +23,8 @@ /** * DWIN UI Enhanced implementation * Author: Miguel A. Risco-Castillo - * Version: 3.6.3 - * Date: 2021/09/08 + * Version: 3.7.1 + * Date: 2021/11/09 */ #include "../../../inc/MarlinConfigPre.h" diff --git a/Marlin/src/lcd/e3v2/enhanced/dwin_lcd.h b/Marlin/src/lcd/e3v2/enhanced/dwin_lcd.h index c49f23af45..43cb098b91 100644 --- a/Marlin/src/lcd/e3v2/enhanced/dwin_lcd.h +++ b/Marlin/src/lcd/e3v2/enhanced/dwin_lcd.h @@ -24,8 +24,8 @@ /** * DWIN UI Enhanced implementation * Author: Miguel A. Risco-Castillo - * Version: 3.6.3 - * Date: 2021/09/08 + * Version: 3.7.1 + * Date: 2021/11/09 */ #include "../common/dwin_api.h" @@ -48,13 +48,6 @@ inline void DWIN_Draw_QR(uint8_t QR_Pixel, uint16_t x, uint16_t y, FSTR_P title) // x/y: Screen paste point void DWIN_Frame_AreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y); -// Copy area from virtual display area to current screen -// cacheID: virtual area number -// xStart/yStart: Upper-left of virtual area -// xEnd/yEnd: Lower-right of virtual area -// x/y: Screen paste point -void DWIN_Frame_AreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y); - // Copy area from current virtual display area to current screen // xStart/yStart: Upper-left of virtual area // xEnd/yEnd: Lower-right of virtual area diff --git a/Marlin/src/lcd/e3v2/enhanced/dwinui.cpp b/Marlin/src/lcd/e3v2/enhanced/dwinui.cpp index 6c46eb31f1..824aca07f8 100644 --- a/Marlin/src/lcd/e3v2/enhanced/dwinui.cpp +++ b/Marlin/src/lcd/e3v2/enhanced/dwinui.cpp @@ -23,8 +23,8 @@ /** * DWIN UI Enhanced implementation * Author: Miguel A. Risco-Castillo - * Version: 3.6.3 - * Date: 2021/09/08 + * Version: 3.7.1 + * Date: 2021/11/09 */ #include "../../../inc/MarlinConfigPre.h" @@ -38,8 +38,8 @@ //#define DEBUG_OUT 1 #include "../../../core/debug_out.h" -uint8_t MenuItemTotal = 0; -uint8_t MenuItemCount = 0; +int8_t MenuItemTotal = 0; +int8_t MenuItemCount = 0; MenuItemClass** MenuItems = nullptr; MenuClass *CurrentMenu = nullptr; MenuClass *PreviousMenu = nullptr; @@ -50,8 +50,8 @@ uint16_t DWINUI::textcolor = Def_Text_Color; uint16_t DWINUI::backcolor = Def_Background_Color; uint8_t DWINUI::font = font8x16; -void (*DWINUI::onCursorErase)(uint8_t line)=nullptr; -void (*DWINUI::onCursorDraw)(uint8_t line)=nullptr; +void (*DWINUI::onCursorErase)(const int8_t line)=nullptr; +void (*DWINUI::onCursorDraw)(const int8_t line)=nullptr; void (*DWINUI::onTitleDraw)(TitleClass* title)=nullptr; void (*DWINUI::onMenuDraw)(MenuClass* menu)=nullptr; @@ -304,14 +304,14 @@ void DWINUI::ClearMenuArea() { void DWINUI::MenuItemsClear() { if (MenuItems == nullptr) return; - for (uint8_t i = 0; i < MenuItemCount; i++) delete MenuItems[i]; + for (int8_t i = 0; i < MenuItemCount; i++) delete MenuItems[i]; delete[] MenuItems; MenuItems = nullptr; MenuItemCount = 0; MenuItemTotal = 0; } -void DWINUI::MenuItemsPrepare(uint8_t totalitems) { +void DWINUI::MenuItemsPrepare(int8_t totalitems) { MenuItemsClear(); MenuItemTotal = totalitems; MenuItems = new MenuItemClass*[totalitems]; @@ -379,7 +379,7 @@ MenuClass::MenuClass() { void MenuClass::draw() { MenuTitle.draw(); if (DWINUI::onMenuDraw != nullptr) (*DWINUI::onMenuDraw)(this); - for (uint8_t i = 0; i < MenuItemCount; i++) + for (int8_t i = 0; i < MenuItemCount; i++) MenuItems[i]->draw(i - topline); if (DWINUI::onCursorDraw != nullptr) DWINUI::onCursorDraw(line()); DWIN_UpdateLCD(); diff --git a/Marlin/src/lcd/e3v2/enhanced/dwinui.h b/Marlin/src/lcd/e3v2/enhanced/dwinui.h index 8cbb66fdf0..078b3cc58b 100644 --- a/Marlin/src/lcd/e3v2/enhanced/dwinui.h +++ b/Marlin/src/lcd/e3v2/enhanced/dwinui.h @@ -24,11 +24,10 @@ /** * DWIN UI Enhanced implementation * Author: Miguel A. Risco-Castillo - * Version: 3.6.3 - * Date: 2021/09/08 + * Version: 3.7.1 + * Date: 2021/11/09 */ -#include "../../../core/types.h" #include "dwin_lcd.h" #include "../common/dwin_set.h" #include "../common/dwin_font.h" @@ -138,7 +137,7 @@ extern TitleClass Title; class MenuItemClass { protected: public: - uint8_t pos = 0; + int8_t pos = 0; uint8_t icon = 0; char caption[32] = ""; uint8_t frameid = 0; @@ -185,8 +184,8 @@ namespace DWINUI { extern uint16_t backcolor; extern uint8_t font; - extern void (*onCursorErase)(uint8_t line); - extern void (*onCursorDraw)(uint8_t line); + extern void (*onCursorErase)(const int8_t line); + extern void (*onCursorDraw)(const int8_t line); extern void (*onTitleDraw)(TitleClass* title); extern void (*onMenuDraw)(MenuClass* menu); @@ -342,6 +341,12 @@ namespace DWINUI { // rlimit: For draw less chars than string length use rlimit void Draw_String(const char * const string, uint16_t rlimit = 0xFFFF); void Draw_String(uint16_t color, const char * const string, uint16_t rlimit = 0xFFFF); + inline void Draw_String(FSTR_P string, uint16_t rlimit = 0xFFFF) { + Draw_String(FTOP(string), rlimit); + } + inline void Draw_String(uint16_t color, FSTR_P string, uint16_t rlimit = 0xFFFF) { + Draw_String(color, FTOP(string), rlimit); + } // Draw a string // size: Font size @@ -353,25 +358,25 @@ namespace DWINUI { DWIN_Draw_String(false, font, textcolor, backcolor, x, y, string); } inline void Draw_String(uint16_t x, uint16_t y, FSTR_P title) { - DWIN_Draw_String(false, font, textcolor, backcolor, x, y, (char *)title); + DWIN_Draw_String(false, font, textcolor, backcolor, x, y, FTOP(title)); } inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, const char * const string) { DWIN_Draw_String(false, font, color, backcolor, x, y, string); } inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, FSTR_P title) { - DWIN_Draw_String(false, font, color, backcolor, x, y, (char *)title); + DWIN_Draw_String(false, font, color, backcolor, x, y, title); } inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) { DWIN_Draw_String(true, font, color, bgcolor, x, y, string); } inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) { - DWIN_Draw_String(true, font, color, bgcolor, x, y, (char *)title); + DWIN_Draw_String(true, font, color, bgcolor, x, y, title); } inline void Draw_String(uint8_t size, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) { DWIN_Draw_String(true, size, color, bgcolor, x, y, string); } inline void Draw_String(uint8_t size, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) { - DWIN_Draw_String(true, size, color, bgcolor, x, y, (char *)title); + DWIN_Draw_String(true, size, color, bgcolor, x, y, title); } // Draw a centered string using DWIN_WIDTH @@ -382,8 +387,8 @@ namespace DWINUI { // y: Upper coordinate of the string // *string: The string void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, const char * const string); - inline void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, FSTR_P title) { - Draw_CenteredString(bShow, size, color, bColor, y, (char *)title); + inline void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, FSTR_P string) { + Draw_CenteredString(bShow, size, color, bColor, y, FTOP(string)); } inline void Draw_CenteredString(uint16_t color, uint16_t bcolor, uint16_t y, const char * const string) { Draw_CenteredString(true, font, color, bcolor, y, string); @@ -392,19 +397,19 @@ namespace DWINUI { Draw_CenteredString(false, size, color, backcolor, y, string); } inline void Draw_CenteredString(uint8_t size, uint16_t color, uint16_t y, FSTR_P title) { - Draw_CenteredString(false, size, color, backcolor, y, (char *)title); + Draw_CenteredString(false, size, color, backcolor, y, title); } inline void Draw_CenteredString(uint16_t color, uint16_t y, const char * const string) { Draw_CenteredString(false, font, color, backcolor, y, string); } inline void Draw_CenteredString(uint16_t color, uint16_t y, FSTR_P title) { - Draw_CenteredString(false, font, color, backcolor, y, (char *)title); + Draw_CenteredString(false, font, color, backcolor, y, title); } inline void Draw_CenteredString(uint16_t y, const char * const string) { Draw_CenteredString(false, font, textcolor, backcolor, y, string); } inline void Draw_CenteredString(uint16_t y, FSTR_P title) { - Draw_CenteredString(false, font, textcolor, backcolor, y, (char *)title); + Draw_CenteredString(false, font, textcolor, backcolor, y, title); } // Draw a circle @@ -477,7 +482,7 @@ namespace DWINUI { void MenuItemsClear(); // Prepare MenuItems array - void MenuItemsPrepare(uint8_t totalitems); + void MenuItemsPrepare(int8_t totalitems); // Add elements to the MenuItems array MenuItemClass* MenuItemsAdd(MenuItemClass* menuitem); diff --git a/Marlin/src/lcd/e3v2/enhanced/meshviewer.cpp b/Marlin/src/lcd/e3v2/enhanced/meshviewer.cpp index 8d6b5fa2c0..3824d63b2b 100644 --- a/Marlin/src/lcd/e3v2/enhanced/meshviewer.cpp +++ b/Marlin/src/lcd/e3v2/enhanced/meshviewer.cpp @@ -1,8 +1,8 @@ /** * DWIN Mesh Viewer * Author: Miguel A. Risco-Castillo - * version: 2.5 - * Date: 2021/09/27 + * version: 3.8.1 + * Date: 2021/11/06 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -35,13 +35,15 @@ MeshViewerClass MeshViewer; void MeshViewerClass::Draw() { - const int8_t mx = 30, my = 30; // Margins + const int8_t mx = 25, my = 25; // Margins const int16_t stx = (DWIN_WIDTH - 2 * mx) / (GRID_MAX_POINTS_X - 1), // Steps sty = (DWIN_WIDTH - 2 * my) / (GRID_MAX_POINTS_Y - 1); - int8_t zmesh[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y], maxz =-127, minz = 127; + const int8_t rmax = _MIN(mx - 2, stx / 2); + const int8_t rmin = 7; + int16_t zmesh[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y], maxz =-32000, minz = 32000; #define px(xp) (mx + (xp) * stx) #define py(yp) (30 + DWIN_WIDTH - my - (yp) * sty) - #define rm(z) ((((z) - minz) * 10 / _MAX(1, (maxz - minz))) + 10) + #define rm(z) ((z - minz) * (rmax - rmin) / _MAX(1, (maxz - minz)) + rmin) #define DrawMeshValue(xp, yp, zv) DWINUI::Draw_Signed_Float(font6x12, 1, 2, px(xp) - 12, py(yp) - 6, zv) #define DrawMeshHLine(yp) DWIN_Draw_HLine(HMI_data.SplitLine_Color, px(0), py(yp), DWIN_WIDTH - 2 * mx) #define DrawMeshVLine(xp) DWIN_Draw_VLine(HMI_data.SplitLine_Color, px(xp), py(GRID_MAX_POINTS_Y - 1), DWIN_WIDTH - 2 * my) @@ -61,8 +63,33 @@ void MeshViewerClass::Draw() { watchdog_refresh(); LOOP_L_N(x, GRID_MAX_POINTS_X) { uint16_t color = DWINUI::RainbowInt(zmesh[x][y], _MIN(-5, minz), _MAX(5, maxz)); - DWINUI::Draw_FillCircle(color, px(x), py(y), rm(zmesh[x][y])); - DrawMeshValue(x, y, Z_VALUES(x,y)); + uint8_t radius = rm(zmesh[x][y]); + DWINUI::Draw_FillCircle(color, px(x), py(y), radius); + if (GRID_MAX_POINTS_X < 9) + DWINUI::Draw_Signed_Float(font6x12, 1, 2, px(x) - 12, py(y) - 6, Z_VALUES(x,y)); + else { + char str_1[9]; + str_1[0] = 0; + switch (zmesh[x][y]) { + case -999 ... -100: + DWINUI::Draw_Signed_Float(font6x12, 1, 1, px(x) - 12, py(y) - 6, Z_VALUES(x,y)); + break; + case -99 ... -1: + sprintf_P(str_1, PSTR("-.%02i"), -zmesh[x][y]); + break; + case 0: + DWIN_Draw_String(false, font6x12, DWINUI::textcolor, DWINUI::backcolor, px(x) - 4, py(y) - 6, "0");; + break; + case 1 ... 99: + sprintf_P(str_1, PSTR(".%02i"), zmesh[x][y]); + break; + case 100 ... 999: + DWINUI::Draw_Signed_Float(font6x12, 1, 1, px(x) - 12, py(y) - 6, Z_VALUES(x,y)); + break; + } + if (str_1[0]) + DWIN_Draw_String(false, font6x12, DWINUI::textcolor, DWINUI::backcolor, px(x) - 12, py(y) - 6, str_1); + } } } char str_1[6], str_2[6] = ""; diff --git a/Marlin/src/lcd/e3v2/enhanced/meshviewer.h b/Marlin/src/lcd/e3v2/enhanced/meshviewer.h index 4f7a6ae1d2..0ba6ae2d7d 100644 --- a/Marlin/src/lcd/e3v2/enhanced/meshviewer.h +++ b/Marlin/src/lcd/e3v2/enhanced/meshviewer.h @@ -1,8 +1,8 @@ /** * DWIN Mesh Viewer * Author: Miguel A. Risco-Castillo - * version: 2.5 - * Date: 2021/09/27 + * Version: 3.8.1 + * Date: 2021/11/06 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index f4eba776b6..0cb29f29e0 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -3044,8 +3044,6 @@ void MarlinSettings::reset() { postprocess(); DEBUG_ECHO_MSG("Hardcoded Default Settings Loaded"); - - TERN_(EXTENSIBLE_UI, ExtUI::onFactoryReset()); } #if DISABLED(DISABLE_M503) diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index cef348c5f9..48941532c8 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -3731,8 +3731,9 @@ void Temperature::isr() { HMI_flag.heat_flag = 0; duration_t elapsed = print_job_timer.duration(); // print timer dwin_heat_time = elapsed.value; + #else + ui.reset_status(); #endif - ui.reset_status(); TERN_(PRINTER_EVENT_LEDS, printerEventLEDs.onHeatingDone()); return true; } From ecd4cdb2983e6eb0d2f6a112f1706b0e7c158ec2 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Thu, 11 Nov 2021 01:01:59 +0000 Subject: [PATCH 124/125] [cron] Bump distribution date (2021-11-11) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 0f2136cbdd..6d97693cd1 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-11-10" +//#define STRING_DISTRIBUTION_DATE "2021-11-11" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index e61948958d..3b5f97d1c4 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-11-10" + #define STRING_DISTRIBUTION_DATE "2021-11-11" #endif /** From 72de764488b96a28d44668e0f246fa86cbadcb0a Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Fri, 12 Nov 2021 01:02:28 +0000 Subject: [PATCH 125/125] [cron] Bump distribution date (2021-11-12) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 6d97693cd1..1643741f49 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-11-11" +//#define STRING_DISTRIBUTION_DATE "2021-11-12" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 3b5f97d1c4..badb7231e0 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-11-11" + #define STRING_DISTRIBUTION_DATE "2021-11-12" #endif /**