From 21674b28799d297f3499d87d8fd29cbfed780551 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Thu, 29 Oct 2020 00:16:59 +0000 Subject: [PATCH 01/17] [cron] Bump distribution date (2020-10-29) --- Marlin/src/inc/Version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index da221bed3bd6..b6660e88667e 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 "2020-10-28" + #define STRING_DISTRIBUTION_DATE "2020-10-29" #endif /** From 18a5000718478a51ebde8955d7707d2f9cabd362 Mon Sep 17 00:00:00 2001 From: Victor Oliveira Date: Thu, 29 Oct 2020 01:45:10 -0300 Subject: [PATCH 02/17] Permit spaces in dependencies g++ path (#19929) --- buildroot/share/PlatformIO/scripts/common-dependencies.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildroot/share/PlatformIO/scripts/common-dependencies.py b/buildroot/share/PlatformIO/scripts/common-dependencies.py index b9cefeab7cf7..f3bc2b9b0283 100644 --- a/buildroot/share/PlatformIO/scripts/common-dependencies.py +++ b/buildroot/share/PlatformIO/scripts/common-dependencies.py @@ -234,7 +234,7 @@ def load_marlin_features(): build_flags = env.ParseFlagsExtended(build_flags) cxx = search_compiler() - cmd = [cxx] + cmd = ['"' + cxx + '"'] # Build flags from board.json #if 'BOARD' in env: From 838220e4b371aad20356bf328605a6dd038cfcfe Mon Sep 17 00:00:00 2001 From: Victor Oliveira Date: Thu, 29 Oct 2020 01:47:12 -0300 Subject: [PATCH 03/17] Keep SPI active on LPC176x (#19932) --- Marlin/src/HAL/LPC1768/HAL_SPI.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Marlin/src/HAL/LPC1768/HAL_SPI.cpp b/Marlin/src/HAL/LPC1768/HAL_SPI.cpp index b3d2908ac93e..cb0d54c0036f 100644 --- a/Marlin/src/HAL/LPC1768/HAL_SPI.cpp +++ b/Marlin/src/HAL/LPC1768/HAL_SPI.cpp @@ -263,8 +263,9 @@ uint16_t SPIClass::transfer16(const uint16_t data) { } void SPIClass::end() { - // SSP_Cmd(_currentSetting->spi_d, DISABLE); // stop device or SSP_DeInit? - SSP_DeInit(_currentSetting->spi_d); + // Neither is needed for Marlin + //SSP_Cmd(_currentSetting->spi_d, DISABLE); + //SSP_DeInit(_currentSetting->spi_d); } void SPIClass::send(uint8_t data) { From 3f644b6275f8596a43cdaff2daa722308e8aa006 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 29 Oct 2020 00:14:55 -0500 Subject: [PATCH 04/17] Add a note about substitution chars --- Marlin/src/lcd/language/language_en.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 8bf4fa6b7ecb..42954d79e5b9 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -26,6 +26,13 @@ * * LCD Menu Messages * See also https://marlinfw.org/docs/development/lcd_language.html + * + * Substitutions are applied for the following characters when used + * in menu items that call lcd_put_u8str_ind_P with an index: + * + * = displays '0'....'10' for indexes 0 - 10 + * ~ displays '1'....'11' for indexes 0 - 10 + * * displays 'E1'...'E11' for indexes 0 - 10 (By default. Uses LCD_FIRST_TOOL) */ #define en 1234 From be0c9ff7058235c94256845795ca05c669f51973 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 29 Oct 2020 00:48:50 -0500 Subject: [PATCH 05/17] Fix comments, spacing --- Marlin/src/HAL/LINUX/pinsDebug.h | 12 ++++++------ Marlin/src/HAL/shared/backtrace/unwarm.cpp | 2 +- Marlin/src/HAL/shared/backtrace/unwarm.h | 2 +- Marlin/src/HAL/shared/backtrace/unwarm_arm.cpp | 2 +- Marlin/src/HAL/shared/backtrace/unwarm_thumb.cpp | 2 +- Marlin/src/HAL/shared/backtrace/unwarmbytab.h | 2 +- Marlin/src/HAL/shared/backtrace/unwarmmem.cpp | 2 +- Marlin/src/HAL/shared/backtrace/unwarmmem.h | 2 +- Marlin/src/HAL/shared/backtrace/unwinder.cpp | 2 +- Marlin/src/HAL/shared/backtrace/unwinder.h | 2 +- Marlin/src/HAL/shared/backtrace/unwmemaccess.cpp | 2 +- Marlin/src/HAL/shared/backtrace/unwmemaccess.h | 2 +- .../share/sublime/MarlinFirmware.sublime-project | 2 +- 13 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Marlin/src/HAL/LINUX/pinsDebug.h b/Marlin/src/HAL/LINUX/pinsDebug.h index a93ceddc61c3..8f8543ef5984 100644 --- a/Marlin/src/HAL/LINUX/pinsDebug.h +++ b/Marlin/src/HAL/LINUX/pinsDebug.h @@ -26,15 +26,15 @@ */ #define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS -#define pwm_details(pin) pin = pin // do nothing // print PWM details -#define pwm_status(pin) false //Print a pin's PWM status. Return true if it's currently a PWM pin. -#define IS_ANALOG(P) (DIGITAL_PIN_TO_ANALOG_PIN(P) >= 0 ? 1 : 0) +#define pwm_details(pin) NOOP // (do nothing) +#define pwm_status(pin) false // Print a pin's PWM status. Return true if it's currently a PWM pin. +#define IS_ANALOG(P) (DIGITAL_PIN_TO_ANALOG_PIN(P) >= 0 ? 1 : 0) #define digitalRead_mod(p) digitalRead(p) #define PRINT_PORT(p) -#define GET_ARRAY_PIN(p) pin_array[p].pin +#define GET_ARRAY_PIN(p) pin_array[p].pin #define PRINT_ARRAY_NAME(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0) -#define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0) -#define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin +#define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0) +#define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin // active ADC function/mode/code values for PINSEL registers constexpr int8_t ADC_pin_mode(pin_t pin) { diff --git a/Marlin/src/HAL/shared/backtrace/unwarm.cpp b/Marlin/src/HAL/shared/backtrace/unwarm.cpp index cdc9c06c615e..adbcca69cc58 100644 --- a/Marlin/src/HAL/shared/backtrace/unwarm.cpp +++ b/Marlin/src/HAL/shared/backtrace/unwarm.cpp @@ -7,7 +7,7 @@ * for free and use it as they wish, with or without modifications, and in * any context, commercially or otherwise. The only limitation is that I * don't guarantee that the software is fit for any purpose or accept any - * liability for it's use or misuse - this software is without warranty. + * liability for its use or misuse - this software is without warranty. *************************************************************************** * File Description: Utility functions and glue for ARM unwinding sub-modules. **************************************************************************/ diff --git a/Marlin/src/HAL/shared/backtrace/unwarm.h b/Marlin/src/HAL/shared/backtrace/unwarm.h index 3128e354cc72..86dc98c073e1 100644 --- a/Marlin/src/HAL/shared/backtrace/unwarm.h +++ b/Marlin/src/HAL/shared/backtrace/unwarm.h @@ -6,7 +6,7 @@ * for free and use it as they wish, with or without modifications, and in * any context, commerically or otherwise. The only limitation is that I * don't guarantee that the software is fit for any purpose or accept any - * liablity for it's use or misuse - this software is without warranty. + * liability for its use or misuse - this software is without warranty. *************************************************************************** * File Description: Internal interface between the ARM unwinding sub-modules. **************************************************************************/ diff --git a/Marlin/src/HAL/shared/backtrace/unwarm_arm.cpp b/Marlin/src/HAL/shared/backtrace/unwarm_arm.cpp index 0ec9bd56af7d..59734bfbfe1e 100644 --- a/Marlin/src/HAL/shared/backtrace/unwarm_arm.cpp +++ b/Marlin/src/HAL/shared/backtrace/unwarm_arm.cpp @@ -7,7 +7,7 @@ * for free and use it as they wish, with or without modifications, and in * any context, commercially or otherwise. The only limitation is that I * don't guarantee that the software is fit for any purpose or accept any - * liability for it's use or misuse - this software is without warranty. + * liability for its use or misuse - this software is without warranty. *************************************************************************** * File Description: Abstract interpreter for ARM mode. **************************************************************************/ diff --git a/Marlin/src/HAL/shared/backtrace/unwarm_thumb.cpp b/Marlin/src/HAL/shared/backtrace/unwarm_thumb.cpp index 26ca8b2604e9..be4abd090fa8 100644 --- a/Marlin/src/HAL/shared/backtrace/unwarm_thumb.cpp +++ b/Marlin/src/HAL/shared/backtrace/unwarm_thumb.cpp @@ -7,7 +7,7 @@ * for free and use it as they wish, with or without modifications, and in * any context, commercially or otherwise. The only limitation is that I * don't guarantee that the software is fit for any purpose or accept any - * liability for it's use or misuse - this software is without warranty. + * liability for its use or misuse - this software is without warranty. *************************************************************************** * File Description: Abstract interpretation for Thumb mode. **************************************************************************/ diff --git a/Marlin/src/HAL/shared/backtrace/unwarmbytab.h b/Marlin/src/HAL/shared/backtrace/unwarmbytab.h index 77a1c82dbddb..e2f80db2a5b8 100644 --- a/Marlin/src/HAL/shared/backtrace/unwarmbytab.h +++ b/Marlin/src/HAL/shared/backtrace/unwarmbytab.h @@ -7,7 +7,7 @@ * for free and use it as they wish, with or without modifications, and in * any context, commerically or otherwise. The only limitation is that I * don't guarantee that the software is fit for any purpose or accept any - * liablity for it's use or misuse - this software is without warranty. + * liability for its use or misuse - this software is without warranty. *************************************************************************** * File Description: Interface to the memory tracking sub-system. **************************************************************************/ diff --git a/Marlin/src/HAL/shared/backtrace/unwarmmem.cpp b/Marlin/src/HAL/shared/backtrace/unwarmmem.cpp index cf9ac414c4e0..a40d8540ec38 100644 --- a/Marlin/src/HAL/shared/backtrace/unwarmmem.cpp +++ b/Marlin/src/HAL/shared/backtrace/unwarmmem.cpp @@ -7,7 +7,7 @@ * for free and use it as they wish, with or without modifications, and in * any context, commerically or otherwise. The only limitation is that I * don't guarantee that the software is fit for any purpose or accept any - * liablity for it's use or misuse - this software is without warranty. + * liability for its use or misuse - this software is without warranty. *************************************************************************** * File Description: Implementation of the memory tracking sub-system. **************************************************************************/ diff --git a/Marlin/src/HAL/shared/backtrace/unwarmmem.h b/Marlin/src/HAL/shared/backtrace/unwarmmem.h index 588618b34f0a..1340bbdf0a25 100644 --- a/Marlin/src/HAL/shared/backtrace/unwarmmem.h +++ b/Marlin/src/HAL/shared/backtrace/unwarmmem.h @@ -7,7 +7,7 @@ * for free and use it as they wish, with or without modifications, and in * any context, commerically or otherwise. The only limitation is that I * don't guarantee that the software is fit for any purpose or accept any - * liablity for it's use or misuse - this software is without warranty. + * liability for its use or misuse - this software is without warranty. *************************************************************************** * File Description: Interface to the memory tracking sub-system. **************************************************************************/ diff --git a/Marlin/src/HAL/shared/backtrace/unwinder.cpp b/Marlin/src/HAL/shared/backtrace/unwinder.cpp index e63af1ed25a8..0f88e2a7f75b 100644 --- a/Marlin/src/HAL/shared/backtrace/unwinder.cpp +++ b/Marlin/src/HAL/shared/backtrace/unwinder.cpp @@ -7,7 +7,7 @@ * for free and use it as they wish, with or without modifications, and in * any context, commercially or otherwise. The only limitation is that I * don't guarantee that the software is fit for any purpose or accept any - * liability for it's use or misuse - this software is without warranty. + * liability for its use or misuse - this software is without warranty. *************************************************************************** * File Description: Implementation of the interface into the ARM unwinder. **************************************************************************/ diff --git a/Marlin/src/HAL/shared/backtrace/unwinder.h b/Marlin/src/HAL/shared/backtrace/unwinder.h index cae137951372..157808d540da 100644 --- a/Marlin/src/HAL/shared/backtrace/unwinder.h +++ b/Marlin/src/HAL/shared/backtrace/unwinder.h @@ -7,7 +7,7 @@ * for free and use it as they wish, with or without modifications, and in * any context, commerically or otherwise. The only limitation is that I * don't guarantee that the software is fit for any purpose or accept any - * liablity for it's use or misuse - this software is without warranty. + * liability for its use or misuse - this software is without warranty. **************************************************************************/ /** \file * Interface to the ARM stack unwinding module. diff --git a/Marlin/src/HAL/shared/backtrace/unwmemaccess.cpp b/Marlin/src/HAL/shared/backtrace/unwmemaccess.cpp index c93494d485c3..e74953064592 100644 --- a/Marlin/src/HAL/shared/backtrace/unwmemaccess.cpp +++ b/Marlin/src/HAL/shared/backtrace/unwmemaccess.cpp @@ -7,7 +7,7 @@ * for free and use it as they wish, with or without modifications, and in * any context, commercially or otherwise. The only limitation is that I * don't guarantee that the software is fit for any purpose or accept any - * liability for it's use or misuse - this software is without warranty. + * liability for its use or misuse - this software is without warranty. *************************************************************************** * File Description: Utility functions to access memory **************************************************************************/ diff --git a/Marlin/src/HAL/shared/backtrace/unwmemaccess.h b/Marlin/src/HAL/shared/backtrace/unwmemaccess.h index fe42bd9485e7..562ab3f05da9 100644 --- a/Marlin/src/HAL/shared/backtrace/unwmemaccess.h +++ b/Marlin/src/HAL/shared/backtrace/unwmemaccess.h @@ -7,7 +7,7 @@ * for free and use it as they wish, with or without modifications, and in * any context, commerically or otherwise. The only limitation is that I * don't guarantee that the software is fit for any purpose or accept any - * liablity for it's use or misuse - this software is without warranty. + * liability for its use or misuse - this software is without warranty. *************************************************************************** * File Description: Utility functions to access memory **************************************************************************/ diff --git a/buildroot/share/sublime/MarlinFirmware.sublime-project b/buildroot/share/sublime/MarlinFirmware.sublime-project index 9b5234f7a13c..1e9275f64623 100644 --- a/buildroot/share/sublime/MarlinFirmware.sublime-project +++ b/buildroot/share/sublime/MarlinFirmware.sublime-project @@ -11,7 +11,7 @@ ".vscode" ], "binary_file_patterns": - [ "*.psd", "*.png", "*.jpg", "*.jpeg", "*.bdf", "*.patch", "avrdude_5.*", "*.svg" ], + [ "*.psd", "*.png", "*.jpg", "*.jpeg", "*.bdf", "*.patch", "avrdude_5.*", "*.svg", "*.bin", "*.woff" ], "file_exclude_patterns": [ "Marlin/platformio.ini", From 7473241438f3c9b7c7e701d6d2e3128d31ba2058 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 29 Oct 2020 00:49:03 -0500 Subject: [PATCH 06/17] .bin and .woff are binary --- .gitattributes | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitattributes b/.gitattributes index 2588229e0544..83897cba6ed3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -17,3 +17,5 @@ *.png binary *.jpg binary *.fon binary +*.bin binary +*.woff binary From dca7c5d1adf642848b8ec9ccb140525f7faa2838 Mon Sep 17 00:00:00 2001 From: Victor Oliveira Date: Thu, 29 Oct 2020 02:52:50 -0300 Subject: [PATCH 07/17] Color UI for MKS SGen-L V2 (#19919) --- Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h | 52 +++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) 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 1a558075b60e..0719752399d8 100644 --- a/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h +++ b/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h @@ -251,7 +251,7 @@ * _____ _____ * (BEEPER) 1.31 | · · | 1.30 (BTN_ENC) (MISO) 0.8 | · · | 0.7 (SD_SCK) * (LCD_EN) 0.18 | · · | 0.16 (LCD_RS) (BTN_EN1) 3.25 | · · | 0.28 (SD_CS2) - * (LCD_D4) 0.15 | · ·| 0.17 (LCD_D5) (BTN_EN2) 3.26 | · ·| 0.9 (SD_MOSI) + * (LCD_D4) 0.15 | · · | 0.17 (LCD_D5) (BTN_EN2) 3.26 | · · | 0.9 (SD_MOSI) * (LCD_D6) 1.0 | · · | 1.22 (LCD_D7) (SD_DETECT) 0.27 | · · | RST * GND | · · | 5V GND | · · | NC * ----- ----- @@ -299,6 +299,56 @@ #define LCD_PINS_D7 P1_22 #define KILL_PIN -1 // NC + #elif HAS_SPI_TFT // Config for Classic UI (emulated DOGM) and Color UI + #define TFT_CS_PIN P1_00 + #define TFT_A0_PIN P1_22 + #define TFT_DC_PIN P1_22 + #define TFT_MISO_PIN P0_08 + #define TFT_BACKLIGHT_PIN P0_18 + #define TFT_RESET_PIN P0_16 + + #define LCD_USE_DMA_SPI + + #define TOUCH_INT_PIN P0_17 + #define TOUCH_CS_PIN P0_15 + #define TOUCH_BUTTONS_HW_SPI + #define TOUCH_BUTTONS_HW_SPI_DEVICE 2 + + // Disable any LCD related PINs config + #define LCD_PINS_ENABLE -1 + #define LCD_PINS_RS -1 + + // XPT2046 Touch Screen calibration + #if ENABLED(TFT_CLASSIC_UI) + #ifndef XPT2046_X_CALIBRATION + #define XPT2046_X_CALIBRATION -11386 + #endif + #ifndef XPT2046_Y_CALIBRATION + #define XPT2046_Y_CALIBRATION 8684 + #endif + #ifndef XPT2046_X_OFFSET + #define XPT2046_X_OFFSET 689 + #endif + #ifndef XPT2046_Y_OFFSET + #define XPT2046_Y_OFFSET -273 + #endif + #elif ENABLED(TFT_COLOR_UI) + #ifndef XPT2046_X_CALIBRATION + #define XPT2046_X_CALIBRATION -17089 + #endif + #ifndef XPT2046_Y_CALIBRATION + #define XPT2046_Y_CALIBRATION 11424 + #endif + #ifndef XPT2046_X_OFFSET + #define XPT2046_X_OFFSET 1044 + #endif + #ifndef XPT2046_Y_OFFSET + #define XPT2046_Y_OFFSET -365 + #endif + + #define TFT_BUFFER_SIZE 2400 + #endif + #else // !MKS_12864OLED_SSD1306 #define LCD_PINS_RS P0_16 From 54ec6a0ce2dd5f0a3eecf9d76040fc33cfb95b5d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 29 Oct 2020 01:14:02 -0500 Subject: [PATCH 08/17] Tweak code formatting --- Marlin/src/module/temperature.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 3468a4c1c5d3..d119a72a646e 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -1233,9 +1233,9 @@ void Temperature::manage_heater() { #ifndef MIN_COOLING_SLOPE_DEG_CHAMBER_VENT #define MIN_COOLING_SLOPE_DEG_CHAMBER_VENT 1.5 #endif - if( (temp_chamber.celsius - temp_chamber.target >= HIGH_EXCESS_HEAT_LIMIT) && !flag_chamber_excess_heat) { - // open vent after MIN_COOLING_SLOPE_TIME_CHAMBER_VENT seconds - // if the temperature did not drop at least MIN_COOLING_SLOPE_DEG_CHAMBER_VENT + if (!flag_chamber_excess_heat && temp_chamber.celsius - temp_chamber.target >= HIGH_EXCESS_HEAT_LIMIT) { + // Open vent after MIN_COOLING_SLOPE_TIME_CHAMBER_VENT seconds if the + // temperature didn't drop at least MIN_COOLING_SLOPE_DEG_CHAMBER_VENT if (next_cool_check_ms_2 == 0 || ELAPSED(ms, next_cool_check_ms_2)) { if (old_temp - temp_chamber.celsius < float(MIN_COOLING_SLOPE_DEG_CHAMBER_VENT)) flag_chamber_excess_heat = true; //the bed is heating the chamber too much next_cool_check_ms_2 = ms + 1000UL * MIN_COOLING_SLOPE_TIME_CHAMBER_VENT; From b6856dcb999b51077c89eb30c5ec102c507152c0 Mon Sep 17 00:00:00 2001 From: Marcio Teixeira Date: Wed, 28 Oct 2020 11:23:46 -0600 Subject: [PATCH 09/17] Improvement and fixes to FTDI touch UI - Fixed incorrect LCD text string - Fixed incorrect refresh of filament change screens - Allow host control via touch UI - Updates to leveling menu - Modified ExtUI::isPrinting() to check if the job timer is running - Added ExtUI method to check whether a host print is paused --- .../ftdi_eve_touch_ui/language/language_en.h | 2 +- .../screens/change_filament_screen.cpp | 1 + .../confirm_abort_print_dialog_box.cpp | 8 +- .../screens/leveling_menu.cpp | 73 +++++++++---------- .../lib/ftdi_eve_touch_ui/screens/screens.h | 3 + .../ftdi_eve_touch_ui/screens/tune_menu.cpp | 55 ++++++++++---- Marlin/src/lcd/extui/ui_api.cpp | 6 +- Marlin/src/lcd/extui/ui_api.h | 1 + 8 files changed, 90 insertions(+), 59 deletions(-) diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/language/language_en.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/language/language_en.h index cc96c8b9cda7..ce60ab5090dd 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/language/language_en.h +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/language/language_en.h @@ -119,7 +119,7 @@ namespace Language_en { PROGMEM Language_Str MSG_CAUTION = u8"Caution:"; PROGMEM Language_Str MSG_HOT = u8"Hot!"; PROGMEM Language_Str MSG_UNLOAD_FILAMENT = u8"Unload/Retract"; - PROGMEM Language_Str MSG_LOAD_FILAMENT = u8"Load/Extruder"; + PROGMEM Language_Str MSG_LOAD_FILAMENT = u8"Load/Extrude"; PROGMEM Language_Str MSG_MOMENTARY = u8"Momentary"; PROGMEM Language_Str MSG_CONTINUOUS = u8"Continuous"; PROGMEM Language_Str MSG_PLEASE_WAIT = u8"Please wait..."; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/change_filament_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/change_filament_screen.cpp index 589da9b21055..60394d06dfb5 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/change_filament_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/change_filament_screen.cpp @@ -84,6 +84,7 @@ void ChangeFilamentScreen::drawTempGradient(uint16_t x, uint16_t y, uint16_t w, } void ChangeFilamentScreen::onEntry() { + BaseScreen::onEntry(); screen_data.ChangeFilamentScreen.e_tag = ExtUI::getActiveTool() + 10; screen_data.ChangeFilamentScreen.t_tag = 0; screen_data.ChangeFilamentScreen.repeat_tag = 0; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_abort_print_dialog_box.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_abort_print_dialog_box.cpp index e23592a46e9f..eb3e2a3e01e7 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_abort_print_dialog_box.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_abort_print_dialog_box.cpp @@ -26,6 +26,8 @@ #include "screens.h" +#include "../../../../../feature/host_actions.h" + using namespace ExtUI; void ConfirmAbortPrintDialogBox::onRedraw(draw_mode_t) { @@ -37,7 +39,11 @@ bool ConfirmAbortPrintDialogBox::onTouchEnd(uint8_t tag) { switch (tag) { case 1: GOTO_PREVIOUS(); - stopPrint(); + if (ExtUI::isPrintingFromMedia()) + ExtUI::stopPrint(); + #ifdef ACTION_ON_CANCEL + else host_action_cancel(); + #endif return true; default: return DialogBoxBaseClass::onTouchEnd(tag); diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/leveling_menu.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/leveling_menu.cpp index 763403d28722..a91d48c0376c 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/leveling_menu.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/leveling_menu.cpp @@ -35,29 +35,27 @@ using namespace ExtUI; using namespace Theme; #ifdef TOUCH_UI_PORTRAIT - #define GRID_ROWS 10 + #define GRID_ROWS 9 #define GRID_COLS 2 #define TITLE_POS BTN_POS(1,1), BTN_SIZE(2,1) - #define LEVEL_BED_POS BTN_POS(1,2), BTN_SIZE(2,1) - #define LEVEL_AXIS_POS BTN_POS(1,3), BTN_SIZE(2,1) - #define Z_AUTO_ALIGN_POS BTN_POS(1,4), BTN_SIZE(2,1) - #define SHOW_MESH_POS BTN_POS(1,5), BTN_SIZE(2,1) - #define BLTOUCH_TITLE_POS BTN_POS(1,7), BTN_SIZE(2,1) - #define BLTOUCH_RESET_POS BTN_POS(1,8), BTN_SIZE(1,1) - #define BLTOUCH_TEST_POS BTN_POS(2,8), BTN_SIZE(1,1) - #define BACK_POS BTN_POS(1,10), BTN_SIZE(2,1) -#else - #define GRID_ROWS 8 - #define GRID_COLS 2 - #define TITLE_POS BTN_POS(1,1), BTN_SIZE(2,1) - #define LEVEL_BED_POS BTN_POS(1,2), BTN_SIZE(2,1) - #define LEVEL_AXIS_POS BTN_POS(1,3), BTN_SIZE(2,1) - #define Z_AUTO_ALIGN_POS BTN_POS(1,4), BTN_SIZE(2,1) - #define SHOW_MESH_POS BTN_POS(1,5), BTN_SIZE(2,1) + #define LEVEL_AXIS_POS BTN_POS(1,2), BTN_SIZE(2,1) + #define LEVEL_BED_POS BTN_POS(1,3), BTN_SIZE(2,1) + #define SHOW_MESH_POS BTN_POS(1,4), BTN_SIZE(2,1) #define BLTOUCH_TITLE_POS BTN_POS(1,6), BTN_SIZE(2,1) #define BLTOUCH_RESET_POS BTN_POS(1,7), BTN_SIZE(1,1) #define BLTOUCH_TEST_POS BTN_POS(2,7), BTN_SIZE(1,1) - #define BACK_POS BTN_POS(1,8), BTN_SIZE(2,1) + #define BACK_POS BTN_POS(1,9), BTN_SIZE(2,1) +#else + #define GRID_ROWS 7 + #define GRID_COLS 2 + #define TITLE_POS BTN_POS(1,1), BTN_SIZE(2,1) + #define LEVEL_AXIS_POS BTN_POS(1,2), BTN_SIZE(2,1) + #define LEVEL_BED_POS BTN_POS(1,3), BTN_SIZE(2,1) + #define SHOW_MESH_POS BTN_POS(1,4), BTN_SIZE(2,1) + #define BLTOUCH_TITLE_POS BTN_POS(1,5), BTN_SIZE(2,1) + #define BLTOUCH_RESET_POS BTN_POS(1,6), BTN_SIZE(1,1) + #define BLTOUCH_TEST_POS BTN_POS(2,6), BTN_SIZE(1,1) + #define BACK_POS BTN_POS(1,7), BTN_SIZE(2,1) #endif void LevelingMenu::onRedraw(draw_mode_t what) { @@ -73,21 +71,16 @@ void LevelingMenu::onRedraw(draw_mode_t what) { cmd.font(font_large) .text(TITLE_POS, GET_TEXT_F(MSG_LEVELING)) .font(font_medium).colors(normal_btn) - .tag(2).button(LEVEL_BED_POS, GET_TEXT_F(MSG_LEVEL_BED)) - .enabled( - #ifdef AXIS_LEVELING_COMMANDS - 1 - #endif - ) - .tag(3).button(LEVEL_AXIS_POS, GET_TEXT_F(MSG_AUTOLEVEL_X_AXIS)) - .enabled(ENABLED(Z_STEPPER_AUTO_ALIGN)) - .tag(4).button(Z_AUTO_ALIGN_POS, GET_TEXT_F(MSG_AUTO_Z_ALIGN)) + #if EITHER(Z_STEPPER_AUTO_ALIGN,MECHANICAL_GANTRY_CALIBRATION) + .tag(2).button(LEVEL_AXIS_POS, GET_TEXT_F(MSG_AUTOLEVEL_X_AXIS)) + #endif + .tag(3).button(LEVEL_BED_POS, GET_TEXT_F(MSG_LEVEL_BED)) .enabled(ENABLED(HAS_MESH)) - .tag(5).button(SHOW_MESH_POS, GET_TEXT_F(MSG_SHOW_MESH)); + .tag(4).button(SHOW_MESH_POS, GET_TEXT_F(MSG_SHOW_MESH)); #if ENABLED(BLTOUCH) cmd.text(BLTOUCH_TITLE_POS, GET_TEXT_F(MSG_BLTOUCH)) - .tag(6).button(BLTOUCH_RESET_POS, GET_TEXT_F(MSG_BLTOUCH_RESET)) - .tag(7).button(BLTOUCH_TEST_POS, GET_TEXT_F(MSG_BLTOUCH_SELFTEST)); + .tag(5).button(BLTOUCH_RESET_POS, GET_TEXT_F(MSG_BLTOUCH_RESET)) + .tag(6).button(BLTOUCH_TEST_POS, GET_TEXT_F(MSG_BLTOUCH_SELFTEST)); #endif cmd.colors(action_btn) .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BACK)); @@ -97,25 +90,25 @@ void LevelingMenu::onRedraw(draw_mode_t what) { bool LevelingMenu::onTouchEnd(uint8_t tag) { switch (tag) { case 1: GOTO_PREVIOUS(); break; - case 2: + #if EITHER(Z_STEPPER_AUTO_ALIGN,MECHANICAL_GANTRY_CALIBRATION) + case 2: SpinnerDialogBox::enqueueAndWait_P(F("G34")); break; + #endif + case 3: + #ifndef BED_LEVELING_COMMANDS + #define BED_LEVELING_COMMANDS "G29" + #endif #if HAS_MESH BedMeshScreen::startMeshProbe(); #else SpinnerDialogBox::enqueueAndWait_P(F(BED_LEVELING_COMMANDS)); #endif break; - #ifdef AXIS_LEVELING_COMMANDS - case 3: SpinnerDialogBox::enqueueAndWait_P(F(AXIS_LEVELING_COMMANDS)); break; - #endif - #if ENABLED(Z_STEPPER_AUTO_ALIGN) - case 4: SpinnerDialogBox::enqueueAndWait_P(F("G34")); break; - #endif #if HAS_MESH - case 5: GOTO_SCREEN(BedMeshScreen); break; + case 4: GOTO_SCREEN(BedMeshScreen); break; #endif #if ENABLED(BLTOUCH) - case 6: injectCommands_P(PSTR("M280 P0 S60")); break; - case 7: SpinnerDialogBox::enqueueAndWait_P(F("M280 P0 S90\nG4 P100\nM280 P0 S120")); break; + case 5: injectCommands_P(PSTR("M280 P0 S60")); break; + case 6: SpinnerDialogBox::enqueueAndWait_P(F("M280 P0 S90\nG4 P100\nM280 P0 S120")); break; #endif default: return false; } diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.h index 2108cff8df2a..71fc7d9ee30d 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.h +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.h @@ -365,6 +365,9 @@ class MainMenu : public BaseScreen, public CachedScreen { }; class TuneMenu : public BaseScreen, public CachedScreen { + private: + static void pausePrint(); + static void resumePrint(); public: static void onRedraw(draw_mode_t); static bool onTouchEnd(uint8_t tag); diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/tune_menu.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/tune_menu.cpp index 9fe2f1e9cbcb..258ee4b04fb0 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/tune_menu.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/tune_menu.cpp @@ -26,6 +26,8 @@ #include "screens.h" +#include "../../../../../feature/host_actions.h" + using namespace FTDI; using namespace Theme; @@ -63,23 +65,24 @@ void TuneMenu::onRedraw(draw_mode_t what) { #endif if (what & FOREGROUND) { - using namespace ExtUI; + const bool sdOrHostPrinting = ExtUI::isPrinting(); + const bool sdOrHostPaused = ExtUI::isPrintingPaused(); CommandProcessor cmd; cmd.colors(normal_btn) .font(font_medium) .tag(2).button( TEMPERATURE_POS, GET_TEXT_F(MSG_TEMPERATURE)) - .enabled(!isPrinting() || isPrintingFromMediaPaused()) + .enabled(!sdOrHostPrinting || sdOrHostPaused) .tag(3).button( FIL_CHANGE_POS, GET_TEXT_F(MSG_FILAMENTCHANGE)) .enabled(EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR)) .tag(9).button( FILAMENT_POS, GET_TEXT_F(MSG_FILAMENT)) .enabled(EITHER(HAS_BED_PROBE, BABYSTEPPING)) .tag(4).button( NUDGE_NOZ_POS, GET_TEXT_F(TERN(BABYSTEPPING, MSG_NUDGE_NOZZLE, MSG_ZPROBE_ZOFFSET))) .tag(5).button( SPEED_POS, GET_TEXT_F(MSG_PRINT_SPEED)) - .tag(isPrintingFromMediaPaused() ? 7 : 6) - .enabled(TERN0(SDSUPPORT, isPrintingFromMedia())) - .button( PAUSE_POS, isPrintingFromMediaPaused() ? GET_TEXT_F(MSG_RESUME_PRINT) : GET_TEXT_F(MSG_PAUSE_PRINT)) - .enabled(TERN0(SDSUPPORT, isPrintingFromMedia())) + .enabled(sdOrHostPrinting) + .tag(sdOrHostPaused ? 7 : 6) + .button( PAUSE_POS, sdOrHostPaused ? GET_TEXT_F(MSG_RESUME_PRINT) : GET_TEXT_F(MSG_PAUSE_PRINT)) + .enabled(sdOrHostPrinting) .tag(8).button( STOP_POS, GET_TEXT_F(MSG_STOP_PRINT)) .enabled(ENABLED(CASE_LIGHT_ENABLE)) .tag(10).button( CASE_LIGHT_POS, GET_TEXT_F(MSG_CASE_LIGHT)) @@ -94,26 +97,26 @@ bool TuneMenu::onTouchEnd(uint8_t tag) { using namespace Theme; using namespace ExtUI; switch (tag) { - case 1: GOTO_PREVIOUS(); break; - case 2: GOTO_SCREEN(TemperatureScreen); break; - case 3: GOTO_SCREEN(ChangeFilamentScreen); break; - case 4: + case 1: GOTO_PREVIOUS(); break; + case 2: GOTO_SCREEN(TemperatureScreen); break; + case 3: GOTO_SCREEN(ChangeFilamentScreen); break; + case 4: #if ENABLED(BABYSTEPPING) GOTO_SCREEN(NudgeNozzleScreen); #elif HAS_BED_PROBE GOTO_SCREEN(ZOffsetScreen); #endif break; - case 5: GOTO_SCREEN(FeedratePercentScreen); break; - case 6: sound.play(twinkle, PLAY_ASYNCHRONOUS); ExtUI::pausePrint(); GOTO_SCREEN(StatusScreen); break; - case 7: sound.play(twinkle, PLAY_ASYNCHRONOUS); ExtUI::resumePrint(); GOTO_SCREEN(StatusScreen); break; - case 8: + case 5: GOTO_SCREEN(FeedratePercentScreen); break; + case 6: pausePrint(); break; + case 7: resumePrint(); break; + case 8: GOTO_SCREEN(ConfirmAbortPrintDialogBox); current_screen.forget(); PUSH_SCREEN(StatusScreen); break; #if EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR) - case 9: GOTO_SCREEN(FilamentMenu); break; + case 9: GOTO_SCREEN(FilamentMenu); break; #endif #if ENABLED(CASE_LIGHT_ENABLE) case 10: GOTO_SCREEN(CaseLightScreen); break; @@ -124,4 +127,24 @@ bool TuneMenu::onTouchEnd(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE +void TuneMenu::pausePrint() { + sound.play(twinkle, PLAY_ASYNCHRONOUS); + if (ExtUI::isPrintingFromMedia()) + ExtUI::pausePrint(); + #ifdef ACTION_ON_PAUSE + else host_action_pause(); + #endif + GOTO_SCREEN(StatusScreen); +} + +void TuneMenu::resumePrint() { + sound.play(twinkle, PLAY_ASYNCHRONOUS); + if (ExtUI::isPrintingFromMedia()) + ExtUI::resumePrint(); + #ifdef ACTION_ON_RESUME + else host_action_resume(); + #endif + GOTO_SCREEN(StatusScreen); +} + +#endif // TOUCH_UI_FTDI_EVE && !TOUCH_UI_LULZBOT_BIO diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index 33b5d5458eda..80033e911ba3 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -972,7 +972,11 @@ namespace ExtUI { } bool isPrinting() { - return (commandsInQueue() || isPrintingFromMedia() || IFSD(IS_SD_PRINTING(), false)); + return (commandsInQueue() || isPrintingFromMedia() || IFSD(IS_SD_PRINTING(), false)) || print_job_timer.isRunning() || print_job_timer.isPaused(); + } + + bool isPrintingPaused() { + return isPrinting() && (isPrintingFromMediaPaused() || print_job_timer.isPaused()); } bool isMediaInserted() { diff --git a/Marlin/src/lcd/extui/ui_api.h b/Marlin/src/lcd/extui/ui_api.h index 15122ec69e15..48d0e9722060 100644 --- a/Marlin/src/lcd/extui/ui_api.h +++ b/Marlin/src/lcd/extui/ui_api.h @@ -302,6 +302,7 @@ namespace ExtUI { bool isPrintingFromMediaPaused(); bool isPrintingFromMedia(); bool isPrinting(); + bool isPrintingPaused(); void printFile(const char *filename); void stopPrint(); From 50ba20fe1f27cdcb0f0f98f11cb42248dbc186f7 Mon Sep 17 00:00:00 2001 From: Victor Oliveira Date: Thu, 29 Oct 2020 04:01:25 -0300 Subject: [PATCH 10/17] PIO env for MKS Nano boards in STM32 (#19905) --- .../src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h | 2 +- platformio.ini | 32 ++++++++++++++++--- 2 files changed, 28 insertions(+), 6 deletions(-) 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 b1e49f4d9fd2..fbd12fb59ca1 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h @@ -25,7 +25,7 @@ * MKS Robin nano (STM32F130VET6) board pin assignments */ -#if NOT_TARGET(__STM32F1__) +#if NOT_TARGET(__STM32F1__, STM32F1) #error "Oops! Select an STM32F1 board in 'Tools > Board.'" #elif HOTENDS > 2 || E_STEPPERS > 2 #error "MKS Robin nano supports up to 2 hotends / E-steppers. Comment out this line to continue." diff --git a/platformio.ini b/platformio.ini index 3e565e6c4eba..b052a26b5878 100644 --- a/platformio.ini +++ b/platformio.ini @@ -1310,17 +1310,39 @@ build_flags = ${lerdge_common.build_flags} # RUMBA32 # [env:rumba32] -platform = ${common_stm32.platform} -extends = common_stm32 -build_flags = ${common_stm32.build_flags} +platform = ${common_stm32.platform} +extends = common_stm32 +build_flags = ${common_stm32.build_flags} -Os -DHAL_PCD_MODULE_ENABLED -DDISABLE_GENERIC_SERIALUSB -DHAL_UART_MODULE_ENABLED -DTIMER_SERIAL=TIM9 -board = rumba32_f446ve +board = rumba32_f446ve upload_protocol = dfu -monitor_speed = 500000 +monitor_speed = 500000 + +# +# MKS Robin Nano V1.2 and V2 using hal STM32 +# +[env:mks_robin_nano35_stm32] +platform = ${common_stm32.platform} +extends = common_stm32 +build_flags = ${common_stm32.build_flags} -DMCU_STM32F103VE -DSS_TIMER=4 -DENABLE_HWSERIAL3 -DTRANSFER_CLOCK_DIV=8 +board = genericSTM32F103VE +board_build.core = stm32 +board_build.variant = MARLIN_F103Vx +board_build.ldscript = ldscript.ld +board_build.offset = 0x7000 +board_build.firmware = Robin_nano35.bin +board_upload.offset_address = 0x08007000 +build_unflags = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC +debug_tool = jlink +upload_protocol = jlink +extra_scripts = ${common.extra_scripts} + pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py + buildroot/share/PlatformIO/scripts/stm32_bootloader.py + buildroot/share/PlatformIO/scripts/mks_encrypt.py ################################# # # From 1247f7375402809034843088617d30fb79985cee Mon Sep 17 00:00:00 2001 From: Giuliano Zaro <3684609+GMagician@users.noreply.github.com> Date: Thu, 29 Oct 2020 22:27:01 +0100 Subject: [PATCH 11/17] Update Italian language (#19953) --- Marlin/src/lcd/language/language_it.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index 38fffcb73b8c..73639c27900b 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -26,6 +26,13 @@ * * LCD Menu Messages * See also https://marlinfw.org/docs/development/lcd_language.html + * + * Substitutions are applied for the following characters when used + * in menu items that call lcd_put_u8str_ind_P with an index: + * + * = displays '0'....'10' for indexes 0 - 10 + * ~ displays '1'....'11' for indexes 0 - 10 + * * displays 'E1'...'E11' for indexes 0 - 10 (By default. Uses LCD_FIRST_TOOL) */ #define DISPLAY_CHARSET_ISO10646_1 @@ -65,6 +72,9 @@ namespace Language_it { PROGMEM Language_Str MSG_AUTO_HOME_Z = _UxGT("Home asse Z"); PROGMEM Language_Str MSG_AUTO_Z_ALIGN = _UxGT("Allineam.automat. Z"); PROGMEM Language_Str MSG_ASSISTED_TRAMMING = _UxGT("Tramming assistito"); + PROGMEM Language_Str MSG_ITERATION = _UxGT("Iterazione G34: %i"); + PROGMEM Language_Str MSG_DECREASING_ACCURACY = _UxGT("Precis.in calo!"); + PROGMEM Language_Str MSG_ACCURACY_ACHIEVED = _UxGT("Precis.raggiunta"); PROGMEM Language_Str MSG_LEVEL_BED_HOMING = _UxGT("Home assi XYZ"); PROGMEM Language_Str MSG_LEVEL_BED_WAITING = _UxGT("Premi per iniziare"); PROGMEM Language_Str MSG_LEVEL_BED_NEXT_POINT = _UxGT("Punto successivo"); @@ -652,4 +662,5 @@ namespace Language_it { PROGMEM Language_Str MSG_REHEATING = _UxGT("Riscaldando..."); PROGMEM Language_Str MSG_PROBE_WIZARD = _UxGT("Proc.guid.sonda Z"); + PROGMEM Language_Str MSG_SOUND = _UxGT("Suono"); } From de315c97b1d11449c1091e5b93f27f8b4c48645a Mon Sep 17 00:00:00 2001 From: Victor Date: Fri, 30 Oct 2020 00:17:04 +0200 Subject: [PATCH 12/17] FAST_PWM for STM32F1 (#19952) --- Marlin/src/HAL/STM32F1/HAL.h | 17 ++++++ Marlin/src/HAL/STM32F1/fast_pwm.cpp | 68 ++++++++++++++++++++++ Marlin/src/HAL/STM32F1/inc/SanityCheck.h | 4 -- Marlin/src/lcd/menu/menu_spindle_laser.cpp | 6 +- 4 files changed, 87 insertions(+), 8 deletions(-) create mode 100644 Marlin/src/HAL/STM32F1/fast_pwm.cpp diff --git a/Marlin/src/HAL/STM32F1/HAL.h b/Marlin/src/HAL/STM32F1/HAL.h index eaf6494dfa92..b77539d7b6c3 100644 --- a/Marlin/src/HAL/STM32F1/HAL.h +++ b/Marlin/src/HAL/STM32F1/HAL.h @@ -244,3 +244,20 @@ void analogWrite(pin_t pin, int pwm_val8); // PWM only! mul by 257 in maple!? #define PLATFORM_M997_SUPPORT void flashFirmware(const int16_t); + +#define HAL_CAN_SET_PWM_FREQ // This HAL supports PWM Frequency adjustment + +/** + * set_pwm_frequency + * Set the frequency of the timer corresponding to the provided pin + * All Timer PWM pins run at the same frequency + */ +void set_pwm_frequency(const pin_t pin, int f_desired); + +/** + * set_pwm_duty + * 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] + */ +void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size=255, const bool invert=false); diff --git a/Marlin/src/HAL/STM32F1/fast_pwm.cpp b/Marlin/src/HAL/STM32F1/fast_pwm.cpp new file mode 100644 index 000000000000..884d482af5f1 --- /dev/null +++ b/Marlin/src/HAL/STM32F1/fast_pwm.cpp @@ -0,0 +1,68 @@ +/** + * 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 . + * + */ +#ifdef __STM32F1__ + +#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; + if (invert) max_val = v_size - max_val; + pwmWrite(pin, max_val); +} + +#endif // NEEDS_HARDWARE_PWM +#endif // __STM32F1__ diff --git a/Marlin/src/HAL/STM32F1/inc/SanityCheck.h b/Marlin/src/HAL/STM32F1/inc/SanityCheck.h index a0381ea8c8d5..937bef8803ea 100644 --- a/Marlin/src/HAL/STM32F1/inc/SanityCheck.h +++ b/Marlin/src/HAL/STM32F1/inc/SanityCheck.h @@ -25,10 +25,6 @@ * Test STM32F1-specific configuration values for errors at compile-time. */ -#if ENABLED(FAST_PWM_FAN) || SPINDLE_LASER_FREQUENCY - #error "Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32F1." -#endif - #if !defined(HAVE_SW_SERIAL) && HAS_TMC_SW_SERIAL #warning "With TMC2208/9 consider using SoftwareSerialM with HAVE_SW_SERIAL and appropriate SS_TIMER." #error "Missing SoftwareSerial implementation." diff --git a/Marlin/src/lcd/menu/menu_spindle_laser.cpp b/Marlin/src/lcd/menu/menu_spindle_laser.cpp index 04b999eaf620..f1bf433c21ef 100644 --- a/Marlin/src/lcd/menu/menu_spindle_laser.cpp +++ b/Marlin/src/lcd/menu/menu_spindle_laser.cpp @@ -55,10 +55,8 @@ #endif } - #if ENABLED(MARLIN_DEV_MODE) - #if ENABLED(HAL_CAN_SET_PWM_FREQ) && defined(SPINDLE_LASER_FREQUENCY) - EDIT_ITEM_FAST(CUTTER_MENU_FREQUENCY_TYPE, MSG_CUTTER_FREQUENCY, &cutter.frequency, 2000, 50000, cutter.refresh_frequency); - #endif + #if BOTH(MARLIN_DEV_MODE, HAL_CAN_SET_PWM_FREQ) && defined(SPINDLE_LASER_FREQUENCY) + EDIT_ITEM_FAST(CUTTER_MENU_FREQUENCY_TYPE, MSG_CUTTER_FREQUENCY, &cutter.frequency, 2000, 50000, cutter.refresh_frequency); #endif END_MENU(); } From f8d57370d00867df6a4fb7c934982d503be48c4b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 29 Oct 2020 17:33:59 -0500 Subject: [PATCH 13/17] gcode_D EEPROM size, cleanup Fixes #19920 Co-Authored-By: Orel <37673727+0r31@users.noreply.github.com> --- Marlin/src/HAL/AVR/eeprom.cpp | 2 +- Marlin/src/HAL/DUE/eeprom_flash.cpp | 2 +- Marlin/src/HAL/DUE/eeprom_wired.cpp | 2 +- Marlin/src/HAL/ESP32/eeprom.cpp | 2 +- Marlin/src/HAL/LINUX/eeprom.cpp | 2 +- Marlin/src/HAL/LPC1768/eeprom_flash.cpp | 2 +- Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp | 2 +- Marlin/src/HAL/LPC1768/eeprom_wired.cpp | 2 +- Marlin/src/HAL/SAMD51/eeprom_flash.cpp | 2 +- Marlin/src/HAL/SAMD51/eeprom_qspi.cpp | 2 +- Marlin/src/HAL/SAMD51/eeprom_wired.cpp | 2 +- Marlin/src/HAL/STM32/eeprom_flash.cpp | 2 +- Marlin/src/HAL/STM32/eeprom_sdcard.cpp | 2 +- Marlin/src/HAL/STM32/eeprom_sram.cpp | 2 +- Marlin/src/HAL/STM32/eeprom_wired.cpp | 2 +- Marlin/src/HAL/STM32F1/eeprom_bl24cxx.cpp | 2 +- Marlin/src/HAL/STM32F1/eeprom_flash.cpp | 2 +- Marlin/src/HAL/STM32F1/eeprom_sdcard.cpp | 2 +- Marlin/src/HAL/STM32F1/eeprom_wired.cpp | 2 +- Marlin/src/HAL/STM32_F4_F7/eeprom_flash.cpp | 2 +- Marlin/src/HAL/STM32_F4_F7/eeprom_wired.cpp | 2 +- Marlin/src/HAL/TEENSY31_32/eeprom.cpp | 2 +- Marlin/src/HAL/TEENSY35_36/eeprom.cpp | 2 +- Marlin/src/HAL/TEENSY40_41/eeprom.cpp | 2 +- Marlin/src/gcode/gcode_d.cpp | 46 ++++++++------------- 25 files changed, 42 insertions(+), 52 deletions(-) diff --git a/Marlin/src/HAL/AVR/eeprom.cpp b/Marlin/src/HAL/AVR/eeprom.cpp index c7906985eb60..ee2a73e410ad 100644 --- a/Marlin/src/HAL/AVR/eeprom.cpp +++ b/Marlin/src/HAL/AVR/eeprom.cpp @@ -59,7 +59,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui return false; } -bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) { +bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) { do { uint8_t c = eeprom_read_byte((uint8_t*)pos); if (writing) *value = c; diff --git a/Marlin/src/HAL/DUE/eeprom_flash.cpp b/Marlin/src/HAL/DUE/eeprom_flash.cpp index 6f38da0967cb..209a5161ae02 100644 --- a/Marlin/src/HAL/DUE/eeprom_flash.cpp +++ b/Marlin/src/HAL/DUE/eeprom_flash.cpp @@ -996,7 +996,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui return false; } -bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) { +bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) { do { uint8_t c = ee_Read(uint32_t(pos)); if (writing) *value = c; diff --git a/Marlin/src/HAL/DUE/eeprom_wired.cpp b/Marlin/src/HAL/DUE/eeprom_wired.cpp index 4599d6a7cd44..b488c36f1666 100644 --- a/Marlin/src/HAL/DUE/eeprom_wired.cpp +++ b/Marlin/src/HAL/DUE/eeprom_wired.cpp @@ -62,7 +62,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui return false; } -bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) { +bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) { do { uint8_t c = eeprom_read_byte((uint8_t*)pos); if (writing) *value = c; diff --git a/Marlin/src/HAL/ESP32/eeprom.cpp b/Marlin/src/HAL/ESP32/eeprom.cpp index 1bf687c6fe09..cb5f881284ec 100644 --- a/Marlin/src/HAL/ESP32/eeprom.cpp +++ b/Marlin/src/HAL/ESP32/eeprom.cpp @@ -44,7 +44,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui return false; } -bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) { +bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) { for (size_t i = 0; i < size; i++) { uint8_t c = EEPROM.read(pos++); if (writing) value[i] = c; diff --git a/Marlin/src/HAL/LINUX/eeprom.cpp b/Marlin/src/HAL/LINUX/eeprom.cpp index 68fff9c433b6..532f323c6edb 100644 --- a/Marlin/src/HAL/LINUX/eeprom.cpp +++ b/Marlin/src/HAL/LINUX/eeprom.cpp @@ -78,7 +78,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui return (bytes_written != size); // return true for any error } -bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uint16_t *crc, const bool writing/*=true*/) { +bool PersistentStore::read_data(int &pos, uint8_t *value, const size_t size, uint16_t *crc, const bool writing/*=true*/) { std::size_t bytes_read = 0; if (writing) { for (std::size_t i = 0; i < size; i++) { diff --git a/Marlin/src/HAL/LPC1768/eeprom_flash.cpp b/Marlin/src/HAL/LPC1768/eeprom_flash.cpp index 255848637520..3c0c3c8ec30e 100644 --- a/Marlin/src/HAL/LPC1768/eeprom_flash.cpp +++ b/Marlin/src/HAL/LPC1768/eeprom_flash.cpp @@ -119,7 +119,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui return false; // return true for any error } -bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) { +bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) { const uint8_t * const buff = writing ? &value[0] : &ram_eeprom[pos]; if (writing) for (size_t i = 0; i < size; i++) value[i] = ram_eeprom[pos + i]; crc16(crc, buff, size); diff --git a/Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp b/Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp index 9f2475f490ef..54a64ccd72f1 100644 --- a/Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp +++ b/Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp @@ -143,7 +143,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui return bytes_written != size; // return true for any error } -bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uint16_t *crc, const bool writing/*=true*/) { +bool PersistentStore::read_data(int &pos, uint8_t *value, const size_t size, uint16_t *crc, const bool writing/*=true*/) { if (!eeprom_file_open) return true; UINT bytes_read = 0; FRESULT s; diff --git a/Marlin/src/HAL/LPC1768/eeprom_wired.cpp b/Marlin/src/HAL/LPC1768/eeprom_wired.cpp index 16c15eaf0063..d94aba6119f1 100644 --- a/Marlin/src/HAL/LPC1768/eeprom_wired.cpp +++ b/Marlin/src/HAL/LPC1768/eeprom_wired.cpp @@ -64,7 +64,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui return false; } -bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) { +bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) { do { // Read from external EEPROM const uint8_t c = eeprom_read_byte((uint8_t*)pos); diff --git a/Marlin/src/HAL/SAMD51/eeprom_flash.cpp b/Marlin/src/HAL/SAMD51/eeprom_flash.cpp index 429ef1c2d4f7..871bf22b7fc4 100644 --- a/Marlin/src/HAL/SAMD51/eeprom_flash.cpp +++ b/Marlin/src/HAL/SAMD51/eeprom_flash.cpp @@ -79,7 +79,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui return false; } -bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) { +bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) { while (size--) { SYNC(NVMCTRL->SEESTAT.bit.BUSY); uint8_t c = ((volatile uint8_t *)SEEPROM_ADDR)[pos]; diff --git a/Marlin/src/HAL/SAMD51/eeprom_qspi.cpp b/Marlin/src/HAL/SAMD51/eeprom_qspi.cpp index b403f7939fb9..faa763719707 100644 --- a/Marlin/src/HAL/SAMD51/eeprom_qspi.cpp +++ b/Marlin/src/HAL/SAMD51/eeprom_qspi.cpp @@ -56,7 +56,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui return false; } -bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) { +bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) { while (size--) { uint8_t c = qspi.readByte(pos); if (writing) *value = c; diff --git a/Marlin/src/HAL/SAMD51/eeprom_wired.cpp b/Marlin/src/HAL/SAMD51/eeprom_wired.cpp index 3283195897b0..d9a0225a7ae4 100644 --- a/Marlin/src/HAL/SAMD51/eeprom_wired.cpp +++ b/Marlin/src/HAL/SAMD51/eeprom_wired.cpp @@ -59,7 +59,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui return false; } -bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) { +bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) { while (size--) { uint8_t c = eeprom_read_byte((uint8_t*)pos); if (writing) *value = c; diff --git a/Marlin/src/HAL/STM32/eeprom_flash.cpp b/Marlin/src/HAL/STM32/eeprom_flash.cpp index 0933b9f4e8cb..c83376d2658a 100644 --- a/Marlin/src/HAL/STM32/eeprom_flash.cpp +++ b/Marlin/src/HAL/STM32/eeprom_flash.cpp @@ -261,7 +261,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui return false; } -bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) { +bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) { do { const uint8_t c = TERN(FLASH_EEPROM_LEVELING, ram_eeprom[pos], eeprom_buffered_read_byte(pos)); if (writing) *value = c; diff --git a/Marlin/src/HAL/STM32/eeprom_sdcard.cpp b/Marlin/src/HAL/STM32/eeprom_sdcard.cpp index 711a83ed5b6a..c9180bf09b22 100644 --- a/Marlin/src/HAL/STM32/eeprom_sdcard.cpp +++ b/Marlin/src/HAL/STM32/eeprom_sdcard.cpp @@ -78,7 +78,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui return false; } -bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uint16_t *crc, const bool writing/*=true*/) { +bool PersistentStore::read_data(int &pos, uint8_t *value, const size_t size, uint16_t *crc, const bool writing/*=true*/) { for (size_t i = 0; i < size; i++) { uint8_t c = HAL_eeprom_data[pos + i]; if (writing) value[i] = c; diff --git a/Marlin/src/HAL/STM32/eeprom_sram.cpp b/Marlin/src/HAL/STM32/eeprom_sram.cpp index 5f6f26f9c61b..135bcabde9aa 100644 --- a/Marlin/src/HAL/STM32/eeprom_sram.cpp +++ b/Marlin/src/HAL/STM32/eeprom_sram.cpp @@ -52,7 +52,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui return false; } -bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) { +bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) { do { // Read from either external EEPROM, program flash or Backup SRAM const uint8_t c = ( *(__IO uint8_t *)(BKPSRAM_BASE + ((uint8_t*)pos)) ); diff --git a/Marlin/src/HAL/STM32/eeprom_wired.cpp b/Marlin/src/HAL/STM32/eeprom_wired.cpp index 8c46e45f0324..ad54c12c471f 100644 --- a/Marlin/src/HAL/STM32/eeprom_wired.cpp +++ b/Marlin/src/HAL/STM32/eeprom_wired.cpp @@ -65,7 +65,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui return false; } -bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) { +bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) { do { // Read from either external EEPROM, program flash or Backup SRAM const uint8_t c = eeprom_read_byte((uint8_t*)pos); diff --git a/Marlin/src/HAL/STM32F1/eeprom_bl24cxx.cpp b/Marlin/src/HAL/STM32F1/eeprom_bl24cxx.cpp index 658b7cd4a654..94b5e099bd58 100644 --- a/Marlin/src/HAL/STM32F1/eeprom_bl24cxx.cpp +++ b/Marlin/src/HAL/STM32F1/eeprom_bl24cxx.cpp @@ -68,7 +68,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui return false; } -bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) { +bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) { do { uint8_t * const p = (uint8_t * const)pos; uint8_t c = eeprom_read_byte(p); diff --git a/Marlin/src/HAL/STM32F1/eeprom_flash.cpp b/Marlin/src/HAL/STM32F1/eeprom_flash.cpp index 8db8c8638bb8..dfcaaaf29ff3 100644 --- a/Marlin/src/HAL/STM32F1/eeprom_flash.cpp +++ b/Marlin/src/HAL/STM32F1/eeprom_flash.cpp @@ -101,7 +101,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui return false; // return true for any error } -bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uint16_t *crc, const bool writing/*=true*/) { +bool PersistentStore::read_data(int &pos, uint8_t *value, const size_t size, uint16_t *crc, const bool writing/*=true*/) { const uint8_t * const buff = writing ? &value[0] : &ram_eeprom[pos]; if (writing) for (size_t i = 0; i < size; i++) value[i] = ram_eeprom[pos + i]; crc16(crc, buff, size); diff --git a/Marlin/src/HAL/STM32F1/eeprom_sdcard.cpp b/Marlin/src/HAL/STM32F1/eeprom_sdcard.cpp index 11959191f6dd..d608ccee1441 100644 --- a/Marlin/src/HAL/STM32F1/eeprom_sdcard.cpp +++ b/Marlin/src/HAL/STM32F1/eeprom_sdcard.cpp @@ -79,7 +79,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui return false; } -bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uint16_t *crc, const bool writing/*=true*/) { +bool PersistentStore::read_data(int &pos, uint8_t *value, const size_t size, uint16_t *crc, const bool writing/*=true*/) { for (size_t i = 0; i < size; i++) { uint8_t c = HAL_eeprom_data[pos + i]; if (writing) value[i] = c; diff --git a/Marlin/src/HAL/STM32F1/eeprom_wired.cpp b/Marlin/src/HAL/STM32F1/eeprom_wired.cpp index fffd6ccaf01e..6e992a22a32d 100644 --- a/Marlin/src/HAL/STM32F1/eeprom_wired.cpp +++ b/Marlin/src/HAL/STM32F1/eeprom_wired.cpp @@ -72,7 +72,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui return false; } -bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) { +bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) { do { uint8_t c = eeprom_read_byte((uint8_t*)pos); if (writing && value) *value = c; diff --git a/Marlin/src/HAL/STM32_F4_F7/eeprom_flash.cpp b/Marlin/src/HAL/STM32_F4_F7/eeprom_flash.cpp index 00b808fd4824..8c5795b6853b 100644 --- a/Marlin/src/HAL/STM32_F4_F7/eeprom_flash.cpp +++ b/Marlin/src/HAL/STM32_F4_F7/eeprom_flash.cpp @@ -96,7 +96,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui return false; } -bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) { +bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) { do { uint8_t c = ee_read_byte((uint8_t*)pos); if (writing) *value = c; diff --git a/Marlin/src/HAL/STM32_F4_F7/eeprom_wired.cpp b/Marlin/src/HAL/STM32_F4_F7/eeprom_wired.cpp index c0d82dbd0754..2bf386bec505 100644 --- a/Marlin/src/HAL/STM32_F4_F7/eeprom_wired.cpp +++ b/Marlin/src/HAL/STM32_F4_F7/eeprom_wired.cpp @@ -62,7 +62,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui return false; } -bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) { +bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) { do { uint8_t c = eeprom_read_byte((uint8_t*)pos); if (writing) *value = c; diff --git a/Marlin/src/HAL/TEENSY31_32/eeprom.cpp b/Marlin/src/HAL/TEENSY31_32/eeprom.cpp index cc5c56f7d550..f2ae5dd534ec 100644 --- a/Marlin/src/HAL/TEENSY31_32/eeprom.cpp +++ b/Marlin/src/HAL/TEENSY31_32/eeprom.cpp @@ -57,7 +57,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui return false; } -bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) { +bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) { do { uint8_t c = eeprom_read_byte((uint8_t*)pos); if (writing) *value = c; diff --git a/Marlin/src/HAL/TEENSY35_36/eeprom.cpp b/Marlin/src/HAL/TEENSY35_36/eeprom.cpp index ccbdc6b11600..8cd6b4ff41d7 100644 --- a/Marlin/src/HAL/TEENSY35_36/eeprom.cpp +++ b/Marlin/src/HAL/TEENSY35_36/eeprom.cpp @@ -61,7 +61,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui return false; } -bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) { +bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) { do { uint8_t c = eeprom_read_byte((uint8_t*)pos); if (writing) *value = c; diff --git a/Marlin/src/HAL/TEENSY40_41/eeprom.cpp b/Marlin/src/HAL/TEENSY40_41/eeprom.cpp index 030a8c38af3f..fe2de388a7a0 100644 --- a/Marlin/src/HAL/TEENSY40_41/eeprom.cpp +++ b/Marlin/src/HAL/TEENSY40_41/eeprom.cpp @@ -61,7 +61,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui return false; } -bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) { +bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) { do { uint8_t c = eeprom_read_byte((uint8_t*)pos); if (writing) *value = c; diff --git a/Marlin/src/gcode/gcode_d.cpp b/Marlin/src/gcode/gcode_d.cpp index 2fd03144c594..0bd295587531 100644 --- a/Marlin/src/gcode/gcode_d.cpp +++ b/Marlin/src/gcode/gcode_d.cpp @@ -54,9 +54,7 @@ size_t total = persistentStore.capacity(); int pos = 0; const uint8_t value = 0x0; - while(total--) { - persistentStore.write_data(pos, &value, 1); - } + while (total--) persistentStore.write_data(pos, &value, 1); persistentStore.access_finish(); #else settings.reset(); @@ -70,7 +68,7 @@ uint8_t *pointer = parser.hex_adr_val('A'); uint16_t len = parser.ushortval('C', 1); uintptr_t addr = (uintptr_t)pointer; - NOMORE(addr, (size_t)(SRAM_SIZE - 1)); + NOMORE(addr, size_t(SRAM_SIZE - 1)); NOMORE(len, SRAM_SIZE - addr); if (parser.seenval('X')) { // Write the hex bytes after the X @@ -91,16 +89,13 @@ uint8_t *pointer = parser.hex_adr_val('A'); uint16_t len = parser.ushortval('C', 1); uintptr_t addr = (uintptr_t)pointer; - #ifndef MARLIN_EEPROM_SIZE - #define MARLIN_EEPROM_SIZE size_t(E2END + 1) - #endif - NOMORE(addr, (size_t)(MARLIN_EEPROM_SIZE - 1)); - NOMORE(len, MARLIN_EEPROM_SIZE - addr); + NOMORE(addr, size_t(persistentStore.capacity() - 1)); + NOMORE(len, persistentStore.capacity() - addr); if (parser.seenval('X')) { uint16_t val = parser.hex_val('X'); #if ENABLED(EEPROM_SETTINGS) persistentStore.access_start(); - while(len--) { + while (len--) { int pos = 0; persistentStore.write_data(pos, (uint8_t *)&val, sizeof(val)); } @@ -111,23 +106,18 @@ #endif } else { - while (len--) { - // Read bytes from EEPROM - #if ENABLED(EEPROM_SETTINGS) - persistentStore.access_start(); - uint8_t val; - while(len--) { - int pos = 0; - if (!persistentStore.read_data(pos, (uint8_t *)&val, sizeof(val))) { - print_hex_byte(val); - } - } - SERIAL_EOL(); - persistentStore.access_finish(); - #else - SERIAL_ECHOLNPGM("NO EEPROM"); - #endif - } + // Read bytes from EEPROM + #if ENABLED(EEPROM_SETTINGS) + persistentStore.access_start(); + int pos = 0; + uint8_t val; + while (len--) if (!persistentStore.read_data(pos, &val, 1)) print_hex_byte(val); + SERIAL_EOL(); + persistentStore.access_finish(); + #else + SERIAL_ECHOLNPGM("NO EEPROM"); + len = 0; + #endif SERIAL_EOL(); } } break; @@ -156,7 +146,7 @@ uint8_t *pointer = parser.hex_adr_val('A'); uint16_t len = parser.ushortval('C', 1); uintptr_t addr = (uintptr_t)pointer; - NOMORE(addr, (size_t)(FLASH_SIZE - 1)); + NOMORE(addr, size_t(FLASH_SIZE - 1)); NOMORE(len, FLASH_SIZE - addr); if (parser.seenval('X')) { // TODO: Write the hex bytes after the X From dde86a4179b3ca44d267a1fe675316f8f7740a72 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Fri, 30 Oct 2020 00:10:04 +0000 Subject: [PATCH 14/17] [cron] Bump distribution date (2020-10-30) --- Marlin/src/inc/Version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index b6660e88667e..fa7f52cb8b4a 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 "2020-10-29" + #define STRING_DISTRIBUTION_DATE "2020-10-30" #endif /** From a272c019f99af579ee5e68c9ee4d9ccb69712d69 Mon Sep 17 00:00:00 2001 From: Orel <37673727+0r31@users.noreply.github.com> Date: Fri, 30 Oct 2020 02:02:29 +0100 Subject: [PATCH 15/17] Rename, adjust Dagoma F5 (#19947) --- Marlin/src/core/boards.h | 2 +- Marlin/src/module/thermistor/thermistor_17.h | 78 +++++++++++++++++++ Marlin/src/module/thermistor/thermistors.h | 3 + Marlin/src/pins/pins.h | 8 +- .../{pins_RAMPS_DAGOMA.h => pins_DAGOMA_F5.h} | 36 +++++++-- 5 files changed, 119 insertions(+), 8 deletions(-) create mode 100644 Marlin/src/module/thermistor/thermistor_17.h rename Marlin/src/pins/ramps/{pins_RAMPS_DAGOMA.h => pins_DAGOMA_F5.h} (61%) diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index e11590334299..a1e39f9ae81d 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -92,7 +92,7 @@ #define BOARD_TRIGORILLA_14_11 1136 // ... Rev 1.1 (new servo pin order) #define BOARD_RAMPS_ENDER_4 1137 // Creality: Ender-4, CR-8 #define BOARD_RAMPS_CREALITY 1138 // Creality: CR10S, CR20, CR-X -#define BOARD_RAMPS_DAGOMA 1139 // Dagoma F5 +#define BOARD_DAGOMA_F5 1139 // Dagoma F5 #define BOARD_FYSETC_F6_13 1140 // FYSETC F6 1.3 #define BOARD_FYSETC_F6_14 1141 // FYSETC F6 1.4 #define BOARD_DUPLICATOR_I3_PLUS 1142 // Wanhao Duplicator i3 Plus diff --git a/Marlin/src/module/thermistor/thermistor_17.h b/Marlin/src/module/thermistor/thermistor_17.h new file mode 100644 index 000000000000..32b5bb77a888 --- /dev/null +++ b/Marlin/src/module/thermistor/thermistor_17.h @@ -0,0 +1,78 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +// Dagoma NTC 100k white thermistor +const temp_entry_t temptable_17[] PROGMEM = { + { OV( 16), 309 }, + { OV( 18), 307 }, + { OV( 20), 300 }, + { OV( 22), 293 }, + { OV( 26), 284 }, + { OV( 29), 272 }, + { OV( 33), 266 }, + { OV( 36), 260 }, + { OV( 42), 252 }, + { OV( 46), 247 }, + { OV( 48), 244 }, + { OV( 51), 241 }, + { OV( 62), 231 }, + { OV( 73), 222 }, + { OV( 78), 219 }, + { OV( 87), 212 }, + { OV( 98), 207 }, + { OV( 109), 201 }, + { OV( 118), 197 }, + { OV( 131), 191 }, + { OV( 145), 186 }, + { OV( 160), 181 }, + { OV( 177), 175 }, + { OV( 203), 169 }, + { OV( 222), 164 }, + { OV( 256), 156 }, + { OV( 283), 151 }, + { OV( 312), 145 }, + { OV( 343), 140 }, + { OV( 377), 131 }, + { OV( 413), 125 }, + { OV( 454), 119 }, + { OV( 496), 113 }, + { OV( 537), 108 }, + { OV( 578), 102 }, + { OV( 619), 97 }, + { OV( 658), 92 }, + { OV( 695), 87 }, + { OV( 735), 81 }, + { OV( 773), 75 }, + { OV( 808), 70 }, + { OV( 844), 64 }, + { OV( 868), 59 }, + { OV( 892), 54 }, + { OV( 914), 49 }, + { OV( 935), 42 }, + { OV( 951), 38 }, + { OV( 967), 32 }, + { OV( 975), 28 }, + { OV(1000), 20 }, + { OV(1010), 10 }, + { OV(1024), -273 } // for safety +}; diff --git a/Marlin/src/module/thermistor/thermistors.h b/Marlin/src/module/thermistor/thermistors.h index 0b0419c52034..f90361d9a346 100644 --- a/Marlin/src/module/thermistor/thermistors.h +++ b/Marlin/src/module/thermistor/thermistors.h @@ -105,6 +105,9 @@ typedef struct { int16_t value, celsius; } temp_entry_t; #if ANY_THERMISTOR_IS(15) // JGAurora A5 thermistor calibration #include "thermistor_15.h" #endif +#if ANY_THERMISTOR_IS(17) // Dagoma NTC 100k white thermistor + #include "thermistor_17.h" +#endif #if ANY_THERMISTOR_IS(18) // ATC Semitec 204GT-2 (4.7k pullup) Dagoma.Fr - MKS_Base_DKU001327 #include "thermistor_18.h" #endif diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index c4dbe60e99ef..62749a3f6e28 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -179,8 +179,8 @@ #include "ramps/pins_RAMPS_ENDER_4.h" // ATmega2560 env:mega2560 #elif MB(RAMPS_CREALITY) #include "ramps/pins_RAMPS_CREALITY.h" // ATmega2560 env:mega2560 -#elif MB(RAMPS_DAGOMA) - #include "ramps/pins_RAMPS_DAGOMA.h" // ATmega2560 env:mega2560 +#elif MB(DAGOMA_F5) + #include "ramps/pins_DAGOMA_F5.h" // ATmega2560 env:mega2560 #elif MB(FYSETC_F6_13) #include "ramps/pins_FYSETC_F6_13.h" // ATmega2560 env:FYSETC_F6_13 #elif MB(FYSETC_F6_14) @@ -713,6 +713,7 @@ #define BOARD_BIGTREE_SKR_E3_DIP -1017 #define BOARD_RUMBA32 -1018 #define BOARD_RUMBA32_AUS3D -1019 + #define BOARD_RAMPS_DAGOMA -1020 #if MB(MKS_13) #error "BOARD_MKS_13 has been renamed BOARD_MKS_GEN_13. Please update your configuration." @@ -756,6 +757,8 @@ #error "BOARD_RUMBA32 is now BOARD_RUMBA32_MKS or BOARD_RUMBA32_V1_0. Please update your configuration." #elif MB(RUMBA32_AUS3D) #error "BOARD_RUMBA32_AUS3D is now BOARD_RUMBA32_V1_0. Please update your configuration." + #elif MB(RAMPS_DAGOMA) + #error "BOARD_RAMPS_DAGOMA is now BOARD_DAGOMA_F5. Please update your configuration." #else #error "Unknown MOTHERBOARD value set in Configuration.h" #endif @@ -780,6 +783,7 @@ #undef BOARD_BIGTREE_SKR_E3_DIP #undef BOARD_RUMBA32 #undef BOARD_RUMBA32_AUS3D + #undef BOARD_RAMPS_DAGOMA #endif diff --git a/Marlin/src/pins/ramps/pins_RAMPS_DAGOMA.h b/Marlin/src/pins/ramps/pins_DAGOMA_F5.h similarity index 61% rename from Marlin/src/pins/ramps/pins_RAMPS_DAGOMA.h rename to Marlin/src/pins/ramps/pins_DAGOMA_F5.h index ad56b7f9d1e9..667ae47f7098 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS_DAGOMA.h +++ b/Marlin/src/pins/ramps/pins_DAGOMA_F5.h @@ -22,21 +22,47 @@ #pragma once #if HOTENDS > 2 || E_STEPPERS > 2 - #error "Dagoma3D F5 RAMPS supports only 2 hotends / E-steppers. Comment out this line to continue." + #error "Dagoma3D F5 supports only 2 hotends / E-steppers. Comment out this line to continue." #endif -#define BOARD_INFO_NAME "Dagoma3D F5 RAMPS" +#define BOARD_INFO_NAME "Dagoma3D F5" +// +// Endstops +// #define X_STOP_PIN 2 #define Y_STOP_PIN 3 #define Z_STOP_PIN 15 + #define FIL_RUNOUT_PIN 39 +#if EXTRUDERS > 1 + #define FIL_RUNOUT2_PIN 14 +#endif -#ifndef E0_AUTO_FAN_PIN - #define E0_AUTO_FAN_PIN 7 +// +// LCD delays +// +#if HAS_MARLINUI_U8GLIB + #define BOARD_ST7920_DELAY_1 DELAY_NS(0) + #define BOARD_ST7920_DELAY_2 DELAY_NS(250) + #define BOARD_ST7920_DELAY_3 DELAY_NS(250) #endif // -// Import RAMPS 1.4 pins +// DAC steppers +// +#define HAS_MOTOR_CURRENT_DAC + +#define DAC_STEPPER_ORDER { 0, 1, 2, 3 } + +#define DAC_STEPPER_SENSE 0.11 +#define DAC_STEPPER_ADDRESS 0 +#define DAC_STEPPER_MAX 4096 +#define DAC_STEPPER_VREF 1 +#define DAC_STEPPER_GAIN 0 +#define DAC_OR_ADDRESS 0x00 + +// +// Import default RAMPS 1.4 pins // #include "pins_RAMPS.h" From 6071a0835ad063ae7bdf1853ba2ca27b78493f64 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Fri, 30 Oct 2020 00:10:04 +0000 Subject: [PATCH 16/17] Fix bilinear_line_to_destination definition See #19431 --- Marlin/src/feature/bedlevel/abl/abl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/feature/bedlevel/abl/abl.cpp b/Marlin/src/feature/bedlevel/abl/abl.cpp index a585c1e1553d..39d8815fad98 100644 --- a/Marlin/src/feature/bedlevel/abl/abl.cpp +++ b/Marlin/src/feature/bedlevel/abl/abl.cpp @@ -348,7 +348,7 @@ float bilinear_z_offset(const xy_pos_t &raw) { * Prepare a bilinear-leveled linear move on Cartesian, * splitting the move where it crosses grid borders. */ - void bilinear_line_to_destination(const feedRate_t scaled_fr_mm_s, uint16_t x_splits, uint16_t y_splits) { + void bilinear_line_to_destination(const feedRate_t &scaled_fr_mm_s, uint16_t x_splits, uint16_t y_splits) { // Get current and destination cells for this line xy_int_t c1 { CELL_INDEX(x, current_position.x), CELL_INDEX(y, current_position.y) }, c2 { CELL_INDEX(x, destination.x), CELL_INDEX(y, destination.y) }; From a4a487b0cc0a431c01ac07c8170b8a5f19cffd2e Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sat, 31 Oct 2020 00:09:17 +0000 Subject: [PATCH 17/17] [cron] Bump distribution date (2020-10-31) --- Marlin/src/inc/Version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index fa7f52cb8b4a..fe61720265b9 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 "2020-10-30" + #define STRING_DISTRIBUTION_DATE "2020-10-31" #endif /**