From 5d06ce3a0518706822d681c3ae07a6411526fa1f Mon Sep 17 00:00:00 2001 From: richonguzman Date: Mon, 9 Dec 2024 15:29:11 -0300 Subject: [PATCH] testing heltec v2 tnc --- src/power_utils.cpp | 6 ++-- variants/heltec-lora32-v2_GPS/platformio.ini | 2 +- .../heltec-lora32-v2_GPS_915/platformio.ini | 2 +- variants/heltec-lora32-v2_TNC/board_pinout.h | 34 +++++++++++++++++++ variants/heltec-lora32-v2_TNC/platformio.ini | 9 +++++ 5 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 variants/heltec-lora32-v2_TNC/board_pinout.h create mode 100644 variants/heltec-lora32-v2_TNC/platformio.ini diff --git a/src/power_utils.cpp b/src/power_utils.cpp index b0dde67..b50b219 100644 --- a/src/power_utils.cpp +++ b/src/power_utils.cpp @@ -59,7 +59,7 @@ namespace POWER_Utils { #ifdef HELTEC_WIRELESS_TRACKER digitalWrite(ADC_CTRL, HIGH); #endif - #if defined(HELTEC_V3_GPS) || defined(HELTEC_V3_TNC)|| defined(HELTEC_V2_GPS) || defined(HELTEC_V2_GPS_915) || defined(HELTEC_WSL_V3_GPS_DISPLAY) + #if defined(HELTEC_V3_GPS) || defined(HELTEC_V3_TNC)|| defined(HELTEC_V2_GPS) || defined(HELTEC_V2_GPS_915) || defined(HELTEC_V2_TNC) || defined(HELTEC_WSL_V3_GPS_DISPLAY) digitalWrite(ADC_CTRL, LOW); #endif #endif @@ -68,7 +68,7 @@ namespace POWER_Utils { #ifdef HELTEC_WIRELESS_TRACKER digitalWrite(ADC_CTRL, LOW); #endif - #if defined(HELTEC_V3_GPS) || defined(HELTEC_V3_TNC) || defined(HELTEC_V2_GPS) || defined(HELTEC_V2_GPS_915) || defined(HELTEC_WSL_V3_GPS_DISPLAY) + #if defined(HELTEC_V3_GPS) || defined(HELTEC_V3_TNC) || defined(HELTEC_V2_GPS) || defined(HELTEC_V2_GPS_915) || defined(HELTEC_V2_TNC) || defined(HELTEC_WSL_V3_GPS_DISPLAY) digitalWrite(ADC_CTRL, HIGH); #endif batteryMeasurmentTime = millis(); @@ -84,7 +84,7 @@ 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) + #if defined(HELTEC_V2_GPS) || defined(HELTEC_V2_GPS_915) || defined(HELTEC_V2_TNC) 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 diff --git a/variants/heltec-lora32-v2_GPS/platformio.ini b/variants/heltec-lora32-v2_GPS/platformio.ini index 03fbd30..fdd7390 100644 --- a/variants/heltec-lora32-v2_GPS/platformio.ini +++ b/variants/heltec-lora32-v2_GPS/platformio.ini @@ -1,6 +1,6 @@ [env:heltec-lora32-v2_GPS] extends = env:esp32 -board = ttgo-lora32-v21 +board = heltec_wifi_lora_32_V2 build_flags = ${common.build_flags} -D HELTEC_V2_GPS diff --git a/variants/heltec-lora32-v2_GPS_915/platformio.ini b/variants/heltec-lora32-v2_GPS_915/platformio.ini index f9372d7..4e343b4 100644 --- a/variants/heltec-lora32-v2_GPS_915/platformio.ini +++ b/variants/heltec-lora32-v2_GPS_915/platformio.ini @@ -1,6 +1,6 @@ [env:heltec-lora32-v2_GPS_915] extends = env:esp32 -board = ttgo-lora32-v21 +board = heltec_wifi_lora_32_V2 build_flags = ${common.build_flags} -D HELTEC_V2_GPS_915 diff --git a/variants/heltec-lora32-v2_TNC/board_pinout.h b/variants/heltec-lora32-v2_TNC/board_pinout.h new file mode 100644 index 0000000..094b557 --- /dev/null +++ b/variants/heltec-lora32-v2_TNC/board_pinout.h @@ -0,0 +1,34 @@ +#ifndef BOARD_PINOUT_H_ +#define BOARD_PINOUT_H_ + + // LoRa Radio + #define HAS_SX1278 + #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 + + // Display + #undef OLED_SDA + #undef OLED_SCL + #undef OLED_RST + + #define OLED_SDA 4 + #define OLED_SCL 15 + #define OLED_RST 16 + + // GPS + #define HAS_NO_GPS + #define GPS_RX -1 + #define GPS_TX -1 + + // OTHER + #define BATTERY_PIN 37 + #define BUTTON_PIN 0 + #define ADC_CTRL 21 + + #define HAS_BT_CLASSIC + +#endif \ No newline at end of file diff --git a/variants/heltec-lora32-v2_TNC/platformio.ini b/variants/heltec-lora32-v2_TNC/platformio.ini new file mode 100644 index 0000000..1e19bdd --- /dev/null +++ b/variants/heltec-lora32-v2_TNC/platformio.ini @@ -0,0 +1,9 @@ +[env:heltec-lora32-v2_TNC] +extends = env:esp32 +board = heltec_wifi_lora_32_V2 +build_flags = + ${common.build_flags} + -D HELTEC_V2_TNC +lib_deps = + ${common.lib_deps} + ${common.display_libs} \ No newline at end of file