Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 349 → Rev 348

/C-OSD/trunk/main.c
541,10 → 541,6
char* directions[8] = {"NE", "E ", "SE", "S ", "SW", "W ", "NW", "N "};
char arrowdir[8] = {218, 217, 224, 223, 222, 221, 220, 219};
 
/*write_ndigit_number_s_10th(5, 10, 1, 100, 0);
write_ndigit_number_s_10th(5, 11, -1, 100, 0);
write_ndigit_number_s_10th(5, 12, -11, 100, 0);*/
 
while (1) {
// write icons at init or after menu/mode-switch
if (!(COSD_FLAGS & COSD_ICONS_WRITTEN) && (COSD_FLAGS & COSD_FLAG_HUD)) {
577,9 → 573,9
naviData = *((NaviData_t*) pRxData);
 
// first line
write_ndigit_number_u(2, top_line, (uint16_t) (((uint32_t) naviData.GroundSpeed * 36) / 1000), 100, 0);
write_3digit_number_u(2, top_line, (uint16_t) (((uint32_t) naviData.GroundSpeed * 36) / 1000));
 
write_ndigit_number_u(7, top_line, naviData.RC_Quality, 100, 0);
write_3digit_number_u(7, top_line, naviData.RC_Quality);
if (naviData.RC_Quality <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) {
for (uint8_t x = 0; x < 4; x++)
write_char_att_xy(7 + x, top_line, BLINK);
589,7 → 585,7
}
last_RC_Quality = naviData.RC_Quality;
 
write_ndigit_number_u(13, top_line, naviData.CompassHeading, 100, 0);
write_3digit_number_u(13, top_line, naviData.CompassHeading);
 
write_ascii_string(17, top_line, directions[heading_conv(naviData.CompassHeading)]);
 
606,13 → 602,12
}
 
//note:lephisto:according to several sources it's /30
if (naviData.Altimeter > 300 || naviData.Altimeter < -300) {
if (naviData.Altimeter > 300) {
// above 10m only write full meters
write_ndigit_number_s(23, top_line, naviData.Altimeter / 30, 1000, 0);
write_number_s(22, top_line, naviData.Altimeter / 30);
} else {
// up to 10m write meters.dm
//write_number_u_10th(21, top_line, naviData.Altimeter / 3);
write_ndigit_number_s_10th(23, top_line, naviData.Altimeter / 3, 100, 0);
write_number_u_10th(21, top_line, naviData.Altimeter / 3);
}
 
// seccond line
622,7 → 617,7
uint16_t heading_home = (naviData.HomePositionDeviation.Bearing + 360 - naviData.CompassHeading) % 360;
write_char_xy(27, top_line + 1, arrowdir[heading_conv(heading_home)]);
 
write_ndigit_number_u(24, top_line + 1, naviData.HomePositionDeviation.Distance / 100, 100, 0);
write_number_s(22, top_line + 1, naviData.HomePositionDeviation.Distance / 100);
 
// center
if (naviData.MKFlags & FLAG_MOTOR_RUN) { // should be engines running
638,16 → 633,16
// stats
if (COSD_FLAGS & COSD_FLAG_STATS) {
write_ascii_string_pgm(2, 5, stats_item_pointers[0]); // max Altitude
write_ndigit_number_s(18, 5, max_Altimeter / 30, 1000, 0);
write_number_s(17, 5, max_Altimeter / 30);
write_char_xy(22, 5, 204); // small meters m
write_ascii_string_pgm(2, 6, stats_item_pointers[1]); // max Speed
write_ndigit_number_u(19, 6, (uint16_t) (((uint32_t) max_GroundSpeed * 36) / 1000), 100, 0);
write_3digit_number_u(19, 6, (uint16_t) (((uint32_t) max_GroundSpeed * 36) / 1000));
write_char_xy(22, 6, 203); // km/h
write_ascii_string_pgm(2, 7, stats_item_pointers[2]); // max Distance
write_ndigit_number_u(19, 7, max_Distance / 100, 100, 0);
write_number_s(17, 7, max_Distance / 100);
write_char_xy(22, 7, 204); // small meters m
write_ascii_string_pgm(2, 8, stats_item_pointers[3]); // min voltage
write_ndigit_number_u_10th(18, 8, min_UBat, 100, 0);
write_number_u_10th(16, 8, min_UBat);
write_ascii_string(22, 8, "V"); // voltage
write_ascii_string_pgm(2, 9, stats_item_pointers[4]); // max time
write_time(16, 9, max_FlyingTime);
658,7 → 653,7
}
 
// bottom line
write_ndigit_number_u_10th(2, bottom_line, naviData.UBat, 100, 0);
write_number_u_10th(0, bottom_line, naviData.UBat);
if (naviData.UBat <= UBAT_WRN && last_UBat > UBAT_WRN) {
for (uint8_t x = 0; x < 7; x++)
write_char_att_xy(x, bottom_line, BLINK);
670,7 → 665,7
write_time(8, bottom_line, uptime);
write_time(16, bottom_line, naviData.FlyingTime);
 
write_ndigit_number_u(24, bottom_line, naviData.SatsInUse, 10, 0);
write_3digit_number_u(23, bottom_line, naviData.SatsInUse);
 
if (naviData.NCFlags & NC_FLAG_CH) {
write_char_xy(27, bottom_line, 231); // gps ch