The per-board libs (M5Stack/M5StickC/M5StickC-Plus/M5Tough) don't build on
Arduino core 3.x, which kept the five M5 BLE envs pinned to espressif32@6.1.0.
Port board support to M5Unified + M5GFX so they run ${com.esp32_platform} like
the rest of the tree.
- environments.ini: 5 M5 envs -> modern platform + m5unified. m5stick-c uses the
pico32 variant (m5stick_c variant absent upstream) and no_coredump partitions
(M5Unified overflows min_spiffs).
- boardM5.cpp / config_M5.h: single <M5Unified.h>; M5.Lcd aliases M5.Display;
unified brightness/sleep/wake.
- main.cpp / mqttDiscovery.cpp: battery telemetry via M5.Power; AXP192-only
Vin/VBus/temp fields dropped (no portable equivalent).
All five M5 envs build; M5Stack Core hardware-verified.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
76 lines
2.9 KiB
C
76 lines
2.9 KiB
C
/*
|
|
Theengs OpenMQTTGateway - We Unite Sensors in One Open-Source Interface
|
|
|
|
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
|
|
|
|
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
|
|
|
|
// All M5 boards (Core / Stick C / Stick C Plus / Tough) are driven through the
|
|
// unified M5Unified + M5GFX libraries, which build on the modern Arduino core
|
|
// and auto-detect the board at runtime. This replaces the per-board libraries
|
|
// (M5Stack / M5StickC / M5StickC-Plus / M5Tough) that were pinned to Arduino
|
|
// core 2.x (espressif32@6.1.0) because they don't compile on core 3.x.
|
|
#include <M5Unified.h>
|
|
|
|
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----------------------*/
|
|
#ifndef LOG_LEVEL_LCD
|
|
# define LOG_LEVEL_LCD LOG_LEVEL_WARNING // Default to only display Warning level messages, if we go down below warning the size of the text to display can make the M5 restarting
|
|
#endif
|
|
#ifndef LOG_TO_LCD
|
|
# define LOG_TO_LCD true // Default to display log messages on display
|
|
#endif
|
|
/*-------------------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 (SYSConfig.powerMode < 1) 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 |