@@ -343,6 +343,7 @@ void Mount::configureDECStepper(byte pin1, byte pin2, uint32_t maxSpeed, uint32_
343
343
_stepperDEC->setPinsInverted (true , false , false );
344
344
_stepperGUIDE->setPinsInverted (true , false , false );
345
345
#endif
346
+ _stepperGUIDE->setCurrentPosition (0 );
346
347
}
347
348
348
349
// ///////////////////////////////
@@ -1540,14 +1541,17 @@ void Mount::stopGuiding(bool ra, bool dec)
1540
1541
// Stop RA guide first, since it's just a speed change back to tracking speed
1541
1542
if (ra && (_mountStatus & STATUS_GUIDE_PULSE_RA))
1542
1543
{
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 ());
1544
1548
_stepperTRK->setSpeed (_trackingSpeed);
1545
1549
_mountStatus &= ~STATUS_GUIDE_PULSE_RA;
1546
1550
}
1547
1551
1548
1552
if (dec && (_mountStatus & STATUS_GUIDE_PULSE_DEC))
1549
1553
{
1550
- LOG (DEBUG_STEPPERS, " [STEPPERS ]: stopGuiding(DEC): Stop motor " );
1554
+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE , " [GUIDE ]: stopGuide: DEC stop guide at : %l " , _stepperGUIDE-> currentPosition () );
1551
1555
1552
1556
// Stop DEC guiding and wait for it to stop.
1553
1557
_stepperGUIDE->stop ();
@@ -1558,16 +1562,20 @@ void Mount::stopGuiding(bool ra, bool dec)
1558
1562
_stepperTRK->runSpeed ();
1559
1563
}
1560
1564
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 ());
1563
1566
_mountStatus &= ~STATUS_GUIDE_PULSE_DEC;
1564
1567
}
1565
1568
1566
1569
// disable pulse state if no direction is active
1567
1570
if ((_mountStatus & STATUS_GUIDE_PULSE_DIR) == 0 )
1568
1571
{
1572
+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: Clear guiding state" );
1569
1573
_mountStatus &= ~STATUS_GUIDE_PULSE_MASK;
1570
1574
}
1575
+ else
1576
+ {
1577
+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: One axis still guiding" );
1578
+ }
1571
1579
}
1572
1580
1573
1581
// ///////////////////////////////
@@ -1577,7 +1585,26 @@ void Mount::stopGuiding(bool ra, bool dec)
1577
1585
// ///////////////////////////////
1578
1586
void Mount::guidePulse (byte direction, int duration)
1579
1587
{
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
+ }
1581
1608
1582
1609
// DEC stepper moves at sidereal rate in both directions
1583
1610
// 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)
1586
1613
/ 3600 .0f ; // u-steps/deg * deg/hr / sec/hr = u-steps/sec
1587
1614
float raGuidingSpeed = _stepsPerRADegree * (RA_TRACKING_MICROSTEPPING / RA_SLEW_MICROSTEPPING) * siderealDegreesInHour
1588
1615
/ 3600 .0f ; // u-steps/deg * deg/hr / sec/hr = u-steps/sec
1589
- raGuidingSpeed *= _trackingSpeedCalibration;
1590
1616
1591
1617
// TODO: Do we need to track how many steps the steppers took and add them to the GoHome calculation?
1592
1618
// 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)
1596
1622
switch (direction)
1597
1623
{
1598
1624
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);
1600
1627
_stepperGUIDE->setSpeed (DEC_PULSE_MULTIPLIER * decGuidingSpeed);
1601
1628
_mountStatus |= STATUS_GUIDE_PULSE | STATUS_GUIDE_PULSE_DEC;
1602
1629
_guideDecEndTime = millis () + duration;
1603
1630
break ;
1604
1631
1605
1632
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);
1607
1635
_stepperGUIDE->setSpeed (-DEC_PULSE_MULTIPLIER * decGuidingSpeed);
1608
1636
_mountStatus |= STATUS_GUIDE_PULSE | STATUS_GUIDE_PULSE_DEC;
1609
1637
_guideDecEndTime = millis () + duration;
1610
1638
break ;
1611
1639
1612
1640
case WEST:
1613
1641
// 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);
1615
1650
_stepperTRK->setSpeed (RA_PULSE_MULTIPLIER * raGuidingSpeed); // Faster than siderael
1616
1651
_mountStatus |= STATUS_GUIDE_PULSE | STATUS_GUIDE_PULSE_RA;
1617
1652
_guideRaEndTime = millis () + duration;
1618
1653
break ;
1619
1654
1620
1655
case EAST:
1621
1656
// 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));
1623
1665
_stepperTRK->setSpeed (raGuidingSpeed * (2 .0f - RA_PULSE_MULTIPLIER)); // Slower than siderael
1624
1666
_mountStatus |= STATUS_GUIDE_PULSE | STATUS_GUIDE_PULSE_RA;
1625
1667
_guideRaEndTime = millis () + duration;
@@ -1630,7 +1672,7 @@ void Mount::guidePulse(byte direction, int duration)
1630
1672
updateInfoDisplay ();
1631
1673
#endif
1632
1674
1633
- LOG (DEBUG_STEPPERS, " [STEPPERS ]: guidePulse: < Guide Pulse" );
1675
+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE , " [GUIDE ]: guidePulse: < Guide Pulse" );
1634
1676
}
1635
1677
1636
1678
// ///////////////////////////////
0 commit comments