Browse Source

Merge branch 'Sergey1560-FB4S_WIFI' into PR

pull/38/head
X-Dron 4 years ago
parent
commit
48ba69684b
  1. 6
      Marlin/Configuration_adv.h
  2. 22
      Marlin/src/MarlinCore.cpp
  3. 9
      Marlin/src/core/serial.h
  4. 2
      Marlin/src/module/mks_wifi/mks_wifi_sd.cpp
  5. 14
      Marlin/src/module/mks_wifi/mks_wifi_serial_out.cpp
  6. 2
      Marlin/src/module/mks_wifi/mks_wifi_serial_out.h
  7. 2
      Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h
  8. 1
      Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h

6
Marlin/Configuration_adv.h

@ -1612,9 +1612,9 @@
#define BABYSTEP_ALWAYS_AVAILABLE // Allow babystepping at all times (not just during movement). #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_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_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_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_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_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. #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping.
#if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING)

22
Marlin/src/MarlinCore.cpp

@ -965,15 +965,19 @@ void setup() {
#endif #endif
#endif #endif
MYSERIAL0.begin(USB_BAUDRATE); MYSERIAL0.begin(BAUDRATE);
uint32_t serial_connect_timeout = millis() + 1000UL; uint32_t serial_connect_timeout = millis() + 1000UL;
while (!MYSERIAL0 && PENDING(millis(), serial_connect_timeout)) { /*nada*/ } while (!MYSERIAL0 && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
#if HAS_MULTI_SERIAL #if HAS_MULTI_SERIAL
MYSERIAL1.begin(BAUDRATE); #if ENABLED(MKS_WIFI)
serial_connect_timeout = millis() + 1000UL; MYSERIAL1.begin(MKS_WIFI_BAUDRATE);
while (!MYSERIAL1 && PENDING(millis(), serial_connect_timeout)) { /*nada*/ } #else
#endif MYSERIAL1.begin(BAUDRATE);
SERIAL_ECHO_MSG("start"); #endif
serial_connect_timeout = millis() + 1000UL;
while (!MYSERIAL1 && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
#endif
#if BOTH(HAS_TFT_LVGL_UI, USE_WIFI_FUNCTION) #if BOTH(HAS_TFT_LVGL_UI, USE_WIFI_FUNCTION)
mks_esp_wifi_init(); mks_esp_wifi_init();

9
Marlin/src/core/serial.h

@ -58,7 +58,6 @@ extern uint8_t marlin_debug_flags;
#else #else
#define SERIAL_OUT(WHAT, V...) do{ \ #define SERIAL_OUT(WHAT, V...) do{ \
if (!serial_port_index || serial_port_index == SERIAL_BOTH) (void)MYSERIAL0.WHAT(V); \ if (!serial_port_index || serial_port_index == SERIAL_BOTH) (void)MYSERIAL0.WHAT(V); \
if ( serial_port_index) (void)MYSERIAL1.WHAT(V); \
}while(0) }while(0)
#endif #endif
@ -82,8 +81,14 @@ extern uint8_t marlin_debug_flags;
#define SERIAL_ECHO(x) SERIAL_OUT(print, x) #define SERIAL_ECHO(x) SERIAL_OUT(print, x)
#endif #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) #define SERIAL_ECHO_F(V...) SERIAL_OUT(print, V)
#endif
#if ENABLED(MKS_WIFI) #if ENABLED(MKS_WIFI)
#define SERIAL_ECHOLN(x) do{ \ #define SERIAL_ECHOLN(x) do{ \
if (!serial_port_index || serial_port_index == SERIAL_BOTH ) SERIAL_OUT(println, x); \ if (!serial_port_index || serial_port_index == SERIAL_BOTH ) SERIAL_OUT(println, x); \

2
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){ while(dma_timeout-- > 0){
iwdg_feed();
if(DMA1->ISR & DMA_ISR_TCIF5){ if(DMA1->ISR & DMA_ISR_TCIF5){
DMA1->IFCR = DMA_IFCR_CGIF5|DMA_IFCR_CTEIF5|DMA_IFCR_CHTIF5|DMA_IFCR_CTCIF5; DMA1->IFCR = DMA_IFCR_CGIF5|DMA_IFCR_CTEIF5|DMA_IFCR_CHTIF5|DMA_IFCR_CTCIF5;

14
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); 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 // PRINT functions
@ -88,11 +97,6 @@ void mks_wifi_println(double f){
sprintf(str,"%.2f\n",f); sprintf(str,"%.2f\n",f);
mks_wifi_out_add((uint8_t *)str, strnlen((char *)str,ESP_PACKET_DATA_MAX_SIZE)); 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){ void mks_wifi_println(long int i){
mks_wifi_println((int32)i); mks_wifi_println((int32)i);
} }

2
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_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(const char *s);
void mks_wifi_print(int32 i); void mks_wifi_print(int32 i);
void mks_wifi_print(uint32 i); void mks_wifi_print(uint32 i);

2
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h

@ -279,6 +279,8 @@ BlTouch
#define MKS_WIFI #define MKS_WIFI
#ifdef MKS_WIFI #ifdef MKS_WIFI
#define MKS_WIFI_BAUDRATE 115200
#undef PLATFORM_M997_SUPPORT #undef PLATFORM_M997_SUPPORT
#define MKS_WIFI_IO0 PA8 #define MKS_WIFI_IO0 PA8

1
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h

@ -439,6 +439,7 @@ https://easyeda.com/sst78rust/fb4s-led-control
*/ */
#define MKS_WIFI #define MKS_WIFI
#ifdef MKS_WIFI #ifdef MKS_WIFI
#define MKS_WIFI_BAUDRATE 115200
#undef PLATFORM_M997_SUPPORT #undef PLATFORM_M997_SUPPORT
#define MKS_WIFI_IO0 PC13 #define MKS_WIFI_IO0 PC13

Loading…
Cancel
Save