change analogcard init behavior

This commit is contained in:
Siwat Sirichai 2024-03-10 00:57:16 +07:00
parent 594ea6bf54
commit 196a87d47b
1 changed files with 8 additions and 7 deletions

View File

@ -133,37 +133,38 @@ uint16_t AnalogCard::analogRead(uint8_t pin)
*/
bool AnalogCard::begin()
{
bool success = true;
if (!this->dac0.begin())
{
ESP_LOGE("AnalogCard", "Card Analog ERROR: Failed to install DAC0");
return false;
success = false;
}
if (!this->dac1.begin())
{
ESP_LOGE("AnalogCard", "Card Analog ERROR: Failed to install DAC1");
return false;
success = false;
}
if (!this->dac2.begin())
{
ESP_LOGE("AnalogCard", "Card Analog ERROR: Failed to install DAC2");
return false;
success = false;
}
if (!this->dac3.begin())
{
ESP_LOGE("AnalogCard", "Card Analog ERROR: Failed to install DAC3");
return false;
success = false;
}
if (!this->analogInputBankA.begin())
{
ESP_LOGE("AnalogCard", "Card Analog ERROR: Failed to install analog input bank A");
return false;
success = false;
}
if (!this->analogInputBankB.begin())
{
ESP_LOGE("AnalogCard", "Card Analog ERROR: Failed to install analog input bank B");
return false;
success = false;
}
return true;
return success;
}
/**