refactoring

This commit is contained in:
2026-01-27 17:50:50 +01:00
parent 3936402e42
commit cbfe305e9d
5 changed files with 20 additions and 37 deletions
+1 -6
View File
@@ -1,8 +1,3 @@
struct Cursor { #include "structs.h"
unsigned short x;
unsigned short y;
Cursor() : x(0), y(0) {}
};
Cursor cursor1; Cursor cursor1;
-14
View File
@@ -16,26 +16,12 @@
#define PANEL_PIXEL_COUNT 16 #define PANEL_PIXEL_COUNT 16
#define PANEL_COUNT 3 #define PANEL_COUNT 3
#define NUMPIXELS PANEL_PIXEL_COUNT*PANEL_PIXEL_COUNT*PANEL_COUNT #define NUMPIXELS PANEL_PIXEL_COUNT*PANEL_PIXEL_COUNT*PANEL_COUNT
#define TEXT_BUFFOR_SIZE 64
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); 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() { void setup() {
Serial.begin(115200); Serial.begin(115200);
+5 -9
View File
@@ -1,5 +1,9 @@
#include "structs.h"
unsigned char saved_images_count = 0; unsigned char saved_images_count = 0;
Cursor cursor1;
uint32_t saved_imaged[12][16][16] = { 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, 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) { void setPixel(unsigned short x, unsigned short y, uint32_t color) {
if (x % 2 == 1) if (x % 2 == 1)
{ {
+1 -7
View File
@@ -1,19 +1,13 @@
#include <WiFi.h> #include <WiFi.h>
#include <WebServer.h> #include <WebServer.h>
#include <ArduinoJson.h> #include <ArduinoJson.h>
#include "structs.h"
const char* ssid = "PPIA"; const char* ssid = "PPIA";
const char* password = "pawelpdaldonejta"; const char* password = "pawelpdaldonejta";
WebServer server(80); 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]; Pixel new_image[16][16];
void handleRoot() { void handleRoot() {
+12
View File
@@ -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;
};