Merge pull request #2164 from Snayler/dev
Fix Heltec Wireless Paper battery reading
This commit is contained in:
@@ -11,6 +11,9 @@
|
|||||||
#ifndef PIN_ADC_CTRL // set in platformio.ini for Heltec Wireless Tracker (2)
|
#ifndef PIN_ADC_CTRL // set in platformio.ini for Heltec Wireless Tracker (2)
|
||||||
#define PIN_ADC_CTRL 37
|
#define PIN_ADC_CTRL 37
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef ADC_MULTIPLIER //default ADC multiplier
|
||||||
|
#define ADC_MULTIPLIER 5.42
|
||||||
|
#endif
|
||||||
#define PIN_ADC_CTRL_ACTIVE LOW
|
#define PIN_ADC_CTRL_ACTIVE LOW
|
||||||
#define PIN_ADC_CTRL_INACTIVE HIGH
|
#define PIN_ADC_CTRL_INACTIVE HIGH
|
||||||
|
|
||||||
@@ -88,7 +91,7 @@ public:
|
|||||||
|
|
||||||
digitalWrite(PIN_ADC_CTRL, !adc_active_state);
|
digitalWrite(PIN_ADC_CTRL, !adc_active_state);
|
||||||
|
|
||||||
return (5.42 * (3.3 / 1024.0) * raw) * 1000;
|
return (ADC_MULTIPLIER * (3.3 / 1024.0) * raw) * 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* getManufacturerName() const override {
|
const char* getManufacturerName() const override {
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ build_flags =
|
|||||||
;-D PIN_BOARD_SCL=18 ; same GPIO as P_LORA_TX_LED
|
;-D PIN_BOARD_SCL=18 ; same GPIO as P_LORA_TX_LED
|
||||||
-D PIN_USER_BTN=0
|
-D PIN_USER_BTN=0
|
||||||
-D PIN_VEXT_EN=45
|
-D PIN_VEXT_EN=45
|
||||||
|
-D ADC_MULTIPLIER=8.4
|
||||||
-D PIN_VBAT_READ=20
|
-D PIN_VBAT_READ=20
|
||||||
-D PIN_ADC_CTRL=19
|
-D PIN_ADC_CTRL=19
|
||||||
-D SX126X_DIO2_AS_RF_SWITCH=true
|
-D SX126X_DIO2_AS_RF_SWITCH=true
|
||||||
|
|||||||
Reference in New Issue
Block a user