@@ -142,6 +142,11 @@ bool Turntable::setPosition(uint16_t id, uint8_t position, uint8_t activity) {
142142 Turntable *tto = Turntable::get (id);
143143 if (!tto) return false ;
144144 if (tto->isMoving ()) return false ;
145+
146+ if (activity == EXTurntable::ActivityNumber::Reverse){
147+ // A 180-degree turn keeps the same logical track position.
148+ position = tto->getPosition ();
149+ }
145150 bool ok = tto->setPositionInternal (position, activity);
146151
147152 if (ok) {
@@ -152,7 +157,7 @@ bool Turntable::setPosition(uint16_t id, uint8_t position, uint8_t activity) {
152157 // Trigger EXRAIL rotateEvent for both types here if changed
153158#if defined(EXRAIL_ACTIVE)
154159 bool rotated = false ;
155- if (position != tto->_previousPosition ) rotated = true ;
160+ if (position != tto->_previousPosition || activity == EXTurntable::ActivityNumber::Reverse ) rotated = true ;
156161 RMFT2::rotateEvent (id, rotated);
157162#endif
158163 }
@@ -204,12 +209,19 @@ using DevState = IODevice::DeviceStateEnum;
204209 bool EXTTTurntable::setPositionInternal (uint8_t position, uint8_t activity) {
205210#ifndef IO_NO_HAL
206211 int16_t value;
207- if (position == 0 ) {
208- value = 0 ; // Position 0 is just to send activities
209- } else {
210- if (activity > 1 ) return false ; // If sending a position update, only phase changes valid (0|1)
212+ if (activity == EXTurntable::ActivityNumber::Reverse) {
213+ // Keep logical position unchanged while issuing the 180 action.
214+ position = _turntableData.position ;
211215 value = getPositionValue (position); // Get position value from position list
216+ }else {
217+ if (position == 0 ) {
218+ value = 0 ; // Position 0 is just to send activities
219+ } else {
220+ if (activity > EXTurntable::ActivityNumber::Turn_PInvert) return false ; // If sending a position update, only phase changes valid (0|1)
221+ value = getPositionValue (position); // Get position value from position list
222+ }
212223 }
224+
213225 if (position > 0 && !value) return false ; // Return false if it's not a valid position
214226 // Set position via device driver
215227 _previousPosition = _turntableData.position ;
0 commit comments