Skip to content

Commit 99bfe2f

Browse files
OATControl V0.9.6.0 - Updates
- Increased some font size and change some colors - Increased upper limit of steps for RA and DEC from 1000 to 10000 - Added ability to define Latitude and Longitude in Connect dialog
1 parent da2b209 commit 99bfe2f

File tree

9 files changed

+448
-238
lines changed

9 files changed

+448
-238
lines changed

Software/OATMobile/OATCommunications/TelescopeCommandHandlers/OatmealTelescopeCommandHandlers.cs

Lines changed: 294 additions & 213 deletions
Large diffs are not rendered by default.

Software/OpenAstroTracker ASCOM/OATControl/App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
<setting name="Scope" serializeAs="String">
1414
<value />
1515
</setting>
16+
<setting name="SiteLatitude" serializeAs="String">
17+
<value>45</value>
18+
</setting>
19+
<setting name="SiteLongitude" serializeAs="String">
20+
<value>-75</value>
21+
</setting>
1622
</OATControl.Properties.Settings>
1723
</userSettings>
1824
</configuration>

Software/OpenAstroTracker ASCOM/OATControl/DlgChooseOat.xaml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
77
xmlns:local="clr-namespace:OATControl"
88
mc:Ignorable="d"
9-
Title="Connect to OpenAstroTracker" Height="312.39" Width="359.862" ResizeMode="NoResize" WindowStartupLocation="CenterOwner" WindowStyle="ToolWindow">
9+
Title="Connect to OpenAstroTracker" Height="400" Width="600" ResizeMode="NoResize" WindowStyle="ToolWindow" FontSize="16" FontWeight="Bold">
1010
<Controls:MetroWindow.Resources>
1111
<Style x:Key="ListItemsStyle" TargetType="ListBoxItem">
1212
<Setter Property="Margin" Value="10,3,5,1" />
@@ -27,17 +27,14 @@
2727
</Grid.ColumnDefinitions>
2828
<Grid.RowDefinitions>
2929
<RowDefinition Height="Auto" />
30-
<RowDefinition Height="129*" />
31-
<RowDefinition Height="61*"/>
30+
<RowDefinition Height="*" />
31+
<RowDefinition Height="Auto"/>
32+
<RowDefinition Height="Auto"/>
33+
<RowDefinition Height="Auto"/>
3234
<RowDefinition Height="Auto" />
3335
</Grid.RowDefinitions>
3436
<TextBlock Grid.Row="0" Grid.Column="0" Text="Available Connections" Margin="10,24,10,0" Foreground="{StaticResource AccentSelectedColorBrush}" />
35-
<StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Right" Grid.ColumnSpan="2">
36-
<Button Content="Rescan" Command="{Binding RescanCommand}" Margin="10,10,60,10" Width="80" Style="{StaticResource AccentedSquareButtonStyle}" />
37-
<Button Content="OK" Command="{Binding OKCommand}" Margin="10" Width="80" Style="{StaticResource AccentedSquareButtonStyle}" IsDefault="True" />
38-
<Button Content="Cancel" Margin="10" Width="80" Style="{StaticResource AccentedSquareButtonStyle}" IsCancel="True" />
39-
</StackPanel>
40-
<ListBox Grid.Row="1" Grid.ColumnSpan="2"
37+
<ListBox Grid.Row="1" Grid.Column="1"
4138
VerticalAlignment="Top"
4239
ItemsSource="{Binding AvailableDevices,Mode=OneWay}"
4340
ItemsPanel="{StaticResource ListBoxItemsPanel}"
@@ -56,6 +53,19 @@
5653
</DataTemplate>
5754
</ListBox.ItemTemplate>
5855
</ListBox>
56+
<TextBlock Grid.Row="2" Grid.Column="0" Text="Latitude" HorizontalAlignment="Right" Margin="10" Foreground="{StaticResource AccentSelectedColorBrush}"/>
57+
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding Latitude}" FontWeight="Bold" FontSize="16" Foreground="{StaticResource AccentSelectedColorBrush}" Background="{StaticResource AccentColorBrush2}" Margin="5"/>
58+
59+
<TextBlock Grid.Row="3" Grid.Column="0" Text="Longitude" HorizontalAlignment="Right" Margin="10" Foreground="{StaticResource AccentSelectedColorBrush}"/>
60+
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding Longitude}" FontWeight="Bold" FontSize="16" Foreground="{StaticResource AccentSelectedColorBrush}" Background="{StaticResource AccentColorBrush2}" Margin="5"/>
61+
62+
<TextBlock Grid.Row="4" Grid.Column="0" Text="Altitude" HorizontalAlignment="Right" Margin="10" Foreground="{StaticResource AccentSelectedColorBrush}"/>
63+
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding Altitude}" FontWeight="Bold" FontSize="16" Foreground="{StaticResource AccentSelectedColorBrush}" Background="{StaticResource AccentColorBrush2}" Margin="5"/>
5964

65+
<StackPanel Grid.Row="5" Orientation="Horizontal" HorizontalAlignment="Right" Grid.ColumnSpan="2">
66+
<Button Content="Rescan" Command="{Binding RescanCommand}" Margin="10,10,60,10" Width="80" Style="{StaticResource AccentedSquareButtonStyle}" />
67+
<Button Content="OK" Command="{Binding OKCommand}" Margin="10" Width="80" Style="{StaticResource AccentedSquareButtonStyle}" IsDefault="True" />
68+
<Button Content="Cancel" Margin="10" Width="80" Style="{StaticResource AccentedSquareButtonStyle}" IsCancel="True" />
69+
</StackPanel>
6070
</Grid>
6171
</Controls:MetroWindow>

Software/OpenAstroTracker ASCOM/OATControl/DlgChooseOat.xaml.cs

Lines changed: 81 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
using MahApps.Metro.Controls;
22
using OATCommunications.WPF.CommunicationHandlers;
3+
using OATControl.Properties;
34
using OATControl.ViewModels;
45
using System;
56
using System.Collections.Generic;
7+
using System.ComponentModel;
68
using System.Linq;
79
using System.Text;
810
using System.Threading.Tasks;
@@ -20,18 +22,32 @@ namespace OATControl
2022
/// <summary>
2123
/// Interaction logic for DlgChooseOat.xaml
2224
/// </summary>
23-
public partial class DlgChooseOat : MetroWindow
25+
public partial class DlgChooseOat : MetroWindow, INotifyPropertyChanged
2426
{
2527
private DelegateCommand _okCommand;
2628
private DelegateCommand _rescanCommand;
29+
private float _latitude = 45;
30+
private float _longitude = -75;
31+
private float _altitude = 100;
32+
private string _device;
33+
2734
public DlgChooseOat()
2835
{
29-
_okCommand = new DelegateCommand(() => { this.DialogResult = true; Close(); });
36+
_latitude = Settings.Default.SiteLatitude;
37+
_longitude = Settings.Default.SiteLongitude;
38+
_okCommand = new DelegateCommand(() =>
39+
{
40+
this.DialogResult = true;
41+
Settings.Default.SiteLatitude = Latitude;
42+
Settings.Default.SiteLongitude = Longitude;
43+
Settings.Default.Save();
44+
Close();
45+
}, () => SelectedDevice != null);
3046
_rescanCommand = new DelegateCommand(() => { CommunicationHandlerFactory.DiscoverDevices(); });
3147

3248
this.DataContext = this;
3349
InitializeComponent();
34-
50+
3551
}
3652

3753
public ICommand OKCommand { get { return _okCommand; } }
@@ -42,6 +58,67 @@ public IList<string> AvailableDevices
4258
get { return CommunicationHandlerFactory.AvailableDevices; }
4359
}
4460

45-
public string SelectedDevice { get; set; }
61+
public string SelectedDevice
62+
{
63+
get { return _device; }
64+
set
65+
{
66+
if (value != _device)
67+
{
68+
_device = value;
69+
OnPropertyChanged("SelectedDevice");
70+
_okCommand.Requery();
71+
}
72+
}
73+
}
74+
75+
public event PropertyChangedEventHandler PropertyChanged;
76+
77+
public float Latitude
78+
{
79+
get { return _latitude; }
80+
set
81+
{
82+
if (value != _latitude)
83+
{
84+
_latitude = value;
85+
OnPropertyChanged("Latitude");
86+
}
87+
}
88+
}
89+
90+
public float Longitude
91+
{
92+
get { return _longitude; }
93+
set
94+
{
95+
if (value != _longitude)
96+
{
97+
_longitude = value;
98+
OnPropertyChanged("Longitude");
99+
}
100+
}
101+
}
102+
103+
public float Altitude
104+
{
105+
get { return _altitude; }
106+
set
107+
{
108+
if (value != _altitude)
109+
{
110+
_altitude = value;
111+
OnPropertyChanged("Altitude");
112+
}
113+
}
114+
}
115+
116+
private void OnPropertyChanged(string field)
117+
{
118+
if (PropertyChanged != null)
119+
{
120+
PropertyChanged(this, new PropertyChangedEventArgs(field));
121+
}
122+
}
46123
}
47124
}

Software/OpenAstroTracker ASCOM/OATControl/MainWindow.xaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@
175175
<Button Grid.Row="6" Grid.Column="5" Style="{StaticResource ArrowStyle}" Content="{StaticResource IconArrowDown}" Command="{Binding ArrowCommand}" CommandParameter="DS-" />
176176

177177
<TextBlock Grid.Row="7" Grid.Column="0" Text="Preset" Margin="0,20,0,0" Style="{StaticResource TextBlockHeading}" />
178-
<ComboBox Grid.Row="7" Grid.Column="1" Grid.ColumnSpan="7" Text="Preset" Margin="0,20,0,0" ItemsSource="{Binding AvailablePointsOfInterest}" DisplayMemberPath="Name" SelectedIndex="{Binding SelectedPointOfInterest}"/>
178+
<ComboBox Grid.Row="7" Grid.Column="1" Grid.ColumnSpan="7" Text="Preset" Margin="0,20,0,0" ItemsSource="{Binding AvailablePointsOfInterest}" DisplayMemberPath="Name" SelectedIndex="{Binding SelectedPointOfInterest}"
179+
FontSize="16" FontWeight="Bold"/>
179180

180181
<Button Grid.Row="1" Grid.Column="7" Grid.RowSpan="1" Margin="8,0,8,4" Padding="0,4,0,8" Content="&lt;- Sync" Style="{StaticResource AccentedSquareButtonStyle}" Command="{Binding SyncToCurrentCommand}" />
181182
<Button Grid.Row="2" Grid.Column="7" Grid.RowSpan="4" Margin="8,0" Padding="30,20" Content="Slew!" Style="{StaticResource AccentedSquareButtonStyle}" Command="{Binding SlewToTargetCommand}" />
@@ -429,11 +430,11 @@
429430

430431
<TextBlock Grid.Column="0" Grid.Row="2" Text="RA Steps" Margin="0,0" Style="{StaticResource TextBlockLabelSmall}" />
431432
<Controls:NumericUpDown Grid.Column="1" Grid.Row="2" Value="{Binding RAStepsPerDegree}" Margin="10,0,0,0"
432-
NumericInputMode="Numbers" StringFormat="0" Maximum="1000" Minimum="100" Interval="1" Style="{StaticResource NumericBorder}"/>
433+
NumericInputMode="Numbers" StringFormat="0" Maximum="10000" Minimum="100" Interval="1" Style="{StaticResource NumericBorder}"/>
433434

434435
<TextBlock Grid.Column="0" Grid.Row="3" Text="DEC Steps" Margin="0,0" Style="{StaticResource TextBlockLabelSmall}" />
435436
<Controls:NumericUpDown Grid.Column="1" Grid.Row="3" Value="{Binding DECStepsPerDegree}" Margin="10,0,0,0"
436-
NumericInputMode="Numbers" StringFormat="0" Maximum="1000" Minimum="100" Interval="1" Style="{StaticResource NumericBorder}"/>
437+
NumericInputMode="Numbers" StringFormat="0" Maximum="10000" Minimum="100" Interval="1" Style="{StaticResource NumericBorder}"/>
437438

438439
<TextBlock Grid.Column="0" Grid.Row="4" Text="HA" Margin="0,0" Style="{StaticResource TextBlockLabelSmall}" />
439440
<TextBlock Grid.Column="2" Grid.Row="4" MinWidth="64" Text="{Binding CurrentHA}" Style="{StaticResource TextBlockLabelValue}"/>

Software/OpenAstroTracker ASCOM/OATControl/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@
5151
// You can specify all the values or you can default the Build and Revision Numbers
5252
// by using the '*' as shown below:
5353
// [assembly: AssemblyVersion("1.0.*")]
54-
[assembly: AssemblyVersion("0.9.5.0")]
54+
[assembly: AssemblyVersion("0.9.6.0")]
5555
[assembly: AssemblyFileVersion("1.0.0.0")]

Software/OpenAstroTracker ASCOM/OATControl/Properties/Settings.Designer.cs

Lines changed: 25 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Software/OpenAstroTracker ASCOM/OATControl/Properties/Settings.settings

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,11 @@
55
<Setting Name="Scope" Type="System.String" Scope="User">
66
<Value Profile="(Default)" />
77
</Setting>
8+
<Setting Name="SiteLatitude" Type="System.Single" Scope="User">
9+
<Value Profile="(Default)">45</Value>
10+
</Setting>
11+
<Setting Name="SiteLongitude" Type="System.Single" Scope="User">
12+
<Value Profile="(Default)">-75</Value>
13+
</Setting>
814
</Settings>
915
</SettingsFile>

Software/OpenAstroTracker ASCOM/OATControl/ViewModels/MountVM.cs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using System.Windows.Threading;
1212
using System.Xml.Linq;
1313
using ASCOM.Utilities;
14+
using MahApps.Metro.Controls.Dialogs;
1415
using OATCommunications;
1516
using OATCommunications.Model;
1617
using OATCommunications.WPF.CommunicationHandlers;
@@ -330,6 +331,9 @@ private void OnSyncToCurrent()
330331
TargetRAHour = CurrentRAHour;
331332
TargetRAMinute = CurrentRAMinute;
332333
TargetRASecond = CurrentRASecond;
334+
TargetDECDegree= CurrentDECDegree;
335+
TargetDECMinute = CurrentDECMinute;
336+
TargetDECSecond = CurrentDECSecond;
333337
}
334338

335339
private void FloatToHMS(double val, out int h, out int m, out int s)
@@ -370,7 +374,7 @@ private async void OnConnectToTelescope()
370374
{
371375
RequeryCommands();
372376

373-
if (this.ChooseTelescope())
377+
if (await this.ChooseTelescope())
374378
{
375379
try
376380
{
@@ -384,9 +388,9 @@ private async void OnConnectToTelescope()
384388
var resultNr = await _oatMount.SendCommand("GVN#,#");
385389
ScopeName = $"{result.Data} {resultNr.Data}";
386390

387-
_transform.SiteElevation = 100;// _oatMount.SiteElevation;
388-
_transform.SiteLatitude = 47.74; //_oatMount.SiteLatitude;
389-
_transform.SiteLongitude = -121.96;// _oatMount.SiteLongitude;
391+
_transform.SiteElevation = 0; // _oatMount.SiteElevation;
392+
_transform.SiteLatitude = await _oatMount.GetSiteLatitude();
393+
_transform.SiteLongitude = await _oatMount.GetSiteLongitude();
390394
_transform.SetAzimuthElevation(0, 90);
391395
var lst = _transform.RATopocentric;
392396
var lstS = _util.HoursToHMS(lst, "", "", "");
@@ -484,9 +488,9 @@ private void RequeryCommands()
484488
OnPropertyChanged("ConnectCommandString");
485489
}
486490

487-
private bool ChooseTelescope()
491+
private async Task<bool> ChooseTelescope()
488492
{
489-
var dlg = new DlgChooseOat();
493+
var dlg = new DlgChooseOat() { Owner = Application.Current.MainWindow, WindowStartupLocation = WindowStartupLocation.CenterOwner };
490494

491495
var result = dlg.ShowDialog();
492496
if (result == true)
@@ -500,7 +504,8 @@ private bool ChooseTelescope()
500504
_commHandler = CommunicationHandlerFactory.ConnectToDevice(dlg.SelectedDevice);
501505
//_commHandler = new TcpCommunicationHandler(new IPAddress(new byte[] { 192, 168, 86, 61 }), 4030);
502506
_oatMount = new OatmealTelescopeCommandHandlers(_commHandler);
503-
507+
await _oatMount.SetSiteLatitude((float)dlg.Latitude);
508+
await _oatMount.SetSiteLongitude((float)dlg.Longitude);
504509
return true;
505510
}
506511

0 commit comments

Comments
 (0)