From d5c104cda48ea3d2585a7c253217cfb06fb2b5af Mon Sep 17 00:00:00 2001 From: gitProtogen Date: Thu, 12 Feb 2026 09:12:42 +0100 Subject: [PATCH] program two vehicles now works --- config.h | 1 + ledy.ino | 94 +++++++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 71 insertions(+), 24 deletions(-) diff --git a/config.h b/config.h index d84d288..bfb3996 100644 --- a/config.h +++ b/config.h @@ -13,6 +13,7 @@ #define MAX_IMAGES_SAVED 2 #define MAX_ANIMATION_FRAME_COUNT 12 #define MAX_ANIMATIONS_COUNT 2 +#define VEHICHLE_COLOR 0xFF111111 #define SMALL_TEXT_HEIGHT 7 #define SMALL_TEXT_WIDTH 5 diff --git a/ledy.ino b/ledy.ino index b363dbc..45a52b5 100644 --- a/ledy.ino +++ b/ledy.ino @@ -32,7 +32,7 @@ Image saved_images[MAX_IMAGES_SAVED] = { const RGB animation_data[MAX_ANIMATIONS_COUNT][MAX_ANIMATION_FRAME_COUNT][PANEL_PIXEL_COUNT][DISPLAY_MAX_X + 1] = {}; Animation animations[MAX_ANIMATIONS_COUNT]; -bool vehichles[][][] = +bool vehichles[13][4][8] = { { {0}, @@ -93,8 +93,20 @@ bool vehichles[][][] = {0,1,1,1,0,0,0,1}, {1,1,1,1,1,1,1,0}, {0,1,0,0,0,1,0,0} + }, + { + {0,1,0,1,1,1,1,1}, + {1,1,0,1,1,1,1,1}, + {1,1,1,1,1,1,1,1}, + {0,0,1,0,0,0,1,0} + }, + { + {0}, + {0,0,0,0,0,1,1,0}, + {0,0,0,1,1,1,1,1}, + {0,0,0,0,1,0,1,0} } -} +}; short getTextNodeY2(TextNode *node) @@ -512,22 +524,6 @@ void resetGlobalIdToAfterIntroValue() global_node_id = 2; } -void setup() -{ - Serial.begin(115200); - Serial.println("----------------------------------------------------"); - - pixels.begin(); - pixels.clear(); - - addNewTextNode("NO", 0xFF050505, false, 0, 0, 1, true, true); - addNewTextNode("INTERNET", 0xFF050505, false, 0, 9, 1, true, true); - - scrollAllScrollableTexts(true); - pixels.show(); - start_server(); -} - void handleProgram1() { if (!main_animation_started) @@ -583,16 +579,66 @@ void handleProgram1() } } +void drawVehichle(unsigned char index = 0, short pos_x = 0, short pos_y = 0) +{ + for (unsigned char i = 0; i < 4; i++) + { + for (unsigned char j = 0; j < 8; j++) + { + if (vehichles[index][i][j]) + { + setPixel(pos_x + j, pos_y + i, VEHICHLE_COLOR); + } + } + } +} + +unsigned char program2_scroll_progress = 0; +short program2_spacing_counter = 0; + +void handleProgram2(unsigned char spacing = 4, unsigned char scroll_slowness = 1, short y = 0) +{ + if (scroll_slowness > program2_scroll_progress) + { + program2_scroll_progress++; + return; + } + program2_scroll_progress = 0; + + shiftGivenRectangleLeft(0, y, DISPLAY_MAX_X, y + 3, 1); + + program2_spacing_counter--; + if (program2_spacing_counter <= 0) + { + drawVehichle(random(0, 11), DISPLAY_MAX_X - 7, y); + program2_spacing_counter = 8 + spacing; + } +} + +void setup() +{ + Serial.begin(115200); + Serial.println("----------------------------------------------------"); + + pixels.begin(); + pixels.clear(); + + scrollAllScrollableTexts(true); + pixels.show(); + start_server(); +} + void loop() { - pixels.clear(); handle_server(); - handleProgram1(); + handleProgram2(4, 1, 0); - handleDisappearTimers(); - handleMultiColorDisappearTimers(); - scrollAllScrollableTexts(true); - scrollAllMultiColorTexts(true); + // pixels.clear(); + // handleProgram1(); + // handleDisappearTimers(); + // handleMultiColorDisappearTimers(); + // scrollAllScrollableTexts(true); + // scrollAllMultiColorTexts(true); pixels.show(); } \ No newline at end of file