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
78 lines
2.6 KiB
C
78 lines
2.6 KiB
C
/*
|
|
OpenMQTTGateway - ESP8266 or Arduino program for home automation
|
|
|
|
Act as a wifi or ethernet gateway between your 433mhz/infrared IR signal and a MQTT broker
|
|
Send and receiving command by MQTT
|
|
|
|
This files enables to use M5Stick C board components (display)
|
|
|
|
Copyright: (c)Florian ROBERT
|
|
|
|
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_M5_h
|
|
#define config_M5_h
|
|
|
|
#ifdef ZboardM5STICKC
|
|
# include <M5StickC.h>
|
|
#endif
|
|
#ifdef ZboardM5STICKCP
|
|
# include <M5StickCPlus.h>
|
|
#endif
|
|
#ifdef ZboardM5STACK
|
|
# include <M5Stack.h>
|
|
#endif
|
|
#ifdef ZboardM5TOUGH
|
|
# include <M5Tough.h>
|
|
#endif
|
|
|
|
extern void setupM5();
|
|
extern void loopM5();
|
|
/*----------------------------USER PARAMETERS-----------------------------*/
|
|
/*---------------DEFINE SCREEN BRIGHTNESS------------------*/
|
|
#ifdef ZboardM5TOUGH // Sleep brightness doesn't seem to work for the moment on Tough
|
|
# ifndef SLEEP_LCD_BRIGHTNESS
|
|
# define SLEEP_LCD_BRIGHTNESS 15 // 0 to 100
|
|
# endif
|
|
#else
|
|
# ifndef SLEEP_LCD_BRIGHTNESS
|
|
# define SLEEP_LCD_BRIGHTNESS 2 // 0 to 100
|
|
# endif
|
|
#endif
|
|
#ifndef NORMAL_LCD_BRIGHTNESS
|
|
# define NORMAL_LCD_BRIGHTNESS 100 // 0 to 100
|
|
#endif
|
|
/*---------------DEFINE SLEEP BUTTON------------------*/
|
|
#ifndef SLEEP_BUTTON
|
|
# define SLEEP_BUTTON 33
|
|
#endif
|
|
/*-------------------DEFINE LOG LEVEL----------------------*/
|
|
#define LOG_LEVEL_LCD LOG_LEVEL_WARNING // if we go down below warning the size of the text to display can make the M5 restarting
|
|
#define LOG_TO_LCD true //set to false if you want to use serial monitor for the log per default instead of the M5 screen
|
|
/*-------------------DEFINE MQTT TOPIC FOR CONFIG----------------------*/
|
|
#define subjectMQTTtoM5set "/commands/MQTTtoM5/config"
|
|
|
|
// Simple print macro
|
|
|
|
// Simple construct for displaying message in lcd and oled displays
|
|
|
|
#define displayPrint(...) \
|
|
if (lowpowermode < 2) M5Print(__VA_ARGS__) // only print if not in low power mode
|
|
#define lpDisplayPrint(...) M5Print(__VA_ARGS__) // print in low power mode
|
|
|
|
void M5Print(char*, char* = "", char* = "");
|
|
|
|
#endif |