Generic SSD1306 display support for ESP32 added (#1847)
* add oled support for esp32_rtl433 * add generic ssd1306 usage into documentation * remove additiona environment with the oled --------- Co-authored-by: Jouni Paulus <paulus@nuppu.eternal>
This commit is contained in:
1 parent
36659309b1
commit
d58e3f469d
2 files changed
+43
-5
No files matched your search
+40
-4
@@ -1,6 +1,6 @@
|
|||||||
# Displays
|
# Displays
|
||||||
|
|
||||||
## SSD1306 Display (Heltec SX127X and LILYGO® LoRa32 boards)
|
## SSD1306 Display (Heltec SX127X, LILYGO® LoRa32 boards, generic SSD1306 displays)
|
||||||
Several options are available for the display of information on the SSD1306 display. Some options are exclusive to each other, and when a different option is enabled, the current option is disabled.
|
Several options are available for the display of information on the SSD1306 display. Some options are exclusive to each other, and when a different option is enabled, the current option is disabled.
|
||||||
|
|
||||||
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.
|
||||||
@@ -69,7 +69,7 @@ you can also revert it back with
|
|||||||
|
|
||||||
`mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoSSD1306/config -m '{"log-oled":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_OLED=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)
|
||||||
|
|
||||||
@@ -97,12 +97,48 @@ At any time, you can reload the stored configuration with the command:
|
|||||||
|
|
||||||
If you want to erase the stored configuration, use the command:
|
If you want to erase the stored configuration, use the command:
|
||||||
|
|
||||||
`mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoSSD1306/config -m '{"erase":true}'`
|
`mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoSSD1306/config -m '{"erase":true}'`
|
||||||
|
|
||||||
Note that this will not change the running configuration, it only ensures that the default configuration is used at next startup.
|
Note that this will not change the running configuration, it only ensures that the default configuration is used at next startup.
|
||||||
|
|
||||||
If you want to load the default configuration use the command:
|
If you want to load the default configuration use the command:
|
||||||
|
|
||||||
`mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoSSD1306/config -m '{"init":true}'`
|
`mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoSSD1306/config -m '{"init":true}'`
|
||||||
|
|
||||||
Note that this will not change the stored configuration, `erase` or `save` is still needed to overwrite the saved configuration.
|
Note that this will not change the stored configuration, `erase` or `save` is still needed to overwrite the saved configuration.
|
||||||
|
|
||||||
|
### Connecting a generic SSD1306 display to ESP32
|
||||||
|
It is possible to connect a generic SSD1306 display with resolution 128*64 to the hardware setups.
|
||||||
|
This example describes how to do it with the ESP32 board.
|
||||||
|
- Connect the display to the ESP32 (display → ESP32):
|
||||||
|
- VCC → 5V (or 3.3V, check your display documentation)
|
||||||
|
- GND → GND
|
||||||
|
- SCL → pin 22
|
||||||
|
- SDA → pin 21
|
||||||
|
- Modify the environment definition in `environments.ini`.
|
||||||
|
- Add the display library:
|
||||||
|
```
|
||||||
|
lib_deps =
|
||||||
|
${com-esp32.lib_deps}
|
||||||
|
...
|
||||||
|
${libraries.ssd1306}
|
||||||
|
```
|
||||||
|
- Add relevant build flags:
|
||||||
|
```
|
||||||
|
build_flags =
|
||||||
|
${com-esp32.build_flags}
|
||||||
|
...
|
||||||
|
; *** Generic SSD1306 OLED Options **
|
||||||
|
'-DZdisplaySSD1306="GenericSSD1306"'
|
||||||
|
'-DOLED_SDA=21' ; SSD1306 pin SDA
|
||||||
|
'-DOLED_SCL=22' ; SSD1306 pin SCL
|
||||||
|
'-DGenericSSD1306=true'
|
||||||
|
'-DJSON_TO_OLED=true'
|
||||||
|
'-DDISPLAY_PAGE_INTERVAL=30'
|
||||||
|
; '-DLOG_TO_OLED=true' ; Enable log to OLED
|
||||||
|
; '-DLOG_LEVEL_OLED=LOG_LEVEL_NOTICE'
|
||||||
|
; '-DDISPLAY_IDLE_LOGO=false'
|
||||||
|
; '-DDISPLAY_BRIGHTNESS=80'
|
||||||
|
; '-DDISPLAY_METRIC=false'
|
||||||
|
; '-DDISPLAY_FLIP=false'
|
||||||
|
```
|
||||||
@@ -302,6 +302,8 @@ OledSerial::OledSerial(int x) {
|
|||||||
// delay(50);
|
// delay(50);
|
||||||
// digitalWrite(OLED_RST, HIGH);
|
// digitalWrite(OLED_RST, HIGH);
|
||||||
display = new SSD1306Wire(0x3c, OLED_SDA, OLED_SCL, GEOMETRY_128_64);
|
display = new SSD1306Wire(0x3c, OLED_SDA, OLED_SCL, GEOMETRY_128_64);
|
||||||
|
# elif defined(GenericSSD1306) // a generic ssd1306 oled with of size 128*64
|
||||||
|
display = new SSD1306Wire(0x3c, OLED_SDA, OLED_SCL, GEOMETRY_128_64);
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -357,7 +359,7 @@ void OledSerial::flush(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Erase display and paint it with the color. Used to
|
Erase display and paint it with the color. Used to
|
||||||
*/
|
*/
|
||||||
void OledSerial::fillScreen(OLEDDISPLAY_COLOR color) {
|
void OledSerial::fillScreen(OLEDDISPLAY_COLOR color) {
|
||||||
if (xSemaphoreTake(semaphoreOLEDOperation, pdMS_TO_TICKS(30000)) == pdTRUE) {
|
if (xSemaphoreTake(semaphoreOLEDOperation, pdMS_TO_TICKS(30000)) == pdTRUE) {
|
||||||
|
|||||||
Reference in new issue
Block a user