From 36ca41c3c0344d83711780710e84cc864e7abaa1 Mon Sep 17 00:00:00 2001 From: richonguzman Date: Tue, 26 Dec 2023 17:27:36 -0300 Subject: [PATCH] add Heltec V3 board --- src/LoRa_APRS_iGate.cpp | 2 ++ src/battery_utils.cpp | 5 +++++ src/pins_config.h | 5 +++++ src/utils.cpp | 12 ++++++++++++ 4 files changed, 24 insertions(+) diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index ce72cc6..098c7ca 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -47,7 +47,9 @@ String firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seven void setup() { Serial.begin(115200); + #ifndef HELTEC_V3 pinMode(batteryPin, INPUT); + #endif pinMode(greenLed, OUTPUT); if (Config.externalVoltageMeasurement) { pinMode(Config.externalVoltagePin, INPUT); diff --git a/src/battery_utils.cpp b/src/battery_utils.cpp index d28bb0e..2b4f780 100644 --- a/src/battery_utils.cpp +++ b/src/battery_utils.cpp @@ -19,7 +19,12 @@ namespace BATTERY_Utils { int sample; int sampleSum = 0; for (int i=0; i<100; i++) { + #if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2) sample = analogRead(batteryPin); + #endif + #ifdef HELTEC_V3 + sample = 0; + #endif sampleSum += sample; delayMicroseconds(50); } diff --git a/src/pins_config.h b/src/pins_config.h index f0e63ed..f0f4d0f 100644 --- a/src/pins_config.h +++ b/src/pins_config.h @@ -48,8 +48,13 @@ #endif // OTHERS +#if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2) #define greenLed 25 // Green Led #define batteryPin 35 +#endif +#ifdef HELTEC_V3 +#define greenLed 35 +#endif /* (Same pins for LILYGO LoRa32 and ESP32 Wroom Dev ) SX1278-------------------> ESP32 ttgo-lora32-v21 and ESP32 WROOM Dev diff --git a/src/utils.cpp b/src/utils.cpp index 7773fc9..1deea7c 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -113,9 +113,11 @@ namespace Utils { } else { beaconPacket = iGateBeaconPacket; } + #ifndef HELTEC_V3 if (Config.sendBatteryVoltage) { beaconPacket += " (Batt=" + String(BATTERY_Utils::checkBattery(),2) + "V)"; } + #endif if (Config.externalVoltageMeasurement) { beaconPacket += " (Ext V=" + String(BATTERY_Utils::checkExternalVoltage(),2) + "V)"; } @@ -126,9 +128,11 @@ namespace Utils { } sixthLine = ""; show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING iGate BEACON", 1000); + #ifndef HELTEC_V3 if (Config.sendBatteryVoltage) { sixthLine = " (Batt=" + String(BATTERY_Utils::checkBattery(),2) + "V)"; } + #endif if (Config.externalVoltageMeasurement) { sixthLine = " (Ext V=" + String(BATTERY_Utils::checkExternalVoltage(),2) + "V)"; } @@ -148,9 +152,11 @@ namespace Utils { fifthLine = ""; sixthLine = ""; show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING iGate BEACON", 0); + #ifndef HELTEC_V3 if (Config.sendBatteryVoltage) { sixthLine = " (Batt=" + String(BATTERY_Utils::checkBattery(),2) + "V)"; } + #endif if (Config.externalVoltageMeasurement) { sixthLine = " (Ext V=" + String(BATTERY_Utils::checkExternalVoltage(),2) + "V)"; } @@ -171,9 +177,11 @@ namespace Utils { APRS_IS_Utils::checkStatus(); thirdLine = getLocalIP(); show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING iGate BEACON", 1000); + #ifndef HELTEC_V3 if (Config.sendBatteryVoltage) { sixthLine = " (Batt=" + String(BATTERY_Utils::checkBattery(),2) + "V)"; } + #endif if (Config.externalVoltageMeasurement) { sixthLine = " (Ext V=" + String(BATTERY_Utils::checkExternalVoltage(),2) + "V)"; } @@ -182,9 +190,11 @@ namespace Utils { show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0); } else { show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING iGate BEACON", 0); + #ifndef HELTEC_V3 if (Config.sendBatteryVoltage) { sixthLine = " (Batt=" + String(BATTERY_Utils::checkBattery(),2) + "V)"; } + #endif if (Config.externalVoltageMeasurement) { sixthLine = " (Ext V=" + String(BATTERY_Utils::checkExternalVoltage(),2) + "V)"; } @@ -201,9 +211,11 @@ namespace Utils { sixthLine = ""; show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING iGate BEACON", 0); + #ifndef HELTEC_V3 if (Config.sendBatteryVoltage) { sixthLine = " (Batt=" + String(BATTERY_Utils::checkBattery(),2) + "V)"; } + #endif if (Config.externalVoltageMeasurement) { sixthLine = " (Ext V=" + String(BATTERY_Utils::checkExternalVoltage(),2) + "V)"; }