program two vehicles now works

This commit is contained in:
2026-02-12 09:12:42 +01:00
parent a96f0b5aa5
commit d5c104cda4
2 changed files with 71 additions and 24 deletions
+70 -24
View File
@@ -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();
}