C++ conversions (#111)

* Remove version from artifact name
* Target C++ 20 and higher
* Use cpp string
* Better crash implementation
* String utils in cpp style
* Replace parameter methods with start() method
* MutexType to Mutex::Type
* Kernel c to cpp style
* Cleanup event flag
* More cpp conversions
* Test fixes
* Updated ideas docs
This commit is contained in:
Ken Van Hoeylandt
2024-12-07 12:24:28 +01:00
committed by GitHub
parent d52fe52d96
commit 42e843b463
66 changed files with 272 additions and 258 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ Gui* gui_alloc() {
&gui_main,
nullptr
);
instance->mutex = tt_mutex_alloc(MutexTypeRecursive);
instance->mutex = tt_mutex_alloc(Mutex::TypeRecursive);
instance->keyboard = nullptr;
instance->loader_pubsub_subscription = tt_pubsub_subscribe(loader::getPubsub(), &loader_callback, instance);
tt_check(lvgl::lock(1000 / portTICK_PERIOD_MS));
+3 -2
View File
@@ -16,6 +16,7 @@
namespace tt::service::loader {
#define TAG "loader"
#define LOADER_EVENT_FLAG 1
typedef struct {
LoaderEventType type;
@@ -77,7 +78,7 @@ LoaderStatus startApp(const std::string& id, bool blocking, std::shared_ptr<cons
/* TODO: Check if task id is not the LVGL one,
because otherwise this fails as the apps starting logic will try to lock lvgl
to update the UI and fail. */
event_flag->wait(TT_API_LOCK_EVENT);
event_flag->wait(LOADER_EVENT_FLAG);
delete event_flag;
}
@@ -330,7 +331,7 @@ static int32_t loader_main(TT_UNUSED void* parameter) {
message.payload.start->parameters
);
if (message.api_lock != nullptr) {
message.api_lock->set(TT_API_LOCK_EVENT);
message.api_lock->set(LOADER_EVENT_FLAG);
}
message.cleanup();
break;
@@ -43,7 +43,7 @@ ScreenshotTask* alloc() {
auto* data = static_cast<ScreenshotTaskData*>(malloc(sizeof(ScreenshotTaskData)));
*data = (ScreenshotTaskData) {
.thread = nullptr,
.mutex = tt_mutex_alloc(MutexTypeRecursive),
.mutex = tt_mutex_alloc(Mutex::TypeRecursive),
.interrupted = false
};
return data;
@@ -76,7 +76,7 @@ static int32_t screenshot_task(void* context) {
if (data->work.type == TASK_WORK_TYPE_DELAY) {
// Splitting up the delays makes it easier to stop the service
for (int i = 0; i < (data->work.delay_in_seconds * 10) && !is_interrupted(data); ++i){
delay_ms(100);
kernel::delayMillis(100);
}
if (is_interrupted(data)) {
@@ -102,7 +102,7 @@ static int32_t screenshot_task(void* context) {
if (app) {
const app::AppManifest& manifest = app->getManifest();
if (manifest.id != last_app_id) {
delay_ms(100);
kernel::delayMillis(100);
last_app_id = manifest.id;
char filename[SCREENSHOT_PATH_LIMIT + 32];
@@ -116,7 +116,7 @@ static int32_t screenshot_task(void* context) {
lvgl::unlock();
}
}
delay_ms(250);
kernel::delayMillis(250);
}
}