add pre-configured button for updating the heap statistics
This commit is contained in:
parent
a23bf27c50
commit
98fbf2a55e
19
src/esp.h
19
src/esp.h
@ -47,19 +47,24 @@ namespace HaESP {
|
|||||||
.withPrecision(0)
|
.withPrecision(0)
|
||||||
.withValueTemplate("{{ value_json.fragmentation }}")
|
.withValueTemplate("{{ value_json.fragmentation }}")
|
||||||
.withJsonAttributes("{{ value_json.heap | tojson }}")
|
.withJsonAttributes("{{ value_json.heap | tojson }}")
|
||||||
.build());
|
.build())
|
||||||
builder.addDiagnostic(Builder<Sensor>(new Sensor{ "Heap free", "heap_free" })
|
.addDiagnostic(Builder<Sensor>(new Sensor{ "Heap free", "heap_free" })
|
||||||
.withDeviceClass("data_size")
|
.withDeviceClass("data_size")
|
||||||
.withUnitMeasure("B")
|
.withUnitMeasure("B")
|
||||||
.withPrecision(0)
|
.withPrecision(0)
|
||||||
.build()
|
.build())
|
||||||
);
|
.addDiagnostic(Builder<Sensor>(new Sensor{ "Heap max free block", "heap_max_free_block" })
|
||||||
builder.addDiagnostic(Builder<Sensor>(new Sensor{ "Heap max free block", "heap_max_free_block" })
|
|
||||||
.withDeviceClass("data_size")
|
.withDeviceClass("data_size")
|
||||||
.withUnitMeasure("B")
|
.withUnitMeasure("B")
|
||||||
.withPrecision(0)
|
.withPrecision(0)
|
||||||
.build()
|
.build())
|
||||||
);
|
.addSecondary(new Button{"Update heap stats", "update_heap_stats",
|
||||||
|
[](const char* msg) {
|
||||||
|
if ((strcmp("PRESS", msg) == 0) && tHeap.isEnabled()) {
|
||||||
|
tHeap.cancel();
|
||||||
|
tHeap.restart();
|
||||||
|
}}});
|
||||||
|
|
||||||
activeSensors.heapStats = true;
|
activeSensors.heapStats = true;
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user