From bc8a840695bd719a20279601bc6a2dbceccda798 Mon Sep 17 00:00:00 2001 From: proddy Date: Fri, 16 Aug 2024 16:14:07 +0200 Subject: [PATCH] fix sonar compile --- src/emsdevice.cpp | 2 +- src/emsesp.cpp | 2 ++ src/helpers.cpp | 4 +++- src/web/WebStatusService.cpp | 2 ++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/emsdevice.cpp b/src/emsdevice.cpp index 7d654cd97..630a109f7 100644 --- a/src/emsdevice.cpp +++ b/src/emsdevice.cpp @@ -1834,7 +1834,7 @@ void EMSdevice::mqtt_ha_entity_config_create() { #endif } } -#ifdef EMSESP_DEBUG +#if defined(EMSESP_DEBUG) || defined(EMSESP_STANDALONE) if (count) { EMSESP::logger().debug("Created %d HA-%s-configs", count, device_type_name()); } diff --git a/src/emsesp.cpp b/src/emsesp.cpp index 7e6200f38..6de204f29 100644 --- a/src/emsesp.cpp +++ b/src/emsesp.cpp @@ -1538,7 +1538,9 @@ EMSESP::EMSESP() // start all the core services // the services must be loaded in the correct order void EMSESP::start() { +#ifndef EMSESP_STANDALONE system_.PSram(ESP.getPsramSize()); +#endif // don't need shell if running unit tests #ifndef EMSESP_UNITY // Serial console's shell diff --git a/src/helpers.cpp b/src/helpers.cpp index 4cef43871..8b1e3ab1c 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -379,7 +379,9 @@ std::string Helpers::data_to_hex(const uint8_t * data, const uint8_t length) { return ""; } - char str[length * 3] = {0}; + char str[length * 3]; + memset(str, 0, length * sizeof(char)); + char buffer[4]; char * p = &str[0]; for (uint8_t i = 0; i < length; i++) { diff --git a/src/web/WebStatusService.cpp b/src/web/WebStatusService.cpp index 6b2c108eb..d2eb47648 100644 --- a/src/web/WebStatusService.cpp +++ b/src/web/WebStatusService.cpp @@ -81,6 +81,7 @@ void WebStatusService::systemStatus(AsyncWebServerRequest * request) { #endif } +#ifndef EMSESP_STANDALONE const esp_partition_t * partition = esp_partition_find_first(ESP_PARTITION_TYPE_APP, ESP_PARTITION_SUBTYPE_APP_FACTORY, nullptr); root["has_loader"] = partition != NULL && partition != esp_ota_get_running_partition(); partition = esp_ota_get_next_update_partition(nullptr); @@ -91,6 +92,7 @@ void WebStatusService::systemStatus(AsyncWebServerRequest * request) { } else { root["has_partition"] = false; } +#endif response->setLength(); request->send(response);