mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-16 04:24:45 -07:00
Merge branch 'ofwdev' into 420
This commit is contained in:
@@ -284,11 +284,7 @@ static void loader_thread_state_callback(FuriThreadState thread_state, void* con
|
|||||||
furi_hal_power_insomnia_enter();
|
furi_hal_power_insomnia_enter();
|
||||||
}
|
}
|
||||||
} else if(thread_state == FuriThreadStateStopped) {
|
} else if(thread_state == FuriThreadStateStopped) {
|
||||||
FURI_LOG_I(
|
FURI_LOG_I(TAG, "Application stopped. Free heap: %d", memmgr_get_free_heap());
|
||||||
TAG,
|
|
||||||
"Application thread stopped. Free heap: %d. Thread allocation balance: %d.",
|
|
||||||
memmgr_get_free_heap(),
|
|
||||||
furi_thread_get_heap_size(instance->application_thread));
|
|
||||||
|
|
||||||
if(loader_instance->application_arguments) {
|
if(loader_instance->application_arguments) {
|
||||||
free(loader_instance->application_arguments);
|
free(loader_instance->application_arguments);
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
#include <furi_hal_rtc.h>
|
#include <furi_hal_rtc.h>
|
||||||
#include <furi_hal_console.h>
|
#include <furi_hal_console.h>
|
||||||
|
|
||||||
|
#define TAG "FuriThread"
|
||||||
|
|
||||||
#define THREAD_NOTIFY_INDEX 1 // Index 0 is used for stream buffers
|
#define THREAD_NOTIFY_INDEX 1 // Index 0 is used for stream buffers
|
||||||
|
|
||||||
typedef struct FuriThreadStdout FuriThreadStdout;
|
typedef struct FuriThreadStdout FuriThreadStdout;
|
||||||
@@ -82,6 +84,12 @@ static void furi_thread_body(void* context) {
|
|||||||
if(thread->heap_trace_enabled == true) {
|
if(thread->heap_trace_enabled == true) {
|
||||||
furi_delay_ms(33);
|
furi_delay_ms(33);
|
||||||
thread->heap_size = memmgr_heap_get_thread_memory((FuriThreadId)task_handle);
|
thread->heap_size = memmgr_heap_get_thread_memory((FuriThreadId)task_handle);
|
||||||
|
furi_log_print_format(
|
||||||
|
thread->heap_size ? FuriLogLevelError : FuriLogLevelInfo,
|
||||||
|
TAG,
|
||||||
|
"%s allocation balance: %d",
|
||||||
|
thread->name ? thread->name : "Thread",
|
||||||
|
thread->heap_size);
|
||||||
memmgr_heap_disable_thread_trace((FuriThreadId)task_handle);
|
memmgr_heap_disable_thread_trace((FuriThreadId)task_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,8 +97,8 @@ static void furi_thread_body(void* context) {
|
|||||||
|
|
||||||
if(thread->is_service) {
|
if(thread->is_service) {
|
||||||
FURI_LOG_E(
|
FURI_LOG_E(
|
||||||
"Service",
|
TAG,
|
||||||
"%s thread exited. Thread memory cannot be reclaimed.",
|
"%s service thread exited. Thread memory cannot be reclaimed.",
|
||||||
thread->name ? thread->name : "<unknown service>");
|
thread->name ? thread->name : "<unknown service>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,12 +75,12 @@ void nfc_worker_start(
|
|||||||
|
|
||||||
void nfc_worker_stop(NfcWorker* nfc_worker) {
|
void nfc_worker_stop(NfcWorker* nfc_worker) {
|
||||||
furi_assert(nfc_worker);
|
furi_assert(nfc_worker);
|
||||||
if(nfc_worker->state == NfcWorkerStateBroken || nfc_worker->state == NfcWorkerStateReady) {
|
furi_assert(nfc_worker->thread);
|
||||||
return;
|
if(furi_thread_get_state(nfc_worker->thread) != FuriThreadStateStopped) {
|
||||||
|
furi_hal_nfc_stop();
|
||||||
|
nfc_worker_change_state(nfc_worker, NfcWorkerStateStop);
|
||||||
|
furi_thread_join(nfc_worker->thread);
|
||||||
}
|
}
|
||||||
furi_hal_nfc_stop();
|
|
||||||
nfc_worker_change_state(nfc_worker, NfcWorkerStateStop);
|
|
||||||
furi_thread_join(nfc_worker->thread);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void nfc_worker_change_state(NfcWorker* nfc_worker, NfcWorkerState state) {
|
void nfc_worker_change_state(NfcWorker* nfc_worker, NfcWorkerState state) {
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ typedef struct NfcWorker NfcWorker;
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
// Init states
|
// Init states
|
||||||
NfcWorkerStateNone,
|
NfcWorkerStateNone,
|
||||||
NfcWorkerStateBroken,
|
|
||||||
NfcWorkerStateReady,
|
NfcWorkerStateReady,
|
||||||
// Main worker states
|
// Main worker states
|
||||||
NfcWorkerStateRead,
|
NfcWorkerStateRead,
|
||||||
|
|||||||
Reference in New Issue
Block a user