diff --git a/lib/MyESP/MyESP.cpp b/lib/MyESP/MyESP.cpp index 8e68bd862..853b4b381 100644 --- a/lib/MyESP/MyESP.cpp +++ b/lib/MyESP/MyESP.cpp @@ -44,8 +44,7 @@ MyESP::MyESP() { _web_callback = NULL; - _serial = false; - _serial_default = false; + _serial = false; _heartbeat = false; _mqtt_host = NULL; @@ -560,13 +559,6 @@ void MyESP::_telnet_setup() { SerialAndTelnet.setDebugOutput(false); 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 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 void MyESP::setUseSerial(bool b) { - _serial_default = _serial = b; + _serial = b; SerialAndTelnet.setSerial(b ? &Serial : NULL); } @@ -1549,10 +1541,14 @@ bool MyESP::_fs_loadConfig() { value = json["mqtt_password"]; _mqtt_password = (value) ? strdup(value) : NULL; - _serial = json["serial"] | _serial_default; - _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 // ok is false if there's a problem loading a custom setting (e.g. does not exist) diff --git a/lib/MyESP/MyESP.h b/lib/MyESP/MyESP.h index d6eedb803..d4d5f4573 100644 --- a/lib/MyESP/MyESP.h +++ b/lib/MyESP/MyESP.h @@ -379,7 +379,6 @@ class MyESP { char * _boottime; bool _suspendOutput; bool _serial; - bool _serial_default; bool _heartbeat; unsigned long _getUptime(); String _buildTime(); diff --git a/platformio.ini-example b/platformio.ini-example index c99ece822..3293cefdb 100644 --- a/platformio.ini-example +++ b/platformio.ini-example @@ -7,7 +7,7 @@ default_envs = debug [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 [env] diff --git a/src/ems.cpp b/src/ems.cpp index 45d723786..a217ddb25 100644 --- a/src/ems.cpp +++ b/src/ems.cpp @@ -2747,6 +2747,6 @@ void ems_testTelegram(uint8_t test_num) { // go an parse it ems_parseTelegram(telegram, length + 1); // include CRC in length #else - myDebug_P(PSTR("Firmware not compiled with test data set")); + myDebug_P(PSTR("Firmware not compiled with test data. Use -DTESTS")); #endif }