Skip to content

Commit f384c2d

Browse files
Merge branch 'develop' of https://github.com/OpenAstroTech/OpenAstroTracker-Firmware into develop
2 parents 55b684a + fe334e7 commit f384c2d

File tree

5 files changed

+69
-47
lines changed

5 files changed

+69
-47
lines changed

Changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
**V1.12.4 - Updates**
2+
- Fixed a bug that incorrectly stopped the RA motor after issuing a DEC move.
3+
14
**V1.12.3 - Updates**
25
- Fixed a bug that incorrectly calculated minimum stepper frequency. This caused Tracking to never run.
36

Version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
// Also, numbers are interpreted as simple numbers. _ __ _
44
// So 1.8 is actually 1.08, meaning that 1.12 is a later version than 1.8. \_(..)_/
55

6-
#define VERSION "V1.12.3"
6+
#define VERSION "V1.12.4"

src/Mount.cpp

Lines changed: 63 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,7 +1317,7 @@ void Mount::startSlewingToTarget()
13171317
}
13181318

13191319
_mountStatus |= STATUS_SLEWING | STATUS_SLEWING_TO_TARGET;
1320-
moveSteppersTo(targetRAPosition, targetDECPosition); // u-steps (in slew mode)
1320+
moveSteppersTo(targetRAPosition, targetDECPosition, RA_AND_DEC_STEPS); // u-steps (in slew mode)
13211321
_totalDECMove = 1.0f * _stepperDEC->distanceToGo();
13221322
_totalRAMove = 1.0f * _stepperRA->distanceToGo();
13231323
LOG(DEBUG_MOUNT, "[MOUNT]: RA Dist: %l, DEC Dist: %l", _stepperRA->distanceToGo(), _stepperDEC->distanceToGo());
@@ -1383,7 +1383,7 @@ void Mount::startSlewingToHome()
13831383
}
13841384

13851385
_mountStatus |= STATUS_SLEWING | STATUS_SLEWING_TO_TARGET;
1386-
moveSteppersTo(targetRAPosition, targetDECPosition); // u-steps (in slew mode)
1386+
moveSteppersTo(targetRAPosition, targetDECPosition, RA_AND_DEC_STEPS); // u-steps (in slew mode)
13871387
_totalDECMove = static_cast<float>(_stepperDEC->distanceToGo());
13881388
_totalRAMove = static_cast<float>(_stepperRA->distanceToGo());
13891389
LOG(DEBUG_MOUNT, "[MOUNT]: RA Dist: %l, DEC Dist: %l", _stepperRA->distanceToGo(), _stepperDEC->distanceToGo());
@@ -3229,45 +3229,51 @@ void Mount::calculateRAandDECSteppers(long &targetRASteps, long &targetDECSteps,
32293229
// moveSteppersTo
32303230
//
32313231
/////////////////////////////////
3232-
void Mount::moveSteppersTo(float targetRASteps, float targetDECSteps)
3232+
void Mount::moveSteppersTo(float targetRASteps, float targetDECSteps, StepperAxis direction)
32333233
{ // Units are u-steps (in slew mode)
32343234
// Show time: tell the steppers where to go!
32353235
_correctForBacklash = false;
32363236
LOG(DEBUG_STEPPERS, "[STEPPERS]: MoveSteppersTo: RA From: %l To: %f", _stepperRA->currentPosition(), targetRASteps);
32373237
LOG(DEBUG_STEPPERS, "[STEPPERS]: MoveSteppersTo: DEC From: %l To: %f", _stepperDEC->currentPosition(), targetDECSteps);
32383238

3239-
if ((_backlashCorrectionSteps != 0) && ((_stepperRA->currentPosition() - targetRASteps) > 0))
3239+
if ((direction == RA_AND_DEC_STEPS) || (direction == RA_STEPS))
32403240
{
3241-
LOG(DEBUG_STEPPERS, "[STEPPERS]: MoveSteppersTo: Needs backlash correction of %d!", _backlashCorrectionSteps);
3242-
targetRASteps -= _backlashCorrectionSteps;
3243-
_correctForBacklash = true;
3244-
}
3245-
3246-
_stepperRA->moveTo(targetRASteps);
3247-
3248-
if (_decUpperLimit != 0)
3249-
{
3250-
#if DEBUG_LEVEL > 0
3251-
if (targetDECSteps > (float) _decUpperLimit)
3241+
if ((_backlashCorrectionSteps != 0) && ((_stepperRA->currentPosition() - targetRASteps) > 0))
32523242
{
3253-
LOG(DEBUG_STEPPERS, "[STEPPERS]: MoveSteppersTo: DEC Upper Limit enforced. To: %l", _decUpperLimit);
3243+
LOG(DEBUG_STEPPERS, "[STEPPERS]: MoveSteppersTo: Needs backlash correction of %d!", _backlashCorrectionSteps);
3244+
targetRASteps -= _backlashCorrectionSteps;
3245+
_correctForBacklash = true;
32543246
}
3255-
#endif
3256-
targetDECSteps = min(targetDECSteps, (float) _decUpperLimit);
3247+
3248+
_stepperRA->moveTo(targetRASteps);
32573249
}
32583250

3259-
if (_decLowerLimit != 0)
3251+
if ((direction == RA_AND_DEC_STEPS) || (direction == DEC_STEPS))
32603252
{
3261-
#if DEBUG_LEVEL > 0
3262-
if (targetDECSteps < (float) _decLowerLimit)
3253+
if (_decUpperLimit != 0)
32633254
{
3264-
LOG(DEBUG_STEPPERS, "[STEPPERS]: MoveSteppersTo: DEC Lower Limit enforced. To: %l", _decLowerLimit);
3255+
#if DEBUG_LEVEL > 0
3256+
if (targetDECSteps > (float) _decUpperLimit)
3257+
{
3258+
LOG(DEBUG_STEPPERS, "[STEPPERS]: MoveSteppersTo: DEC Upper Limit enforced. To: %l", _decUpperLimit);
3259+
}
3260+
#endif
3261+
targetDECSteps = min(targetDECSteps, (float) _decUpperLimit);
32653262
}
3263+
3264+
if (_decLowerLimit != 0)
3265+
{
3266+
#if DEBUG_LEVEL > 0
3267+
if (targetDECSteps < (float) _decLowerLimit)
3268+
{
3269+
LOG(DEBUG_STEPPERS, "[STEPPERS]: MoveSteppersTo: DEC Lower Limit enforced. To: %l", _decLowerLimit);
3270+
}
32663271
#endif
3267-
targetDECSteps = max(targetDECSteps, (float) _decLowerLimit);
3268-
}
3272+
targetDECSteps = max(targetDECSteps, (float) _decLowerLimit);
3273+
}
32693274

3270-
_stepperDEC->moveTo(targetDECSteps);
3275+
_stepperDEC->moveTo(targetDECSteps);
3276+
}
32713277
}
32723278

32733279
/////////////////////////////////
@@ -3278,12 +3284,14 @@ void Mount::moveSteppersTo(float targetRASteps, float targetDECSteps)
32783284
void Mount::moveStepperBy(StepperAxis direction, long steps)
32793285
{
32803286
LOG(DEBUG_STEPPERS, "[STEPPERS]: moveStepperBy: %l", steps);
3287+
32813288
switch (direction)
32823289
{
3290+
case RA_AND_DEC_STEPS:
3291+
LOG(DEBUG_STEPPERS, "[STEPPERS]: moveStepperBy: MoveStepperBy does not support multiple axes.");
3292+
break;
3293+
32833294
case RA_STEPS:
3284-
moveSteppersTo(_stepperRA->targetPosition() + steps, _stepperDEC->targetPosition());
3285-
_mountStatus |= STATUS_SLEWING | STATUS_SLEWING_TO_TARGET;
3286-
_totalRAMove = 1.0f * _stepperRA->distanceToGo();
32873295
if (steps != 0)
32883296
{
32893297
// Only stop tracking if we're actually going to slew somewhere else, otherwise the
@@ -3301,43 +3309,53 @@ void Mount::moveStepperBy(StepperAxis direction, long steps)
33013309
LOG(DEBUG_STEPPERS, "[STEPPERS]: moveStepperBy: Switching RA driver to microsteps(%d)", RA_SLEW_MICROSTEPPING);
33023310
_driverRA->microsteps(RA_SLEW_MICROSTEPPING == 1 ? 0 : RA_SLEW_MICROSTEPPING);
33033311
#endif
3304-
moveSteppersTo(_stepperRA->currentPosition() + steps, _stepperDEC->currentPosition());
3312+
moveSteppersTo(_stepperRA->currentPosition() + steps, 0, direction);
33053313
_mountStatus |= STATUS_SLEWING | STATUS_SLEWING_TO_TARGET;
33063314
_totalRAMove = 1.0f * _stepperRA->distanceToGo();
33073315
break;
33083316

33093317
case DEC_STEPS:
3310-
moveSteppersTo(_stepperRA->currentPosition(), _stepperDEC->currentPosition() + steps);
3311-
_mountStatus |= STATUS_SLEWING | STATUS_SLEWING_TO_TARGET;
3312-
_totalDECMove = 1.0f * _stepperDEC->distanceToGo();
3318+
{
3319+
moveSteppersTo(0, _stepperDEC->currentPosition() + steps, direction);
3320+
_mountStatus |= STATUS_SLEWING | STATUS_SLEWING_TO_TARGET;
3321+
_totalDECMove = 1.0f * _stepperDEC->distanceToGo();
33133322

33143323
#if DEC_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART
3315-
// Since normal state for DEC is guide microstepping, switch to slew microstepping here.
3316-
LOG(DEBUG_STEPPERS, "[STEPPERS]: moveStepperBy: Switching DEC driver to microsteps(%d)", DEC_SLEW_MICROSTEPPING);
3317-
_driverDEC->microsteps(DEC_SLEW_MICROSTEPPING == 1 ? 0 : DEC_SLEW_MICROSTEPPING);
3324+
// Since normal state for DEC is guide microstepping, switch to slew microstepping here.
3325+
LOG(DEBUG_STEPPERS, "[STEPPERS]: moveStepperBy: Switching DEC driver to microsteps(%d)", DEC_SLEW_MICROSTEPPING);
3326+
_driverDEC->microsteps(DEC_SLEW_MICROSTEPPING == 1 ? 0 : DEC_SLEW_MICROSTEPPING);
33183327
#endif
3319-
3328+
}
33203329
break;
3330+
33213331
case FOCUS_STEPS:
3332+
{
33223333
#if FOCUS_STEPPER_TYPE != STEPPER_TYPE_NONE
3323-
focusMoveBy(steps);
3334+
focusMoveBy(steps);
33243335
#endif
3336+
}
33253337
break;
3338+
33263339
case AZIMUTH_STEPS:
3340+
{
33273341
#if AZ_STEPPER_TYPE != STEPPER_TYPE_NONE
3328-
enableAzAltMotors();
3329-
LOG(DEBUG_STEPPERS,
3330-
"[STEPPERS]: moveStepperBy: AZ from %l to %l",
3331-
_stepperAZ->currentPosition(),
3332-
_stepperAZ->currentPosition() + steps);
3333-
_stepperAZ->moveTo(_stepperAZ->currentPosition() + steps);
3342+
enableAzAltMotors();
3343+
LOG(DEBUG_STEPPERS,
3344+
"[STEPPERS]: moveStepperBy: AZ from %l to %l",
3345+
_stepperAZ->currentPosition(),
3346+
_stepperAZ->currentPosition() + steps);
3347+
_stepperAZ->moveTo(_stepperAZ->currentPosition() + steps);
33343348
#endif
3349+
}
33353350
break;
3351+
33363352
case ALTITUDE_STEPS:
3353+
{
33373354
#if ALT_STEPPER_TYPE != STEPPER_TYPE_NONE
3338-
enableAzAltMotors();
3339-
_stepperALT->moveTo(_stepperALT->currentPosition() + steps);
3355+
enableAzAltMotors();
3356+
_stepperALT->moveTo(_stepperALT->currentPosition() + steps);
33403357
#endif
3358+
}
33413359
break;
33423360
}
33433361
}

src/Mount.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ class Mount
473473

474474
void calculateRAandDECSteppers(long &targetRASteps, long &targetDECSteps, long pSolutions[6] = nullptr) const;
475475
void displayStepperPosition();
476-
void moveSteppersTo(float targetRA, float targetDEC);
476+
void moveSteppersTo(float targetRA, float targetDEC, StepperAxis direction);
477477

478478
void autoCalcHa();
479479

src/Types.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ enum StepperAxis
55
{
66
RA_STEPS,
77
DEC_STEPS,
8+
RA_AND_DEC_STEPS,
89
AZIMUTH_STEPS,
910
ALTITUDE_STEPS,
1011
FOCUS_STEPS

0 commit comments

Comments
 (0)