78
78
79
79
// Extended bits
80
80
#define EEPROM_PARKING_POS_MARKER_BIT 0x0001
81
+ #define EEPROM_DEC_LIMIT_MARKER_BIT 0x0002
81
82
82
83
const char * formatStringsDEC[] = {
83
84
" " ,
@@ -155,6 +156,8 @@ Mount::Mount(int stepsPerRADegree, int stepsPerDECDegree, LcdMenu* lcdMenu) {
155
156
_slewingToPark = false ;
156
157
_raParkingPos = 0 ;
157
158
_decParkingPos = 0 ;
159
+ _decLowerLimit = 0 ;
160
+ _decUpperLimit = 0 ;
158
161
159
162
#if USE_GYRO_LEVEL == 1
160
163
_pitchCalibrationAngle = 0 ;
@@ -324,6 +327,15 @@ void Mount::readPersistentData()
324
327
else {
325
328
LOGV1 (DEBUG_INFO|DEBUG_EEPROM,F (" Mount: EEPROM: No stored value for Parking position" ));
326
329
}
330
+ if (nextMarker & EEPROM_DEC_LIMIT_MARKER_BIT){
331
+ _decLowerLimit = EPROMStore::readInt32 (31 ); // 31-34
332
+ _decUpperLimit = EPROMStore::readInt32 (35 ); // 35-38
333
+ LOGV3 (DEBUG_INFO|DEBUG_EEPROM,F (" Mount: EEPROM: DEC limitsread as %l -> %l" ), _decLowerLimit, _decUpperLimit );
334
+ }
335
+ else {
336
+ LOGV1 (DEBUG_INFO|DEBUG_EEPROM,F (" Mount: EEPROM: No stored value for Parking position" ));
337
+ }
338
+
327
339
}
328
340
else {
329
341
LOGV1 (DEBUG_INFO|DEBUG_EEPROM,F (" Mount: EEPROM: No ExtendedMarker present" ));
@@ -444,7 +456,7 @@ void Mount::writePersistentData(int which, long val)
444
456
case EEPROM_RA_PARKING_POS:
445
457
case EEPROM_DEC_PARKING_POS:
446
458
{
447
- // ... set bit 8 to indicate pitch offset angle value has been written to 19/20
459
+ // ... set bit 0 in extended flag to indicate Parking pos has been written to 23-30
448
460
writeExtended = true ;
449
461
extendedFlag |= EEPROM_PARKING_POS_MARKER_BIT;
450
462
if (which == EEPROM_RA_PARKING_POS ){
@@ -457,6 +469,23 @@ void Mount::writePersistentData(int which, long val)
457
469
}
458
470
}
459
471
break ;
472
+
473
+ case EEPROM_DEC_UPPER_LIMIT:
474
+ case EEPROM_DEC_LOWER_LIMIT:
475
+ {
476
+ // ... set bit 1 in extended flag to indicate Parking pos has been written to 23-30
477
+ writeExtended = true ;
478
+ extendedFlag |= EEPROM_DEC_LIMIT_MARKER_BIT;
479
+ if (which == EEPROM_DEC_UPPER_LIMIT ){
480
+ EPROMStore::updateInt32 (31 , val);
481
+ LOGV2 (DEBUG_INFO|DEBUG_EEPROM,F (" Mount: EEPROM Write: Updating DEC Upper limit to %l at 31-34" ), val);
482
+ }
483
+ else {
484
+ EPROMStore::updateInt32 (35 , val);
485
+ LOGV2 (DEBUG_INFO|DEBUG_EEPROM,F (" Mount: EEPROM Write: Updating DEC Lower limit to %l at 35-38" ), val);
486
+ }
487
+ }
488
+ break ;
460
489
}
461
490
462
491
@@ -704,6 +733,7 @@ float Mount::getPitchCalibrationAngle()
704
733
void Mount::setPitchCalibrationAngle (float angle)
705
734
{
706
735
uint16_t angleValue = (angle * 100 ) + 16384 ;
736
+ LOGV3 (DEBUG_GYRO, " Mount: Setting Pitch calibration to %d (%f)" , angleValue, angle);
707
737
writePersistentData (EEPROM_PITCH_OFFSET, angleValue);
708
738
_pitchCalibrationAngle = angle;
709
739
}
@@ -727,6 +757,7 @@ float Mount::getRollCalibrationAngle()
727
757
void Mount::setRollCalibrationAngle (float angle)
728
758
{
729
759
uint16_t angleValue = (angle * 100 ) + 16384 ;
760
+ LOGV3 (DEBUG_GYRO, " Mount: Setting Roll calibration to %d (%f)" , angleValue, angle);
730
761
writePersistentData (EEPROM_ROLL_OFFSET, angleValue);
731
762
_rollCalibrationAngle = angle;
732
763
}
@@ -1867,7 +1898,6 @@ void Mount::interruptLoop()
1867
1898
// Process any stepper changes.
1868
1899
// ///////////////////////////////
1869
1900
void Mount::loop () {
1870
- unsigned long now = millis ();
1871
1901
bool raStillRunning = false ;
1872
1902
bool decStillRunning = false ;
1873
1903
@@ -2005,7 +2035,7 @@ void Mount::loop() {
2005
2035
_stepperDEC->moveTo (_decParkingPos);
2006
2036
_totalDECMove = 1 .0f * _stepperDEC->distanceToGo ();
2007
2037
_totalRAMove = 1 .0f * _stepperRA->distanceToGo ();
2008
- LOGV5 (DEBUG_MOUNT|DEBUG_STEPPERS,F (" Mount::Loop: Park Position is R:%l D:%l, TotalMove is R:%f, D:%f" ), _raParkingPos,_decParkingPos,_totalRAMove, _totalDECMove);
2038
+ LOGV5 (DEBUG_MOUNT|DEBUG_STEPPERS,F (" Mount::Loop: Park Position is R:%l D:%l, TotalMove is R:%f, D:%f" ), _raParkingPos, _decParkingPos,_totalRAMove, _totalDECMove);
2009
2039
if ((_stepperDEC->distanceToGo () != 0 ) || (_stepperRA->distanceToGo () != 0 )) {
2010
2040
_mountStatus |= STATUS_PARKING_POS | STATUS_SLEWING;
2011
2041
}
@@ -2026,17 +2056,8 @@ void Mount::loop() {
2026
2056
2027
2057
// Make sure we do one last update when the steppers have stopped.
2028
2058
displayStepperPosition ();
2029
- if (!inSerialControl) {
2030
- _lcdMenu->updateDisplay ();
2031
- }
2032
2059
}
2033
2060
}
2034
-
2035
- if ((_bootComplete) && (now - _lastTrackingPrint > 200 )) {
2036
- _lcdMenu->printAt (15 ,0 , isSlewingTRK () ? ' &' : ' `' );
2037
- _lastTrackingPrint = now;
2038
- }
2039
-
2040
2061
}
2041
2062
2042
2063
_stepperWasRunning = raStillRunning || decStillRunning;
@@ -2051,12 +2072,18 @@ void Mount::bootComplete() {
2051
2072
_bootComplete = true ;
2052
2073
}
2053
2074
2075
+ bool Mount::isBootComplete (){
2076
+ return _bootComplete;
2077
+ }
2078
+
2079
+
2080
+
2054
2081
// ///////////////////////////////
2055
2082
//
2056
2083
// setParkingPosition
2057
2084
//
2058
2085
// ///////////////////////////////
2059
- void Mount::setParkingPosition (){
2086
+ void Mount::setParkingPosition () {
2060
2087
_raParkingPos = _stepperRA->currentPosition () - _stepperTRK->currentPosition ();
2061
2088
_decParkingPos = _stepperDEC->currentPosition ();
2062
2089
@@ -2066,6 +2093,42 @@ void Mount::setParkingPosition(){
2066
2093
writePersistentData (EEPROM_DEC_PARKING_POS, _decParkingPos);
2067
2094
}
2068
2095
2096
+ // ///////////////////////////////
2097
+ //
2098
+ // setDecLimitPosition
2099
+ //
2100
+ // ///////////////////////////////
2101
+ void Mount::setDecLimitPosition (bool upper) {
2102
+ if (upper) {
2103
+ _decUpperLimit = _stepperDEC->currentPosition ();
2104
+ writePersistentData (EEPROM_DEC_UPPER_LIMIT, _decUpperLimit);
2105
+ LOGV3 (DEBUG_MOUNT,F (" Mount::setDecLimitPosition(Upper): limit DEC: %l -> %l" ), _decLowerLimit, _decUpperLimit);
2106
+ }
2107
+ else {
2108
+ _decLowerLimit = _stepperDEC->currentPosition ();
2109
+ writePersistentData (EEPROM_DEC_LOWER_LIMIT, _decLowerLimit);
2110
+ LOGV3 (DEBUG_MOUNT,F (" Mount::setDecLimitPosition(Lower): limit DEC: %l -> %l" ), _decLowerLimit, _decUpperLimit);
2111
+ }
2112
+ }
2113
+
2114
+ // ///////////////////////////////
2115
+ //
2116
+ // clearDecLimitPosition
2117
+ //
2118
+ // ///////////////////////////////
2119
+ void Mount::clearDecLimitPosition (bool upper) {
2120
+ if (upper) {
2121
+ _decUpperLimit = 0 ;
2122
+ writePersistentData (EEPROM_DEC_UPPER_LIMIT, _decUpperLimit);
2123
+ LOGV3 (DEBUG_MOUNT,F (" Mount::clearDecLimitPosition(Upper): limit DEC: %l -> %l" ), _decLowerLimit, _decUpperLimit);
2124
+ }
2125
+ else {
2126
+ _decLowerLimit = 0 ;
2127
+ writePersistentData (EEPROM_DEC_LOWER_LIMIT, _decLowerLimit);
2128
+ LOGV3 (DEBUG_MOUNT,F (" Mount::clearDecLimitPosition(Lower): limit DEC: %l -> %l" ), _decLowerLimit, _decUpperLimit);
2129
+ }
2130
+ }
2131
+
2069
2132
// ///////////////////////////////
2070
2133
//
2071
2134
// setHome
0 commit comments