@@ -234,8 +234,8 @@ void Mount::syncRA(int hour, int minute, int second) {
234
234
newHA.addTime (deltaRA);
235
235
setHA (newHA);
236
236
237
- float targetRA,targetDEC;
238
- calculateRAandDECSteppers (targetRA,targetDEC);
237
+ float targetRA, targetDEC;
238
+ calculateRAandDECSteppers (targetRA, targetDEC);
239
239
_stepperRA->setCurrentPosition (targetRA);
240
240
}
241
241
@@ -246,11 +246,10 @@ void Mount::syncRA(int hour, int minute, int second) {
246
246
// ///////////////////////////////
247
247
// Set the current DEC position to be the given degrees (which are 0 .. -180 for Northern Hemisphere)
248
248
void Mount::syncDEC (int degree, int minute, int second) {
249
- Serial.println (" SyncDEC: " + String (degree) + " :" + String (minute) + " :" + String (second));
250
249
_currentDEC = DegreeTime (degree, minute, second);
251
250
_targetDEC = _currentDEC;
252
- float targetRA,targetDEC;
253
- calculateRAandDECSteppers (targetRA,targetDEC);
251
+ float targetRA, targetDEC;
252
+ calculateRAandDECSteppers (targetRA, targetDEC);
254
253
_stepperDEC->setCurrentPosition (targetDEC);
255
254
}
256
255
@@ -262,13 +261,12 @@ void Mount::syncDEC(int degree, int minute, int second) {
262
261
// Calculates movement parameters and program steppers to move
263
262
// there. Must call loop() frequently to actually move.
264
263
void Mount::startSlewingToTarget () {
265
- // Serial.println("StSlew2Trgt!");
266
264
// Calculate new RA stepper target (and DEC)
267
265
_currentDECStepperPosition = _stepperDEC->currentPosition ();
268
266
_currentRAStepperPosition = _stepperRA->currentPosition ();
269
- float targetRA,targetDEC;
270
- calculateRAandDECSteppers (targetRA,targetDEC);
271
- moveSteppersTo (targetRA,targetDEC);
267
+ float targetRA, targetDEC;
268
+ calculateRAandDECSteppers (targetRA, targetDEC);
269
+ moveSteppersTo (targetRA, targetDEC);
272
270
273
271
_mountStatus |= STATUS_SLEWING | STATUS_SLEWING_TO_TARGET;
274
272
_totalDECMove = 1 .0f * _stepperDEC->distanceToGo ();
@@ -394,7 +392,6 @@ bool Mount::isParked() {
394
392
// Starts manual slewing in one of eight directions or tracking
395
393
// ///////////////////////////////
396
394
void Mount::startSlewing (int direction) {
397
- // Serial.println("StrtSlew: > " + String(direction) + " " + mountStatusString());
398
395
if (direction & TRACKING) {
399
396
_stepperTRK->setSpeed (_trackingSpeed);
400
397
@@ -419,7 +416,6 @@ void Mount::startSlewing(int direction) {
419
416
_mountStatus |= STATUS_SLEWING;
420
417
}
421
418
}
422
- // Serial.println("StrtSlew: < " + mountStatusString());
423
419
}
424
420
425
421
// ///////////////////////////////
@@ -429,24 +425,18 @@ void Mount::startSlewing(int direction) {
429
425
// Stop manual slewing in one of two directions or Tracking. NS is the same. EW is the same
430
426
// ///////////////////////////////
431
427
void Mount::stopSlewing (int direction) {
432
- // Serial.println("StopSlw: > " + String(direction) + " " + mountStatusString());
433
428
if (direction & TRACKING) {
434
- // Serial.println("StpSlw: TRK OFF");
435
429
// Turn off tracking
436
430
_mountStatus &= ~STATUS_TRACKING;
437
431
_stepperTRK->stop ();
438
432
}
439
433
440
434
if ((direction & (NORTH | SOUTH)) != 0 ) {
441
435
_stepperDEC->stop ();
442
- // Serial.println("StpSlw: DEC OFF");
443
436
}
444
437
if ((direction & (WEST | EAST)) != 0 ) {
445
438
_stepperRA->stop ();
446
- // Serial.println("StpSlw: RA OFF");
447
439
}
448
-
449
- // Serial.println("StpSlw: < " + mountStatusString());
450
440
}
451
441
452
442
// ///////////////////////////////
@@ -537,7 +527,6 @@ void Mount::loop() {
537
527
_currentDEC = _targetDEC;
538
528
}
539
529
540
- // Serial.println("Loop: RA " + String(raStillRunning) + String(decStillRunning) );
541
530
displayStepperPositionThrottled ();
542
531
}
543
532
else {
@@ -553,7 +542,9 @@ void Mount::loop() {
553
542
554
543
// Make sure we do one last update when the steppers have stopped.
555
544
displayStepperPosition ();
556
- _lcdMenu->updateDisplay ();
545
+ if (!inSerialControl) {
546
+ _lcdMenu->updateDisplay ();
547
+ }
557
548
}
558
549
}
559
550
@@ -580,7 +571,6 @@ void Mount::setHome() {
580
571
// ///////////////////////////////
581
572
void Mount::setTargetToHome () {
582
573
float trackedSeconds = _stepperTRK->currentPosition () / _trackingSpeed; // steps/steps/s
583
- // Serial.println("Pos: " + String(stepperTRK->currentPosition()) + " Secs:" + String(trackedSeconds , 3));
584
574
585
575
// In order for RA coordinates to work correctly, we need to
586
576
// offset HATime by elapsed time since last HA set and also
@@ -685,16 +675,17 @@ void Mount::moveSteppersTo(float targetRA, float targetDEC) {
685
675
// ///////////////////////////////
686
676
void Mount::displayStepperPosition () {
687
677
String disp ;
678
+
688
679
if ((abs (_totalDECMove) > 0.001 ) && (abs (_totalRAMove) > 0.001 )) {
689
680
float decDist = 100.0 - 100.0 * _stepperDEC->distanceToGo () / _totalDECMove;
690
681
float raDist = 100.0 - 100.0 * _stepperRA->distanceToGo () / _totalRAMove;
691
682
692
- sprintf (scratchBuffer, " D %s %d%%" , DECString (LCD_STRING | CURRENT_STRING).c_str (), (int )decDist);
693
- _lcdMenu->setCursor (0 , 1 );
694
- _lcdMenu->printMenu (String (scratchBuffer));
695
683
sprintf (scratchBuffer, " R %s %d%%" , RAString (LCD_STRING | CURRENT_STRING).c_str (), (int )raDist);
696
684
_lcdMenu->setCursor (0 , 0 );
697
685
_lcdMenu->printMenu (String (scratchBuffer));
686
+ sprintf (scratchBuffer, " D %s %d%%" , DECString (LCD_STRING | CURRENT_STRING).c_str (), (int )decDist);
687
+ _lcdMenu->setCursor (0 , 1 );
688
+ _lcdMenu->printMenu (String (scratchBuffer));
698
689
return ;
699
690
}
700
691
else if (abs (_totalDECMove) > 0.001 ) {
@@ -707,13 +698,35 @@ void Mount::displayStepperPosition() {
707
698
float raDist = 100.0 - 100.0 * _stepperRA->distanceToGo () / _totalRAMove;
708
699
sprintf (scratchBuffer, " R %s %d%%" , RAString (LCD_STRING | CURRENT_STRING).c_str (), (int )raDist);
709
700
disp = disp + String (scratchBuffer);
710
- _lcdMenu->setCursor (0 , 1 );
701
+ _lcdMenu->setCursor (0 , inSerialControl ? 0 : 1 );
711
702
_lcdMenu->printMenu (String (scratchBuffer));
712
703
}
713
704
else {
714
- disp = " R:" + String (_stepperRA->currentPosition ()) + " D:" + String (_stepperDEC->currentPosition ()) ;
705
+ #ifdef SUPPORT_SERIAL_CONTROL
706
+ if (inSerialControl) {
707
+ sprintf (scratchBuffer, " RA: %s" , RAString (LCD_STRING | CURRENT_STRING).c_str ());
708
+ _lcdMenu->setCursor (0 , 0 );
709
+ _lcdMenu->printMenu (scratchBuffer);
710
+ sprintf (scratchBuffer, " DEC: %s" , DECString (LCD_STRING | CURRENT_STRING).c_str ());
711
+ _lcdMenu->setCursor (0 , 1 );
712
+ _lcdMenu->printMenu (scratchBuffer);
713
+ }
714
+ else {
715
+ disp = " R:" + String (_stepperRA->currentPosition ());
716
+ _lcdMenu->setCursor (0 , 1 );
717
+ _lcdMenu->printMenu (disp);
718
+ disp = " D:" + String (_stepperDEC->currentPosition ()) ;
719
+ _lcdMenu->setCursor (8 , 1 );
720
+ _lcdMenu->printMenu (disp);
721
+ }
722
+ #else
723
+ disp = " R:" + String (_stepperRA->currentPosition ());
715
724
_lcdMenu->setCursor (0 , 1 );
716
725
_lcdMenu->printMenu (disp);
726
+ disp = " D:" + String (_stepperDEC->currentPosition ()) ;
727
+ _lcdMenu->setCursor (8 , 1 );
728
+ _lcdMenu->printMenu (disp);
729
+ #endif
717
730
}
718
731
}
719
732
@@ -760,32 +773,19 @@ String Mount::DECString(byte type, byte active) {
760
773
// ///////////////////////////////
761
774
// Return a string of DEC in the given format. For LCDSTRING, active determines where the cursor is
762
775
String Mount::RAString (byte type, byte active) {
763
- // Serial.println("RA1: T" + String(type) + " A" + String(active));
764
776
DayTime ra;
765
- // Serial.println("RA2:" + ra.ToString());
766
777
if ((type & TARGET_STRING) == TARGET_STRING) {
767
- // Serial.println("RA3");
768
778
ra = DayTime (_targetRA);
769
- // Serial.println("RA3A:" + ra.ToString());
770
779
} else {
771
780
ra = DayTime (currentRA ());
772
781
}
773
782
774
- // Serial.println("RA4:" + ra.ToString());
775
783
DayTime raDisplay (ra);
776
- // Serial.println("RA5:" + raDisplay.ToString());
777
-
778
- // Serial.println("RA6:" + _HACorrection.ToString());
779
784
raDisplay.addTime (_HACorrection);
780
- // Serial.println("RA6A:" + raDisplay.ToString());
781
785
782
786
sprintf (scratchBuffer, formatStringsRA[type & FORMAT_STRING_MASK], raDisplay.getHours (), raDisplay.getMinutes () , raDisplay.getSeconds ());
783
- // Serial.println("RA8:" + String(scratchBuffer));
784
787
if ((type & FORMAT_STRING_MASK) == LCDMENU_STRING) {
785
- // Serial.println("RA9");
786
788
scratchBuffer[active * 4 ] = ' >' ;
787
- // Serial.println("RA9A:" + String(scratchBuffer));
788
789
}
789
- // Serial.println("RAQ");
790
790
return String (scratchBuffer);
791
791
}
0 commit comments