mirror of
https://github.com/1technophile/OpenMQTTGateway.git
synced 2026-02-20 00:32:04 +01:00
* Update arduino core to 3.1.1 * Fix Blufi build * Update arduinojson, fix build errors with idf * Fix narrowing * fix RF builds * WIP-Convert ino files to cpp * Fix pilight build * Fix Somfy actuator build. * Update esp32dev-rf partition * Fix Weatherstation build * Fix GFSunInverter build * Fix esp32dev-ir build * Fix ble-aws build * Fix eth builds * Fix m5Stack missing pins_arduino.h * Fix build errors for M5 stack/tough, others are upstream issues. * Fix RTL 433 build - remaining errors are from radolib * Fix nodemcu build * fix 2g builds * Fix serial build * Fix actuator on off builds * Fix SSD1306 build - remaining errors are from radiolib * Fix multiple definition of OTAserver_cert * Fix nodemcu rf2 build * Fix ADC builds * Fix sensor builds * Fix LORA builds * Fix multi-receiver builds - remaining errors are in radiolib * Fix fastled builds * Fix theegns board builds * Fix broker builds * Update fastled - old version failed all-test build * Fix RN8209 builds * Fix max temp actuator builds * Fix PWM builds * Fix C37 sensor builds * Fix HTU21 builds * Fix INA266 builds * Fix undefined variables in mqtt discovery * Fix webui build * Fix fastled invalid pin error * Fix wifi manual setup builds * Fix onewire/all-test build - bin too big error remaining * Fix theengs plug build * Fix rfbridge builds * Fix blufi builds * Fix undefined functions in serial * Fix preprocessor definition checks * Set IDF log level to erre * Add delay in loop to prevent watchdog timeout * Use xTaskCreateUniveral to support single core processors * Remove old HTTPUpdate files - upsteam fixed. * Cleanup and move common declarations to header file * Use custom partiton table to fix builds where bin is too large * Update M5StickC - fixs esp32-m5stick-c-ble build * Revert to Arduino core 2.x for builds with incompatible libs * Remove "Z" from file names and rename omg_common to TheengsCommon * Fix gateway name when using MAC with new Arduino core * Update IDF config to reduce loop task stack use * Update esp-nimble-cpp version, corrects BLE uppercase ID's * Update wifi manager to fix watchdog timeout error
140 lines
4.4 KiB
C
140 lines
4.4 KiB
C
/*
|
|
OpenMQTTGateway Addon - ESP8266 or Arduino program for home automation
|
|
|
|
Act as a gateway between your 433mhz, infrared IR, BLE, LoRa signal and one interface like an 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
|
|
|
|
Contributors:
|
|
- 1technophile
|
|
- NorthernMan54
|
|
|
|
This file is part of OpenMQTTGateway.
|
|
|
|
OpenMQTTGateway is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
OpenMQTTGateway is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef config_SSD1306_h
|
|
#define config_SSD1306_h
|
|
|
|
#include "TheengsCommon.h"
|
|
#include "config_WebUI.h"
|
|
|
|
/*-------------------DEFINE LOG LEVEL----------------------*/
|
|
|
|
#ifndef LOG_LEVEL_OLED
|
|
# define LOG_LEVEL_OLED LOG_LEVEL_WARNING // Default to only display Warning level messages
|
|
#endif
|
|
|
|
#ifndef LOG_TO_OLED
|
|
# define LOG_TO_OLED false // Default to not display log messages on display
|
|
#endif
|
|
|
|
#ifndef ZwebUI
|
|
# ifndef JSON_TO_OLED
|
|
# define JSON_TO_OLED true // Default to displaying JSON messages on the display
|
|
# endif
|
|
#else
|
|
# ifndef JSON_TO_OLED
|
|
# define JSON_TO_OLED false // If WebUI is NOT included within the build, the JSON message parser is not included within the build and the JSON messages are not available for display
|
|
# endif
|
|
#endif
|
|
|
|
#ifndef DISPLAY_PAGE_INTERVAL
|
|
# define DISPLAY_PAGE_INTERVAL 3 // Number of seconds between json message displays
|
|
#endif
|
|
|
|
#ifndef DISPLAY_IDLE_LOGO
|
|
# define DISPLAY_IDLE_LOGO true // Display the OMG logo when idle
|
|
#endif
|
|
|
|
#ifndef DISPLAY_FLIP
|
|
# define DISPLAY_FLIP true // Flip display orientation
|
|
#endif
|
|
|
|
#ifndef DISPLAY_STATE
|
|
# define DISPLAY_STATE true // set to false if you don't want to use the display
|
|
#endif
|
|
|
|
#ifndef DISPLAY_BRIGHTNESS
|
|
# define DISPLAY_BRIGHTNESS 50 // 0-100; 50 % brightness as default
|
|
#endif
|
|
|
|
/*------------------- DEFAULT DISPLAY GEOMETRY ----------------------*/
|
|
|
|
#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
|
|
|
|
#define OLED_TEXT_WIDTH OLED_WIDTH / 4 // This is an approx amount
|
|
|
|
/*-------------------DEFINE MQTT TOPIC FOR CONFIG----------------------*/
|
|
|
|
#define subjectMQTTtoSSD1306set "/commands/MQTTtoSSD1306/config"
|
|
#define subjectSSD1306toMQTT "/SSD1306toMQTT"
|
|
|
|
/*-------------------Display Blanking via Touch----------------------*/
|
|
|
|
#ifdef DISPLAY_BLANKING
|
|
# ifndef DISPLAY_BLANKING_TOUCH_GPIO
|
|
# define DISPLAY_BLANKING_TOUCH_GPIO 2 // GPIO pin for touch sensor
|
|
# endif
|
|
# ifndef DISPLAY_BLANKING_START
|
|
# define DISPLAY_BLANKING_START 30 // 30 seconds after last touch
|
|
# endif
|
|
# ifndef DISPLAY_BLANKING_THRESHOLD
|
|
# define DISPLAY_BLANKING_THRESHOLD 10
|
|
# endif
|
|
# define TOUCH_READINGS 100 // Number of readings to average
|
|
# define TOUCH_THRESHOLD 0.2 // 20% change in reading
|
|
#endif
|
|
|
|
/*-------------------EXTERNAL FUNCTIONS----------------------*/
|
|
|
|
extern void setupSSD1306();
|
|
extern void loopSSD1306();
|
|
extern void XtoSSD1306(const char*, JsonObject&);
|
|
extern String stateSSD1306Display();
|
|
|
|
// Simple construct for displaying message in lcd and oled displays
|
|
|
|
#define displayPrint(...) \
|
|
if (SYSConfig.powerMode < 1) ssd1306Print(__VA_ARGS__) // only print if not in low power mode
|
|
#define lpDisplayPrint(...) ssd1306Print(__VA_ARGS__) // print in low power mode
|
|
|
|
void ssd1306Print(char*, char*, char*);
|
|
void ssd1306Print(char*, char*);
|
|
void ssd1306Print(char*);
|
|
|
|
/*-------------------End of Global Variables----------------------*/
|
|
|
|
#endif
|