Use common power amp definition for Heltec v4 and Heltec Tracker v2

This commit is contained in:
Tom Fifield
2025-09-30 08:30:18 +10:00
parent 8d323a1cf1
commit 0f6131d2c8
5 changed files with 10 additions and 9 deletions

View File

@@ -117,7 +117,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define SX126X_MAX_POWER 22
#endif
#ifdef HELTEC_V4
#ifdef USE_GC1109_PA
// Power Amps are often non-linear, so we can use an array of values for the power curve
#define NUM_PA_POINTS 22
#define TX_GAIN_LORA 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 10, 9, 9, 8, 7

View File

@@ -52,7 +52,7 @@ template <typename T> bool SX126xInterface<T>::init()
pinMode(SX126X_POWER_EN, OUTPUT);
#endif
#if defined(HELTEC_V4)||defined(HELTEC_WIRELESS_TRACKER_V2)
#if defined(USE_GC1109_PA)
pinMode(LORA_PA_POWER, OUTPUT);
digitalWrite(LORA_PA_POWER, HIGH);
@@ -352,7 +352,7 @@ template <typename T> bool SX126xInterface<T>::sleep()
digitalWrite(SX126X_POWER_EN, LOW);
#endif
#if defined(HELTEC_V4)||defined(HELTEC_WIRELESS_TRACKER_V2)
#if defined(USE_GC1109_PA)
/*
* Do not switch the power on and off frequently.
* After turning off LORA_PA_EN, the power consumption has dropped to the uA level.
@@ -367,7 +367,7 @@ template <typename T> bool SX126xInterface<T>::sleep()
/** Some boards require GPIO control of tx vs rx paths */
template <typename T> void SX126xInterface<T>::setTransmitEnable(bool txon)
{
#if defined(HELTEC_V4)||defined(HELTEC_WIRELESS_TRACKER_V2)
#if defined(USE_GC1109_PA)
digitalWrite(LORA_PA_POWER, HIGH);
digitalWrite(LORA_PA_EN, HIGH);
digitalWrite(LORA_PA_TX_EN, txon ? 1 : 0);

View File

@@ -554,7 +554,7 @@ void enableLoraInterrupt()
gpio_pullup_en((gpio_num_t)LORA_CS);
#endif
#if defined(HELTEC_V4)||defined(HELTEC_WIRELESS_TRACKER_V2)
#if defined(USE_GC1109_PA)
gpio_pullup_en((gpio_num_t)LORA_PA_POWER);
gpio_pullup_en((gpio_num_t)LORA_PA_EN);
gpio_pulldown_en((gpio_num_t)LORA_PA_TX_EN);

View File

@@ -37,6 +37,7 @@
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
#define USE_GC1109_PA // We have a GC1109 power amplifier+attenuator
#define LORA_PA_POWER 7 // power en
#define LORA_PA_EN 2
#define LORA_PA_TX_EN 46 // enable tx

View File

@@ -28,7 +28,6 @@
#define SCREEN_TRANSITION_FRAMERATE 3 // fps
#define DISPLAY_FORCE_SMALL_FONTS
#define VEXT_ENABLE 3 // active HIGH - powers the GPS, GPS LNA and OLED
#define VEXT_ON_VALUE HIGH
#define BUTTON_PIN 0
@@ -73,6 +72,7 @@
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
#define USE_GC1109_PA // We have a GC1109 power amplifier+attenuator
#define LORA_PA_POWER 7 // power en
#define LORA_PA_EN 4
#define LORA_PA_TX_EN 46 // enable tx