@@ -343,6 +343,7 @@ void Mount::configureDECStepper(byte pin1, byte pin2, uint32_t maxSpeed, uint32_
343343 _stepperDEC->setPinsInverted (true , false , false );
344344 _stepperGUIDE->setPinsInverted (true , false , false );
345345#endif
346+ _stepperGUIDE->setCurrentPosition (0 );
346347}
347348
348349// ///////////////////////////////
@@ -1540,14 +1541,17 @@ void Mount::stopGuiding(bool ra, bool dec)
15401541 // Stop RA guide first, since it's just a speed change back to tracking speed
15411542 if (ra && (_mountStatus & STATUS_GUIDE_PULSE_RA))
15421543 {
1543- LOG (DEBUG_STEPPERS, " [STEPPERS]: stopGuiding(RA): TRK.setSpeed(%f)" , _trackingSpeed);
1544+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE,
1545+ " [GUIDE]: stopGuide: RA set speed : %f (at %l)" ,
1546+ _trackingSpeed,
1547+ _stepperTRK->currentPosition ());
15441548 _stepperTRK->setSpeed (_trackingSpeed);
15451549 _mountStatus &= ~STATUS_GUIDE_PULSE_RA;
15461550 }
15471551
15481552 if (dec && (_mountStatus & STATUS_GUIDE_PULSE_DEC))
15491553 {
1550- LOG (DEBUG_STEPPERS, " [STEPPERS ]: stopGuiding(DEC): Stop motor " );
1554+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE , " [GUIDE ]: stopGuide: DEC stop guide at : %l " , _stepperGUIDE-> currentPosition () );
15511555
15521556 // Stop DEC guiding and wait for it to stop.
15531557 _stepperGUIDE->stop ();
@@ -1558,16 +1562,20 @@ void Mount::stopGuiding(bool ra, bool dec)
15581562 _stepperTRK->runSpeed ();
15591563 }
15601564
1561- LOG (DEBUG_STEPPERS, " [STEPPERS]: stopGuiding(DEC): GuideStepper stopped at %l" , _stepperGUIDE->currentPosition ());
1562-
1565+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: stopGuide: DEC stopped at : %l" , _stepperGUIDE->currentPosition ());
15631566 _mountStatus &= ~STATUS_GUIDE_PULSE_DEC;
15641567 }
15651568
15661569 // disable pulse state if no direction is active
15671570 if ((_mountStatus & STATUS_GUIDE_PULSE_DIR) == 0 )
15681571 {
1572+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: Clear guiding state" );
15691573 _mountStatus &= ~STATUS_GUIDE_PULSE_MASK;
15701574 }
1575+ else
1576+ {
1577+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: One axis still guiding" );
1578+ }
15711579}
15721580
15731581// ///////////////////////////////
@@ -1577,7 +1585,26 @@ void Mount::stopGuiding(bool ra, bool dec)
15771585// ///////////////////////////////
15781586void Mount::guidePulse (byte direction, int duration)
15791587{
1580- LOG (DEBUG_STEPPERS, " [STEPPERS]: guidePulse: > Guide Pulse %d for %dms" , direction, duration);
1588+ #if (DEBUG_LEVEL & (DEBUG_STEPPERS | DEBUG_GUIDE))
1589+ const char *directionName = " -NE-S---W" ;
1590+ #endif
1591+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: > Guide Pulse %c for %dms" , directionName[direction], duration);
1592+ if ((direction == NORTH) || (direction == SOUTH))
1593+ {
1594+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: DEC current steps : %l" , _stepperGUIDE->currentPosition ());
1595+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: DEC steps/deg : %f" , _stepsPerDECDegree);
1596+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE,
1597+ " [GUIDE]: guidePulse: DEC Microstep ratio : %f" ,
1598+ (DEC_GUIDE_MICROSTEPPING / DEC_SLEW_MICROSTEPPING));
1599+ }
1600+ else
1601+ {
1602+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: RA current steps : %l" , _stepperTRK->currentPosition ());
1603+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: RA steps/deg : %f" , _stepsPerRADegree);
1604+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE,
1605+ " [GUIDE]: guidePulse: RA Microstep ratio : %f" ,
1606+ (RA_TRACKING_MICROSTEPPING / RA_SLEW_MICROSTEPPING));
1607+ }
15811608
15821609 // DEC stepper moves at sidereal rate in both directions
15831610 // RA stepper moves at either 2.5x sidereal rate or 0.5x sidereal rate.
@@ -1586,7 +1613,6 @@ void Mount::guidePulse(byte direction, int duration)
15861613 / 3600 .0f ; // u-steps/deg * deg/hr / sec/hr = u-steps/sec
15871614 float raGuidingSpeed = _stepsPerRADegree * (RA_TRACKING_MICROSTEPPING / RA_SLEW_MICROSTEPPING) * siderealDegreesInHour
15881615 / 3600 .0f ; // u-steps/deg * deg/hr / sec/hr = u-steps/sec
1589- raGuidingSpeed *= _trackingSpeedCalibration;
15901616
15911617 // TODO: Do we need to track how many steps the steppers took and add them to the GoHome calculation?
15921618 // If so, we need to remember where we were when we started the guide pulse. Then at the end,
@@ -1596,30 +1622,46 @@ void Mount::guidePulse(byte direction, int duration)
15961622 switch (direction)
15971623 {
15981624 case NORTH:
1599- LOG (DEBUG_STEPPERS, " [STEPPERS]: guidePulse: DEC.setSpeed(%f)" , DEC_PULSE_MULTIPLIER * decGuidingSpeed);
1625+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: DEC base speed : %f" , decGuidingSpeed);
1626+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: DEC guide speed : %f" , DEC_PULSE_MULTIPLIER * decGuidingSpeed);
16001627 _stepperGUIDE->setSpeed (DEC_PULSE_MULTIPLIER * decGuidingSpeed);
16011628 _mountStatus |= STATUS_GUIDE_PULSE | STATUS_GUIDE_PULSE_DEC;
16021629 _guideDecEndTime = millis () + duration;
16031630 break ;
16041631
16051632 case SOUTH:
1606- LOG (DEBUG_STEPPERS, " [STEPPERS]: guidePulse: DEC.setSpeed(%f)" , -DEC_PULSE_MULTIPLIER * decGuidingSpeed);
1633+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: DEC base speed : %f" , decGuidingSpeed);
1634+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: DEC guide speed : %f" , -DEC_PULSE_MULTIPLIER * decGuidingSpeed);
16071635 _stepperGUIDE->setSpeed (-DEC_PULSE_MULTIPLIER * decGuidingSpeed);
16081636 _mountStatus |= STATUS_GUIDE_PULSE | STATUS_GUIDE_PULSE_DEC;
16091637 _guideDecEndTime = millis () + duration;
16101638 break ;
16111639
16121640 case WEST:
16131641 // We were in tracking mode before guiding, so no need to update microstepping mode on RA driver
1614- LOG (DEBUG_STEPPERS, " [STEPPERS]: guidePulse: TRK.setSpeed(%f)" , (RA_PULSE_MULTIPLIER * raGuidingSpeed));
1642+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: RA base speed : %f" , raGuidingSpeed);
1643+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: RA speed factor : %f" , _trackingSpeedCalibration);
1644+ raGuidingSpeed *= _trackingSpeedCalibration;
1645+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: RA adjusted speed : %f" , raGuidingSpeed);
1646+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE,
1647+ " [GUIDE]: guidePulse: RA guide speed : %f (%f x adjusted speed)" ,
1648+ (RA_PULSE_MULTIPLIER * raGuidingSpeed),
1649+ RA_PULSE_MULTIPLIER);
16151650 _stepperTRK->setSpeed (RA_PULSE_MULTIPLIER * raGuidingSpeed); // Faster than siderael
16161651 _mountStatus |= STATUS_GUIDE_PULSE | STATUS_GUIDE_PULSE_RA;
16171652 _guideRaEndTime = millis () + duration;
16181653 break ;
16191654
16201655 case EAST:
16211656 // We were in tracking mode before guiding, so no need to update microstepping mode on RA driver
1622- LOG (DEBUG_STEPPERS, " [STEPPERS]: guidePulse: TRK.setSpeed(%f)" , (raGuidingSpeed * (2 .0f - RA_PULSE_MULTIPLIER)));
1657+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: RA base speed : %f" , raGuidingSpeed);
1658+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: RA speed factor : %f" , _trackingSpeedCalibration);
1659+ raGuidingSpeed *= _trackingSpeedCalibration;
1660+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: RA adjusted speed : %f" , raGuidingSpeed);
1661+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE,
1662+ " [GUIDE]: guidePulse: RA guide speed : %f (%f x adjusted speed)" ,
1663+ (2.0 - RA_PULSE_MULTIPLIER * raGuidingSpeed),
1664+ (2.0 - RA_PULSE_MULTIPLIER));
16231665 _stepperTRK->setSpeed (raGuidingSpeed * (2 .0f - RA_PULSE_MULTIPLIER)); // Slower than siderael
16241666 _mountStatus |= STATUS_GUIDE_PULSE | STATUS_GUIDE_PULSE_RA;
16251667 _guideRaEndTime = millis () + duration;
@@ -1630,7 +1672,7 @@ void Mount::guidePulse(byte direction, int duration)
16301672 updateInfoDisplay ();
16311673#endif
16321674
1633- LOG (DEBUG_STEPPERS, " [STEPPERS ]: guidePulse: < Guide Pulse" );
1675+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE , " [GUIDE ]: guidePulse: < Guide Pulse" );
16341676}
16351677
16361678// ///////////////////////////////
0 commit comments