Implement posix app loading (#643)

- Added POSIX desktop support for SDK builds, application packaging, and integration testing.
- Added POSIX filesystem partitions and improved application path handling.
- Added simulator support for loading and running applications dynamically.
- Improved simulator task stack handling and display startup reliability.
- Improved simulator display scaling, resizing, high-DPI support, and pointer accuracy.
- Fixed LVGL timers and input polling on POSIX. (fixes simulator with Linux on some Intel graphics platforms)
- Standardized data paths across platforms.
- Logging now works via separate task: this allows apps to write to log without it affecting their stdout (for apps that output text as relevant date for other apps, like the File Selection app)
- Fixes for app stdio
This commit is contained in:
Ken Van Hoeylandt
2026-08-31 22:09:04 +02:00
committed by GitHub
parent d3656bcd3d
commit 643cbc3806
66 changed files with 2139 additions and 336 deletions
+41 -9
View File
@@ -3,6 +3,7 @@
#ifndef ESP_PLATFORM
#include <tactility/log.h>
#include <tactility/log_queue.h>
#include <mutex>
#include <inttypes.h>
@@ -11,7 +12,11 @@
#include <stdarg.h>
#include <sys/time.h>
static const char* get_log_color(LogLevel level) {
namespace {
constexpr auto MINIMUM_LOG_LEVEL = LOG_LEVEL_DEBUG;
const char* get_log_color(LogLevel level) {
using enum LogLevel;
switch (level) {
case LOG_LEVEL_ERROR:
@@ -29,7 +34,7 @@ static const char* get_log_color(LogLevel level) {
}
}
static inline char get_log_prefix(LogLevel level) {
inline char get_log_prefix(LogLevel level) {
using enum LogLevel;
switch (level) {
case LOG_LEVEL_ERROR:
@@ -47,7 +52,7 @@ static inline char get_log_prefix(LogLevel level) {
}
}
static uint64_t get_log_timestamp() {
uint64_t get_log_timestamp() {
static uint64_t base = 0U;
static std::once_flag init_flag;
std::call_once(init_flag, []() {
@@ -61,15 +66,42 @@ static uint64_t get_log_timestamp() {
return now - base;
}
}
extern "C" {
void log_generic(enum LogLevel level, const char* tag, const char* format, ...) {
va_list args;
va_start(args, format);
printf("%s %c (%" PRIu64 ") %s ", get_log_color(level), get_log_prefix(level), get_log_timestamp(), tag);
vprintf(format, args);
printf("\033[0m\n");
va_end(args);
if (MINIMUM_LOG_LEVEL >= level) {
char buffer[LOG_QUEUE_MESSAGE_MAX_LENGTH];
size_t offset = 0;
int prefix_len = snprintf(buffer, sizeof(buffer), "%s %c (%" PRIu64 ") %s ",
get_log_color(level), get_log_prefix(level), get_log_timestamp(), tag);
if (prefix_len > 0) {
offset = static_cast<size_t>(prefix_len) < sizeof(buffer) ? static_cast<size_t>(prefix_len) : sizeof(buffer) - 1;
}
if (offset < sizeof(buffer)) {
va_list args;
va_start(args, format);
int written = vsnprintf(buffer + offset, sizeof(buffer) - offset, format, args);
va_end(args);
if (written > 0) {
size_t remaining = sizeof(buffer) - offset;
offset += static_cast<size_t>(written) < remaining ? static_cast<size_t>(written) : remaining - 1;
}
}
if (offset < sizeof(buffer)) {
int tail_len = snprintf(buffer + offset, sizeof(buffer) - offset, "\033[0m\n");
if (tail_len > 0) {
size_t remaining = sizeof(buffer) - offset;
offset += static_cast<size_t>(tail_len) < remaining ? static_cast<size_t>(tail_len) : remaining - 1;
}
}
log_queue_write(buffer, offset);
}
}
}