diff --git a/README.md b/README.md index 3baf8dc..5bc50e3 100644 --- a/README.md +++ b/README.md @@ -4,4 +4,12 @@ +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 + +Add a drawing as a binary image (features) + +State of panel + +Remote panel on/off +#Docs for API +*Endpoints + +10.131.170.4 - the local static IP + +/api/text - endpoint for editing text (POST) + +/api/led - endpint for on/off panel (POST) + +/api/led - endpoint for check on/off panel (GET), return "{"led":"true"}" if panel ON and "{"led":"false"}" if panel OFF diff --git a/panel.ino b/panel.ino index 08f5e90..04d17c2 100644 --- a/panel.ino +++ b/panel.ino @@ -8,14 +8,15 @@ #define DISPLAYS_ACROSS 1 #define DISPLAYS_DOWN 1 DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN); +bool panel = true; 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); +IPAddress staticIP(10, 131, 170, 4); +IPAddress gateway(10, 131, 170, 1); +IPAddress subnet(255, 255, 255, 0); String displayText = "Привет из СКБ \"КИТ\""; //String displayText = "Пизда с членом разлучились("; @@ -25,59 +26,85 @@ void IRAM_ATTR triggerScan() { dmd.scanDisplayBySPI(); } -void reader(){} +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)) { + + 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", - "" - "" - "
" - "" - "" + displayText + "
"); + server.send(200, "text/html; charset=UTF-8", + "" + displayText + "
"); }); server.begin(); @@ -93,19 +120,19 @@ void setup() { 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(); - } - } + + // // Очистка экрана и вывод текста + // 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(); + // } + // } }