From 6a77bacb7eefe8f0137515ee7c27b9159ce45654 Mon Sep 17 00:00:00 2001 From: rasmus Date: Mon, 15 Dec 2025 20:45:05 +0100 Subject: [PATCH] testing --- Desktop_Test/Desktop_Test.ino | 14 +++----------- Desktop_Test/GLOBALS.h | 5 ----- Desktop_Test/event_manager.cpp | 10 +--------- Desktop_Test/system_manager.cpp | 0 Desktop_Test/system_manager.h | 9 +++++++++ Desktop_Test/window_manager.cpp | 6 ++++++ 6 files changed, 19 insertions(+), 25 deletions(-) create mode 100644 Desktop_Test/system_manager.cpp create mode 100644 Desktop_Test/system_manager.h diff --git a/Desktop_Test/Desktop_Test.ino b/Desktop_Test/Desktop_Test.ino index 76d3c90..f6f3fba 100644 --- a/Desktop_Test/Desktop_Test.ino +++ b/Desktop_Test/Desktop_Test.ino @@ -47,22 +47,14 @@ void setup() { wm->init(th, _display_state); // Create input task on Core 0 - xTaskCreatePinnedToCore( - input_task, - "input_task", - 4096, - NULL, - 1, - &InputTask, - 0 - ); + xTaskCreatePinnedToCore(input_task, "input_task", 4096, NULL, 1, &InputTask, 0); delay(100); // Create test windows Window win1 = { .id = 0, - .x = 10, + .x = 170, .y = 30, .width = 350, .height = 250, @@ -77,7 +69,7 @@ void setup() { Window win2 = { .id = 1, .x = 30, - .y = 50, + .y = 150, .width = 350, .height = 270, .background_color = 0xbdf7, diff --git a/Desktop_Test/GLOBALS.h b/Desktop_Test/GLOBALS.h index 57f4e53..229427f 100644 --- a/Desktop_Test/GLOBALS.h +++ b/Desktop_Test/GLOBALS.h @@ -7,11 +7,6 @@ enum CLICK_EVENTS { RIGHT_CLICK = 2, }; -enum REDRAW_EVENT { - DESKTOP = 0, - WINDOWS = 1, -}; - struct CLICK_EVENT { int x; int y; diff --git a/Desktop_Test/event_manager.cpp b/Desktop_Test/event_manager.cpp index 93d4a6b..af205a8 100644 --- a/Desktop_Test/event_manager.cpp +++ b/Desktop_Test/event_manager.cpp @@ -1,15 +1,7 @@ #include "event_manager.h" void EventManager::init() { - xTaskCreatePinnedToCore( - dispatch_task, - "event_dispatch", - 4096, - this, - 2, // Higher priority than input - &_dispatcher_task, - 0 - ); + xTaskCreatePinnedToCore(dispatch_task, "event_dispatch", 4096, this, 2, &_dispatcher_task, 0); } void EventManager::publish(const CLICK_EVENT& event) { diff --git a/Desktop_Test/system_manager.cpp b/Desktop_Test/system_manager.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Desktop_Test/system_manager.h b/Desktop_Test/system_manager.h new file mode 100644 index 0000000..7ac7f8b --- /dev/null +++ b/Desktop_Test/system_manager.h @@ -0,0 +1,9 @@ +#pragma once + +class SystemManager { +private: + + +public: + void init(); +}; \ No newline at end of file diff --git a/Desktop_Test/window_manager.cpp b/Desktop_Test/window_manager.cpp index 84f1575..41d59ce 100644 --- a/Desktop_Test/window_manager.cpp +++ b/Desktop_Test/window_manager.cpp @@ -10,6 +10,12 @@ void WindowManager::init(TFT_Handler* th, DISPLAY_STATE* ds) { } void WindowManager::create_window(Window window) { + int total_pos_x = window.x + window.width; + int total_pos_y = window.y + window.height; + + if (total_pos_x > 480) window.x = total_pos_x - 480; + if (total_pos_y > 320) window.y = total_pos_y - 320; + windows.push_back(window); display_state->update_display.store(true); }