diff --git a/CHANGELOG.md b/CHANGELOG.md index 014423f..da0856f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ ## Roc-MQTT-Display Changelog +### Roc-MQTT-Display release 1.09 +2022-11-14 - tested with Arduino IDE 1.8.19 with latest versions of included libraries + +- OTA default password set to 'RMDOTA' +- Webinterface - optimized +- Webinterface - added Station and Track info for each display in configuration. +- Fixes - for Issues #31, #32 + ### Roc-MQTT-Display release 1.08 2022-10-30 - tested with Arduino IDE 1.8.19 with latest versions of included libraries diff --git a/README.md b/README.md index 46f0191..1009b2b 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ Several controllers can run in parallel so the total number of displays is not l A friend of mine was looking for an easy way to run displays with live data in his model railroad environment. Right after this conversation this project was born. Since then it's a work in progress with already many nice features. If you want to share your experience with this code or have ideas for more features you are welcome to share them in the Issues or Discussions area. Have fun. -Latest Version 1.08 -October 30, 2022 +Latest Version 1.09 +November 14, 2022 Thank you for your interest in the Roc-MQTT-Display project. If you like the project please Star it here on GitHub and consider donating if you want to support further development. diff --git a/src/RocMQTTdisplay.ino b/src/RocMQTTdisplay.ino index 661cf0d..e79a302 100644 --- a/src/RocMQTTdisplay.ino +++ b/src/RocMQTTdisplay.ino @@ -1,11 +1,11 @@ /*######################################################################################## - Roc-MQTT-Display + Rail-MQTT-Display Dynamic Passenger Information for Model Railroad Stations controlled by Rocrail or other sources via MQTT. A Wemos D1 mini ESP8266 and a TCA9548A I2C Multiplexer can drive up to eight I2C OLED displays. Several D1 mini can run together so the total number of displays is not limited. -Version 1.08 rerelease November 5, 2022 +Version 1.09 November 14, 2022 Copyright (c) 2020-2022 Christian Heinrichs. All rights reserved. https://github.com/chrisweather/RocMQTTdisplay diff --git a/src/config.h b/src/config.h index 53de826..683bfbf 100644 --- a/src/config.h +++ b/src/config.h @@ -1,5 +1,5 @@ // Roc-MQTT-Display CONFIGURATION -// Version 1.08 rerelease +// Version 1.09 // Copyright (c) 2020-2022 Christian Heinrichs. All rights reserved. // https://github.com/chrisweather/RocMQTTdisplay @@ -24,7 +24,7 @@ struct Sec { }; struct Config { - const char* VER = "1.08"; + const char* VER = "1.09"; // WIFI char WIFI_DEVICENAME[19]; // Unique Controller Device Name for WiFi network uint16_t WIFI_RECONDELAY; // Delay between WiFi reconnection attempts, default = 60000 ms @@ -57,12 +57,13 @@ struct Config { }; // Configuration for displays connected to this controller (Disp) 1-8 -// Disp1, Disp2, Disp3, Disp4, Disp5, Disp6, Disp7, Disp8 -char DPL_id[8][4] = { "D01", "D02", "D03", "D04", "D05", "D06", "D07", "D08" }; // ID's of Displays 1-8 connected to this controller, e.g. D01...D99 -uint8_t DPL_flip[] = { 0, 1, 1, 0, 0, 1, 1, 0 }; // 0,1 180 degree hardware based rotation of the internal frame buffer when 1 -//uint8_t DPL_rotation[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; // 0,90,180,270 software based display content rotation by 0, 90, 180, 270 degrees, still work in progress -uint8_t DPL_contrast[] = { 1, 1, 1, 1, 1, 1, 1, 1 }; // 0-255 0=display off (works with some displays only), default = 1, 255 max brightness, change requires reboot -uint8_t DPL_side[] = { 1, 0, 0, 1, 1, 0, 0, 1 }; // 0,1 0=Side A, 1=Side B +// Disp1, Disp2, Disp3, Disp4, Disp5, Disp6, Disp7, Disp8 +char DPL_id[8][4] = { "D01", "D02", "D03", "D04", "D05", "D06", "D07", "D08" }; // ID's of Displays 1-8 connected to this controller, e.g. D01...D99 +char DPL_station[8][4] = { "", "", "", "", "", "", "", "" }; // Station, where the display is installed, e.g. Hbg, Kln, Ams, Wie, ... +uint8_t DPL_track[] = { 1, 1, 1, 1, 1, 1, 1, 1 }; // 1...99 track, where the display is installed, e.g. 1...99 +uint8_t DPL_flip[] = { 0, 1, 1, 0, 0, 1, 1, 0 }; // 0,1 180 degree hardware based rotation of the internal frame buffer when 1 +uint8_t DPL_contrast[] = { 1, 1, 1, 1, 1, 1, 1, 1 }; // 0-255 0=display off (works with some displays only), default = 1, 255 max brightness, change requires reboot +uint8_t DPL_side[] = { 1, 0, 0, 1, 1, 0, 0, 1 }; // 0,1 0=Side A, 1=Side B struct Template { }; @@ -92,7 +93,7 @@ void loadConfiguration(const char *configfile, Config &config) // Open config json file for reading File file = LittleFS.open(configfile, "r"); delay(200); - StaticJsonDocument<1800> doc; + StaticJsonDocument<2500> doc; DeserializationError error = deserializeJson(doc, file); if (error) { Serial.println(F("Failed to convert json file, using default configuration")); @@ -135,6 +136,22 @@ void loadConfiguration(const char *configfile, Config &config) strlcpy(DPL_id[5], doc["DPL_ID5"] | "D06", sizeof(DPL_id[5])); strlcpy(DPL_id[6], doc["DPL_ID6"] | "D07", sizeof(DPL_id[6])); strlcpy(DPL_id[7], doc["DPL_ID7"] | "D08", sizeof(DPL_id[7])); + strlcpy(DPL_station[0], doc["DPL_STATION00"] | "", sizeof(DPL_station[0])); + strlcpy(DPL_station[1], doc["DPL_STATION01"] | "", sizeof(DPL_station[1])); + strlcpy(DPL_station[2], doc["DPL_STATION02"] | "", sizeof(DPL_station[2])); + strlcpy(DPL_station[3], doc["DPL_STATION03"] | "", sizeof(DPL_station[3])); + strlcpy(DPL_station[4], doc["DPL_STATION04"] | "", sizeof(DPL_station[4])); + strlcpy(DPL_station[5], doc["DPL_STATION05"] | "", sizeof(DPL_station[5])); + strlcpy(DPL_station[6], doc["DPL_STATION06"] | "", sizeof(DPL_station[6])); + strlcpy(DPL_station[7], doc["DPL_STATION07"] | "", sizeof(DPL_station[7])); + DPL_track[0] = doc["DPL_TRACK0"] | 1; + DPL_track[1] = doc["DPL_TRACK1"] | 1; + DPL_track[2] = doc["DPL_TRACK2"] | 1; + DPL_track[3] = doc["DPL_TRACK3"] | 1; + DPL_track[4] = doc["DPL_TRACK4"] | 1; + DPL_track[5] = doc["DPL_TRACK5"] | 1; + DPL_track[6] = doc["DPL_TRACK6"] | 1; + DPL_track[7] = doc["DPL_TRACK7"] | 1; DPL_flip[0] = doc["DPL_FLIP0"] | 0; DPL_flip[1] = doc["DPL_FLIP1"] | 0; DPL_flip[2] = doc["DPL_FLIP2"] | 0; @@ -208,6 +225,22 @@ void saveConfiguration(const char *configfile, const Config &config) doc["DPL_ID5"] = DPL_id[5]; doc["DPL_ID6"] = DPL_id[6]; doc["DPL_ID7"] = DPL_id[7]; + doc["DPL_STATION00"] = DPL_station[0]; + doc["DPL_STATION01"] = DPL_station[1]; + doc["DPL_STATION02"] = DPL_station[2]; + doc["DPL_STATION03"] = DPL_station[3]; + doc["DPL_STATION04"] = DPL_station[4]; + doc["DPL_STATION05"] = DPL_station[5]; + doc["DPL_STATION06"] = DPL_station[6]; + doc["DPL_STATION07"] = DPL_station[7]; + doc["DPL_TRACK0"] = DPL_track[0]; + doc["DPL_TRACK1"] = DPL_track[1]; + doc["DPL_TRACK2"] = DPL_track[2]; + doc["DPL_TRACK3"] = DPL_track[3]; + doc["DPL_TRACK4"] = DPL_track[4]; + doc["DPL_TRACK5"] = DPL_track[5]; + doc["DPL_TRACK6"] = DPL_track[6]; + doc["DPL_TRACK7"] = DPL_track[7]; doc["DPL_FLIP0"] = DPL_flip[0]; doc["DPL_FLIP1"] = DPL_flip[1]; doc["DPL_FLIP2"] = DPL_flip[2]; diff --git a/src/template.h b/src/template.h index e10572b..4b2a965 100644 --- a/src/template.h +++ b/src/template.h @@ -1,5 +1,5 @@ // Roc-MQTT-Display TEMPLATES -// Version 1.08 rerelease +// Version 1.09 // Copyright (c) 2020-2022 Christian Heinrichs. All rights reserved. // https://github.com/chrisweather/RocMQTTdisplay diff --git a/src/web.h b/src/web.h index 0f9fd30..8a711fb 100644 --- a/src/web.h +++ b/src/web.h @@ -1,5 +1,5 @@ // Roc-MQTT-Display WEBSERVER -// Version 1.08 rerelease +// Version 1.09 // Copyright (c) 2020-2022 Christian Heinrichs. All rights reserved. // https://github.com/chrisweather/RocMQTTdisplay @@ -88,6 +88,22 @@ void loadCfg() buf1.replace("%DPL_ID5%", String(DPL_id[5])); buf1.replace("%DPL_ID6%", String(DPL_id[6])); buf1.replace("%DPL_ID7%", String(DPL_id[7])); + buf1.replace("%DPL_STATION00%", String(DPL_station[0])); + buf1.replace("%DPL_STATION01%", String(DPL_station[1])); + buf1.replace("%DPL_STATION02%", String(DPL_station[2])); + buf1.replace("%DPL_STATION03%", String(DPL_station[3])); + buf1.replace("%DPL_STATION04%", String(DPL_station[4])); + buf1.replace("%DPL_STATION05%", String(DPL_station[5])); + buf1.replace("%DPL_STATION06%", String(DPL_station[6])); + buf1.replace("%DPL_STATION07%", String(DPL_station[7])); + buf1.replace("%DPL_TRACK0%", String(DPL_track[0])); + buf1.replace("%DPL_TRACK1%", String(DPL_track[1])); + buf1.replace("%DPL_TRACK2%", String(DPL_track[2])); + buf1.replace("%DPL_TRACK3%", String(DPL_track[3])); + buf1.replace("%DPL_TRACK4%", String(DPL_track[4])); + buf1.replace("%DPL_TRACK5%", String(DPL_track[5])); + buf1.replace("%DPL_TRACK6%", String(DPL_track[6])); + buf1.replace("%DPL_TRACK7%", String(DPL_track[7])); buf1.replace("%DPL_FLIP0%", String(DPL_flip[0])); buf1.replace("%DPL_FLIP1%", String(DPL_flip[1])); buf1.replace("%DPL_FLIP2%", String(DPL_flip[2])); @@ -153,6 +169,22 @@ void handleCfgSubmit() if (webserver.argName(i) == "f_DPL_ID5") { webserver.arg(webserver.argName(i)).toCharArray(DPL_id[5], sizeof(DPL_id[5])); } if (webserver.argName(i) == "f_DPL_ID6") { webserver.arg(webserver.argName(i)).toCharArray(DPL_id[6], sizeof(DPL_id[6])); } if (webserver.argName(i) == "f_DPL_ID7") { webserver.arg(webserver.argName(i)).toCharArray(DPL_id[7], sizeof(DPL_id[7])); } + if (webserver.argName(i) == "f_DPL_STATION00") { webserver.arg(webserver.argName(i)).toCharArray(DPL_station[0], sizeof(DPL_station[0])); } + if (webserver.argName(i) == "f_DPL_STATION01") { webserver.arg(webserver.argName(i)).toCharArray(DPL_station[1], sizeof(DPL_station[1])); } + if (webserver.argName(i) == "f_DPL_STATION02") { webserver.arg(webserver.argName(i)).toCharArray(DPL_station[2], sizeof(DPL_station[2])); } + if (webserver.argName(i) == "f_DPL_STATION03") { webserver.arg(webserver.argName(i)).toCharArray(DPL_station[3], sizeof(DPL_station[3])); } + if (webserver.argName(i) == "f_DPL_STATION04") { webserver.arg(webserver.argName(i)).toCharArray(DPL_station[4], sizeof(DPL_station[4])); } + if (webserver.argName(i) == "f_DPL_STATION05") { webserver.arg(webserver.argName(i)).toCharArray(DPL_station[5], sizeof(DPL_station[5])); } + if (webserver.argName(i) == "f_DPL_STATION06") { webserver.arg(webserver.argName(i)).toCharArray(DPL_station[6], sizeof(DPL_station[6])); } + if (webserver.argName(i) == "f_DPL_STATION07") { webserver.arg(webserver.argName(i)).toCharArray(DPL_station[7], sizeof(DPL_station[7])); } + if (webserver.argName(i) == "f_DPL_TRACK0") { DPL_track[0] = webserver.arg(webserver.argName(i)).toInt(); } + if (webserver.argName(i) == "f_DPL_TRACK1") { DPL_track[1] = webserver.arg(webserver.argName(i)).toInt(); } + if (webserver.argName(i) == "f_DPL_TRACK2") { DPL_track[2] = webserver.arg(webserver.argName(i)).toInt(); } + if (webserver.argName(i) == "f_DPL_TRACK3") { DPL_track[3] = webserver.arg(webserver.argName(i)).toInt(); } + if (webserver.argName(i) == "f_DPL_TRACK4") { DPL_track[4] = webserver.arg(webserver.argName(i)).toInt(); } + if (webserver.argName(i) == "f_DPL_TRACK5") { DPL_track[5] = webserver.arg(webserver.argName(i)).toInt(); } + if (webserver.argName(i) == "f_DPL_TRACK6") { DPL_track[6] = webserver.arg(webserver.argName(i)).toInt(); } + if (webserver.argName(i) == "f_DPL_TRACK7") { DPL_track[7] = webserver.arg(webserver.argName(i)).toInt(); } if (webserver.argName(i) == "f_DPL_FLIP0") { DPL_flip[0] = webserver.arg(webserver.argName(i)).toInt(); } if (webserver.argName(i) == "f_DPL_FLIP1") { DPL_flip[1] = webserver.arg(webserver.argName(i)).toInt(); } if (webserver.argName(i) == "f_DPL_FLIP2") { DPL_flip[2] = webserver.arg(webserver.argName(i)).toInt(); } @@ -273,7 +305,7 @@ void loadTpl1() buf1.replace("%TPL_LOGO19H%", String(logoh[19])); String lbuf = ""; - +/* for (i = 0; i < (logo0size); i++){ if (uint8_t(logo0[i]) < 16){ lbuf += String("0x0"); @@ -532,7 +564,28 @@ void loadTpl1() if (i < (logo19size - 1)) lbuf += String(", "); } buf1.replace("%TPL_LOGO19%", String(lbuf)); - + */ + buf1.replace("%TPL_LOGO0%", String(lbuf)); + buf1.replace("%TPL_LOGO1%", String(lbuf)); + buf1.replace("%TPL_LOGO2%", String(lbuf)); + buf1.replace("%TPL_LOGO3%", String(lbuf)); + buf1.replace("%TPL_LOGO4%", String(lbuf)); + buf1.replace("%TPL_LOGO5%", String(lbuf)); + buf1.replace("%TPL_LOGO6%", String(lbuf)); + buf1.replace("%TPL_LOGO7%", String(lbuf)); + buf1.replace("%TPL_LOGO8%", String(lbuf)); + buf1.replace("%TPL_LOGO9%", String(lbuf)); + buf1.replace("%TPL_LOGO10%", String(lbuf)); + buf1.replace("%TPL_LOGO11%", String(lbuf)); + buf1.replace("%TPL_LOGO12%", String(lbuf)); + buf1.replace("%TPL_LOGO13%", String(lbuf)); + buf1.replace("%TPL_LOGO14%", String(lbuf)); + buf1.replace("%TPL_LOGO15%", String(lbuf)); + buf1.replace("%TPL_LOGO16%", String(lbuf)); + buf1.replace("%TPL_LOGO17%", String(lbuf)); + buf1.replace("%TPL_LOGO18%", String(lbuf)); + buf1.replace("%TPL_LOGO19%", String(lbuf)); + webserver.setContentLength( buf1.length() ); webserver.send( 200, "text/html", buf1 ); buf1 = "";