Update to rtl_433_ESP 0.1.5 and support for LILYGO® LoRa32 V2.1_1.6.1 433 Mhz (#1371)
* Update to rtl_433_ESP 0.1.5 Includes support for LILYGO® LoRa32 V2.1_1.6.1 433 Mhz * Fix lint issue * Fix build and lint issues * Add lilygo-rtl_433 to build.yml
This commit is contained in:
1 parent
85a4fd6e15
commit
2e0d1708c3
9 files changed
+207
-121
No files matched your search
@@ -39,6 +39,7 @@ jobs:
|
||||
- "esp32-m5atom-lite"
|
||||
- "esp32dev-rtl_433"
|
||||
- "heltec-rtl_433"
|
||||
- "lilygo-rtl_433"
|
||||
- "esp32dev-multi_receiver"
|
||||
- "tinypico-ble"
|
||||
- "ttgo-lora32-v1-868"
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ With SRX882 some users reported that D3 is not working use D1 instead in this ca
|
||||
## ESP32 Hardware setup
|
||||

|
||||
|
||||
## Heltec SX127X 433Mhz boards
|
||||
## Heltec SX127X 433Mhz boards and LILYGO® LoRa32 V2.1_1.6.1 433 Mhz
|
||||
Those boards don't require any hardware modifications.
|
||||
|
||||
## SONOFF RF Bridge Hardware setup
|
||||
|
||||
@@ -80,3 +80,17 @@ OpenMQTTGateway support a low power mode for ESP32, this mode can be set by MQTT
|
||||
|
||||
The low power mode can be changed also with a push to button B when the board is processing (top button on M5stickC, M5stickC Plus and middle button of M5stack).
|
||||
If you are already in low power mode 1 or 2 with M5Stack you can wake up the board by pressing the red button.
|
||||
|
||||
## SSD1306 Display boards ( Heltec SX127X 433Mhz boards and LILYGO® LoRa32 V2.1_1.6.1 433 Mhz )
|
||||
|
||||
### Setting the log output
|
||||
|
||||
Per default the log of the SSD1306 Display boards is going to the LCD display with Errors and Warnings only, if you want to change the ouput at build time you can do it with the compiler directive `-DLOG_LEVEL_LCD=LOG_LEVEL_NOTICE`.
|
||||
|
||||
You can also change it by MQTT. For example if you want to set to LCD
|
||||
|
||||
`mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoSSD1306 -m '{"log-lcd":true}'`
|
||||
|
||||
you can also revert it to the serial monitor:
|
||||
|
||||
`mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoSSD1306 -m '{"log-lcd":false}'`
|
||||
+1
-1
@@ -565,7 +565,7 @@ CRGB leds[FASTLED_IND_NUM_LEDS];
|
||||
#endif
|
||||
|
||||
/*-----------PLACEHOLDERS FOR OLED/LCD DISPLAY--------------*/
|
||||
// The real definitions are in config_M5.h / config_HELTEC.h
|
||||
// The real definitions are in config_M5.h / config_SSD1306.h
|
||||
#define displayPrint(...) // only print if not in low power mode
|
||||
#define lpDisplayPrint(...) // print in low power mode
|
||||
|
||||
|
||||
@@ -4,7 +4,10 @@
|
||||
Act as a wifi or ethernet gateway between your 433mhz/infrared IR signal and a MQTT broker
|
||||
Send and receiving command by MQTT
|
||||
|
||||
Supported boards with displays
|
||||
|
||||
HELTEC ESP32 LORA - SSD1306 / Onboard 0.96-inch 128*64 dot matrix OLED display
|
||||
LILYGO® LoRa32 V2.1_1.6.1 433 Mhz / https://www.lilygo.cc/products/lora3?variant=42476923879605
|
||||
|
||||
Copyright: (c)Florian ROBERT
|
||||
|
||||
@@ -28,10 +31,13 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "User_config.h"
|
||||
#if defined(ZboardHELTEC)
|
||||
#if defined(ZdisplaySSD1306)
|
||||
|
||||
# include <ArduinoJson.h>
|
||||
|
||||
# include "ArduinoLog.h"
|
||||
# include "config_HELTEC.h"
|
||||
# include "User_config.h"
|
||||
# include "config_SSD1306.h"
|
||||
|
||||
SemaphoreHandle_t semaphoreOLEDOperation;
|
||||
|
||||
@@ -39,18 +45,20 @@ void logToLCD(bool display) {
|
||||
display ? Log.begin(LOG_LEVEL_LCD, &Oled) : Log.begin(LOG_LEVEL, &Serial); // Log on LCD following LOG_LEVEL_LCD
|
||||
}
|
||||
|
||||
void setupHELTEC() {
|
||||
Log.trace(F("Setup HELTEC Display" CR));
|
||||
void setupSSD1306() {
|
||||
Log.trace(F("Setup SSD1306 Display" CR));
|
||||
Log.trace(F("ZdisplaySSD1306 command topic: %s" CR), subjectMQTTtoSSD1306set);
|
||||
Oled.begin();
|
||||
Log.notice(F("Setup HELTEC Display end" CR));
|
||||
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
|
||||
# endif
|
||||
}
|
||||
|
||||
void loopHELTEC() {
|
||||
static int previousLogLevel;
|
||||
static int previousLogLevel = 0;
|
||||
|
||||
void loopSSD1306() {
|
||||
int currentLogLevel = Log.getLastMsgLevel();
|
||||
if (previousLogLevel != currentLogLevel && lowpowermode != 2) {
|
||||
switch (currentLogLevel) {
|
||||
@@ -66,8 +74,7 @@ void loopHELTEC() {
|
||||
// M5.Lcd.setTextColor(TFT_BLACK, TFT_ORANGE);
|
||||
break;
|
||||
default:
|
||||
// wakeScreen(SLEEP_LCD_BRIGHTNESS);
|
||||
// M5.Lcd.fillScreen(TFT_WHITE);
|
||||
// TODO: Display splash screen x seconds after last message displayed on OLED
|
||||
Oled.fillScreen(WHITE);
|
||||
Oled.drawLogo((int)OLED_WIDTH * 0.24, (int)(OLED_WIDTH / 2) - OLED_WIDTH * 0.2, (int)(OLED_HEIGHT / 2) + OLED_HEIGHT * 0.2, true, true, true, true, true, true); // Name
|
||||
break;
|
||||
@@ -76,34 +83,42 @@ void loopHELTEC() {
|
||||
previousLogLevel = currentLogLevel;
|
||||
}
|
||||
|
||||
void MQTTtoHELTEC(char* topicOri, JsonObject& HELTECdata) { // json object decoding
|
||||
if (cmpToMainTopic(topicOri, subjectMQTTtoHELTECset)) {
|
||||
Log.trace(F("MQTTtoHELTEC json set" CR));
|
||||
// Log display set between HELTEC lcd (true) and serial monitor (false)
|
||||
if (HELTECdata.containsKey("log-lcd")) {
|
||||
bool displayOnLCD = HELTECdata["log-lcd"];
|
||||
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)
|
||||
if (SSD1306data.containsKey("log-lcd")) {
|
||||
bool displayOnLCD = SSD1306data["log-lcd"];
|
||||
Log.notice(F("Set lcd log: %T" CR), displayOnLCD);
|
||||
logToLCD(displayOnLCD);
|
||||
success = true;
|
||||
}
|
||||
if (success) {
|
||||
pub(subjectSSD1306toMQTTset, SSD1306data);
|
||||
} else {
|
||||
pub(subjectSSD1306toMQTTset, "{\"Status\": \"Error\"}"); // Fail feedback
|
||||
Log.error(F("MQTTtoSSD1306 Fail json" CR), SSD1306data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Simple print methonds
|
||||
|
||||
void heltecPrint(char* line1, char* line2, char* line3) {
|
||||
void ssd1306Print(char* line1, char* line2, char* line3) {
|
||||
Oled.println(line1);
|
||||
Oled.println(line2);
|
||||
Oled.println(line3);
|
||||
delay(2000);
|
||||
}
|
||||
|
||||
void heltecPrint(char* line1, char* line2) {
|
||||
void ssd1306Print(char* line1, char* line2) {
|
||||
Oled.println(line1);
|
||||
Oled.println(line2);
|
||||
delay(2000);
|
||||
}
|
||||
|
||||
void heltecPrint(char* line1) {
|
||||
void ssd1306Print(char* line1) {
|
||||
Oled.println(line1);
|
||||
delay(2000);
|
||||
}
|
||||
@@ -112,20 +127,29 @@ void heltecPrint(char* line1) {
|
||||
|
||||
OledSerial Oled(0); // Not sure about this, came from Hardwareserial
|
||||
OledSerial::OledSerial(int x) {
|
||||
# if defined(WIFI_Kit_32) || defined(WIFI_LoRa_32) || defined(WIFI_LoRa_32_V2)
|
||||
pinMode(RST_OLED, OUTPUT);
|
||||
digitalWrite(RST_OLED, LOW);
|
||||
delay(50);
|
||||
digitalWrite(RST_OLED, HIGH);
|
||||
|
||||
# if defined(WIFI_Kit_32) || defined(WIFI_LoRa_32) || defined(WIFI_LoRa_32_V2)
|
||||
display = new SSD1306Wire(0x3c, SDA_OLED, SCL_OLED, GEOMETRY_128_64);
|
||||
# elif defined(Wireless_Stick)
|
||||
pinMode(RST_OLED, OUTPUT);
|
||||
digitalWrite(RST_OLED, LOW);
|
||||
delay(50);
|
||||
digitalWrite(RST_OLED, HIGH);
|
||||
display = new SSD1306Wire(0x3c, SDA_OLED, SCL_OLED, GEOMETRY_64_32);
|
||||
# elif defined(ARDUINO_TTGO_LoRa32_v21new) // LILYGO® Disaster-Radio LoRa V2.1_1.6.1
|
||||
pinMode(OLED_RST, OUTPUT);
|
||||
digitalWrite(OLED_RST, LOW);
|
||||
delay(50);
|
||||
digitalWrite(OLED_RST, HIGH);
|
||||
display = new SSD1306Wire(0x3c, OLED_SDA, OLED_SCL, GEOMETRY_128_64);
|
||||
# endif
|
||||
} // Not sure about this, came from Hardwareserial
|
||||
}
|
||||
|
||||
void OledSerial::begin() {
|
||||
// Heltec.begin(); // User OMG serial support
|
||||
// SSD1306.begin(); // User OMG serial support
|
||||
|
||||
semaphoreOLEDOperation = xSemaphoreCreateBinary();
|
||||
xSemaphoreGive(semaphoreOLEDOperation);
|
||||
@@ -137,7 +161,7 @@ void OledSerial::begin() {
|
||||
display->setColor(WHITE);
|
||||
display->fillRect(0, 0, OLED_WIDTH, OLED_HEIGHT);
|
||||
display->display();
|
||||
displayIntro(OLED_WIDTH * 0.24, (OLED_WIDTH / 2) - OLED_WIDTH * 0.2, (OLED_HEIGHT / 2) + OLED_HEIGHT * 0.2);
|
||||
ssd1306Intro(OLED_WIDTH * 0.24, (OLED_WIDTH / 2) - OLED_WIDTH * 0.2, (OLED_HEIGHT / 2) + OLED_HEIGHT * 0.2);
|
||||
display->setLogBuffer(OLED_TEXT_ROWS, OLED_TEXT_BUFFER);
|
||||
delay(1000);
|
||||
}
|
||||
@@ -157,9 +181,12 @@ void OledSerial::flush(void) {
|
||||
}
|
||||
|
||||
void OledSerial::fillScreen(OLEDDISPLAY_COLOR color) {
|
||||
display->clear();
|
||||
display->setColor(color);
|
||||
display->fillRect(0, 0, OLED_WIDTH, OLED_HEIGHT);
|
||||
if (xSemaphoreTake(semaphoreOLEDOperation, pdMS_TO_TICKS(30000)) == pdTRUE) {
|
||||
display->clear();
|
||||
display->setColor(color);
|
||||
display->fillRect(0, 0, OLED_WIDTH, OLED_HEIGHT);
|
||||
xSemaphoreGive(semaphoreOLEDOperation);
|
||||
}
|
||||
}
|
||||
|
||||
size_t OledSerial::write(const uint8_t* buffer, size_t size) {
|
||||
@@ -186,7 +213,7 @@ size_t OledSerial::write(const uint8_t* buffer, size_t size) {
|
||||
Display OpenMQTTGateway logo - borrowed from ZboardM5.ino and tweaked for ssd1306 display ( removed color and tweaked size/location )
|
||||
*/
|
||||
|
||||
void OledSerial::displayIntro(int scale, int displayWidth, int displayHeight) {
|
||||
void OledSerial::ssd1306Intro(int scale, int displayWidth, int displayHeight) {
|
||||
drawLogo(scale, displayWidth, displayHeight, false, true, false, false, false, false); // Circle 2
|
||||
drawLogo(scale, displayWidth, displayHeight, false, false, true, false, false, false); // Circle 3
|
||||
drawLogo(scale, displayWidth, displayHeight, false, true, true, true, false, false); // Line 1
|
||||
@@ -196,64 +223,67 @@ void OledSerial::displayIntro(int scale, int displayWidth, int displayHeight) {
|
||||
}
|
||||
|
||||
void OledSerial::drawLogo(int logoSize, int circle1X, int circle1Y, bool circle1, bool circle2, bool circle3, bool line1, bool line2, bool name) {
|
||||
int circle1T = logoSize / 15;
|
||||
int circle2T = logoSize / 25;
|
||||
int circle3T = logoSize / 30;
|
||||
if (xSemaphoreTake(semaphoreOLEDOperation, pdMS_TO_TICKS(30000)) == pdTRUE) {
|
||||
int circle1T = logoSize / 15;
|
||||
int circle2T = logoSize / 25;
|
||||
int circle3T = logoSize / 30;
|
||||
|
||||
int circle3Y = circle1Y - (logoSize * 1.2);
|
||||
int circle3X = circle1X - (logoSize * 0.13);
|
||||
int circle2X = circle1X - (logoSize * 1.05);
|
||||
int circle2Y = circle1Y - (logoSize * 0.8);
|
||||
int circle3Y = circle1Y - (logoSize * 1.2);
|
||||
int circle3X = circle1X - (logoSize * 0.13);
|
||||
int circle2X = circle1X - (logoSize * 1.05);
|
||||
int circle2Y = circle1Y - (logoSize * 0.8);
|
||||
|
||||
if (line1) {
|
||||
display->setColor(BLACK);
|
||||
display->drawLine(circle1X - 2, circle1Y, circle2X - 2, circle2Y);
|
||||
display->drawLine(circle1X - 1, circle1Y, circle2X - 1, circle2Y);
|
||||
display->drawLine(circle1X, circle1Y, circle2X, circle2Y);
|
||||
display->drawLine(circle1X + 1, circle1Y, circle2X + 1, circle2Y);
|
||||
display->drawLine(circle1X + 2, circle1Y, circle2X + 2, circle2Y);
|
||||
display->setColor(WHITE);
|
||||
display->fillCircle(circle3X, circle3Y, logoSize / 4 - circle3T * 2); // , WHITE);
|
||||
if (line1) {
|
||||
display->setColor(BLACK);
|
||||
display->drawLine(circle1X - 2, circle1Y, circle2X - 2, circle2Y);
|
||||
display->drawLine(circle1X - 1, circle1Y, circle2X - 1, circle2Y);
|
||||
display->drawLine(circle1X, circle1Y, circle2X, circle2Y);
|
||||
display->drawLine(circle1X + 1, circle1Y, circle2X + 1, circle2Y);
|
||||
display->drawLine(circle1X + 2, circle1Y, circle2X + 2, circle2Y);
|
||||
display->setColor(WHITE);
|
||||
display->fillCircle(circle3X, circle3Y, logoSize / 4 - circle3T * 2); // , WHITE);
|
||||
}
|
||||
if (line2) {
|
||||
display->setColor(BLACK);
|
||||
display->drawLine(circle1X - 2, circle1Y, circle3X - 2, circle3Y);
|
||||
display->drawLine(circle1X - 1, circle1Y, circle3X - 1, circle3Y);
|
||||
display->drawLine(circle1X, circle1Y, circle3X, circle3Y);
|
||||
display->drawLine(circle1X + 1, circle1Y, circle3X + 1, circle3Y);
|
||||
display->setColor(WHITE);
|
||||
display->fillCircle(circle2X, circle2Y, logoSize / 3 - circle2T * 2); // , WHITE);
|
||||
}
|
||||
if (circle1) {
|
||||
display->setColor(WHITE);
|
||||
display->fillCircle(circle1X, circle1Y, logoSize / 2); // , WHITE);
|
||||
display->setColor(BLACK);
|
||||
display->fillCircle(circle1X, circle1Y, logoSize / 2 - circle1T); // , TFT_GREEN);
|
||||
display->setColor(WHITE);
|
||||
display->fillCircle(circle1X, circle1Y, logoSize / 2 - circle1T * 2); // , WHITE);
|
||||
}
|
||||
if (circle2) {
|
||||
display->setColor(WHITE);
|
||||
display->fillCircle(circle2X, circle2Y, logoSize / 3); // , WHITE);
|
||||
display->setColor(BLACK);
|
||||
display->fillCircle(circle2X, circle2Y, logoSize / 3 - circle2T); // , TFT_ORANGE);
|
||||
display->setColor(WHITE);
|
||||
display->fillCircle(circle2X, circle2Y, logoSize / 3 - circle2T * 2); // , WHITE);
|
||||
}
|
||||
if (circle3) {
|
||||
display->setColor(WHITE);
|
||||
display->fillCircle(circle3X, circle3Y, logoSize / 4); // , WHITE);
|
||||
display->setColor(BLACK);
|
||||
display->fillCircle(circle3X, circle3Y, logoSize / 4 - circle3T); // , TFT_PINK);
|
||||
display->setColor(WHITE);
|
||||
display->fillCircle(circle3X, circle3Y, logoSize / 4 - circle3T * 2); // , WHITE);
|
||||
}
|
||||
if (name) {
|
||||
display->setColor(BLACK);
|
||||
display->drawString(circle1X + (circle1X * 0.27), circle1Y, "penMQTTGateway");
|
||||
}
|
||||
display->display();
|
||||
delay(50);
|
||||
xSemaphoreGive(semaphoreOLEDOperation);
|
||||
}
|
||||
if (line2) {
|
||||
display->setColor(BLACK);
|
||||
display->drawLine(circle1X - 2, circle1Y, circle3X - 2, circle3Y);
|
||||
display->drawLine(circle1X - 1, circle1Y, circle3X - 1, circle3Y);
|
||||
display->drawLine(circle1X, circle1Y, circle3X, circle3Y);
|
||||
display->drawLine(circle1X + 1, circle1Y, circle3X + 1, circle3Y);
|
||||
display->setColor(WHITE);
|
||||
display->fillCircle(circle2X, circle2Y, logoSize / 3 - circle2T * 2); // , WHITE);
|
||||
}
|
||||
if (circle1) {
|
||||
display->setColor(WHITE);
|
||||
display->fillCircle(circle1X, circle1Y, logoSize / 2); // , WHITE);
|
||||
display->setColor(BLACK);
|
||||
display->fillCircle(circle1X, circle1Y, logoSize / 2 - circle1T); // , TFT_GREEN);
|
||||
display->setColor(WHITE);
|
||||
display->fillCircle(circle1X, circle1Y, logoSize / 2 - circle1T * 2); // , WHITE);
|
||||
}
|
||||
if (circle2) {
|
||||
display->setColor(WHITE);
|
||||
display->fillCircle(circle2X, circle2Y, logoSize / 3); // , WHITE);
|
||||
display->setColor(BLACK);
|
||||
display->fillCircle(circle2X, circle2Y, logoSize / 3 - circle2T); // , TFT_ORANGE);
|
||||
display->setColor(WHITE);
|
||||
display->fillCircle(circle2X, circle2Y, logoSize / 3 - circle2T * 2); // , WHITE);
|
||||
}
|
||||
if (circle3) {
|
||||
display->setColor(WHITE);
|
||||
display->fillCircle(circle3X, circle3Y, logoSize / 4); // , WHITE);
|
||||
display->setColor(BLACK);
|
||||
display->fillCircle(circle3X, circle3Y, logoSize / 4 - circle3T); // , TFT_PINK);
|
||||
display->setColor(WHITE);
|
||||
display->fillCircle(circle3X, circle3Y, logoSize / 4 - circle3T * 2); // , WHITE);
|
||||
}
|
||||
if (name) {
|
||||
display->setColor(BLACK);
|
||||
display->drawString(circle1X + (circle1X * 0.27), circle1Y, "penMQTTGateway");
|
||||
}
|
||||
display->display();
|
||||
delay(50);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -26,11 +26,15 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "User_config.h"
|
||||
#ifdef ZgatewayRTL_433
|
||||
|
||||
# include <ArduinoJson.h>
|
||||
# include <config_RF.h>
|
||||
# include <rtl_433_ESP.h>
|
||||
|
||||
# include "ArduinoLog.h"
|
||||
# include "User_config.h"
|
||||
|
||||
char messageBuffer[JSON_MSG_BUFFER];
|
||||
|
||||
rtl_433_ESP rtl_433(-1);
|
||||
|
||||
@@ -4,7 +4,10 @@
|
||||
Act as a wifi or ethernet gateway between your 433mhz/infrared IR signal and a MQTT broker
|
||||
Send and receiving command by MQTT
|
||||
|
||||
Supported boards with displays
|
||||
|
||||
HELTEC ESP32 LORA - SSD1306 / Onboard 0.96-inch 128*64 dot matrix OLED display
|
||||
LILYGO® LoRa32 V2.1_1.6.1 433 Mhz / https://www.lilygo.cc/products/lora3?variant=42476923879605
|
||||
|
||||
Copyright: (c)Florian ROBERT
|
||||
|
||||
@@ -28,50 +31,61 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef config_HELTEC_h
|
||||
#define config_HELTEC_h
|
||||
#ifndef config_SSD1306_h
|
||||
#define config_SSD1306_h
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <ArduinoJson.h>
|
||||
#include <Wire.h>
|
||||
|
||||
#include "SSD1306Wire.h"
|
||||
|
||||
#ifdef ZboardHELTEC
|
||||
# define OLED_WIDTH 128
|
||||
# define OLED_HEIGHT 64
|
||||
# define OLED_TEXT_BUFFER 1000
|
||||
# define OLED_TEXT_ROWS 5
|
||||
#define OLED_TEXT_BUFFER 1000
|
||||
#define OLED_TEXT_ROWS 5
|
||||
#define OLED_WIDTH 128
|
||||
#define OLED_HEIGHT 64
|
||||
|
||||
// Display layout definitions based on board definition
|
||||
|
||||
#if defined(WIFI_LoRa_32_V2) // from ~/.platformio/packages/framework-arduinoespressif32/variants/.../pins_arduino.h
|
||||
# define OLED_WIDTH DISPLAY_WIDTH
|
||||
# define OLED_HEIGHT DISPLAY_HEIGHT
|
||||
#elif defined(ARDUINO_TTGO_LoRa32_v21new)
|
||||
# define OLED_WIDTH 128
|
||||
# define OLED_HEIGHT 64
|
||||
#endif
|
||||
|
||||
extern void setupHELTEC();
|
||||
extern void loopHELTEC();
|
||||
extern void setupSSD1306();
|
||||
extern void loopSSD1306();
|
||||
extern void MQTTtoSSD1306(char*, JsonObject&);
|
||||
size_t OledPrint(String msg);
|
||||
|
||||
/*-------------------DEFINE LOG LEVEL----------------------*/
|
||||
#ifndef LOG_LEVEL_LCD
|
||||
# define LOG_LEVEL_LCD LOG_LEVEL_WARNING // Default to only display Notice level messages
|
||||
# define LOG_LEVEL_LCD 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
|
||||
#endif
|
||||
/*-------------------DEFINE MQTT TOPIC FOR CONFIG----------------------*/
|
||||
#define subjectMQTTtoHELTECset "/commands/MQTTtoHELTEC/config"
|
||||
#define subjectMQTTtoSSD1306set "/commands/MQTTtoSSD1306"
|
||||
#define subjectSSD1306toMQTTset "/SSD1306toMQTT"
|
||||
|
||||
// Simple construct for displaying message in lcd and oled displays
|
||||
|
||||
#define displayPrint(...) \
|
||||
if (lowpowermode < 2) heltecPrint(__VA_ARGS__) // only print if not in low power mode
|
||||
#define lpDisplayPrint(...) heltecPrint(__VA_ARGS__) // print in low power mode
|
||||
if (lowpowermode < 2) ssd1306Print(__VA_ARGS__) // only print if not in low power mode
|
||||
#define lpDisplayPrint(...) ssd1306Print(__VA_ARGS__) // print in low power mode
|
||||
|
||||
void heltecPrint(char*, char*, char*);
|
||||
void heltecPrint(char*, char*);
|
||||
void heltecPrint(char*);
|
||||
void ssd1306Print(char*, char*, char*);
|
||||
void ssd1306Print(char*, char*);
|
||||
void ssd1306Print(char*);
|
||||
|
||||
// This pattern was borrowed from HardwareSerial and modified to support the ssd1306 display
|
||||
|
||||
class OledSerial : public Stream {
|
||||
private:
|
||||
void displayIntro(int scale, int displayWidth, int displayHeight);
|
||||
void ssd1306Intro(int scale, int displayWidth, int displayHeight);
|
||||
|
||||
public:
|
||||
OledSerial(int);
|
||||
+9
-9
@@ -159,8 +159,8 @@ struct GfSun2000Data {};
|
||||
#if defined(ZboardM5STICKC) || defined(ZboardM5STICKCP) || defined(ZboardM5STACK) || defined(ZboardM5TOUGH)
|
||||
# include "config_M5.h"
|
||||
#endif
|
||||
#if defined(ZboardHELTEC)
|
||||
# include "config_HELTEC.h"
|
||||
#if defined(ZdisplaySSD1306)
|
||||
# include "config_SSD1306.h"
|
||||
#endif
|
||||
#if defined(ZgatewayRS232)
|
||||
# include "config_RS232.h"
|
||||
@@ -666,9 +666,9 @@ void setup() {
|
||||
# if defined(ZboardM5STICKC) || defined(ZboardM5STICKCP) || defined(ZboardM5STACK) || defined(ZboardM5TOUGH)
|
||||
setupM5();
|
||||
# endif
|
||||
# if defined(ZboardHELTEC)
|
||||
setupHELTEC();
|
||||
modules.add(ZboardHELTEC);
|
||||
# if defined(ZdisplaySSD1306)
|
||||
setupSSD1306();
|
||||
modules.add(ZdisplaySSD1306);
|
||||
# endif
|
||||
Log.notice(F("OpenMQTTGateway Version: " OMG_VERSION CR));
|
||||
# endif
|
||||
@@ -1596,8 +1596,8 @@ void loop() {
|
||||
#if defined(ZboardM5STICKC) || defined(ZboardM5STICKCP) || defined(ZboardM5STACK) || defined(ZboardM5TOUGH)
|
||||
loopM5();
|
||||
#endif
|
||||
#if defined(ZboardHELTEC)
|
||||
loopHELTEC();
|
||||
#if defined(ZdisplaySSD1306)
|
||||
loopSSD1306();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1820,8 +1820,8 @@ 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);
|
||||
# if defined(ZdisplaySSD1306)
|
||||
MQTTtoSSD1306(topicOri, jsondata);
|
||||
# endif
|
||||
# ifdef ZactuatorONOFF
|
||||
MQTTtoONOFF(topicOri, jsondata);
|
||||
|
||||
+32
-9
@@ -135,7 +135,7 @@ smartrc-cc1101-driver-lib = SmartRC-CC1101-Driver-Lib@2.5.7
|
||||
stl = https://github.com/mike-matera/ArduinoSTL.git#7411816
|
||||
shtc3 = https://github.com/sparkfun/SparkFun_SHTC3_Arduino_Library
|
||||
somfy_remote=Somfy_Remote_Lib@0.3.0
|
||||
rtl_433_ESP = https://github.com/NorthernMan54/rtl_433_ESP.git#v0.1.4
|
||||
rtl_433_ESP = https://github.com/NorthernMan54/rtl_433_ESP.git#v0.1.5
|
||||
emodbus = miq19/eModbus@1.0.0
|
||||
gfSunInverter = https://github.com/BlackSmith/GFSunInverter.git#v1.0.1
|
||||
decoder = https://github.com/theengs/decoder.git#v0.9.7
|
||||
@@ -827,7 +827,7 @@ build_flags =
|
||||
|
||||
[env:heltec-rtl_433]
|
||||
platform = ${com.esp32_platform}
|
||||
board = heltec_wifi_lora_32_V2
|
||||
board = heltec_wifi_lora_32_V2 ; ~/.platformio/packages/framework-arduinoespressif32/variants/.../pins_arduino.h
|
||||
board_build.partitions = min_spiffs.csv
|
||||
lib_deps =
|
||||
${com-esp.lib_deps}
|
||||
@@ -842,11 +842,34 @@ build_flags =
|
||||
'-DGateway_Name="OpenMQTTGateway_heltec_rtl_433_ESP"'
|
||||
; *** OpenMQTTGateway Modules ***
|
||||
'-DZgatewayRTL_433="rtl_433"'
|
||||
'-DZboardHELTEC="HELTEC"'
|
||||
'-DZdisplaySSD1306="HELTEC_SSD1306"'
|
||||
'-DZradioSX127x="SX127x"'
|
||||
; *** ssd1306 Module Options ***
|
||||
; '-DLOG_TO_LCD=true' ; Enable log to LCD
|
||||
; '-DLOG_LEVEL_LCD=LOG_LEVEL_TRACE' // default is notice log level
|
||||
'-DLOG_TO_LCD=true' ; Enable log to LCD
|
||||
; '-DLOG_LEVEL_LCD=LOG_LEVEL_NOTICE' // default is WARNING log level
|
||||
|
||||
[env:lilygo-rtl_433]
|
||||
platform = ${com.esp32_platform}
|
||||
board = ttgo-lora32-v21 ; ~/.platformio/packages/framework-arduinoespressif32/variants/.../pins_arduino.h
|
||||
board_build.partitions = min_spiffs.csv
|
||||
lib_deps =
|
||||
${com-esp.lib_deps}
|
||||
${libraries.wifimanager32}
|
||||
${libraries.ssd1306}
|
||||
${libraries.rtl_433_ESP}
|
||||
build_flags =
|
||||
${com-esp.build_flags}
|
||||
; *** OpenMQTTGateway Config ***
|
||||
'-UZmqttDiscovery' ; disables MQTT Discovery
|
||||
'-DvalueAsATopic=true' ; MQTT topic includes model and device
|
||||
'-DGateway_Name="OpenMQTTGateway_lilygo_rtl_433_ESP"'
|
||||
; *** OpenMQTTGateway Modules ***
|
||||
'-DZgatewayRTL_433="rtl_433"'
|
||||
'-DZdisplaySSD1306="LilyGo_SSD1306"'
|
||||
'-DZradioSX127x="SX127x"'
|
||||
; *** ssd1306 Module Options ***
|
||||
'-DLOG_TO_LCD=true' ; Enable log to LCD
|
||||
; '-DLOG_LEVEL_LCD=LOG_LEVEL_NOTICE' // default is WARNING log level
|
||||
|
||||
[env:esp32dev-multi_receiver]
|
||||
platform = ${com.esp32_platform}
|
||||
@@ -966,9 +989,9 @@ lib_deps =
|
||||
build_flags =
|
||||
${com-esp.build_flags}
|
||||
; *** OpenMQTTGateway Modules ***
|
||||
'-DZboardHELTEC="HELTEC"'
|
||||
'-DZdisplaySSD1306="HELTEC_SSD1306"'
|
||||
'-DLOG_TO_LCD=true' ; Enable log to LCD
|
||||
; '-DLOG_LEVEL_LCD=LOG_LEVEL_TRACE' // default is notice log level
|
||||
; '-DLOG_LEVEL_LCD=LOG_LEVEL_TRACE' // default is WARNING log level
|
||||
'-DZgatewayLORA="LORA"'
|
||||
'-DLORA_BAND=868E6'
|
||||
'-DGateway_Name="OpenMQTTGateway_ESP32_LORA"'
|
||||
@@ -987,9 +1010,9 @@ lib_deps =
|
||||
build_flags =
|
||||
${com-esp.build_flags}
|
||||
; *** OpenMQTTGateway Modules ***
|
||||
'-DZboardHELTEC="HELTEC"'
|
||||
'-DZdisplaySSD1306="HELTEC_SSD1306"'
|
||||
'-DLOG_TO_LCD=true' ; Enable log to LCD
|
||||
; '-DLOG_LEVEL_LCD=LOG_LEVEL_TRACE' // default is notice log level
|
||||
; '-DLOG_LEVEL_LCD=LOG_LEVEL_TRACE' // default is WARNING log level
|
||||
'-DZgatewayLORA="LORA"'
|
||||
'-DLORA_BAND=915E6'
|
||||
'-DGateway_Name="OpenMQTTGateway_ESP32_LORA"'
|
||||
|
||||
Reference in new issue
Block a user