mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-09-01 02:21:46 +02:00
Handle NO_PIN for control and user_output pins
This commit is contained in:
@@ -10,21 +10,24 @@ void IRAM_ATTR ControlPin::handleISR() {
|
||||
}
|
||||
|
||||
void ControlPin::init() {
|
||||
if (_pin.defined()) {
|
||||
_pin.report(_legend);
|
||||
auto attr = Pin::Attr::Input | Pin::Attr::ISR;
|
||||
if (_pin.capabilities().has(Pins::PinCapabilities::PullUp)) {
|
||||
attr = attr | Pin::Attr::PullUp;
|
||||
}
|
||||
_pin.setAttr(attr);
|
||||
_pin.attachInterrupt<ControlPin, &ControlPin::handleISR>(this, CHANGE);
|
||||
if (_pin.undefined() || _pin.name() == "NO_PIN") {
|
||||
return;
|
||||
}
|
||||
_pin.report(_legend);
|
||||
auto attr = Pin::Attr::Input | Pin::Attr::ISR;
|
||||
if (_pin.capabilities().has(Pins::PinCapabilities::PullUp)) {
|
||||
attr = attr | Pin::Attr::PullUp;
|
||||
}
|
||||
_pin.setAttr(attr);
|
||||
_pin.attachInterrupt<ControlPin, &ControlPin::handleISR>(this, CHANGE);
|
||||
}
|
||||
|
||||
void ControlPin::report(char* status) {
|
||||
if (!_pin.undefined()) {
|
||||
addPinReport(status, _letter);
|
||||
if (_pin.undefined() || _pin.name() == "NO_PIN") {
|
||||
return;
|
||||
}
|
||||
|
||||
addPinReport(status, _letter);
|
||||
}
|
||||
|
||||
ControlPin::~ControlPin() {
|
||||
|
@@ -23,10 +23,9 @@
|
||||
|
||||
namespace UserOutput {
|
||||
DigitalOutput::DigitalOutput(uint8_t number, Pin& pin) : _number(number), _pin(pin) {
|
||||
if (_pin.undefined()) {
|
||||
if (_pin.undefined() || _pin.name() == "NO_PIN") {
|
||||
return;
|
||||
}
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
@@ -51,7 +50,7 @@ namespace UserOutput {
|
||||
// ==================================================================
|
||||
|
||||
AnalogOutput::AnalogOutput(uint8_t number, Pin& pin, float pwm_frequency) : _number(number), _pin(pin), _pwm_frequency(pwm_frequency) {
|
||||
if (pin.undefined()) {
|
||||
if (_pin.undefined() || _pin.name() == "NO_PIN") {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user