Improve BLE and BLE debug logging

This commit is contained in:
iranl
2024-12-21 21:25:43 +01:00
parent 6877ce0a66
commit 083e83d977
9 changed files with 19 additions and 37 deletions

View File

@@ -77,7 +77,7 @@ extra_scripts =
post:pio_package_post.py
build_flags =
${env.build_flags}
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_NONE
-DCONFIG_NIMBLE_CPP_LOG_LEVEL=0
-DCONFIG_BT_NIMBLE_LOG_LEVEL=0

View File

@@ -86,7 +86,6 @@ CONFIG_HEAP_TASK_TRACKING=n
CONFIG_LOG_COLORS=n
CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=n
CONFIG_LOG_MAXIMUM_LEVEL=4
CONFIG_ARDUHAL_ESP_LOG=y
CONFIG_ETH_ENABLED=y
CONFIG_ETH_USE_SPI_ETHERNET=y
CONFIG_ETH_SPI_ETHERNET_W5500=y
@@ -106,5 +105,4 @@ CONFIG_HTTPD_PURGE_BUF_LEN=32
CONFIG_HTTPD_WS_SUPPORT=y
CONFIG_ESP_HTTPS_SERVER_ENABLE=n
CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE=y
CONFIG_BOOTLOADER_WDT_TIME_MS=90000
CONFIG_LOG_MASTER_LEVEL=y
CONFIG_BOOTLOADER_WDT_TIME_MS=120000

View File

@@ -4,7 +4,3 @@ CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC=y
CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_DEFAULT=y
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=4096
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=50768
CONFIG_LOG_DEFAULT_LEVEL_NONE=y
CONFIG_LOG_DEFAULT_LEVEL=0
CONFIG_ESP_IPC_TASK_STACK_SIZE=1024
CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_NONE

View File

@@ -1,5 +1,5 @@
CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y
CONFIG_LOG_DEFAULT_LEVEL=4
CONFIG_ESP_IPC_TASK_STACK_SIZE=2048
CONFIG_LOG_DEFAULT_LEVEL_NONE=y
CONFIG_LOG_DEFAULT_LEVEL=0
CONFIG_ESP_IPC_TASK_STACK_SIZE=1024
CONFIG_BOOTLOADER_LOG_LEVEL_ERROR=y
CONFIG_BOOTLOADER_LOG_LEVEL=1

View File

@@ -54,12 +54,7 @@ void NukiOpenerWrapper::initialize()
_nukiOpener.setDebugReadableData(_preferences->getBool(preference_debug_readable_data, false));
_nukiOpener.setDebugHexData(_preferences->getBool(preference_debug_hex_data, false));
_nukiOpener.setDebugCommand(_preferences->getBool(preference_debug_command, false));
if (_preferences->getBool(preference_debug_connect, false) || _preferences->getBool(preference_debug_communication, false) || _preferences->getBool(preference_debug_readable_data, false) ||
_preferences->getBool(preference_debug_hex_data, false) || _preferences->getBool(preference_debug_command, false))
{
esp_log_set_level_master(ESP_LOG_DEBUG);
}
_nukiOpener.registerLogger(Log);
_nukiOpener.initialize(_preferences->getBool(preference_connect_mode, true));
_nukiOpener.registerBleScanner(_bleScanner);

View File

@@ -55,12 +55,7 @@ void NukiWrapper::initialize()
_nukiLock.setDebugReadableData(_preferences->getBool(preference_debug_readable_data, false));
_nukiLock.setDebugHexData(_preferences->getBool(preference_debug_hex_data, false));
_nukiLock.setDebugCommand(_preferences->getBool(preference_debug_command, false));
if (_preferences->getBool(preference_debug_connect, false) || _preferences->getBool(preference_debug_communication, false) || _preferences->getBool(preference_debug_readable_data, false) ||
_preferences->getBool(preference_debug_hex_data, false) || _preferences->getBool(preference_debug_command, false))
{
esp_log_set_level_master(ESP_LOG_DEBUG);
}
_nukiLock.registerLogger(Log);
_nukiLock.initialize(_preferences->getBool(preference_connect_mode, true));
_nukiLock.registerBleScanner(_bleScanner);

View File

@@ -8,6 +8,7 @@
#include "esp_task_wdt.h"
#include "Config.h"
#include "esp32-hal-log.h"
#include "hal/wdt_hal.h"
#ifndef NUKI_HUB_UPDATER
#include "NukiWrapper.h"
@@ -110,7 +111,7 @@ int _log_vprintf(const char *fmt, va_list args)
{
Log->write((uint8_t *)log_print_buffer, (size_t)ret);
}
return 0; //return vprintf(fmt, args);
return 0;
}
void setReroute()
@@ -122,6 +123,7 @@ void setReroute()
esp_log_level_set("nvs", ESP_LOG_INFO);
esp_log_level_set("wifi", ESP_LOG_INFO);
#else
/*
esp_log_level_set("*", ESP_LOG_NONE);
esp_log_level_set("httpd", ESP_LOG_ERROR);
esp_log_level_set("httpd_sess", ESP_LOG_ERROR);
@@ -133,7 +135,7 @@ void setReroute()
esp_log_level_set("ARDUINO", ESP_LOG_DEBUG);
esp_log_level_set("nvs", ESP_LOG_ERROR);
esp_log_level_set("wifi", ESP_LOG_ERROR);
*/
#endif
if(preferences->getBool(preference_mqtt_log_enabled))
@@ -352,6 +354,12 @@ esp_err_t _http_event_handler(esp_http_client_event_t *evt)
Log->println("HTTP_EVENT_REDIRECT");
break;
}
wdt_hal_context_t rtc_wdt_ctx = RWDT_HAL_CONTEXT_DEFAULT();
wdt_hal_write_protect_disable(&rtc_wdt_ctx);
wdt_hal_feed(&rtc_wdt_ctx);
wdt_hal_write_protect_enable(&rtc_wdt_ctx);
return ESP_OK;
}
@@ -461,9 +469,6 @@ void setupTasks(bool ota)
void setup()
{
//Set Log level to error for all TAGS
#ifndef DEBUG_NUKIHUB
esp_log_set_level_master(ESP_LOG_ERROR);
#endif
esp_log_level_set("*", ESP_LOG_ERROR);
//Set Log level to none for mqtt TAG
esp_log_level_set("mqtt", ESP_LOG_NONE);

View File

@@ -34,11 +34,6 @@ build_flags =
-DESP32
-DARDUINO_ARCH_ESP32
-DUSE_ESP_IDF_LOG
-DCONFIG_ASYNC_TCP_MAX_ACK_TIME=3000
-DCONFIG_ASYNC_TCP_PRIORITY=10
-DCONFIG_ASYNC_TCP_RUNNING_CORE=1
-DCONFIG_ASYNC_TCP_QUEUE_SIZE=128
-DCONFIG_ASYNC_TCP_STACK_SIZE=24576
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_NONE
-DETH_SPI_SUPPORTS_NO_IRQ
-DNUKI_HUB_UPDATER
@@ -95,8 +90,6 @@ extends = env:updater_esp32
board = esp32-h2-devkitm-1
board_build.cmake_extra_args =
-DNUKI_TARGET_H2=y
lib_deps =
PsychicHttp=symlink://../lib/PsychicHttp
[env:updater_esp32-solo1]
extends = env:updater_esp32