@@ -1317,7 +1317,7 @@ void Mount::startSlewingToTarget()
1317
1317
}
1318
1318
1319
1319
_mountStatus |= STATUS_SLEWING | STATUS_SLEWING_TO_TARGET;
1320
- moveSteppersTo (targetRAPosition, targetDECPosition); // u-steps (in slew mode)
1320
+ moveSteppersTo (targetRAPosition, targetDECPosition, RA_AND_DEC_STEPS ); // u-steps (in slew mode)
1321
1321
_totalDECMove = 1 .0f * _stepperDEC->distanceToGo ();
1322
1322
_totalRAMove = 1 .0f * _stepperRA->distanceToGo ();
1323
1323
LOG (DEBUG_MOUNT, " [MOUNT]: RA Dist: %l, DEC Dist: %l" , _stepperRA->distanceToGo (), _stepperDEC->distanceToGo ());
@@ -1383,7 +1383,7 @@ void Mount::startSlewingToHome()
1383
1383
}
1384
1384
1385
1385
_mountStatus |= STATUS_SLEWING | STATUS_SLEWING_TO_TARGET;
1386
- moveSteppersTo (targetRAPosition, targetDECPosition); // u-steps (in slew mode)
1386
+ moveSteppersTo (targetRAPosition, targetDECPosition, RA_AND_DEC_STEPS ); // u-steps (in slew mode)
1387
1387
_totalDECMove = static_cast <float >(_stepperDEC->distanceToGo ());
1388
1388
_totalRAMove = static_cast <float >(_stepperRA->distanceToGo ());
1389
1389
LOG (DEBUG_MOUNT, " [MOUNT]: RA Dist: %l, DEC Dist: %l" , _stepperRA->distanceToGo (), _stepperDEC->distanceToGo ());
@@ -3229,45 +3229,51 @@ void Mount::calculateRAandDECSteppers(long &targetRASteps, long &targetDECSteps,
3229
3229
// moveSteppersTo
3230
3230
//
3231
3231
// ///////////////////////////////
3232
- void Mount::moveSteppersTo (float targetRASteps, float targetDECSteps)
3232
+ void Mount::moveSteppersTo (float targetRASteps, float targetDECSteps, StepperAxis direction )
3233
3233
{ // Units are u-steps (in slew mode)
3234
3234
// Show time: tell the steppers where to go!
3235
3235
_correctForBacklash = false ;
3236
3236
LOG (DEBUG_STEPPERS, " [STEPPERS]: MoveSteppersTo: RA From: %l To: %f" , _stepperRA->currentPosition (), targetRASteps);
3237
3237
LOG (DEBUG_STEPPERS, " [STEPPERS]: MoveSteppersTo: DEC From: %l To: %f" , _stepperDEC->currentPosition (), targetDECSteps);
3238
3238
3239
- if ((_backlashCorrectionSteps != 0 ) && ((_stepperRA-> currentPosition () - targetRASteps) > 0 ))
3239
+ if ((direction == RA_AND_DEC_STEPS) || (direction == RA_STEPS ))
3240
3240
{
3241
- LOG (DEBUG_STEPPERS, " [STEPPERS]: MoveSteppersTo: Needs backlash correction of %d!" , _backlashCorrectionSteps);
3242
- targetRASteps -= _backlashCorrectionSteps;
3243
- _correctForBacklash = true ;
3244
- }
3245
-
3246
- _stepperRA->moveTo (targetRASteps);
3247
-
3248
- if (_decUpperLimit != 0 )
3249
- {
3250
- #if DEBUG_LEVEL > 0
3251
- if (targetDECSteps > (float ) _decUpperLimit)
3241
+ if ((_backlashCorrectionSteps != 0 ) && ((_stepperRA->currentPosition () - targetRASteps) > 0 ))
3252
3242
{
3253
- LOG (DEBUG_STEPPERS, " [STEPPERS]: MoveSteppersTo: DEC Upper Limit enforced. To: %l" , _decUpperLimit);
3243
+ LOG (DEBUG_STEPPERS, " [STEPPERS]: MoveSteppersTo: Needs backlash correction of %d!" , _backlashCorrectionSteps);
3244
+ targetRASteps -= _backlashCorrectionSteps;
3245
+ _correctForBacklash = true ;
3254
3246
}
3255
- # endif
3256
- targetDECSteps = min (targetDECSteps, ( float ) _decUpperLimit );
3247
+
3248
+ _stepperRA-> moveTo (targetRASteps );
3257
3249
}
3258
3250
3259
- if (_decLowerLimit != 0 )
3251
+ if ((direction == RA_AND_DEC_STEPS) || (direction == DEC_STEPS) )
3260
3252
{
3261
- #if DEBUG_LEVEL > 0
3262
- if (targetDECSteps < (float ) _decLowerLimit)
3253
+ if (_decUpperLimit != 0 )
3263
3254
{
3264
- LOG (DEBUG_STEPPERS, " [STEPPERS]: MoveSteppersTo: DEC Lower Limit enforced. To: %l" , _decLowerLimit);
3255
+ #if DEBUG_LEVEL > 0
3256
+ if (targetDECSteps > (float ) _decUpperLimit)
3257
+ {
3258
+ LOG (DEBUG_STEPPERS, " [STEPPERS]: MoveSteppersTo: DEC Upper Limit enforced. To: %l" , _decUpperLimit);
3259
+ }
3260
+ #endif
3261
+ targetDECSteps = min (targetDECSteps, (float ) _decUpperLimit);
3265
3262
}
3263
+
3264
+ if (_decLowerLimit != 0 )
3265
+ {
3266
+ #if DEBUG_LEVEL > 0
3267
+ if (targetDECSteps < (float ) _decLowerLimit)
3268
+ {
3269
+ LOG (DEBUG_STEPPERS, " [STEPPERS]: MoveSteppersTo: DEC Lower Limit enforced. To: %l" , _decLowerLimit);
3270
+ }
3266
3271
#endif
3267
- targetDECSteps = max (targetDECSteps, (float ) _decLowerLimit);
3268
- }
3272
+ targetDECSteps = max (targetDECSteps, (float ) _decLowerLimit);
3273
+ }
3269
3274
3270
- _stepperDEC->moveTo (targetDECSteps);
3275
+ _stepperDEC->moveTo (targetDECSteps);
3276
+ }
3271
3277
}
3272
3278
3273
3279
// ///////////////////////////////
@@ -3278,12 +3284,14 @@ void Mount::moveSteppersTo(float targetRASteps, float targetDECSteps)
3278
3284
void Mount::moveStepperBy (StepperAxis direction, long steps)
3279
3285
{
3280
3286
LOG (DEBUG_STEPPERS, " [STEPPERS]: moveStepperBy: %l" , steps);
3287
+
3281
3288
switch (direction)
3282
3289
{
3290
+ case RA_AND_DEC_STEPS:
3291
+ LOG (DEBUG_STEPPERS, " [STEPPERS]: moveStepperBy: MoveStepperBy does not support multiple axes." );
3292
+ break ;
3293
+
3283
3294
case RA_STEPS:
3284
- moveSteppersTo (_stepperRA->targetPosition () + steps, _stepperDEC->targetPosition ());
3285
- _mountStatus |= STATUS_SLEWING | STATUS_SLEWING_TO_TARGET;
3286
- _totalRAMove = 1 .0f * _stepperRA->distanceToGo ();
3287
3295
if (steps != 0 )
3288
3296
{
3289
3297
// Only stop tracking if we're actually going to slew somewhere else, otherwise the
@@ -3301,43 +3309,53 @@ void Mount::moveStepperBy(StepperAxis direction, long steps)
3301
3309
LOG (DEBUG_STEPPERS, " [STEPPERS]: moveStepperBy: Switching RA driver to microsteps(%d)" , RA_SLEW_MICROSTEPPING);
3302
3310
_driverRA->microsteps (RA_SLEW_MICROSTEPPING == 1 ? 0 : RA_SLEW_MICROSTEPPING);
3303
3311
#endif
3304
- moveSteppersTo (_stepperRA->currentPosition () + steps, _stepperDEC-> currentPosition () );
3312
+ moveSteppersTo (_stepperRA->currentPosition () + steps, 0 , direction );
3305
3313
_mountStatus |= STATUS_SLEWING | STATUS_SLEWING_TO_TARGET;
3306
3314
_totalRAMove = 1 .0f * _stepperRA->distanceToGo ();
3307
3315
break ;
3308
3316
3309
3317
case DEC_STEPS:
3310
- moveSteppersTo (_stepperRA->currentPosition (), _stepperDEC->currentPosition () + steps);
3311
- _mountStatus |= STATUS_SLEWING | STATUS_SLEWING_TO_TARGET;
3312
- _totalDECMove = 1 .0f * _stepperDEC->distanceToGo ();
3318
+ {
3319
+ moveSteppersTo (0 , _stepperDEC->currentPosition () + steps, direction);
3320
+ _mountStatus |= STATUS_SLEWING | STATUS_SLEWING_TO_TARGET;
3321
+ _totalDECMove = 1 .0f * _stepperDEC->distanceToGo ();
3313
3322
3314
3323
#if DEC_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART
3315
- // Since normal state for DEC is guide microstepping, switch to slew microstepping here.
3316
- LOG (DEBUG_STEPPERS, " [STEPPERS]: moveStepperBy: Switching DEC driver to microsteps(%d)" , DEC_SLEW_MICROSTEPPING);
3317
- _driverDEC->microsteps (DEC_SLEW_MICROSTEPPING == 1 ? 0 : DEC_SLEW_MICROSTEPPING);
3324
+ // Since normal state for DEC is guide microstepping, switch to slew microstepping here.
3325
+ LOG (DEBUG_STEPPERS, " [STEPPERS]: moveStepperBy: Switching DEC driver to microsteps(%d)" , DEC_SLEW_MICROSTEPPING);
3326
+ _driverDEC->microsteps (DEC_SLEW_MICROSTEPPING == 1 ? 0 : DEC_SLEW_MICROSTEPPING);
3318
3327
#endif
3319
-
3328
+ }
3320
3329
break ;
3330
+
3321
3331
case FOCUS_STEPS:
3332
+ {
3322
3333
#if FOCUS_STEPPER_TYPE != STEPPER_TYPE_NONE
3323
- focusMoveBy (steps);
3334
+ focusMoveBy (steps);
3324
3335
#endif
3336
+ }
3325
3337
break ;
3338
+
3326
3339
case AZIMUTH_STEPS:
3340
+ {
3327
3341
#if AZ_STEPPER_TYPE != STEPPER_TYPE_NONE
3328
- enableAzAltMotors ();
3329
- LOG (DEBUG_STEPPERS,
3330
- " [STEPPERS]: moveStepperBy: AZ from %l to %l" ,
3331
- _stepperAZ->currentPosition (),
3332
- _stepperAZ->currentPosition () + steps);
3333
- _stepperAZ->moveTo (_stepperAZ->currentPosition () + steps);
3342
+ enableAzAltMotors ();
3343
+ LOG (DEBUG_STEPPERS,
3344
+ " [STEPPERS]: moveStepperBy: AZ from %l to %l" ,
3345
+ _stepperAZ->currentPosition (),
3346
+ _stepperAZ->currentPosition () + steps);
3347
+ _stepperAZ->moveTo (_stepperAZ->currentPosition () + steps);
3334
3348
#endif
3349
+ }
3335
3350
break ;
3351
+
3336
3352
case ALTITUDE_STEPS:
3353
+ {
3337
3354
#if ALT_STEPPER_TYPE != STEPPER_TYPE_NONE
3338
- enableAzAltMotors ();
3339
- _stepperALT->moveTo (_stepperALT->currentPosition () + steps);
3355
+ enableAzAltMotors ();
3356
+ _stepperALT->moveTo (_stepperALT->currentPosition () + steps);
3340
3357
#endif
3358
+ }
3341
3359
break ;
3342
3360
}
3343
3361
}
0 commit comments