mirror of
https://gitlab.dit.htwk-leipzig.de/phillip.kuehne/dezibot.git
synced 2025-07-04 17:51:41 +02:00
Fix "adc1 already in use!" log spam.
This commit is contained in:
@ -36,6 +36,10 @@ void PowerManager::begin() {
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize IO for battery voltage measurement
|
||||
pinMode(PowerParameters::PinConfig::BAT_ADC_EN, OUTPUT);
|
||||
pinMode(PowerParameters::PinConfig::BAT_ADC, INPUT);
|
||||
|
||||
if (powerScheduler == nullptr) {
|
||||
ESP_LOGI(TAG, "Creating Power Scheduler");
|
||||
powerScheduler = &PowerScheduler::getPowerScheduler(
|
||||
@ -111,8 +115,6 @@ float PowerManager::getConsumerCurrent(PowerParameters::PowerConsumers consumer)
|
||||
float PowerManager::getBatteryVoltage() {
|
||||
// Get the battery voltage from the ADC and convert it to a voltage
|
||||
// using the voltage divider.
|
||||
pinMode(PowerParameters::PinConfig::BAT_ADC_EN, OUTPUT);
|
||||
pinMode(PowerParameters::PinConfig::BAT_ADC, INPUT);
|
||||
// Enable voltage divider
|
||||
digitalWrite(PowerParameters::PinConfig::BAT_ADC_EN, HIGH);
|
||||
// Allow voltage to stabilize
|
||||
|
Reference in New Issue
Block a user