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:
parent
f00371ca56
commit
98694ab81a
1 changed files with 1 additions and 1 deletions
|
|
@ -15,7 +15,6 @@ float getBatteryCapacity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getChargingState() {
|
bool getChargingState() {
|
||||||
pinMode(CHG, INPUT_PULLUP);
|
|
||||||
return !digitalRead(CHG);
|
return !digitalRead(CHG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -33,6 +32,7 @@ void ARDUINO_ISR_ATTR chargeIsr() {
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void initVariant(void){
|
extern "C" void initVariant(void){
|
||||||
|
pinMode(CHG, INPUT_PULLUP);
|
||||||
attachInterrupt(CHG, chargeIsr, CHANGE);
|
attachInterrupt(CHG, chargeIsr, CHANGE);
|
||||||
analogReadResolution(12);
|
analogReadResolution(12);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue