diff --git a/.gitignore b/.gitignore index 81a8981..dd6a475 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ dist/* .vscode .clang-format +.clangd .editorconfig .env .ufbt diff --git a/src/main.c b/src/main.c index 454ca4d..b97f82c 100644 --- a/src/main.c +++ b/src/main.c @@ -20,10 +20,10 @@ int main() { view_dispatcher_run(app->view_dispatcher); - FURI_LOG_I("DemoApp", "Exiting application."); + FURI_LOG_I(APP_NAME, "Exiting application."); free_scenes(app); - FURI_LOG_I("DemoApp", "Freed app."); + FURI_LOG_I(APP_NAME, "Freed app."); return 0; } diff --git a/src/main.h b/src/main.h index 316083e..8e30662 100644 --- a/src/main.h +++ b/src/main.h @@ -4,6 +4,8 @@ #include #include "scenes/import.h" +#define APP_NAME "DemoApp" + typedef struct App { SceneManager* scene_manager; ViewDispatcher* view_dispatcher; diff --git a/src/scenes/register.c b/src/scenes/register.c index d9c704c..7a2c5e9 100644 --- a/src/scenes/register.c +++ b/src/scenes/register.c @@ -43,7 +43,10 @@ void register_scenes(App* app) { app->allocated_scenes = (void**)malloc(sizeof(void*) * AppSceneNum); } - view_dispatcher_enable_queue(app->view_dispatcher); + // No longer required: + // - see https://developer.flipper.net/flipperzero/doxygen/deprecated.html + // + // view_dispatcher_enable_queue(app->view_dispatcher); view_dispatcher_set_event_callback_context(app->view_dispatcher, app); view_dispatcher_set_custom_event_callback(app->view_dispatcher, scene_handler_event_forwarder); @@ -66,36 +69,36 @@ void register_scenes(App* app) { * Free all scenes. */ void free_scenes(App* app) { - FURI_LOG_I("DemoApp", "Freeing scenes."); + FURI_LOG_I(APP_NAME, "Freeing scenes."); furi_assert(app != NULL, "App is NULL."); void* tmp; #define SCENE_ACTION(scene) \ if(app->allocated_scenes != NULL) { \ tmp = app->allocated_scenes[scene]; \ app->allocated_scenes[scene] = NULL; \ - FURI_LOG_I("DemoApp", "Freeing scene " STRINGIFY(scene) "."); \ + FURI_LOG_I(APP_NAME, "Freeing scene " STRINGIFY(scene) "."); \ if(tmp != NULL) scene##_free(tmp); \ - FURI_LOG_I("DemoApp", "Free'd scene " STRINGIFY(scene) "."); \ + FURI_LOG_I(APP_NAME, "Free'd scene " STRINGIFY(scene) "."); \ } \ if(app->view_dispatcher != NULL) view_dispatcher_remove_view(app->view_dispatcher, scene); \ - FURI_LOG_I("DemoApp", "Removed from dispatcher " STRINGIFY(scene) "."); + FURI_LOG_I(APP_NAME, "Removed from dispatcher " STRINGIFY(scene) "."); #include "list.h" #undef SCENE_ACTION - FURI_LOG_I("DemoApp", "Freeing allocated scenes."); + FURI_LOG_I(APP_NAME, "Freeing allocated scenes."); furi_assert(app->allocated_scenes != NULL, "Allocated scenes is NULL."); free(app->allocated_scenes); app->allocated_scenes = NULL; - FURI_LOG_I("DemoApp", "Freeing View dispatcher."); + FURI_LOG_I(APP_NAME, "Freeing View dispatcher."); furi_assert(app->view_dispatcher != NULL, "View dispatcher is NULL."); view_dispatcher_free(app->view_dispatcher); - FURI_LOG_I("DemoApp", "Freeing SceneManager"); + FURI_LOG_I(APP_NAME, "Freeing SceneManager"); furi_assert(app->scene_manager != NULL, "Scene manager is NULL."); scene_manager_free(app->scene_manager); - FURI_LOG_I("DemoApp", "Freeing App"); + FURI_LOG_I(APP_NAME, "Freeing App"); free(app); }