Skip to content

Commit d1737c6

Browse files
committed
temperature_measurement_app: Review changes
1 parent 6571c5e commit d1737c6

File tree

5 files changed

+13
-15
lines changed

5 files changed

+13
-15
lines changed

config/esp32/components/chip/Kconfig

+2-4
Original file line numberDiff line numberDiff line change
@@ -1001,12 +1001,10 @@ menu "CHIP Device Layer"
10011001

10021002
config ENABLE_ESP_DIAGNOSTICS_TRACE
10031003
bool "Enable ESP Platform Diagnostics for Matter"
1004-
depends on ESP_DIAGNOSTICS_ENABLED
1005-
default y
1004+
default n
10061005
help
10071006
Enables the ESP Diagnostics platform to collect, store, and retrieve diagnostic data for the Matter protocol.
10081007
This feature helps monitor system health and performance by providing insights through diagnostics logs.
1009-
Requires ESP_DIAGNOSTICS_ENABLED to be activated.
10101008

10111009
config ENABLE_ESP_INSIGHTS_TRACE
10121010
bool "Enable Matter ESP Insights"
@@ -1027,7 +1025,7 @@ menu "CHIP Device Layer"
10271025
config MAX_PERMIT_LIST_SIZE
10281026
int "Set permit list size for Insights traces"
10291027
range 5 30
1030-
depends on ESP_INSIGHTS_ENABLED || ESP_DIAGNOSTICS_ENABLED
1028+
depends on ESP_INSIGHTS_ENABLED || ENABLE_ESP_DIAGNOSTICS_TRACE
10311029
default 20
10321030
help
10331031
Set the maximum number of group entries that can be included in the permit list for reporting

examples/temperature-measurement-app/esp32/main/Kconfig.projbuild

+1-4
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,10 @@ depends on ENABLE_PW_RPC
8585
endmenu
8686

8787
menu "Platform Diagnostics"
88-
config ESP_DIAGNOSTICS_ENABLED
89-
bool "Enable ESP Diagnostics"
90-
default n
9188

9289
config END_USER_BUFFER_SIZE
9390
int "Set buffer size for end user diagnostic data"
94-
depends on ESP_DIAGNOSTICS_ENABLED
91+
depends on ENABLE_ESP_DIAGNOSTICS_TRACE
9592
default 4096
9693
help
9794
Defines the buffer size (in bytes) for storing diagnostic data related to end user activity.

examples/temperature-measurement-app/esp32/main/diagnostic-logs-provider-delegate-impl.cpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ using namespace chip::app::Clusters::DiagnosticLogs;
2929
LogProvider LogProvider::sInstance;
3030
LogProvider::CrashLogContext LogProvider::sCrashLogContext;
3131

32+
#if CONFIG_ENABLE_ESP_DIAGNOSTICS_TRACE
33+
static uint32_t sIntentSize = CONFIG_END_USER_BUFFER_SIZE;
34+
#endif
35+
3236
namespace {
3337
bool IsValidIntent(IntentEnum intent)
3438
{
@@ -77,7 +81,7 @@ size_t LogProvider::GetSizeForIntent(IntentEnum intent)
7781
{
7882
case IntentEnum::kEndUserSupport: {
7983
#if CONFIG_ENABLE_ESP_DIAGNOSTICS_TRACE
80-
return DIAGNOSTIC_BUFFER_SIZE;
84+
return sIntentSize;
8185
#else
8286
return static_cast<size_t>(endUserSupportLogEnd - endUserSupportLogStart);
8387
#endif
@@ -116,7 +120,7 @@ CHIP_ERROR LogProvider::PrepareLogContextForIntent(LogContext * context, IntentE
116120
case IntentEnum::kEndUserSupport: {
117121
#if CONFIG_ENABLE_ESP_DIAGNOSTICS_TRACE
118122
DiagnosticStorageImpl & diagnosticStorage = DiagnosticStorageImpl::GetInstance();
119-
MutableByteSpan endUserSupportSpan(endUserBuffer, DIAGNOSTIC_BUFFER_SIZE);
123+
MutableByteSpan endUserSupportSpan(endUserBuffer, CONFIG_END_USER_BUFFER_SIZE);
120124

121125
if (diagnosticStorage.IsEmptyBuffer())
122126
{
@@ -130,6 +134,7 @@ CHIP_ERROR LogProvider::PrepareLogContextForIntent(LogContext * context, IntentE
130134
ChipLogError(DeviceLayer, "Failed to retrieve data: %s", chip::ErrorStr(err));
131135
return err;
132136
}
137+
sIntentSize = endUserSupportSpan.size();
133138
// Now, assign the span to the EndUserSupport object or whatever is required
134139
context->EndUserSupport.span = endUserSupportSpan;
135140
#else

examples/temperature-measurement-app/esp32/main/include/diagnostic-logs-provider-delegate-impl.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include <app/clusters/diagnostic-logs-server/DiagnosticLogsProviderDelegate.h>
2222

2323
#if CONFIG_ENABLE_ESP_DIAGNOSTICS_TRACE
24-
#include <src/tracing/esp32_diagnostic_trace/DiagnosticStorageManager.h>
24+
#include <tracing/esp32_diagnostic_trace/DiagnosticStorageManager.h>
2525
#endif
2626

2727
#include <map>
@@ -31,9 +31,7 @@
3131
#endif // defined(CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH) && defined(CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF)
3232

3333
#if CONFIG_ENABLE_ESP_DIAGNOSTICS_TRACE
34-
#define DIAGNOSTIC_BUFFER_SIZE CONFIG_END_USER_BUFFER_SIZE
35-
static uint8_t endUserBuffer[DIAGNOSTIC_BUFFER_SIZE];
36-
34+
static uint8_t endUserBuffer[CONFIG_END_USER_BUFFER_SIZE];
3735
using namespace chip::Tracing::Diagnostics;
3836
#endif
3937

examples/temperature-measurement-app/esp32/main/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ extern "C" void app_main()
8888
#endif
8989

9090
#if CONFIG_ENABLE_ESP_DIAGNOSTICS_TRACE
91-
static ESP32Diagnostics diagnosticBackend(endUserBuffer, DIAGNOSTIC_BUFFER_SIZE);
91+
static ESP32Diagnostics diagnosticBackend(endUserBuffer, CONFIG_END_USER_BUFFER_SIZE);
9292
Tracing::Register(diagnosticBackend);
9393
#endif
9494

0 commit comments

Comments
 (0)