Skip to content

Commit 4e8e6f5

Browse files
V1.6.31 - Updates
- Previous code didn't even compile.... QA much? - Fixed Serial CM function to compile. - Changed the guiding code slightly to not move to a target, but run at constant speed.
1 parent 78e72b9 commit 4e8e6f5

File tree

3 files changed

+41
-43
lines changed

3 files changed

+41
-43
lines changed

Software/Arduino code/OpenAstroTracker/Mount.cpp

Lines changed: 38 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ void Mount::configureRAStepper(byte stepMode, byte pin1, byte pin2, byte pin3, b
7575
_stepperRA = new AccelStepper(stepMode, pin1, pin2, pin3, pin4);
7676
_stepperRA->setMaxSpeed(maxSpeed);
7777
_stepperRA->setAcceleration(maxAcceleration);
78-
// _maxRASpeed = maxSpeed;
79-
// _maxRAAcceleration = maxAcceleration;
78+
// _maxRASpeed = maxSpeed;
79+
// _maxRAAcceleration = maxAcceleration;
8080

8181
// Use another AccelStepper to run the RA motor as well. This instance tracks earths rotation.
8282
_stepperTRK = new AccelStepper(HALFSTEP, pin1, pin2, pin3, pin4);
@@ -264,25 +264,6 @@ void Mount::syncDEC(int degree, int minute, int second) {
264264
_stepperDEC->setCurrentPosition(targetDEC);
265265
}
266266

267-
/////////////////////////////////
268-
//
269-
// stopGuiding
270-
//
271-
/////////////////////////////////
272-
void Mount::stopGuiding() {
273-
_stepperDEC->stop();
274-
while (_stepperDEC->isRunning()) {
275-
_stepperDEC->run();
276-
}
277-
_stepperDEC->setMaxSpeed(_maxDECSpeed);
278-
_stepperDEC->setAcceleration(_maxDECAcceleration);
279-
_stepperTRK->setMaxSpeed(10);
280-
_stepperTRK->setAcceleration(2500);
281-
_stepperTRK->setSpeed(_trackingSpeed);
282-
_stepperTRK->runSpeed();
283-
_mountStatus &= ~STATUS_GUIDE_PULSE_MASK;
284-
}
285-
286267
/////////////////////////////////
287268
//
288269
// startSlewingToTarget
@@ -307,44 +288,61 @@ void Mount::startSlewingToTarget() {
307288
_totalRAMove = 1.0f * _stepperRA->distanceToGo();
308289
}
309290

291+
/////////////////////////////////
292+
//
293+
// stopGuiding
294+
//
295+
/////////////////////////////////
296+
void Mount::stopGuiding() {
297+
_stepperDEC->stop();
298+
while (_stepperDEC->isRunning()) {
299+
_stepperDEC->run();
300+
}
301+
302+
_stepperDEC->setMaxSpeed(_maxDECSpeed);
303+
_stepperDEC->setAcceleration(_maxDECAcceleration);
304+
_stepperTRK->setMaxSpeed(10);
305+
_stepperTRK->setAcceleration(2500);
306+
_stepperTRK->setSpeed(_trackingSpeed);
307+
_mountStatus &= ~STATUS_GUIDE_PULSE_MASK;
308+
}
309+
310310
/////////////////////////////////
311311
//
312312
// guidePulse
313313
//
314314
/////////////////////////////////
315315
void Mount::guidePulse(byte direction, int duration) {
316-
// How many steps moves the RA ring one sidereal hour along. One sidereal hour moves just shy of 15 degrees
317-
// NOTE: May need to adjust with _trackingSpeedCalibration
318-
float decStepsPerSiderealHour = _stepsPerDECDegree * siderealDegreesInHour;
319-
float decStepsForDuration = decStepsPerSiderealHour * duration / 3600000;
320-
float raStepsPerSiderealHour = _stepsPerRADegree * siderealDegreesInHour;
321-
float raStepsForDuration = raStepsPerSiderealHour * duration / 3600000;
322-
316+
// DEC stepper moves at sidereal rate in both directions
317+
// RA stepper moves at either 2x sidereal rate or stops.
318+
// TODO: Do we need to adjust with _trackingSpeedCalibration?
323319
float decTrackingSpeed = _stepsPerDECDegree * siderealDegreesInHour / 3600.0f;
324320
float raTrackingSpeed = _stepsPerRADegree * siderealDegreesInHour / 3600.0f;
325321

326-
long raPos = _stepperRA->currentPosition();
327-
long decPos = _stepperDEC->currentPosition();
322+
// TODO: Do we need to track how many steps the steppers took and add them to the GoHome calculation?
323+
// If so, we need to remember where we were when we started the guide pulse. Then at the end,
324+
// we can calculate the difference.
325+
// long raPos = _stepperTRK->currentPosition();
326+
// long decPos = _stepperDEC->currentPosition();
328327

329328
switch (direction) {
330329
case NORTH:
330+
_stepperDEC->setAcceleration(2500);
331331
_stepperDEC->setMaxSpeed(decTrackingSpeed * 1.2);
332332
_stepperDEC->setSpeed(decTrackingSpeed);
333-
_stepperDEC->moveTo(decPos + decStepsForDuration);
334333
_mountStatus |= STATUS_GUIDE_PULSE | STATUS_GUIDE_PULSE_DEC ;
335334
break;
336335

337336
case SOUTH:
337+
_stepperDEC->setAcceleration(2500);
338338
_stepperDEC->setMaxSpeed(decTrackingSpeed * 1.2);
339-
_stepperDEC->setSpeed(decTrackingSpeed);
340-
_stepperDEC->moveTo(decPos - decStepsForDuration);
339+
_stepperDEC->setSpeed(-decTrackingSpeed);
341340
_mountStatus |= STATUS_GUIDE_PULSE | STATUS_GUIDE_PULSE_DEC ;
342341
break;
343342

344343
case WEST:
345344
_stepperTRK->setMaxSpeed(raTrackingSpeed * 2.2);
346345
_stepperTRK->setSpeed(raTrackingSpeed * 2);
347-
_stepperTRK->moveTo(raPos + raStepsForDuration);
348346
_mountStatus |= STATUS_GUIDE_PULSE | STATUS_GUIDE_PULSE_RA;
349347
break;
350348

@@ -417,8 +415,8 @@ String Mount::mountStatusString() {
417415
if (_mountStatus & STATUS_PARKING) {
418416
disp = "PARKNG ";
419417
}
420-
else if (isGuiding()){
421-
disp = "GUIDING ";
418+
else if (isGuiding()) {
419+
disp = "GUIDING ";
422420
}
423421
else {
424422
if (_mountStatus & STATUS_TRACKING) disp += "TRK ";
@@ -861,8 +859,8 @@ void Mount::moveSteppersTo(float targetRA, float targetDEC) {
861859
//
862860
/////////////////////////////////
863861
void Mount::displayStepperPosition() {
864-
#ifndef HEADLESS_CLIENT
865-
862+
#ifndef HEADLESS_CLIENT
863+
866864
String disp ;
867865

868866
if ((abs(_totalDECMove) > 0.001) && (abs(_totalRAMove) > 0.001)) {
@@ -926,13 +924,13 @@ void Mount::displayStepperPosition() {
926924
//
927925
/////////////////////////////////
928926
void Mount::displayStepperPositionThrottled() {
929-
#ifndef HEADLESS_CLIENT
927+
#ifndef HEADLESS_CLIENT
930928
long elapsed = millis() - _lastDisplayUpdate;
931929
if (elapsed > DISPLAY_UPDATE_TIME) {
932930
displayStepperPosition();
933931
_lastDisplayUpdate = millis();
934932
}
935-
#endif
933+
#endif
936934
}
937935

938936
/////////////////////////////////

Software/Arduino code/OpenAstroTracker/OpenAstroTracker.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717
#include "Globals.h"
1818

19-
String version = "V1.6.30";
19+
String version = "V1.6.31";
2020

2121
///////////////////////////////////////////////////////////////////////////
2222
// Please see the Globals.h file for configuration of the firmware.

Software/Arduino code/OpenAstroTracker/f_serial.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ void handleMeadeGetInfo(String inCmd) {
221221
/////////////////////////////
222222
void handleMeadeSyncControl(String inCmd) {
223223
if (inCmd[0] == 'M') {
224-
mount.syncDEC(mount.targetDEC().getHours(), mount.targetDEC().getMinutes(), mount.targetDEC().getSeconds(),);
225-
mount.syncRA(mount.targetRA().getHours(), mount.targetRA.getMinutes()(), mount.targetRA().getSeconds());
224+
mount.syncDEC(mount.targetDEC().getHours(), mount.targetDEC().getMinutes(), mount.targetDEC().getSeconds());
225+
mount.syncRA(mount.targetRA().getHours(), mount.targetRA().getMinutes(), mount.targetRA().getSeconds());
226226
Serial.print("NONE#");
227227
}
228228
else {

0 commit comments

Comments
 (0)