Skip to content
Snippets Groups Projects
Commit a91df58c authored by agdl's avatar agdl Committed by Cristian Maglie
Browse files

Fixed ADC battery discharge

INPUT_PULDOWN was not suitable to completely discharge the input capacitor on ADC_BATTERY.
Switching to OUTPUT, LOW discharge it faster then try to read
parent 6d085671
No related branches found
No related tags found
No related merge requests found
......@@ -199,7 +199,11 @@ static inline void disable_battery_charging() {}
#endif
void initVariant() {
pinMode(ADC_BATTERY, INPUT_PULLDOWN);
pinMode(ADC_BATTERY, OUTPUT);
digitalWrite(ADC_BATTERY, LOW);
delay(1);
pinMode(ADC_BATTERY, INPUT);
delay(1);
if (analogRead(ADC_BATTERY) > 100) {
enable_battery_charging();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment