@@ -1566,11 +1566,9 @@ void Mount::stopGuiding(bool ra, bool dec)
15661566 // Stop RA guide first, since it's just a speed change back to tracking speed
15671567 if (ra && (_mountStatus & STATUS_GUIDE_PULSE_RA))
15681568 {
1569- LOG (DEBUG_STEPPERS | DEBUG_GUIDE,
1570- " [GUIDE]: stopGuide: RA set speed : %f (at %l)" ,
1571- _trackingSpeed,
1572- _stepperTRK->currentPosition ());
1569+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: stopGuide: TRK stop guide at : %l" , _stepperTRK->currentPosition ());
15731570 _stepperTRK->setSpeed (_trackingSpeed);
1571+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: stopGuide: TRK speed set to : %f" , _trackingSpeed);
15741572 _mountStatus &= ~STATUS_GUIDE_PULSE_RA;
15751573 }
15761574
@@ -1586,8 +1584,6 @@ void Mount::stopGuiding(bool ra, bool dec)
15861584 _stepperGUIDE->run ();
15871585 _stepperTRK->runSpeed ();
15881586 }
1589-
1590- LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: stopGuide: DEC stopped at : %l" , _stepperGUIDE->currentPosition ());
15911587 _mountStatus &= ~STATUS_GUIDE_PULSE_DEC;
15921588 }
15931589
@@ -1613,84 +1609,95 @@ void Mount::guidePulse(byte direction, int duration)
16131609#if (DEBUG_LEVEL != DEBUG_NONE)
16141610 const char *directionName = " -NE-S---W" ;
16151611#endif
1616- LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: > Guide Pulse %c for %dms" , directionName[direction], duration);
1617- if ((direction == NORTH) || (direction == SOUTH ))
1612+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: > Guide Pulse %c for %dms requested " , directionName[direction], duration);
1613+ if (! isSlewingTRK ( ))
16181614 {
1619- LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: DEC current steps : %l" , _stepperGUIDE->currentPosition ());
1620- LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: DEC steps/deg : %f" , _stepsPerDECDegree);
1621- LOG (DEBUG_STEPPERS | DEBUG_GUIDE,
1622- " [GUIDE]: guidePulse: DEC Microstep ratio : %f" ,
1623- (DEC_GUIDE_MICROSTEPPING / DEC_SLEW_MICROSTEPPING));
1615+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: Not tracking (at limit?), ignoring guide pulse" );
16241616 }
16251617 else
16261618 {
1627- LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: RA current steps : %l" , _stepperTRK->currentPosition ());
1628- LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: RA steps/deg : %f" , _stepsPerRADegree);
1629- LOG (DEBUG_STEPPERS | DEBUG_GUIDE,
1630- " [GUIDE]: guidePulse: RA Microstep ratio : %f" ,
1631- (RA_TRACKING_MICROSTEPPING / RA_SLEW_MICROSTEPPING));
1632- }
1619+ if ((direction == NORTH) || (direction == SOUTH))
1620+ {
1621+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: DEC current steps : %l" , _stepperGUIDE->currentPosition ());
1622+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: DEC steps/deg : %f" , _stepsPerDECDegree);
1623+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE,
1624+ " [GUIDE]: guidePulse: DEC Microstep ratio : %f" ,
1625+ (1.0 * DEC_GUIDE_MICROSTEPPING / DEC_SLEW_MICROSTEPPING));
1626+ }
1627+ else
1628+ {
1629+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: RA current steps : %l" , _stepperTRK->currentPosition ());
1630+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: RA steps/deg : %f" , _stepsPerRADegree);
1631+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE,
1632+ " [GUIDE]: guidePulse: RA Microstep ratio : %f" ,
1633+ (1.0 * RA_TRACKING_MICROSTEPPING / RA_SLEW_MICROSTEPPING));
1634+ }
16331635
1634- // DEC stepper moves at sidereal rate in both directions
1635- // RA stepper moves at either 2.5x sidereal rate or 0.5x sidereal rate.
1636- // Also compensate for microstepping mode change between slew & guiding/tracking
1637- float decGuidingSpeed = _stepsPerDECDegree * (DEC_GUIDE_MICROSTEPPING / DEC_SLEW_MICROSTEPPING) * siderealDegreesInHour
1638- / 3600 .0f ; // u-steps/deg * deg/hr / sec/hr = u-steps/sec
1639- float raGuidingSpeed = _stepsPerRADegree * (RA_TRACKING_MICROSTEPPING / RA_SLEW_MICROSTEPPING) * siderealDegreesInHour
1640- / 3600 .0f ; // u-steps/deg * deg/hr / sec/hr = u-steps/sec
1636+ // DEC stepper moves at sidereal rate in both directions
1637+ // RA stepper moves at either 2.5x sidereal rate or 0.5x sidereal rate.
1638+ // Also compensate for microstepping mode change between slew & guiding/tracking
1639+ float decGuidingSpeed = _stepsPerDECDegree * (1.0 * DEC_GUIDE_MICROSTEPPING / DEC_SLEW_MICROSTEPPING) * siderealDegreesInHour
1640+ / 3600 .0f ; // u-steps/deg * deg/hr / sec/hr = u-steps/sec
1641+ float raGuidingSpeed = _stepsPerRADegree * (1.0 * RA_TRACKING_MICROSTEPPING / RA_SLEW_MICROSTEPPING) * siderealDegreesInHour
1642+ / 3600 .0f ; // u-steps/deg * deg/hr / sec/hr = u-steps/sec
16411643
1642- // TODO: Do we need to track how many steps the steppers took and add them to the GoHome calculation?
1643- // If so, we need to remember where we were when we started the guide pulse. Then at the end,
1644- // we can calculate the difference. Ignore DEC Guide for now.
1645- // TODO: Take guide pulses on DEC into account
1644+ // TODO: Do we need to track how many steps the steppers took and add them to the GoHome calculation?
1645+ // If so, we need to remember where we were when we started the guide pulse. Then at the end,
1646+ // we can calculate the difference. Ignore DEC Guide for now.
1647+ // TODO: Take guide pulses on DEC into account
16461648
1647- switch (direction)
1648- {
1649- case NORTH:
1650- LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: DEC base speed : %f" , decGuidingSpeed);
1651- LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: DEC guide speed : %f" , DEC_PULSE_MULTIPLIER * decGuidingSpeed);
1652- _stepperGUIDE->setSpeed (DEC_PULSE_MULTIPLIER * decGuidingSpeed);
1653- _mountStatus |= STATUS_GUIDE_PULSE | STATUS_GUIDE_PULSE_DEC;
1654- _guideDecEndTime = millis () + duration;
1655- break ;
1649+ switch (direction)
1650+ {
1651+ case NORTH:
1652+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: DEC base speed : %f" , decGuidingSpeed);
1653+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE,
1654+ " [GUIDE]: guidePulse: DEC guide speed : %f" ,
1655+ DEC_PULSE_MULTIPLIER * decGuidingSpeed);
1656+ _stepperGUIDE->setSpeed (DEC_PULSE_MULTIPLIER * decGuidingSpeed);
1657+ _mountStatus |= STATUS_GUIDE_PULSE | STATUS_GUIDE_PULSE_DEC;
1658+ _guideDecEndTime = millis () + duration;
1659+ break ;
16561660
1657- case SOUTH:
1658- LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: DEC base speed : %f" , decGuidingSpeed);
1659- LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: DEC guide speed : %f" , -DEC_PULSE_MULTIPLIER * decGuidingSpeed);
1660- _stepperGUIDE->setSpeed (-DEC_PULSE_MULTIPLIER * decGuidingSpeed);
1661- _mountStatus |= STATUS_GUIDE_PULSE | STATUS_GUIDE_PULSE_DEC;
1662- _guideDecEndTime = millis () + duration;
1663- break ;
1661+ case SOUTH:
1662+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: DEC base speed : %f" , decGuidingSpeed);
1663+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE,
1664+ " [GUIDE]: guidePulse: DEC guide speed : %f" ,
1665+ -DEC_PULSE_MULTIPLIER * decGuidingSpeed);
1666+ _stepperGUIDE->setSpeed (-DEC_PULSE_MULTIPLIER * decGuidingSpeed);
1667+ _mountStatus |= STATUS_GUIDE_PULSE | STATUS_GUIDE_PULSE_DEC;
1668+ _guideDecEndTime = millis () + duration;
1669+ break ;
16641670
1665- case WEST:
1666- // We were in tracking mode before guiding, so no need to update microstepping mode on RA driver
1667- LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: RA base speed : %f" , raGuidingSpeed);
1668- LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: RA speed factor : %f" , _trackingSpeedCalibration);
1669- raGuidingSpeed *= _trackingSpeedCalibration;
1670- LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: RA adjusted speed : %f" , raGuidingSpeed);
1671- LOG (DEBUG_STEPPERS | DEBUG_GUIDE,
1672- " [GUIDE]: guidePulse: RA guide speed : %f (%f x adjusted speed)" ,
1673- (RA_PULSE_MULTIPLIER * raGuidingSpeed),
1674- RA_PULSE_MULTIPLIER);
1675- _stepperTRK->setSpeed (RA_PULSE_MULTIPLIER * raGuidingSpeed); // Faster than siderael
1676- _mountStatus |= STATUS_GUIDE_PULSE | STATUS_GUIDE_PULSE_RA;
1677- _guideRaEndTime = millis () + duration;
1678- break ;
1671+ case WEST:
1672+ // We were in tracking mode before guiding, so no need to update microstepping mode on RA driver
1673+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: RA base speed : %f" , raGuidingSpeed);
1674+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: RA speed factor : %f" , _trackingSpeedCalibration);
1675+ raGuidingSpeed *= _trackingSpeedCalibration;
1676+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: RA adjusted speed : %f" , raGuidingSpeed);
1677+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE,
1678+ " [GUIDE]: guidePulse: RA guide speed : %f (%f x adjusted speed)" ,
1679+ (RA_PULSE_MULTIPLIER * raGuidingSpeed),
1680+ RA_PULSE_MULTIPLIER);
1681+ _stepperTRK->setSpeed (RA_PULSE_MULTIPLIER * raGuidingSpeed); // Faster than siderael
1682+ _mountStatus |= STATUS_GUIDE_PULSE | STATUS_GUIDE_PULSE_RA;
1683+ _guideRaEndTime = millis () + duration;
1684+ break ;
16791685
1680- case EAST:
1681- // We were in tracking mode before guiding, so no need to update microstepping mode on RA driver
1682- LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: RA base speed : %f" , raGuidingSpeed);
1683- LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: RA speed factor : %f" , _trackingSpeedCalibration);
1684- raGuidingSpeed *= _trackingSpeedCalibration;
1685- LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: RA adjusted speed : %f" , raGuidingSpeed);
1686- LOG (DEBUG_STEPPERS | DEBUG_GUIDE,
1687- " [GUIDE]: guidePulse: RA guide speed : %f (%f x adjusted speed)" ,
1688- (2.0 - RA_PULSE_MULTIPLIER * raGuidingSpeed),
1689- (2.0 - RA_PULSE_MULTIPLIER));
1690- _stepperTRK->setSpeed (raGuidingSpeed * (2 .0f - RA_PULSE_MULTIPLIER)); // Slower than siderael
1691- _mountStatus |= STATUS_GUIDE_PULSE | STATUS_GUIDE_PULSE_RA;
1692- _guideRaEndTime = millis () + duration;
1693- break ;
1686+ case EAST:
1687+ // We were in tracking mode before guiding, so no need to update microstepping mode on RA driver
1688+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: RA base speed : %f" , raGuidingSpeed);
1689+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: RA speed factor : %f" , _trackingSpeedCalibration);
1690+ raGuidingSpeed *= _trackingSpeedCalibration;
1691+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: RA adjusted speed : %f" , raGuidingSpeed);
1692+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE,
1693+ " [GUIDE]: guidePulse: RA guide speed : %f (%f x adjusted speed)" ,
1694+ (2.0 - RA_PULSE_MULTIPLIER * raGuidingSpeed),
1695+ (2.0 - RA_PULSE_MULTIPLIER));
1696+ _stepperTRK->setSpeed (raGuidingSpeed * (2 .0f - RA_PULSE_MULTIPLIER)); // Slower than siderael
1697+ _mountStatus |= STATUS_GUIDE_PULSE | STATUS_GUIDE_PULSE_RA;
1698+ _guideRaEndTime = millis () + duration;
1699+ break ;
1700+ }
16941701 }
16951702// Since we will not be updating the display during a guide pulse, update the display here.
16961703#if INFO_DISPLAY_TYPE != INFO_DISPLAY_TYPE_NONE
@@ -2992,6 +2999,7 @@ void Mount::loop()
29922999 bool stopDecGuiding = (now > _guideDecEndTime) && (_mountStatus & STATUS_GUIDE_PULSE_DEC);
29933000 if (stopRaGuiding || stopDecGuiding)
29943001 {
3002+ LOG (DEBUG_GUIDE, " [MOUNT]: Loop: StopGuiding. Now: %l, RA End: %l, DEC End: %l" , now, _guideRaEndTime, _guideDecEndTime);
29953003 stopGuiding (stopRaGuiding, stopDecGuiding);
29963004 }
29973005 else
0 commit comments