From 81bcb27e3026b87fa96d8e30fbfba6ccc279935b Mon Sep 17 00:00:00 2001 From: maksb2bb Date: Mon, 17 Feb 2025 13:27:57 +0300 Subject: [PATCH] first comit --- README.md | 7 ++++ kit128.bmp | Bin 0 -> 1088 bytes output.txt | 64 ++++++++++++++++++++++++++++++ panel.ino | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 182 insertions(+) create mode 100644 README.md create mode 100644 kit128.bmp create mode 100644 output.txt create mode 100644 panel.ino diff --git a/README.md b/README.md new file mode 100644 index 0000000..3baf8dc --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +#The code for the panel is P10 + ESP32 +********* +*List of features + +Edit text in real time via HomeAssistiant + +Split sentences into lines(features) + +Enable/disable text scrolling (features) + +Add a drawing as a binary image (features) \ No newline at end of file diff --git a/kit128.bmp b/kit128.bmp new file mode 100644 index 0000000000000000000000000000000000000000..07c2e6d7f75d99fb3e1a75aea8e1824e88b78f0e GIT binary patch literal 1088 zcmdVZu};H43Z6c1=*qy5i4`_Fg#7h2 zFP!iMNxa){!3R+l{1&HdH**?3`W jxzh#rVSLc`@mI*gn~&-_WL=^qx7wt=rnTy?lx`arrnPC# literal 0 HcmV?d00001 diff --git a/output.txt b/output.txt new file mode 100644 index 0000000..48d43e1 --- /dev/null +++ b/output.txt @@ -0,0 +1,64 @@ +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000 +11100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011000000000000 +11100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001101100000000 +10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001101101111111 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001101111111 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001101111111 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001100111110 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110011100 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111011000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001011000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001110000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000111111111111111000000000000000000000000000000000000111000000 +00000000000000000000000000000000000000000000000000000000000000001111111111111111111111111100000000000000000000000000110011000000 +00000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111110000000000000000001111001000000 +00000000000000000000000000000000000000000000000000000000000000001110111111111111111111111111111111111101111111111111111100000000 +00000000000000000000000000000000000000000000000000000000000000001111011111111111111111111111111111111101111111111111111110000000 +00000000000000000000000000000000000000000000000000000000000000001111100000000000000000011111111111111110111111111111111100000000 +00000000000000000000000000000000000000000000000000000000000000000111111111111111111111001111111111111111011111111110011000000000 +00000000000000000000000000000000000000000000000000000000000000000111111111111111111111100111111111111111100000000000111000000000 +00000000000000000000000000000000000000000000000000000000000000000111111111111111111111110011111111111111111111111111110000000000 +00000000000000000000000000000000000000000000000000000000000000000011111111111110111111111001111111111111111111111111100000000000 +00000000000000000000000000000000000000000000000000000000000000000001111111111100011111111100111111111111111111111111000000000000 +00000000000000000000000000000000000000000000000000000000000000000000111111111100011111111110000000011111111111111110000000000000 +00000000000000000000000000000000000000000000000000000000000000000000011111111110111111111111111111000000011111111100000000000000 +00000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111101111110000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000111111111111111111111111111111111110111000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000011111111111111111111111111111111111110000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111110000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111110000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000111111100000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000011111110000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000001111110000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000111111000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000011111000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000111100000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000011110000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +11111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 diff --git a/panel.ino b/panel.ino new file mode 100644 index 0000000..08f5e90 --- /dev/null +++ b/panel.ino @@ -0,0 +1,111 @@ +#include +#include +#include +#include +#include + +#define FONT Font_BOLD +#define DISPLAYS_ACROSS 1 +#define DISPLAYS_DOWN 1 +DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN); + +const char* ssid = "SKBKIT"; +const char* password = "skbkit2024"; + +WebServer server(80); +IPAddress staticIP(10,131,170,4); +IPAddress gateway(10,131,170,1); +IPAddress subnet(255,255,255,0); + +String displayText = "Привет из СКБ \"КИТ\""; +//String displayText = "Пизда с членом разлучились("; +hw_timer_t* timer = NULL; + +void IRAM_ATTR triggerScan() { + dmd.scanDisplayBySPI(); +} + +void reader(){} + +void setup() { + Serial.begin(115200); + dmd.selectFont(Font_BOLD); + WiFi.begin(ssid, password); + //WiFi.config(staticIP, gateway, subnet); + + if(!WiFi.config(staticIP, gateway, subnet)) { + Serial.println("Failed to configure Static IP"); + } else { + Serial.println("Static IP configured!"); + } + + // if(!SPIFFS.begin()){ + // Serial.print("An occurred ERROR"); + // log_e("OCCURRED ERROR"); + // return; + // } + + while (WiFi.status() != WL_CONNECTED) { + delay(500); + Serial.print("."); + } + + Serial.println("\nConnected to WiFi"); + Serial.println(WiFi.localIP()); + + // Обрабатываем GET запрос для главной страницы с формой + server.on("/", HTTP_GET, []() { + server.send(200, "text/html", + "" + "" + "" + "" + "Panel text" + "" + "" + "

Введите текст для отображения на экране:

" + "
" + "" + ""); + }); + + // Обрабатываем POST запрос для изменения текста + server.on("/api/text", HTTP_POST, []() { + if (server.hasArg("text")) { + // Получаем текст с формы без преобразования в HTML-сущности + displayText = server.arg("text"); + } + // Отправляем ответ с правильной кодировкой UTF-8 + server.send(200, "text/html; charset=UTF-8", + "

Text set to:

" + displayText + "

"); + }); + + server.begin(); + + uint8_t cpuClock = ESP.getCpuFreqMHz(); + timer = timerBegin(0, cpuClock, true); + timerAttachInterrupt(timer, &triggerScan, true); + timerAlarmWrite(timer, 300, true); + timerAlarmEnable(timer); + + dmd.clearScreen(true); +} + +void loop() { + server.handleClient(); // Обработка запросов от клиента + + // Очистка экрана и вывод текста + dmd.clearScreen(true); + dmd.drawMarquee(displayText.c_str(), displayText.length(), (32 * DISPLAYS_ACROSS) - 1, 0); + + long start = millis(); + long timer = start; + boolean ret = false; + + while (!ret) { + if ((timer + 30) < millis()) { + ret = dmd.stepMarquee(-1, 0); // Прокрутка текста + timer = millis(); + } + } +}