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:
Jouni PaulusandJouni Paulus authored and GitHub committed 2024-01-05 12:17:51 -06:00
1 parent 36659309b1
commit d58e3f469d
2 files changed
+39 -1

No files matched your search

+37 -1
View File
@@ -1,6 +1,6 @@
# 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.
The current SSD1306 display states are being published to the `SSD1306toMQTT` topic, e.g.
@@ -106,3 +106,39 @@ If you want to load the default configuration use the command:
`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.
### 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 &rarr; ESP32):
- VCC &rarr; 5V (or 3.3V, check your display documentation)
- GND &rarr; GND
- SCL &rarr; pin 22
- SDA &rarr; 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'
```
+2
View File
@@ -302,6 +302,8 @@ OledSerial::OledSerial(int x) {
// delay(50);
// digitalWrite(OLED_RST, HIGH);
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
}