Skip to content

Commit

Permalink
V1.13.9 Updates (#252)
Browse files Browse the repository at this point in the history
  • Loading branch information
ClutchplateDude authored Sep 26, 2024
1 parent 05d2176 commit 400a3cc
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 24 deletions.
6 changes: 6 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
**V1.13.9 - Updates**
- Added guide logging support.
- Fixed some Meade documentation errors.
- Adjusted DEC limits for OAM to 135 degrees.
- Reverted OLED library for InfoDisplay back to forked version so it compiles correctly.

**V1.13.8 - Updates**
- Fixed DEC runaway issue by updating avr-interrupt-stepper library to version 0.0.3

Expand Down
4 changes: 2 additions & 2 deletions Configuration_adv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,14 @@

#ifndef DEC_LIMIT_UP
#ifdef OAM
#define DEC_LIMIT_UP 100.0f
#define DEC_LIMIT_UP 135.0f
#else
#define DEC_LIMIT_UP 0.0f
#endif
#endif
#ifndef DEC_LIMIT_DOWN
#ifdef OAM
#define DEC_LIMIT_DOWN 100.0f
#define DEC_LIMIT_DOWN 135.0f
#else
#define DEC_LIMIT_DOWN 0.0f
#endif
Expand Down
1 change: 1 addition & 0 deletions Constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,5 @@
#define DEBUG_FOCUS 0x1000 // Focuser activity
#define DEBUG_COORD_CALC 0x2000 // Calculations of coordinates
#define DEBUG_DISPLAY 0x4000 // Info display
#define DEBUG_GUIDE 0x8000 // Guiding info
#define DEBUG_ANY 0xFFFF // All debug output
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.8"
#define VERSION "V1.13.9"
4 changes: 2 additions & 2 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ lib_deps =
arduino-libraries/LiquidCrystal @ ^1.0.7
lincomatic/LiquidTWI2@^1.2.7
olikraus/U8g2@^2.28.8
https://github.com/ThingPulse/esp8266-oled-ssd1306@4.6.1
https://github.com/ClutchplateDude/esp8266-oled-ssd1306@4.6.0

[env]
extra_scripts =
Expand Down Expand Up @@ -95,7 +95,7 @@ debug_build_flags =
lib_deps =
${common.lib_deps}
jdolinay/avr-debugger @ 1.2
https://github.com/andre-stefanov/avr-interrupt-stepper@0.0.3
https://github.com/andre-stefanov/avr-interrupt-stepper@0.0.4

[env:mksgenlv21]
extends = env:ramps
Expand Down
16 changes: 8 additions & 8 deletions src/MeadeCommandProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ bool gpsAqcuisitionComplete(int &indicator); // defined in c72_menuHA_GPS.hpp
// "x" is the stepper to move (r for RA, d for DEC, f for FOC, z for AZ, t for ALT)
// "nnnn" is the number of steps
// Returns:
// "1" if successfully scheduled
// "1" if successfully scheduled, else "0"
//
// :MHRxn#
// Description:
Expand Down Expand Up @@ -743,7 +743,7 @@ bool gpsAqcuisitionComplete(int &indicator); // defined in c72_menuHA_GPS.hpp
// one Hall sensor based autohoming axis is enabled.
// Returns:
// "rastate|decstate#" if either axis is enabled
// "|" if no autohoming is enabled
// "|#" if no autohoming is enabled
// Remarks:
// While the mount status (:GX#) is 'Homing', the command returns one of these:
// MOVE_OFF
Expand Down Expand Up @@ -935,7 +935,7 @@ bool gpsAqcuisitionComplete(int &indicator); // defined in c72_menuHA_GPS.hpp
// Information:
// Get the current LST of the mount.
// Returns:
// "HHMMSS"
// "HHMMSS#"
//
// :XSBn#
// Description:
Expand Down Expand Up @@ -1856,23 +1856,23 @@ String MeadeCommandProcessor::handleMeadeExtraCommands(String inCmd)
{
if (inCmd.length() > 2)
{
LOG(DEBUG_MOUNT, "[MEADE]: XGH -> %s", inCmd.c_str());
LOG(DEBUG_MEADE, "[MEADE]: XGH -> %s", inCmd.c_str());
if (inCmd[2] == 'R') // :XGHR#
{
LOG(DEBUG_MOUNT, "[MEADE]: XGHR -> %s", inCmd.c_str());
LOG(DEBUG_MEADE, "[MEADE]: XGHR -> %s", inCmd.c_str());
return String(_mount->getHomingOffset(StepperAxis::RA_STEPS)) + "#";
}
else if (inCmd[2] == 'D') // :XGHD#
{
LOG(DEBUG_MOUNT, "[MEADE]: XGHD -> %s", inCmd.c_str());
LOG(DEBUG_MEADE, "[MEADE]: XGHD -> %s", inCmd.c_str());
return String(_mount->getHomingOffset(StepperAxis::DEC_STEPS)) + "#";
}
else if (inCmd[2] == 'S') // :XGHS#
{
LOG(DEBUG_MOUNT, "[MEADE]: XGHS -> %s", inCmd.c_str());
LOG(DEBUG_MEADE, "[MEADE]: XGHS -> %s", inCmd.c_str());
return String(inNorthernHemisphere ? "N#" : "S#");
}
LOG(DEBUG_MOUNT, "[MEADE]: XGH? -> %s", inCmd.c_str());
LOG(DEBUG_MEADE, "[MEADE]: XGH? -> %s", inCmd.c_str());

return "0#";
}
Expand Down
64 changes: 53 additions & 11 deletions src/Mount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ void Mount::configureDECStepper(byte pin1, byte pin2, uint32_t maxSpeed, uint32_
_stepperDEC->setPinsInverted(true, false, false);
_stepperGUIDE->setPinsInverted(true, false, false);
#endif
_stepperGUIDE->setCurrentPosition(0);
}

/////////////////////////////////
Expand Down Expand Up @@ -1540,14 +1541,17 @@ 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, "[STEPPERS]: stopGuiding(RA): TRK.setSpeed(%f)", _trackingSpeed);
LOG(DEBUG_STEPPERS | DEBUG_GUIDE,
"[GUIDE]: stopGuide: RA set speed : %f (at %l)",
_trackingSpeed,
_stepperTRK->currentPosition());
_stepperTRK->setSpeed(_trackingSpeed);
_mountStatus &= ~STATUS_GUIDE_PULSE_RA;
}

if (dec && (_mountStatus & STATUS_GUIDE_PULSE_DEC))
{
LOG(DEBUG_STEPPERS, "[STEPPERS]: stopGuiding(DEC): Stop motor");
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: stopGuide: DEC stop guide at : %l", _stepperGUIDE->currentPosition());

// Stop DEC guiding and wait for it to stop.
_stepperGUIDE->stop();
Expand All @@ -1558,16 +1562,20 @@ void Mount::stopGuiding(bool ra, bool dec)
_stepperTRK->runSpeed();
}

LOG(DEBUG_STEPPERS, "[STEPPERS]: stopGuiding(DEC): GuideStepper stopped at %l", _stepperGUIDE->currentPosition());

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

//disable pulse state if no direction is active
if ((_mountStatus & STATUS_GUIDE_PULSE_DIR) == 0)
{
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: Clear guiding state");
_mountStatus &= ~STATUS_GUIDE_PULSE_MASK;
}
else
{
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: One axis still guiding");
}
}

/////////////////////////////////
Expand All @@ -1577,7 +1585,26 @@ void Mount::stopGuiding(bool ra, bool dec)
/////////////////////////////////
void Mount::guidePulse(byte direction, int duration)
{
LOG(DEBUG_STEPPERS, "[STEPPERS]: guidePulse: > Guide Pulse %d for %dms", direction, duration);
#if (DEBUG_LEVEL & (DEBUG_STEPPERS | DEBUG_GUIDE))
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: 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));
}
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));
}

// DEC stepper moves at sidereal rate in both directions
// RA stepper moves at either 2.5x sidereal rate or 0.5x sidereal rate.
Expand All @@ -1586,7 +1613,6 @@ void Mount::guidePulse(byte direction, int duration)
/ 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
raGuidingSpeed *= _trackingSpeedCalibration;

// 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,
Expand All @@ -1596,30 +1622,46 @@ void Mount::guidePulse(byte direction, int duration)
switch (direction)
{
case NORTH:
LOG(DEBUG_STEPPERS, "[STEPPERS]: guidePulse: DEC.setSpeed(%f)", DEC_PULSE_MULTIPLIER * decGuidingSpeed);
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, "[STEPPERS]: guidePulse: DEC.setSpeed(%f)", -DEC_PULSE_MULTIPLIER * decGuidingSpeed);
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, "[STEPPERS]: guidePulse: TRK.setSpeed(%f)", (RA_PULSE_MULTIPLIER * raGuidingSpeed));
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, "[STEPPERS]: guidePulse: TRK.setSpeed(%f)", (raGuidingSpeed * (2.0f - RA_PULSE_MULTIPLIER)));
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;
Expand All @@ -1630,7 +1672,7 @@ void Mount::guidePulse(byte direction, int duration)
updateInfoDisplay();
#endif

LOG(DEBUG_STEPPERS, "[STEPPERS]: guidePulse: < Guide Pulse");
LOG(DEBUG_STEPPERS | DEBUG_GUIDE, "[GUIDE]: guidePulse: < Guide Pulse");
}

/////////////////////////////////
Expand Down

0 comments on commit 400a3cc

Please sign in to comment.