[SYS] Migrate M5 boards to M5Unified + M5GFX (modern platform) (#2355)
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>
This commit is contained in:
1 parent
7df23d4e3e
commit
d8ffa3f1dd
6 files changed
+82
-91
No files matched your search
+11
-14
@@ -2933,23 +2933,20 @@ String stateMeasures() {
|
||||
SYSdata["mac"] = (char*)WiFi.macAddress().c_str();
|
||||
}
|
||||
#ifdef ZboardM5STACK
|
||||
M5.Power.begin();
|
||||
// Power is initialised by M5.begin() in setupM5(); no explicit begin() needed.
|
||||
SYSdata["m5battlevel"] = (int8_t)M5.Power.getBatteryLevel();
|
||||
SYSdata["m5ischarging"] = (bool)M5.Power.isCharging();
|
||||
SYSdata["m5ischargefull"] = (bool)M5.Power.isChargeFull();
|
||||
SYSdata["m5ischarging"] = (bool)(M5.Power.isCharging() == m5::Power_Class::is_charging);
|
||||
SYSdata["m5ischargefull"] = (bool)(M5.Power.getBatteryLevel() >= 100);
|
||||
#endif
|
||||
#if defined(ZboardM5STICKC) || defined(ZboardM5STICKCP) || defined(ZboardM5TOUGH)
|
||||
M5.Axp.EnableCoulombcounter();
|
||||
SYSdata["m5batvoltage"] = (float)M5.Axp.GetBatVoltage();
|
||||
SYSdata["m5batcurrent"] = (float)M5.Axp.GetBatCurrent();
|
||||
SYSdata["m5vinvoltage"] = (float)M5.Axp.GetVinVoltage();
|
||||
SYSdata["m5vincurrent"] = (float)M5.Axp.GetVinCurrent();
|
||||
SYSdata["m5vbusvoltage"] = (float)M5.Axp.GetVBusVoltage();
|
||||
SYSdata["m5vbuscurrent"] = (float)M5.Axp.GetVBusCurrent();
|
||||
SYSdata["m5tempaxp"] = (float)M5.Axp.GetTempInAXP192();
|
||||
SYSdata["m5batpower"] = (float)M5.Axp.GetBatPower();
|
||||
SYSdata["m5batchargecurrent"] = (float)M5.Axp.GetBatChargeCurrent();
|
||||
SYSdata["m5apsvoltage"] = (float)M5.Axp.GetAPSVoltage();
|
||||
// M5Unified exposes a portable battery API across the AXP192/AXP2101 PMICs.
|
||||
// getBatteryVoltage() is in mV; convert to volts to preserve the previous
|
||||
// field semantics. The AXP192-only Vin/VBus/internal-temperature/power
|
||||
// readings have no portable M5Unified equivalent, so those fields are dropped.
|
||||
SYSdata["m5batvoltage"] = (float)M5.Power.getBatteryVoltage() / 1000.0f;
|
||||
SYSdata["m5batcurrent"] = (float)M5.Power.getBatteryCurrent();
|
||||
SYSdata["m5battlevel"] = (int8_t)M5.Power.getBatteryLevel();
|
||||
SYSdata["m5ischarging"] = (bool)(M5.Power.isCharging() == m5::Power_Class::is_charging);
|
||||
#endif
|
||||
SYSdata["modules"] = modules;
|
||||
|
||||
|
||||
Reference in new issue
Block a user