Skip to content

Commit

Permalink
wireless paper battery reading fix
Browse files Browse the repository at this point in the history
  • Loading branch information
richonguzman committed Aug 19, 2024
1 parent 8863838 commit 9cc26cc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/battery_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,12 @@ namespace BATTERY_Utils {
#if defined(HELTEC_V3) || defined(HELTEC_V2) || defined(HELTEC_WSL_V3) || defined(HELTEC_WP)
digitalWrite(ADC_CTRL, HIGH);
#endif

#ifdef HELTEC_WP
double inputDivider = (1.0 / (10.0 + 10.0)) * 10.0; // The voltage divider is a 10k + 10k resistor in series
#else
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.
#endif
return (((sampleSum/100) * adcReadingTransformation) / inputDivider) + 0.285; // Yes, this offset is excessive, but the ADC on the ESP32s3 is quite inaccurate and noisy. Adjust to own measurements.
#else
#ifdef HAS_ADC_CALIBRATION
Expand Down

0 comments on commit 9cc26cc

Please sign in to comment.