Add MKS TFT support

This commit is contained in:
Luc 2019-06-17 22:41:10 +02:00
parent 82f0c74015
commit 1d7b3ff83f
4 changed files with 43 additions and 2 deletions

View File

@ -1935,7 +1935,29 @@ bool COMMAND::check_command (String buffer, tpipe output, bool handlelockserial,
#ifdef SERIAL_COMMAND_FEATURE
if (executecmd) {
String ESP_Command;
int ESPpos = buffer.indexOf ("[ESP");
int ESPpos = -1;
#ifdef MKS_TFT_FEATURE
if (buffer.startsWith("at+")){
//echo
ESPCOM::print (buffer, output);
ESPCOM::print ("\r\r\n", output);
if (buffer.startsWith("at+net_wanip=?")){
String ipstr;
if (WiFi.getMode() == WIFI_STA) {
ipstr = WiFi.localIP().toString() + "," + WiFi.subnetMask().toString()+ "," + WiFi.gatewayIP().toString()+"\r\n";
} else {
ipstr = WiFi.softAPIP().toString() + ",255.255.255.0," + WiFi.softAPIP().toString()+"\r\n";
}
ESPCOM::print (ipstr, output);
} else if (buffer.startsWith("at+wifi_ConState=?")){
ESPCOM::print ("Connected\r\n", output);
} else{
ESPCOM::print ("ok\r\n", output);
}
return false;
}
#endif
ESPpos = buffer.indexOf ("[ESP");
if (ESPpos == -1 && (CONFIG::GetFirmwareTarget() == SMOOTHIEWARE)){
ESPpos = buffer.indexOf ("[esp");
}

View File

@ -19,7 +19,7 @@
*/
//version and sources location
#define FW_VERSION "2.1.0.b27"
#define FW_VERSION "2.1.0.b28"
#define REPOSITORY "https://github.com/luc-github/ESP3D"
//Customize ESP3D ////////////////////////////////////////////////////////////////////////
@ -51,6 +51,9 @@
//NOTIFICATION_FEATURE : allow to push notifications
#define NOTIFICATION_FEATURE
//MKS TFT WIFI support see Wiki for wiring
//#define MKS_TFT_FEATURE
//MDNS_FEATURE: this feature allow type the name defined
//in web browser by default: http:\\esp8266.local and connect
#define MDNS_FEATURE

View File

@ -121,6 +121,9 @@ void Esp3D::begin(uint16_t startdelayms, uint16_t recoverydelayms)
data_server = NULL;
#endif
#ifdef MKS_TFT_FEATURE
startdelayms = 1000;
#endif
#ifdef ESP_OLED_FEATURE
uint32_t start_display_time = millis();
uint32_t now = millis();

View File

@ -179,7 +179,9 @@ void onWiFiEvent(WiFiEvent_t event){
switch (event) {
case WIFI_EVENT_STAMODE_CONNECTED:
#ifndef MKS_TFT_FEATURE
ESPCOM::println (F ("Connected"), PRINTER_PIPE);
#endif
#ifdef ESP_OLED_FEATURE
OLED_DISPLAY::display_signal(wifi_config.getSignal (WiFi.RSSI ()));
OLED_DISPLAY::setCursor(0, 0);
@ -196,7 +198,9 @@ void onWiFiEvent(WiFiEvent_t event){
#endif
break;
case WIFI_EVENT_STAMODE_GOT_IP:
#ifndef MKS_TFT_FEATURE
ESPCOM::println (WiFi.localIP().toString().c_str(), PRINTER_PIPE);
#endif
#ifdef ESP_OLED_FEATURE
OLED_DISPLAY::setCursor(0, 16);
ESPCOM::print(WiFi.localIP().toString().c_str(), OLED_PIPE);
@ -273,9 +277,12 @@ bool WIFI_CONFIG::Setup (bool force_ap)
#ifdef ESP_OLED_FEATURE
OLED_DISPLAY::display_signal(100);
OLED_DISPLAY::setCursor(0, 0);
ESPCOM::print(sbuf, OLED_PIPE);
#else
#ifndef MKS_TFT_FEATURE
ESPCOM::println (sbuf, PRINTER_PIPE);
#endif
#endif
LOG ("SSID ")
LOG (sbuf)
@ -411,7 +418,9 @@ bool WIFI_CONFIG::Setup (bool force_ap)
return false;
}
#ifndef MKS_TFT_FEATURE
ESPCOM::println (sbuf, PRINTER_PIPE);
#endif
#ifdef ESP_OLED_FEATURE
OLED_DISPLAY::display_signal(-1);
OLED_DISPLAY::setCursor(0, 0);
@ -512,13 +521,17 @@ bool WIFI_CONFIG::Setup (bool force_ap)
if (dot == 4) {
dot = 0;
}
#ifndef MKS_TFT_FEATURE
ESPCOM::println (msg, PRINTER_PIPE);
#endif
delay (500);
i++;
}
if (WiFi.status() != WL_CONNECTED) {
#ifndef MKS_TFT_FEATURE
ESPCOM::println (F ("Not Connected!"), PRINTER_PIPE);
#endif
return false;
}
#ifdef ARDUINO_ARCH_ESP8266