writign words might work

This commit is contained in:
2026-01-27 18:55:21 +01:00
parent cbfe305e9d
commit 58e3074b04
11 changed files with 322 additions and 57 deletions
+10
View File
@@ -0,0 +1,10 @@
# Default ignored files
/shelf/
/workspace.xml
# Ignored default folder with query files
/queries/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Ask2AgentMigrationStateService">
<option name="migrationStatus" value="COMPLETED" />
</component>
</project>
+98
View File
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="BackendCodeEditorSettings">
<option name="/Default/CodeStyle/CodeFormatting/CppClangFormat/EnableClangFormatSupport/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_ARGUMENT/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_BINARY_EXPRESSIONS_CHAIN/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_CALLS_CHAIN/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXPRESSION/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXTENDS_LIST/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_FOR_STMT/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_PARAMETER/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_ARGUMENT/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_PARAMETER/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTIPLE_DECLARATION/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_TERNARY/@EntryValue" value="ALIGN_ALL" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_CLASS_DEFINITION/@EntryValue" value="1" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_DECLARATIONS/@EntryValue" value="0" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DECLARATION/@EntryValue" value="1" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DEFINITION/@EntryValue" value="1" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BREAK_TEMPLATE_DECLARATION/@EntryValue" value="LINE_BREAK" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CASE_BLOCK_BRACES/@EntryValue" value="NEXT_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CONTINUOUS_LINE_INDENT/@EntryValue" value="Double" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/EMPTY_BLOCK_STYLE/@EntryValue" value="TOGETHER" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_ACCESS_SPECIFIERS_FROM_CLASS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CASE_FROM_SWITCH/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CLASS_MEMBERS_FROM_ACCESS_SPECIFIERS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_COMMENT/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_SIZE/@EntryValue" value="4" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_STYLE/@EntryValue" value="Space" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INITIALIZER_BRACES/@EntryValue" value="END_OF_LINE_NO_SPACE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INT_ALIGN_EQ/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_BLANK_LINES_IN_CODE/@EntryValue" value="2" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue" value="2" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_USER_LINEBREAKS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/LINE_BREAK_AFTER_COLON_IN_MEMBER_INITIALIZER_LISTS/@EntryValue" value="ON_SINGLE_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/LINKAGE_SPECIFICATION_BRACES/@EntryValue" value="NEXT_LINE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/MEMBER_INITIALIZER_LIST_STYLE/@EntryValue" value="DO_NOT_CHANGE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/NAMESPACE_INDENTATION/@EntryValue" value="All" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_CATCH_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_ELSE_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_NAMESPACE_DEFINITIONS_ON_SAME_LINE/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_WHILE_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SIMPLE_BLOCK_STYLE/@EntryValue" value="DO_NOT_CHANGE" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_CAST_EXPRESSION_PARENTHESES/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COMMA_IN_TEMPLATE_ARGS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COMMA_IN_TEMPLATE_PARAMS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_EXTENDS_COLON/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_COLON/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_SEMICOLON/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_DATA_MEMBER/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_DATA_MEMBERS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_METHOD/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_NESTED_DECLARATOR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_DATA_MEMBER/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_DATA_MEMBERS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_METHOD/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_UNARY_OPERATOR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_EXTENDS_COLON/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_COLON/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_SEMICOLON/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_ABSTRACT_DECL/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_DATA_MEMBER/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_DATA_MEMBERS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_METHOD/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_ABSTRACT_DECL/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_DATA_MEMBER/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_DATA_MEMBERS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_METHOD/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_ARGS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BETWEEN_CLOSING_ANGLE_BRACKETS_IN_TEMPLATE_ARGS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_ARRAY_ACCESS_BRACKETS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_CAST_EXPRESSION_PARENTHESES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_DECLARATION_PARENTHESES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_BLOCKS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_METHOD_PARENTHESES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_ARGS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPECIAL_ELSE_IF_TREATMENT/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TAB_WIDTH/@EntryValue" value="4" type="int" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_BINARY_OPSIGN/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_DECLARATION_LPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_INVOCATION_LPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_ARGUMENTS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_DECLARATION_LPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_DECLARATION_RPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_INVOCATION_LPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_INVOCATION_RPAR/@EntryValue" value="false" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_TERNARY_OPSIGNS/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_PARAMETERS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
<option name="/Default/CodeStyle/EditorConfig/EnableClangFormatSupport/@EntryValue" value="false" type="bool" />
</component>
</project>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/pti-ledy.iml" filepath="$PROJECT_DIR$/.idea/pti-ledy.iml" />
</modules>
</component>
</project>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="CPP_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
Generated
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
+2 -1
View File
@@ -1,4 +1,5 @@
constexpr bool font7x5[95][7][5] = {
constexpr bool font7x5[95][7][5] =
{
// ! (ASCII 33)
{
{false, false, true, false, false},
+81 -8
View File
@@ -16,27 +16,100 @@
#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() {
void setup()
{
Serial.begin(115200);
pixels.begin();
pixels.clear();
drawCharacter(font7x5['P' - '!'], 7, 5, 0x00030100);
drawCharacter(font7x5['T' - '!'], 7, 5, 0x00030100);
drawCharacter(font7x5['I' - '!'], 7, 5, 0x00030100);
addLeftScrollableTextOnScreen("Its alive!");
pixels.show();
start_server();
}
void loop() {
void loop()
{
shiftGivenRectangle(0, 0, 19, 7, 1);
pixels.show();
handle_server();
+57 -34
View File
@@ -4,7 +4,8 @@ unsigned char saved_images_count = 0;
Cursor cursor1;
uint32_t saved_imaged[12][16][16] = {
uint32_t saved_imaged[2][16][16] =
{
{
{
0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000
@@ -57,7 +58,8 @@ uint32_t saved_imaged[12][16][16] = {
}
};
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)
{
y = PANEL_PIXEL_COUNT - 1 - y;
@@ -65,7 +67,8 @@ void setPixel(unsigned short x, unsigned short y, uint32_t color) {
pixels.setPixelColor(y + (x * PANEL_PIXEL_COUNT), color);
}
uint32_t getPixelColor(unsigned short x, unsigned short y) {
uint32_t getPixelColor(unsigned short x, unsigned short y)
{
if (x % 2 == 1)
{
y = PANEL_PIXEL_COUNT - 1 - y;
@@ -73,78 +76,98 @@ uint32_t getPixelColor(unsigned short x, unsigned short y) {
return pixels.getPixelColor(y + (x * PANEL_PIXEL_COUNT));
}
void drawImageFromSaved(unsigned short offset_x, unsigned short offset_y, unsigned char i) {
for (int row = 0; row < 16; row++) {
for (int col = 0; col < 16; col++) {
void drawImageFromSaved(unsigned short offset_x, unsigned short offset_y, unsigned char i)
{
for (int row = 0; row < 16; row++)
{
for (int col = 0; col < 16; col++)
{
uint32_t px_color = saved_imaged[i][row][col];
if (!px_color) {
if (!px_color)
{
continue;
}
unsigned short pixel_x = col + offset_x;
unsigned short pixel_y = row + offset_y;
if (pixel_x >= 0 && pixel_x < NUMPIXELS &&
pixel_y >= 0 && pixel_y < NUMPIXELS) {
pixel_y >= 0 && pixel_y < NUMPIXELS)
{
setPixel(pixel_x, pixel_y, px_color);
}
}
}
}
void drawCharacter(const bool (*character)[5], unsigned char height, unsigned char width, uint32_t color) {
for (unsigned char row = 0; row < 7; row++) {
for (unsigned char col = 0; col < 5; col++) {
if (character[row][col]) {
unsigned short pixel_x = col + cursor1.x;
unsigned short pixel_y = row + cursor1.y;
void drawCharacter(const bool (*character)[5], unsigned char height, unsigned char width, uint32_t color, Cursor (*used_cursor))
{
for (unsigned char row = 0; row < 7; row++)
{
for (unsigned char col = 0; col < 5; col++)
{
if (character[row][col])
{
unsigned short pixel_x = col + used_cursor.x;
unsigned short pixel_y = row + used_cursor.y;
if (pixel_x >= 0 && pixel_x < NUMPIXELS &&
pixel_y >= 0 && pixel_y < NUMPIXELS) {
pixel_y >= 0 && pixel_y < NUMPIXELS)
{
setPixel(pixel_x, pixel_y, color);
}
}
}
}
cursor1.x += width + 1;
used_cursor.x += width + 1;
}
void fillPixels(unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, uint32_t color)
{
if (x1 > x2) {
unsigned short tmp = x1; x1 = x2; x2 = tmp;
if (x1 > x2)
{
unsigned short tmp = x1; x1 = x2; x2 = tmp;
}
if (y1 > y2) {
unsigned short tmp = y1; y1 = y2; y2 = tmp;
if (y1 > y2)
{
unsigned short tmp = y1; y1 = y2; y2 = tmp;
}
unsigned short width = (unsigned short)(x2 - x1 + 1);
unsigned short height = (unsigned short)(y2 - y1 + 1);
for (unsigned short i = 0; i < height; i++) {
for (unsigned short j = 0; j < width; j++) {
setPixel(x1 + j, y1 + i, color);
}
for (unsigned short i = 0; i < height; i++)
{
for (unsigned short j = 0; j < width; j++)
{
setPixel(x1 + j, y1 + i, color);
}
}
}
void shiftGivenRectangle(unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, unsigned char shiftBy) {
if (!shiftBy) {
void shiftGivenRectangle(unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, unsigned char shift_by)
{
if (!shift_by)
{
return;
}
if (x1 > x2) {
unsigned short tmp = x1; x1 = x2; x2 = tmp;
if (x1 > x2)
{
unsigned short tmp = x1; x1 = x2; x2 = tmp;
}
if (y1 > y2) {
unsigned short tmp = y1; y1 = y2; y2 = tmp;
if (y1 > y2)
{
unsigned short tmp = y1; y1 = y2; y2 = tmp;
}
unsigned short width = (unsigned short)(x2 - x1 + 1);
unsigned short height = (unsigned short)(y2 - y1 + 1);
for (unsigned short i = 0; i < height; i++) {
for (unsigned short j = 0; j < width + shiftBy; j++) {
setPixel(x1 + j - shiftBy, y1 + i, getPixelColor(x1 + j, y1 + i));
setPixel(x1 + j, y1 + i, 0x00000000);
for (unsigned short i = 0; i < height; i++)
{
for (unsigned short j = 0; j < width + shift_by; j++)
{
setPixel(x1 + j - shift_by, y1 + i, getPixelColor(x1 + j, y1 + i));
setPixel(x1 + j, y1 + i, 0x00000000);
}
}
}
+24 -12
View File
@@ -10,12 +10,15 @@ WebServer server(80);
Pixel new_image[16][16];
void handleRoot() {
void handleRoot()
{
server.send(200, "text/html", index_html);
}
void handleUpload() {
if (server.hasArg("plain") == false) {
void handleUpload()
{
if (server.hasArg("plain") == false)
{
server.send(400, "text/plain", "body not received");
return;
}
@@ -24,9 +27,11 @@ void handleUpload() {
deserializeJson(doc, body);
JsonArray arr = doc.as<JsonArray>();
int row = 0;
for (JsonVariant val : arr) {
for (JsonVariant val : arr)
{
int col = 0;
for (JsonVariant val2 : val.as<JsonArray>()) {
for (JsonVariant val2 : val.as<JsonArray>())
{
unsigned long color = strtoul(val2.as<const char*>(), NULL, 16);
new_image[row][col] = { (unsigned short)col, (unsigned short)row, (uint32_t)color };
col++;
@@ -35,13 +40,16 @@ void handleUpload() {
}
// Save the new image to the next slot
if (saved_images_count < 11) { // Ensure we don't overflow (max index is 11)
if (saved_images_count < 11)
{ // Ensure we don't overflow (max index is 11)
saved_images_count++;
}
// Copy new_image data to saved_imaged array
for (int r = 0; r < 16; r++) {
for (int c = 0; c < 16; c++) {
for (int r = 0; r < 16; r++)
{
for (int c = 0; c < 16; c++)
{
saved_imaged[saved_images_count][r][c] = new_image[r][c].color;
}
}
@@ -52,16 +60,19 @@ void handleUpload() {
server.send(200, "text/plain", "OK");
}
void handleShowSaved() {
void handleShowSaved()
{
pixels.clear();
drawImageFromSaved(0, 0, 0);
pixels.show();
server.send(200, "text/plain", "OK");
}
void start_server() {
void start_server()
{
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
while (WiFi.status() != WL_CONNECTED)
{
delay(1000);
Serial.println("Connecting to WiFi...");
}
@@ -74,6 +85,7 @@ void start_server() {
server.begin();
}
void handle_server() {
void handle_server()
{
server.handleClient();
}
+21 -2
View File
@@ -1,12 +1,31 @@
struct Cursor {
struct Cursor
{
unsigned short x;
unsigned short y;
Cursor() : x(0), y(0) {}
};
struct Pixel {
struct Pixel
{
unsigned short x;
unsigned short y;
uint32_t color;
};
struct Text
{
char content[SCROLLABLE_TEXT_MAX_LENGTH];
uint32_t color;
unsigned short pos_x;
unsigned short pos_y;
struct CharacterSize
{
unsigned short height;
unsigned short width;
} characterSize;
unsigned char character_count;
bool deleted;
Text() : color(0), pos_x(0), pos_y(0), character_count(0), characterSize({7,5,0}), deleted(true) {}
};