Skip to content
Snippets Groups Projects
Commit a00bd84c authored by Martino Facchin's avatar Martino Facchin Committed by Cristian Maglie
Browse files

Modify ICHARGE only if a battery is connected

parent f9c8150b
No related branches found
No related tags found
No related merge requests found
...@@ -216,7 +216,12 @@ static inline void disable_battery_charging() {} ...@@ -216,7 +216,12 @@ static inline void disable_battery_charging() {}
#endif #endif
void initVariant() { void initVariant() {
set_pmic_safe_defaults(); pinMode(32, INPUT_PULLDOWN);
if (analogRead(32) < 800) {
disable_battery_charging();
} else {
set_pmic_safe_defaults();
}
// Workaround for RTS not being controlled correctly // Workaround for RTS not being controlled correctly
pinMode(28, OUTPUT); pinMode(28, OUTPUT);
digitalWrite(28, LOW); digitalWrite(28, LOW);
...@@ -224,10 +229,6 @@ void initVariant() { ...@@ -224,10 +229,6 @@ void initVariant() {
digitalWrite(31, HIGH); digitalWrite(31, HIGH);
delay(100); delay(100);
digitalWrite(31, LOW); digitalWrite(31, LOW);
pinMode(32, INPUT_PULLDOWN);
if (analogRead(32) < 800) {
disable_battery_charging();
}
} }
// Serial1 // Serial1
......
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