Rev 2398 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2398 | Rev 2399 | ||
---|---|---|---|
Line 1555... | Line 1555... | ||
1555 | Dispatcher.Invoke(() => tbCur.Text = ((double)iAnalogData[index] / (double)10).ToString("0.0 A")); |
1555 | Dispatcher.Invoke(() => tbCur.Text = ((double)iAnalogData[index] / (double)10).ToString("0.0 A")); |
1556 | Dispatcher.Invoke(() => tbTopCurrent.Text = ((double)iAnalogData[index] / (double)10).ToString("0.0 A")); |
1556 | Dispatcher.Invoke(() => tbTopCurrent.Text = ((double)iAnalogData[index] / (double)10).ToString("0.0 A")); |
1557 | break; |
1557 | break; |
1558 | case 10: //heading |
1558 | case 10: //heading |
1559 | Dispatcher.Invoke((Action)(() => tbHeading.Text = sAnalogData[index] + "°")); |
1559 | Dispatcher.Invoke((Action)(() => tbHeading.Text = sAnalogData[index] + "°")); |
- | 1560 | if (!_Simulate) //use NavData for simulation |
|
- | 1561 | { |
|
1560 | Dispatcher.Invoke(() => ArtHor.rotate = iAnalogData[index]); |
1562 | Dispatcher.Invoke(() => ArtHor.rotate = iAnalogData[index]); |
1561 | //Dispatcher.Invoke(() => ((CustomMarkerCopter)(copter.Shape)).rotate = iAnalogData[index]); |
1563 | Dispatcher.Invoke(() => ((CustomMarkerCopter)(copter.Shape)).rotate = iAnalogData[index]); |
- | 1564 | } |
|
1562 | break; |
1565 | break; |
1563 | case 12: // SPI error |
1566 | case 12: // SPI error |
1564 | Dispatcher.Invoke((Action)(() => tbSPI.Text = sAnalogData[index])); |
1567 | Dispatcher.Invoke((Action)(() => tbSPI.Text = sAnalogData[index])); |
1565 | break; |
1568 | break; |
1566 | case 14: //i2c error |
1569 | case 14: //i2c error |
Line 1610... | Line 1613... | ||
1610 | } |
1613 | } |
1611 | } |
1614 | } |
1612 | break; |
1615 | break; |
1613 | case 21: //GroundSpeed |
1616 | case 21: //GroundSpeed |
1614 | Dispatcher.Invoke((Action)(() => tbSpeed.Text = ((double)iAnalogData[index] / (double)100).ToString("0.00 m/s"))); |
1617 | Dispatcher.Invoke((Action)(() => tbSpeed.Text = ((double)iAnalogData[index] / (double)100).ToString("0.00 m/s"))); |
- | 1618 | if (!_Simulate) |
|
1615 | Dispatcher.Invoke((Action)(() => tbTopSpeed.Text = ((double)iAnalogData[index] / (double)100).ToString("0.00 m/s"))); |
1619 | Dispatcher.Invoke((Action)(() => tbTopSpeed.Text = ((double)iAnalogData[index] / (double)100).ToString("0.00 m/s"))); |
1616 | break; |
1620 | break; |
Line 1617... | Line 1621... | ||
1617 | 1621 | ||
1618 | ///********** needs testing --> not sure what position this is *************** |
1622 | ///********** needs testing --> not sure what position this is *************** |
1619 | case 28: //Distance East from saved home position -> calculate distance with distance N + height |
1623 | case 28: //Distance East from saved home position -> calculate distance with distance N + height |
Line 1760... | Line 1764... | ||
1760 | iVal += data[5]; |
1764 | iVal += data[5]; |
1761 | d = (double)iVal / Math.Pow(10, 7); |
1765 | d = (double)iVal / Math.Pow(10, 7); |
1762 | Dispatcher.Invoke(() => { drGPX[1] = d; }); |
1766 | Dispatcher.Invoke(() => { drGPX[1] = d; }); |
1763 | Dispatcher.Invoke(() => { drGPX[4] = DateTime.UtcNow.ToString("u", System.Globalization.CultureInfo.InvariantCulture); }); //2011-01-14T01:59:01Z }); |
1767 | Dispatcher.Invoke(() => { drGPX[4] = DateTime.UtcNow.ToString("u", System.Globalization.CultureInfo.InvariantCulture); }); //2011-01-14T01:59:01Z }); |
1764 | p.Lat = d; |
1768 | p.Lat = d; |
- | 1769 | ||
1765 | if (data[50] > 4)//if more than 4 sats in use . otherwise the map would jump and scroll insane at beginning |
1770 | if (data[50] > 4)//if more than 4 sats in use . otherwise the map would jump and scroll insane at beginning |
1766 | { |
1771 | { |
1767 | _bSatFix = true; _iSatsJitter = 0; _bVoiceSatFixActive = false; |
1772 | _bSatFix = true; _iSatsJitter = 0; _bVoiceSatFixActive = false; |
1768 | if(_bAutoHome && !_bFirstSatFix) |
1773 | if(_bAutoHome && !_bFirstSatFix) |
1769 | { |
1774 | { |
Line 1822... | Line 1827... | ||
1822 | _bSatFix = false; |
1827 | _bSatFix = false; |
1823 | } |
1828 | } |
1824 | } |
1829 | } |
1825 | } |
1830 | } |
Line -... | Line 1831... | ||
- | 1831 | ||
1826 | 1832 | //Distance to next WP |
|
1827 | i_16 = data[28]; |
1833 | i_16 = data[28]; |
1828 | i_16 = (Int16)(i_16 << 8); |
1834 | i_16 = (Int16)(i_16 << 8); |
1829 | iVal = data[27] + i_16; |
1835 | iVal = data[27] + i_16; |
- | 1836 | Dispatcher.Invoke((Action)(() => tbWP.Text = ((double)iVal / (double)10).ToString("0.0 m"))); |
|
Line 1830... | Line 1837... | ||
1830 | Dispatcher.Invoke((Action)(() => tbWP.Text = ((double)iVal / (double)10).ToString("0.0 m"))); //Distance to next WP |
1837 | Dispatcher.Invoke((Action)(() => lblWPRouteDistanceWP.Content = ((double)iVal / (double)10).ToString("0.0 m"))); |
1831 | 1838 | ||
1832 | i_16 = data[45]; |
1839 | i_16 = data[45]; |
1833 | i_16 = (Int16)(i_16 << 8); |
1840 | i_16 = (Int16)(i_16 << 8); |
1834 | iVal = data[44] + i_16; |
1841 | iVal = data[44] + i_16; |
Line 1835... | Line 1842... | ||
1835 | // Dispatcher.Invoke((Action)(() => tbTopDistanceHP.Text = ((double)iVal / (double)10).ToString("0.0 m"))); //Distance to HP set by GPS on |
1842 | // Dispatcher.Invoke((Action)(() => tbTopDistanceHP.Text = ((double)iVal / (double)10).ToString("0.0 m"))); //Distance to HP set by GPS on |
1836 | Dispatcher.Invoke((Action)(() => tbHP.Text = ((double)iVal / (double)10).ToString("0.0 m"))); //Distance to HP set by GPS on |
1843 | Dispatcher.Invoke((Action)(() => tbHP.Text = ((double)iVal / (double)10).ToString("0.0 m"))); //Distance to HP set by GPS on |
1837 | 1844 | ||
1838 | Dispatcher.Invoke((Action)(() => tbWPIndex.Text = data[48].ToString())); //Waypoint index |
1845 | Dispatcher.Invoke((Action)(() => tbWPIndex.Text = data[48].ToString())); //Waypoint index |
1839 | Dispatcher.Invoke((Action)(() => lblWPIndexNC.Content = data[48].ToString())); |
1846 | Dispatcher.Invoke((Action)(() => lblWPIndexNC.Content = data[48].ToString())); |
1840 | if(data[48] > 0 && _wpIndex != data[48] -1 && wpList.Count > 0) |
1847 | if(data[48] > 0 && _wpIndex != data[48] -1 && wpList.Count >= data[48] -1) |
1841 | { |
1848 | { |
1842 | _setActiveWP(data[48]-1); |
1849 | _setActiveWP(data[48]-1); |
Line 1894... | Line 1901... | ||
1894 | 1901 | ||
1895 | //--------------- Ground speed ------------------------ |
1902 | //--------------- Ground speed ------------------------ |
1896 | i_16 = data[59]; |
1903 | i_16 = data[59]; |
1897 | i_16 = (Int16)(i_16 << 8); |
1904 | i_16 = (Int16)(i_16 << 8); |
1898 | iVal = data[58] + i_16; |
1905 | iVal = data[58] + i_16; |
- | 1906 | Dispatcher.Invoke((Action)(() => tbNCGrSpeed.Text = ((double)(iVal)/100).ToString("0.00 m/s"))); |
|
- | 1907 | if(_Simulate) |
|
Line 1899... | Line 1908... | ||
1899 | Dispatcher.Invoke((Action)(() => tbNCGrSpeed.Text = ((double)(iVal)/100).ToString("0.00 m/s"))); |
1908 | Dispatcher.Invoke((Action)(() => tbTopSpeed.Text = ((double)(iVal)/100).ToString("0.00 m/s"))); |
1900 | 1909 | ||
1901 | //--------------- Heading north ------------------------ |
1910 | //--------------- Heading north ------------------------ |
1902 | i_16 = data[61]; |
1911 | i_16 = data[61]; |
Line 1907... | Line 1916... | ||
1907 | //--------------- Heading compass ------------------------ |
1916 | //--------------- Heading compass ------------------------ |
1908 | i_16 = data[63]; |
1917 | i_16 = data[63]; |
1909 | i_16 = (Int16)(i_16 << 8); |
1918 | i_16 = (Int16)(i_16 << 8); |
1910 | iVal = data[62] + i_16; |
1919 | iVal = data[62] + i_16; |
1911 | Dispatcher.Invoke((Action)(() => tbHeadingCompass.Text = iVal.ToString() + " °")); |
1920 | Dispatcher.Invoke((Action)(() => tbHeadingCompass.Text = iVal.ToString() + " °")); |
- | 1921 | if (_Simulate) |
|
- | 1922 | { |
|
1912 | //Dispatcher.Invoke(() => ArtHor.rotate = iVal); |
1923 | Dispatcher.Invoke(() => ArtHor.rotate = iVal); |
1913 | Dispatcher.Invoke(() => ((CustomMarkerCopter)(copter.Shape)).rotate = iVal); |
1924 | Dispatcher.Invoke(() => ((CustomMarkerCopter)(copter.Shape)).rotate = iVal); |
- | 1925 | } |
|
1914 | //--------------- Flying time ------------------------ |
1926 | //--------------- Flying time ------------------------ |
1915 | i_16 = data[56]; |
1927 | i_16 = data[56]; |
1916 | i_16 = (Int16)(i_16 << 8); |
1928 | i_16 = (Int16)(i_16 << 8); |
1917 | iVal = data[55] + i_16; |
1929 | iVal = data[55] + i_16; |
1918 | TimeSpan t = TimeSpan.FromSeconds(iVal); |
1930 | TimeSpan t = TimeSpan.FromSeconds(iVal); |
Line 1952... | Line 1964... | ||
1952 | } |
1964 | } |
1953 | _iRCLevelJitter++; |
1965 | _iRCLevelJitter++; |
1954 | } |
1966 | } |
1955 | } |
1967 | } |
Line -... | Line 1968... | ||
- | 1968 | ||
- | 1969 | //Target hold time |
|
- | 1970 | Dispatcher.Invoke((Action)(() => lblWPHoldTime.Content = data[73].ToString()+ " s")); |
|
1956 | 1971 | ||
1957 | //--------------- NC Error ------------------------ |
1972 | //--------------- NC Error ------------------------ |
1958 | Dispatcher.Invoke((Action)(() => tbNCErr.Text = data[69].ToString())); //NC Errornumber |
1973 | Dispatcher.Invoke((Action)(() => tbNCErr.Text = data[69].ToString())); //NC Errornumber |
1959 | if (data[69] > 0) |
1974 | if (data[69] > 0) |
1960 | _readNCError(); |
1975 | _readNCError(); |
Line 3777... | Line 3792... | ||
3777 | 3792 | ||
3778 | if (_wpCount > 0) |
3793 | if (_wpCount > 0) |
3779 | _sendWayPoint(dr, -1, 'w', false); |
3794 | _sendWayPoint(dr, -1, 'w', false); |
3780 | else |
3795 | else |
- | 3796 | _sendWayPoint(dr, 1, 'w', false); |
|
- | 3797 | ||
- | 3798 | if(_wpIndex > -1 && _wpIndex < dtWaypoints.Rows.Count) |
|
3781 | _sendWayPoint(dr, 1, 'w', false); |
3799 | _sendWayPoint(dtWaypoints.Rows[_wpIndex], _wpIndex + 1, 's', false); |
3782 | } |
3800 | } |
3783 | } |
3801 | } |
3784 | private void btnWPSimulateStart_Click(object sender, RoutedEventArgs e) |
3802 | private void btnWPSimulateStart_Click(object sender, RoutedEventArgs e) |
3785 | { |
3803 | { |