@@ -919,7 +919,7 @@ const DayTime Mount::HA() const {
919919 DayTime ha = _LST;
920920 // LOGV2(DEBUG_MOUNT_VERBOSE, F("Mount: LST: %s"), _LST.ToString());
921921 ha.subtractTime (DayTime (POLARIS_RA_HOUR, POLARIS_RA_MINUTE, POLARIS_RA_SECOND));
922- LOGV2 (DEBUG_MOUNT, F (" Mount: GetHA: LST-Polaris is HA %s" ), ha.ToString ());
922+ // LOGV2(DEBUG_MOUNT, F("Mount: GetHA: LST-Polaris is HA %s"), ha.ToString());
923923 return ha;
924924}
925925
@@ -1757,20 +1757,42 @@ void Mount::startSlewing(int direction) {
17571757 _driverRA->microsteps (SET_MICROSTEPPING);
17581758 #endif
17591759 #endif
1760- LOGV1 (DEBUG_STEPPERS, F ( " STEP-startSlewing: call moveTo() on stepper " ));
1760+
17611761 if (direction & NORTH) {
1762- _stepperDEC->moveTo (sign * 300000 );
1762+ long targetLocation = sign * 300000 ;
1763+ if (_decUpperLimit != 0 ) {
1764+ targetLocation = _decUpperLimit;
1765+ LOGV3 (DEBUG_STEPPERS, F (" STEP-startSlewing(N): DEC has upper limit of %l. targetMoveTo is now %l" ), _decUpperLimit, targetLocation);
1766+ }
1767+ else {
1768+ LOGV2 (DEBUG_STEPPERS, F (" STEP-startSlewing(N): initial targetMoveTo is %l" ), targetLocation);
1769+ }
1770+
1771+ _stepperDEC->moveTo (targetLocation);
17631772 _mountStatus |= STATUS_SLEWING;
17641773 }
1774+
17651775 if (direction & SOUTH) {
1766- _stepperDEC->moveTo (-sign * 300000 );
1776+ long targetLocation = -sign * 300000 ;
1777+ if (_decLowerLimit != 0 ) {
1778+ targetLocation = _decLowerLimit;
1779+ LOGV3 (DEBUG_STEPPERS, F (" STEP-startSlewing(S): DEC has lower limit of %l. targetMoveTo is now %l" ), _decLowerLimit, targetLocation);
1780+ }
1781+ else {
1782+ LOGV2 (DEBUG_STEPPERS, F (" STEP-startSlewing(S): initial targetMoveTo is %l" ), targetLocation);
1783+ }
1784+
1785+ _stepperDEC->moveTo (targetLocation);
17671786 _mountStatus |= STATUS_SLEWING;
17681787 }
1788+
17691789 if (direction & EAST) {
1790+ LOGV2 (DEBUG_STEPPERS, F (" STEP-startSlewing(E): initial targetMoveTo is %l" ), -sign * 300000 );
17701791 _stepperRA->moveTo (-sign * 300000 );
17711792 _mountStatus |= STATUS_SLEWING;
17721793 }
17731794 if (direction & WEST) {
1795+ LOGV2 (DEBUG_STEPPERS, F (" STEP-startSlewing(W): initial targetMoveTo is %l" ), sign * 300000 );
17741796 _stepperRA->moveTo (sign * 300000 );
17751797 _mountStatus |= STATUS_SLEWING;
17761798 }
@@ -1907,7 +1929,8 @@ void Mount::loop() {
19071929 interruptLoop ();
19081930 #endif
19091931
1910- #if DEBUG_LEVEL&DEBUG_MOUNT
1932+ #if DEBUG_LEVEL & (DEBUG_MOUNT && DEBUG_VERBOSE)
1933+ unsigned long now = millis ();
19111934 if (now - _lastMountPrint > 2000 ) {
19121935 Serial.println (getStatusString ());
19131936 _lastMountPrint = now;
@@ -1975,7 +1998,7 @@ void Mount::loop() {
19751998 _mountStatus &= ~(STATUS_SLEWING | STATUS_SLEWING_TO_TARGET);
19761999
19772000 if (_stepperWasRunning) {
1978- LOGV1 (DEBUG_MOUNT|DEBUG_STEPPERS,F (" Mount::Loop: Reached target." ));
2001+ LOGV3 (DEBUG_MOUNT|DEBUG_STEPPERS,F (" Mount::Loop: Reached target. RA:%l, DEC:%l " ), _stepperRA-> currentPosition (), _stepperDEC-> currentPosition ( ));
19792002 // Mount is at Target!
19802003 // If we we're parking, we just reached home. Clear the flag, reset the motors and stop tracking.
19812004 if (isParking ()) {
@@ -2129,6 +2152,16 @@ void Mount::clearDecLimitPosition(bool upper) {
21292152 }
21302153}
21312154
2155+ // ///////////////////////////////
2156+ //
2157+ // getDecLimitPositions
2158+ //
2159+ // ///////////////////////////////
2160+ void Mount::getDecLimitPositions (long & lowerLimit, long & upperLimit) {
2161+ lowerLimit = _decLowerLimit;
2162+ upperLimit = _decUpperLimit;
2163+ }
2164+
21322165// ///////////////////////////////
21332166//
21342167// setHome
@@ -2323,6 +2356,16 @@ void Mount::moveSteppersTo(float targetRA, float targetDEC) {
23232356 }
23242357
23252358 _stepperRA->moveTo (targetRA);
2359+
2360+ if (_decUpperLimit != 0 ) {
2361+ targetDEC = min (targetDEC, _decUpperLimit);
2362+ LOGV2 (DEBUG_MOUNT,F (" Mount::MoveSteppersTo: DEC Upper Limit enforced. To: %f" ), targetDEC);
2363+ }
2364+ if (_decLowerLimit != 0 ) {
2365+ targetDEC = max (targetDEC, _decLowerLimit);
2366+ LOGV2 (DEBUG_MOUNT,F (" Mount::MoveSteppersTo: DEC Lower Limit enforced. To: %f" ), targetDEC);
2367+ }
2368+
23262369 _stepperDEC->moveTo (targetDEC);
23272370}
23282371
0 commit comments