diff --git a/EXRAIL2.cpp b/EXRAIL2.cpp index 38fd394..f401eba 100644 --- a/EXRAIL2.cpp +++ b/EXRAIL2.cpp @@ -1145,7 +1145,7 @@ void RMFT2::kill(const FSH * reason, int operand) { int16_t RMFT2::getSignalSlot(int16_t id) { - if (id > 0) { + if (id >= 0) { int sigslot = 0; int16_t sighandle = 0; // Trundle down the signal list until we reach the end @@ -1155,14 +1155,14 @@ int16_t RMFT2::getSignalSlot(int16_t id) { // for a LED signal it will be same as redpin // but for a servo signal it will also have SERVO_SIGNAL_FLAG set. VPIN sigid = sighandle & SIGNAL_ID_MASK; - if (sigid == (VPIN)id) - return sigslot; // found it - sigslot++; // keep looking + if (sigid == (VPIN)id) // cast to keep compiler happy but id is positive + return sigslot; // found it + sigslot++; // keep looking }; } - // We did not find the signal + // If we got here, we did not find the signal DIAG(F("EXRAIL Signal %d not defined"), id); - return -1; + return -1; } /* static */ void RMFT2::doSignal(int16_t id,char rag) {