From 99ab479b0b2c017ee8342a0191accac6e2e23dc8 Mon Sep 17 00:00:00 2001 From: PizzaProgram Date: Wed, 16 Apr 2025 19:19:49 +0200 Subject: [PATCH] Update ServoFirmata.h add `IS_PIN_SERVO(..)` to both `attach` and `detach` --- src/ServoFirmata.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ServoFirmata.h b/src/ServoFirmata.h index 592750e..eb37460 100644 --- a/src/ServoFirmata.h +++ b/src/ServoFirmata.h @@ -115,6 +115,7 @@ boolean ServoFirmata::handleSysex(byte command, byte argc, byte* argv) void ServoFirmata::attach(byte pin, int minPulse, int maxPulse) { + if (! IS_PIN_SERVO(pin)) {return;} Servo *servo = servos[PIN_TO_SERVO(pin)]; if (!servo) { servo = new Servo(); @@ -130,6 +131,7 @@ void ServoFirmata::attach(byte pin, int minPulse, int maxPulse) void ServoFirmata::detach(byte pin) { + if (! IS_PIN_SERVO(pin)) {return;} // Servo not available for this pin? if (PIN_TO_SERVO(pin) >= sizeof(servos) / sizeof(servos[0])) { return;