@@ -88,6 +88,7 @@ public class MountVM : ViewModelBase
8888 DateTime _connectedAt = DateTime . UtcNow ;
8989 string _lastDirection = string . Empty ;
9090 bool _useCustomParkPosition = false ;
91+ bool _isManualTrackingMode = false ;
9192
9293 private float _maxMotorSpeed = 2.5f ;
9394 double _speed = 1.0 ;
@@ -185,6 +186,7 @@ public class MountVM : ViewModelBase
185186 private ICommunicationHandler _commHandler ;
186187 private string _serialBaudRate ;
187188 private string _trackingMode = "Sidereal" ;
189+ float _manualTrackingRateEdit = 0.0f ;
188190
189191 private OatmealTelescopeCommandHandlers _oatMount ;
190192 private PointsOfInterest _pointsOfInterest ;
@@ -1209,11 +1211,12 @@ private void OnStartChangingParameter(object p)
12091211 case "SR" : RAStepsPerDegreeEdit += 0.1f * _incrDirection ; break ;
12101212 case "SD" : DECStepsPerDegreeEdit += 0.1f * _incrDirection ; break ;
12111213 case "SS" : SpeedCalibrationFactorEdit += _incrDirection ; break ;
1214+ case "TR" : ManualTrackingRateEdit += 0.1f * _incrDirection ; break ;
12121215 default : OnAdjustTarget ( _incrVar + ( _incrDirection == 1 ? "+" : "-" ) ) ; break ;
12131216 }
12141217 }
12151218 }
1216-
1219+
12171220 void SetDECStepsPerDegree ( float steps )
12181221 {
12191222 DECStepsPerDegree = steps ;
@@ -1234,6 +1237,7 @@ private void OnIncrementVariable(object sender, EventArgs e)
12341237 case "SR" : RAStepsPerDegreeEdit += 0.2f * _incrDirection ; break ;
12351238 case "SD" : DECStepsPerDegreeEdit += 0.2f * _incrDirection ; break ;
12361239 case "SS" : SpeedCalibrationFactorEdit += _incrDirection ; break ;
1240+ case "TR" : ManualTrackingRateEdit += 0.1f * _incrDirection ; break ;
12371241 default : OnAdjustTarget ( _incrVar + ( _incrDirection == 1 ? "+" : "-" ) ) ; break ;
12381242 }
12391243 _timer . Interval = TimeSpan . FromMilliseconds ( _incrementalDelay ) ;
@@ -1910,7 +1914,11 @@ public void UpdateRealtimeParameters(bool editable)
19101914 this . SendOatCommand ( ":GC#,#" , ( a ) => { localDate = a . Data ; failed |= ! a . Success ; } ) ;
19111915 if ( FirmwareVersion >= 11314 )
19121916 {
1913- this . SendOatCommand ( ":TZ#,#" , ( a ) => { trkMode = a . Data ; failed |= ! a . Success ; } ) ;
1917+ this . SendOatCommand ( ":Gk#,#" , ( a ) => { trkMode = a . Data ; failed |= ! a . Success ; } ) ;
1918+ this . SendOatCommand ( ":GT#,#" , ( a ) => {
1919+ ManualTrackingRateEdit = float . Parse ( a . Data , _oatCulture ) ;
1920+ failed |= ! a . Success ;
1921+ } ) ;
19141922 }
19151923 this . SendOatCommand ( ":XGH#,#" , ( a ) => { ha = a . Data ; failed |= ! a . Success ; } ) ;
19161924 if ( FirmwareVersion >= 11206 )
@@ -2462,6 +2470,22 @@ public async Task UpdateInitialScopeValues()
24622470 doneEvent . Set ( ) ;
24632471 } ) ;
24642472
2473+ this . SendOatCommand ( ":Gk#,#" , ( trkMode ) =>
2474+ {
2475+ Log . WriteLine ( "MOUNT: Current Tracking Mode is {0}..." , trkMode . Data ) ;
2476+ if ( trkMode . Success )
2477+ {
2478+ IsManualTrackingMode = false ;
2479+ TrackingMode = trkMode . Data ;
2480+ if ( trkMode . Data == "Manual" )
2481+ {
2482+ IsManualTrackingMode = true ;
2483+ }
2484+ }
2485+
2486+ doneEvent . Set ( ) ;
2487+ } ) ;
2488+
24652489 await doneEvent . WaitAsync ( ) ;
24662490
24672491 ShowDECLimits = AppSettings . Instance . ShowDecLimits ;
@@ -3850,6 +3874,15 @@ public float DECStepsPerDegreeEdit
38503874 set { SetPropertyValue ( ref _decStepsPerDegreeEdit , value ) ; }
38513875 }
38523876
3877+ public float ManualTrackingRateEdit
3878+ {
3879+ get { return _manualTrackingRateEdit ; }
3880+ set {
3881+ SetPropertyValue ( ref _manualTrackingRateEdit , value ) ;
3882+ _oatMount ? . SendCommand ( string . Format ( _oatCulture , ":Sq{0:0.0000}#" , ManualTrackingRateEdit ) , ( a ) => { } ) ;
3883+ }
3884+ }
3885+
38533886 /// <summary>
38543887 /// Gets or sets the DEC steps per degree
38553888 /// </summary>
@@ -4313,6 +4346,12 @@ public bool UseCustomParkPosition
43134346 set { SetPropertyValue ( ref _useCustomParkPosition , value , OnUseCustomParkPositionChanged ) ; }
43144347 }
43154348
4349+ public bool IsManualTrackingMode
4350+ {
4351+ get { return _isManualTrackingMode ; }
4352+ set { SetPropertyValue ( ref _isManualTrackingMode , value ) ; }
4353+ }
4354+
43164355 /// <summary>
43174356 /// Sends command to enable/disable Custom Park Position to the mount
43184357 /// </summary>
@@ -4632,8 +4671,9 @@ public String SelectedTrackingMode
46324671 get { return _trackingMode ; }
46334672 set
46344673 {
4635- if ( FirmwareVersion > 11314 )
4674+ if ( FirmwareVersion >= 11314 )
46364675 {
4676+ IsManualTrackingMode = false ;
46374677 if ( value == "Sidereal" )
46384678 {
46394679 this . SendOatCommand ( ":TQ#,n" , ( a ) => { } ) ;
@@ -4650,15 +4690,27 @@ public String SelectedTrackingMode
46504690 {
46514691 this . SendOatCommand ( ":TK#,n" , ( a ) => { } ) ;
46524692 }
4693+ else if ( value == "Manual" )
4694+ {
4695+ this . SendOatCommand ( ":TM#,n" , ( a ) => { } ) ;
4696+ IsManualTrackingMode = true ;
4697+ }
46534698 else
46544699 {
46554700 this . SendOatCommand ( ":TQ#,n" , ( a ) => { } ) ;
46564701 }
46574702
46584703 Log . WriteLine ( "MOUNT: Changing tracking rate to " + value ) ;
4659- _trackingMode = value ;
4704+ // _trackingMode = value;
4705+ SetPropertyValue ( ref _trackingMode , value ) ;
4706+
4707+ OnPropertyChanged ( "TrackingMode" ) ;
4708+ OnPropertyChanged ( "SelectedTrackingMode" ) ;
4709+
46604710 AppSettings . Instance . TrackingRate = value ;
46614711 AppSettings . Instance . Save ( ) ;
4712+
4713+
46624714 }
46634715 }
46644716 }
@@ -4695,7 +4747,8 @@ public IEnumerable<String> AvailableTrackingModes
46954747 "Sidereal" ,
46964748 "Lunar" ,
46974749 "Solar" ,
4698- "King"
4750+ "King" ,
4751+ "Manual"
46994752 } ;
47004753
47014754
0 commit comments