Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
**V1.13.14 - Updates**
- Improved Serial command handling (made it less 'blocking'), which should improve general performance
- Guiding now updates RA/DEC coordinates
- Guide pulses are ignored when tracking is disabled (for example, when at the limits)

**V1.13.13 - Updates**
- Improved Meade command documentation
- Fixed a bug that was not correctly showing the stepper direction in the :GX# command reply./
Expand Down Expand Up @@ -44,7 +49,6 @@ NOTE: Make sure to do a Factory Reset when using this version.
- Lowered ESP32 second core priority
- Added support for informational display
- You must upgrade to OATControl V1.1.2.0 to use with this version (at least if you want to use teh DEC park/unpark feature)

**V1.13.2 - Updates**
- Fix for RA steps being incorrectly set on every boot.

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.13"
#define VERSION "V1.13.14"
5 changes: 3 additions & 2 deletions src/MeadeCommandProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ bool gpsAqcuisitionComplete(int &indicator); // defined in c72_menuHA_GPS.hpp
// Information:
// This stops all motors, including tracking. Note that deceleration curves are still followed.
// Returns:
// "1" when all motors have stopped
// nothing
//
// :Qd#
// Description:
Expand Down Expand Up @@ -1521,6 +1521,7 @@ String MeadeCommandProcessor::handleMeadeSetInfo(String inCmd)
/////////////////////////////
String MeadeCommandProcessor::handleMeadeMovement(String inCmd)
{
LOG(DEBUG_MEADE, "[MEADE]: Process Move command: [%s]", inCmd.c_str());
if (inCmd[0] == 'S') // :MS#
{
_mount->startSlewingToTarget();
Expand Down Expand Up @@ -2203,7 +2204,7 @@ String MeadeCommandProcessor::processCommand(String inCmd)
{
if (inCmd[0] == ':')
{
LOG(DEBUG_MEADE, "[MEADE]: Received command '%s'", inCmd.c_str());
LOG(DEBUG_MEADE, "[MEADE]: Received command '%s'", inCmd.c_str());

// Apparently some LX200 implementations put spaces in their commands..... remove them with impunity.
int spacePos;
Expand Down
179 changes: 106 additions & 73 deletions src/Mount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1566,11 +1566,28 @@ void Mount::stopGuiding(bool ra, bool dec)
// Stop RA guide first, since it's just a speed change back to tracking speed
if (ra && (_mountStatus & STATUS_GUIDE_PULSE_RA))
{
LOG(DEBUG_STEPPERS | DEBUG_GUIDE,
"[GUIDE]: stopGuide: RA set speed : %f (at %l)",
_trackingSpeed,
_stepperTRK->currentPosition());
long raStepsDuringGuide = _stepperTRK->currentPosition() - _stepperTrkPosAtGuideStart;
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: stopGuide: TRK stop guide at : %l", _stepperTRK->currentPosition());
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: stopGuide: TRK steps moved : %l", raStepsDuringGuide);
long extraSteps = 0;
if (_stepperTRK->speed() < _trackingSpeed)
{
// EAST (1.5x), faster so we need 1/3 of the steps
extraSteps = -((1.0 / (2.0 - RA_PULSE_MULTIPLIER)) - 1.0) * raStepsDuringGuide;
}
else
{
// WEST (0.5)
extraSteps = (1.0 - (1.0 / RA_PULSE_MULTIPLIER)) * raStepsDuringGuide;
}
_stepperTRK->setSpeed(_trackingSpeed);

// Calculate the extra steps moved during guiding on top of tracking and convert from TRK stepper to RA stepper
extraSteps *= RA_SLEW_MICROSTEPPING / RA_TRACKING_MICROSTEPPING;
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: stopGuide: RA extra steps : %l", extraSteps);
// Adjust RA coordinate by the amount of steps moved during guiding
_stepperRA->setCurrentPosition(_stepperRA->currentPosition() + extraSteps);

_mountStatus &= ~STATUS_GUIDE_PULSE_RA;
}

Expand All @@ -1586,8 +1603,12 @@ void Mount::stopGuiding(bool ra, bool dec)
_stepperGUIDE->run();
_stepperTRK->runSpeed();
}
long decStepsDuringGuide = _stepperGUIDE->currentPosition() - _stepperGuidePosAtGuideStart;

LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: stopGuide: DEC stopped at : %l", _stepperGUIDE->currentPosition());
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: stopGuide: DEC steps moved : %l", decStepsDuringGuide);
// Adjust DEC coordinate by the amount of steps moved during guiding
_stepperDEC->setCurrentPosition(_stepperDEC->currentPosition()
+ decStepsDuringGuide * DEC_SLEW_MICROSTEPPING / DEC_GUIDE_MICROSTEPPING);
_mountStatus &= ~STATUS_GUIDE_PULSE_DEC;
}

Expand All @@ -1613,84 +1634,95 @@ void Mount::guidePulse(byte direction, int duration)
#if (DEBUG_LEVEL != DEBUG_NONE)
const char *directionName = "-NE-S---W";
#endif
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: guidePulse: > Guide Pulse %c for %dms", directionName[direction], duration);
if ((direction == NORTH) || (direction == SOUTH))
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: guidePulse: > Guide Pulse %c for %dms requested", directionName[direction], duration);
if (!isSlewingTRK())
{
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: guidePulse: DEC current steps : %l", _stepperGUIDE->currentPosition());
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: guidePulse: DEC steps/deg : %f", _stepsPerDECDegree);
LOG(DEBUG_STEPPERS | DEBUG_GUIDE,
"[GUIDE]: guidePulse: DEC Microstep ratio : %f",
(DEC_GUIDE_MICROSTEPPING / DEC_SLEW_MICROSTEPPING));
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: guidePulse: Not tracking (at limit?), ignoring guide pulse");
}
else
{
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: guidePulse: RA current steps : %l", _stepperTRK->currentPosition());
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: guidePulse: RA steps/deg : %f", _stepsPerRADegree);
LOG(DEBUG_STEPPERS | DEBUG_GUIDE,
"[GUIDE]: guidePulse: RA Microstep ratio : %f",
(RA_TRACKING_MICROSTEPPING / RA_SLEW_MICROSTEPPING));
}
if ((direction == NORTH) || (direction == SOUTH))
{
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: guidePulse: DEC current steps : %l", _stepperGUIDE->currentPosition());
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: guidePulse: DEC steps/deg : %f", _stepsPerDECDegree);
LOG(DEBUG_STEPPERS | DEBUG_GUIDE,
"[GUIDE]: guidePulse: DEC Microstep ratio : %f",
(1.0 * DEC_GUIDE_MICROSTEPPING / DEC_SLEW_MICROSTEPPING));
}
else
{
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: guidePulse: RA current steps : %l", _stepperTRK->currentPosition());
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: guidePulse: RA steps/deg : %f", _stepsPerRADegree);
LOG(DEBUG_STEPPERS | DEBUG_GUIDE,
"[GUIDE]: guidePulse: RA Microstep ratio : %f",
(1.0 * RA_TRACKING_MICROSTEPPING / RA_SLEW_MICROSTEPPING));
}

// DEC stepper moves at sidereal rate in both directions
// RA stepper moves at either 2.5x sidereal rate or 0.5x sidereal rate.
// Also compensate for microstepping mode change between slew & guiding/tracking
float decGuidingSpeed = _stepsPerDECDegree * (DEC_GUIDE_MICROSTEPPING / DEC_SLEW_MICROSTEPPING) * siderealDegreesInHour
/ 3600.0f; // u-steps/deg * deg/hr / sec/hr = u-steps/sec
float raGuidingSpeed = _stepsPerRADegree * (RA_TRACKING_MICROSTEPPING / RA_SLEW_MICROSTEPPING) * siderealDegreesInHour
/ 3600.0f; // u-steps/deg * deg/hr / sec/hr = u-steps/sec
// DEC stepper moves at sidereal rate in both directions
// RA stepper moves at either 2.5x sidereal rate or 0.5x sidereal rate.
// Also compensate for microstepping mode change between slew & guiding/tracking
float decGuidingSpeed = _stepsPerDECDegree * (1.0 * DEC_GUIDE_MICROSTEPPING / DEC_SLEW_MICROSTEPPING) * siderealDegreesInHour
/ 3600.0f; // u-steps/deg * deg/hr / sec/hr = u-steps/sec
float raGuidingSpeed = _stepsPerRADegree * (1.0 * RA_TRACKING_MICROSTEPPING / RA_SLEW_MICROSTEPPING) * siderealDegreesInHour
/ 3600.0f; // u-steps/deg * deg/hr / sec/hr = u-steps/sec

// TODO: Do we need to track how many steps the steppers took and add them to the GoHome calculation?
// If so, we need to remember where we were when we started the guide pulse. Then at the end,
// we can calculate the difference. Ignore DEC Guide for now.
// TODO: Take guide pulses on DEC into account
// TODO: Do we need to track how many steps the steppers took and add them to the GoHome calculation?
// If so, we need to remember where we were when we started the guide pulse. Then at the end,
// we can calculate the difference. Ignore DEC Guide for now.
// TODO: Take guide pulses on DEC into account

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;
break;
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;
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;
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;
break;

case WEST:
// We were in tracking mode before guiding, so no need to update microstepping mode on RA driver
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: guidePulse: RA base speed : %f", raGuidingSpeed);
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: guidePulse: RA speed factor : %f", _trackingSpeedCalibration);
raGuidingSpeed *= _trackingSpeedCalibration;
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: guidePulse: RA adjusted speed : %f", raGuidingSpeed);
LOG(DEBUG_STEPPERS | DEBUG_GUIDE,
"[GUIDE]: guidePulse: RA guide speed : %f (%f x adjusted speed)",
(RA_PULSE_MULTIPLIER * raGuidingSpeed),
RA_PULSE_MULTIPLIER);
_stepperTRK->setSpeed(RA_PULSE_MULTIPLIER * raGuidingSpeed); // Faster than siderael
_mountStatus |= STATUS_GUIDE_PULSE | STATUS_GUIDE_PULSE_RA;
_guideRaEndTime = millis() + duration;
break;
case WEST:
// We were in tracking mode before guiding, so no need to update microstepping mode on RA driver
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: guidePulse: RA base speed : %f", raGuidingSpeed);
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: guidePulse: RA speed factor : %f", _trackingSpeedCalibration);
raGuidingSpeed *= _trackingSpeedCalibration;
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: guidePulse: RA adjusted speed : %f", raGuidingSpeed);
LOG(DEBUG_STEPPERS | DEBUG_GUIDE,
"[GUIDE]: guidePulse: RA guide speed : %f (%f x adjusted speed)",
(RA_PULSE_MULTIPLIER * raGuidingSpeed),
RA_PULSE_MULTIPLIER);
_stepperTRK->setSpeed(RA_PULSE_MULTIPLIER * raGuidingSpeed); // Faster than siderael
_mountStatus |= STATUS_GUIDE_PULSE | STATUS_GUIDE_PULSE_RA;
_guideRaEndTime = millis() + duration;
break;

case EAST:
// We were in tracking mode before guiding, so no need to update microstepping mode on RA driver
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: guidePulse: RA base speed : %f", raGuidingSpeed);
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: guidePulse: RA speed factor : %f", _trackingSpeedCalibration);
raGuidingSpeed *= _trackingSpeedCalibration;
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: guidePulse: RA adjusted speed : %f", raGuidingSpeed);
LOG(DEBUG_STEPPERS | DEBUG_GUIDE,
"[GUIDE]: guidePulse: RA guide speed : %f (%f x adjusted speed)",
(2.0 - RA_PULSE_MULTIPLIER * raGuidingSpeed),
(2.0 - RA_PULSE_MULTIPLIER));
_stepperTRK->setSpeed(raGuidingSpeed * (2.0f - RA_PULSE_MULTIPLIER)); // Slower than siderael
_mountStatus |= STATUS_GUIDE_PULSE | STATUS_GUIDE_PULSE_RA;
_guideRaEndTime = millis() + duration;
break;
case EAST:
// We were in tracking mode before guiding, so no need to update microstepping mode on RA driver
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: guidePulse: RA base speed : %f", raGuidingSpeed);
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: guidePulse: RA speed factor : %f", _trackingSpeedCalibration);
raGuidingSpeed *= _trackingSpeedCalibration;
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: guidePulse: RA adjusted speed : %f", raGuidingSpeed);
LOG(DEBUG_STEPPERS | DEBUG_GUIDE,
"[GUIDE]: guidePulse: RA guide speed : %f (%f x adjusted speed)",
(2.0 - RA_PULSE_MULTIPLIER * raGuidingSpeed),
(2.0 - RA_PULSE_MULTIPLIER));
_stepperTRK->setSpeed(raGuidingSpeed * (2.0f - RA_PULSE_MULTIPLIER)); // Slower than siderael
_mountStatus |= STATUS_GUIDE_PULSE | STATUS_GUIDE_PULSE_RA;
_guideRaEndTime = millis() + duration;
break;
}
}
// Since we will not be updating the display during a guide pulse, update the display here.
#if INFO_DISPLAY_TYPE != INFO_DISPLAY_TYPE_NONE
Expand Down Expand Up @@ -2992,6 +3024,7 @@ void Mount::loop()
bool stopDecGuiding = (now > _guideDecEndTime) && (_mountStatus & STATUS_GUIDE_PULSE_DEC);
if (stopRaGuiding || stopDecGuiding)
{
LOG(DEBUG_GUIDE, "[MOUNT]: Loop: StopGuiding. Now: %l, RA End: %l, DEC End: %l", now, _guideRaEndTime, _guideDecEndTime);
stopGuiding(stopRaGuiding, stopDecGuiding);
}
else
Expand Down
2 changes: 2 additions & 0 deletions src/Mount.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,8 @@ class Mount

unsigned long _guideRaEndTime;
unsigned long _guideDecEndTime;
long _stepperGuidePosAtGuideStart;
long _stepperTrkPosAtGuideStart;
unsigned long _lastMountPrint = 0;
float _trackingSpeed; // RA u-steps/sec when in tracking mode
float _trackingSpeedCalibration; // Dimensionless, very close to 1.0
Expand Down
22 changes: 11 additions & 11 deletions src/b_setup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,6 @@ void setup()
// Set the stepper motor parameters
#if (RA_STEPPER_TYPE != STEPPER_TYPE_NONE)
LOG(DEBUG_ANY, "[STEPPERS]: Configure RA stepper NEMA.");
LOG(DEBUG_ANY, "[STEPPERS]: Stepper SPR : %d", RA_STEPPER_SPR);
LOG(DEBUG_ANY, "[STEPPERS]: Slew Microsteps : %d", RA_SLEW_MICROSTEPPING);
LOG(DEBUG_ANY, "[STEPPERS]: Trk Microsteps : %d", RA_TRACKING_MICROSTEPPING);
LOG(DEBUG_ANY, "[STEPPERS]: Stepper SPR : %d", RA_STEPPER_SPR);
Expand All @@ -381,17 +380,18 @@ void setup()

#if (DEC_STEPPER_TYPE != STEPPER_TYPE_NONE)
LOG(DEBUG_ANY, "[STEPPERS]: Configure DEC stepper NEMA.");
LOG(DEBUG_ANY, "[STEPPERS]: Slew Microsteps : %d", DEC_SLEW_MICROSTEPPING);
LOG(DEBUG_ANY, "[STEPPERS]: Stepper SPR : %d", DEC_STEPPER_SPR);
LOG(DEBUG_ANY, "[STEPPERS]: Transmission : %f", DEC_TRANSMISSION);
LOG(DEBUG_ANY, "[STEPPERS]: Slew Microsteps : %d", DEC_SLEW_MICROSTEPPING);
LOG(DEBUG_ANY, "[STEPPERS]: Guide Microsteps : %d", DEC_GUIDE_MICROSTEPPING);
LOG(DEBUG_ANY, "[STEPPERS]: Stepper SPR : %d", DEC_STEPPER_SPR);
LOG(DEBUG_ANY, "[STEPPERS]: Transmission : %f", DEC_TRANSMISSION);
#ifdef NEW_STEPPER_LIB
LOG(DEBUG_ANY, "[STEPPERS]: Driver Slew SPR : %l", config::Dec::DRIVER_SPR_SLEW);
LOG(DEBUG_ANY, "[STEPPERS]: Driver Trk SPR : %l", config::Dec::DRIVER_SPR_TRK);
LOG(DEBUG_ANY, "[STEPPERS]: SPR Slew : %f", config::Dec::SPR_SLEW);
LOG(DEBUG_ANY, "[STEPPERS]: SPR Trk : %f", config::Dec::SPR_TRK);
LOG(DEBUG_ANY, "[STEPPERS]: Speed Slew : %f", config::Dec::SPEED_SLEW);
LOG(DEBUG_ANY, "[STEPPERS]: Accel Slew : %f", config::Dec::ACCEL_SLEW);
LOG(DEBUG_ANY, "[STEPPERS]: Speed Trk : %f", config::Dec::SPEED_TRK);
LOG(DEBUG_ANY, "[STEPPERS]: Driver Slew SPR : %l", config::Dec::DRIVER_SPR_SLEW);
LOG(DEBUG_ANY, "[STEPPERS]: Driver Trk SPR : %l", config::Dec::DRIVER_SPR_TRK);
LOG(DEBUG_ANY, "[STEPPERS]: SPR Slew : %f", config::Dec::SPR_SLEW);
LOG(DEBUG_ANY, "[STEPPERS]: SPR Trk : %f", config::Dec::SPR_TRK);
LOG(DEBUG_ANY, "[STEPPERS]: Speed Slew : %f", config::Dec::SPEED_SLEW);
LOG(DEBUG_ANY, "[STEPPERS]: Accel Slew : %f", config::Dec::ACCEL_SLEW);
LOG(DEBUG_ANY, "[STEPPERS]: Speed Trk : %f", config::Dec::SPEED_TRK);
LOG(DEBUG_ANY, "[STEPPERS]: Configure DEC stepper NEMA...");
mount.configureDECStepper(DECmotorPin1, DECmotorPin2, config::Dec::SPEED_SLEW, config::Dec::ACCEL_SLEW);
#else
Expand Down
Loading