From cbfe305e9db348d03e65e926d5620adb595b4c22 Mon Sep 17 00:00:00 2001 From: gitProtogen Date: Tue, 27 Jan 2026 17:50:50 +0100 Subject: [PATCH] refactoring --- cursor.h | 9 ++------- ledy.ino | 14 -------------- lowLevel.ino | 14 +++++--------- server.ino | 8 +------- structs.h | 12 ++++++++++++ 5 files changed, 20 insertions(+), 37 deletions(-) create mode 100644 structs.h diff --git a/cursor.h b/cursor.h index 9992605..fa45b4a 100644 --- a/cursor.h +++ b/cursor.h @@ -1,8 +1,3 @@ -struct Cursor { - unsigned short x; - unsigned short y; +#include "structs.h" - Cursor() : x(0), y(0) {} -}; - -Cursor cursor1; \ No newline at end of file +Cursor cursor1; diff --git a/ledy.ino b/ledy.ino index 397de84..6e902a6 100644 --- a/ledy.ino +++ b/ledy.ino @@ -16,26 +16,12 @@ #define PANEL_PIXEL_COUNT 16 #define PANEL_COUNT 3 #define NUMPIXELS PANEL_PIXEL_COUNT*PANEL_PIXEL_COUNT*PANEL_COUNT -#define TEXT_BUFFOR_SIZE 64 Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); -ScrollableTextData scrollableTexts[4] = {0}; -unsigned char scrollableTextsCount = 0; -char rightTextBuffor[TEXT_BUFFOR_SIZE] = {0}; -void writeSmallScrollabreTextInBuffor(char (*text)[TEXT_BUFFOR_SIZE + 1], pos_y = 0) { - for (unsigned char i = 0; i < TEXT_BUFFOR_SIZE; i++) { - if (text[i]) { - unsigned char text_iterator - while() - } - } -} - - void setup() { Serial.begin(115200); diff --git a/lowLevel.ino b/lowLevel.ino index a32f838..790bfab 100644 --- a/lowLevel.ino +++ b/lowLevel.ino @@ -1,5 +1,9 @@ +#include "structs.h" + unsigned char saved_images_count = 0; +Cursor cursor1; + uint32_t saved_imaged[12][16][16] = { { { @@ -48,19 +52,11 @@ uint32_t saved_imaged[12][16][16] = { 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000 }, { - 0xFF000000, 0xFF000000, 0xunsigned FF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000 + 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000 } } }; -struct ScrollableTextData { - unsigned short pos_x; - unsigned short pos_y; - unsigned char width; - bool isSmall; - ScrollableTextData() : pos_x(0), pos_y(0), width(0), isSmall(false) {} -}; - void setPixel(unsigned short x, unsigned short y, uint32_t color) { if (x % 2 == 1) { diff --git a/server.ino b/server.ino index 57dc059..68bc2b0 100644 --- a/server.ino +++ b/server.ino @@ -1,19 +1,13 @@ #include #include #include +#include "structs.h" const char* ssid = "PPIA"; const char* password = "pawelpdaldonejta"; WebServer server(80); -// Declare the new_image buffer to temporarily store uploaded image -struct Pixel { - unsigned short x; - unsigned short y; - uint32_t color; -}; - Pixel new_image[16][16]; void handleRoot() { diff --git a/structs.h b/structs.h new file mode 100644 index 0000000..677be6f --- /dev/null +++ b/structs.h @@ -0,0 +1,12 @@ +struct Cursor { + unsigned short x; + unsigned short y; + + Cursor() : x(0), y(0) {} +}; + +struct Pixel { + unsigned short x; + unsigned short y; + uint32_t color; +}; \ No newline at end of file