[FL-2975] Bug fixes and improvements: Furi, Input, Cli (#2004)

* Furi: configurable heap allocation tracking
* Furi: relax restriction in thread heap setter asserts, apply heap tracking setting on app start instead of thread allocation
* Furi: hide dangerous heap tracking levels in release build
* Input: fix non-working debounce
This commit is contained in:
あく
2022-11-12 17:46:04 +09:00
committed by GitHub
parent 721ab717d7
commit 90cefe7c71
10 changed files with 186 additions and 25 deletions

View File

@@ -122,9 +122,14 @@ FuriThread* furi_thread_alloc() {
thread->output.buffer = furi_string_alloc();
thread->is_service = false;
if(furi_thread_get_current_id()) {
FuriHalRtcHeapTrackMode mode = furi_hal_rtc_get_heap_track_mode();
if(mode == FuriHalRtcHeapTrackModeAll) {
thread->heap_trace_enabled = true;
} else if(mode == FuriHalRtcHeapTrackModeTree && furi_thread_get_current_id()) {
FuriThread* parent = pvTaskGetThreadLocalStoragePointer(NULL, 0);
if(parent) thread->heap_trace_enabled = parent->heap_trace_enabled;
} else {
thread->heap_trace_enabled = false;
}
return thread;
@@ -243,14 +248,12 @@ FuriThreadId furi_thread_get_id(FuriThread* thread) {
void furi_thread_enable_heap_trace(FuriThread* thread) {
furi_assert(thread);
furi_assert(thread->state == FuriThreadStateStopped);
furi_assert(thread->heap_trace_enabled == false);
thread->heap_trace_enabled = true;
}
void furi_thread_disable_heap_trace(FuriThread* thread) {
furi_assert(thread);
furi_assert(thread->state == FuriThreadStateStopped);
furi_assert(thread->heap_trace_enabled == true);
thread->heap_trace_enabled = false;
}