1
0
mirror of https://github.com/s00500/ESPUI.git synced 2025-07-04 06:10:18 +00:00

6 Commits
1.4.1 ... 1.4.3

Author SHA1 Message Date
851c363aba version bump 2017-12-26 21:14:06 +01:00
c72bff5b2e #5 fixing textThem to function properly 2017-12-26 21:10:54 +01:00
679bf1a5c1 fixed single quotes 2017-12-26 19:35:53 +01:00
8150ba8f82 version bump next patch 2017-12-25 17:03:33 +01:00
4af48ce87d fixing prepareFileSystem zepto name 2017-12-25 17:01:55 +01:00
ad9033cfe3 version bump patch 2017-12-25 16:40:37 +01:00
2 changed files with 22 additions and 11 deletions

View File

@ -1,5 +1,5 @@
name=ESPUI
version=1.4.0
version=1.4.3
author=Lukas Bachschwell
maintainer=Lukas Bachschwell <lukas@lbsfilm.at>
sentence=ESP32 and ESP8266 Web Interface Library

View File

@ -49,7 +49,7 @@ void writeFile(fs::FS &fs, const char * path, const char * data){
void ESPUIClass::prepareFileSystem(){
// this function should only be used once
Serial.println('About to prepare filesystem...');
Serial.println("About to prepare filesystem...");
#if defined(ESP32)
if(!SPIFFS.begin(true)) {
@ -67,7 +67,7 @@ deleteFile(SPIFFS, "/css/style.css");
deleteFile(SPIFFS, "/css/normalize.css");
deleteFile(SPIFFS, "/js/controls.js");
deleteFile(SPIFFS, "/js/zepto.js");
deleteFile(SPIFFS, "/js/zepto.min.js");
deleteFile(SPIFFS, "/js/slider.js");
Serial.println('Cleanup done');
@ -78,7 +78,7 @@ writeFile(SPIFFS, "/index.htm", HTML_INDEX);
writeFile(SPIFFS, "/css/style.css", CSS_STYLE);
writeFile(SPIFFS, "/css/normalize.css", CSS_NORMALIZE);
writeFile(SPIFFS, "/js/zepto.js", JS_ZEPTO);
writeFile(SPIFFS, "/js/zepto.min.js", JS_ZEPTO);
writeFile(SPIFFS, "/js/controls.js", JS_CONTROLS);
writeFile(SPIFFS, "/js/slider.js", JS_SLIDER);
@ -95,12 +95,17 @@ void onWsEvent(AsyncWebSocket *server, AsyncWebSocketClient *client,
Serial.printf("Disconnected!\n");
break;
case WS_EVT_CONNECT: {
if (debug)
Serial.println("Connected");
if (debug){
Serial.print("Connected: ");
Serial.println(client->id());
}
ESPUI.jsonDom(client);
if (debug)
if (debug){
Serial.println("JSON Data Sent to Client!");
} break;
}
}
break;
case WS_EVT_DATA:
String msg = "";
for (size_t i = 0; i < len; i++) {
@ -337,11 +342,17 @@ void ESPUIClass::updateSwitcher(String label, bool nValue, int clientId) {
updateSwitcher(getIdByLabel(label), nValue, clientId);
}
// This is a hacky workaround because ESPAsyncWebServer does not have a function like this and it's clients array is private
void ESPUIClass::textThem(String text, int clientId){
for(int i = 1; i <= this->ws->count(); i++){
if(clientId!=i){
this->ws->client(i)->text(text);
int tryId = 0;
for(int count = 0; count < this->ws->count();){
if(this->ws->hasClient(tryId)) {
if(clientId!=tryId){
this->ws->client(tryId)->text(text);
}
count++;
}
tryId++;
}
}