diff --git a/.idea/editor.xml b/.idea/editor.xml
index 95e2b51..ae802b3 100644
--- a/.idea/editor.xml
+++ b/.idea/editor.xml
@@ -20,7 +20,7 @@
-
+
diff --git a/config.h b/config.h
new file mode 100644
index 0000000..eb03cc2
--- /dev/null
+++ b/config.h
@@ -0,0 +1,13 @@
+#define PIN 12
+
+// Panel Configuration
+#define PANEL_PIXEL_COUNT 16
+#define PANEL_COUNT 3
+#define NUMPIXELS PANEL_PIXEL_COUNT*PANEL_PIXEL_COUNT*PANEL_COUNT
+#define PANEL_MAX_X PANEL_PIXEL_COUNT * PANEL_COUNT - 1
+#define PANEL_MAX_Y PANEL_PIXEL_COUNT - 1
+
+#define TEXT_MAX_LENGTH 64
+#define MAX_TEXT_NODES_COUNT 4
+#define SMALL_TEXT_HEIGHT 7
+#define SMALL_TEXT_WIDTH 5
\ No newline at end of file
diff --git a/cursor.h b/cursor.h
deleted file mode 100644
index fa45b4a..0000000
--- a/cursor.h
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "structs.h"
-
-Cursor cursor1;
diff --git a/ledy.ino b/ledy.ino
index e31864f..69bf395 100644
--- a/ledy.ino
+++ b/ledy.ino
@@ -2,99 +2,18 @@
#include
#include
#include
+#include "config.h"
#include "index.h"
#include "fonts.h"
-#include "cursor.h"
#include "lowLevel.ino"
#ifdef __AVR__
#include // Required for 16 MHz Adafruit Trinket
#endif
-#define PIN 12
-
-#define PANEL_PIXEL_COUNT 16
-#define PANEL_COUNT 3
-#define NUMPIXELS PANEL_PIXEL_COUNT*PANEL_PIXEL_COUNT*PANEL_COUNT
-#define PANEL_MAX_X PANEL_PIXEL_COUNT * PANEL_COUNT - 1
-#define PANEL_MAX_Y PANEL_PIXEL_COUNT - 1
-#define TEXT_MAX_LENGTH 64
-#define SCROLLABLE_TEXT_MAX_COUNT 4
-#define SMALL_TEXT_HEIGHT 7
-#define SMALL_TEXT_WIDTH 5
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
-Text scrollable_texts[SCROLLABLE_TEXT_MAX_COUNT];
-
-void addLeftScrollableTextOnScreen(char text[TEXT_MAX_LENGTH], uint32_t color = 0x00010101, bool is_small = true, unsigned short pos_x = nullptr, unsigned short pos_y)
-{
- unsigned char character_index = 0;
-
- for (unsigned char i = 0; i < SCROLLABLE_TEXT_MAX_COUNT; i++)
- {
- if (scrollable_texts[i].deleted)
- {
- scrollable_texts[i].deleted = false;
- character_index = i;
- break;
- }
- }
- if (pos_x == nullptr)
- {
- for (unsigned char i = 0; true; i++)
- {
- if (!text[i])
- {
- pos_x = PANEL_MAX_X - ((characterSize.width + 1) * i);
- }
- }
- }
-
- for (unsigned char i = 0; i < TEXT_MAX_LENGTH; i++)
- {
- scrollable_texts[character_index].content[i] = text[i];
- if (!text[i])
- {
- scrollable_texts[character_index].character_count = i;
- break;
- }
- }
-
- scrollable_texts[character_index].color = color;
- scrollable_texts[character_index].pos_x = pos_x;
- scrollable_texts[character_index].pos_y = pos_y;
-
- if (is_small)
- {
- scrollable_texts[character_index].characterSize.height = SMALL_TEXT_HEIGHT;
- scrollable_texts[character_index].characterSize.width = SMALL_TEXT_WIDTH;
- }
-}
-
-void drawGivenLeftScrollableText(unsigned char index, Cursor (*used_cursor))
-{
- if (scrollable_texts[index].deleted)
- {
- return;
- }
-
- for (unsigned char i = 0; i < scrollable_texts[index].character_count; i++)
- {
- if (scrollable_texts[index].is_small)
- {
- for (unsigned char char_i = 0; char_i < scrollable_texts[index].character_count; char_i++)
- {
- used_cursor.x = scrollable_texts[index].pos_x;
- used_cursor.y = scrollable_texts[index].pos_y;
-
- drawCharacter(font7x5[scrollable_texts[index].content[char_i] - '!'], 7, 5, scrollable_texts[index].color, used_cursor);
- }
- }
- }
-}
-
-
void setup()
{
Serial.begin(115200);
@@ -102,15 +21,12 @@ void setup()
pixels.begin();
pixels.clear();
- addLeftScrollableTextOnScreen("Its alive!");
-
pixels.show();
start_server();
}
void loop()
{
- shiftGivenRectangle(0, 0, 19, 7, 1);
pixels.show();
handle_server();
}
\ No newline at end of file
diff --git a/lowLevel.ino b/lowLevel.ino
index 4aff7c1..586dc02 100644
--- a/lowLevel.ino
+++ b/lowLevel.ino
@@ -1,3 +1,4 @@
+#include "config.h"
#include "structs.h"
unsigned char saved_images_count = 0;
diff --git a/structs.h b/structs.h
index bcb433c..cebb202 100644
--- a/structs.h
+++ b/structs.h
@@ -1,3 +1,5 @@
+#include "config.h"
+
struct Cursor
{
unsigned short x;
@@ -15,7 +17,7 @@ struct Pixel
struct Text
{
- char content[SCROLLABLE_TEXT_MAX_LENGTH];
+ char content[TEXT_MAX_LENGTH];
uint32_t color;
unsigned short pos_x;
unsigned short pos_y;
@@ -27,5 +29,6 @@ struct Text
unsigned char character_count;
bool deleted;
- Text() : color(0), pos_x(0), pos_y(0), character_count(0), characterSize({7,5,0}), deleted(true) {}
-};
\ No newline at end of file
+
+ Text() : color(0), pos_x(0), pos_y(0), character_count(0), characterSize({7,5}), deleted(true) {}
+};