149,6 → 149,7 |
bool _navCtrlDataAutorefresh = true; |
bool _blctrlDataAutorefresh = true; |
bool _OSDAutorefresh = true; |
bool _bErrorLog = false; |
int crcError = 0; |
int iLableIndex = 0; |
string filePath = Directory.GetCurrentDirectory(); |
177,7 → 178,9 |
/// datatable for the debug data array - displayed on settings tabpage in datagridview |
/// </summary> |
DataTable dtAnalog = new DataTable(); |
|
/// <summary> |
/// datatable for motordata (current,temp) |
/// </summary> |
DataTable dtMotors1 = new DataTable(); |
DataTable dtMotors2 = new DataTable(); |
|
324,6 → 327,10 |
labelTimingOSD.Text = (OSDInterval * 10).ToString(); |
} |
} |
private void rtfError_LinkClicked(object sender, LinkClickedEventArgs e) |
{ |
System.Diagnostics.Process.Start(e.LinkText); |
} |
#endregion events |
|
/// <summary> Log data to the terminal window. </summary> |
378,6 → 385,7 |
rtfError.AppendText(msg + Environment.NewLine); |
|
})); |
_bErrorLog = true; |
} |
|
#region functions |
576,8 → 584,8 |
dTemp = Math.Sqrt(dTemp) / (double)10; //'flat' distance from HP with N/E |
// lblNCDist.Invoke((Action)(() => lblNCDist.Text = dTemp.ToString("0.00"))); |
dTemp = Math.Pow(dTemp, 2) + Math.Pow(((double)iAnalogData[4] / (double)10), 2); //adding 'height' into calculation |
dTemp = Math.Sqrt(dTemp); |
lblNCDistHP.Invoke((Action)(() => lblNCDistHP.Text = dTemp.ToString("0 m"))); |
dTemp = Math.Sqrt(dTemp) / (double)10; |
lblNCDistHP.Invoke((Action)(() => lblNCDistHP.Text = dTemp.ToString("0.0 m"))); |
break; |
case 31: //Sats used |
lblNCSat.Invoke((Action)(() => lblNCSat.Text = sAnalogData[index])); |
664,6 → 672,8 |
if (adr == 2) |
ErrorLog(LogMsgType.Error, "NC - Unknown HW-ERROR: " + data[6].ToString()); //@moment NC has only one error field |
} |
if((data[5] + data[6] == 0) && _bErrorLog) |
_clearErrorLog(adr==1 ? "FC - HW-Error" : "FC - HW-Error"); |
|
} |
check_HWError = false; |
745,8 → 755,21 |
iVal += data[5]; |
d = (double)iVal / Math.Pow(10, 7); |
lblNCGPSLat.Invoke((Action)(() => lblNCGPSLat.Text = d.ToString("0.######°"))); //GPS-Position: Latitude in decimal degree |
//lblNCGPSLat.Invoke((Action)(() => lblNCGPSLat.Text = _convertDegree(d))); //GPS-Position: Latitude in minutes, seconds |
//lblNCGPSLat.Invoke((Action)(() => lblNCGPSLat.Text = _convertDegree(d))); //GPS-Position: Latitude in minutes, seconds |
|
i_16 = data[28]; |
i_16 = (Int16)(i_16 << 8); |
iVal = data[27] + i_16; |
lblNCDistWP.Invoke((Action)(() => lblNCDistWP.Text = ((double)iVal/ (double)10).ToString("0.0 m"))); //Distance to next WP |
|
i_16 = data[45]; |
i_16 = (Int16)(i_16 << 8); |
iVal = data[44] + i_16; |
lblNCDistHP1.Invoke((Action)(() => lblNCDistHP1.Text = ((double)iVal/ (double)10).ToString("0.0 m"))); //Distance to next WP |
|
lblNCWPIndex.Invoke((Action)(() => lblNCWPIndex.Text = data[48].ToString())); //Waypoint index |
lblNCWPCount.Invoke((Action)(() => lblNCWPCount.Text = data[49].ToString())); //Waypoints count |
|
i_16 = data[81]; |
i_16 = (Int16)(i_16 << 8); |
iVal = data[80] + i_16; |
766,6 → 789,8 |
//break; |
if (data[69] > 0 & data[69] < 44) |
ErrorLog(LogMsgType.Error, "NC Error [" + data[69].ToString() + "]: " + NC_Error[data[69]]); |
else |
if(_bErrorLog) _clearErrorLog("NC Error"); |
|
} |
/// <summary> |
1097,6 → 1122,9 |
lblNCSat.Invoke((Action)(() => lblNCSat.Text = "NA")); //Sats used |
lblNCGPSLong.Invoke((Action)(() => lblNCGPSLong.Text = "NA")); //GPS position - longitude |
lblNCGPSLat.Invoke((Action)(() => lblNCGPSLat.Text = "NA")); //GPS position - latitude |
lblNCDistWP.Invoke((Action)(() => lblNCDistWP.Text = "NA")); //next WP distance |
lblNCWPIndex.Invoke((Action)(() => lblNCWPIndex.Text = "NA")); //index of actual WP |
lblNCWPCount.Invoke((Action)(() => lblNCWPCount.Text = "NA")); //count of items in WP list |
} |
/// <summary> |
/// one time query of the OSD Menue with pagenumber |
1252,6 → 1280,43 |
|
return deg.ToString("0° ") + min.ToString("0") + "' " + sec.ToString("0") + "," + milli.ToString() + "\""; |
} |
|
void _clearErrorLog(string s) |
{ |
rtfError.Invoke((Action)(() => |
{ |
if (rtfError.Text.Contains(s)) |
{ |
int iLength = 0; |
int iStart = rtfError.Text.IndexOf(s); |
int iEnd = rtfError.Text.IndexOf('\n', iStart); |
if (iEnd > 0) |
{ |
iLength = iEnd + 1; |
int iHttp = rtfError.Text.IndexOf("http", iEnd); |
if (iHttp == iLength) |
{ |
int iEnd2 = rtfError.Text.IndexOf('\n', iLength); |
if (iEnd2 > iLength) |
{ |
iLength = iEnd2 + 1; |
rtfError.Select(iStart, iLength); |
rtfError.SelectedText = string.Empty; |
if(rtfError.Text.Length < 2) _bErrorLog = false; |
} |
|
} |
else |
{ |
rtfError.Select(iStart, iLength); |
rtfError.SelectedText = string.Empty; |
if(rtfError.Text.Length < 2) _bErrorLog = false; |
} |
} |
} |
})); |
|
} |
#endregion functions |
|
#region buttons |
1374,6 → 1439,7 |
_OSDMenueAutoRefresh(4); |
} |
#endregion buttons |
|
} |
public class IniFile |
{ |