diff --git a/src/battery_utils.cpp b/src/battery_utils.cpp index 9578453..940a5ea 100644 --- a/src/battery_utils.cpp +++ b/src/battery_utils.cpp @@ -24,11 +24,11 @@ namespace BATTERY_Utils { float checkBattery() { int sample; int sampleSum = 0; - #ifdef HELTEC_V3 + #ifdef ADC_CTRL digitalWrite(ADC_CTRL, LOW); #endif for (int i = 0; i < 100; i++) { - #if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) || defined(HELTEC_HTCT62) || defined(HELTEC_V3) || defined(ESP32_DIY_LoRa_A7670) || defined(TTGO_T_LORA32_V2_1_915) + #ifdef BATTERY_PIN sample = analogRead(BATTERY_PIN); #endif #if defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa) @@ -38,7 +38,7 @@ namespace BATTERY_Utils { delayMicroseconds(50); } - #ifdef HELTEC_V3 + #ifdef ADC_CTRL digitalWrite(ADC_CTRL, HIGH); 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. 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. diff --git a/src/pins_config.h b/src/pins_config.h index d3b4c7e..741cfb9 100644 --- a/src/pins_config.h +++ b/src/pins_config.h @@ -134,10 +134,7 @@ #define INTERNAL_LED_PIN 25 // Green Led #define BATTERY_PIN 35 #endif -#if defined(HELTEC_WS) -#define INTERNAL_LED_PIN 35 -#endif -#if defined(HELTEC_V3) +#if defined(HELTEC_V3) || defined(HELTEC_WS) #define INTERNAL_LED_PIN 35 #define BATTERY_PIN 1 #define VEXT_CTRL 36