Rev 2361 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2361 | Rev 2362 | ||
---|---|---|---|
Line 2215... | Line 2215... | ||
2215 | 2215 | ||
2216 | return false; |
2216 | return false; |
2217 | } |
2217 | } |
2218 | void _sendWPList() |
2218 | void _sendWPList() |
- | 2219 | { |
|
- | 2220 | _sendWPList(0); |
|
- | 2221 | } |
|
- | 2222 | void _sendWPList(int iStart) |
|
2219 | { |
2223 | { |
2220 | int iTimeout = 0; |
2224 | int iTimeout = 0; |
2221 | if (serialPortCtrl.Port.IsOpen) |
2225 | if (serialPortCtrl.Port.IsOpen) |
2222 | { |
2226 | { |
2223 | if (_clearCopterWPList()) |
2227 | if (_clearCopterWPList()) |
- | 2228 | { |
|
2224 | { |
2229 | int k = 1; |
2225 | for (int i = 0; i < dtWaypoints.Rows.Count; i++) |
2230 | for (int i = iStart; i < dtWaypoints.Rows.Count; i++) |
- | 2231 | { |
|
2226 | { |
2232 | k = iStart > 0 ? k : -1; |
Line 2227... | Line 2233... | ||
2227 | _sendWayPoint(dtWaypoints.Rows[i],-1,'w'); |
2233 | _sendWayPoint(dtWaypoints.Rows[i], k, 'w'); |
2228 | 2234 | ||
2229 | _iWPCount = -1; |
2235 | _iWPCount = -1; |
2230 | iTimeout = 0; |
2236 | iTimeout = 0; |
Line 2237... | Line 2243... | ||
2237 | { |
2243 | { |
2238 | Log(LogMsgType.Error, "Timeout while sending list!"); |
2244 | Log(LogMsgType.Error, "Timeout while sending list!"); |
2239 | break; |
2245 | break; |
2240 | } |
2246 | } |
2241 | Dispatcher.Invoke(() => lblWPCount.Content = _iWPCount.ToString()); |
2247 | Dispatcher.Invoke(() => lblWPCount.Content = _iWPCount.ToString()); |
- | 2248 | k++; |
|
2242 | } |
2249 | } |
2243 | } |
2250 | } |
2244 | } |
2251 | } |
2245 | else |
2252 | else |
2246 | Log(LogMsgType.Error, "NOT CONNECTED!"); |
2253 | Log(LogMsgType.Error, "NOT CONNECTED!"); |
Line 2247... | Line 2254... | ||
2247 | 2254 | ||
- | 2255 | } |
|
2248 | } |
2256 | |
2249 | bool _sendWayPoint(DataRow dr, int index, char command) |
2257 | bool _sendWayPoint(DataRow dr, int index, char command) |
Line 2250... | Line 2258... | ||
2250 | { |
2258 | { |
2251 | 2259 | ||
Line 2305... | Line 2313... | ||
2305 | //Speed |
2313 | //Speed |
2306 | bData[22] = Convert.ToByte(dr[7]); |
2314 | bData[22] = Convert.ToByte(dr[7]); |
2307 | //CamAngle |
2315 | //CamAngle |
2308 | bData[23] = (byte)Convert.ToInt16(dr[12]); |
2316 | bData[23] = (byte)Convert.ToInt16(dr[12]); |
2309 | //Name |
2317 | //Name |
- | 2318 | string s = index > 0 ? ((string)dr[2]).Substring(0, 1) + index.ToString() : (string)dr[2]; |
|
2310 | byte[] name = ASCIIEncoding.ASCII.GetBytes((string)dr[2]); |
2319 | byte[] name = ASCIIEncoding.ASCII.GetBytes(s); |
2311 | bData[24] = name.Length > 0 ? name[0] : (byte)0; |
2320 | bData[24] = name.Length > 0 ? name[0] : (byte)0; |
2312 | bData[25] = name.Length > 1 ? name[1] : (byte)0; |
2321 | bData[25] = name.Length > 1 ? name[1] : (byte)0; |
2313 | bData[26] = name.Length > 2 ? name[2] : (byte)0; |
2322 | bData[26] = name.Length > 2 ? name[2] : (byte)0; |
2314 | bData[27] = name.Length > 3 ? name[3] : (byte)0; |
2323 | bData[27] = name.Length > 3 ? name[3] : (byte)0; |
2315 | //Autotrigger |
2324 | //Autotrigger |
Line 2438... | Line 2447... | ||
2438 | mp.Open(file); |
2447 | mp.Open(file); |
2439 | mp.Play(); |
2448 | mp.Play(); |
2440 | } |
2449 | } |
2441 | } |
2450 | } |
Line -... | Line 2451... | ||
- | 2451 | ||
2442 | 2452 | #region ui |
|
2443 | /// <summary> |
2453 | /// <summary> |
2444 | /// Switch between fullscreen and normal window mode |
2454 | /// Switch between fullscreen and normal window mode |
2445 | /// save & restore scaling settings |
2455 | /// save & restore scaling settings |
2446 | /// </summary> |
2456 | /// </summary> |
Line 2551... | Line 2561... | ||
2551 | scaleNormalOSD = UIScaleOSDSlider.Value; |
2561 | scaleNormalOSD = UIScaleOSDSlider.Value; |
2552 | scaleNormalLOG = UIScaleLOGSlider.Value; |
2562 | scaleNormalLOG = UIScaleLOGSlider.Value; |
2553 | scaleNormalHorizon = UIScaleHorizonSlider.Value; |
2563 | scaleNormalHorizon = UIScaleHorizonSlider.Value; |
2554 | } |
2564 | } |
2555 | } |
2565 | } |
- | 2566 | #endregion ui |
|
Line 2556... | Line 2567... | ||
2556 | 2567 | ||
2557 | /// <summary> |
2568 | /// <summary> |
2558 | /// read settings from ini-file |
2569 | /// read settings from ini-file |
2559 | /// </summary> |
2570 | /// </summary> |
Line 3527... | Line 3538... | ||
3527 | } |
3538 | } |
3528 | private void btnSendActiveWP_Click(object sender, RoutedEventArgs e) |
3539 | private void btnSendActiveWP_Click(object sender, RoutedEventArgs e) |
3529 | { |
3540 | { |
3530 | if (dgvWP.SelectedIndex > -1 && dgvWP.SelectedIndex < dtWaypoints.Rows.Count) |
3541 | if (dgvWP.SelectedIndex > -1 && dgvWP.SelectedIndex < dtWaypoints.Rows.Count) |
3531 | { |
3542 | { |
3532 | if (_wpCount > 0) |
3543 | //if (_wpCount > 0) |
3533 | _sendWayPoint(dtWaypoints.Rows[dgvWP.SelectedIndex], -1,'s'); |
3544 | // _sendWayPoint(dtWaypoints.Rows[dgvWP.SelectedIndex], -1,'s'); |
3534 | else |
3545 | //else |
3535 | _sendWayPoint(dtWaypoints.Rows[dgvWP.SelectedIndex], 1,'s'); |
3546 | // _sendWayPoint(dtWaypoints.Rows[dgvWP.SelectedIndex], 1,'s'); |
3536 | - | ||
3537 | Dispatcher.Invoke(() => { |
- | |
3538 | DataGridRow row; |
- | |
3539 | if (_wpIndex > -1 && _wpIndex < dgvWP.ItemContainerGenerator.Items.Count) |
- | |
3540 | { |
- | |
3541 | row = (DataGridRow)dgvWP.ItemContainerGenerator.ContainerFromIndex(_wpIndex); |
- | |
3542 | row.Background = new SolidColorBrush(Colors.Transparent); |
- | |
3543 | row.BorderBrush = new SolidColorBrush(Colors.Transparent); |
- | |
3544 | row.BorderThickness = new Thickness(0); |
- | |
3545 | } |
- | |
3546 | _wpIndex = dgvWP.SelectedIndex; |
3547 | int index = dgvWP.SelectedIndex; |
3547 | row = (DataGridRow)dgvWP.ItemContainerGenerator.ContainerFromIndex(_wpIndex); |
- | |
3548 | row.Background = new SolidColorBrush(Color.FromArgb(80, 0, 100, 255)); |
- | |
3549 | row.BorderBrush = new SolidColorBrush(Colors.Aqua); |
- | |
3550 | row.BorderThickness = new Thickness(2); |
3548 | Thread t = new Thread(() => _sendWPList(index)); |
3551 | dgvWP.UpdateLayout(); |
- | |
3552 | }); |
3549 | t.Start(); |
3553 | } |
- | |
3554 | } |
- | |
3555 | private void btnSendActiveWP2_Click(object sender, RoutedEventArgs e) |
- | |
3556 | { |
- | |
3557 | if (dgvWP.SelectedIndex > -1 && dgvWP.SelectedIndex < dtWaypoints.Rows.Count) |
- | |
3558 | { |
- | |
3559 | if (_wpCount > 0) |
- | |
3560 | _sendWayPoint(dtWaypoints.Rows[dgvWP.SelectedIndex], _wpCount,'s'); |
- | |
3561 | else |
- | |
3562 | _sendWayPoint(dtWaypoints.Rows[dgvWP.SelectedIndex], 1,'s'); |
- | |
Line 3563... | Line 3550... | ||
3563 | 3550 | ||
3564 | Dispatcher.Invoke(() => { |
3551 | Dispatcher.Invoke(() => { |
3565 | DataGridRow row; |
3552 | DataGridRow row; |
3566 | if (_wpIndex > -1 && _wpIndex < dgvWP.ItemContainerGenerator.Items.Count) |
3553 | if (_wpIndex > -1 && _wpIndex < dgvWP.ItemContainerGenerator.Items.Count) |