Add board M5Stickc Plus (#828)
This commit is contained in:
1 parent
417eb99d40
commit
6ae09d8bb6
7 files changed
+54
-19
No files matched your search
+5
-5
@@ -7,7 +7,7 @@
|
||||
So as to erase the flash memory on ESP boards you may do a long press to TRIGGER_GPIO button or connect the pin TRIGGER_GPIO to the ground during several seconds.
|
||||
|
||||
On M5Stack boards you may do a long press to these buttons:
|
||||
* Button B on M5StickC (GPIO 37)
|
||||
* Button B on M5StickC and M5StickC Plus (GPIO 37)
|
||||
* Button C on M5Stack (GPIO 37)
|
||||
* Button lateral on M5stick (GPIO 35)
|
||||
|
||||
@@ -31,7 +31,7 @@ When coming back from mode 2 to mode 0 you may publish the command with a retain
|
||||
If you change the default low power mode in config_BT.h to 2 and your credential are not set or not correct, the ESP32 will not connect to the broker and the only way to change the low power mode will be a new erase/upload.
|
||||
:::
|
||||
|
||||
## M5Stick C or M5Stack
|
||||
## M5StickC, M5StickC Plus or M5Stack
|
||||
|
||||
### Behaviour
|
||||
|
||||
@@ -39,7 +39,7 @@ If the connexion of the board to WIFI and MQTT is successfull you will see the l
|
||||
|
||||

|
||||
|
||||
The same behaviour apply to M5 Stick C
|
||||
The same behaviour apply to M5StickC and M5StickC Plus
|
||||
|
||||

|
||||
|
||||
@@ -66,8 +66,8 @@ OpenMQTTGateway support a low power mode for ESP32, this mode can be set by MQTT
|
||||
|
||||
`mosquitto_pub -t "home/OpenMQTTGateway/commands/MQTTtoBT/config" -m '{"low_power_mode":1}'`
|
||||
|
||||
* Low Power mode, screen OFF, LED ON when processing on M5StickC
|
||||
* Low Power mode, screen OFF, LED ON when processing on M5StickC or M5stickC Plus
|
||||
|
||||
`mosquitto_pub -t "home/OpenMQTTGateway/commands/MQTTtoBT/config" -m '{"low_power_mode":2}'`
|
||||
|
||||
The low power mode can be changed also with a push to button B when the board is processing (top button on M5stickC and middle button of M5stack).
|
||||
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).
|
||||
@@ -229,6 +229,7 @@ uint8_t wifiProtocol = 0; // default mode, automatic selection
|
||||
//#define ZmqttDiscovery "HADiscovery"//ESP8266, Arduino, ESP32, Sonoff RF Bridge
|
||||
//#define ZactuatorFASTLED "FASTLED" //ESP8266, Arduino, ESP32, Sonoff RF Bridge
|
||||
//#define ZboardM5STICKC "M5StickC"
|
||||
//#define ZboardM5STICKCP "M5StickCP"
|
||||
//#define ZboardM5STACK "ZboardM5STACK"
|
||||
//#define ZradioCC1101 "CC1101" //ESP8266, ESP32
|
||||
//#define ZactuatorPWM "PWM" //ESP8266, ESP32
|
||||
|
||||
+6
-3
@@ -28,10 +28,13 @@
|
||||
*/
|
||||
#include "User_config.h"
|
||||
|
||||
#if defined(ZboardM5STICKC) || defined(ZboardM5STACK)
|
||||
#if defined(ZboardM5STICKC) || defined(ZboardM5STICKCP) || defined(ZboardM5STACK)
|
||||
# ifdef ZboardM5STICKC
|
||||
# include <M5StickC.h>
|
||||
# endif
|
||||
# ifdef ZboardM5STICKCP
|
||||
# include <M5StickCPlus.h>
|
||||
# endif
|
||||
# ifdef ZboardM5STACK
|
||||
# include <M5Stack.h>
|
||||
# endif
|
||||
@@ -43,7 +46,7 @@ void setBrightness(int brightness) {
|
||||
# ifdef ZboardM5STACK
|
||||
M5.Lcd.setBrightness(brightness * 2);
|
||||
# endif
|
||||
# ifdef ZboardM5STICKC
|
||||
# if defined(ZboardM5STICKC) || defined(ZboardM5STICKCP)
|
||||
(!brightness) ? M5.Axp.ScreenBreath(0) : M5.Axp.ScreenBreath(7 + (int)brightness * 0.08);
|
||||
# endif
|
||||
}
|
||||
@@ -84,7 +87,7 @@ void sleepScreen() {
|
||||
# ifdef ZboardM5STACK
|
||||
M5.begin(false, false, false); // M5.lcd.sleep() provokes a reset of the ESP
|
||||
# endif
|
||||
# ifdef ZboardM5STICKC
|
||||
# if defined(ZboardM5STICKC) || defined(ZboardM5STICKCP)
|
||||
M5.Axp.ScreenBreath(0);
|
||||
M5.Axp.SetLDO2(false);
|
||||
# endif
|
||||
|
||||
+1
-1
@@ -654,7 +654,7 @@ void changelow_power_mode(int newLowPowerMode) {
|
||||
# ifdef ZboardM5STACK
|
||||
M5.Lcd.wakeup();
|
||||
# endif
|
||||
# ifdef ZboardM5STICKC
|
||||
# if defined(ZboardM5STICKC) || defined(ZboardM5STICKCP)
|
||||
M5.Axp.SetLDO2(true);
|
||||
M5.Lcd.begin();
|
||||
# endif
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
#ifdef ZboardM5STICKC
|
||||
# include <M5StickC.h>
|
||||
#endif
|
||||
#ifdef ZboardM5STICKCP
|
||||
# include <M5StickCPlus.h>
|
||||
#endif
|
||||
#ifdef ZboardM5STACK
|
||||
# include <M5Stack.h>
|
||||
#endif
|
||||
|
||||
+10
-10
@@ -132,7 +132,7 @@ JsonArray& modules = modulesBuffer.createArray();
|
||||
#ifdef ZactuatorPWM
|
||||
# include "config_PWM.h"
|
||||
#endif
|
||||
#if defined(ZboardM5STICKC) || defined(ZboardM5STACK)
|
||||
#if defined(ZboardM5STICKC) || defined(ZboardM5STICKCP) || defined(ZboardM5STACK)
|
||||
# include "config_M5.h"
|
||||
#endif
|
||||
#if defined(ZgatewayRS232)
|
||||
@@ -466,7 +466,7 @@ void connectMQTT() {
|
||||
strcat(topic, will_Topic);
|
||||
client.setBufferSize(mqtt_max_packet_size);
|
||||
if (client.connect(gateway_name, mqtt_user, mqtt_pass, topic, will_QoS, will_Retain, will_Message)) {
|
||||
#if defined(ZboardM5STICKC) || defined(ZboardM5STACK)
|
||||
#if defined(ZboardM5STICKC) || defined(ZboardM5STICKCP) || defined(ZboardM5STACK)
|
||||
if (low_power_mode < 2)
|
||||
M5Display("MQTT connected", "", "");
|
||||
#endif
|
||||
@@ -547,7 +547,7 @@ void setup() {
|
||||
preferences.begin(Gateway_Short_Name, false);
|
||||
low_power_mode = preferences.getUInt("low_power_mode", DEFAULT_LOW_POWER_MODE);
|
||||
preferences.end();
|
||||
# if defined(ZboardM5STICKC) || defined(ZboardM5STACK)
|
||||
# if defined(ZboardM5STICKC) || defined(ZboardM5STICKCP) || defined(ZboardM5STACK)
|
||||
setupM5();
|
||||
# endif
|
||||
# endif
|
||||
@@ -807,7 +807,7 @@ void setOTA() {
|
||||
# if defined(ZgatewayBT) && defined(ESP32)
|
||||
stopProcessing();
|
||||
# endif
|
||||
# if defined(ZboardM5STICKC) || defined(ZboardM5STACK)
|
||||
# if defined(ZboardM5STICKC) || defined(ZboardM5STICKCP) || defined(ZboardM5STACK)
|
||||
M5Display("OTA in progress", "", "");
|
||||
# endif
|
||||
});
|
||||
@@ -816,7 +816,7 @@ void setOTA() {
|
||||
# if defined(ZgatewayBT) && defined(ESP32)
|
||||
startProcessing();
|
||||
# endif
|
||||
# if defined(ZboardM5STICKC) || defined(ZboardM5STACK)
|
||||
# if defined(ZboardM5STICKC) || defined(ZboardM5STICKCP) || defined(ZboardM5STACK)
|
||||
M5Display("OTA done", "", "");
|
||||
# endif
|
||||
});
|
||||
@@ -1046,7 +1046,7 @@ void setup_wifimanager(bool reset_settings) {
|
||||
{
|
||||
# ifdef ESP32
|
||||
if (low_power_mode < 2) {
|
||||
# if defined(ZboardM5STICKC) || defined(ZboardM5STACK)
|
||||
# if defined(ZboardM5STICKC) || defined(ZboardM5STICKCP) || defined(ZboardM5STACK)
|
||||
M5Display("Connect your phone to WIFI AP:", WifiManager_ssid, WifiManager_password);
|
||||
# endif
|
||||
} 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)
|
||||
@@ -1073,7 +1073,7 @@ void setup_wifimanager(bool reset_settings) {
|
||||
}
|
||||
}
|
||||
|
||||
# if defined(ZboardM5STICKC) || defined(ZboardM5STACK)
|
||||
# if defined(ZboardM5STICKC) || defined(ZboardM5STICKCP) || defined(ZboardM5STACK)
|
||||
if (low_power_mode < 2)
|
||||
M5Display("Wifi connected", "", "");
|
||||
# endif
|
||||
@@ -1346,7 +1346,7 @@ void loop() {
|
||||
#endif
|
||||
}
|
||||
// Function that doesn't need an active connection
|
||||
#if defined(ZboardM5STICKC) || defined(ZboardM5STACK)
|
||||
#if defined(ZboardM5STICKC) || defined(ZboardM5STICKCP) || defined(ZboardM5STACK)
|
||||
loopM5();
|
||||
#endif
|
||||
}
|
||||
@@ -1392,7 +1392,7 @@ void stateMeasures() {
|
||||
SYSdata["m5-is-charging"] = (bool)M5.Power.isCharging();
|
||||
SYSdata["m5-is-chargefull"] = (bool)M5.Power.isChargeFull();
|
||||
# endif
|
||||
# ifdef ZboardM5STICKC
|
||||
# if defined(ZboardM5STICKC) || defined(ZboardM5STICKCP)
|
||||
M5.Axp.EnableCoulombcounter();
|
||||
SYSdata["m5-bat-voltage"] = (float)M5.Axp.GetBatVoltage();
|
||||
SYSdata["m5-bat-current"] = (float)M5.Axp.GetBatCurrent();
|
||||
@@ -1514,7 +1514,7 @@ void receivingMQTT(char* topicOri, char* datacallback) {
|
||||
# ifdef ZactuatorPWM
|
||||
MQTTtoPWM(topicOri, jsondata);
|
||||
# endif
|
||||
# if defined(ZboardM5STICKC) || defined(ZboardM5STACK)
|
||||
# if defined(ZboardM5STICKC) || defined(ZboardM5STICKCP) || defined(ZboardM5STACK)
|
||||
MQTTtoM5(topicOri, jsondata);
|
||||
# endif
|
||||
# ifdef ZactuatorONOFF // outside the jsonpublishing macro due to the fact that we need to use simplepublishing with HA discovery
|
||||
|
||||
@@ -44,6 +44,7 @@ extra_configs =
|
||||
;default_envs = esp32-m5stick-ble
|
||||
;default_envs = esp32-m5stack-ble
|
||||
;default_envs = esp32-m5stick-c-ble
|
||||
;default_envs = esp32-m5stick-cp-ble
|
||||
;default_envs = esp32-m5atom
|
||||
;default_envs = ttgo-lora32-v1
|
||||
;default_envs = nodemcuv2-rf
|
||||
@@ -104,6 +105,7 @@ fastled = FastLED@3.3.2
|
||||
onewire = OneWire
|
||||
dallastemperature = DallasTemperature
|
||||
m5stickc = M5StickC@0.2.0
|
||||
m5stickcp = https://github.com/m5stack/M5StickC-Plus.git
|
||||
m5stack = M5Stack@0.3.0
|
||||
smartrc-cc1101-driver-lib = SmartRC-CC1101-Driver-Lib@2.3.5
|
||||
stl = https://github.com/mike-matera/ArduinoSTL.git#7411816
|
||||
@@ -405,6 +407,32 @@ build_flags =
|
||||
'-DGateway_Name="OpenMQTTGateway_ESP32_M5STICK_C_BLE_IR"'
|
||||
board_upload.speed = 1500000
|
||||
|
||||
[env:esp32-m5stick-cp-ble]
|
||||
platform = ${com.esp32_platform}
|
||||
board = pico32
|
||||
board_build.partitions = min_spiffs.csv
|
||||
lib_deps =
|
||||
${com-esp.lib_deps}
|
||||
${libraries.ble}
|
||||
${libraries.m5stickcp}
|
||||
${libraries.irremoteesp}
|
||||
build_flags =
|
||||
${com-esp.build_flags}
|
||||
'-DZgatewayBT="BT"'
|
||||
'-DZgatewayIR="IR"'
|
||||
'-DZsensorGPIOInput="GPIOInput"'
|
||||
'-DZboardM5STICKCP="M5StickCP"'
|
||||
'-DACTUATOR_ONOFF_GPIO=10'
|
||||
'-DINPUT_GPIO=37'
|
||||
'-DLED_RECEIVE=10'
|
||||
'-DLED_RECEIVE_ON=0'
|
||||
'-DSLEEP_BUTTON=39'
|
||||
'-DTRIGGER_GPIO=39'
|
||||
'-DIR_EMITTER_INVERTED=true'
|
||||
'-DIR_EMITTER_GPIO=9'
|
||||
'-DGateway_Name="OpenMQTTGateway_ESP32_M5STICK_CP_BLE_IR"'
|
||||
board_upload.speed = 1500000
|
||||
|
||||
[env:esp32-m5atom]
|
||||
platform = ${com.esp32_platform}
|
||||
board = pico32
|
||||
|
||||
Reference in new issue
Block a user