Skip to content

[Bug]: #8160 breaks TX_POWER_GAIN feature for heltec-v4 and heltec-wireless-tracker-v2 #8276

@ndoo

Description

@ndoo

Category

Hardware Compatibility

Hardware

Other

Is this bug report about any UI component firmware like InkHUD or Meshtatic UI (MUI)?

  • Meshtastic UI aka MUI colorTFT
  • InkHUD ePaper
  • OLED slide UI on any display

Firmware Version

2.7.12.x

Description

#8160

In configuration.h, #ifdef HELTEC_V4 is changed to #ifdef USE_GC1109_PA to control definition of #define NUM_PA_POINTS and #define TX_GAIN_LORA.

The corresponding change in the heltec-v4 variant is to add #define USE_GC1109_PA in variant.h and likewise for heltec-wireless-tracker-v2 variant.

Generally, this gets picked up everywhere #ifdef USE_GC1109_PA or #elif defined(USE_GC1109_PA) etc. is used, except one particular file, configuration.h itself.

I suspect this is because the order in which PlatformIO includes files is such that variant.h is not included when processing configuration.h. The result is that TX_GAIN_LORA calculation is never performed for heltec-v4 and heltec-wireless-tracker-v2.

Relevant log output

Boot log (I raised MY_919 max power to 127 for testing purposes):

INFO  | ??:??:?? 4 Start meshradio init
INFO  | ??:??:?? 4 Radio freq=922.875, config.lora.frequency_offset=0.000
INFO  | ??:??:?? 4 Set radio: region=MY_919, name=LongFast, config=0, ch=15, power=127
INFO  | ??:??:?? 4 myRegion->freqStart -> myRegion->freqEnd: 919.000000 -> 924.000000 (5.000000 MHz)
INFO  | ??:??:?? 4 numChannels: 20 x 250.000kHz
INFO  | ??:??:?? 4 channel_num: 16
INFO  | ??:??:?? 4 frequency: 922.875000
INFO  | ??:??:?? 4 Slot time: 28 msec
INFO  | ??:??:?? 4 Final Tx power: 22 dBm
INFO  | ??:??:?? 4 SX126x init result 0
INFO  | ??:??:?? 4 Frequency set to 922.875000
INFO  | ??:??:?? 4 Bandwidth set to 250.000000
INFO  | ??:??:?? 4 Power output set to 22

Adding -D USE_GC1109_PA in platformio.ini for heltec-v4 throws a lot of warnings due to re-definition in most files, but crucially, USE_GC1109_PA is now defined when processing configuration.h and so TX_GAIN_LORA is now calculated, here is the bootlog with my hackish test by adding that line:

INFO  | ??:??:?? 2 Start meshradio init
INFO  | ??:??:?? 2 Radio freq=922.875, config.lora.frequency_offset=0.000
INFO  | ??:??:?? 2 Set radio: region=MY_919, name=LongFast, config=0, ch=15, power=127
INFO  | ??:??:?? 2 myRegion->freqStart -> myRegion->freqEnd: 919.000000 -> 924.000000 (5.000000 MHz)
INFO  | ??:??:?? 3 numChannels: 20 x 250.000kHz
INFO  | ??:??:?? 3 channel_num: 16
INFO  | ??:??:?? 3 frequency: 922.875000
INFO  | ??:??:?? 3 Slot time: 28 msec
INFO  | ??:??:?? 3 Requested Tx power: 127 dBm; Device LoRa Tx gain: 7 dB
INFO  | ??:??:?? 3 Final Tx power: 22 dBm
INFO  | ??:??:?? 3 SX126x init result 0
INFO  | ??:??:?? 3 Frequency set to 922.875000
INFO  | ??:??:?? 3 Bandwidth set to 250.000000
INFO  | ??:??:?? 3 Power output set to 22

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions