fixes #1926 - serial shell not working

This commit is contained in:
proddy
2024-08-05 10:50:51 +02:00
parent 38ae744a10
commit 66ed8a1e17
8 changed files with 19 additions and 22 deletions

View File

@@ -1539,25 +1539,22 @@ EMSESP::EMSESP()
// the services must be loaded in the correct order
void EMSESP::start() {
// don't need shell if running unit tests
#if !defined(UNITY_INCLUDE_CONFIG_H)
#ifndef EMSESP_UNITY
// Serial console's shell
serial_console_.begin(SERIAL_CONSOLE_BAUD_RATE);
shell_ = std::make_shared<EMSESPConsole>(*this, serial_console_, true);
shell_->maximum_log_messages(100);
shell_->start();
#if defined(EMSESP_DEBUG)
shell_->log_level(uuid::log::Level::DEBUG);
#else
shell_->log_level(uuid::log::Level::TRACE);
#endif
#if defined(EMSESP_STANDALONE)
shell_->add_flags(CommandFlags::ADMIN); // always start in su/admin mode when running tests
#endif
#else
#warning "Shell is disabled when running Unity tests."
#endif
// start the file system

View File

@@ -1544,7 +1544,7 @@ bool System::command_info(const char * value, const int8_t id, JsonObject output
node = output["api"].to<JsonObject>();
// if we're generating test data for Unit Tests we dont want to count these API calls as it will pollute the data response
#if defined(UNITY_INCLUDE_CONFIG_H)
#if defined(EMSESP_UNITY)
node["APICalls"] = 0;
node["APIFails"] = 0;
#else
@@ -1618,7 +1618,7 @@ bool System::command_info(const char * value, const int8_t id, JsonObject output
node["analogEnabled"] = settings.analog_enabled;
node["telnetEnabled"] = settings.telnet_enabled;
node["maxWebLogBuffer"] = settings.weblog_buffer;
#if defined(UNITY_INCLUDE_CONFIG_H)
#if defined(EMSESP_UNITY)
node["webLogBuffer"] = 0;
#else
node["webLogBuffer"] = EMSESP::webLogService.num_log_messages();

View File

@@ -1 +1 @@
#define EMSESP_APP_VERSION "3.7.0-dev.29"
#define EMSESP_APP_VERSION "3.7.0-dev.30"

View File

@@ -138,7 +138,7 @@ void WebAPIService::parse(AsyncWebServerRequest * request, JsonObject input) {
// store the result so we can test with Unity later
storeResponse(output);
#endif
#if defined(EMSESP_STANDALONE) && !defined(UNITY_INCLUDE_CONFIG_H)
#if defined(EMSESP_STANDALONE) && !defined(EMSESP_UNITY)
Serial.printf("%sweb output: %s[%s] %s(200)%s ", COLOR_WHITE, COLOR_BRIGHT_CYAN, request->url().c_str(), COLOR_BRIGHT_GREEN, COLOR_MAGENTA);
serializeJson(output, Serial);
Serial.println(COLOR_RESET);
@@ -165,7 +165,7 @@ void WebAPIService::parse(AsyncWebServerRequest * request, JsonObject input) {
// store the result so we can test with Unity later
storeResponse(output);
#endif
#if defined(EMSESP_STANDALONE) && !defined(UNITY_INCLUDE_CONFIG_H)
#if defined(EMSESP_STANDALONE) && !defined(EMSESP_UNITY)
Serial.printf("%sweb output: %s[%s]", COLOR_WHITE, COLOR_BRIGHT_CYAN, request->url().c_str());
Serial.printf(" %s(%d)%s ", ret_codes[return_code] == 200 ? COLOR_BRIGHT_GREEN : COLOR_BRIGHT_RED, ret_codes[return_code], COLOR_YELLOW);
serializeJson(output, Serial);