diff --git a/Changelog.md b/Changelog.md index 659ee6fe..3fd484bc 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,7 @@ +**V1.13.16 - Updates** +- Throttled InfoDisplay updates. Turned off on two axis slew, limited to 5Hz on one-axis slew. +- Guide pulses are now ignored for DEC as well when at the limits. + **V1.13.15 - Updates** - Check `INFO_DISPLAY_TYPE` builds in CI - Fix `INFO_DISPLAY_TYPE_I2C_SSD1306_128x64` for esp32 builds diff --git a/ConfigurationValidation.hpp b/ConfigurationValidation.hpp index 6660e854..292f5b9e 100644 --- a/ConfigurationValidation.hpp +++ b/ConfigurationValidation.hpp @@ -449,7 +449,7 @@ #endif #endif -// For OAT, we must have DEC limits defined, otherwise free slew does nto work. +// For OAT, we must have DEC limits defined, otherwise free slew does not work. #ifndef OAM #ifndef DEC_LIMIT_UP #error "You must set DEC_LIMIT_UP to the number of degrees that your OAT can move upwards from the home position." diff --git a/Version.h b/Version.h index 81278909..e069b894 100644 --- a/Version.h +++ b/Version.h @@ -3,4 +3,4 @@ // Also, numbers are interpreted as simple numbers. _ __ _ // So 1.8 is actually 1.08, meaning that 1.12 is a later version than 1.8. \_(..)_/ -#define VERSION "V1.13.15" +#define VERSION "V1.13.16" diff --git a/src/Mount.cpp b/src/Mount.cpp index 8a917214..2e4180b5 100644 --- a/src/Mount.cpp +++ b/src/Mount.cpp @@ -79,7 +79,7 @@ Mount::Mount(LcdMenu *lcdMenu) { _commandReceived = 0; #if (INFO_DISPLAY_TYPE != INFO_DISPLAY_TYPE_NONE) - _loops = 0; + _lastInfoUpdate = millis(); #endif _lcdMenu = lcdMenu; initializeVariables(); @@ -1649,23 +1649,46 @@ void Mount::guidePulse(byte direction, int duration) switch (direction) { case NORTH: - LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: guidePulse: DEC base speed : %f", decGuidingSpeed); - LOG(DEBUG_STEPPERS | DEBUG_GUIDE, - "[GUIDE]: guidePulse: DEC guide speed : %f", - DEC_PULSE_MULTIPLIER * decGuidingSpeed); - _stepperGUIDE->setSpeed(DEC_PULSE_MULTIPLIER * decGuidingSpeed); - _mountStatus |= STATUS_GUIDE_PULSE | STATUS_GUIDE_PULSE_DEC; - _guideDecEndTime = millis() + duration; + // If a upper limit is set, check we're not there. If we are, refuse the guide pulse. + if (_decUpperLimit != 0 && _stepperDEC->currentPosition() >= _decUpperLimit) + { + // TODO: Make sure Southern hemisphere does not need a sign/direction inversion. + LOG(DEBUG_STEPPERS | DEBUG_GUIDE, + "[GUIDE]: guidePulse: DEC is at (%l) which is at or above upper limit (%l), ignoring guide pulse", + _stepperDEC->currentPosition(), + _decUpperLimit); + } + else + { + LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: guidePulse: DEC base speed : %f", decGuidingSpeed); + LOG(DEBUG_STEPPERS | DEBUG_GUIDE, + "[GUIDE]: guidePulse: DEC guide speed : %f", + DEC_PULSE_MULTIPLIER * decGuidingSpeed); + _stepperGUIDE->setSpeed(DEC_PULSE_MULTIPLIER * decGuidingSpeed); + _mountStatus |= STATUS_GUIDE_PULSE | STATUS_GUIDE_PULSE_DEC; + _guideDecEndTime = millis() + duration; + } break; case SOUTH: - LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: guidePulse: DEC base speed : %f", decGuidingSpeed); - LOG(DEBUG_STEPPERS | DEBUG_GUIDE, - "[GUIDE]: guidePulse: DEC guide speed : %f", - -DEC_PULSE_MULTIPLIER * decGuidingSpeed); - _stepperGUIDE->setSpeed(-DEC_PULSE_MULTIPLIER * decGuidingSpeed); - _mountStatus |= STATUS_GUIDE_PULSE | STATUS_GUIDE_PULSE_DEC; - _guideDecEndTime = millis() + duration; + if (_decLowerLimit != 0 && _stepperDEC->currentPosition() <= _decLowerLimit) + { + LOG(DEBUG_STEPPERS | DEBUG_GUIDE, + "[GUIDE]: guidePulse: DEC is at (%l) which is at or below lower limit (%l), ignoring guide pulse", + _stepperDEC->currentPosition(), + _decLowerLimit); + LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: guidePulse: DEC is at lower limit, ignoring guide pulse"); + } + else + { + LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: guidePulse: DEC base speed : %f", decGuidingSpeed); + LOG(DEBUG_STEPPERS | DEBUG_GUIDE, + "[GUIDE]: guidePulse: DEC guide speed : %f", + -DEC_PULSE_MULTIPLIER * decGuidingSpeed); + _stepperGUIDE->setSpeed(-DEC_PULSE_MULTIPLIER * decGuidingSpeed); + _mountStatus |= STATUS_GUIDE_PULSE | STATUS_GUIDE_PULSE_DEC; + _guideDecEndTime = millis() + duration; + } break; case WEST: @@ -3226,20 +3249,20 @@ void Mount::updateInfoDisplay() { #if (INFO_DISPLAY_TYPE != INFO_DISPLAY_TYPE_NONE) // If we update this display too often while slewing, the serial port is unable to process commands fast enough. Which makes the driver - // timeout, causing ASCOM errors. + // timeout, causing ASCOM errors. // We will update at 30Hz when idle, 5Hz when slewing one axis and skip updates when slewing both. - int refreshRateHz = 30; - long now = millis(); - if ((slewStatus() & (SLEWING_DEC | SLEWING_RA)) == (SLEWING_DEC | SLEWING_RA)) + int refreshRateHz = 30; + const bool isSlewingRAandDEC = (slewStatus() & (SLEWING_DEC | SLEWING_RA)) == (SLEWING_DEC | SLEWING_RA); + if (isSlewingRAandDEC) { - return; + return; // Do not update the display } - - if (isSlewingRAorDEC()) + else if (isSlewingRAorDEC()) { - refreshRateHz = 5; + refreshRateHz = 5; // Update the display slower } + const long now = millis(); if (now - _lastInfoUpdate > (1000 / refreshRateHz)) { LOG(DEBUG_DISPLAY, "[DISPLAY]: Render state to OLED ..."); @@ -3281,6 +3304,7 @@ bool Mount::isBootComplete() // // setDecLimitPosition // +// If limitAngle is 0, no offset is given, so the current position is used. ///////////////////////////////// void Mount::setDecLimitPosition(bool upper, float limitAngle) { diff --git a/src/Mount.hpp b/src/Mount.hpp index 80d53351..b63632f4 100644 --- a/src/Mount.hpp +++ b/src/Mount.hpp @@ -403,7 +403,7 @@ class Mount void setupInfoDisplay(); void updateInfoDisplay(); InfoDisplayRender *getInfoDisplay(); - long _loops; + long _lastInfoUpdate; #endif // Called by Meade processor every time a command is received.