Skip to content

Commit 21d677c

Browse files
OATControl V0.9.9.04 - Updates
- Added display of the hardware that is connected - Made target coordinate textboxes focus in the expected tab order select all text on focus - Made target coordinate textboxes select all text on focus - Made target coordinate textboxes respond to keyboard up and down - Minor cosmetic and text changes - Cleared info on disconnect
1 parent bed631c commit 21d677c

File tree

4 files changed

+71
-17
lines changed

4 files changed

+71
-17
lines changed

Software/OpenAstroTracker ASCOM/OATControl/MainWindow.xaml

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
xmlns:controls="clr-namespace:OATControl.Controls"
99
xmlns:converters="clr-namespace:OATControl.Converters"
1010
mc:Ignorable="d"
11-
Title="{Binding Version, StringFormat={} OpenAstroTracker Control V{0}}" MinHeight="715" MinWidth="790" Height="717" Width="770">
11+
Title="{Binding Version, StringFormat={} OpenAstroTracker Control V{0}}" MinHeight="720" MinWidth="790" Height="720" Width="770">
1212
<Window.Resources>
1313
<converters:BoolToStringConverter x:Key="SlewModeConverter" TrueString="Pulsed" FalseString="Continuous" />
1414
<converters:BoolToVisibilityConverter x:Key="TrueBoolToHidden" Collapse="False" IsReversed="True"/>
@@ -38,7 +38,7 @@
3838
<Setter Property="MinWidth" Value="50" />
3939
</Style>
4040
<Style x:Key="NumericBorder" TargetType="Controls:NumericUpDown" >
41-
<Setter Property="FontSize" Value="20" />
41+
<Setter Property="FontSize" Value="14" />
4242
<Setter Property="MinWidth" Value="50" />
4343
</Style>
4444
<Style x:Key="DockBlockStatus" TargetType="DockPanel" >
@@ -204,11 +204,11 @@
204204
<Button Grid.Row="1" Grid.Column="5" Style="{StaticResource ArrowStyle}" Content="{StaticResource IconArrowUp}" Command="{Binding ArrowCommand}" CommandParameter="RS+" />
205205

206206
<TextBlock Grid.Row="2" Grid.Column="0" Text="RA" Style="{StaticResource TextBlockHeading}" />
207-
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding TargetRAHour, StringFormat={}{0:00}}" Style="{StaticResource TextBorder}" />
207+
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding TargetRAHour, StringFormat={}{0:00}}" Style="{StaticResource TextBorder}" Tag="RH" TabIndex="1" GotKeyboardFocus="TextBox_GotKeyboardFocus" KeyUp="TextBox_KeyUp" />
208208
<TextBlock Grid.Row="2" Grid.Column="2" Text="h" Margin="2,0,8,0" Style="{StaticResource TextBlockLabel}" />
209-
<TextBox Grid.Row="2" Grid.Column="3" Text="{Binding TargetRAMinute, StringFormat={}{0:00}}" Style="{StaticResource TextBorder}" />
209+
<TextBox Grid.Row="2" Grid.Column="3" Text="{Binding TargetRAMinute, StringFormat={}{0:00}}" Style="{StaticResource TextBorder}" Tag="RM" TabIndex="2" GotKeyboardFocus="TextBox_GotKeyboardFocus" KeyUp="TextBox_KeyUp" />
210210
<TextBlock Grid.Row="2" Grid.Column="4" Text="m" Margin="2,0,8,0" Style="{StaticResource TextBlockLabel}" />
211-
<TextBox Grid.Row="2" Grid.Column="5" Text="{Binding TargetRASecond, StringFormat={}{0:00}}" Style="{StaticResource TextBorder}" />
211+
<TextBox Grid.Row="2" Grid.Column="5" Text="{Binding TargetRASecond, StringFormat={}{0:00}}" Style="{StaticResource TextBorder}" Tag="RS" TabIndex="3" GotKeyboardFocus="TextBox_GotKeyboardFocus" KeyUp="TextBox_KeyUp" />
212212
<TextBlock Grid.Row="2" Grid.Column="6" Text="s" Margin="2,0,8,0" Style="{StaticResource TextBlockLabel}" />
213213

214214
<Button Grid.Row="3" Grid.Column="1" Style="{StaticResource ArrowStyle}" Content="{StaticResource IconArrowDown}" Command="{Binding ArrowCommand}" CommandParameter="RH-" />
@@ -220,11 +220,11 @@
220220
<Button Grid.Row="4" Grid.Column="5" Style="{StaticResource ArrowStyle}" Content="{StaticResource IconArrowUp}" Command="{Binding ArrowCommand}" CommandParameter="DS+" />
221221

222222
<TextBlock Grid.Row="5" Grid.Column="0" Text="DEC" Style="{StaticResource TextBlockHeading}" />
223-
<TextBox Grid.Row="5" Grid.Column="1" Text="{Binding TargetDECDegree, StringFormat={}{0:00}}" Style="{StaticResource TextBorder}"/>
223+
<TextBox Grid.Row="5" Grid.Column="1" Text="{Binding TargetDECDegree, StringFormat={}{0:00}}" Style="{StaticResource TextBorder}" Tag="DD" TabIndex="4" GotKeyboardFocus="TextBox_GotKeyboardFocus" KeyUp="TextBox_KeyUp" />
224224
<TextBlock Grid.Row="5" Grid.Column="2" Text="°" Margin="2,0,8,0" Style="{StaticResource TextBlockLabel}" />
225-
<TextBox Grid.Row="5" Grid.Column="3" Text="{Binding TargetDECMinute, StringFormat={}{0:00}}" Style="{StaticResource TextBorder}"/>
225+
<TextBox Grid.Row="5" Grid.Column="3" Text="{Binding TargetDECMinute, StringFormat={}{0:00}}" Style="{StaticResource TextBorder}" Tag="DM" TabIndex="5" GotKeyboardFocus="TextBox_GotKeyboardFocus" KeyUp="TextBox_KeyUp" />
226226
<TextBlock Grid.Row="5" Grid.Column="4" Text="m" Margin="2,0,8,0" Style="{StaticResource TextBlockLabel}" />
227-
<TextBox Grid.Row="5" Grid.Column="5" Text="{Binding TargetDECSecond, StringFormat={}{0:00}}" Style="{StaticResource TextBorder}" />
227+
<TextBox Grid.Row="5" Grid.Column="5" Text="{Binding TargetDECSecond, StringFormat={}{0:00}}" Style="{StaticResource TextBorder}" Tag="DS" TabIndex="6" GotKeyboardFocus="TextBox_GotKeyboardFocus" KeyUp="TextBox_KeyUp" />
228228
<TextBlock Grid.Row="5" Grid.Column="6" Text="s" Margin="2,0,8,0" Style="{StaticResource TextBlockLabel}" />
229229

230230
<Button Grid.Row="6" Grid.Column="1" Style="{StaticResource ArrowStyle}" Content="{StaticResource IconArrowDown}" Command="{Binding ArrowCommand}" CommandParameter="DD-" />
@@ -365,7 +365,6 @@
365365
<ColumnDefinition Width="Auto"/>
366366
<ColumnDefinition Width="3*"/>
367367
<ColumnDefinition Width="Auto"/>
368-
<ColumnDefinition Width="*"/>
369368
</Grid.ColumnDefinitions>
370369
<TextBlock Grid.Column="3" Text="{Binding DriftAlignStatus}" Style="{StaticResource TextBlockLabelSmall}"/>
371370
<Border Grid.Row="1" Grid.Column="3" Padding="0,1,0,0">
@@ -504,7 +503,7 @@
504503
</Grid.ColumnDefinitions>
505504
<TextBlock Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" Text="Calibration" Margin="10,12,0,0" Style="{StaticResource TextBlockLabel}" />
506505

507-
<TextBlock Grid.Column="0" Grid.Row="1" Text="Speed" Margin="10,12,0,0" Style="{StaticResource TextBlockLabelSmall}" />
506+
<TextBlock Grid.Column="0" Grid.Row="1" Text="Speed" Margin="0,0" Style="{StaticResource TextBlockLabelSmall}" />
508507
<Controls:NumericUpDown Grid.Column="1" Grid.Row="1" Value="{Binding SpeedCalibrationFactor}" Margin="10,0,0,0"
509508
NumericInputMode="Decimal" StringFormat="0.0000" Maximum="3" Minimum="0.25" Interval="0.0001" Style="{StaticResource NumericBorder}"/>
510509

@@ -531,15 +530,17 @@
531530
</Grid>
532531

533532

534-
<TextBlock Grid.Row="4" Grid.Column="0" Text="Telescope" Style="{StaticResource TextBlockHeading}" Margin="0,10,0,0" />
535-
<Grid Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="4" >
533+
<Grid Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="4" >
536534
<Grid.ColumnDefinitions>
537535
<ColumnDefinition Width="*" />
538536
<ColumnDefinition Width="*" />
537+
<ColumnDefinition Width="*" />
539538
</Grid.ColumnDefinitions>
540-
<Button Grid.Column="0" Margin="10,12,0,0" Style="{StaticResource AccentedSquareButtonStyle}" Command="{Binding ConnectScopeCommand}" Content="{Binding ConnectCommandString}"/>
539+
<TextBlock Grid.Row="0" Grid.Column="1" Text="Mount" Style="{StaticResource TextBlockHeading}" Margin="0,10,0,0" HorizontalAlignment="Right"/>
540+
<Button Grid.Column="2" Margin="10,12,0,0" Style="{StaticResource AccentedSquareButtonStyle}" Command="{Binding ConnectScopeCommand}" Content="{Binding ConnectCommandString}"/>
541541
</Grid>
542-
<TextBlock Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="4" Text="{Binding ScopeName}" Style="{StaticResource TextBlockLabel}" Margin="0,2,0,0" />
542+
<TextBlock Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="3" Text="{Binding ScopeName}" Style="{StaticResource TextBlockLabel}" Margin="0,2,0,0" HorizontalAlignment="Right" />
543+
<TextBlock Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="3" Text="{Binding ScopeHardware}" Style="{StaticResource TextBlockLabelSmall}" Margin="0,2,0,0" HorizontalAlignment="Right" />
543544

544545

545546
<!--<Button Grid.Row="5" Grid.Column="1" Style="{StaticResource ArrowStyle}" Content="{StaticResource IconArrowUp}" Command="{Binding ArrowCommand}" CommandParameter="HH+" />

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,41 @@ public MainWindow()
2929
InitializeComponent();
3030
this.DataContext = mountVm;
3131
}
32+
33+
private void TextBox_GotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
34+
{
35+
TextBox tb = sender as TextBox;
36+
if (tb != null)
37+
{
38+
tb.SelectAll();
39+
}
40+
}
41+
42+
private void TextBox_KeyUp(object sender, KeyEventArgs e)
43+
{
44+
TextBox tb = sender as TextBox;
45+
if (tb != null)
46+
{
47+
int newNum;
48+
if (int.TryParse(tb.Text, out newNum))
49+
{
50+
string command = tb.Tag as string;
51+
if (e.Key == Key.Up)
52+
{
53+
command += "+";
54+
}
55+
else if (e.Key == Key.Down)
56+
{
57+
command += "-";
58+
}
59+
else
60+
{
61+
return;
62+
}
63+
64+
mountVm.OnAdjustTarget(command);
65+
}
66+
}
67+
}
3268
}
3369
}

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.9.03")]
54+
[assembly: AssemblyVersion("0.9.9.04")]
5555
[assembly: AssemblyFileVersion("1.0.0.0")]

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public class MountVM : ViewModelBase
5656
private float _maxMotorSpeed = 600;
5757
double _speed = 1.0;
5858
string _scopeName = string.Empty;
59+
string _scopeHardware = string.Empty;
5960
string _mountStatus = string.Empty;
6061
string _currentHA = string.Empty;
6162
CultureInfo _oatCulture = new CultureInfo("en-US");
@@ -401,6 +402,8 @@ private async void OnConnectToTelescope()
401402
{
402403
MountConnected = false;
403404
_commHandler.Disconnect();
405+
ScopeName = string.Empty;
406+
ScopeHardware = string.Empty;
404407
_oatMount = null;
405408
_commHandler = null;
406409
RequeryCommands();
@@ -429,7 +432,12 @@ private async void OnConnectToTelescope()
429432
var resultNr = await _oatMount.SendCommand("GVN#,#");
430433
ScopeName = $"{result.Data} {resultNr.Data}";
431434

432-
Log.WriteLine("Mount: Connected to {0}", ScopeName);
435+
var hardware = await _oatMount.SendCommand("XGM#,#");
436+
Log.WriteLine("Mount: Hardware is {0}", hardware);
437+
var hwParts = hardware.Data.Split(',');
438+
var raParts = hwParts[1].Split('|');
439+
var decParts = hwParts[2].Split('|');
440+
ScopeHardware = $"{hwParts[0]} board RA {raParts[0]}, {raParts[1]}T DEC {decParts[0]}, {decParts[1]}T";
433441

434442
_transform.SiteElevation = 0; // _oatMount.SiteElevation;
435443
Log.WriteLine("Mount: Getting OAT Latitude");
@@ -615,7 +623,7 @@ private int AdjustClamp(int current, int adjustBy, int minVal, int maxVal)
615623
return current;
616624
}
617625

618-
private void OnAdjustTarget(string command)
626+
public void OnAdjustTarget(string command)
619627
{
620628
int inc = command[2] == '-' ? -1 : 1;
621629
char comp = command[1];
@@ -867,6 +875,15 @@ public string ScopeName
867875
set { SetPropertyValue(ref _scopeName, value); }
868876
}
869877

878+
/// <summary>
879+
/// Gets or sets the name of the scope
880+
/// </summary>
881+
public string ScopeHardware
882+
{
883+
get { return _scopeHardware; }
884+
set { SetPropertyValue(ref _scopeHardware, value); }
885+
}
886+
870887
/// <summary>
871888
/// Gets or sets the status of the scope
872889
/// </summary>

0 commit comments

Comments
 (0)