From 0b8c529c03ad7f58f2115e0ce3341fc30586270f Mon Sep 17 00:00:00 2001 From: Sergey Date: Fri, 6 Nov 2020 12:10:42 +0300 Subject: [PATCH 1/2] Merge PR16 --- Marlin/Configuration.h | 2 +- Marlin/Configuration_adv.h | 4 ++-- Marlin/src/MarlinCore.cpp | 10 +++++++--- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h | 2 ++ Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h | 1 + 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index d730c603e1..7226b452ad 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -558,7 +558,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 diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 883121c482..433b5412d7 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -794,7 +794,7 @@ // // Add the G35 command to read bed corners to help adjust screws. Requires a bed probe. // -#define ASSISTED_TRAMMING +//#define ASSISTED_TRAMMING #if ENABLED(ASSISTED_TRAMMING) // Define positions for probing points, use the hotend as reference not the sensor. @@ -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 diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index e238edeeeb..932c718aee 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -969,9 +969,13 @@ void setup() { uint32_t serial_connect_timeout = millis() + 1000UL; while (!MYSERIAL0 && PENDING(millis(), serial_connect_timeout)) { /*nada*/ } #if HAS_MULTI_SERIAL - MYSERIAL1.begin(BAUDRATE); - serial_connect_timeout = millis() + 1000UL; - while (!MYSERIAL1 && PENDING(millis(), serial_connect_timeout)) { /*nada*/ } + #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 SERIAL_ECHO_MSG("start"); diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h index 1e23089e74..ebd8c63df6 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h @@ -279,6 +279,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 3fa07f1a5d..997daf72bc 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h @@ -439,6 +439,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 7bad09ebe14d90afadfc0b154422c899e9e8fe45 Mon Sep 17 00:00:00 2001 From: Sergey Date: Fri, 6 Nov 2020 12:22:32 +0300 Subject: [PATCH 2/2] Fix float print --- Marlin/Configuration_adv.h | 6 +++--- 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 ++ 5 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 433b5412d7..dea6cca66a 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 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/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);