From 1fafc27b393c27c73065775853cb3b6511107797 Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Sat, 30 May 2026 16:57:27 +0300 Subject: [PATCH] Make it possible to unassign motor pin using -1 parameter value --- flix/motors.ino | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flix/motors.ino b/flix/motors.ino index b1a1206..1540ac4 100644 --- a/flix/motors.ino +++ b/flix/motors.ino @@ -20,6 +20,7 @@ void setupMotors() { print("Setup Motors\n"); // Configure pins for (int i = 0; i < 4; i++) { + if (motorPins[i] < 0) continue; // skip unassigned motors ledcAttach(motorPins[i], pwmFrequency, pwmResolution); pwmFrequency = ledcChangeFrequency(motorPins[i], pwmFrequency, pwmResolution); // when reconfiguring } @@ -29,6 +30,7 @@ void setupMotors() { void sendMotors() { for (int i = 0; i < 4; i++) { + if (motorPins[i] < 0) continue; // skip unassigned motors ledcWrite(motorPins[i], getDutyCycle(motors[i])); } }