mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-09-01 18:32:37 +02:00
Better - but not perfect - pin number error checking
This commit is contained in:
@@ -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
|
||||
|
@@ -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) {
|
||||
|
Reference in New Issue
Block a user