mirror of
https://github.com/okalachev/flix.git
synced 2026-06-28 05:56:44 +00:00
Make it possible to unassign motor pin using -1 parameter value
This commit is contained in:
@@ -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]));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user