Skip to content
3 changes: 3 additions & 0 deletions src/helpers/CommonCLI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,9 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
LocationProvider * l = _sensors->getLocationProvider();
if (l != NULL) {
l->syncTime();
strcpy(reply, "ok");
} else {
strcpy(reply, "gps provider not found");
}
} else if (memcmp(command, "gps setloc", 10) == 0) {
_prefs->node_lat = _sensors->node_lat;
Expand Down
3 changes: 3 additions & 0 deletions src/helpers/RefCountedDigitalPin.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ class RefCountedDigitalPin {
digitalWrite(_pin, _active);
}
}

void release() {
if (_claims == 0) return; // avoid negative _claims

_claims--;
if (_claims == 0) {
digitalWrite(_pin, !_active);
Expand Down
5 changes: 5 additions & 0 deletions variants/heltec_tracker/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ build_flags =
-D PIN_TFT_LEDA_CTL=21 ; LEDK (switches on/off via mosfet to create the ground)
-D PIN_GPS_RX=33
-D PIN_GPS_TX=34
-D PIN_GPS_EN=35 ; N-ch MOSFET Q2 drives P-ch high-side switch → active HIGH (default)
-D PIN_GPS_RESET=36
-D PIN_GPS_RESET_ACTIVE=LOW
-D GPS_BAUD_RATE=115200
-D ENV_INCLUDE_GPS=1
-D SX126X_DIO2_AS_RF_SWITCH=true
-D SX126X_DIO3_TCXO_VOLTAGE=1.8
-D SX126X_CURRENT_LIMIT=140
Expand Down
11 changes: 5 additions & 6 deletions variants/heltec_tracker/target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ WRAPPER_CLASS radio_driver(radio, board);

ESP32RTCClock fallback_clock;
AutoDiscoverRTCClock rtc_clock(fallback_clock);
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1);
// GPS_EN (GPIO35) drives N-ch MOSFET → P-ch high-side switch; GPS_RESET (GPIO36) active LOW
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock, GPS_RESET, GPS_EN, &board.periph_power);
HWTSensorManager sensors = HWTSensorManager(nmea);

#ifdef DISPLAY_CLASS
Expand Down Expand Up @@ -58,18 +59,16 @@ mesh::LocalIdentity radio_new_identity() {

void HWTSensorManager::start_gps() {
if (!gps_active) {
board.periph_power.claim();

_location->begin(); // Claims periph_power via RefCountedDigitalPin
gps_active = true;
Serial1.println("$CFGSYS,h35155*68");
Serial1.println("$CFGSYS,h35155*68"); // Configure GPS for all constellations
}
}

void HWTSensorManager::stop_gps() {
if (gps_active) {
gps_active = false;

board.periph_power.release();
_location->stop(); // Releases periph_power via RefCountedDigitalPin
}
}

Expand Down
1 change: 1 addition & 0 deletions variants/heltec_tracker/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class HWTSensorManager : public SensorManager {
const char* getSettingName(int i) const override;
const char* getSettingValue(int i) const override;
bool setSettingValue(const char* name, const char* value) override;
LocationProvider* getLocationProvider() override { return _location; }
};

extern HeltecV3Board board;
Expand Down
4 changes: 1 addition & 3 deletions variants/heltec_v4/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ build_flags =
-D P_LORA_PA_TX_EN=46 ; PA CPS - GC1109 TX PA full(High) / bypass(Low)
-D PIN_USER_BTN=0
-D PIN_VEXT_EN=36
-D PIN_VEXT_EN_ACTIVE=LOW
-D PIN_VEXT_EN_ACTIVE=HIGH
-D LORA_TX_POWER=10 ;If it is configured as 10 here, the final output will be 22 dbm.
-D MAX_LORA_TX_POWER=22 ; Max SX1262 output
-D SX126X_REGISTER_PATCH=1 ; Patch register 0x8B5 for improved RX
Expand Down Expand Up @@ -54,8 +54,6 @@ build_flags =
-D PIN_BOARD_SDA=17
-D PIN_BOARD_SCL=18
-D PIN_OLED_RESET=21
-D ENV_PIN_SDA=4
-D ENV_PIN_SCL=3
build_src_filter= ${Heltec_lora32_v4.build_src_filter}
lib_deps = ${Heltec_lora32_v4.lib_deps}

Expand Down
2 changes: 1 addition & 1 deletion variants/heltec_v4/target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
#endif

#ifdef DISPLAY_CLASS
DISPLAY_CLASS display(&(board.periph_power));
DISPLAY_CLASS display(NULL);
MomentaryButton user_btn(PIN_USER_BTN, 1000, true);
#endif

Expand Down