mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-23 17:13:38 +00:00
PIN_GPS_EN power toggling (#2592)
* PIN_GPS_EN * Remove extra digitalWrite * GPS_POWER_TOGGLE macro enabled. Added WSLv3 too * Update variant.h * Update variant.h * Fixed macro guard
This commit is contained in:
parent
65aafe7ea1
commit
de53280ffc
@ -419,13 +419,12 @@ bool GPS::setupGPS()
|
|||||||
bool GPS::setup()
|
bool GPS::setup()
|
||||||
{
|
{
|
||||||
// Master power for the GPS
|
// Master power for the GPS
|
||||||
#ifdef PIN_GPS_EN
|
|
||||||
digitalWrite(PIN_GPS_EN, 1);
|
|
||||||
pinMode(PIN_GPS_EN, OUTPUT);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAS_PMU
|
#if defined(HAS_PMU) || defined(PIN_GPS_EN)
|
||||||
if (config.position.gps_enabled) {
|
if (config.position.gps_enabled) {
|
||||||
|
#ifdef PIN_GPS_EN
|
||||||
|
pinMode(PIN_GPS_EN, OUTPUT);
|
||||||
|
#endif
|
||||||
setGPSPower(true);
|
setGPSPower(true);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -99,6 +99,10 @@ void setGPSPower(bool on)
|
|||||||
{
|
{
|
||||||
LOG_INFO("Setting GPS power=%d\n", on);
|
LOG_INFO("Setting GPS power=%d\n", on);
|
||||||
|
|
||||||
|
#ifdef PIN_GPS_EN
|
||||||
|
digitalWrite(PIN_GPS_EN, on ? 1 : 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAS_PMU
|
#ifdef HAS_PMU
|
||||||
if (pmu_found && PMU) {
|
if (pmu_found && PMU) {
|
||||||
uint8_t model = PMU->getChipModel();
|
uint8_t model = PMU->getChipModel();
|
||||||
@ -185,7 +189,7 @@ static void waitEnterSleep()
|
|||||||
|
|
||||||
void doGPSpowersave(bool on)
|
void doGPSpowersave(bool on)
|
||||||
{
|
{
|
||||||
#ifdef HAS_PMU
|
#if defined(HAS_PMU) || defined(PIN_GPS_EN)
|
||||||
if (on) {
|
if (on) {
|
||||||
LOG_INFO("Turning GPS back on\n");
|
LOG_INFO("Turning GPS back on\n");
|
||||||
gps->forceWake(1);
|
gps->forceWake(1);
|
||||||
|
@ -4,3 +4,4 @@ board = heltec_wifi_lora_32_V3
|
|||||||
# Temporary until espressif creates a release with this new target
|
# Temporary until espressif creates a release with this new target
|
||||||
build_flags =
|
build_flags =
|
||||||
${esp32s3_base.build_flags} -D HELTEC_V3 -I variants/heltec_v3
|
${esp32s3_base.build_flags} -D HELTEC_V3 -I variants/heltec_v3
|
||||||
|
-DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely.
|
@ -7,6 +7,8 @@
|
|||||||
#define VEXT_ENABLE Vext // active low, powers the oled display and the lora antenna boost
|
#define VEXT_ENABLE Vext // active low, powers the oled display and the lora antenna boost
|
||||||
#define BUTTON_PIN 0
|
#define BUTTON_PIN 0
|
||||||
|
|
||||||
|
#define PIN_GPS_EN 46 // GPS power enable pin
|
||||||
|
|
||||||
#define BATTERY_PIN 1 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
#define BATTERY_PIN 1 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
||||||
#define ADC_CHANNEL ADC1_GPIO1_CHANNEL
|
#define ADC_CHANNEL ADC1_GPIO1_CHANNEL
|
||||||
#define ADC_ATTENUATION ADC_ATTEN_DB_2_5 // lower dB for high resistance voltage divider
|
#define ADC_ATTENUATION ADC_ATTEN_DB_2_5 // lower dB for high resistance voltage divider
|
||||||
@ -29,4 +31,4 @@
|
|||||||
#define SX126X_DIO1 LORA_DIO1
|
#define SX126X_DIO1 LORA_DIO1
|
||||||
#define SX126X_BUSY LORA_DIO2
|
#define SX126X_BUSY LORA_DIO2
|
||||||
#define SX126X_RESET LORA_RESET
|
#define SX126X_RESET LORA_RESET
|
||||||
#define SX126X_E22
|
#define SX126X_E22
|
||||||
|
@ -4,3 +4,4 @@ board = heltec_wifi_lora_32_V3
|
|||||||
# Temporary until espressif creates a release with this new target
|
# Temporary until espressif creates a release with this new target
|
||||||
build_flags =
|
build_flags =
|
||||||
${esp32s3_base.build_flags} -D HELTEC_WSL_V3 -I variants/heltec_wsl_v3
|
${esp32s3_base.build_flags} -D HELTEC_WSL_V3 -I variants/heltec_wsl_v3
|
||||||
|
-DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely.
|
@ -8,6 +8,8 @@
|
|||||||
#define VEXT_ENABLE Vext // active low, powers the oled display and the lora antenna boost
|
#define VEXT_ENABLE Vext // active low, powers the oled display and the lora antenna boost
|
||||||
#define BUTTON_PIN 0
|
#define BUTTON_PIN 0
|
||||||
|
|
||||||
|
#define PIN_GPS_EN 46 // GPS power enable pin
|
||||||
|
|
||||||
#define BATTERY_PIN 1 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
#define BATTERY_PIN 1 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
||||||
#define ADC_CHANNEL ADC1_GPIO1_CHANNEL
|
#define ADC_CHANNEL ADC1_GPIO1_CHANNEL
|
||||||
#define ADC_ATTENUATION ADC_ATTEN_DB_2_5 // lower dB for high resistance voltage divider
|
#define ADC_ATTENUATION ADC_ATTEN_DB_2_5 // lower dB for high resistance voltage divider
|
||||||
@ -30,4 +32,4 @@
|
|||||||
#define SX126X_DIO1 LORA_DIO1
|
#define SX126X_DIO1 LORA_DIO1
|
||||||
#define SX126X_BUSY LORA_DIO2
|
#define SX126X_BUSY LORA_DIO2
|
||||||
#define SX126X_RESET LORA_RESET
|
#define SX126X_RESET LORA_RESET
|
||||||
#define SX126X_E22
|
#define SX126X_E22
|
||||||
|
Loading…
Reference in New Issue
Block a user