tidy up EMSESP_DEBUG

This commit is contained in:
proddy
2024-09-15 18:09:15 +02:00
parent 3e9b18222b
commit 77b5e934a3
9 changed files with 30 additions and 52 deletions

View File

@@ -686,7 +686,7 @@ void EMSESPShell::end_of_transmission() {
void EMSESPShell::main_help_function(Shell & shell, const std::vector<std::string> & arguments) {
shell.println();
#ifndef EMSESP_DEBUG
#if defined(EMSESP_DEBUG)
shell.printfln("%s%sEMS-ESP version %s%s", COLOR_BRIGHT_GREEN, COLOR_BOLD_ON, EMSESP_APP_VERSION, COLOR_RESET);
#else
shell.printfln("%s%sEMS-ESP version %s%s (DEBUG)", COLOR_BRIGHT_GREEN, COLOR_BOLD_ON, EMSESP_APP_VERSION, COLOR_RESET);

View File

@@ -1682,8 +1682,8 @@ bool EMSdevice::generate_values(JsonObject output, const int8_t tag_filter, cons
// do not overwrite
if (json.containsKey(name)) {
#ifdef EMSESP_DEBUG
EMSESP::logger().debug("double json key: %s", name);
#if defined(EMSESP_DEBUG)
EMSESP::logger().debug("warning: double json key: %s", name);
#endif
continue;
}

View File

@@ -132,19 +132,6 @@ class Telegram {
// check for out of bounds, if so don't modify the value
auto msg_size = (index - this->offset + num_bytes - 1);
#ifdef EMSESP_DEBUG
// Serial.print(" index: ");
// Serial.print(index);
// Serial.print(" offset: ");
// Serial.print(offset);
// Serial.print(" index: ");
// Serial.print(" message_length: ");
// Serial.print(this->message_length);
// Serial.print(" msg_size: ");
// Serial.print(msg_size);
// Serial.println();
#endif
if ((index < this->offset) || (msg_size >= this->message_length) || (msg_size > EMS_MAX_TELEGRAM_MESSAGE_LENGTH)) {
return false;
}
@@ -443,13 +430,8 @@ class TxService : public EMSbus {
return tx_telegrams_.empty();
}
#if defined(EMSESP_DEBUG)
static constexpr uint8_t MAXIMUM_TX_RETRIES = 0; // when compiled with EMSESP_DEBUG don't retry
#else
static constexpr uint8_t MAXIMUM_TX_RETRIES = 3;
#endif
static constexpr uint32_t POST_SEND_DELAY = 2000;
static constexpr uint8_t MAXIMUM_TX_RETRIES = 3;
static constexpr uint32_t POST_SEND_DELAY = 2000;
private:
std::deque<QueuedTxTelegram> tx_telegrams_; // the Tx queue

View File

@@ -93,7 +93,7 @@ StateUpdateResult WebSettings::update(JsonObject root, WebSettings & settings) {
bool psram = false;
#endif
#ifdef EMSESP_DEBUG
#if defined(EMSESP_DEBUG)
EMSESP::logger().debug("NVS boot value=[%s], board profile=[%s], EMSESP_DEFAULT_BOARD_PROFILE=[%s]",
EMSESP::nvs_.getString("boot").c_str(),
root["board_profile"] | "",
@@ -111,7 +111,7 @@ StateUpdateResult WebSettings::update(JsonObject root, WebSettings & settings) {
if (!EMSESP::system_.getBBQKeesGatewayDetails().isEmpty()) {
String nvs_boot = EMSESP::nvs_.getString("boot");
if (!nvs_boot.isEmpty()) {
#ifdef EMSESP_DEBUG
#if defined(EMSESP_DEBUG)
EMSESP::logger().debug("Overriding board profile with NVS boot value %s");
#endif
settings.board_profile = nvs_boot;
@@ -145,7 +145,7 @@ StateUpdateResult WebSettings::update(JsonObject root, WebSettings & settings) {
// still don't have a valid board profile. Let's see if we can determine one
if (settings.board_profile == "default") {
#ifdef EMSESP_DEBUG
#if defined(EMSESP_DEBUG)
EMSESP::logger().debug("Trying to detect board and set board profile...");
#endif

View File

@@ -82,7 +82,7 @@ void WebStatusService::systemStatus(AsyncWebServerRequest * request) {
#endif
}
#ifdef EMSESP_DEBUG
#if defined(EMSESP_DEBUG)
#ifdef EMSESP_TEST
root["build_flags"] = "DEBUG,TEST";
#else
@@ -155,7 +155,7 @@ void WebStatusService::checkUpgrade(AsyncWebServerRequest * request, JsonVariant
const std::string latest_version = json["version"] | EMSESP_APP_VERSION;
version::Semver200_version this_version(latest_version);
#ifdef EMSESP_DEBUG
#if defined(EMSESP_DEBUG)
emsesp::EMSESP::logger().debug("Checking for upgrade: %s > %s", EMSESP_APP_VERSION, latest_version.c_str());
#endif