Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 4 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
**V1.13.14 - Updates**
- Improved Serial command handling (made it less 'blocking'), which should improve general performance
- 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 +48,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"
9 changes: 9 additions & 0 deletions src/HallSensorHoming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ void HallSensorHoming::processHomingProgress()
{
// First time the pin has triggered, record that position
_homingData.position[HOMING_START_PIN_POSITION] = _pMount->getCurrentStepperPosition(_axis);

LOG(DEBUG_STEPPERS,
"[HOMING]: Potentially found start of sensor at %l",
_homingData.position[HOMING_START_PIN_POSITION]);
Expand All @@ -230,6 +231,10 @@ void HallSensorHoming::processHomingProgress()
// Make sure we continue moving far enough to reach end
long distance = _homingData.initialDir * _stepsPerDegree * _homingData.searchDistance;
_pMount->moveStepperBy(_axis, distance);
LOG(DEBUG_STEPPERS,
"[HOMING]: Making sure stepper keeps going by another %l steps. New target is %l",
distance,
_pMount->getCurrentStepperPosition(_axis) + distance);

_homingData.lastPinState = homingPinState;
_homingData.pinChangeCount = 0;
Expand Down Expand Up @@ -289,6 +294,10 @@ void HallSensorHoming::processHomingProgress()
// Make sure we continue moving far enough to reach end
long distance = -_homingData.initialDir * _stepsPerDegree * _homingData.searchDistance;
_pMount->moveStepperBy(_axis, distance);
LOG(DEBUG_STEPPERS,
"[HOMING]: Making sure stepper keeps going by another %l steps. New target is %l",
distance,
_pMount->getCurrentStepperPosition(_axis) + distance);

_homingData.lastPinState = homingPinState;
_homingData.pinChangeCount = 0;
Expand Down
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
156 changes: 82 additions & 74 deletions src/Mount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1566,11 +1566,9 @@ 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());
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: stopGuide: TRK stop guide at : %l", _stepperTRK->currentPosition());
_stepperTRK->setSpeed(_trackingSpeed);
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: stopGuide: TRK speed set to : %f", _trackingSpeed);
_mountStatus &= ~STATUS_GUIDE_PULSE_RA;
}

Expand All @@ -1586,8 +1584,6 @@ void Mount::stopGuiding(bool ra, bool dec)
_stepperGUIDE->run();
_stepperTRK->runSpeed();
}

LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: stopGuide: DEC stopped at : %l", _stepperGUIDE->currentPosition());
_mountStatus &= ~STATUS_GUIDE_PULSE_DEC;
}

Expand All @@ -1613,84 +1609,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 +2999,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
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