@@ -441,8 +441,8 @@ void Mount::configureRAdriver(Stream *serial, float rsense, byte driveraddress,
441
441
_driverRA->blank_time (24 );
442
442
_driverRA->microsteps (RA_TRACKING_MICROSTEPPING == 1 ? 0 : RA_TRACKING_MICROSTEPPING); // System starts in tracking mode
443
443
_driverRA->fclktrim (4 );
444
- _driverRA->TCOOLTHRS (0xFFFFF ); // xFFFFF);
445
- _driverRA->semin (0 ); // disable CoolStep so that current is consistent
444
+ _driverRA->TCOOLTHRS (0xFFFFF ); // xFFFFF);
445
+ _driverRA->semin (0 ); // disable CoolStep so that current is consistent
446
446
_driverRA->SGTHRS (stallvalue);
447
447
if (UART_Rx_connected)
448
448
{
@@ -481,7 +481,7 @@ void Mount::configureRAdriver(uint16_t RA_SW_RX, uint16_t RA_SW_TX, float rsense
481
481
_driverRA->semin (0 ); // disable CoolStep so that current is consistent
482
482
_driverRA->microsteps (RA_TRACKING_MICROSTEPPING == 1 ? 0 : RA_TRACKING_MICROSTEPPING); // System starts in tracking mode
483
483
_driverRA->fclktrim (4 );
484
- _driverRA->TCOOLTHRS (0xFFFFF ); // xFFFFF);
484
+ _driverRA->TCOOLTHRS (0xFFFFF ); // xFFFFF);
485
485
_driverRA->SGTHRS (stallvalue);
486
486
if (UART_Rx_connected)
487
487
{
@@ -525,7 +525,7 @@ void Mount::configureDECdriver(Stream *serial, float rsense, byte driveraddress,
525
525
_driverDEC->microsteps (
526
526
DEC_GUIDE_MICROSTEPPING == 1 ? 0 : DEC_GUIDE_MICROSTEPPING); // If 1 then disable microstepping. Start with Guide microsteps.
527
527
_driverDEC->TCOOLTHRS (0xFFFFF );
528
- _driverDEC->semin (0 ); // disable CoolStep so that current is consistent
528
+ _driverDEC->semin (0 ); // disable CoolStep so that current is consistent
529
529
_driverDEC->SGTHRS (stallvalue);
530
530
if (UART_Rx_connected)
531
531
{
@@ -564,7 +564,7 @@ void Mount::configureDECdriver(uint16_t DEC_SW_RX, uint16_t DEC_SW_TX, float rse
564
564
_driverDEC->microsteps (
565
565
DEC_GUIDE_MICROSTEPPING == 1 ? 0 : DEC_GUIDE_MICROSTEPPING); // If 1 then disable microstepping. Start with Guide microsteps
566
566
_driverDEC->TCOOLTHRS (0xFFFFF );
567
- _driverDEC->semin (0 ); // disable CoolStep so that current is consistent
567
+ _driverDEC->semin (0 ); // disable CoolStep so that current is consistent
568
568
_driverDEC->SGTHRS (stallvalue);
569
569
if (UART_Rx_connected)
570
570
{
@@ -1199,6 +1199,7 @@ void Mount::setLST(const DayTime &lst)
1199
1199
// ///////////////////////////////
1200
1200
void Mount::setLatitude (Latitude latitude)
1201
1201
{
1202
+ LOG (DEBUG_GENERAL, " [MOUNT]: Setting longitude to %fs" , latitude.getTotalHours ());
1202
1203
_latitude = latitude;
1203
1204
configureHemisphere (_latitude.getTotalHours () > 0 );
1204
1205
EEPROMStore::storeLatitude (_latitude);
@@ -1211,6 +1212,7 @@ void Mount::setLatitude(Latitude latitude)
1211
1212
// ///////////////////////////////
1212
1213
void Mount::setLongitude (Longitude longitude)
1213
1214
{
1215
+ LOG (DEBUG_GENERAL, " [MOUNT]: Setting longitude to %fs" , longitude.getTotalHours ());
1214
1216
_longitude = longitude;
1215
1217
EEPROMStore::storeLongitude (_longitude);
1216
1218
@@ -1396,14 +1398,17 @@ void Mount::startSlewingToTarget()
1396
1398
1397
1399
if (targetRAPosition != _stepperRA->currentPosition ())
1398
1400
{
1399
- // Only stop tracking if we're actually going to slew somewhere else, otherwise the
1401
+ // Only stop tracking if we're tracking and actually going to slew somewhere else, otherwise the
1400
1402
// mount::loop() code won't detect the end of the slewing operation...
1401
- LOG (DEBUG_STEPPERS, " [MOUNT]: Stop tracking (NEMA steppers)" );
1402
- stopSlewing (TRACKING);
1403
- _trackerStoppedAt = millis ();
1404
- _compensateForTrackerOff = true ;
1403
+ if (isSlewingTRK ())
1404
+ {
1405
+ LOG (DEBUG_STEPPERS, " [MOUNT]: Stop tracking (NEMA steppers)" );
1406
+ stopSlewing (TRACKING);
1407
+ _trackerStoppedAt = millis ();
1408
+ _compensateForTrackerOff = true ;
1409
+ }
1405
1410
1406
- // set Slew microsteps for TMC2209 UART once the TRK stepper has stopped
1411
+ // Set RA to slew microsteps for TMC2209 UART once the TRK stepper has stopped
1407
1412
#if RA_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART
1408
1413
LOG (DEBUG_STEPPERS, " [STEPPERS]: startSlewingToTarget: Switching RA driver to microsteps(%d)" , RA_SLEW_MICROSTEPPING);
1409
1414
_driverRA->microsteps (RA_SLEW_MICROSTEPPING == 1 ? 0 : RA_SLEW_MICROSTEPPING);
@@ -1547,7 +1552,7 @@ void Mount::guidePulse(byte direction, int duration)
1547
1552
float decGuidingSpeed = _stepsPerDECDegree * (DEC_GUIDE_MICROSTEPPING / DEC_SLEW_MICROSTEPPING) * siderealDegreesInHour
1548
1553
/ 3600 .0f ; // u-steps/deg * deg/hr / sec/hr = u-steps/sec
1549
1554
float raGuidingSpeed = _stepsPerRADegree * (RA_TRACKING_MICROSTEPPING / RA_SLEW_MICROSTEPPING) * siderealDegreesInHour
1550
- / 3600 .0f ; // u-steps/deg * deg/hr / sec/hr = u-steps/sec
1555
+ / 3600 .0f ; // u-steps/deg * deg/hr / sec/hr = u-steps/sec
1551
1556
raGuidingSpeed *= _trackingSpeedCalibration;
1552
1557
1553
1558
// TODO: Do we need to track how many steps the steppers took and add them to the GoHome calculation?
@@ -2927,6 +2932,11 @@ void Mount::loop()
2927
2932
_targetRA = currentRA ();
2928
2933
if (isParking ())
2929
2934
{
2935
+ // Set DEC to Slew microstepping since it is set to guiding.
2936
+ #if DEC_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART
2937
+ LOG (DEBUG_STEPPERS, " [STEPPERS]: Loop: Parking. DEC driver setMicrosteps(%d)" , DEC_SLEW_MICROSTEPPING);
2938
+ _driverDEC->microsteps (DEC_SLEW_MICROSTEPPING == 1 ? 0 : DEC_SLEW_MICROSTEPPING);
2939
+ #endif
2930
2940
LOG (DEBUG_MOUNT | DEBUG_STEPPERS, " [MOUNT]: Loop: Was parking, so no tracking. Proceeding to park position..." );
2931
2941
_mountStatus &= ~STATUS_PARKING;
2932
2942
_slewingToPark = true ;
@@ -2957,6 +2967,11 @@ void Mount::loop()
2957
2967
startSlewing (TRACKING);
2958
2968
}
2959
2969
_slewingToHome = false ;
2970
+ // Reset DEC to guide microstepping so that guiding is always ready and no switch is neccessary on guide pulses.
2971
+ #if DEC_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART
2972
+ LOG (DEBUG_STEPPERS, " [STEPPERS]: Loop: Arrived at park. DEC driver setMicrosteps(%d)" , DEC_GUIDE_MICROSTEPPING);
2973
+ _driverDEC->microsteps (DEC_GUIDE_MICROSTEPPING == 1 ? 0 : DEC_GUIDE_MICROSTEPPING);
2974
+ #endif
2960
2975
}
2961
2976
else if (_slewingToPark)
2962
2977
{
@@ -3392,14 +3407,16 @@ void Mount::moveStepperBy(StepperAxis direction, long steps)
3392
3407
case RA_STEPS:
3393
3408
if (steps != 0 )
3394
3409
{
3395
- // Only stop tracking if we're actually going to slew somewhere else, otherwise the
3410
+ // Only stop tracking if we're actually tracking and going to slew somewhere else, otherwise the
3396
3411
// mount::loop() code won't detect the end of the slewing operation...
3397
- LOG (DEBUG_STEPPERS, " [STEPPERS]: moveStepperBy: Stop tracking (NEMA steppers)" );
3398
- stopSlewing (TRACKING);
3399
- _trackerStoppedAt = millis ();
3400
- _compensateForTrackerOff = true ;
3401
-
3402
- LOG (DEBUG_STEPPERS, " [STEPPERS]: moveStepperBy: TRK stopped at %lms" , _trackerStoppedAt);
3412
+ if (isSlewingTRK ())
3413
+ {
3414
+ LOG (DEBUG_STEPPERS, " [STEPPERS]: moveStepperBy: Stop tracking (NEMA steppers)" );
3415
+ stopSlewing (TRACKING);
3416
+ _trackerStoppedAt = millis ();
3417
+ _compensateForTrackerOff = true ;
3418
+ LOG (DEBUG_STEPPERS, " [STEPPERS]: moveStepperBy: TRK stopped at %lms" , _trackerStoppedAt);
3419
+ }
3403
3420
}
3404
3421
3405
3422
// set Slew microsteps for TMC2209 UART once the TRK stepper has stopped
0 commit comments