diff --git a/Grbl_Esp32/src/Pins/GPIOPinDetail.cpp b/Grbl_Esp32/src/Pins/GPIOPinDetail.cpp index 9cebe6c9..ecf29c44 100644 --- a/Grbl_Esp32/src/Pins/GPIOPinDetail.cpp +++ b/Grbl_Esp32/src/Pins/GPIOPinDetail.cpp @@ -104,7 +104,8 @@ namespace Pins { // that were allocated by the constructor up to that point _MUST_ be freed! Otherwise, you // WILL get into trouble. - Assert(_capabilities != PinCapabilities::None, "Bad GPIO number"); + Assert(index < nGPIOPins, "Pin number is greater than max %d", nGPIOPins - 1); + Assert(_capabilities != PinCapabilities::None, "Unavailable GPIO"); Assert(!_claimed[index], "Pin is already used."); // User defined pin capabilities diff --git a/Grbl_Esp32/src/Pins/I2SOPinDetail.cpp b/Grbl_Esp32/src/Pins/I2SOPinDetail.cpp index 2433f40c..51cab9d1 100644 --- a/Grbl_Esp32/src/Pins/I2SOPinDetail.cpp +++ b/Grbl_Esp32/src/Pins/I2SOPinDetail.cpp @@ -30,6 +30,7 @@ namespace Pins { I2SOPinDetail::I2SOPinDetail(uint8_t index, const PinOptionsParser& options) : PinDetail(index), _capabilities(PinCapabilities::Output | PinCapabilities::I2S), _attributes(Pins::PinAttributes::Undefined), _readWriteMask(0) { + Assert(index < nI2SOPins, "Pin number is greater than max %d", nI2SOPins - 1); Assert(!_claimed[index], "Pin is already used."); // User defined pin capabilities for (auto opt : options) {