From ef6354982a828ad24f92dcd1a724dc0264847a73 Mon Sep 17 00:00:00 2001 From: X-Dron Date: Sun, 1 Nov 2020 21:21:27 +0300 Subject: [PATCH 1/9] PID RANGE, USB SPEED, HOME OFFSETS MENU, UART drive --- Marlin/Configuration.h | 8 ++++---- Marlin/Configuration_adv.h | 28 +++++++++++++++++----------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 56f512f13f..403e281b42 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -416,7 +416,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. */ -#define TEMP_SENSOR_0 1 +#define TEMP_SENSOR_0 13 #define TEMP_SENSOR_1 0 #define TEMP_SENSOR_2 0 #define TEMP_SENSOR_3 0 @@ -559,7 +559,7 @@ //#define PID_DEBUG // Sends debug data to the serial port. Use 'M303 D' to toggle activation. //#define PID_OPENLOOP // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay - #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature + #define PID_FUNCTIONAL_RANGE 20 // If the temperature difference between the target temperature and the actual temperature // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max. #endif @@ -749,7 +749,7 @@ * Override with M92 * X, Y, Z, E0 [, E1[, E2...]] */ -#define DEFAULT_AXIS_STEPS_PER_UNIT { 161.0, 161.0, 800, 830 } +#define DEFAULT_AXIS_STEPS_PER_UNIT { 161.0, 161.0, 800, 820 } /** * Default Max Feed Rate (mm/s) @@ -1166,7 +1166,7 @@ #define Z_MIN_POS 0 #define X_MAX_POS X_BED_SIZE + X_MIN_POS #define Y_MAX_POS Y_BED_SIZE + Y_MIN_POS -#define Z_MAX_POS 210 +#define Z_MAX_POS 200 /** * Software Endstops diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index cf173755b5..c68605cd27 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -507,11 +507,11 @@ #if ENABLED(CASE_LIGHT_ENABLE) #define CASE_LIGHT_PIN LED_CASE_PIN // Override the default pin if needed #define INVERT_CASE_LIGHT false // Set true if Case Light is ON when pin is LOW - #define CASE_LIGHT_DEFAULT_ON true // Set default power-up state on + #define CASE_LIGHT_DEFAULT_ON false // Set default power-up state on #define CASE_LIGHT_DEFAULT_BRIGHTNESS 255 // Set default power-up brightness (0-255, requires PWM pin) #define CASE_LIGHT_MAX_PWM 255 // Limit pwm #define CASE_LIGHT_MENU // Add Case Light options to the LCD menu - #define CASE_LIGHT_NO_BRIGHTNESS // Disable brightness control. Enable for non-PWM lighting. + //#define CASE_LIGHT_NO_BRIGHTNESS // Disable brightness control. Enable for non-PWM lighting. //#define CASE_LIGHT_USE_NEOPIXEL // Use NeoPixel LED as case light, requires NEOPIXEL_LED. #if ENABLED(CASE_LIGHT_USE_NEOPIXEL) #define CASE_LIGHT_NEOPIXEL_COLOR { 255, 255, 255, 255 } // { Red, Green, Blue, White } @@ -3158,7 +3158,7 @@ * - M206 and M428 are disabled. * - G92 will revert to its behavior from Marlin 1.0. */ -//#define NO_WORKSPACE_OFFSETS +#define NO_WORKSPACE_OFFSETS // Extra options for the M114 "Current Position" report //#define M114_DETAIL // Use 'M114` for details to check planner calculations @@ -3236,17 +3236,23 @@ #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" - #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL - #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) + #define USER_DESC_2 "Light ON" + #define USER_GCODE_2 "M355 S1" - #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL - #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) + #define USER_DESC_3 "Light OFF" + #define USER_GCODE_3 "M355 S0" - #define USER_DESC_4 "Heat Bed/Home/Level" - #define USER_GCODE_4 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nG28\nG29" +// #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL +// #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - #define USER_DESC_5 "Power off" - #define USER_GCODE_5 "M81" +// #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL +// #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) + +// #define USER_DESC_4 "Heat Bed/Home/Level" +// #define USER_GCODE_4 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nG28\nG29" + + #define USER_DESC_4 "Power off" + #define USER_GCODE_4 "M81" #endif From a6fea31697b0799220ca2a8171485d3350a25ebc Mon Sep 17 00:00:00 2001 From: X-Dron Date: Fri, 6 Nov 2020 07:49:12 +0300 Subject: [PATCH 2/9] LED Switch and minor config update --- Marlin/Configuration.h | 2 +- Marlin/Configuration_adv.h | 6 ++--- Marlin/src/MarlinCore.cpp | 23 +++++++++++++++++++ Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h | 7 +++++- .../src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h | 7 +++++- 5 files changed, 39 insertions(+), 6 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 403e281b42..d2504207ec 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1162,7 +1162,7 @@ // Travel limits (mm) after homing, corresponding to endstop positions. #define X_MIN_POS 0 -#define Y_MIN_POS -4 +#define Y_MIN_POS -2 #define Z_MIN_POS 0 #define X_MAX_POS X_BED_SIZE + X_MIN_POS #define Y_MAX_POS Y_BED_SIZE + Y_MIN_POS diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index c68605cd27..0c4e2a1f52 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1612,9 +1612,9 @@ #define BABYSTEP_ALWAYS_AVAILABLE // Allow babystepping at all times (not just during movement). //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - //#define BABYSTEP_MILLIMETER_UNITS // Specify BABYSTEP_MULTIPLICATOR_(XY|Z) in mm instead of micro-steps - #define BABYSTEP_MULTIPLICATOR_Z 10 // (steps or mm) Steps or millimeter distance for each Z babystep - #define BABYSTEP_MULTIPLICATOR_XY 10 // (steps or mm) Steps or millimeter distance for each XY babystep + #define BABYSTEP_MILLIMETER_UNITS // Specify BABYSTEP_MULTIPLICATOR_(XY|Z) in mm instead of micro-steps + #define BABYSTEP_MULTIPLICATOR_Z 0.01 // (steps or mm) Steps or millimeter distance for each Z babystep + //#define BABYSTEP_MULTIPLICATOR_XY 10 // (steps or mm) Steps or millimeter distance for each XY babystep #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 5cea9cb58f..1141740efb 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -268,6 +268,11 @@ bool wait_for_heatup = true; * ******************************** FUNCTIONS ******************************** * *************************************************************************** */ +#ifdef LED_SW_PIN + void setup_LED_SW_pin() { + SET_INPUT_PULLDOWN(LED_SW_PIN); + } +#endif void setup_killpin() { #if HAS_KILL @@ -559,6 +564,20 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) { } #endif + #ifdef LED_SW_PIN + static int LedSw_Count = 0; // make the inactivity button a bit less responsive + const int LED_SW_DELAY = 100; + bool led_pin_status = !READ(LED_SW_PIN); + if (led_pin_status && LedSw_Count <= LED_SW_DELAY) + LedSw_Count++; + else if (!led_pin_status) + LedSw_Count = 0; + if (LedSw_Count == LED_SW_DELAY){ + caselight.on = !caselight.on; + caselight.update(true); + } + #endif + #if HAS_HOME // Handle a standalone HOME button constexpr millis_t HOME_DEBOUNCE_DELAY = 1000UL; @@ -1001,6 +1020,10 @@ void setup() { #endif SETUP_RUN(setup_killpin()); + + #ifdef LED_SW_PIN + SETUP_RUN(setup_LED_SW_pin()); + #endif #if HAS_TMC220x SETUP_RUN(tmc_serial_begin()); diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h index 1e23089e74..c22b2df5d4 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h @@ -168,7 +168,12 @@ BlTouch //#define POWER_LOSS_PIN PA2 // PW_DET //#define PS_ON_PIN PB2 // PW_OFF #define FIL_RUNOUT_PIN PA4 - #define FIL_RUNOUT2_PIN PE6 + #ifdef CASE_LED_INSTEAD_E1 + //#define LED_SW_PIN PE6 + #endif + #ifndef LED_SW_PIN + #define FIL_RUNOUT2_PIN PE6 + #endif #endif // 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 3fa07f1a5d..5fde0b0d0f 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h @@ -236,7 +236,12 @@ https://easyeda.com/sst78rust/fb4s-led-control //#define POWER_LOSS_PIN PA2 // PW_DET //#define PS_ON_PIN PB2 // PW_OFF #define FIL_RUNOUT_PIN PA4 - #define FIL_RUNOUT2_PIN PE6 + #ifdef CASE_LED_INSTEAD_E1 + #define LED_SW_PIN PE6 + #endif + #ifndef LED_SW_PIN + #define FIL_RUNOUT2_PIN PE6 + #endif #endif #define SERVO0_PIN PA8 // Enable BLTOUCH From de94b4588d245d7377ad39bdc5db22c5cde69a6f Mon Sep 17 00:00:00 2001 From: X-Dron Date: Fri, 6 Nov 2020 19:09:10 +0300 Subject: [PATCH 3/9] ENABLED(BABYSTEP_ZPROBE_OFFSET) --- Marlin/Configuration_adv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 0c4e2a1f52..0d22236477 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1628,7 +1628,7 @@ //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping + #define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor From 72431de8e560bd2ddf2301c8394c2906e6f4c84e Mon Sep 17 00:00:00 2001 From: X-Dron Date: Fri, 6 Nov 2020 19:59:59 +0300 Subject: [PATCH 4/9] Sync with Sergey1560 --- Marlin/Configuration.h | 3 +-- Marlin/Configuration_adv.h | 4 ++-- Marlin/src/MarlinCore.cpp | 8 ++++++-- Marlin/src/core/serial.h | 9 +++++++-- Marlin/src/module/mks_wifi/mks_wifi_sd.cpp | 2 ++ Marlin/src/module/mks_wifi/mks_wifi_serial_out.cpp | 14 +++++++++----- Marlin/src/module/mks_wifi/mks_wifi_serial_out.h | 2 ++ Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h | 2 ++ Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h | 1 + 9 files changed, 32 insertions(+), 13 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index d2504207ec..3d0810310c 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -120,8 +120,7 @@ * * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000] */ -#define BAUDRATE 115200 -#define USB_BAUDRATE 250000 +#define BAUDRATE 250000 // Enable the Bluetooth serial interface on AT90USB devices //#define BLUETOOTH diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 0d22236477..4916722215 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1613,8 +1613,8 @@ //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way #define BABYSTEP_MILLIMETER_UNITS // Specify BABYSTEP_MULTIPLICATOR_(XY|Z) in mm instead of micro-steps - #define BABYSTEP_MULTIPLICATOR_Z 0.01 // (steps or mm) Steps or millimeter distance for each Z babystep - //#define BABYSTEP_MULTIPLICATOR_XY 10 // (steps or mm) Steps or millimeter distance for each XY babystep + #define BABYSTEP_MULTIPLICATOR_Z 0.01 // (steps or mm) Steps or millimeter distance for each Z babystep + //#define BABYSTEP_MULTIPLICATOR_XY 0.01 // (steps or mm) Steps or millimeter distance for each XY babystep #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 1141740efb..5d5ff62603 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -984,11 +984,15 @@ void setup() { #endif #endif - MYSERIAL0.begin(USB_BAUDRATE); + MYSERIAL0.begin(BAUDRATE); uint32_t serial_connect_timeout = millis() + 1000UL; while (!MYSERIAL0 && PENDING(millis(), serial_connect_timeout)) { /*nada*/ } #if HAS_MULTI_SERIAL - MYSERIAL1.begin(BAUDRATE); + #if ENABLED(MKS_WIFI) + MYSERIAL1.begin(MKS_WIFI_BAUDRATE); + #else + MYSERIAL1.begin(BAUDRATE); + #endif serial_connect_timeout = millis() + 1000UL; while (!MYSERIAL1 && PENDING(millis(), serial_connect_timeout)) { /*nada*/ } #endif diff --git a/Marlin/src/core/serial.h b/Marlin/src/core/serial.h index d93f1961df..77711e31b1 100644 --- a/Marlin/src/core/serial.h +++ b/Marlin/src/core/serial.h @@ -58,7 +58,6 @@ extern uint8_t marlin_debug_flags; #else #define SERIAL_OUT(WHAT, V...) do{ \ if (!serial_port_index || serial_port_index == SERIAL_BOTH) (void)MYSERIAL0.WHAT(V); \ - if ( serial_port_index) (void)MYSERIAL1.WHAT(V); \ }while(0) #endif @@ -82,8 +81,14 @@ extern uint8_t marlin_debug_flags; #define SERIAL_ECHO(x) SERIAL_OUT(print, x) #endif +#if ENABLED(MKS_WIFI) +#define SERIAL_ECHO_F(V...) do{ \ + if (!serial_port_index || serial_port_index == SERIAL_BOTH ) SERIAL_OUT(print, V); \ + if ( serial_port_index) mks_wifi_print_f(V); \ +}while(0) +#else #define SERIAL_ECHO_F(V...) SERIAL_OUT(print, V) - +#endif #if ENABLED(MKS_WIFI) #define SERIAL_ECHOLN(x) do{ \ if (!serial_port_index || serial_port_index == SERIAL_BOTH ) SERIAL_OUT(println, x); \ diff --git a/Marlin/src/module/mks_wifi/mks_wifi_sd.cpp b/Marlin/src/module/mks_wifi/mks_wifi_sd.cpp index d9f10c064a..c23db1463c 100644 --- a/Marlin/src/module/mks_wifi/mks_wifi_sd.cpp +++ b/Marlin/src/module/mks_wifi/mks_wifi_sd.cpp @@ -199,6 +199,8 @@ void mks_wifi_start_file_upload(ESP_PROTOC_FRAME *packet){ while(dma_timeout-- > 0){ + iwdg_feed(); + if(DMA1->ISR & DMA_ISR_TCIF5){ DMA1->IFCR = DMA_IFCR_CGIF5|DMA_IFCR_CTEIF5|DMA_IFCR_CHTIF5|DMA_IFCR_CTCIF5; diff --git a/Marlin/src/module/mks_wifi/mks_wifi_serial_out.cpp b/Marlin/src/module/mks_wifi/mks_wifi_serial_out.cpp index ecd59553aa..09697d1267 100644 --- a/Marlin/src/module/mks_wifi/mks_wifi_serial_out.cpp +++ b/Marlin/src/module/mks_wifi/mks_wifi_serial_out.cpp @@ -16,6 +16,15 @@ void mks_wifi_print_var(uint8_t count, ...){ va_end(args); } +void mks_wifi_print_f(float f,uint8_t size){ + char str[20]; + char format[10]; + + sprintf(format,"%%0.%df",size); + sprintf(str,format,f); + mks_wifi_out_add((uint8_t *)str, strnlen((char *)str,ESP_PACKET_DATA_MAX_SIZE)); +} + // PRINT functions @@ -88,11 +97,6 @@ void mks_wifi_println(double f){ sprintf(str,"%.2f\n",f); mks_wifi_out_add((uint8_t *)str, strnlen((char *)str,ESP_PACKET_DATA_MAX_SIZE)); } -/* -void mks_wifi_println(int i){ - mks_wifi_println((int32)i); -} -*/ void mks_wifi_println(long int i){ mks_wifi_println((int32)i); } diff --git a/Marlin/src/module/mks_wifi/mks_wifi_serial_out.h b/Marlin/src/module/mks_wifi/mks_wifi_serial_out.h index de0db7d2be..f466b28dfe 100644 --- a/Marlin/src/module/mks_wifi/mks_wifi_serial_out.h +++ b/Marlin/src/module/mks_wifi/mks_wifi_serial_out.h @@ -11,6 +11,8 @@ void mks_wifi_print_var(uint8_t count, ...); +void mks_wifi_print_f(float f,uint8_t size); + void mks_wifi_print(const char *s); void mks_wifi_print(int32 i); void mks_wifi_print(uint32 i); diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h index c22b2df5d4..58f43eda3d 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h @@ -284,6 +284,8 @@ BlTouch #define MKS_WIFI #ifdef MKS_WIFI + + #define MKS_WIFI_BAUDRATE 115200 #undef PLATFORM_M997_SUPPORT #define MKS_WIFI_IO0 PA8 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 5fde0b0d0f..b8ff9df34b 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h @@ -444,6 +444,7 @@ https://easyeda.com/sst78rust/fb4s-led-control */ #define MKS_WIFI #ifdef MKS_WIFI + #define MKS_WIFI_BAUDRATE 115200 #undef PLATFORM_M997_SUPPORT #define MKS_WIFI_IO0 PC13 From 12ac9daecfe00f843d8035831b231022545fd0e3 Mon Sep 17 00:00:00 2001 From: X-Dron Date: Fri, 6 Nov 2020 20:32:48 +0300 Subject: [PATCH 5/9] Revert "Sync with Sergey1560" This reverts commit 72431de8e560bd2ddf2301c8394c2906e6f4c84e. --- Marlin/Configuration.h | 3 ++- Marlin/Configuration_adv.h | 4 ++-- Marlin/src/MarlinCore.cpp | 8 ++------ Marlin/src/core/serial.h | 9 ++------- Marlin/src/module/mks_wifi/mks_wifi_sd.cpp | 2 -- Marlin/src/module/mks_wifi/mks_wifi_serial_out.cpp | 14 +++++--------- Marlin/src/module/mks_wifi/mks_wifi_serial_out.h | 2 -- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h | 2 -- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h | 1 - 9 files changed, 13 insertions(+), 32 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 3d0810310c..d2504207ec 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -120,7 +120,8 @@ * * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000] */ -#define BAUDRATE 250000 +#define BAUDRATE 115200 +#define USB_BAUDRATE 250000 // Enable the Bluetooth serial interface on AT90USB devices //#define BLUETOOTH diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 4916722215..0d22236477 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1613,8 +1613,8 @@ //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way #define BABYSTEP_MILLIMETER_UNITS // Specify BABYSTEP_MULTIPLICATOR_(XY|Z) in mm instead of micro-steps - #define BABYSTEP_MULTIPLICATOR_Z 0.01 // (steps or mm) Steps or millimeter distance for each Z babystep - //#define BABYSTEP_MULTIPLICATOR_XY 0.01 // (steps or mm) Steps or millimeter distance for each XY babystep + #define BABYSTEP_MULTIPLICATOR_Z 0.01 // (steps or mm) Steps or millimeter distance for each Z babystep + //#define BABYSTEP_MULTIPLICATOR_XY 10 // (steps or mm) Steps or millimeter distance for each XY babystep #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 5d5ff62603..1141740efb 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -984,15 +984,11 @@ void setup() { #endif #endif - MYSERIAL0.begin(BAUDRATE); + MYSERIAL0.begin(USB_BAUDRATE); uint32_t serial_connect_timeout = millis() + 1000UL; while (!MYSERIAL0 && PENDING(millis(), serial_connect_timeout)) { /*nada*/ } #if HAS_MULTI_SERIAL - #if ENABLED(MKS_WIFI) - MYSERIAL1.begin(MKS_WIFI_BAUDRATE); - #else - MYSERIAL1.begin(BAUDRATE); - #endif + MYSERIAL1.begin(BAUDRATE); serial_connect_timeout = millis() + 1000UL; while (!MYSERIAL1 && PENDING(millis(), serial_connect_timeout)) { /*nada*/ } #endif diff --git a/Marlin/src/core/serial.h b/Marlin/src/core/serial.h index 77711e31b1..d93f1961df 100644 --- a/Marlin/src/core/serial.h +++ b/Marlin/src/core/serial.h @@ -58,6 +58,7 @@ extern uint8_t marlin_debug_flags; #else #define SERIAL_OUT(WHAT, V...) do{ \ if (!serial_port_index || serial_port_index == SERIAL_BOTH) (void)MYSERIAL0.WHAT(V); \ + if ( serial_port_index) (void)MYSERIAL1.WHAT(V); \ }while(0) #endif @@ -81,14 +82,8 @@ extern uint8_t marlin_debug_flags; #define SERIAL_ECHO(x) SERIAL_OUT(print, x) #endif -#if ENABLED(MKS_WIFI) -#define SERIAL_ECHO_F(V...) do{ \ - if (!serial_port_index || serial_port_index == SERIAL_BOTH ) SERIAL_OUT(print, V); \ - if ( serial_port_index) mks_wifi_print_f(V); \ -}while(0) -#else #define SERIAL_ECHO_F(V...) SERIAL_OUT(print, V) -#endif + #if ENABLED(MKS_WIFI) #define SERIAL_ECHOLN(x) do{ \ if (!serial_port_index || serial_port_index == SERIAL_BOTH ) SERIAL_OUT(println, x); \ diff --git a/Marlin/src/module/mks_wifi/mks_wifi_sd.cpp b/Marlin/src/module/mks_wifi/mks_wifi_sd.cpp index c23db1463c..d9f10c064a 100644 --- a/Marlin/src/module/mks_wifi/mks_wifi_sd.cpp +++ b/Marlin/src/module/mks_wifi/mks_wifi_sd.cpp @@ -199,8 +199,6 @@ void mks_wifi_start_file_upload(ESP_PROTOC_FRAME *packet){ while(dma_timeout-- > 0){ - iwdg_feed(); - if(DMA1->ISR & DMA_ISR_TCIF5){ DMA1->IFCR = DMA_IFCR_CGIF5|DMA_IFCR_CTEIF5|DMA_IFCR_CHTIF5|DMA_IFCR_CTCIF5; diff --git a/Marlin/src/module/mks_wifi/mks_wifi_serial_out.cpp b/Marlin/src/module/mks_wifi/mks_wifi_serial_out.cpp index 09697d1267..ecd59553aa 100644 --- a/Marlin/src/module/mks_wifi/mks_wifi_serial_out.cpp +++ b/Marlin/src/module/mks_wifi/mks_wifi_serial_out.cpp @@ -16,15 +16,6 @@ void mks_wifi_print_var(uint8_t count, ...){ va_end(args); } -void mks_wifi_print_f(float f,uint8_t size){ - char str[20]; - char format[10]; - - sprintf(format,"%%0.%df",size); - sprintf(str,format,f); - mks_wifi_out_add((uint8_t *)str, strnlen((char *)str,ESP_PACKET_DATA_MAX_SIZE)); -} - // PRINT functions @@ -97,6 +88,11 @@ void mks_wifi_println(double f){ sprintf(str,"%.2f\n",f); mks_wifi_out_add((uint8_t *)str, strnlen((char *)str,ESP_PACKET_DATA_MAX_SIZE)); } +/* +void mks_wifi_println(int i){ + mks_wifi_println((int32)i); +} +*/ void mks_wifi_println(long int i){ mks_wifi_println((int32)i); } diff --git a/Marlin/src/module/mks_wifi/mks_wifi_serial_out.h b/Marlin/src/module/mks_wifi/mks_wifi_serial_out.h index f466b28dfe..de0db7d2be 100644 --- a/Marlin/src/module/mks_wifi/mks_wifi_serial_out.h +++ b/Marlin/src/module/mks_wifi/mks_wifi_serial_out.h @@ -11,8 +11,6 @@ void mks_wifi_print_var(uint8_t count, ...); -void mks_wifi_print_f(float f,uint8_t size); - void mks_wifi_print(const char *s); void mks_wifi_print(int32 i); void mks_wifi_print(uint32 i); diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h index 58f43eda3d..c22b2df5d4 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h @@ -284,8 +284,6 @@ BlTouch #define MKS_WIFI #ifdef MKS_WIFI - - #define MKS_WIFI_BAUDRATE 115200 #undef PLATFORM_M997_SUPPORT #define MKS_WIFI_IO0 PA8 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 b8ff9df34b..5fde0b0d0f 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h @@ -444,7 +444,6 @@ https://easyeda.com/sst78rust/fb4s-led-control */ #define MKS_WIFI #ifdef MKS_WIFI - #define MKS_WIFI_BAUDRATE 115200 #undef PLATFORM_M997_SUPPORT #define MKS_WIFI_IO0 PC13 From f1e9249a8b5b7caf7ba5dd25681aca7d108143b0 Mon Sep 17 00:00:00 2001 From: X-Dron Date: Fri, 6 Nov 2020 21:06:22 +0300 Subject: [PATCH 6/9] Update Configuration.h --- Marlin/Configuration.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index d2504207ec..3d0810310c 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -120,8 +120,7 @@ * * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000] */ -#define BAUDRATE 115200 -#define USB_BAUDRATE 250000 +#define BAUDRATE 250000 // Enable the Bluetooth serial interface on AT90USB devices //#define BLUETOOTH From 0196149b591143be6efd2de21db5b06e2594ac99 Mon Sep 17 00:00:00 2001 From: X-Dron Date: Fri, 6 Nov 2020 21:14:42 +0300 Subject: [PATCH 7/9] Update MarlinCore.cpp --- Marlin/src/MarlinCore.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 1616e7a5be..7f36e3a00e 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -988,11 +988,11 @@ void setup() { uint32_t serial_connect_timeout = millis() + 1000UL; while (!MYSERIAL0 && PENDING(millis(), serial_connect_timeout)) { /*nada*/ } #if HAS_MULTI_SERIAL - #if ENABLED(MKS_WIFI) - MYSERIAL1.begin(MKS_WIFI_BAUDRATE); - #else - MYSERIAL1.begin(BAUDRATE); - #endif + #if ENABLED(MKS_WIFI) + MYSERIAL1.begin(MKS_WIFI_BAUDRATE); + #else + MYSERIAL1.begin(BAUDRATE); + #endif serial_connect_timeout = millis() + 1000UL; while (!MYSERIAL1 && PENDING(millis(), serial_connect_timeout)) { /*nada*/ } #endif From 92a2c1d62d21c245084f607ba13ca4ac7a94b197 Mon Sep 17 00:00:00 2001 From: X-Dron Date: Wed, 25 Nov 2020 20:08:55 +0300 Subject: [PATCH 8/9] PSU + Update config --- Marlin/Configuration.h | 37 ++++++++++--------- Marlin/Configuration_adv.h | 18 ++++----- Marlin/src/MarlinCore.cpp | 16 ++++---- .../src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h | 10 ++++- 4 files changed, 45 insertions(+), 36 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 3d0810310c..6e39d3a047 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -499,9 +499,10 @@ #define DEFAULT_Ki_LIST { 1.08, 1.0 } #define DEFAULT_Kd_LIST { 114.00, 112.0 } #else - #define DEFAULT_Kp 17.04 - #define DEFAULT_Ki 1.31 - #define DEFAULT_Kd 55.34 + // 50Вт + #define DEFAULT_Kp 11.1 + #define DEFAULT_Ki 0.55 + #define DEFAULT_Kd 56.1 #endif #endif // PIDTEMP @@ -686,8 +687,8 @@ * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'L6474', 'POWERSTEP01', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC2209', 'TMC2209_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_STANDALONE'] */ #define X_DRIVER_TYPE TMC2209 -#define Y_DRIVER_TYPE TMC2208 -#define Z_DRIVER_TYPE TMC2208 +#define Y_DRIVER_TYPE TMC2209 +#define Z_DRIVER_TYPE TMC2209 //#define X2_DRIVER_TYPE A4988 //#define Y2_DRIVER_TYPE A4988 //#define Z2_DRIVER_TYPE A4988 @@ -748,7 +749,7 @@ * Override with M92 * X, Y, Z, E0 [, E1[, E2...]] */ -#define DEFAULT_AXIS_STEPS_PER_UNIT { 161.0, 161.0, 800, 820 } +#define DEFAULT_AXIS_STEPS_PER_UNIT { 160.0, 160.0, 400, 205.0 } /** * Default Max Feed Rate (mm/s) @@ -784,7 +785,7 @@ * M204 T Travel Acceleration */ // @efim-a-efim - decreased E0 acceleration to make it less noisy (yes, even with TMC2208 drivers) -#define DEFAULT_ACCELERATION 1100 // X, Y, Z and E acceleration for printing moves +#define DEFAULT_ACCELERATION 1200 // X, Y, Z and E acceleration for printing moves #define DEFAULT_RETRACT_ACCELERATION 800 // E acceleration for retracts #define DEFAULT_TRAVEL_ACCELERATION 1200 // X, Y, Z acceleration for travel (non printing) moves @@ -1018,8 +1019,8 @@ * A total of 2 does fast/slow probes with a weighted average. * A total of 3 or more adds more slow probes, taking the average. */ -#define MULTIPLE_PROBING 2 -//#define EXTRA_PROBING 1 +#define MULTIPLE_PROBING 3 +#define EXTRA_PROBING 1 /** * Z probes require clearance when deploying, stowing, and moving between @@ -1043,8 +1044,8 @@ #define Z_PROBE_LOW_POINT -2 // Farthest distance below the trigger-point to go before stopping // For M851 give a range for adjusting the Z probe offset -#define Z_PROBE_OFFSET_RANGE_MIN -20 -#define Z_PROBE_OFFSET_RANGE_MAX 20 +#define Z_PROBE_OFFSET_RANGE_MIN -5 +#define Z_PROBE_OFFSET_RANGE_MAX 5 // Enable the M48 repeatability test to test probe accuracy #define Z_MIN_PROBE_REPEATABILITY_TEST @@ -1268,8 +1269,8 @@ */ //#define AUTO_BED_LEVELING_3POINT //#define AUTO_BED_LEVELING_LINEAR -#define AUTO_BED_LEVELING_BILINEAR -//#define AUTO_BED_LEVELING_UBL +//#define AUTO_BED_LEVELING_BILINEAR +#define AUTO_BED_LEVELING_UBL //#define MESH_BED_LEVELING /** @@ -1347,7 +1348,7 @@ //#define MESH_EDIT_GFX_OVERLAY // Display a graphics overlay while editing the mesh - #define MESH_INSET 20 // Set Mesh bounds as an inset region of the bed + #define MESH_INSET 5 // Set Mesh bounds as an inset region of the bed #define GRID_MAX_POINTS_X 10 // Don't use more than 15 points per axis, implementation limited. #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X @@ -1427,8 +1428,8 @@ #endif // Homing speeds (mm/m) -#define HOMING_FEEDRATE_XY (50*50) -#define HOMING_FEEDRATE_Z (50*50) +#define HOMING_FEEDRATE_XY (60*60) +#define HOMING_FEEDRATE_Z (4*60) // Validate that endstops are triggered on homing moves #define VALIDATE_HOMING_ENDSTOPS @@ -1775,7 +1776,7 @@ EEPROM_W25Q * * :['JAPANESE', 'WESTERN', 'CYRILLIC'] */ -#define DISPLAY_CHARSET_HD44780 JAPANESE +#define DISPLAY_CHARSET_HD44780 CYRILLIC /** * Info Screen Style (0:Classic, 1:Průša) @@ -1824,7 +1825,7 @@ EEPROM_W25Q // This option overrides the default number of encoder pulses needed to // produce one step. Should be increased for high-resolution encoders. // -//#define ENCODER_PULSES_PER_STEP 4 +#define ENCODER_PULSES_PER_STEP 4 // // Use this option to override the number of step signals required to diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 4916722215..31f10c9659 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1703,10 +1703,10 @@ #if EITHER(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL) // Override the mesh area if the automatic (max) area is too large - //#define MESH_MIN_X MESH_INSET - //#define MESH_MIN_Y MESH_INSET - //#define MESH_MAX_X X_BED_SIZE - (MESH_INSET) - //#define MESH_MAX_Y Y_BED_SIZE - (MESH_INSET) + #define MESH_MIN_X MESH_INSET + #define MESH_MIN_Y MESH_INSET + #define MESH_MAX_X X_BED_SIZE - (MESH_INSET) + #define MESH_MAX_Y Y_BED_SIZE - (MESH_INSET) #endif /** @@ -2096,7 +2096,7 @@ // This short retract is done immediately, before parking the nozzle. #define FILAMENT_CHANGE_UNLOAD_FEEDRATE 10 // (mm/s) Unload filament feedrate. This can be pretty fast. #define FILAMENT_CHANGE_UNLOAD_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate. - #define FILAMENT_CHANGE_UNLOAD_LENGTH 710 // (mm) The length of filament for a complete unload. + #define FILAMENT_CHANGE_UNLOAD_LENGTH 100 // (mm) The length of filament for a complete unload. // For Bowden, the full length of the tube and nozzle. // For direct drive, the full length of the nozzle. // Set to 0 for manual unloading. @@ -2105,7 +2105,7 @@ // 0 to disable start loading and skip to fast load only #define FILAMENT_CHANGE_FAST_LOAD_FEEDRATE 6 // (mm/s) Load filament feedrate. This can be pretty fast. #define FILAMENT_CHANGE_FAST_LOAD_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate. - #define FILAMENT_CHANGE_FAST_LOAD_LENGTH 710 // (mm) Load length of filament, from extruder gear to nozzle. + #define FILAMENT_CHANGE_FAST_LOAD_LENGTH 100 // (mm) Load length of filament, from extruder gear to nozzle. // For Bowden, the full length of the tube and nozzle. // For direct drive, the full length of the nozzle. #define ADVANCED_PAUSE_CONTINUOUS_PURGE // Purge continuously up to the purge length until interrupted. @@ -2300,7 +2300,7 @@ #if AXIS_IS_TMC(Z) #define Z_CURRENT 800 #define Z_CURRENT_HOME Z_CURRENT - #define Z_MICROSTEPS 32 + #define Z_MICROSTEPS 16 #define Z_RSENSE 0.11 #define Z_CHAIN_POS -1 #endif @@ -2330,8 +2330,8 @@ #endif #if AXIS_IS_TMC(E0) - #define E0_CURRENT 800 - #define E0_MICROSTEPS 32 + #define E0_CURRENT 650 + #define E0_MICROSTEPS 8 #define E0_RSENSE 0.11 #define E0_CHAIN_POS -1 #endif diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 7f36e3a00e..56ccf52795 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -549,7 +549,7 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) { // key kill key press // ------------------------------------------------------------------------------- static int killCount = 0; // make the inactivity button a bit less responsive - const int KILL_DELAY = 750; + const int KILL_DELAY = 100000; if (kill_state()) killCount++; else if (killCount > 0) @@ -566,16 +566,16 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) { #ifdef LED_SW_PIN static int LedSw_Count = 0; // make the inactivity button a bit less responsive - const int LED_SW_DELAY = 100; - bool led_pin_status = !READ(LED_SW_PIN); - if (led_pin_status && LedSw_Count <= LED_SW_DELAY) - LedSw_Count++; - else if (!led_pin_status) - LedSw_Count = 0; - if (LedSw_Count == LED_SW_DELAY){ + const int LED_SW_DELAY = 1000; + bool led_pin_status = READ(LED_SW_PIN); + if (LedSw_Count == LED_SW_DELAY && !led_pin_status){ caselight.on = !caselight.on; caselight.update(true); } + if (led_pin_status && LedSw_Count < LED_SW_DELAY) + LedSw_Count++; + else if (!led_pin_status) + LedSw_Count = 0; #endif #if HAS_HOME 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 b8ff9df34b..57935dd78d 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h @@ -202,6 +202,14 @@ https://easyeda.com/sst78rust/fb4s-led-control #define FAN_PIN PB1 // FAN +/* +Управление питанием +*/ +#define SUICIDE_PIN PB2 +#define SUICIDE_PIN_INVERTING false +#define KILL_PIN PA2 // Enable MKSPWC DET PIN +#define KILL_PIN_STATE true // Enable MKSPWC PIN STATE + // // Thermocouples // @@ -237,7 +245,7 @@ https://easyeda.com/sst78rust/fb4s-led-control //#define PS_ON_PIN PB2 // PW_OFF #define FIL_RUNOUT_PIN PA4 #ifdef CASE_LED_INSTEAD_E1 - #define LED_SW_PIN PE6 + #define LED_SW_PIN PA2//PE6 #endif #ifndef LED_SW_PIN #define FIL_RUNOUT2_PIN PE6 From 87b632dc0fd4e174d675c1d6b09ad03a9f6aa21c Mon Sep 17 00:00:00 2001 From: X-Dron Date: Tue, 29 Dec 2020 17:55:24 +0300 Subject: [PATCH 9/9] Update Configuration.h --- Marlin/Configuration.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 6e39d3a047..52efeef6a3 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -749,7 +749,7 @@ * Override with M92 * X, Y, Z, E0 [, E1[, E2...]] */ -#define DEFAULT_AXIS_STEPS_PER_UNIT { 160.0, 160.0, 400, 205.0 } +#define DEFAULT_AXIS_STEPS_PER_UNIT { 160.5, 160.5, 400, 205.0 } /** * Default Max Feed Rate (mm/s)