fix rebooting while reading charge state (#7307)

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
This commit is contained in:
TAMC 2022-10-26 15:51:12 +08:00 committed by GitHub
parent f00371ca56
commit 98694ab81a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,7 +15,6 @@ float getBatteryCapacity() {
}
bool getChargingState() {
pinMode(CHG, INPUT_PULLUP);
return !digitalRead(CHG);
}
@ -33,6 +32,7 @@ void ARDUINO_ISR_ATTR chargeIsr() {
}
extern "C" void initVariant(void){
pinMode(CHG, INPUT_PULLUP);
attachInterrupt(CHG, chargeIsr, CHANGE);
analogReadResolution(12);
}