force serial off

This commit is contained in:
Paul
2019-07-25 10:30:34 +02:00
parent 3fdd086160
commit cac7bfae31
4 changed files with 10 additions and 15 deletions

View File

@@ -45,7 +45,6 @@ MyESP::MyESP() {
_web_callback = NULL; _web_callback = NULL;
_serial = false; _serial = false;
_serial_default = false;
_heartbeat = false; _heartbeat = false;
_mqtt_host = NULL; _mqtt_host = NULL;
@@ -560,13 +559,6 @@ void MyESP::_telnet_setup() {
SerialAndTelnet.setDebugOutput(false); SerialAndTelnet.setDebugOutput(false);
SerialAndTelnet.begin(TELNET_SERIAL_BAUD); // default baud is 115200 SerialAndTelnet.begin(TELNET_SERIAL_BAUD); // default baud is 115200
// serial is only on when booting
#ifdef DEFAULT_NO_SERIAL
_serial_default = false;
#else
_serial_default = true;
#endif
// init command buffer for console commands // init command buffer for console commands
memset(_command, 0, TELNET_MAX_COMMAND_LENGTH); memset(_command, 0, TELNET_MAX_COMMAND_LENGTH);
} }
@@ -790,7 +782,7 @@ bool MyESP::_changeSetting(uint8_t wc, const char * setting, const char * value)
// force the serial on/off // force the serial on/off
void MyESP::setUseSerial(bool b) { void MyESP::setUseSerial(bool b) {
_serial_default = _serial = b; _serial = b;
SerialAndTelnet.setSerial(b ? &Serial : NULL); SerialAndTelnet.setSerial(b ? &Serial : NULL);
} }
@@ -1549,10 +1541,14 @@ bool MyESP::_fs_loadConfig() {
value = json["mqtt_password"]; value = json["mqtt_password"];
_mqtt_password = (value) ? strdup(value) : NULL; _mqtt_password = (value) ? strdup(value) : NULL;
_serial = json["serial"] | _serial_default;
_heartbeat = (bool)json["heartbeat"]; // defaults to off _heartbeat = (bool)json["heartbeat"]; // defaults to off
// serial is only on when booting
#ifdef FORCE_SERIAL
_serial_ = true;
#else
_serial = json["serial"];
#endif
// callback for loading custom settings // callback for loading custom settings
// ok is false if there's a problem loading a custom setting (e.g. does not exist) // ok is false if there's a problem loading a custom setting (e.g. does not exist)

View File

@@ -379,7 +379,6 @@ class MyESP {
char * _boottime; char * _boottime;
bool _suspendOutput; bool _suspendOutput;
bool _serial; bool _serial;
bool _serial_default;
bool _heartbeat; bool _heartbeat;
unsigned long _getUptime(); unsigned long _getUptime();
String _buildTime(); String _buildTime();

View File

@@ -7,7 +7,7 @@
default_envs = debug default_envs = debug
[common] [common]
; -DMYESP_TIMESTAMP -DTESTS -DCRASH -DNO_SERIAL -DNO_GLOBAL_EEPROM -DLOGICANALYZER ; -DMYESP_TIMESTAMP -DTESTS -DCRASH -DFORCE_SERIAL -DNO_GLOBAL_EEPROM -DLOGICANALYZER
extra_flags = -DNO_GLOBAL_EEPROM extra_flags = -DNO_GLOBAL_EEPROM
[env] [env]

View File

@@ -2747,6 +2747,6 @@ void ems_testTelegram(uint8_t test_num) {
// go an parse it // go an parse it
ems_parseTelegram(telegram, length + 1); // include CRC in length ems_parseTelegram(telegram, length + 1); // include CRC in length
#else #else
myDebug_P(PSTR("Firmware not compiled with test data set")); myDebug_P(PSTR("Firmware not compiled with test data. Use -DTESTS"));
#endif #endif
} }