improved NbApp definition

default values added for task priority and stack size
+ other small improvements
This commit is contained in:
Ken Van Hoeylandt 2023-12-28 00:07:39 +01:00
parent f0cfd3c34d
commit 83ef89cf07
10 changed files with 28 additions and 15 deletions

View File

@ -23,6 +23,9 @@ UI is created with [lvgl](https://github.com/lvgl/lvgl) via [esp_lvgl_port](http
## Supported Hardware ## Supported Hardware
**NOTE**: `sdkconfig.defaults` currently contains `CONFIG_LV_COLOR_16_SWAP=y`.
You might have to remove this setting if you're not using the Yellow Board described below.
### Devices ### Devices
See below for the supported hardware. See below for the supported hardware.

View File

@ -2,6 +2,7 @@
#include "nb_hardware.h" #include "nb_hardware.h"
#include "core_defines.h" #include "core_defines.h"
#include "esp_log.h"
static int32_t prv_desktop_main(void* param) { static int32_t prv_desktop_main(void* param) {
UNUSED(param); UNUSED(param);
printf("desktop app init\n"); printf("desktop app init\n");
@ -13,6 +14,6 @@ const NbApp desktop_app = {
.name = "Desktop", .name = "Desktop",
.type = SERVICE, .type = SERVICE,
.entry_point = &prv_desktop_main, .entry_point = &prv_desktop_main,
.stack_size = 2048, .stack_size = NB_TASK_STACK_SIZE_DEFAULT,
.priority = 10 .priority = NB_TASK_PRIORITY_DEFAULT
}; };

View File

@ -3,7 +3,7 @@
#include "record.h" #include "record.h"
#include "check.h" #include "check.h"
#define TAG "Gui" #define TAG "gui"
// Forward declarations from gui_draw.c // Forward declarations from gui_draw.c
bool gui_redraw_fs(NbGui* gui); bool gui_redraw_fs(NbGui* gui);
@ -233,6 +233,6 @@ const NbApp gui_app = {
.name = "GUI", .name = "GUI",
.type = SERVICE, .type = SERVICE,
.entry_point = &prv_gui_main, .entry_point = &prv_gui_main,
.stack_size = 2048, .stack_size = NB_TASK_STACK_SIZE_DEFAULT,
.priority = 10 .priority = NB_TASK_PRIORITY_DEFAULT
}; };

View File

@ -12,6 +12,6 @@ const NbApp loader_app = {
.name = "Loader", .name = "Loader",
.type = SERVICE, .type = SERVICE,
.entry_point = &prv_loader_main, .entry_point = &prv_loader_main,
.stack_size = 2048, .stack_size = NB_TASK_STACK_SIZE_DEFAULT,
.priority = 10 .priority = NB_TASK_PRIORITY_DEFAULT
}; };

View File

@ -33,6 +33,6 @@ NbApp system_info_app = {
.name = "System Info", .name = "System Info",
.type = SYSTEM, .type = SYSTEM,
.entry_point = &system_info_entry_point, .entry_point = &system_info_entry_point,
.stack_size = 2048, .stack_size = NB_TASK_STACK_SIZE_DEFAULT,
.priority = 10 .priority = NB_TASK_PRIORITY_DEFAULT
}; };

View File

@ -53,6 +53,7 @@ static void prv_start_app(const NbApp _Nonnull* app) {
} }
furi_thread_set_appid(thread, app->id); furi_thread_set_appid(thread, app->id);
furi_thread_set_priority(thread, app->priority);
furi_thread_start(thread); furi_thread_start(thread);
FuriThreadId thread_id = furi_thread_get_id(thread); FuriThreadId thread_id = furi_thread_get_id(thread);

View File

@ -17,6 +17,14 @@ typedef enum {
USER USER
} NbAppType; } NbAppType;
typedef enum {
NB_TASK_PRIORITY_DEFAULT = 10
} NbTaskPriority;
typedef enum {
NB_TASK_STACK_SIZE_DEFAULT = 2048
} NbStackSize;
typedef int32_t (*NbAppEntryPoint) (void _Nonnull* parameter); typedef int32_t (*NbAppEntryPoint) (void _Nonnull* parameter);
typedef struct { typedef struct {
@ -24,8 +32,8 @@ typedef struct {
const char name[NB_APP_NAME_LENGTH]; const char name[NB_APP_NAME_LENGTH];
const NbAppType type; const NbAppType type;
const NbAppEntryPoint _Nullable entry_point; const NbAppEntryPoint _Nullable entry_point;
const size_t stack_size; const NbStackSize stack_size;
const uint32_t priority; const NbTaskPriority priority;
} NbApp; } NbApp;
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -3,7 +3,7 @@
#include "esp_err.h" #include "esp_err.h"
#include "check.h" #include "check.h"
#define TAG "nb_hardware" #define TAG "hardware"
NbHardware nb_hardware_create(NbConfig _Nonnull* config) { NbHardware nb_hardware_create(NbConfig _Nonnull* config) {

View File

@ -2,7 +2,7 @@
#include "esp_lvgl_port.h" #include "esp_lvgl_port.h"
#include "check.h" #include "check.h"
#define TAG "nb_lvgl" #define TAG "lvgl"
NbLvgl nb_lvgl_init(NbHardware _Nonnull* hardware) { NbLvgl nb_lvgl_init(NbHardware _Nonnull* hardware) {
const lvgl_port_cfg_t lvgl_cfg = { const lvgl_port_cfg_t lvgl_cfg = {

View File

@ -70,6 +70,6 @@ const NbApp hello_world_app = {
.name = "Hello World", .name = "Hello World",
.type = USER, .type = USER,
.entry_point = &prv_hello_world_main, .entry_point = &prv_hello_world_main,
.stack_size = 2048, .stack_size = NB_TASK_STACK_SIZE_DEFAULT,
.priority = 10 .priority = NB_TASK_PRIORITY_DEFAULT
}; };