Heltec SSD1306 Display Support (#1283)
My environment
[env:heltec-display] ; Heltec ESP32 Board with SSD1306 display
platform = ${com.esp32_platform}
board = heltec_wifi_lora_32_V2
build_type = debug
monitor_filters = esp32_exception_decoder
board_build.partitions = min_spiffs.csv
extra_scripts = pre:scripts/omg_firmware_version.py
lib_deps =
${com-esp.lib_deps}
${libraries.wifimanager32}
${libraries.heltec}
; ${libraries.m5stickcp}
build_flags =
${com-esp.build_flags}
${test_env.build_flags}
; *** OpenMQTTGateway Config ***
'-UZmqttDiscovery' ; disables MQTT Discovery
'-DvalueAsATopic=true'
'-DLOG_LEVEL=LOG_LEVEL_TRACE'
; *** OpenMQTTGateway Modules ***
'-DZboardHELTEC="HELTEC"'
; *** Heltec Board Options ***
'-DDEBUG_OLEDDISPLAY(...)=Serial.printf( __VA_ARGS__ )'
'-DLOG_TO_LCD=true' ; Enable log to LCD
'-DLED_ERROR=2'
'-DONBOARD_LED=25' ; Onboard LED is GPIO 25 on the Heltec Board
monitor_port = /dev/cu.SLAB_USBtoUART
monitor_speed = 921600
upload_port = /dev/cu.SLAB_USBtoUART
upload_speed = 921600
1 - Set default LCD log level to WARNING
2 - Implemented a macro based displayPrint function that will be usable across different displays
- Added logo display when idle
- Fixed log-lcd mqtt function
- Enable OLED Display on Heltec Boards
This commit is contained in:
1 parent
b0fc25bfe0
commit
c45181ef7e
7 files changed
+10701
-19
No files matched your search
+21
-17
@@ -153,6 +153,9 @@ struct GfSun2000Data {};
|
||||
#if defined(ZboardM5STICKC) || defined(ZboardM5STICKCP) || defined(ZboardM5STACK) || defined(ZboardM5TOUGH)
|
||||
# include "config_M5.h"
|
||||
#endif
|
||||
#if defined(ZboardHELTEC)
|
||||
# include "config_HELTEC.h"
|
||||
#endif
|
||||
#if defined(ZgatewayRS232)
|
||||
# include "config_RS232.h"
|
||||
#endif
|
||||
@@ -524,10 +527,8 @@ void connectMQTT() {
|
||||
#else
|
||||
if (client.connect(gateway_name, mqtt_user, mqtt_pass, topic, will_QoS, will_Retain, will_Message)) {
|
||||
#endif
|
||||
#if defined(ZboardM5STICKC) || defined(ZboardM5STICKCP) || defined(ZboardM5STACK) || defined(ZboardM5TOUGH)
|
||||
if (lowpowermode < 2)
|
||||
M5Print("MQTT connected", "", "");
|
||||
#endif
|
||||
|
||||
displayPrint("MQTT connected");
|
||||
Log.notice(F("Connected to broker" CR));
|
||||
failure_number_mqtt = 0;
|
||||
// Once connected, publish an announcement...
|
||||
@@ -620,6 +621,10 @@ void setup() {
|
||||
preferences.end();
|
||||
# if defined(ZboardM5STICKC) || defined(ZboardM5STICKCP) || defined(ZboardM5STACK) || defined(ZboardM5TOUGH)
|
||||
setupM5();
|
||||
# endif
|
||||
# if defined(ZboardHELTEC)
|
||||
setupHELTEC();
|
||||
modules.add(ZboardHELTEC);
|
||||
# endif
|
||||
Log.notice(F("OpenMQTTGateway Version: " OMG_VERSION CR));
|
||||
# endif
|
||||
@@ -873,9 +878,7 @@ void setOTA() {
|
||||
# if defined(ZgatewayBT) && defined(ESP32)
|
||||
stopProcessing();
|
||||
# endif
|
||||
# if defined(ZboardM5STICKC) || defined(ZboardM5STICKCP) || defined(ZboardM5STACK) || defined(ZboardM5TOUGH)
|
||||
M5Print("OTA in progress", "", "");
|
||||
# endif
|
||||
lpDisplayPrint("OTA in progress");
|
||||
});
|
||||
ArduinoOTA.onEnd([]() {
|
||||
Log.trace(F("\nOTA done" CR));
|
||||
@@ -884,9 +887,7 @@ void setOTA() {
|
||||
# if defined(ZgatewayBT) && defined(ESP32)
|
||||
startProcessing();
|
||||
# endif
|
||||
# if defined(ZboardM5STICKC) || defined(ZboardM5STICKCP) || defined(ZboardM5STACK) || defined(ZboardM5TOUGH)
|
||||
M5Print("OTA done", "", "");
|
||||
# endif
|
||||
lpDisplayPrint("OTA done");
|
||||
});
|
||||
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
|
||||
Log.trace(F("Progress: %u%%\r" CR), (progress / (total / 100)));
|
||||
@@ -1200,9 +1201,7 @@ void setup_wifimanager(bool reset_settings) {
|
||||
{
|
||||
# ifdef ESP32
|
||||
if (lowpowermode < 2) {
|
||||
# if defined(ZboardM5STICKC) || defined(ZboardM5STICKCP) || defined(ZboardM5STACK) || defined(ZboardM5TOUGH)
|
||||
M5Print("Connect your phone to WIFI AP:", WifiManager_ssid, WifiManager_password);
|
||||
# endif
|
||||
displayPrint("Connect your phone to WIFI AP:", WifiManager_ssid, WifiManager_password);
|
||||
} else { // in case of low power mode we put the ESP to sleep again if we didn't get connected (typical in case the wifi is down)
|
||||
# ifdef ZgatewayBT
|
||||
lowPowerESP32();
|
||||
@@ -1227,10 +1226,7 @@ void setup_wifimanager(bool reset_settings) {
|
||||
digitalWrite(LED_INFO, !LED_INFO_ON);
|
||||
}
|
||||
|
||||
# if defined(ZboardM5STICKC) || defined(ZboardM5STICKCP) || defined(ZboardM5STACK) || defined(ZboardM5TOUGH)
|
||||
if (lowpowermode < 2)
|
||||
M5Print("Wifi connected", "", "");
|
||||
# endif
|
||||
displayPrint("Wifi connected");
|
||||
|
||||
if (shouldSaveConfig) {
|
||||
//read updated parameters
|
||||
@@ -1525,6 +1521,11 @@ void loop() {
|
||||
#if defined(ZboardM5STICKC) || defined(ZboardM5STICKCP) || defined(ZboardM5STACK) || defined(ZboardM5TOUGH)
|
||||
loopM5();
|
||||
#endif
|
||||
|
||||
// Function that doesn't need an active connection
|
||||
#if defined(ZboardHELTEC)
|
||||
loopHELTEC();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1742,6 +1743,9 @@ void receivingMQTT(char* topicOri, char* datacallback) {
|
||||
# if defined(ZboardM5STICKC) || defined(ZboardM5STICKCP) || defined(ZboardM5STACK) || defined(ZboardM5TOUGH)
|
||||
MQTTtoM5(topicOri, jsondata);
|
||||
# endif
|
||||
# if defined(ZboardHELTEC)
|
||||
MQTTtoHELTEC(topicOri, jsondata);
|
||||
# endif
|
||||
# ifdef ZactuatorONOFF
|
||||
MQTTtoONOFF(topicOri, jsondata);
|
||||
# endif
|
||||
|
||||
Reference in new issue
Block a user