@@ -2279,6 +2279,13 @@ void Mount::setTrackingStepperPos(long stepPos)
22792279 _stepperTRK->setCurrentPosition (stepPos);
22802280}
22812281
2282+ void Mount::setStatus (int state)
2283+ {
2284+ noInterrupts ();
2285+ _mountStatus = state;
2286+ interrupts ();
2287+ }
2288+
22822289void Mount::setStatusFlag (int flag)
22832290{
22842291 noInterrupts ();
@@ -2590,8 +2597,7 @@ void Mount::startSlewing(int direction)
25902597 setStatusFlag (STATUS_SLEWING);
25912598 }
25922599
2593- const float trackedHours = (_trackingSpeed > 0 ) ? ((_stepperTRK->currentPosition () / _trackingSpeed) / 3600 .0F )
2594- : 0 .0F ; // steps / steps/s / 3600 = hours
2600+ const float trackedHours = getTrackedHours ();
25952601 if (direction & EAST)
25962602 {
25972603 // We need to subtract the distance tracked from the physical RA home coordinate
@@ -3279,7 +3285,7 @@ void Mount::loop()
32793285 {
32803286 LOG (DEBUG_MOUNT | DEBUG_STEPPERS, " [MOUNT]: Loop: Already at Parking pos, so done." );
32813287 noInterrupts ();
3282- _mountStatus = STATUS_PARKED;
3288+ setStatus ( STATUS_PARKED) ;
32833289 interrupts ();
32843290 }
32853291 }
@@ -3299,7 +3305,7 @@ void Mount::loop()
32993305 {
33003306 LOG (DEBUG_MOUNT | DEBUG_STEPPERS, " [MOUNT]: Loop: Arrived at park position..." );
33013307 noInterrupts ();
3302- _mountStatus = STATUS_PARKED;
3308+ setStatus ( STATUS_PARKED) ;
33033309 interrupts ();
33043310 _slewingToPark = false ;
33053311 }
@@ -3590,8 +3596,7 @@ void Mount::calculateRAandDECSteppers(long &targetRASteps, long &targetDECSteps,
35903596 LOG (DEBUG_COORD_CALC, " [MOUNT]: CalcSteppersIn: moveRA (target) is %f" , moveRA);
35913597
35923598 // Total hours of tracking-to-date
3593- float trackedHours
3594- = (_trackingSpeed > 0 ) ? ((_stepperTRK->currentPosition () / _trackingSpeed) / 3600 .0F ) : 0 .0F ; // steps / steps/s / 3600 = hours
3599+ float trackedHours = getTrackedHours ();
35953600 LOG (DEBUG_COORD_CALC, " [MOUNT]: CalcSteppersIn: Tracked time is %l steps (%f h)." , _stepperTRK->currentPosition (), trackedHours);
35963601
35973602 // The current RA of the home position, taking tracking-to-date into account
@@ -4279,15 +4284,19 @@ void Mount::testUART_vactual(TMC2209Stepper *driver, int _speed, int _duration)
42794284 #endif
42804285#endif
42814286
4287+ float Mount::getTrackedHours ()
4288+ {
4289+ return (_trackingSpeed > 0 ) ? ((_stepperTRK->currentPosition () / _trackingSpeed) / 3600 .0F ) : 0 .0F ; // steps / steps/s / 3600 = hours
4290+ }
4291+
42824292// ///////////////////////////////
42834293//
42844294// checkRALimit
42854295//
42864296// ///////////////////////////////
42874297float Mount::checkRALimit ()
42884298{
4289- const float trackedHours
4290- = (_trackingSpeed > 0 ) ? ((_stepperTRK->currentPosition () / _trackingSpeed) / 3600 .0F ) : 0 .0F ; // steps / steps/s / 3600 = hours
4299+ const float trackedHours = getTrackedHours ();
42914300 const float homeRA = _zeroPosRA.getTotalHours () + trackedHours;
42924301 const float RALimit = RA_TRACKING_LIMIT;
42934302 LOG (DEBUG_MOUNT_VERBOSE,
0 commit comments