[SSD1306] Partial MAC address in BLE title (#1498)
* partial MAC in title • Last three octets of MAC address in title to differentiate devices with the same model name. • fixed memory leak • process optimisation * lcd to oled lcd to oled renaming
This commit is contained in:
1 parent
578f522356
commit
1b5215de42
5 files changed
+76
-59
No files matched your search
@@ -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.
|
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
|
### Display ON/OFF
|
||||||
To turn the SSD1306 display on or off.
|
To turn the SSD1306 display on or off.
|
||||||
@@ -59,27 +59,27 @@ or at runtime with
|
|||||||
|
|
||||||
### Setting the log output
|
### 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:
|
you can also revert it back with
|
||||||
|
|
||||||
`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)
|
### Displaying Module json messages (default)
|
||||||
|
|
||||||
The display of messages from various modules is also supported. Currently supported modules include `ZgatewayRTL_433`, `ZgatewayBT` and `ZsensorBME280`.
|
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:
|
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:
|
And to disable the display of module json messages:
|
||||||
|
|
||||||
|
|||||||
+12
-12
@@ -740,9 +740,9 @@ build_flags =
|
|||||||
'-DZradioSX127x="SX127x"'
|
'-DZradioSX127x="SX127x"'
|
||||||
; *** ssd1306 Display Options ***
|
; *** ssd1306 Display Options ***
|
||||||
'-DZdisplaySSD1306="HELTEC_SSD1306"'
|
'-DZdisplaySSD1306="HELTEC_SSD1306"'
|
||||||
; '-DLOG_TO_LCD=false' ; Enable log to LCD
|
; '-DLOG_TO_OLED=false' ; Enable log to OLED
|
||||||
; '-DJSON_TO_LCD=true'
|
; '-DJSON_TO_OLED=true'
|
||||||
; '-DLOG_LEVEL_LCD=LOG_LEVEL_NOTICE'
|
; '-DLOG_LEVEL_OLED=LOG_LEVEL_NOTICE'
|
||||||
; '-DDISPLAY_IDLE_LOGO=false'
|
; '-DDISPLAY_IDLE_LOGO=false'
|
||||||
; '-DDISPLAY_BRIGHTNESS=80'
|
; '-DDISPLAY_BRIGHTNESS=80'
|
||||||
; '-DDISPLAY_METRIC=false'
|
; '-DDISPLAY_METRIC=false'
|
||||||
@@ -793,9 +793,9 @@ build_flags =
|
|||||||
'-DZradioSX127x="SX127x"'
|
'-DZradioSX127x="SX127x"'
|
||||||
; *** ssd1306 Display Options ***
|
; *** ssd1306 Display Options ***
|
||||||
'-DZdisplaySSD1306="LilyGo_SSD1306"'
|
'-DZdisplaySSD1306="LilyGo_SSD1306"'
|
||||||
; '-DLOG_TO_LCD=true' ; Enable log to LCD
|
; '-DLOG_TO_OLED=true' ; Enable log to OLED
|
||||||
; '-DJSON_TO_LCD=true'
|
; '-DJSON_TO_OLED=true'
|
||||||
; '-DLOG_LEVEL_LCD=LOG_LEVEL_NOTICE'
|
; '-DLOG_LEVEL_OLED=LOG_LEVEL_NOTICE'
|
||||||
; '-DDISPLAY_IDLE_LOGO=false'
|
; '-DDISPLAY_IDLE_LOGO=false'
|
||||||
; '-DDISPLAY_BRIGHTNESS=80'
|
; '-DDISPLAY_BRIGHTNESS=80'
|
||||||
; '-DDISPLAY_METRIC=false'
|
; '-DDISPLAY_METRIC=false'
|
||||||
@@ -960,9 +960,9 @@ build_flags =
|
|||||||
'-DLED_SEND_RECEIVE_ON=1'
|
'-DLED_SEND_RECEIVE_ON=1'
|
||||||
; *** ssd1306 Display Options ***
|
; *** ssd1306 Display Options ***
|
||||||
'-DZdisplaySSD1306="HELTEC_SSD1306"'
|
'-DZdisplaySSD1306="HELTEC_SSD1306"'
|
||||||
; '-DLOG_TO_LCD=true' ; Enable log to LCD
|
; '-DLOG_TO_OLED=true' ; Enable log to OLED
|
||||||
; '-DJSON_TO_LCD=true'
|
; '-DJSON_TO_OLED=true'
|
||||||
; '-DLOG_LEVEL_LCD=LOG_LEVEL_NOTICE'
|
; '-DLOG_LEVEL_OLED=LOG_LEVEL_NOTICE'
|
||||||
; '-DDISPLAY_IDLE_LOGO=false'
|
; '-DDISPLAY_IDLE_LOGO=false'
|
||||||
; '-DDISPLAY_BRIGHTNESS=80'
|
; '-DDISPLAY_BRIGHTNESS=80'
|
||||||
; '-DDISPLAY_METRIC=false'
|
; '-DDISPLAY_METRIC=false'
|
||||||
@@ -988,9 +988,9 @@ build_flags =
|
|||||||
'-DLED_SEND_RECEIVE_ON=1'
|
'-DLED_SEND_RECEIVE_ON=1'
|
||||||
; *** ssd1306 Display Options ***
|
; *** ssd1306 Display Options ***
|
||||||
'-DZdisplaySSD1306="HELTEC_SSD1306"'
|
'-DZdisplaySSD1306="HELTEC_SSD1306"'
|
||||||
; '-DLOG_TO_LCD=true' ; Enable log to LCD
|
; '-DLOG_TO_OLED=true' ; Enable log to OLED
|
||||||
; '-DJSON_TO_LCD=true'
|
; '-DJSON_TO_OLED=true'
|
||||||
; '-DLOG_LEVEL_LCD=LOG_LEVEL_NOTICE'
|
; '-DLOG_LEVEL_OLED=LOG_LEVEL_NOTICE'
|
||||||
; '-DDISPLAY_IDLE_LOGO=false'
|
; '-DDISPLAY_IDLE_LOGO=false'
|
||||||
; '-DDISPLAY_BRIGHTNESS=80'
|
; '-DDISPLAY_BRIGHTNESS=80'
|
||||||
; '-DDISPLAY_METRIC=false'
|
; '-DDISPLAY_METRIC=false'
|
||||||
|
|||||||
+47
-29
@@ -41,8 +41,8 @@
|
|||||||
|
|
||||||
SemaphoreHandle_t semaphoreOLEDOperation;
|
SemaphoreHandle_t semaphoreOLEDOperation;
|
||||||
QueueHandle_t displayQueue;
|
QueueHandle_t displayQueue;
|
||||||
boolean logToLCDDisplay = LOG_TO_LCD;
|
boolean logToOLEDDisplay = LOG_TO_OLED;
|
||||||
boolean jsonDisplay = JSON_TO_LCD;
|
boolean jsonDisplay = JSON_TO_OLED;
|
||||||
boolean displayMetric = DISPLAY_METRIC;
|
boolean displayMetric = DISPLAY_METRIC;
|
||||||
boolean displayFlip = DISPLAY_FLIP;
|
boolean displayFlip = DISPLAY_FLIP;
|
||||||
boolean displayState = DISPLAY_STATE;
|
boolean displayState = DISPLAY_STATE;
|
||||||
@@ -52,9 +52,9 @@ uint8_t displayBrightness = round(DISPLAY_BRIGHTNESS * 2.55);
|
|||||||
/*
|
/*
|
||||||
Toogle log display
|
Toogle log display
|
||||||
*/
|
*/
|
||||||
void logToLCD(bool display) {
|
void logToOLED(bool display) {
|
||||||
logToLCDDisplay = display;
|
logToOLEDDisplay = display;
|
||||||
display ? Log.begin(LOG_LEVEL_LCD, &Oled) : Log.begin(LOG_LEVEL, &Serial); // Log on LCD following LOG_LEVEL_LCD
|
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() {
|
void setupSSD1306() {
|
||||||
Log.trace(F("Setup SSD1306 Display" CR));
|
Log.trace(F("Setup SSD1306 Display" CR));
|
||||||
Log.trace(F("ZdisplaySSD1306 command topic: %s" CR), subjectMQTTtoSSD1306set);
|
Log.trace(F("ZdisplaySSD1306 command topic: %s" CR), subjectMQTTtoSSD1306set);
|
||||||
Log.trace(F("ZdisplaySSD1306 log-lcd: %T" CR), logToLCDDisplay);
|
Log.trace(F("ZdisplaySSD1306 log-oled: %T" CR), logToOLEDDisplay);
|
||||||
Log.trace(F("ZdisplaySSD1306 json-lcd: %T" CR), jsonDisplay);
|
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_PAGE_INTERVAL: %d" CR), DISPLAY_PAGE_INTERVAL);
|
||||||
Log.trace(F("ZdisplaySSD1306 DISPLAY_IDLE_LOGO: %T" CR), DISPLAY_IDLE_LOGO);
|
Log.trace(F("ZdisplaySSD1306 DISPLAY_IDLE_LOGO: %T" CR), DISPLAY_IDLE_LOGO);
|
||||||
Log.trace(F("ZdisplaySSD1306 DISPLAY_METRIC: %T" CR), displayMetric);
|
Log.trace(F("ZdisplaySSD1306 DISPLAY_METRIC: %T" CR), displayMetric);
|
||||||
@@ -73,8 +73,8 @@ void setupSSD1306() {
|
|||||||
Oled.begin();
|
Oled.begin();
|
||||||
Log.notice(F("Setup SSD1306 Display end" CR));
|
Log.notice(F("Setup SSD1306 Display end" CR));
|
||||||
|
|
||||||
# if LOG_TO_LCD
|
# if LOG_TO_OLED
|
||||||
Log.begin(LOG_LEVEL_LCD, &Oled); // Log on LCD following LOG_LEVEL_LCD
|
Log.begin(LOG_LEVEL_OLED, &Oled); // Log on OLED following LOG_LEVEL_OLED
|
||||||
jsonDisplay = false;
|
jsonDisplay = false;
|
||||||
# else
|
# else
|
||||||
jsonDisplay = true;
|
jsonDisplay = true;
|
||||||
@@ -93,7 +93,7 @@ void loopSSD1306() {
|
|||||||
|
|
||||||
long enough since the last message and display not being used and a queue message waiting
|
long enough since the last message and display not being used and a queue message waiting
|
||||||
*/
|
*/
|
||||||
if (jsonDisplay) {
|
if (jsonDisplay && displayState) {
|
||||||
if (uptime() >= nextDisplayPage && uxSemaphoreGetCount(semaphoreOLEDOperation) && uxQueueMessagesWaiting(displayQueue)) {
|
if (uptime() >= nextDisplayPage && uxSemaphoreGetCount(semaphoreOLEDOperation) && uxQueueMessagesWaiting(displayQueue)) {
|
||||||
displayQueueMessage* message = nullptr;
|
displayQueueMessage* message = nullptr;
|
||||||
xQueueReceive(displayQueue, &message, portMAX_DELAY);
|
xQueueReceive(displayQueue, &message, portMAX_DELAY);
|
||||||
@@ -108,7 +108,8 @@ void loopSSD1306() {
|
|||||||
/*
|
/*
|
||||||
Display logo if it has been more than DISPLAY_PAGE_INTERVAL
|
Display logo if it has been more than DISPLAY_PAGE_INTERVAL
|
||||||
*/
|
*/
|
||||||
if (uptime() > nextDisplayPage + 1 && !logoDisplayed && idlelogo) {
|
if (uptime() > nextDisplayPage + 1 && !logoDisplayed && idlelogo && displayState) {
|
||||||
|
Oled.display->normalDisplay();
|
||||||
Oled.fillScreen(BLACK);
|
Oled.fillScreen(BLACK);
|
||||||
Oled.drawLogo(rand() % 13 - 5, rand() % 32 - 13);
|
Oled.drawLogo(rand() % 13 - 5, rand() % 32 - 13);
|
||||||
logoDisplayed = true;
|
logoDisplayed = true;
|
||||||
@@ -117,21 +118,26 @@ void loopSSD1306() {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Handler for mqtt commands sent to the module
|
Handler for mqtt commands sent to the module
|
||||||
- log-lcd: boolean
|
- log-oled: boolean
|
||||||
Enable / Disable display of log messages on display
|
Enable / Disable display of log messages on display
|
||||||
*/
|
*/
|
||||||
void MQTTtoSSD1306(char* topicOri, JsonObject& SSD1306data) { // json object decoding
|
void MQTTtoSSD1306(char* topicOri, JsonObject& SSD1306data) { // json object decoding
|
||||||
bool success = false;
|
bool success = false;
|
||||||
if (cmpToMainTopic(topicOri, subjectMQTTtoSSD1306set)) {
|
if (cmpToMainTopic(topicOri, subjectMQTTtoSSD1306set)) {
|
||||||
Log.trace(F("MQTTtoSSD1306 json set" CR));
|
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 (SSD1306data.containsKey("onstate")) {
|
||||||
if (displayState != SSD1306data["onstate"]) {
|
if (displayState != SSD1306data["onstate"]) {
|
||||||
displayState = SSD1306data["onstate"];
|
displayState = SSD1306data["onstate"];
|
||||||
|
if (!displayState) {
|
||||||
|
Oled.display->displayOff();
|
||||||
|
} else {
|
||||||
|
Oled.display->displayOn();
|
||||||
Oled.begin();
|
Oled.begin();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
displayState = SSD1306data["onstate"];
|
displayState = SSD1306data["onstate"];
|
||||||
Log.notice(F("Set display state: %T" CR), logToLCDDisplay);
|
Log.notice(F("Set display state: %T" CR), logToOLEDDisplay);
|
||||||
success = true;
|
success = true;
|
||||||
} else if (SSD1306data.containsKey("brightness")) {
|
} else if (SSD1306data.containsKey("brightness")) {
|
||||||
displayBrightness = SSD1306data["brightness"];
|
displayBrightness = SSD1306data["brightness"];
|
||||||
@@ -139,21 +145,21 @@ void MQTTtoSSD1306(char* topicOri, JsonObject& SSD1306data) { // json object dec
|
|||||||
Oled.display->setBrightness(displayBrightness);
|
Oled.display->setBrightness(displayBrightness);
|
||||||
Log.notice(F("Set brightness: %d" CR), displayBrightness);
|
Log.notice(F("Set brightness: %d" CR), displayBrightness);
|
||||||
success = true;
|
success = true;
|
||||||
} else if (SSD1306data.containsKey("log-lcd")) {
|
} else if (SSD1306data.containsKey("log-oled")) {
|
||||||
logToLCDDisplay = SSD1306data["log-lcd"];
|
logToOLEDDisplay = SSD1306data["log-oled"];
|
||||||
Log.notice(F("Set lcd log: %T" CR), logToLCDDisplay);
|
Log.notice(F("Set OLED log: %T" CR), logToOLEDDisplay);
|
||||||
logToLCD(logToLCDDisplay);
|
logToOLED(logToOLEDDisplay);
|
||||||
if (logToLCDDisplay) {
|
if (logToOLEDDisplay) {
|
||||||
jsonDisplay = false;
|
jsonDisplay = false;
|
||||||
}
|
}
|
||||||
success = true;
|
success = true;
|
||||||
} else if (SSD1306data.containsKey("json-lcd")) {
|
} else if (SSD1306data.containsKey("json-oled")) {
|
||||||
jsonDisplay = SSD1306data["json-lcd"];
|
jsonDisplay = SSD1306data["json-oled"];
|
||||||
if (jsonDisplay) {
|
if (jsonDisplay) {
|
||||||
logToLCDDisplay = false;
|
logToOLEDDisplay = false;
|
||||||
logToLCD(logToLCDDisplay);
|
logToOLED(logToOLEDDisplay);
|
||||||
}
|
}
|
||||||
Log.notice(F("Set json-lcd: %T" CR), jsonDisplay);
|
Log.notice(F("Set json-oled: %T" CR), jsonDisplay);
|
||||||
success = true;
|
success = true;
|
||||||
} else if (SSD1306data.containsKey("display-metric")) {
|
} else if (SSD1306data.containsKey("display-metric")) {
|
||||||
displayMetric = SSD1306data["display-metric"];
|
displayMetric = SSD1306data["display-metric"];
|
||||||
@@ -192,7 +198,7 @@ constexpr unsigned int hash(const char* s, int off = 0) { // workaround for swit
|
|||||||
Parse json message from module into a format for displaying on screen, and queue for display
|
Parse json message from module into a format for displaying on screen, and queue for display
|
||||||
*/
|
*/
|
||||||
void ssd1306PubPrint(const char* topicori, JsonObject& data) {
|
void ssd1306PubPrint(const char* topicori, JsonObject& data) {
|
||||||
if (jsonDisplay) {
|
if (jsonDisplay && displayState) {
|
||||||
displayQueueMessage* message = (displayQueueMessage*)malloc(sizeof(displayQueueMessage));
|
displayQueueMessage* message = (displayQueueMessage*)malloc(sizeof(displayQueueMessage));
|
||||||
if (message != NULL) {
|
if (message != NULL) {
|
||||||
char* topic = strdup(topicori);
|
char* topic = strdup(topicori);
|
||||||
@@ -200,7 +206,6 @@ void ssd1306PubPrint(const char* topicori, JsonObject& data) {
|
|||||||
free(topic);
|
free(topic);
|
||||||
|
|
||||||
Oled.display->normalDisplay();
|
Oled.display->normalDisplay();
|
||||||
// Oled.display->normalDisplay();
|
|
||||||
|
|
||||||
switch (hash(message->title)) {
|
switch (hash(message->title)) {
|
||||||
case hash("SYStoMQTT"): {
|
case hash("SYStoMQTT"): {
|
||||||
@@ -303,6 +308,7 @@ void ssd1306PubPrint(const char* topicori, JsonObject& data) {
|
|||||||
|
|
||||||
if (xQueueSend(displayQueue, (void*)&message, 0) != pdTRUE) {
|
if (xQueueSend(displayQueue, (void*)&message, 0) != pdTRUE) {
|
||||||
Log.error(F("[ SSD1306 ] displayQueue full, discarding signal %s" CR), message->title);
|
Log.error(F("[ SSD1306 ] displayQueue full, discarding signal %s" CR), message->title);
|
||||||
|
free(message);
|
||||||
} else {
|
} else {
|
||||||
// Log.notice(F("Queued %s" CR), message->title);
|
// Log.notice(F("Queued %s" CR), message->title);
|
||||||
}
|
}
|
||||||
@@ -667,6 +673,13 @@ void ssd1306PubPrint(const char* topicori, JsonObject& data) {
|
|||||||
line4 = properties[4] + properties[5];
|
line4 = properties[4] + properties[5];
|
||||||
|
|
||||||
if (!(line2 == "" && line3 == "" && line4 == "")) {
|
if (!(line2 == "" && line3 == "" && line4 == "")) {
|
||||||
|
// Titel
|
||||||
|
char* topic = strdup(topicori);
|
||||||
|
String heading = strtok(topic, "/");
|
||||||
|
String line0 = heading + " " + data["id"].as<String>().substring(9, 17);
|
||||||
|
line0.toCharArray(message->title, OLED_TEXT_WIDTH);
|
||||||
|
free(topic);
|
||||||
|
|
||||||
// Line 1
|
// Line 1
|
||||||
strlcpy(message->line1, data["model"], OLED_TEXT_WIDTH);
|
strlcpy(message->line1, data["model"], OLED_TEXT_WIDTH);
|
||||||
|
|
||||||
@@ -680,9 +693,13 @@ void ssd1306PubPrint(const char* topicori, JsonObject& data) {
|
|||||||
} else {
|
} else {
|
||||||
// Log.notice(F("Queued %s" CR), message->title);
|
// Log.notice(F("Queued %s" CR), message->title);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
free(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
} else {
|
||||||
|
free(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
@@ -751,7 +768,7 @@ OledSerial::OledSerial(int x) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Initialize ssd1306 oled display for use, and display animated OMG logo
|
Initialize ssd1306 oled display for use, and display OMG logo
|
||||||
*/
|
*/
|
||||||
void OledSerial::begin() {
|
void OledSerial::begin() {
|
||||||
// SSD1306.begin(); // User OMG serial support
|
// SSD1306.begin(); // User OMG serial support
|
||||||
@@ -845,6 +862,7 @@ Display full page message on the display.
|
|||||||
boolean OledSerial::displayPage(displayQueueMessage* message) {
|
boolean OledSerial::displayPage(displayQueueMessage* message) {
|
||||||
if (xPortGetCoreID() == CONFIG_ARDUINO_RUNNING_CORE) {
|
if (xPortGetCoreID() == CONFIG_ARDUINO_RUNNING_CORE) {
|
||||||
if (xSemaphoreTake(semaphoreOLEDOperation, pdMS_TO_TICKS(30000)) == pdTRUE) {
|
if (xSemaphoreTake(semaphoreOLEDOperation, pdMS_TO_TICKS(30000)) == pdTRUE) {
|
||||||
|
display->normalDisplay();
|
||||||
display->clear();
|
display->clear();
|
||||||
display->setColor(WHITE);
|
display->setColor(WHITE);
|
||||||
display->setFont(ArialMT_Plain_10);
|
display->setFont(ArialMT_Plain_10);
|
||||||
@@ -909,8 +927,8 @@ void stateSSD1306Display() {
|
|||||||
DISPLAYdata["display-metric"] = (bool)displayMetric;
|
DISPLAYdata["display-metric"] = (bool)displayMetric;
|
||||||
DISPLAYdata["display-flip"] = (bool)displayFlip;
|
DISPLAYdata["display-flip"] = (bool)displayFlip;
|
||||||
DISPLAYdata["idlelogo"] = (bool)idlelogo;
|
DISPLAYdata["idlelogo"] = (bool)idlelogo;
|
||||||
DISPLAYdata["log-lcd"] = (bool)logToLCDDisplay;
|
DISPLAYdata["log-oled"] = (bool)logToOLEDDisplay;
|
||||||
DISPLAYdata["json-lcd"] = (bool)jsonDisplay;
|
DISPLAYdata["json-oled"] = (bool)jsonDisplay;
|
||||||
pub(subjectSSD1306toMQTT, DISPLAYdata);
|
pub(subjectSSD1306toMQTT, DISPLAYdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-3
@@ -991,9 +991,8 @@ void launchBTDiscovery(bool overrideDiscovery) {
|
|||||||
void PublishDeviceData(JsonObject& BLEdata, bool processBLEData) {
|
void PublishDeviceData(JsonObject& BLEdata, bool processBLEData) {
|
||||||
if (abs((int)BLEdata["rssi"] | 0) < abs(BTConfig.minRssi)) { // process only the devices close enough
|
if (abs((int)BLEdata["rssi"] | 0) < abs(BTConfig.minRssi)) { // process only the devices close enough
|
||||||
if (processBLEData) process_bledata(BLEdata);
|
if (processBLEData) process_bledata(BLEdata);
|
||||||
String topic = subjectBTtoMQTT;
|
if (BLEdata.containsKey("type") && (BLEdata.containsKey("model") || BLEdata.containsKey("distance"))) { // Only display sensor data with type
|
||||||
if (BLEdata.containsKey("model") || BLEdata.containsKey("distance")) { // Only display sensor data
|
pubOled(subjectBTtoMQTT, BLEdata);
|
||||||
pubOled((char*)topic.c_str(), BLEdata);
|
|
||||||
}
|
}
|
||||||
if (!BTConfig.pubAdvData) {
|
if (!BTConfig.pubAdvData) {
|
||||||
BLEdata.remove("servicedatauuid");
|
BLEdata.remove("servicedatauuid");
|
||||||
|
|||||||
@@ -42,16 +42,16 @@
|
|||||||
|
|
||||||
/*-------------------DEFINE LOG LEVEL----------------------*/
|
/*-------------------DEFINE LOG LEVEL----------------------*/
|
||||||
|
|
||||||
#ifndef LOG_LEVEL_LCD
|
#ifndef LOG_LEVEL_OLED
|
||||||
# define LOG_LEVEL_LCD LOG_LEVEL_WARNING // Default to only display Warning level messages
|
# define LOG_LEVEL_OLED LOG_LEVEL_WARNING // Default to only display Warning level messages
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef LOG_TO_LCD
|
#ifndef LOG_TO_OLED
|
||||||
# define LOG_TO_LCD false // Default to not display log messages on display
|
# define LOG_TO_OLED false // Default to not display log messages on display
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef JSON_TO_LCD
|
#ifndef JSON_TO_OLED
|
||||||
# define JSON_TO_LCD true // Default to displaying JSON messages on the display
|
# define JSON_TO_OLED true // Default to displaying JSON messages on the display
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DISPLAY_PAGE_INTERVAL
|
#ifndef DISPLAY_PAGE_INTERVAL
|
||||||
|
|||||||
Reference in new issue
Block a user