heltec v2 gps add

This commit is contained in:
richonguzman 2024-07-25 17:38:15 -04:00
parent 9bf929822a
commit 1a5656b231
3 changed files with 51 additions and 3 deletions

View File

@ -464,4 +464,30 @@ lib_deps =
${common.lib_deps}
adafruit/Adafruit GFX Library @ 1.11.9
adafruit/Adafruit SSD1306 @ 2.5.10
adafruit/Adafruit SH110X @ 2.1.10
adafruit/Adafruit SH110X @ 2.1.10
[env:heltec-lora32-v2_GPS]
extends = env:esp32
board = ttgo-lora32-v21
build_flags =
-Werror -Wall
-DHELTEC_V2_GPS
-DHAS_SX1278
-DHAS_BT_CLASSIC
lib_deps =
${common.lib_deps}
adafruit/Adafruit GFX Library @ 1.11.9
adafruit/Adafruit SSD1306 @ 2.5.10
[env:heltec-lora32-v2_GPS_915]
extends = env:esp32
board = ttgo-lora32-v21
build_flags =
-Werror -Wall
-DHELTEC_V2_GPS_915
-DHAS_SX1276
-DHAS_BT_CLASSIC
lib_deps =
${common.lib_deps}
adafruit/Adafruit GFX Library @ 1.11.9
adafruit/Adafruit SSD1306 @ 2.5.10

View File

@ -241,4 +241,22 @@
#define RADIO_BUSY_PIN 2
#endif
#if defined(HELTEC_V2_GPS) || defined(HELTEC_V2_GPS_915)
#define OLED_SDA 4
#define OLED_SCL 15
#define OLED_RST 16
#define GPS_RX 12
#define GPS_TX 34
#define BATTERY_PIN 37
#define BUTTON_PIN 0
#define ADC_CTRL 21
#define RADIO_SCLK_PIN 5
#define RADIO_MISO_PIN 19
#define RADIO_MOSI_PIN 27
#define RADIO_CS_PIN 18
#define RADIO_RST_PIN 14
#define RADIO_BUSY_PIN 26
#endif
#endif

View File

@ -59,7 +59,7 @@ namespace POWER_Utils {
#ifdef HELTEC_WIRELESS_TRACKER
digitalWrite(ADC_CTRL, HIGH);
#endif
#ifdef HELTEC_V3_GPS
#if defined(HELTEC_V3_GPS) || defined(HELTEC_V2_GPS) || defined(HELTEC_V2_GPS_915)
digitalWrite(ADC_CTRL, LOW);
#endif
#endif
@ -68,7 +68,7 @@ namespace POWER_Utils {
#ifdef HELTEC_WIRELESS_TRACKER
digitalWrite(ADC_CTRL, LOW);
#endif
#ifdef HELTEC_V3_GPS
#if defined(HELTEC_V3_GPS) || defined(HELTEC_V2_GPS) || defined(HELTEC_V2_GPS_915)
digitalWrite(ADC_CTRL, HIGH);
#endif
batteryMeasurmentTime = millis();
@ -81,6 +81,10 @@ namespace POWER_Utils {
double inputDivider = (1.0 / (390.0 + 100.0)) * 100.0; // The voltage divider is a 390k + 100k resistor in series, 100k on the low side.
return (voltage / inputDivider) + 0.285; // Yes, this offset is excessive, but the ADC on the ESP32s3 is quite inaccurate and noisy. Adjust to own measurements.
#endif
#if defined(HELTEC_V2_GPS) || defined(HELTEC_V2_GPS_915)
double inputDivider = (1.0 / (220.0 + 100.0)) * 100.0; // The voltage divider is a 390k + 100k resistor in series, 100k on the low side.
return (voltage / inputDivider) + 0.285; // Yes, this offset is excessive, but the ADC on the ESP32s3 is quite inaccurate and noisy. Adjust to own measurements.
#endif
#else
return 0.0;
#endif