Rev 453 | Rev 455 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 453 | Rev 454 | ||
---|---|---|---|
Line 257... | Line 257... | ||
257 | case 5: // reset uptime |
257 | case 5: // reset uptime |
258 | uptime = 0; |
258 | uptime = 0; |
259 | config_menu_doclick(chosen, menu); |
259 | config_menu_doclick(chosen, menu); |
260 | break; |
260 | break; |
261 | case 6: // re-request OSD data |
261 | case 6: // re-request OSD data |
- | 262 | #if FCONLY |
|
- | 263 | // request data ever 100ms from FC; |
|
- | 264 | usart1_request_mk_data(0, 'd', 100); |
|
- | 265 | #else |
|
262 | // request OSD Data from NC every 100ms |
266 | // request OSD Data from NC every 100ms |
263 | usart1_request_mk_data(1, 'o', 100); |
267 | usart1_request_mk_data(1, 'o', 100); |
- | 268 | ||
- | 269 | // and disable debug... |
|
- | 270 | usart1_request_mk_data(0, 'd', 0); |
|
- | 271 | #endif |
|
264 | config_menu_doclick(chosen, menu); |
272 | config_menu_doclick(chosen, menu); |
265 | break; |
273 | break; |
266 | case 7: // disable debug data |
274 | case 7: // disable debug data |
267 | // disable sending of debug data |
275 | // disable sending of debug data |
268 | // may result in smoother ddata display |
276 | // may result in smoother ddata display |
Line 397... | Line 405... | ||
397 | #else |
405 | #else |
398 | // clear serial screen |
406 | // clear serial screen |
399 | //usart1_puts("\x1B[2J\x1B[H"); |
407 | //usart1_puts("\x1B[2J\x1B[H"); |
400 | //usart1_puts("hello world!\r\n"); |
408 | //usart1_puts("hello world!\r\n"); |
Line 401... | Line 409... | ||
401 | 409 | ||
402 | 410 | #if FCONLY |
|
403 | // request data ever 100ms from FC; |
411 | // request data ever 100ms from FC; |
404 | //usart1_request_mk_data(0, 'd', 100); |
412 | usart1_request_mk_data(0, 'd', 100); |
405 | 413 | #else |
|
406 | // request OSD Data from NC every 100ms |
414 | // request OSD Data from NC every 100ms |
Line 407... | Line 415... | ||
407 | usart1_request_mk_data(1, 'o', 100); |
415 | usart1_request_mk_data(1, 'o', 100); |
408 | 416 | ||
- | 417 | // and disable debug... |
|
Line 409... | Line 418... | ||
409 | // and disable debug... |
418 | usart1_request_mk_data(0, 'd', 0); |
410 | usart1_request_mk_data(0, 'd', 0); |
419 | #endif |
411 | 420 | ||
412 | // stats for after flight |
421 | // stats for after flight |
Line 423... | Line 432... | ||
423 | //char arrowdir[8] = {218, 217, 224, 223, 222, 221, 220, 219}; |
432 | //char arrowdir[8] = {218, 217, 224, 223, 222, 221, 220, 219}; |
Line 424... | Line 433... | ||
424 | 433 | ||
425 | while (1) { |
434 | while (1) { |
426 | // write icons at init or after menu/mode-switch |
435 | // write icons at init or after menu/mode-switch |
- | 436 | if (!(COSD_FLAGS & COSD_ICONS_WRITTEN) && (COSD_FLAGS & COSD_FLAG_HUD)) { |
|
- | 437 | #if FCONLY |
|
- | 438 | // FC Mode ICONS |
|
- | 439 | write_char_xy(10, top_line, 0xCA); // RC-transmitter |
|
- | 440 | write_char_xy(27, top_line, 0xCC); // small meters m height |
|
- | 441 | write_char_xy(7, bottom_line, 0x9E); // small v |
|
- | 442 | #else |
|
427 | if (!(COSD_FLAGS & COSD_ICONS_WRITTEN) && (COSD_FLAGS & COSD_FLAG_HUD)) { |
443 | // NAVI Mode ICONS |
428 | write_char_xy(5, top_line, 0xCB); // km/h |
444 | write_char_xy(5, top_line, 0xCB); // km/h |
429 | write_char_xy(10, top_line, 0xCA); // RC-transmitter |
445 | write_char_xy(10, top_line, 0xCA); // RC-transmitter |
430 | write_char_xy(16, top_line, 0xD0); // degree symbol |
446 | write_char_xy(16, top_line, 0xD0); // degree symbol |
431 | write_char_xy(27, top_line, 0xCC); // small meters m height |
447 | write_char_xy(27, top_line, 0xCC); // small meters m height |
Line 436... | Line 452... | ||
436 | write_char_xy(14, bottom_line, 0xD1); // on clock |
452 | write_char_xy(14, bottom_line, 0xD1); // on clock |
437 | write_char_xy(21, bottom_line, 0xD2); // fly clock |
453 | write_char_xy(21, bottom_line, 0xD2); // fly clock |
438 | write_char_xy(26, bottom_line, 0xC8); // sat1 |
454 | write_char_xy(26, bottom_line, 0xC8); // sat1 |
439 | write_char_xy(27, bottom_line, 0xC9); // sat2 |
455 | write_char_xy(27, bottom_line, 0xC9); // sat2 |
440 | COSD_FLAGS |= COSD_ICONS_WRITTEN; |
456 | COSD_FLAGS |= COSD_ICONS_WRITTEN; |
- | 457 | #endif |
|
441 | } |
458 | } |
442 | if (rxd_buffer_locked) { |
459 | if (rxd_buffer_locked) { |
443 | if (COSD_FLAGS & COSD_FLAG_HUD) { |
460 | if (COSD_FLAGS & COSD_FLAG_HUD) { |
- | 461 | #if FCONLY |
|
444 | if (rxd_buffer[2] == 'D') { // FC Data |
462 | if (rxd_buffer[2] == 'D') { // FC Data |
445 | /*Decode64(); |
463 | Decode64(); |
446 | debugData = *((DebugOut_t*) pRxData); |
464 | debugData = *((DebugOut_t*) pRxData); |
- | 465 | write_ascii_string(2, 2, "FCONLY MODE"); |
|
- | 466 | ||
- | 467 | write_ndigit_number_u(7, top_line, debugData.Analog[10], 100, 0); |
|
- | 468 | if (debugData.Analog[10] <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) { |
|
- | 469 | for (uint8_t x = 0; x < 4; x++) |
|
- | 470 | write_char_att_xy(7 + x, top_line, BLINK); |
|
- | 471 | } else if (debugData.Analog[10] > RCLVL_WRN && last_RC_Quality <= RCLVL_WRN) { |
|
- | 472 | for (uint8_t x = 0; x < 4; x++) |
|
- | 473 | write_char_att_xy(7 + x, top_line, 0); |
|
- | 474 | } |
|
- | 475 | last_RC_Quality = debugData.Analog[10]; |
|
- | 476 | ||
- | 477 | ||
- | 478 | if (debugData.Analog[5] > 300 || debugData.Analog[5] < -300) { |
|
- | 479 | // above 10m only write full meters |
|
- | 480 | write_ndigit_number_s(23, top_line, debugData.Analog[5] / 30, 1000, 0); |
|
- | 481 | } else { |
|
- | 482 | // up to 10m write meters.dm |
|
- | 483 | write_ndigit_number_s_10th(23, top_line, debugData.Analog[5] / 3, 100, 0); |
|
- | 484 | } |
|
- | 485 | ||
- | 486 | draw_battery(2, bottom_line, min_voltage, debugData.Analog[9], max_voltage); |
|
- | 487 | write_ndigit_number_u_10th(3, bottom_line, debugData.Analog[9], 100, 0); |
|
- | 488 | if (debugData.Analog[9] <= min_voltage && last_UBat > min_voltage) { |
|
447 | write_number_s(12, 2, RxDataLen); |
489 | for (uint8_t x = 2; x < 8; x++) |
- | 490 | write_char_att_xy(x, bottom_line, BLINK); |
|
- | 491 | } else if (debugData.Analog[9] > min_voltage && last_UBat < min_voltage) { |
|
- | 492 | for (uint8_t x = 2; x < 8; x++) |
|
448 | write_number_s(20, 2, setsReceived++); |
493 | write_char_att_xy(x, bottom_line, 0); |
- | 494 | } |
|
- | 495 | // remember last values |
|
- | 496 | last_UBat = debugData.Analog[9]; |
|
- | 497 | ||
- | 498 | /* |
|
449 | write_number_s(12, 3, debugData.Analog[0]); // AngleNick |
499 | debugData.Analog[0]); // AngleNick |
450 | write_number_s(12, 4, debugData.Analog[1]); // AngleRoll |
500 | debugData.Analog[1]); // AngleRoll |
451 | write_number_s(12, 5, debugData.Analog[5]); // Height |
501 | debugData.Analog[5]); // Height |
452 | write_number_s(12, 6, debugData.Analog[9]); // Voltage |
502 | debugData.Analog[9]); // Voltage |
453 | write_number_s(12, 7, debugData.Analog[10]);// RC Signal |
503 | debugData.Analog[10]);// RC Signal |
454 | write_number_s(12, 8, debugData.Analog[11]);// Gyro compass |
504 | debugData.Analog[11]);// Gyro compass |
- | 505 | */ |
|
455 | seconds_since_last_data = 0;*/ |
506 | seconds_since_last_data = 0; |
- | 507 | } |
|
- | 508 | #else |
|
456 | } else if (rxd_buffer[2] == 'O') { // NC OSD Data |
509 | if (rxd_buffer[2] == 'O') { // NC OSD Data |
457 | Decode64(); |
510 | Decode64(); |
458 | naviData = *((NaviData_t*) pRxData); |
511 | naviData = *((NaviData_t*) pRxData); |
Line 459... | Line 512... | ||
459 | 512 | ||
460 | // init on first data retrival, distinguished by last battery :) |
513 | // init on first data retrival, distinguished by last battery :) |
Line 622... | Line 675... | ||
622 | } |
675 | } |
Line 623... | Line 676... | ||
623 | 676 | ||
624 | old_MKFlags = naviData.MKFlags; |
677 | old_MKFlags = naviData.MKFlags; |
625 | seconds_since_last_data = 0; |
678 | seconds_since_last_data = 0; |
- | 679 | } |
|
626 | } |
680 | #endif |
627 | } |
681 | } |
628 | rxd_buffer_locked = 0; |
682 | rxd_buffer_locked = 0; |
629 | } |
683 | } |
630 | // handle keypress |
684 | // handle keypress |
631 | if (s1_pressed()) { |
685 | if (s1_pressed()) { |
632 | config_menu(); |
686 | config_menu(); |
633 | } |
687 | } |
- | 688 | if (seconds_since_last_data > 2) { |
|
- | 689 | #if FCONLY |
|
- | 690 | // request data ever 100ms from FC; |
|
- | 691 | usart1_request_mk_data(0, 'd', 100); |
|
634 | if (seconds_since_last_data > 2) { |
692 | #else |
635 | // request OSD Data from NC every 100ms |
693 | // request OSD Data from NC every 100ms |
- | 694 | usart1_request_mk_data(1, 'o', 100); |
|
- | 695 | ||
636 | usart1_request_mk_data(1, 'o', 100); |
696 | // and disable debug... |
- | 697 | usart1_request_mk_data(0, 'd', 0); |
|
637 | seconds_since_last_data = 0; |
698 | #endif |
638 | } |
699 | } |
639 | } |
700 | } |
640 | #endif |
701 | #endif |
641 | return 0; |
702 | return 0; |