mirror of
https://github.com/pelgraine/Meck.git
synced 2026-08-06 16:52:46 +02:00
Fix T-Watch S3 build; disambiguate the S3 Plus env names
Three build failures, all mine: 1. XPowersLib access. setPowerChannelVoltage, enable/disablePowerOutput and isPowerChannelEnable are protected on XPowersAXP2101 and public only on XPowersLibInterface, so holding the PMU as the concrete type made every rail call illegal. The board now keeps both pointers to the same object: PMU (interface) for the channel ops, _axp (concrete) for setIrqLevelTime and the PWRON press/release edges, which the interface does not declare. Verified against XPowersLib v0.2.9, the version ^0.2.7 resolves to. 2. ENV_INCLUDE_GPS. sensor_base defaults it to 1. The variant zeroed every other ENV_INCLUDE_* but not that one, so gpsStream, board.gpsPowerOn/Off and the GPS home page were all still compiled in. Now -D ENV_INCLUDE_GPS=0. 3. GPS_BAUDRATE is referenced unguarded by MyMesh.cpp's gps.baud CLI command. variant.h now supplies the same #ifndef fallback the T5S3 variant uses. Also renames the S3 Plus envs to meck_twatch_s3_plus_standalone and meck_twatch_s3_plus_ble, so they no longer read as the generic watch build. Nothing outside variants/lilygo_twatch_s3_plus/platformio.ini referenced the old names.
This commit is contained in:
@@ -96,10 +96,12 @@ void TWatchS3Board::begin() {
|
||||
}
|
||||
|
||||
bool TWatchS3Board::power_init() {
|
||||
PMU = new XPowersAXP2101(Wire, PIN_BOARD_SDA, PIN_BOARD_SCL, I2C_ADDR_PMU);
|
||||
_axp = new XPowersAXP2101(Wire, PIN_BOARD_SDA, PIN_BOARD_SCL, I2C_ADDR_PMU);
|
||||
PMU = _axp; // same object; see the note in TWatchS3Board.h
|
||||
if (!PMU->init()) {
|
||||
MESH_DEBUG_PRINTLN("Warning: Failed to find AXP2101 power management");
|
||||
delete PMU;
|
||||
delete _axp;
|
||||
_axp = NULL;
|
||||
PMU = NULL;
|
||||
return false;
|
||||
}
|
||||
@@ -152,7 +154,7 @@ bool TWatchS3Board::power_init() {
|
||||
// Matches the 2S ON / 6S OFF behaviour printed on LilyGo's own pin diagram.
|
||||
PMU->setPowerKeyPressOnTime(XPOWERS_POWERON_2S);
|
||||
PMU->setPowerKeyPressOffTime(XPOWERS_POWEROFF_6S);
|
||||
PMU->setIrqLevelTime(XPOWERS_AXP2101_IRQ_TIME_1S);
|
||||
_axp->setIrqLevelTime(XPOWERS_AXP2101_IRQ_TIME_1S); // not on XPowersLibInterface
|
||||
|
||||
PMU->disableIRQ(XPOWERS_AXP2101_ALL_IRQ);
|
||||
PMU->clearIrqStatus();
|
||||
|
||||
@@ -10,14 +10,20 @@
|
||||
|
||||
// LilyGo T-Watch S3 board (non-GPS, 470 mAh).
|
||||
//
|
||||
// Power is managed by an AXP2101 PMU on the main I2C bus. The PMU is held as the
|
||||
// concrete XPowersAXP2101 rather than XPowersLibInterface because PMUButton
|
||||
// needs isPekeyNegativeIrq()/isPekeyPositiveIrq(), which the interface does not
|
||||
// declare.
|
||||
// Power is managed by an AXP2101 PMU on the main I2C bus. Two pointers to the
|
||||
// same object are kept, because XPowersLib splits its API by access specifier:
|
||||
// PMU (XPowersLibInterface*) -- the power-channel ops (setPowerChannelVoltage,
|
||||
// enable/disablePowerOutput, isPowerChannelEnable) are PROTECTED on
|
||||
// XPowersAXP2101 and only reachable through the interface.
|
||||
// _axp (XPowersAXP2101*) -- setIrqLevelTime() and the PWRON press/release
|
||||
// edges isPekeyNegativeIrq()/isPekeyPositiveIrq() are AXP2101-only and
|
||||
// absent from the interface.
|
||||
// Everything else is public on both.
|
||||
class SensorBMA423; // full include kept in the .cpp to avoid a BLE-build header clash
|
||||
|
||||
class TWatchS3Board : public ESP32Board {
|
||||
XPowersAXP2101* PMU = NULL;
|
||||
XPowersLibInterface* PMU = NULL;
|
||||
XPowersAXP2101* _axp = NULL; // same object as PMU, concrete type
|
||||
SensorBMA423* _accel = nullptr;
|
||||
static volatile bool _tilt_flag;
|
||||
static void IRAM_ATTR onTiltISR(); // defined in the .cpp (IRAM relocation)
|
||||
@@ -31,7 +37,7 @@ public:
|
||||
bool tiltFired();
|
||||
|
||||
// The AXP2101 handle, for PMUButton. NULL if the PMU failed to init.
|
||||
XPowersAXP2101* getPMU() { return PMU; }
|
||||
XPowersAXP2101* getPMU() { return _axp; }
|
||||
|
||||
void enterDeepSleep(uint32_t secs, int pin_wake_btn) {
|
||||
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
|
||||
|
||||
@@ -48,8 +48,10 @@ build_flags =
|
||||
-D AUTO_SHUTDOWN_MILLIVOLTS=2800
|
||||
-D ARDUINO_LOOP_STACK_SIZE=32768
|
||||
; ---- No GPS ----
|
||||
; HAS_GPS and ENV_INCLUDE_GPS are deliberately left undefined. The watch map
|
||||
; screen, the GPS home page and the BLDO1 rail control are all gated on them.
|
||||
; HAS_GPS is deliberately left undefined, which drops the watch map screen.
|
||||
; ENV_INCLUDE_GPS must be explicitly zeroed: sensor_base defaults it to 1, and
|
||||
; it gates gpsStream, board.gpsPowerOn/Off and the GPS home page.
|
||||
-D ENV_INCLUDE_GPS=0
|
||||
-D ENV_INCLUDE_AHTX0=0
|
||||
-D ENV_INCLUDE_BME280=0
|
||||
-D ENV_INCLUDE_BMP280=0
|
||||
|
||||
@@ -80,8 +80,18 @@
|
||||
#define SDCARD_CS -1
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// GPS: none. HAS_GPS and ENV_INCLUDE_GPS are left undefined in platformio.ini,
|
||||
// which drops the map screen, the GPS home page and the BLDO1 rail control.
|
||||
// The optional external GPS shield lands on GPIO41 (RX) / GPIO42 (TX) if it is
|
||||
// ever wired up.
|
||||
// GPS: none. HAS_GPS and ENV_INCLUDE_GPS are left undefined / zeroed in
|
||||
// platformio.ini, which drops the map screen, the GPS home page and the BLDO1
|
||||
// rail control. The optional external GPS shield lands on GPIO41 (RX) /
|
||||
// GPIO42 (TX) if it is ever wired up.
|
||||
// -----------------------------------------------------------------------------
|
||||
// #define HAS_GPS 1
|
||||
// #define GPS_BAUDRATE 38400
|
||||
// #define GPS_RX_PIN 41
|
||||
// #define GPS_TX_PIN 42
|
||||
|
||||
// Fallback for code that references GPS_BAUDRATE without a HAS_GPS guard
|
||||
// (e.g. MyMesh.cpp "gps.baud" CLI command)
|
||||
#ifndef GPS_BAUDRATE
|
||||
#define GPS_BAUDRATE 9600
|
||||
#endif
|
||||
|
||||
@@ -93,7 +93,7 @@ lib_deps =
|
||||
; off until toggled on ("gps on"); maps, tiles and the on-screen keyboard are
|
||||
; deferred to later phases.
|
||||
; ---------------------------------------------------------------------------
|
||||
[env:meck_twatch_standalone]
|
||||
[env:meck_twatch_s3_plus_standalone]
|
||||
extends = LilyGo_TWatchS3Plus
|
||||
build_flags =
|
||||
${LilyGo_TWatchS3Plus.build_flags}
|
||||
@@ -128,9 +128,9 @@ lib_ignore =
|
||||
; Contacts stay PSRAM-allocated via initContacts(), covering the BLE stack's
|
||||
; internal-SRAM use. ESP32_CPU_FREQ=80 sets the boot clock low; note that
|
||||
; CPUPowerManager already governs the idle clock to 80 MHz at runtime.
|
||||
; Flash: pio run -e meck_twatch_ble -t upload
|
||||
; Flash: pio run -e meck_twatch_s3_plus_ble -t upload
|
||||
; ---------------------------------------------------------------------------
|
||||
[env:meck_twatch_ble]
|
||||
[env:meck_twatch_s3_plus_ble]
|
||||
extends = LilyGo_TWatchS3Plus
|
||||
build_flags =
|
||||
${LilyGo_TWatchS3Plus.build_flags}
|
||||
|
||||
Reference in New Issue
Block a user