Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 2430 → Rev 2431

/MKLiveView/v1.0/Source/FlightControllerMessage.cs
4,7 → 4,10
/// (http://hdl.lib.byu.edu/1877/2747)
/// (http://hdl.lib.byu.edu/1877/2748)
///============================================================================
/// made minor changes here...
///============================================================================
 
 
using System;
using System.Collections.Generic;
using System.Linq;
/MKLiveView/v1.0/Source/MainWindow.xaml
389,7 → 389,7
</Style>
</Window.Resources>
<Grid>
<Grid x:Name="GridGMapControl">
<Grid x:Name="GridGMapControl" TouchDown="OnPreviewTouchDown">
<WindowsPresentation:GMapControl x:Name="MainMap" Loaded="MainMap_Loaded" OnPositionChanged="MainMap_OnPositionChanged" OnMapZoomChanged="MainMap_OnMapZoomChanged" StylusDown="MainMap_StylusDown" StylusUp="MainMap_StylusUp" StylusMove="MainMap_StylusMove"/>
</Grid>
<Grid>
594,7 → 594,7
</Label.Style>
</Label>
</Grid>
<Grid x:Name="GridData" Background="#7F000000" HorizontalAlignment="Left" Width="204" Margin="23,36,0,0" Visibility="Collapsed" >
<Grid x:Name="GridData" Background="#7F000000" HorizontalAlignment="Left" Width="204" Margin="23,36,0,0" >
<TabControl x:Name="tabControl" HorizontalAlignment="Left" Height="619" VerticalAlignment="Top" Width="200" Background="{x:Null}" Margin="2,0,0,0">
<TabItem Header="Analog">
<Grid>
646,10 → 646,12
<Label x:Name="label6_Copy21" Content="Gr. speed (NC)" HorizontalAlignment="Left" Margin="6,392,0,0" VerticalAlignment="Top" Background="{x:Null}" Foreground="White" FontSize="14"/>
<TextBlock x:Name="tbHeadingCompass" HorizontalAlignment="Left" Height="23" Margin="110,415,0,0" TextWrapping="Wrap" Text="NA" VerticalAlignment="Top" Width="65" Foreground="White" FontSize="16"/>
<Label x:Name="label6_Copy22" Content="Heading (NC)" HorizontalAlignment="Left" Margin="6,411,0,0" VerticalAlignment="Top" Background="{x:Null}" Foreground="White" FontSize="14"/>
<TextBlock x:Name="tbHeadingNorth" HorizontalAlignment="Left" Height="23" Margin="110,433,0,0" TextWrapping="Wrap" Text="NA" VerticalAlignment="Top" Width="65" Foreground="White" FontSize="16"/>
<Label x:Name="label6_Copy23" Content="Heading north" HorizontalAlignment="Left" Margin="6,429,0,0" VerticalAlignment="Top" Background="{x:Null}" Foreground="White" FontSize="14"/>
<TextBlock x:Name="tbLiPoCells" HorizontalAlignment="Left" Height="23" Margin="110,433,0,0" TextWrapping="Wrap" Text="NA" VerticalAlignment="Top" Width="65" Foreground="White" FontSize="16"/>
<Label x:Name="label6_Copy23" Content="LipoCells" HorizontalAlignment="Left" Margin="6,429,0,0" VerticalAlignment="Top" Background="{x:Null}" Foreground="White" FontSize="14"/>
<TextBlock x:Name="tbWPMaxRange" HorizontalAlignment="Left" Height="23" Margin="110,370,0,0" TextWrapping="Wrap" Text="NA" VerticalAlignment="Top" Width="65" Foreground="White" FontSize="16"/>
<Label x:Name="label6_Copy24" Content="WP max range" HorizontalAlignment="Left" Margin="6,366,0,0" VerticalAlignment="Top" Background="{x:Null}" Foreground="White" FontSize="14"/>
<TextBlock x:Name="tbCamCtrl" HorizontalAlignment="Left" Height="23" Margin="110,450,0,0" TextWrapping="Wrap" Text="NA" VerticalAlignment="Top" Width="65" Foreground="White" FontSize="16"/>
<Label x:Name="label6_Copy30" Content="CamCtrl" HorizontalAlignment="Left" Margin="6,446,0,0" VerticalAlignment="Top" Background="{x:Null}" Foreground="White" FontSize="14"/>
 
</Grid>
</TabItem>
1243,7 → 1245,7
</LinearGradientBrush>
</Label.Background>
</Label>
<Grid x:Name="GridWP" Margin="23,36,25,0" Background="#7F000000" Height="526" VerticalAlignment="Top">
<Grid x:Name="GridWP" Margin="23,36,25,0" Background="#7F000000" Height="526" VerticalAlignment="Top" Visibility="Collapsed">
<Label x:Name="label4" Content="points" HorizontalAlignment="Right" Margin="0,480,51,0" VerticalAlignment="Top" Width="53" Foreground="White" Height="19" HorizontalContentAlignment="Right" Padding="0" VerticalContentAlignment="Center" FontSize="13" Visibility="Hidden"/>
<Label x:Name="lblWPCount" Content="##" HorizontalAlignment="Right" Margin="0,482,19,0" VerticalAlignment="Top" Width="26" Foreground="White" HorizontalContentAlignment="Right" Padding="0" Height="16" FontSize="13" Visibility="Hidden"/>
<Label x:Name="label4_Copy" Content="WP Index" HorizontalAlignment="Left" Margin="94,194,0,0" VerticalAlignment="Top" Width="80" Foreground="White" Visibility="Hidden"/>
/MKLiveView/v1.0/Source/MainWindow.xaml.cs
1,4 → 1,54
using GMap.NET;
///============================================================================
/// MKLiveView
/// Copyright © 2016 Steph
///
///This file is part of MKLiveView.
///
///MKLiveView is free software: you can redistribute it and/or modify
///it under the terms of the GNU General Public License as published by
///the Free Software Foundation, either version 3 of the License, or
///(at your option) any later version.
///
///MKLiveView is distributed in the hope that it will be useful,
///but WITHOUT ANY WARRANTY; without even the implied warranty of
///MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
///GNU General Public License for more details.
///
///You should have received a copy of the GNU General Public License
///along with cssRcon. If not, see <http://www.gnu.org/licenses/>.
///
///============================================================================
///Credits:
 
/// radioman (http://www.codeplex.com/site/users/view/radioman)
/// for his really GreatMaps! (http://greatmaps.codeplex.com/)
///
/// I made some changes to the source, so You need all files from this project here in order to compile and run
///
/// JOHN C. MACDONALD at Ira A. Fulton College of Engineering and Technology
/// for his MIKROKOPTER SERIAL CONTROL TUTORIAL (http://hdl.lib.byu.edu/1877/2747)
/// and the sourcecode (http://hdl.lib.byu.edu/1877/2748)
/// By his work I finally managed to get the communication with the Mikrokopter controllers to run
/// Some of his code was used in this programm like the SimpelSerialPort class (with lots of changes)
/// and the FilghtControllerMessage class
///
///============================================================================
/// DISCLAIMER
/// ===========
///
/// I created this software with my best knowledge and belief.
///
/// IN NO EVENT, UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING,
/// SHALL I, OR ANY PERSON BE LIABLE FOR ANY LOSS, EXPENSE OR DAMAGE,
/// OF ANY TYPE OR NATURE ARISING OUT OF THE USE OF,
/// OR INABILITY TO USE THIS SOFTWARE OR PROGRAM,
/// INCLUDING, BUT NOT LIMITED TO, CLAIMS, SUITS OR CAUSES OF ACTION
/// INVOLVING ALLEGED INFRINGEMENT OF COPYRIGHTS,
/// PATENTS, TRADEMARKS, TRADE SECRETS, OR UNFAIR COMPETITION.
///
/// This means: use it & have fun (but @ Your own risk...)
/// ===========================================================================
using GMap.NET;
using GMap.NET.MapProviders;
using GMap.NET.WindowsPresentation;
using MKLiveView.GMapCustomMarkers;
691,6 → 741,48
Application.Current.Shutdown();
}
 
#region doubletap //http://stackoverflow.com/questions/9001023/capturing-double-tap-touch-on-multi-touch-screen
private Point? _lastTapLocation;
private readonly Stopwatch _doubleTapStopwatch = new Stopwatch();
 
private bool IsDoubleTap(TouchEventArgs e)
{
Point currentTapPosition = e.GetTouchPoint(this).Position;
bool tapsAreCloseInDistance = false;
if (_lastTapLocation != null)
{
tapsAreCloseInDistance = GetDistanceBetweenPoints(currentTapPosition, (Point)_lastTapLocation) < 70;
}
_lastTapLocation = currentTapPosition;
 
TimeSpan elapsed = _doubleTapStopwatch.Elapsed;
_doubleTapStopwatch.Restart();
bool tapsAreCloseInTime = (elapsed != TimeSpan.Zero && elapsed < TimeSpan.FromSeconds(0.4));
 
if (tapsAreCloseInTime && tapsAreCloseInDistance)
{
_lastTapLocation = null;
}
return tapsAreCloseInDistance && tapsAreCloseInTime;
}
 
private void OnPreviewTouchDown(object sender, TouchEventArgs e)
{
if (IsDoubleTap(e))
{
MainMap.CanDragMap = false;
MessageBox.Show("Blubb!");
}
}
public static double GetDistanceBetweenPoints(Point p, Point q)
{
double a = p.X - q.X;
double b = p.Y - q.Y;
double distance = Math.Sqrt(a * a + b * b);
return distance;
}
 
#endregion doubletap
#endregion events
 
#region GMap
1845,6 → 1937,8
switch ((int)data[0])
{
case 10:
char[] c = Encoding.ASCII.GetChars(new byte[] { data[13] });
Dispatcher.Invoke((Action)(() => tbCamCtrl.Text = c[0].ToString()));
break;
case 11:
OSDSTATUSFLAGS2 = osd.OSDSTATUSFLAGS2();
1931,6 → 2025,8
}
Dispatcher.Invoke((Action)(() => tbWPMaxRange.Text = iVal.ToString() + " m"));
}
//--------------- LiPoCell count ------------------------
Dispatcher.Invoke((Action)(() => tbLiPoCells.Text = data[25].ToString()));
 
break;
 
2408,10 → 2504,10
Dispatcher.Invoke((Action)(() => tbTopSpeed.Text = ((double)(iVal)/100).ToString("0.00 m/s")));
 
//--------------- Heading north ------------------------
i_16 = data[61];
i_16 = (Int16)(i_16 << 8);
iVal = data[60] + i_16;
Dispatcher.Invoke((Action)(() => tbHeadingNorth.Text = iVal.ToString() + " °"));
//i_16 = data[61];
//i_16 = (Int16)(i_16 << 8);
//iVal = data[60] + i_16;
//Dispatcher.Invoke((Action)(() => tbHeadingNorth.Text = iVal.ToString() + " °"));
 
//--------------- Heading compass ------------------------
i_16 = data[63];
5152,6 → 5248,7
 
}
 
 
private void btnLoadGPXLog_Click(object sender, RoutedEventArgs e)
{
_loadGPXLog();
5416,5 → 5513,4
IsMaximized = false;
}
}
 
}
/MKLiveView/v1.0/Source/SerialPortCtrl.xaml.cs
4,7 → 4,11
/// (http://hdl.lib.byu.edu/1877/2747)
/// (http://hdl.lib.byu.edu/1877/2748)
///============================================================================
/// made lot of changes here...
///============================================================================
 
 
 
using System;
using System.Collections.Generic;
using System.Linq;