Skip to content

Commit

Permalink
2.5dB could be a more appropriate attenuation for heltec ADCs (#2511)
Browse files Browse the repository at this point in the history
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
  • Loading branch information
code8buster and thebentern committed May 26, 2023
1 parent f3af3c1 commit 7475c86
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Power.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ RTC_NOINIT_ATTR uint64_t RTC_reg_b;
#endif // BAT_MEASURE_ADC_UNIT

esp_adc_cal_characteristics_t *adc_characs = (esp_adc_cal_characteristics_t *)calloc(1, sizeof(esp_adc_cal_characteristics_t));

#ifndef ADC_ATTENUATION
static const adc_atten_t atten = ADC_ATTEN_DB_11;
#else
static const adc_atten_t atten = ADC_ATTENUATION;
#endif
#endif // BATTERY_PIN && ARCH_ESP32

#ifdef HAS_PMU
Expand Down
1 change: 1 addition & 0 deletions variants/heltec_v3/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#define BATTERY_PIN 1 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
#define ADC_CHANNEL ADC1_GPIO1_CHANNEL
#define ADC_ATTENUATION ADC_ATTEN_DB_2_5 // lower dB for high resistance voltage divider
#define ADC_MULTIPLIER 4.9

#define USE_SX1262
Expand Down
1 change: 1 addition & 0 deletions variants/heltec_wsl_v3/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#define BATTERY_PIN 1 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
#define ADC_CHANNEL ADC1_GPIO1_CHANNEL
#define ADC_ATTENUATION ADC_ATTEN_DB_2_5 // lower dB for high resistance voltage divider
#define ADC_MULTIPLIER 4.9

#define USE_SX1262
Expand Down

0 comments on commit 7475c86

Please sign in to comment.