From a190abf2151890a5615e51100f26b5edba4a8a05 Mon Sep 17 00:00:00 2001 From: Mitch Bradley Date: Thu, 3 Jun 2021 09:17:07 -1000 Subject: [PATCH] Better messages for I2SO pins --- Grbl_Esp32/src/Pins/I2SOPinDetail.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Grbl_Esp32/src/Pins/I2SOPinDetail.cpp b/Grbl_Esp32/src/Pins/I2SOPinDetail.cpp index 80d1f257..0a2b4df1 100644 --- a/Grbl_Esp32/src/Pins/I2SOPinDetail.cpp +++ b/Grbl_Esp32/src/Pins/I2SOPinDetail.cpp @@ -35,7 +35,7 @@ namespace Pins { } else if (opt.is("high")) { // Default: Active HIGH. } else { - Assert(false, "Bad I2S option passed to pin %d: %s", int(index), opt()); + Assert(false, "Unsupported I2SO option '%s'", opt()); } } @@ -46,12 +46,11 @@ namespace Pins { PinCapabilities I2SOPinDetail::capabilities() const { return PinCapabilities::Output | PinCapabilities::I2S; } void I2SOPinDetail::write(int high) { - Assert(_attributes.has(PinAttributes::Output), "Pin has no output attribute defined. Cannot write to it."); int value = _readWriteMask ^ high; i2s_out_write(_index, value); // XXX Do we want to add i2s_out_delay() here ? // Doing so would eliminate the need to override - // switchCSpin() in TrnamicDriver.cpp + // switchCSpin() in TrinamicDriver.cpp i2s_out_delay(); } @@ -62,7 +61,8 @@ namespace Pins { void I2SOPinDetail::setAttr(PinAttributes value) { // Check the attributes first: - Assert(value.validateWith(this->_capabilities), "The requested attributes don't match the pin capabilities"); + Assert(!value.has(PinAttributes::Input), "I2SO pins cannot be used as input"); + Assert(value.validateWith(this->_capabilities), "Requested attributes do not match the I2SO pin capabilities"); Assert(!_attributes.conflictsWith(value), "Attributes on this pin have been set before, and there's a conflict."); _attributes = value;