Boot splash and more (#98)
* Boot splash and more - Added developer sdkconfig - Refactored the way FreeRTOS includes are included - Improved Gui/Loader logic - Implemented boot app with splash screen * Updated naming for Gui and Loader services * Renamed Screenshot service methods * Renames * Service renames
This commit is contained in:
committed by
GitHub
parent
3f62ec2efa
commit
0188ce721c
@@ -15,8 +15,8 @@ extern const Manifest manifest;
|
||||
|
||||
typedef struct {
|
||||
Mutex* mutex;
|
||||
ScreenshotTask* task;
|
||||
ScreenshotMode mode;
|
||||
task::ScreenshotTask* task;
|
||||
Mode mode;
|
||||
} ServiceData;
|
||||
|
||||
static ServiceData* service_data_alloc() {
|
||||
@@ -49,14 +49,14 @@ static void on_start(Service& service) {
|
||||
static void on_stop(Service& service) {
|
||||
auto* data = static_cast<ServiceData*>(service.getData());
|
||||
if (data->task) {
|
||||
task_free(data->task);
|
||||
task::free(data->task);
|
||||
data->task = nullptr;
|
||||
}
|
||||
tt_mutex_free(data->mutex);
|
||||
service_data_free(data);
|
||||
}
|
||||
|
||||
void start_apps(const char* path) {
|
||||
void startApps(const char* path) {
|
||||
_Nullable auto* service = findServiceById(manifest.id);
|
||||
if (service == nullptr) {
|
||||
TT_LOG_E(TAG, "Service not found");
|
||||
@@ -66,16 +66,16 @@ void start_apps(const char* path) {
|
||||
auto* data = static_cast<ServiceData*>(service->getData());
|
||||
service_data_lock(data);
|
||||
if (data->task == nullptr) {
|
||||
data->task = task_alloc();
|
||||
data->task = task::alloc();
|
||||
data->mode = ScreenshotModeApps;
|
||||
task_start_apps(data->task, path);
|
||||
task::startApps(data->task, path);
|
||||
} else {
|
||||
TT_LOG_E(TAG, "Screenshot task already running");
|
||||
}
|
||||
service_data_unlock(data);
|
||||
}
|
||||
|
||||
void start_timed(const char* path, uint8_t delay_in_seconds, uint8_t amount) {
|
||||
void startTimed(const char* path, uint8_t delay_in_seconds, uint8_t amount) {
|
||||
_Nullable auto* service = findServiceById(manifest.id);
|
||||
if (service == nullptr) {
|
||||
TT_LOG_E(TAG, "Service not found");
|
||||
@@ -85,9 +85,9 @@ void start_timed(const char* path, uint8_t delay_in_seconds, uint8_t amount) {
|
||||
auto* data = static_cast<ServiceData*>(service->getData());
|
||||
service_data_lock(data);
|
||||
if (data->task == nullptr) {
|
||||
data->task = task_alloc();
|
||||
data->task = task::alloc();
|
||||
data->mode = ScreenshotModeTimed;
|
||||
task_start_timed(data->task, path, delay_in_seconds, amount);
|
||||
task::startTimed(data->task, path, delay_in_seconds, amount);
|
||||
} else {
|
||||
TT_LOG_E(TAG, "Screenshot task already running");
|
||||
}
|
||||
@@ -104,8 +104,8 @@ void stop() {
|
||||
auto data = static_cast<ServiceData*>(service->getData());
|
||||
service_data_lock(data);
|
||||
if (data->task != nullptr) {
|
||||
task_stop(data->task);
|
||||
task_free(data->task);
|
||||
task::stop(data->task);
|
||||
task::free(data->task);
|
||||
data->task = nullptr;
|
||||
data->mode = ScreenshotModeNone;
|
||||
} else {
|
||||
@@ -114,7 +114,7 @@ void stop() {
|
||||
service_data_unlock(data);
|
||||
}
|
||||
|
||||
ScreenshotMode get_mode() {
|
||||
Mode getMode() {
|
||||
_Nullable auto* service = findServiceById(manifest.id);
|
||||
if (service == nullptr) {
|
||||
TT_LOG_E(TAG, "Service not found");
|
||||
@@ -122,14 +122,14 @@ ScreenshotMode get_mode() {
|
||||
} else {
|
||||
auto* data = static_cast<ServiceData*>(service->getData());
|
||||
service_data_lock(data);
|
||||
ScreenshotMode mode = data->mode;
|
||||
Mode mode = data->mode;
|
||||
service_data_unlock(data);
|
||||
return mode;
|
||||
}
|
||||
}
|
||||
|
||||
bool is_started() {
|
||||
return get_mode() != ScreenshotModeNone;
|
||||
bool isStarted() {
|
||||
return getMode() != ScreenshotModeNone;
|
||||
}
|
||||
|
||||
extern const Manifest manifest = {
|
||||
|
||||
@@ -8,24 +8,24 @@ typedef enum {
|
||||
ScreenshotModeNone,
|
||||
ScreenshotModeTimed,
|
||||
ScreenshotModeApps
|
||||
} ScreenshotMode;
|
||||
} Mode;
|
||||
|
||||
/** @brief Starts taking screenshot with a timer
|
||||
* @param path the path to store the screenshots in
|
||||
* @param delay_in_seconds the delay before starting (and between successive screenshots)
|
||||
* @param amount 0 = indefinite, >0 for a specific
|
||||
*/
|
||||
void start_timed(const char* path, uint8_t delay_in_seconds, uint8_t amount);
|
||||
void startTimed(const char* path, uint8_t delay_in_seconds, uint8_t amount);
|
||||
|
||||
/** @brief Starts taking screenshot when an app is started
|
||||
* @param path the path to store the screenshots in
|
||||
*/
|
||||
void start_apps(const char* path);
|
||||
void startApps(const char* path);
|
||||
|
||||
void stop();
|
||||
|
||||
ScreenshotMode get_mode();
|
||||
Mode getMode();
|
||||
|
||||
bool is_started();
|
||||
bool isStarted();
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "service/loader/Loader.h"
|
||||
#include "lvgl/LvglSync.h"
|
||||
|
||||
namespace tt::service::screenshot {
|
||||
namespace tt::service::screenshot::task {
|
||||
|
||||
#define TAG "screenshot_task"
|
||||
|
||||
@@ -39,7 +39,7 @@ static void task_unlock(ScreenshotTaskData* data) {
|
||||
tt_check(tt_mutex_release(data->mutex) == TtStatusOk);
|
||||
}
|
||||
|
||||
ScreenshotTask* task_alloc() {
|
||||
ScreenshotTask* alloc() {
|
||||
auto* data = static_cast<ScreenshotTaskData*>(malloc(sizeof(ScreenshotTaskData)));
|
||||
*data = (ScreenshotTaskData) {
|
||||
.thread = nullptr,
|
||||
@@ -49,10 +49,10 @@ ScreenshotTask* task_alloc() {
|
||||
return data;
|
||||
}
|
||||
|
||||
void task_free(ScreenshotTask* task) {
|
||||
void free(ScreenshotTask* task) {
|
||||
auto* data = static_cast<ScreenshotTaskData*>(task);
|
||||
if (data->thread) {
|
||||
task_stop(data);
|
||||
stop(data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ static int32_t screenshot_task(void* context) {
|
||||
break; // Interrupted loop
|
||||
}
|
||||
} else if (data->work.type == TASK_WORK_TYPE_APPS) {
|
||||
app::App* _Nullable app = loader::get_current_app();
|
||||
app::App* _Nullable app = loader::getCurrentApp();
|
||||
if (app) {
|
||||
const app::Manifest& manifest = app->getManifest();
|
||||
if (manifest.id != last_app_id) {
|
||||
@@ -136,7 +136,7 @@ static void task_start(ScreenshotTaskData* data) {
|
||||
task_unlock(data);
|
||||
}
|
||||
|
||||
void task_start_apps(ScreenshotTask* task, const char* path) {
|
||||
void startApps(ScreenshotTask* task, const char* path) {
|
||||
tt_check(strlen(path) < (SCREENSHOT_PATH_LIMIT - 1));
|
||||
auto* data = static_cast<ScreenshotTaskData*>(task);
|
||||
task_lock(data);
|
||||
@@ -151,7 +151,7 @@ void task_start_apps(ScreenshotTask* task, const char* path) {
|
||||
task_unlock(data);
|
||||
}
|
||||
|
||||
void task_start_timed(ScreenshotTask* task, const char* path, uint8_t delay_in_seconds, uint8_t amount) {
|
||||
void startTimed(ScreenshotTask* task, const char* path, uint8_t delay_in_seconds, uint8_t amount) {
|
||||
tt_check(strlen(path) < (SCREENSHOT_PATH_LIMIT - 1));
|
||||
auto* data = static_cast<ScreenshotTaskData*>(task);
|
||||
task_lock(data);
|
||||
@@ -168,7 +168,7 @@ void task_start_timed(ScreenshotTask* task, const char* path, uint8_t delay_in_s
|
||||
task_unlock(data);
|
||||
}
|
||||
|
||||
void task_stop(ScreenshotTask* task) {
|
||||
void stop(ScreenshotTask* task) {
|
||||
auto* data = static_cast<ScreenshotTaskData*>(task);
|
||||
if (data->thread != nullptr) {
|
||||
task_lock(data);
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace tt::service::screenshot {
|
||||
namespace tt::service::screenshot::task {
|
||||
|
||||
typedef void ScreenshotTask;
|
||||
|
||||
ScreenshotTask* task_alloc();
|
||||
ScreenshotTask* alloc();
|
||||
|
||||
void task_free(ScreenshotTask* task);
|
||||
void free(ScreenshotTask* task);
|
||||
|
||||
/** @brief Start taking screenshots after a certain delay
|
||||
* @param task the screenshot task
|
||||
@@ -16,17 +16,17 @@ void task_free(ScreenshotTask* task);
|
||||
* @param delay_in_seconds the delay before starting (and between successive screenshots)
|
||||
* @param amount 0 = indefinite, >0 for a specific
|
||||
*/
|
||||
void task_start_timed(ScreenshotTask* task, const char* path, uint8_t delay_in_seconds, uint8_t amount);
|
||||
void startTimed(ScreenshotTask* task, const char* path, uint8_t delay_in_seconds, uint8_t amount);
|
||||
|
||||
/** @brief Start taking screenshot whenever an app is started
|
||||
* @param task the screenshot task
|
||||
* @param path the path to store the screenshots at
|
||||
*/
|
||||
void task_start_apps(ScreenshotTask* task, const char* path);
|
||||
void startApps(ScreenshotTask* task, const char* path);
|
||||
|
||||
/** @brief Stop taking screenshots
|
||||
* @param task the screenshot task
|
||||
*/
|
||||
void task_stop(ScreenshotTask* task);
|
||||
void stop(ScreenshotTask* task);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user