feat(travelers): enable GPS with GP-02 module support

- Add HAS_GPS=1, GPS_RX_PIN=20, GPS_TX_PIN=21
- Add TCA9535 P1.6 (GPS RST) and P1.7 (GPS EN) control via I2C
- GPS power on at boot: P1.6 and P1.7 default HIGH in init
- Bridge gps->enablePin to TCA9535 via GpioUnaryTransformer
- Add tca9535GpsReset() and tca9535GpsEn() static functions
- Update CHANGELOG with GPS support details
This commit is contained in:
2026-03-29 07:28:58 +08:00
parent 6f51e8ff83
commit 311232c9b9
5 changed files with 93 additions and 8 deletions
+10
View File
@@ -955,6 +955,16 @@ void setup()
gps = GPS::createGps();
if (gps) {
gpsStatus->observe(&gps->newStatus);
#ifdef TCA9535_GPS_HAS_CTRL
// 替换 enablePin 为 TCA9535 P1.7GPS EN),I²C 控制
// createGps() 创建了空的 GpioVirtPin,替换为实际的 TCA9535 驱动
class GpioTca9535GpsEnPin : public GpioPin {
public:
void set(bool value) override { tca9535GpsEn(value); }
} *tca9535GpsEnPin = new GpioTca9535GpsEnPin();
new GpioUnaryTransformer(gps->enablePin, tca9535GpsEnPin);
// GPS 已在 TCA9535 init 中上电(P1.7=高),无需额外操作
#endif
} else {
LOG_DEBUG("Run without GPS");
}