@@ -78,6 +78,7 @@ public class MountVM : ViewModelBase
7878 DateTime _connectedAt = DateTime . UtcNow ;
7979 string _lastDirection = string . Empty ;
8080 bool _useCustomParkPosition = false ;
81+ bool _isManualTrackingMode = false ;
8182
8283 private float _maxMotorSpeed = 2.5f ;
8384 double _speed = 1.0 ;
@@ -175,6 +176,7 @@ public class MountVM : ViewModelBase
175176 private ICommunicationHandler _commHandler ;
176177 private string _serialBaudRate ;
177178 private string _trackingMode = "Sidereal" ;
179+ float _manualTrackingRateEdit = 0.0f ;
178180
179181 private OatmealTelescopeCommandHandlers _oatMount ;
180182 private PointsOfInterest _pointsOfInterest ;
@@ -900,11 +902,12 @@ private void OnStartChangingParameter(object p)
900902 case "SR" : RAStepsPerDegreeEdit += 0.1f * _incrDirection ; break ;
901903 case "SD" : DECStepsPerDegreeEdit += 0.1f * _incrDirection ; break ;
902904 case "SS" : SpeedCalibrationFactorEdit += _incrDirection ; break ;
905+ case "TR" : ManualTrackingRateEdit += 0.1f * _incrDirection ; break ;
903906 default : OnAdjustTarget ( _incrVar + ( _incrDirection == 1 ? "+" : "-" ) ) ; break ;
904907 }
905908 }
906909 }
907-
910+
908911 void SetDECStepsPerDegree ( float steps )
909912 {
910913 DECStepsPerDegree = steps ;
@@ -925,6 +928,7 @@ private void OnIncrementVariable(object sender, EventArgs e)
925928 case "SR" : RAStepsPerDegreeEdit += 0.2f * _incrDirection ; break ;
926929 case "SD" : DECStepsPerDegreeEdit += 0.2f * _incrDirection ; break ;
927930 case "SS" : SpeedCalibrationFactorEdit += _incrDirection ; break ;
931+ case "TR" : ManualTrackingRateEdit += 0.1f * _incrDirection ; break ;
928932 default : OnAdjustTarget ( _incrVar + ( _incrDirection == 1 ? "+" : "-" ) ) ; break ;
929933 }
930934 _timer . Interval = TimeSpan . FromMilliseconds ( _incrementalDelay ) ;
@@ -1601,7 +1605,11 @@ public void UpdateRealtimeParameters(bool editable)
16011605 this . SendOatCommand ( ":GC#,#" , ( a ) => { localDate = a . Data ; failed |= ! a . Success ; } ) ;
16021606 if ( FirmwareVersion >= 11314 )
16031607 {
1604- this . SendOatCommand ( ":TZ#,#" , ( a ) => { trkMode = a . Data ; failed |= ! a . Success ; } ) ;
1608+ this . SendOatCommand ( ":Gk#,#" , ( a ) => { trkMode = a . Data ; failed |= ! a . Success ; } ) ;
1609+ this . SendOatCommand ( ":GT#,#" , ( a ) => {
1610+ ManualTrackingRateEdit = float . Parse ( a . Data , _oatCulture ) ;
1611+ failed |= ! a . Success ;
1612+ } ) ;
16051613 }
16061614 this . SendOatCommand ( ":XGH#,#" , ( a ) => { ha = a . Data ; failed |= ! a . Success ; } ) ;
16071615 if ( FirmwareVersion >= 11206 )
@@ -2152,6 +2160,22 @@ public async Task UpdateInitialScopeValues()
21522160 doneEvent . Set ( ) ;
21532161 } ) ;
21542162
2163+ this . SendOatCommand ( ":Gk#,#" , ( trkMode ) =>
2164+ {
2165+ Log . WriteLine ( "MOUNT: Current Tracking Mode is {0}..." , trkMode . Data ) ;
2166+ if ( trkMode . Success )
2167+ {
2168+ IsManualTrackingMode = false ;
2169+ TrackingMode = trkMode . Data ;
2170+ if ( trkMode . Data == "Manual" )
2171+ {
2172+ IsManualTrackingMode = true ;
2173+ }
2174+ }
2175+
2176+ doneEvent . Set ( ) ;
2177+ } ) ;
2178+
21552179 await doneEvent . WaitAsync ( ) ;
21562180
21572181 ShowDECLimits = AppSettings . Instance . ShowDecLimits ;
@@ -3540,6 +3564,15 @@ public float DECStepsPerDegreeEdit
35403564 set { SetPropertyValue ( ref _decStepsPerDegreeEdit , value ) ; }
35413565 }
35423566
3567+ public float ManualTrackingRateEdit
3568+ {
3569+ get { return _manualTrackingRateEdit ; }
3570+ set {
3571+ SetPropertyValue ( ref _manualTrackingRateEdit , value ) ;
3572+ _oatMount ? . SendCommand ( string . Format ( _oatCulture , ":Sq{0:0.0000}#" , ManualTrackingRateEdit ) , ( a ) => { } ) ;
3573+ }
3574+ }
3575+
35433576 /// <summary>
35443577 /// Gets or sets the DEC steps per degree
35453578 /// </summary>
@@ -3998,6 +4031,12 @@ public bool UseCustomParkPosition
39984031 set { SetPropertyValue ( ref _useCustomParkPosition , value , OnUseCustomParkPositionChanged ) ; }
39994032 }
40004033
4034+ public bool IsManualTrackingMode
4035+ {
4036+ get { return _isManualTrackingMode ; }
4037+ set { SetPropertyValue ( ref _isManualTrackingMode , value ) ; }
4038+ }
4039+
40014040 /// <summary>
40024041 /// Sends command to enable/disable Custom Park Position to the mount
40034042 /// </summary>
@@ -4317,8 +4356,9 @@ public String SelectedTrackingMode
43174356 get { return _trackingMode ; }
43184357 set
43194358 {
4320- if ( FirmwareVersion > 11314 )
4359+ if ( FirmwareVersion >= 11314 )
43214360 {
4361+ IsManualTrackingMode = false ;
43224362 if ( value == "Sidereal" )
43234363 {
43244364 this . SendOatCommand ( ":TQ#,n" , ( a ) => { } ) ;
@@ -4335,15 +4375,27 @@ public String SelectedTrackingMode
43354375 {
43364376 this . SendOatCommand ( ":TK#,n" , ( a ) => { } ) ;
43374377 }
4378+ else if ( value == "Manual" )
4379+ {
4380+ this . SendOatCommand ( ":TM#,n" , ( a ) => { } ) ;
4381+ IsManualTrackingMode = true ;
4382+ }
43384383 else
43394384 {
43404385 this . SendOatCommand ( ":TQ#,n" , ( a ) => { } ) ;
43414386 }
43424387
43434388 Log . WriteLine ( "MOUNT: Changing tracking rate to " + value ) ;
4344- _trackingMode = value ;
4389+ // _trackingMode = value;
4390+ SetPropertyValue ( ref _trackingMode , value ) ;
4391+
4392+ OnPropertyChanged ( "TrackingMode" ) ;
4393+ OnPropertyChanged ( "SelectedTrackingMode" ) ;
4394+
43454395 AppSettings . Instance . TrackingRate = value ;
43464396 AppSettings . Instance . Save ( ) ;
4397+
4398+
43474399 }
43484400 }
43494401 }
@@ -4380,7 +4432,8 @@ public IEnumerable<String> AvailableTrackingModes
43804432 "Sidereal" ,
43814433 "Lunar" ,
43824434 "Solar" ,
4383- "King"
4435+ "King" ,
4436+ "Manual"
43844437 } ;
43854438
43864439
0 commit comments