Skip to content
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion ConfigurationValidation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
2 changes: 1 addition & 1 deletion Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
83 changes: 60 additions & 23 deletions src/Mount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -349,7 +349,7 @@ void Mount::configureAZStepper(byte pin1, byte pin2, int maxSpeed, int maxAccele
#ifdef NEW_STEPPER_LIB
_stepperAZ = new StepperAzSlew(AccelStepper::DRIVER, pin1, pin2);
#else
_stepperAZ = new AccelStepper(AccelStepper::DRIVER, pin1, pin2);
_stepperAZ = new AccelStepper(AccelStepper::DRIVER, pin1, pin2);
#endif
_stepperAZ->setMaxSpeed(maxSpeed);
_stepperAZ->setAcceleration(maxAcceleration);
Expand All @@ -367,7 +367,7 @@ void Mount::configureALTStepper(byte pin1, byte pin2, int maxSpeed, int maxAccel
#ifdef NEW_STEPPER_LIB
_stepperALT = new StepperAltSlew(AccelStepper::DRIVER, pin1, pin2);
#else
_stepperALT = new AccelStepper(AccelStepper::DRIVER, pin1, pin2);
_stepperALT = new AccelStepper(AccelStepper::DRIVER, pin1, pin2);
#endif
_stepperALT->setMaxSpeed(maxSpeed);
_stepperALT->setAcceleration(maxAcceleration);
Expand Down Expand Up @@ -758,7 +758,7 @@ void Mount::configureALTdriver(uint16_t ALT_SW_RX, uint16_t ALT_SW_TX, float rse
_driverALT->pdn_disable(true);
#if UART_CONNECTION_TEST_TXRX == 1
bool UART_Rx_connected = false;
UART_Rx_connected = connectToDriver("ALT");
UART_Rx_connected = connectToDriver("ALT");
if (!UART_Rx_connected)
{
digitalWrite(ALT_EN_PIN,
Expand Down Expand Up @@ -849,7 +849,7 @@ void Mount::configureFocusDriver(
_driverFocus->pdn_disable(true);
#if UART_CONNECTION_TEST_TXRX == 1
bool UART_Rx_connected = false;
UART_Rx_connected = connectToDriver("FOC");
UART_Rx_connected = connectToDriver("FOC");
if (!UART_Rx_connected)
{
digitalWrite(FOCUS_EN_PIN,
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -1868,7 +1891,7 @@ void Mount::getAZALTPositions(long &azPos, long &altPos)
#if (AZ_STEPPER_TYPE != STEPPER_TYPE_NONE)
azPos = _stepperAZ->currentPosition();
#else
azPos = 0;
azPos = 0;
#endif
#if (ALT_STEPPER_TYPE != STEPPER_TYPE_NONE)
altPos = _stepperALT->currentPosition();
Expand Down Expand Up @@ -3225,13 +3248,26 @@ void Mount::setupInfoDisplay()
void Mount::updateInfoDisplay()
{
#if (INFO_DISPLAY_TYPE != INFO_DISPLAY_TYPE_NONE)
_loops++;
// Update display every 8 cycles
if (_loops % 8 == 0)
// 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.
// 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))
{
return;
}
else if (isSlewingRAorDEC())
{
refreshRateHz = 5;
}
Comment on lines +3254 to +3263
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
int refreshRateHz = 30;
long now = millis();
if ((slewStatus() & (SLEWING_DEC | SLEWING_RA)) == (SLEWING_DEC | SLEWING_RA))
{
return;
}
else if (isSlewingRAorDEC())
{
refreshRateHz = 5;
}
int refreshRateHz = 30;
const bool isSlewingRAandDEC = (slewStatus() & (SLEWING_DEC | SLEWING_RA)) == (SLEWING_DEC | SLEWING_RA);
if (isSlewingRAandDEC)
{
return; // Do not update the display
}
else if (isSlewingRAorDEC())
{
refreshRateHz = 5; // Update the display slower
}
const long now = millis();


if (now - _lastInfoUpdate > (1000 / refreshRateHz))
{
LOG(DEBUG_DISPLAY, "[DISPLAY]: Render state to OLED ...");
infoDisplay->render(this);
LOG(DEBUG_DISPLAY, "[DISPLAY]: Rendered state to OLED ...");
_lastInfoUpdate = now;
}
#endif
}
Expand Down Expand Up @@ -3267,6 +3303,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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Mount.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading