From 3831a6dcf64af5c249329e7d32df1615325537b3 Mon Sep 17 00:00:00 2001 From: peteGSX <97784652+peteGSX@users.noreply.github.com> Date: Tue, 20 Feb 2024 15:16:37 +1000 Subject: [PATCH] Tiny bit more --- IOFunctions.cpp | 8 ++++++++ TurntableFunctions.cpp | 10 +++++++++- defines.h | 4 ++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/IOFunctions.cpp b/IOFunctions.cpp index d54db3c..dcd5b09 100644 --- a/IOFunctions.cpp +++ b/IOFunctions.cpp @@ -218,6 +218,14 @@ void displayTTEXConfig() { Serial.println(F("EX-Turntable in TURNTABLE mode")); #endif +#if defined(ROTATE_FORWARD_ONLY) + Serial.println(F("Rotating in forward direction only")); +#elif defined(ROTATE_REVERSE_ONLY) + Serial.println(F("Rotating in reverse direction only")); +#else + Serial.println(F("Rotating/moving in the shortest direction")); +#endif + // If in sensor testing mode, display this, don't enable stepper or I2C if (sensorTesting) { Serial.println(F("SENSOR TESTING ENABLED, EX-Turntable operations disabled")); diff --git a/TurntableFunctions.cpp b/TurntableFunctions.cpp index 8f0d189..e7125d1 100644 --- a/TurntableFunctions.cpp +++ b/TurntableFunctions.cpp @@ -173,6 +173,13 @@ void moveToPosition(long steps, uint8_t phaseSwitch) { #if TURNTABLE_EX_MODE == TRAVERSER // If we're in traverser mode, very simple logic, negative move to limit, positive move to home. moveSteps = lastStep - steps; +#else +// In turntable mode we can force always moving forwards or reverse +#if defined(ROTATE_FORWARD_ONLY) + if (debug) Serial.println(F("Force forward move only")); + if () +#elif defined(ROTATE_REVERSE_ONLY) + #else if ((steps - lastStep) > halfTurnSteps) { moveSteps = steps - fullTurnSteps - lastStep; @@ -181,7 +188,8 @@ void moveToPosition(long steps, uint8_t phaseSwitch) { } else { moveSteps = steps - lastStep; } -#endif +#endif // Turntable forward/reverse/shortest distance +#endif // Turntable/traverser Serial.print(F(" - moving ")); Serial.print(moveSteps); Serial.println(F(" steps")); diff --git a/defines.h b/defines.h index 50757e6..242d47a 100644 --- a/defines.h +++ b/defines.h @@ -76,4 +76,8 @@ #error Both ROTATE_FORWARD_ONLY and ROTATE_REVERSE_ONLY defined, please only define one or the other #endif +#if (TURNTABLE_EX_MODE == TRAVERSER && defined(ROTATE_FORWARD_ONLY)) || (TURNTABLE_EX_MODE == TRAVERSER && defined(ROTATE_REVERSE_ONLY)) +#error Traverser mode cannot operate with ROTATE_FORWARD_ONLY or ROTATE_REVERSE_ONLY +#endif + #endif