1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-30 03:26:13 +01:00

check ADCee::init() return value

This commit is contained in:
Harald Barth 2023-06-18 09:48:15 +02:00
parent 277825c530
commit cade89ba16

View File

@ -108,8 +108,13 @@ MotorDriver::MotorDriver(int16_t power_pin, byte signal_pin, byte signal_pin2, i
} }
currentPin=current_pin; currentPin=current_pin;
if (currentPin!=UNUSED_PIN) if (currentPin!=UNUSED_PIN) {
ADCee::init(currentPin); int ret = ADCee::init(currentPin);
if (ret < -1010) { // XXX give value a name later
DIAG(F("ADCee::init error %d, disable current pin %d"), ret, currentPin);
currentPin = UNUSED_PIN;
}
}
senseOffset=0; // value can not be obtained until waveform is activated senseOffset=0; // value can not be obtained until waveform is activated
if (fault_pin != UNUSED_PIN) { if (fault_pin != UNUSED_PIN) {