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
13 changes: 13 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
**V1.12.6 - Updates**
- Fixed all known issues related to running in the southern hemisphere.
- Added support for DIR inversion to interrupt stepper library.
- Hemisphere no longer needs to be defined in config, firmware determines it automatically from the given Latitude, switching at the equator.
- Fixed the logic in Sync call to account for both hemispheres.
- Fixed some logic that stopped tracking when setting home position.
- Fixed a bug that caused the firmware to fail to recognize the end of very short slews.
- Added Meade Extension command to query remaining tracking time
- Added Meade Extension command to query the hemisphere that is set.

**V1.12.5 - Updates**
- Bound interrupt stepper library to version 0.0.1.

**V1.12.4 - Updates**
- Fixed a bug that incorrectly stopped the RA motor after issuing a DEC move.

Expand Down
2 changes: 1 addition & 1 deletion Configuration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#error You have to specify the board
#endif

// Set to 1 for the northern hemisphere, 0 otherwise
// Default to northern hemisphere
#ifndef NORTHERN_HEMISPHERE
#define NORTHERN_HEMISPHERE 1
#endif
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.12.4"
#define VERSION "V1.12.6"
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ debug_build_flags =
lib_deps =
${common.lib_deps}
jdolinay/avr-debugger @ 1.2
https://github.com/andre-stefanov/avr-interrupt-stepper
https://github.com/andre-stefanov/avr-interrupt-stepper@0.0.2

[env:mksgenlv21]
extends = env:ramps
Expand Down
32 changes: 18 additions & 14 deletions src/Declination.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "../Configuration.hpp" // For NORTHERN_HEMISPHERE only
#include "./inc/Globals.hpp"
#include "../Configuration.hpp"
#include "Utility.hpp"
#include "Declination.hpp"

Expand All @@ -11,13 +12,13 @@
// Parses the RA or DEC from a string that has an optional sign, a two digit degree, a seperator, a two digit minute, a seperator and a two digit second.
// For example: -45*32:11 or 23:44:22

// In the northern hemisphere, 0 is north pole, 180 and -180 is south pole
// In the NORTHERN hemisphere, 0 is north pole, 180 and -180 is south pole
//------------------ S---------------------------------------- N ---------------------------------- S
// Celestial -90 -60 -30 0 30 60 90 60 30 0 -30 -60 -90
// Celestial = 90 - abs(Declination)
// Declination -180 -150 -120 -90 -60 -30 0 30 60 90 120 150 180

// In the southern hemisphere, 0 is south pole, 180 and -180 is north pole
// In the SOUTHERN hemisphere, 0 is south pole, 180 and -180 is north pole
//------------------ N---------------------------------------- S ---------------------------------- N
// Celestial 90 60 30 0 -30 -60 -90 -60 -30 0 30 60 90
// Celestial = -90 + abs(Declination)
Expand Down Expand Up @@ -87,7 +88,9 @@ const char *Declination::ToString() const

*p++ = ' ';
*p++ = '(';
strcpy(p, String(NORTHERN_HEMISPHERE ? 90 - fabsf(getTotalHours()) : -90 + fabsf(getTotalHours()), 4).c_str());
strcpy(p, String(inNorthernHemisphere ? 90 - fabsf(getTotalHours()) : -90 + fabsf(getTotalHours()), 4).c_str());
strcat(p, ", ");
strcat(p, String(getTotalHours(), 4).c_str());
strcat(p, ")");

return achBufDeg;
Expand All @@ -96,32 +99,33 @@ const char *Declination::ToString() const
Declination Declination::ParseFromMeade(String const &s)
{
Declination result;
LOG(DEBUG_GENERAL, "[DECLINATION]: Declination.Parse(%s)", s.c_str());
LOG(DEBUG_MEADE, "[DECLINATION]: Declination.Parse(%s) for %s Hemi", s.c_str(), inNorthernHemisphere ? "N" : "S");

// Use the DayTime code to parse it...
DayTime dt = DayTime::ParseFromMeade(s);
LOG(DEBUG_MEADE, "[DECLINATION]: Declination DayTime is %l secs", dt.getTotalSeconds());

// ...and then correct for hemisphere
result.totalSeconds = NORTHERN_HEMISPHERE ? (arcSecondsPerHemisphere / 2) - dt.getTotalSeconds()
: -(arcSecondsPerHemisphere / 2) + dt.getTotalSeconds();
LOG(DEBUG_GENERAL, "[DECLINATION]: Declination.Parse(%s) -> %s (%l)", s.c_str(), result.ToString(), result.totalSeconds);
result.totalSeconds = inNorthernHemisphere ? (arcSecondsPerHemisphere / 2) - labs(dt.getTotalSeconds())
: -(arcSecondsPerHemisphere / 2) + labs(dt.getTotalSeconds());
LOG(DEBUG_MEADE, "[DECLINATION]: Adjust for hemisphere. %s -> %s (%l secs)", s.c_str(), result.ToString(), result.totalSeconds);
return result;
}

Declination Declination::FromSeconds(long seconds)
{
const auto secondsFloat = static_cast<float>(seconds);
const auto arcSecondsPerHemisphereFloat = static_cast<float>(arcSecondsPerHemisphere);
#if NORTHERN_HEMISPHERE == 1
return Declination(((arcSecondsPerHemisphereFloat / 2.0f) - secondsFloat) / 3600.0f);
#else
return Declination(((-arcSecondsPerHemisphereFloat / 2.0f) + secondsFloat) / 3600.0f);
#endif
if (inNorthernHemisphere)
{
return Declination(((arcSecondsPerHemisphereFloat / 2.0f) - secondsFloat) / 3600.0f);
}
return Declination(((arcSecondsPerHemisphereFloat / 2.0f) + secondsFloat) / 3600.0f);
}

const char *Declination::formatString(char *targetBuffer, const char *format, long *) const
{
long secs
= NORTHERN_HEMISPHERE ? (arcSecondsPerHemisphere / 2) - labs(totalSeconds) : -(arcSecondsPerHemisphere / 2) + labs(totalSeconds);
= inNorthernHemisphere ? (arcSecondsPerHemisphere / 2) - labs(totalSeconds) : -(arcSecondsPerHemisphere / 2) + labs(totalSeconds);
return DayTime::formatString(targetBuffer, format, &secs);
}
2 changes: 1 addition & 1 deletion src/InterruptAccelStepper.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ template <typename STEPPER> class InterruptAccelStepper

void setPinsInverted(bool directionInvert = false, bool stepInvert = false, bool enableInvert = false)
{
// STUB
STEPPER::setInverted(directionInvert);
}

bool isRunning()
Expand Down
4 changes: 2 additions & 2 deletions src/Latitude.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ Latitude Latitude::ParseFromMeade(String const &s)
{
Latitude result(0.0);

LOG(DEBUG_GENERAL, "[LATITUDE]: Latitude.Parse(%s)", s.c_str());
LOG(DEBUG_MEADE, "[LATITUDE]: Latitude.Parse(%s)", s.c_str());
// Use the DayTime code to parse it.
DayTime dt = DayTime::ParseFromMeade(s);
result.totalSeconds = dt.getTotalSeconds();
result.checkHours();
LOG(DEBUG_GENERAL, "[LATITUDE]: Latitude.Parse(%s) -> %s", s.c_str(), result.ToString());
LOG(DEBUG_MEADE, "[LATITUDE]: Latitude.Parse(%s) -> %s", s.c_str(), result.ToString());
return result;
}
4 changes: 2 additions & 2 deletions src/Longitude.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void Longitude::checkHours()
Longitude Longitude::ParseFromMeade(String const &s)
{
Longitude result(0.0);
LOG(DEBUG_GENERAL, "[LONGITUDE]: Parse(%s)", s.c_str());
LOG(DEBUG_MEADE, "[LONGITUDE]: Parse(%s)", s.c_str());

// Use the DayTime code to parse it.
DayTime dt = DayTime::ParseFromMeade(s);
Expand All @@ -52,7 +52,7 @@ Longitude Longitude::ParseFromMeade(String const &s)
}
result.checkHours();

LOG(DEBUG_GENERAL, "[LONGITUDE]: Parse(%s) -> %s = %ls", s.c_str(), result.ToString(), result.getTotalSeconds());
LOG(DEBUG_MEADE, "[LONGITUDE]: Parse(%s) -> %s = %ls", s.c_str(), result.ToString(), result.getTotalSeconds());
return result;
}

Expand Down
49 changes: 41 additions & 8 deletions src/MeadeCommandProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,14 @@ bool gpsAqcuisitionComplete(int &indicator); // defined in c72_menuHA_GPS.hpp
// Returns:
// "float#"
//
// :XGST#
// Description:
// Get Remaining Safe Time
// Information:
// Get the number of hours before the RA ring reaches its end.
// Returns:
// "float#"
//
// :XGT#
// Description:
// Get Tracking speed
Expand All @@ -796,6 +804,15 @@ bool gpsAqcuisitionComplete(int &indicator); // defined in c72_menuHA_GPS.hpp
// Returns:
// "n#" - the number of steps from the center of the hall sensor trigger range to the home position.
//
// :XGHS#
// Description:
// Get Hemisphere
// Information:
// Get the hemisphere that the OAT currently assumes it is operating in. This is set via setting Latitude (see ":St" command)
// Returns:
// "N#" - for northern hemisphere
// "S#" - for southern hemisphere
//
// :XGM#
// Description:
// Get Mount configuration settings
Expand Down Expand Up @@ -1346,7 +1363,7 @@ String MeadeCommandProcessor::handleMeadeSetInfo(String inCmd)
}
else if (inCmd[1] == 'P')
{
// Set home point
// Set home point :SHP#
_mount->setHome(false);
}
else
Expand Down Expand Up @@ -1685,9 +1702,16 @@ String MeadeCommandProcessor::handleMeadeExtraCommands(String inCmd)
return String(_mount->getStepsPerDegree(DEC_STEPS), 1) + "#";
}
}
else if (inCmd[1] == 'S') // :XGS#
else if (inCmd[1] == 'S')
{
return String(_mount->getSpeedCalibration(), 5) + "#";
if (inCmd.length() == 2) // :XGS#
{
return String(_mount->getSpeedCalibration(), 5) + "#";
}
else if ((inCmd.length() == 3) && (inCmd[2] == 'T')) // :XGST#
{
return String(_mount->checkRALimit(), 7) + "#";
}
}
else if (inCmd[1] == 'T') // :XGT#
{
Expand Down Expand Up @@ -1726,9 +1750,16 @@ String MeadeCommandProcessor::handleMeadeExtraCommands(String inCmd)
}
else if (inCmd[1] == 'H') // :XGH#
{
if (inCmd.length() > 2 && inCmd[2] == 'R') // :XGHR#
if (inCmd.length() > 2)
{
return String(_mount->getHomingOffset(StepperAxis::RA_STEPS)) + "#";
if (inCmd[2] == 'R') // :XGHR#
{
return String(_mount->getHomingOffset(StepperAxis::RA_STEPS)) + "#";
}
else if (inCmd[2] == 'S') // :XGHS#
{
return String(inNorthernHemisphere ? "N#" : "S#");
}
}
else if (inCmd.length() > 2 && inCmd[2] == 'D') // :XGHD#
{
Expand Down Expand Up @@ -1840,12 +1871,14 @@ String MeadeCommandProcessor::handleMeadeExtraCommands(String inCmd)
{
_mount->setBacklashCorrection(inCmd.substring(2).toInt());
}

else if (inCmd[1] == 'H') // :XSH
{
if (inCmd.length() > 2 && inCmd[2] == 'R') // :XSHR
if (inCmd.length() > 2)
{
_mount->setHomingOffset(StepperAxis::RA_STEPS, inCmd.substring(3).toInt());
if (inCmd[2] == 'R') // :XSHR
{
_mount->setHomingOffset(StepperAxis::RA_STEPS, inCmd.substring(3).toInt());
}
}
else if (inCmd.length() > 2 && inCmd[2] == 'D') // :XSHD
{
Expand Down
Loading