From f17394d67740e1f5591b3e0e23cc7313b218776d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 9 Nov 2020 18:53:19 -0600 Subject: [PATCH 1/6] Ability to disable M32 --- Marlin/src/gcode/gcode.cpp | 5 +- Marlin/src/gcode/gcode.h | 2 +- Marlin/src/gcode/sd/M32.cpp | 4 +- Marlin/src/inc/Conditionals_adv.h | 4 ++ Marlin/src/sd/cardreader.cpp | 82 +++++++++++++++++-------------- Marlin/src/sd/cardreader.h | 9 ++-- buildroot/tests/LPC1769-tests | 1 + platformio.ini | 2 + 8 files changed, 64 insertions(+), 45 deletions(-) diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index e2c70ad3ae..1d6bd94231 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -431,7 +431,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 28: M28(); break; // M28: Start SD write case 29: M29(); break; // M29: Stop SD write case 30: M30(); break; // M30 Delete File - case 32: M32(); break; // M32: Select file and start SD print + + #if HAS_MEDIA_SUBCALLS + case 32: M32(); break; // M32: Select file and start SD print + #endif #if ENABLED(LONG_FILENAME_HOST_SUPPORT) case 33: M33(); break; // M33: Get the long full path to a file or folder diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 34df51e517..5db8b08e08 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -541,7 +541,7 @@ private: static void M31(); #if ENABLED(SDSUPPORT) - static void M32(); + TERN_(HAS_MEDIA_SUBCALLS, static void M32()); TERN_(LONG_FILENAME_HOST_SUPPORT, static void M33()); #if BOTH(SDCARD_SORT_ALPHA, SDSORT_GCODE) static void M34(); diff --git a/Marlin/src/gcode/sd/M32.cpp b/Marlin/src/gcode/sd/M32.cpp index 55ec6ea497..ea893c9232 100644 --- a/Marlin/src/gcode/sd/M32.cpp +++ b/Marlin/src/gcode/sd/M32.cpp @@ -22,7 +22,7 @@ #include "../../inc/MarlinConfig.h" -#if ENABLED(SDSUPPORT) +#if HAS_MEDIA_SUBCALLS #include "../gcode.h" #include "../../sd/cardreader.h" @@ -56,4 +56,4 @@ void GcodeSuite::M32() { } } -#endif // SDSUPPORT +#endif // HAS_MEDIA_SUBCALLS diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index 2a898d6084..02513e3eaa 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -146,6 +146,10 @@ #define HAS_PRINT_PROGRESS 1 #endif +#if ENABLED(SDSUPPORT) && SD_PROCEDURE_DEPTH + #define HAS_MEDIA_SUBCALLS 1 +#endif + #if HAS_PRINT_PROGRESS && EITHER(PRINT_PROGRESS_SHOW_DECIMALS, SHOW_REMAINING_TIME) #define HAS_PRINT_PROGRESS_PERMYRIAD 1 #endif diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index 5a914050c4..d2713539b7 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -118,9 +118,11 @@ Sd2Card CardReader::sd2card; SdVolume CardReader::volume; SdFile CardReader::file; -uint8_t CardReader::file_subcall_ctr; -uint32_t CardReader::filespos[SD_PROCEDURE_DEPTH]; -char CardReader::proc_filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH]; +#if HAS_MEDIA_SUBCALLS + uint8_t CardReader::file_subcall_ctr; + uint32_t CardReader::filespos[SD_PROCEDURE_DEPTH]; + char CardReader::proc_filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH]; +#endif uint32_t CardReader::filesize, CardReader::sdpos; @@ -135,7 +137,8 @@ CardReader::CardReader() { #endif flag.sdprinting = flag.mounted = flag.saving = flag.logging = false; filesize = sdpos = 0; - file_subcall_ctr = 0; + + TERN_(HAS_MEDIA_SUBCALLS, file_subcall_ctr = 0); workDirDepth = 0; ZERO(workDirParents); @@ -540,34 +543,39 @@ void CardReader::openFileRead(char * const path, const uint8_t subcall_type/*=0* switch (subcall_type) { case 0: // Starting a new print. "Now fresh file: ..." announceOpen(2, path); - file_subcall_ctr = 0; + TERN_(HAS_MEDIA_SUBCALLS, file_subcall_ctr = 0); break; - case 1: // Starting a sub-procedure + #if HAS_MEDIA_SUBCALLS - // With no file is open it's a simple macro. "Now doing file: ..." - if (!isFileOpen()) { announceOpen(1, path); break; } + case 1: // Starting a sub-procedure - // Too deep? The firmware has to bail. - if (file_subcall_ctr > SD_PROCEDURE_DEPTH - 1) { - SERIAL_ERROR_MSG("Exceeded max SUBROUTINE depth:" STRINGIFY(SD_PROCEDURE_DEPTH)); - kill(GET_TEXT(MSG_KILL_SUBCALL_OVERFLOW)); - return; - } + // With no file is open it's a simple macro. "Now doing file: ..." + if (!isFileOpen()) { announceOpen(1, path); break; } - // Store current filename (based on workDirParents) and position - getAbsFilename(proc_filenames[file_subcall_ctr]); - filespos[file_subcall_ctr] = sdpos; + // Too deep? The firmware has to bail. + if (file_subcall_ctr > SD_PROCEDURE_DEPTH - 1) { + SERIAL_ERROR_MSG("Exceeded max SUBROUTINE depth:", int(SD_PROCEDURE_DEPTH)); + kill(GET_TEXT(MSG_KILL_SUBCALL_OVERFLOW)); + return; + } - // For sub-procedures say 'SUBROUTINE CALL target: "..." parent: "..." pos12345' - SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR("SUBROUTINE CALL target:\"", path, "\" parent:\"", proc_filenames[file_subcall_ctr], "\" pos", sdpos); - file_subcall_ctr++; - break; + // Store current filename (based on workDirParents) and position + getAbsFilename(proc_filenames[file_subcall_ctr]); - case 2: // Resuming previous file after sub-procedure - SERIAL_ECHO_MSG("END SUBROUTINE"); - break; + TERN_(HAS_MEDIA_SUBCALLS, filespos[file_subcall_ctr] = sdpos); + + // For sub-procedures say 'SUBROUTINE CALL target: "..." parent: "..." pos12345' + SERIAL_ECHO_START(); + SERIAL_ECHOLNPAIR("SUBROUTINE CALL target:\"", path, "\" parent:\"", proc_filenames[file_subcall_ctr], "\" pos", sdpos); + file_subcall_ctr++; + break; + + case 2: // Resuming previous file after sub-procedure + SERIAL_ECHO_MSG("END SUBROUTINE"); + break; + + #endif } endFilePrint(); @@ -603,7 +611,7 @@ void CardReader::openFileWrite(char * const path) { if (!isMounted()) return; announceOpen(2, path); - file_subcall_ctr = 0; + TERN_(HAS_MEDIA_SUBCALLS, file_subcall_ctr = 0); endFilePrint(); @@ -1158,17 +1166,19 @@ uint16_t CardReader::get_num_Files() { void CardReader::fileHasFinished() { planner.synchronize(); file.close(); - if (file_subcall_ctr > 0) { // Resume calling file after closing procedure - file_subcall_ctr--; - openFileRead(proc_filenames[file_subcall_ctr], 2); // 2 = Returning from sub-procedure - setIndex(filespos[file_subcall_ctr]); - startFileprint(); - } - else { - endFilePrint(TERN_(SD_RESORT, true)); - marlin_state = MF_SD_COMPLETE; - } + #if HAS_MEDIA_SUBCALLS + if (file_subcall_ctr > 0) { // Resume calling file after closing procedure + file_subcall_ctr--; + openFileRead(proc_filenames[file_subcall_ctr], 2); // 2 = Returning from sub-procedure + setIndex(filespos[file_subcall_ctr]); + startFileprint(); + return; + } + #endif + + endFilePrint(TERN_(SD_RESORT, true)); + marlin_state = MF_SD_COMPLETE; } #if ENABLED(AUTO_REPORT_SD_STATUS) diff --git a/Marlin/src/sd/cardreader.h b/Marlin/src/sd/cardreader.h index 33645b6531..c6fe37400c 100644 --- a/Marlin/src/sd/cardreader.h +++ b/Marlin/src/sd/cardreader.h @@ -249,12 +249,11 @@ private: // // Procedure calls to other files // - #ifndef SD_PROCEDURE_DEPTH - #define SD_PROCEDURE_DEPTH 1 + #if HAS_MEDIA_SUBCALLS + static uint8_t file_subcall_ctr; + static uint32_t filespos[SD_PROCEDURE_DEPTH]; + static char proc_filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH]; #endif - static uint8_t file_subcall_ctr; - static uint32_t filespos[SD_PROCEDURE_DEPTH]; - static char proc_filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH]; // // SD Auto Reporting diff --git a/buildroot/tests/LPC1769-tests b/buildroot/tests/LPC1769-tests index 4314b0d5ff..df66f0ab75 100755 --- a/buildroot/tests/LPC1769-tests +++ b/buildroot/tests/LPC1769-tests @@ -23,6 +23,7 @@ opt_enable VIKI2 SDSUPPORT ADAPTIVE_FAN_SLOWING NO_FAN_SLOWING_IN_PID_TUNING \ PRINTCOUNTER NOZZLE_PARK_FEATURE NOZZLE_CLEAN_FEATURE SLOW_PWM_HEATERS PIDTEMPBED EEPROM_SETTINGS INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT \ Z_SAFE_HOMING ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE \ LCD_INFO_MENU ARC_SUPPORT BEZIER_CURVE_SUPPORT EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES SDCARD_SORT_ALPHA EMERGENCY_PARSER +opt_disable SD_PROCEDURE_DEPTH opt_set GRID_MAX_POINTS_X 16 exec_test $1 $2 "Smoothieboard with many features" diff --git a/platformio.ini b/platformio.ini index af7ce47a50..15b8d4c23a 100644 --- a/platformio.ini +++ b/platformio.ini @@ -180,6 +180,7 @@ default_src_filter = + - - + - - - + - - - - @@ -370,6 +371,7 @@ Z_PROBE_SLED = src_filter=+ G38_PROBE_TARGET = src_filter=+ MAGNETIC_PARKING_EXTRUDER = src_filter=+ SDSUPPORT = src_filter=+ +HAS_MEDIA_SUBCALLS = src_filter=+ HAS_EXTRUDERS = src_filter=+ + AUTO_REPORT_TEMPERATURES = src_filter=+ INCH_MODE_SUPPORT = src_filter=+ From a70fdfaeba716eb38245cf629fbf20984d48ec91 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Tue, 10 Nov 2020 10:21:05 +0100 Subject: [PATCH 2/6] Fix 320x240 touch buttons Y (#20079) --- Marlin/src/lcd/touch/touch_buttons.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/lcd/touch/touch_buttons.h b/Marlin/src/lcd/touch/touch_buttons.h index bf05d2bae5..a79bb15be4 100644 --- a/Marlin/src/lcd/touch/touch_buttons.h +++ b/Marlin/src/lcd/touch/touch_buttons.h @@ -47,7 +47,7 @@ #define BUTTONC_X_LO BUTTONB_X_HI + BUTTON_SPACING #define BUTTONC_X_HI BUTTONC_X_LO + BUTTON_WIDTH - 1 -#define BUTTON_Y_HI (TFT_HEIGHT) - (BUTTON_SPACING / 2) +#define BUTTON_Y_HI (TFT_HEIGHT) - BUTTON_SPACING #define BUTTON_Y_LO BUTTON_Y_HI - BUTTON_HEIGHT class TouchButtons { From 6ce1eeb4ae65d1c5523cd81d806bd0450ddbe66a Mon Sep 17 00:00:00 2001 From: Gustavo Alvarez <462213+sl1pkn07@users.noreply.github.com> Date: Tue, 10 Nov 2020 10:22:08 +0100 Subject: [PATCH 3/6] Fix SKR E3 DIP pin CLCD_SPI_CS (#20078) --- Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h index c151b44bb7..c748dbbed3 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h @@ -264,7 +264,7 @@ #define BEEPER_PIN PB6 #define CLCD_MOD_RESET PA9 - #define CLCD_SPI_CS PA8 + #define CLCD_SPI_CS PB8 #endif // TOUCH_UI_FTDI_EVE && LCD_FYSETC_TFT81050 From 60aadd2a02db40d69aadcb9ecf629493b8cc8b36 Mon Sep 17 00:00:00 2001 From: qwewer0 <57561110+qwewer0@users.noreply.github.com> Date: Tue, 10 Nov 2020 10:26:45 +0100 Subject: [PATCH 4/6] Update issues/support link (#20077) Co-authored-by: Scott Lahteine --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f3c2afa874..f70b7c409a 100644 --- a/README.md +++ b/README.md @@ -109,7 +109,7 @@ Proposed patches should be submitted as a Pull Request against the ([bugfix-2.0. - This branch is for fixing bugs and integrating any new features for the duration of the Marlin 2.0.x life-cycle. - Follow the [Coding Standards](https://marlinfw.org/docs/development/coding_standards.html) to gain points with the maintainers. -- Please submit your questions and concerns to the [Issue Queue](https://github.com/MarlinFirmware/Marlin/issues). +- Please submit Feature Requests and Bug Reports to the [Issue Queue](https://github.com/MarlinFirmware/Marlin/issues/new/choose). Support resources are also listed there. ### [RepRap.org Wiki Page](https://reprap.org/wiki/Marlin) From 2abb674c878538557d7f38faaf3c6d3d182b1fe7 Mon Sep 17 00:00:00 2001 From: qwewer0 <57561110+qwewer0@users.noreply.github.com> Date: Tue, 10 Nov 2020 10:27:34 +0100 Subject: [PATCH 5/6] What if 8 was 9? (#20076) --- Marlin/src/MarlinCore.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index be3dcdd109..44abf722f2 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -509,7 +509,7 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) { kill(); } - // M18 / M94 : Handle steppers inactive time timeout + // M18 / M84 : Handle steppers inactive time timeout if (gcode.stepper_inactive_time) { static bool already_shutdown_steppers; // = false From 53e79224fc404361f6233c19466816270dd5cf1b Mon Sep 17 00:00:00 2001 From: Jason Smith Date: Tue, 10 Nov 2020 01:32:08 -0800 Subject: [PATCH 6/6] Fix Arduino DUE compilation (#20058) --- Marlin/src/HAL/STM32/MarlinSPI.cpp | 4 ++++ Marlin/src/feature/controllerfan.cpp | 2 ++ Marlin/src/feature/controllerfan.h | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Marlin/src/HAL/STM32/MarlinSPI.cpp b/Marlin/src/HAL/STM32/MarlinSPI.cpp index fd05b1aeb4..da11b88a60 100644 --- a/Marlin/src/HAL/STM32/MarlinSPI.cpp +++ b/Marlin/src/HAL/STM32/MarlinSPI.cpp @@ -20,6 +20,8 @@ * */ +#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) + #include "MarlinSPI.h" static void spi_init(spi_t *obj, uint32_t speed, spi_mode_e mode, uint8_t msb, uint32_t dataSize) { @@ -159,3 +161,5 @@ uint8_t MarlinSPI::dmaSend(const void * transmitBuf, uint16_t length, bool minc) HAL_DMA_DeInit(&_dmaTx); return 1; } + +#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC diff --git a/Marlin/src/feature/controllerfan.cpp b/Marlin/src/feature/controllerfan.cpp index fa5a86b019..0206467752 100644 --- a/Marlin/src/feature/controllerfan.cpp +++ b/Marlin/src/feature/controllerfan.cpp @@ -34,6 +34,8 @@ uint8_t ControllerFan::speed; #if ENABLED(CONTROLLER_FAN_EDITABLE) controllerFan_settings_t ControllerFan::settings; // {0} + #else + const controllerFan_settings_t &ControllerFan::settings = controllerFan_defaults; #endif void ControllerFan::setup() { diff --git a/Marlin/src/feature/controllerfan.h b/Marlin/src/feature/controllerfan.h index d1d39f21f3..55f2d5cfc7 100644 --- a/Marlin/src/feature/controllerfan.h +++ b/Marlin/src/feature/controllerfan.h @@ -58,7 +58,7 @@ class ControllerFan { #if ENABLED(CONTROLLER_FAN_EDITABLE) static controllerFan_settings_t settings; #else - static const controllerFan_settings_t constexpr &settings = controllerFan_defaults; + static const controllerFan_settings_t &settings; #endif static inline bool state() { return speed > 0; } static inline void init() { reset(); }