Rev 412 | Rev 454 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 412 | Rev 453 | ||
---|---|---|---|
Line 83... | Line 83... | ||
83 | 83 | ||
84 | // general PAL|NTSC distingiusch stuff |
84 | // general PAL|NTSC distingiusch stuff |
85 | uint8_t top_line = 1; |
85 | uint8_t top_line = 1; |
Line -... | Line 86... | ||
- | 86 | uint8_t bottom_line = 14; |
|
- | 87 | ||
- | 88 | // battery voltages |
|
- | 89 | uint8_t min_voltage = 0; |
|
86 | uint8_t bottom_line = 14; |
90 | uint8_t max_voltage = 0; |
87 | 91 | ||
Line 88... | Line 92... | ||
88 | // Flags |
92 | // Flags |
89 | uint8_t COSD_FLAGS = 0; |
93 | uint8_t COSD_FLAGS = 0; |
Line 451... | Line 455... | ||
451 | seconds_since_last_data = 0;*/ |
455 | seconds_since_last_data = 0;*/ |
452 | } else if (rxd_buffer[2] == 'O') { // NC OSD Data |
456 | } else if (rxd_buffer[2] == 'O') { // NC OSD Data |
453 | Decode64(); |
457 | Decode64(); |
454 | naviData = *((NaviData_t*) pRxData); |
458 | naviData = *((NaviData_t*) pRxData); |
Line -... | Line 459... | ||
- | 459 | ||
- | 460 | // init on first data retrival, distinguished by last battery :) |
|
- | 461 | // TODO: this is testing stuff, strings should go progmem and so on... |
|
- | 462 | if (last_UBat == 255) { |
|
- | 463 | clear(); |
|
- | 464 | // fix for min_bat glitch caused by data only gathered during motors up |
|
- | 465 | min_UBat = naviData.UBat; |
|
- | 466 | write_ascii_string(2, 2, "C-OSD Initialisation"); |
|
- | 467 | uint8_t cellnum = 0; |
|
- | 468 | if (CELL_NUM == -1) { |
|
- | 469 | write_ascii_string(2, 5, "Guessing Number of Cells"); |
|
- | 470 | do { |
|
- | 471 | cellnum++; |
|
- | 472 | } while (naviData.UBat > ((cellnum * CELL_VOLT_MAX) + 10)); |
|
- | 473 | } else { |
|
- | 474 | cellnum = CELL_NUM; |
|
- | 475 | } |
|
- | 476 | min_voltage = cellnum * CELL_VOLT_MIN; |
|
- | 477 | max_voltage = cellnum * CELL_VOLT_MAX; |
|
- | 478 | write_ascii_string(2, 7, "Number of Cells:"); |
|
- | 479 | write_ndigit_number_u(21, 7, cellnum, 1, 0); |
|
- | 480 | write_ascii_string(2, 8, "Warn Voltage :"); |
|
- | 481 | write_ndigit_number_s_10th(20, 8, min_voltage, 100, 0); |
|
- | 482 | write_ascii_string(2, 9, "Max Voltage :"); |
|
- | 483 | write_ndigit_number_s_10th(20, 9, max_voltage, 100, 0); |
|
- | 484 | _delay_ms(200); |
|
- | 485 | clear(); |
|
- | 486 | // update flags to paint display again because of clear |
|
- | 487 | COSD_FLAGS &= ~COSD_ICONS_WRITTEN; |
|
- | 488 | } |
|
455 | 489 | ||
456 | // first line |
490 | // first line |
Line 457... | Line 491... | ||
457 | write_ndigit_number_u(2, top_line, (uint16_t) (((uint32_t) naviData.GroundSpeed * (uint32_t)9) / (uint32_t)250), 100, 0); |
491 | write_ndigit_number_u(2, top_line, (uint16_t) (((uint32_t) naviData.GroundSpeed * (uint32_t)9) / (uint32_t)250), 100, 0); |
458 | 492 | ||
Line 540... | Line 574... | ||
540 | if (COSD_FLAGS & COSD_FLAG_BIGVARIO) { |
574 | if (COSD_FLAGS & COSD_FLAG_BIGVARIO) { |
541 | draw_big_variometer(27, 8, naviData.Variometer); |
575 | draw_big_variometer(27, 8, naviData.Variometer); |
542 | } |
576 | } |
Line 543... | Line 577... | ||
543 | 577 | ||
544 | // bottom line |
578 | // bottom line |
545 | draw_battery(2, bottom_line, naviData.UBat); |
579 | draw_battery(2, bottom_line, min_voltage, naviData.UBat, max_voltage); |
546 | write_ndigit_number_u_10th(3, bottom_line, naviData.UBat, 100, 0); |
580 | write_ndigit_number_u_10th(3, bottom_line, naviData.UBat, 100, 0); |
547 | if (naviData.UBat <= UBAT_WRN && last_UBat > UBAT_WRN) { |
581 | if (naviData.UBat <= min_voltage && last_UBat > min_voltage) { |
548 | for (uint8_t x = 2; x < 8; x++) |
582 | for (uint8_t x = 2; x < 8; x++) |
549 | write_char_att_xy(x, bottom_line, BLINK); |
583 | write_char_att_xy(x, bottom_line, BLINK); |
550 | } else { |
584 | } else if (naviData.UBat > min_voltage && last_UBat < min_voltage) { |
551 | for (uint8_t x = 2; x < 8; x++) |
585 | for (uint8_t x = 2; x < 8; x++) |
552 | write_char_att_xy(x, bottom_line, 0); |
586 | write_char_att_xy(x, bottom_line, 0); |
553 | } |
- | |
- | 587 | } |
|
- | 588 | // remember last values |
|
Line 554... | Line 589... | ||
554 | 589 | last_UBat = naviData.UBat; |
|
555 | 590 | ||
Line 556... | Line 591... | ||
556 | write_time(8, bottom_line, uptime); |
591 | write_time(8, bottom_line, uptime); |