Browse Source

Fix build without MKS_WIFI

pull/45/head
Sergey 4 years ago
parent
commit
80a7af65d2
  1. 9
      Marlin/src/core/serial_hook.h
  2. 9
      Marlin/src/module/mks_wifi/mks_wifi.cpp
  3. 10
      Marlin/src/module/mks_wifi/mks_wifi.h

9
Marlin/src/core/serial_hook.h

@ -22,10 +22,6 @@
#pragma once #pragma once
#include "serial_base.h" #include "serial_base.h"
//#if ENABLED(MKS_WIFI)
//#include "../module/mks_wifi/mks_wifi.h"
//#endif
void mks_wifi_out_add(uint8_t *data, uint32_t size); void mks_wifi_out_add(uint8_t *data, uint32_t size);
// A mask containing a bitmap of the serial port to act upon // A mask containing a bitmap of the serial port to act upon
@ -216,10 +212,7 @@ struct MultiSerial : public SerialBase< MultiSerial<Serial0T, Serial1T, offset,
NO_INLINE void write(uint8_t c) { NO_INLINE void write(uint8_t c) {
if (portMask.enabled(FirstOutput)) serial0.write(c); if (portMask.enabled(FirstOutput)) serial0.write(c);
if (portMask.enabled(SecondOutput)) { if (portMask.enabled(SecondOutput)) mks_wifi_out_add((uint8_t *)&c,1);
mks_wifi_out_add((uint8_t *)&c,1);
//serial1.write(c);
};
} }
NO_INLINE void msgDone() { NO_INLINE void msgDone() {
if (portMask.enabled(FirstOutput)) serial0.msgDone(); if (portMask.enabled(FirstOutput)) serial0.msgDone();

9
Marlin/src/module/mks_wifi/mks_wifi.cpp

@ -1,4 +1,6 @@
#include "mks_wifi.h" #include "mks_wifi.h"
#ifdef MKS_WIFI #ifdef MKS_WIFI
#include "../../lcd/marlinui.h" #include "../../lcd/marlinui.h"
@ -372,5 +374,12 @@ void mks_wifi_send(uint8_t *packet, uint16_t size){
MYSERIAL2.write(packet[i]); MYSERIAL2.write(packet[i]);
} }
} }
#else
void mks_wifi_out_add(uint8_t *data, uint32_t size){
while(size--){
MYSERIAL2.write(*data++);
}
return;
};
#endif #endif

10
Marlin/src/module/mks_wifi/mks_wifi.h

@ -1,21 +1,19 @@
#ifndef MKS_WIFI_H #ifndef MKS_WIFI_H
#define MKS_WIFI_H #define MKS_WIFI_H
#include "../../MarlinCore.h" #include "../../MarlinCore.h"
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#include "../../libs/Segger/log.h" #include "../../libs/Segger/log.h"
#include "mks_wifi_settings.h" #include "mks_wifi_settings.h"
void mks_wifi_out_add(uint8_t *data, uint32_t size);
#ifdef MKS_WIFI #ifdef MKS_WIFI
#define MKS_OUT_BUFF_SIZE (ESP_PACKET_DATA_MAX_SIZE) #define MKS_OUT_BUFF_SIZE (ESP_PACKET_DATA_MAX_SIZE)
#define MKS_IN_BUFF_SIZE (ESP_PACKET_DATA_MAX_SIZE + 30) #define MKS_IN_BUFF_SIZE (ESP_PACKET_DATA_MAX_SIZE + 30)
#define MKS_TOTAL_PACKET_SIZE (ESP_PACKET_DATA_MAX_SIZE+10) #define MKS_TOTAL_PACKET_SIZE (ESP_PACKET_DATA_MAX_SIZE+10)
//#define SDIO_TEST_AT_STARTUP
//#define LIST_FILES_AT_STARTUP (uint8_t)1
//#define MKS_WIFI_SERIAL_NUM (uint8_t)1
#define WIFI_MODE_STA (uint8_t)2 #define WIFI_MODE_STA (uint8_t)2
#define WIFI_MODE_AP (uint8_t)1 #define WIFI_MODE_AP (uint8_t)1
@ -51,8 +49,6 @@ void mks_wifi_set_param(void);
uint8_t mks_wifi_input(uint8_t data); uint8_t mks_wifi_input(uint8_t data);
void mks_wifi_parse_packet(ESP_PROTOC_FRAME *packet); void mks_wifi_parse_packet(ESP_PROTOC_FRAME *packet);
void mks_wifi_out_add(uint8_t *data, uint32_t size);
uint16_t mks_wifi_build_packet(uint8_t *packet, ESP_PROTOC_FRAME *esp_frame); uint16_t mks_wifi_build_packet(uint8_t *packet, ESP_PROTOC_FRAME *esp_frame);
uint8_t mks_wifi_check_packet(uint8_t *in_data); uint8_t mks_wifi_check_packet(uint8_t *in_data);

Loading…
Cancel
Save