diff --git a/docs/use/displays.md b/docs/use/displays.md index c93d42aeea..b21d89cf3a 100644 --- a/docs/use/displays.md +++ b/docs/use/displays.md @@ -5,7 +5,7 @@ Several options are available for the display of information on the SSD1306 disp The current SSD1306 display states are being published to the `SSD1306toMQTT` topic, e.g. -`{"onstate":true,"brightness":50,"display-metric":true,"display-flip":true,"idlelogo":true,"log-lcd":false,"json-lcd":true}` +`{"onstate":true,"brightness":50,"display-metric":true,"display-flip":true,"idlelogo":true,"log-oled":false,"json-oled":true}` ### Display ON/OFF To turn the SSD1306 display on or off. @@ -59,27 +59,27 @@ or at runtime with ### Setting the log output -The display of serial log messages to the display can be enabled via compiler directive `-DLOG_TO_LCD=true` or via MQTT commands. +The display of serial log messages to the display can be enabled via compiler directive `-DLOG_TO_OLED=true` or via MQTT commands. -For example if you want to set the serial log to LCD +For example if you want to set the serial log to OLED -`mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoSSD1306/config -m '{"log-lcd":true}'` +`mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoSSD1306/config -m '{"log-oled":true}'` you can also revert it back to the serial monitor: -`mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoSSD1306/config -m '{"log-lcd":false}'` +`mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoSSD1306/config -m '{"log-oled":false}'` -The log level of the messages displayed is Errors and Warnings, and this can only be changed via the compiler directive `-DLOG_LEVEL_LCD=LOG_LEVEL_NOTICE`. +The log level of the messages displayed is Errors and Warnings, and this can only be changed via the compiler directive `-DLOG_LEVEL_OLED=LOG_LEVEL_NOTICE`. ### Displaying Module json messages (default) The display of messages from various modules is also supported. Currently supported modules include `ZgatewayRTL_433`, `ZgatewayBT` and `ZsensorBME280`. -This can be enabled with the compiler directive `-DJSON_TO_LCD=true`. +This can be enabled with the compiler directive `-DJSON_TO_OLED=true`. You can also change it by MQTT. For example if you want to display module json messages: -`mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoSSD1306/config -m '{"json-lcd":true}'` +`mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoSSD1306/config -m '{"json-oled":true}'` And to disable the display of module json messages: diff --git a/environments.ini b/environments.ini index 5dd3867493..c37fa4547a 100644 --- a/environments.ini +++ b/environments.ini @@ -740,9 +740,9 @@ build_flags = '-DZradioSX127x="SX127x"' ; *** ssd1306 Display Options *** '-DZdisplaySSD1306="HELTEC_SSD1306"' -; '-DLOG_TO_LCD=false' ; Enable log to LCD -; '-DJSON_TO_LCD=true' -; '-DLOG_LEVEL_LCD=LOG_LEVEL_NOTICE' +; '-DLOG_TO_OLED=false' ; Enable log to OLED +; '-DJSON_TO_OLED=true' +; '-DLOG_LEVEL_OLED=LOG_LEVEL_NOTICE' ; '-DDISPLAY_IDLE_LOGO=false' ; '-DDISPLAY_BRIGHTNESS=80' ; '-DDISPLAY_METRIC=false' @@ -793,9 +793,9 @@ build_flags = '-DZradioSX127x="SX127x"' ; *** ssd1306 Display Options *** '-DZdisplaySSD1306="LilyGo_SSD1306"' -; '-DLOG_TO_LCD=true' ; Enable log to LCD -; '-DJSON_TO_LCD=true' -; '-DLOG_LEVEL_LCD=LOG_LEVEL_NOTICE' +; '-DLOG_TO_OLED=true' ; Enable log to OLED +; '-DJSON_TO_OLED=true' +; '-DLOG_LEVEL_OLED=LOG_LEVEL_NOTICE' ; '-DDISPLAY_IDLE_LOGO=false' ; '-DDISPLAY_BRIGHTNESS=80' ; '-DDISPLAY_METRIC=false' @@ -960,9 +960,9 @@ build_flags = '-DLED_SEND_RECEIVE_ON=1' ; *** ssd1306 Display Options *** '-DZdisplaySSD1306="HELTEC_SSD1306"' -; '-DLOG_TO_LCD=true' ; Enable log to LCD -; '-DJSON_TO_LCD=true' -; '-DLOG_LEVEL_LCD=LOG_LEVEL_NOTICE' +; '-DLOG_TO_OLED=true' ; Enable log to OLED +; '-DJSON_TO_OLED=true' +; '-DLOG_LEVEL_OLED=LOG_LEVEL_NOTICE' ; '-DDISPLAY_IDLE_LOGO=false' ; '-DDISPLAY_BRIGHTNESS=80' ; '-DDISPLAY_METRIC=false' @@ -988,9 +988,9 @@ build_flags = '-DLED_SEND_RECEIVE_ON=1' ; *** ssd1306 Display Options *** '-DZdisplaySSD1306="HELTEC_SSD1306"' -; '-DLOG_TO_LCD=true' ; Enable log to LCD -; '-DJSON_TO_LCD=true' -; '-DLOG_LEVEL_LCD=LOG_LEVEL_NOTICE' +; '-DLOG_TO_OLED=true' ; Enable log to OLED +; '-DJSON_TO_OLED=true' +; '-DLOG_LEVEL_OLED=LOG_LEVEL_NOTICE' ; '-DDISPLAY_IDLE_LOGO=false' ; '-DDISPLAY_BRIGHTNESS=80' ; '-DDISPLAY_METRIC=false' diff --git a/main/ZdisplaySSD1306.ino b/main/ZdisplaySSD1306.ino index a4ad9152db..fd48ec8f52 100644 --- a/main/ZdisplaySSD1306.ino +++ b/main/ZdisplaySSD1306.ino @@ -41,8 +41,8 @@ SemaphoreHandle_t semaphoreOLEDOperation; QueueHandle_t displayQueue; -boolean logToLCDDisplay = LOG_TO_LCD; -boolean jsonDisplay = JSON_TO_LCD; +boolean logToOLEDDisplay = LOG_TO_OLED; +boolean jsonDisplay = JSON_TO_OLED; boolean displayMetric = DISPLAY_METRIC; boolean displayFlip = DISPLAY_FLIP; boolean displayState = DISPLAY_STATE; @@ -52,9 +52,9 @@ uint8_t displayBrightness = round(DISPLAY_BRIGHTNESS * 2.55); /* Toogle log display */ -void logToLCD(bool display) { - logToLCDDisplay = display; - display ? Log.begin(LOG_LEVEL_LCD, &Oled) : Log.begin(LOG_LEVEL, &Serial); // Log on LCD following LOG_LEVEL_LCD +void logToOLED(bool display) { + logToOLEDDisplay = display; + display ? Log.begin(LOG_LEVEL_OLED, &Oled) : Log.begin(LOG_LEVEL, &Serial); // Log on OLED following LOG_LEVEL_OLED } /* @@ -63,8 +63,8 @@ module setup, for use in Arduino setup void setupSSD1306() { Log.trace(F("Setup SSD1306 Display" CR)); Log.trace(F("ZdisplaySSD1306 command topic: %s" CR), subjectMQTTtoSSD1306set); - Log.trace(F("ZdisplaySSD1306 log-lcd: %T" CR), logToLCDDisplay); - Log.trace(F("ZdisplaySSD1306 json-lcd: %T" CR), jsonDisplay); + Log.trace(F("ZdisplaySSD1306 log-oled: %T" CR), logToOLEDDisplay); + Log.trace(F("ZdisplaySSD1306 json-oled: %T" CR), jsonDisplay); Log.trace(F("ZdisplaySSD1306 DISPLAY_PAGE_INTERVAL: %d" CR), DISPLAY_PAGE_INTERVAL); Log.trace(F("ZdisplaySSD1306 DISPLAY_IDLE_LOGO: %T" CR), DISPLAY_IDLE_LOGO); Log.trace(F("ZdisplaySSD1306 DISPLAY_METRIC: %T" CR), displayMetric); @@ -73,8 +73,8 @@ void setupSSD1306() { Oled.begin(); Log.notice(F("Setup SSD1306 Display end" CR)); -# if LOG_TO_LCD - Log.begin(LOG_LEVEL_LCD, &Oled); // Log on LCD following LOG_LEVEL_LCD +# if LOG_TO_OLED + Log.begin(LOG_LEVEL_OLED, &Oled); // Log on OLED following LOG_LEVEL_OLED jsonDisplay = false; # else jsonDisplay = true; @@ -117,21 +117,21 @@ void loopSSD1306() { /* Handler for mqtt commands sent to the module -- log-lcd: boolean +- log-oled: boolean Enable / Disable display of log messages on display */ void MQTTtoSSD1306(char* topicOri, JsonObject& SSD1306data) { // json object decoding bool success = false; if (cmpToMainTopic(topicOri, subjectMQTTtoSSD1306set)) { Log.trace(F("MQTTtoSSD1306 json set" CR)); - // Log display set between SSD1306 lcd (true) and serial monitor (false) + // Log display set between SSD1306 OLED (true) and serial monitor (false) if (SSD1306data.containsKey("onstate")) { if (displayState != SSD1306data["onstate"]) { displayState = SSD1306data["onstate"]; Oled.begin(); } displayState = SSD1306data["onstate"]; - Log.notice(F("Set display state: %T" CR), logToLCDDisplay); + Log.notice(F("Set display state: %T" CR), logToOLEDDisplay); success = true; } else if (SSD1306data.containsKey("brightness")) { displayBrightness = SSD1306data["brightness"]; @@ -139,21 +139,21 @@ void MQTTtoSSD1306(char* topicOri, JsonObject& SSD1306data) { // json object dec Oled.display->setBrightness(displayBrightness); Log.notice(F("Set brightness: %d" CR), displayBrightness); success = true; - } else if (SSD1306data.containsKey("log-lcd")) { - logToLCDDisplay = SSD1306data["log-lcd"]; - Log.notice(F("Set lcd log: %T" CR), logToLCDDisplay); - logToLCD(logToLCDDisplay); - if (logToLCDDisplay) { + } else if (SSD1306data.containsKey("log-oled")) { + logToOLEDDisplay = SSD1306data["log-oled"]; + Log.notice(F("Set OLED log: %T" CR), logToOLEDDisplay); + logToOLED(logToOLEDDisplay); + if (logToOLEDDisplay) { jsonDisplay = false; } success = true; - } else if (SSD1306data.containsKey("json-lcd")) { - jsonDisplay = SSD1306data["json-lcd"]; + } else if (SSD1306data.containsKey("json-oled")) { + jsonDisplay = SSD1306data["json-oled"]; if (jsonDisplay) { - logToLCDDisplay = false; - logToLCD(logToLCDDisplay); + logToOLEDDisplay = false; + logToOLED(logToOLEDDisplay); } - Log.notice(F("Set json-lcd: %T" CR), jsonDisplay); + Log.notice(F("Set json-oled: %T" CR), jsonDisplay); success = true; } else if (SSD1306data.containsKey("display-metric")) { displayMetric = SSD1306data["display-metric"]; @@ -920,8 +920,8 @@ void stateSSD1306Display() { DISPLAYdata["display-metric"] = (bool)displayMetric; DISPLAYdata["display-flip"] = (bool)displayFlip; DISPLAYdata["idlelogo"] = (bool)idlelogo; - DISPLAYdata["log-lcd"] = (bool)logToLCDDisplay; - DISPLAYdata["json-lcd"] = (bool)jsonDisplay; + DISPLAYdata["log-oled"] = (bool)logToOLEDDisplay; + DISPLAYdata["json-oled"] = (bool)jsonDisplay; pub(subjectSSD1306toMQTT, DISPLAYdata); } diff --git a/main/config_SSD1306.h b/main/config_SSD1306.h index ae8d13cb30..23b6397e1d 100644 --- a/main/config_SSD1306.h +++ b/main/config_SSD1306.h @@ -42,16 +42,16 @@ /*-------------------DEFINE LOG LEVEL----------------------*/ -#ifndef LOG_LEVEL_LCD -# define LOG_LEVEL_LCD LOG_LEVEL_WARNING // Default to only display Warning level messages +#ifndef LOG_LEVEL_OLED +# define LOG_LEVEL_OLED LOG_LEVEL_WARNING // Default to only display Warning level messages #endif -#ifndef LOG_TO_LCD -# define LOG_TO_LCD false // Default to not display log messages on display +#ifndef LOG_TO_OLED +# define LOG_TO_OLED false // Default to not display log messages on display #endif -#ifndef JSON_TO_LCD -# define JSON_TO_LCD true // Default to displaying JSON messages on the display +#ifndef JSON_TO_OLED +# define JSON_TO_OLED true // Default to displaying JSON messages on the display #endif #ifndef DISPLAY_PAGE_INTERVAL