mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-12 15:39:06 +08:00
parent
1bdcc4f597
commit
717754eb3e
@ -165,5 +165,8 @@ Get will give type and settings only not the protected T1/T2
|
|||||||
* Get fw target
|
* Get fw target
|
||||||
[ESP801]<header answer>
|
[ESP801]<header answer>
|
||||||
|
|
||||||
|
* Get state / Set Enable / Disable Serial Communication
|
||||||
|
[ESP900]<ENABLE/DISABLE>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1909,6 +1909,37 @@ bool COMMAND::execute_command (int cmd, String cmd_params, tpipe output, level_a
|
|||||||
case 810:
|
case 810:
|
||||||
web_interface->blockserial = false;
|
web_interface->blockserial = false;
|
||||||
break;
|
break;
|
||||||
|
case 900:
|
||||||
|
parameter = get_param (cmd_params, "", true);
|
||||||
|
#ifdef AUTHENTICATION_FEATURE
|
||||||
|
if (auth_type == LEVEL_GUEST) {
|
||||||
|
ESPCOM::println (INCORRECT_CMD_MSG, output, espresponse);
|
||||||
|
response = false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if (parameter.length() == 0) {
|
||||||
|
if (CONFIG::is_com_enabled) {
|
||||||
|
ESPCOM::print (F ("ENABLED"), output, espresponse);
|
||||||
|
} else {
|
||||||
|
ESPCOM::print (F ("DISABLED"), output, espresponse);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (parameter == "ENABLE") {
|
||||||
|
CONFIG::DisableSerial();
|
||||||
|
if (!CONFIG::InitBaudrate()){
|
||||||
|
ESPCOM::print (F ("Cannot enable serial communication"), output, espresponse);
|
||||||
|
} else {
|
||||||
|
ESPCOM::print (F ("Enable serial communication"), output, espresponse);
|
||||||
|
}
|
||||||
|
} else if (parameter == "DISABLE") {
|
||||||
|
ESPCOM::print (F ("Disable serial communication"), output, espresponse);
|
||||||
|
CONFIG::DisableSerial();
|
||||||
|
} else {
|
||||||
|
ESPCOM::println (INCORRECT_CMD_MSG, output, espresponse);
|
||||||
|
response = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ESPCOM::println (INCORRECT_CMD_MSG, output, espresponse);
|
ESPCOM::println (INCORRECT_CMD_MSG, output, espresponse);
|
||||||
|
@ -49,7 +49,7 @@ extern DHTesp dht;
|
|||||||
|
|
||||||
uint8_t CONFIG::FirmwareTarget = UNKNOWN_FW;
|
uint8_t CONFIG::FirmwareTarget = UNKNOWN_FW;
|
||||||
byte CONFIG::output_flag = DEFAULT_OUTPUT_FLAG;
|
byte CONFIG::output_flag = DEFAULT_OUTPUT_FLAG;
|
||||||
|
bool CONFIG::is_com_enabled = false;
|
||||||
#ifdef DHT_FEATURE
|
#ifdef DHT_FEATURE
|
||||||
byte CONFIG::DHT_type = DEFAULT_DHT_TYPE;
|
byte CONFIG::DHT_type = DEFAULT_DHT_TYPE;
|
||||||
int CONFIG::DHT_interval = DEFAULT_DHT_INTERVAL;
|
int CONFIG::DHT_interval = DEFAULT_DHT_INTERVAL;
|
||||||
@ -162,6 +162,21 @@ void CONFIG::InitDirectSD()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CONFIG::DisableSerial()
|
||||||
|
{
|
||||||
|
#ifdef USE_SERIAL_0
|
||||||
|
Serial.end();
|
||||||
|
#endif
|
||||||
|
#ifdef USE_SERIAL_1
|
||||||
|
Serial1.end();
|
||||||
|
#endif
|
||||||
|
#ifdef USE_SERIAL_2
|
||||||
|
Serial2.end();
|
||||||
|
#endif
|
||||||
|
CONFIG::is_com_enabled = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool CONFIG::InitBaudrate(long value)
|
bool CONFIG::InitBaudrate(long value)
|
||||||
{
|
{
|
||||||
long baud_rate = 0;
|
long baud_rate = 0;
|
||||||
@ -214,6 +229,7 @@ bool CONFIG::InitBaudrate(long value)
|
|||||||
|
|
||||||
wifi_config.baud_rate = baud_rate;
|
wifi_config.baud_rate = baud_rate;
|
||||||
delay (100);
|
delay (100);
|
||||||
|
CONFIG::is_com_enabled = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//version and sources location
|
//version and sources location
|
||||||
#define FW_VERSION "2.1.0.b32"
|
#define FW_VERSION "2.1.0.b33"
|
||||||
#define REPOSITORY "https://github.com/luc-github/ESP3D"
|
#define REPOSITORY "https://github.com/luc-github/ESP3D"
|
||||||
|
|
||||||
//Customize ESP3D ////////////////////////////////////////////////////////////////////////
|
//Customize ESP3D ////////////////////////////////////////////////////////////////////////
|
||||||
@ -530,6 +530,7 @@ public:
|
|||||||
static int DHT_interval;
|
static int DHT_interval;
|
||||||
static void InitDHT(bool refresh = false);
|
static void InitDHT(bool refresh = false);
|
||||||
#endif
|
#endif
|
||||||
|
static bool is_com_enabled;
|
||||||
static bool is_locked(byte flag);
|
static bool is_locked(byte flag);
|
||||||
static bool is_direct_sd;
|
static bool is_direct_sd;
|
||||||
static bool read_string (int pos, char byte_buffer[], int size_max);
|
static bool read_string (int pos, char byte_buffer[], int size_max);
|
||||||
@ -548,6 +549,7 @@ public:
|
|||||||
static void InitDirectSD();
|
static void InitDirectSD();
|
||||||
static void InitPins();
|
static void InitPins();
|
||||||
static bool InitBaudrate(long value = 0);
|
static bool InitBaudrate(long value = 0);
|
||||||
|
static bool DisableSerial();
|
||||||
static bool InitExternalPorts();
|
static bool InitExternalPorts();
|
||||||
static uint8_t GetFirmwareTarget();
|
static uint8_t GetFirmwareTarget();
|
||||||
static const char* GetFirmwareTargetName();
|
static const char* GetFirmwareTargetName();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user