@@ -79,7 +79,7 @@ Mount::Mount(LcdMenu *lcdMenu)
7979{
8080 _commandReceived = 0 ;
8181#if (INFO_DISPLAY_TYPE != INFO_DISPLAY_TYPE_NONE)
82- _loops = 0 ;
82+ _lastInfoUpdate = millis () ;
8383#endif
8484 _lcdMenu = lcdMenu;
8585 initializeVariables ();
@@ -1649,23 +1649,46 @@ void Mount::guidePulse(byte direction, int duration)
16491649 switch (direction)
16501650 {
16511651 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;
1652+ // If a upper limit is set, check we're not there. If we are, refuse the guide pulse.
1653+ if (_decUpperLimit != 0 && _stepperDEC->currentPosition () >= _decUpperLimit)
1654+ {
1655+ // TODO: Make sure Southern hemisphere does not need a sign/direction inversion.
1656+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE,
1657+ " [GUIDE]: guidePulse: DEC is at (%l) which is at or above upper limit (%l), ignoring guide pulse" ,
1658+ _stepperDEC->currentPosition (),
1659+ _decUpperLimit);
1660+ }
1661+ else
1662+ {
1663+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: DEC base speed : %f" , decGuidingSpeed);
1664+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE,
1665+ " [GUIDE]: guidePulse: DEC guide speed : %f" ,
1666+ DEC_PULSE_MULTIPLIER * decGuidingSpeed);
1667+ _stepperGUIDE->setSpeed (DEC_PULSE_MULTIPLIER * decGuidingSpeed);
1668+ _mountStatus |= STATUS_GUIDE_PULSE | STATUS_GUIDE_PULSE_DEC;
1669+ _guideDecEndTime = millis () + duration;
1670+ }
16591671 break ;
16601672
16611673 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;
1674+ if (_decLowerLimit != 0 && _stepperDEC->currentPosition () <= _decLowerLimit)
1675+ {
1676+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE,
1677+ " [GUIDE]: guidePulse: DEC is at (%l) which is at or below lower limit (%l), ignoring guide pulse" ,
1678+ _stepperDEC->currentPosition (),
1679+ _decLowerLimit);
1680+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: DEC is at lower limit, ignoring guide pulse" );
1681+ }
1682+ else
1683+ {
1684+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE, " [GUIDE]: guidePulse: DEC base speed : %f" , decGuidingSpeed);
1685+ LOG (DEBUG_STEPPERS | DEBUG_GUIDE,
1686+ " [GUIDE]: guidePulse: DEC guide speed : %f" ,
1687+ -DEC_PULSE_MULTIPLIER * decGuidingSpeed);
1688+ _stepperGUIDE->setSpeed (-DEC_PULSE_MULTIPLIER * decGuidingSpeed);
1689+ _mountStatus |= STATUS_GUIDE_PULSE | STATUS_GUIDE_PULSE_DEC;
1690+ _guideDecEndTime = millis () + duration;
1691+ }
16691692 break ;
16701693
16711694 case WEST:
@@ -3226,20 +3249,20 @@ void Mount::updateInfoDisplay()
32263249{
32273250 #if (INFO_DISPLAY_TYPE != INFO_DISPLAY_TYPE_NONE)
32283251 // If we update this display too often while slewing, the serial port is unable to process commands fast enough. Which makes the driver
3229- // timeout, causing ASCOM errors.
3252+ // timeout, causing ASCOM errors.
32303253 // We will update at 30Hz when idle, 5Hz when slewing one axis and skip updates when slewing both.
3231- int refreshRateHz = 30 ;
3232- long now = millis ( );
3233- if (( slewStatus () & (SLEWING_DEC | SLEWING_RA)) == (SLEWING_DEC | SLEWING_RA))
3254+ int refreshRateHz = 30 ;
3255+ const bool isSlewingRAandDEC = ( slewStatus () & (SLEWING_DEC | SLEWING_RA)) == (SLEWING_DEC | SLEWING_RA );
3256+ if (isSlewingRAandDEC)
32343257 {
3235- return ;
3258+ return ; // Do not update the display
32363259 }
3237-
3238- if (isSlewingRAorDEC ())
3260+ else if (isSlewingRAorDEC ())
32393261 {
3240- refreshRateHz = 5 ;
3262+ refreshRateHz = 5 ; // Update the display slower
32413263 }
32423264
3265+ const long now = millis ();
32433266 if (now - _lastInfoUpdate > (1000 / refreshRateHz))
32443267 {
32453268 LOG (DEBUG_DISPLAY, " [DISPLAY]: Render state to OLED ..." );
@@ -3281,6 +3304,7 @@ bool Mount::isBootComplete()
32813304//
32823305// setDecLimitPosition
32833306//
3307+ // If limitAngle is 0, no offset is given, so the current position is used.
32843308// ///////////////////////////////
32853309void Mount::setDecLimitPosition (bool upper, float limitAngle)
32863310{
0 commit comments