Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 901 → Rev 902

/C-OSD/trunk/osd_ncmode_default.c/osd_ncmode_default.c
1,5 → 1,5
/****************************************************************************
* Copyright (C) 2009-2010 by Claas Anders "CaScAdE" Rathje *
* Copyright (C) 2009-2011 by Claas Anders "CaScAdE" Rathje *
* admiralcascade@gmail.com *
* Project-URL: http://www.mylifesucks.de/oss/c-osd/ *
* *
69,6 → 69,14
write_ndigit_number_u(2, top_line, (uint16_t)(((uint32_t)naviData.GroundSpeed * (uint32_t)279) / (uint32_t)12500), 3, 0);
} else {
write_ndigit_number_u(2, top_line, (uint16_t)(((uint32_t)naviData.GroundSpeed * (uint32_t)9) / (uint32_t)250), 3, 0);
 
// draw big speed-meter only if configure AND not flying OR stats off and not flying
if ((COSD_FLAGS_CONFIG & COSD_FLAG_BIGSPEED)
&& ((naviData.FCFlags & FCFLAG_MOTOR_RUN)
|| !((COSD_FLAGS_RUNTIME & COSD_WASFLYING) && (COSD_FLAGS_MODES & COSD_FLAG_STATS)))) {
 
draw_big_variometer(2, 8, (uint16_t)((uint32_t)naviData.GroundSpeed / (uint32_t)125));
}
}
 
write_ndigit_number_u(7, top_line, rc_signal, 3, 0);
178,52 → 186,7
}
// stats
if ((COSD_FLAGS_RUNTIME & COSD_WASFLYING) && (COSD_FLAGS_MODES & COSD_FLAG_STATS)) {
uint8_t line = 3;
write_ascii_string_pgm(1, line, (const char *)(pgm_read_word(&(stats_item_pointers[0])))); // max Altitude
write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[1])))); // max Speed
write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[2])))); // max Distance
 
if (COSD_FLAGS_CONFIG & COSD_FLAG_FEET) {
write_ndigit_number_s(16, line - 2, max_Altimeter * 32 / 10, 4, 0);
write_char_xy(20, line - 2, 0x7E); // small feet ft
write_ndigit_number_u(17, line - 1, (uint16_t)(((uint32_t)max_GroundSpeed * (uint32_t)279) / (uint32_t)12500), 3, 0);
write_char_xy(20, line - 1, 0x7D); // mp/h
write_ndigit_number_u(16, line - 0, max_Distance / 10 * 32 / 10, 4, 0);
write_char_xy(20, line - 0, 0x7E); // small feet ft
} else {
write_ndigit_number_s(16, line - 2, max_Altimeter, 4, 0);
write_char_xy(20, line - 2, 204); // small meters m
write_ndigit_number_u(17, line - 1, (uint16_t)(((uint32_t)max_GroundSpeed * (uint32_t)9) / (uint32_t)250), 3, 0);
write_char_xy(20, line - 1, 203); // km/h
write_ndigit_number_u(16, line - 0, max_Distance / 10, 4, 0);
write_char_xy(20, line - 0, 204); // small meters m
}
 
write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[3])))); // min voltage
write_ndigit_number_u_10th(16, line, min_UBat, 3, 0);
write_char_xy(20, line, 0x9E); // small V
if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) || (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) {
write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[7])))); // ampere
write_ndigit_number_u_10th(16, line, max_ampere / 10, 3, 0);
write_char_xy(20, line, 0x9F); // small A
 
// wasted mampere in this flight (will count up after landing)
if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) && !(COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) {
write_ndigit_number_u(21, line, (ampere_wasted / 10) - wasted_ampere_offset, 5, 0);
} else if (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT) {
 
write_ndigit_number_u(21, line, naviData.UsedCapacity - wasted_ampere_offset, 5, 0);
}
 
write_char_xy(26, line, 0xB5); // mah
}
write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[4])))); // max time
write_time(14, line, max_FlyingTime);
write_char_xy(20, line, 210); // fly clock
write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[5])))); // longitude
write_gps_pos(14, line, naviData.CurrentPosition.Longitude);
write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[6])))); // latitude
write_gps_pos(14, line, naviData.CurrentPosition.Latitude);
draw_stats();
} else if (COSD_FLAGS_MODES & COSD_FLAG_ARTHORIZON) { // if no stats there is space horizon
uint8_t horizon_bottom = bottom_line - 1;
if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) || (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) {
236,6 → 199,15
}
}
}
 
// show coords only when configure AND stats are off OR stats are on and motors are off
if ((COSD_FLAGS_CONFIG & COSD_FLAG_SHOW_COORDS)
&& ((naviData.FCFlags & FCFLAG_MOTOR_RUN)
|| !((COSD_FLAGS_RUNTIME & COSD_WASFLYING) && (COSD_FLAGS_MODES & COSD_FLAG_STATS)))) {
write_gps_pos(15, bottom_line - 2, naviData.CurrentPosition.Longitude);
write_gps_pos(15, bottom_line - 1, naviData.CurrentPosition.Latitude);
}
 
if (COSD_FLAGS_MODES & COSD_FLAG_BIGVARIO) {
draw_big_variometer(27, 8, naviData.Variometer);
}
293,9 → 265,10
write_char_xy(27, bottom_line, 201); // sat2 (free)
}
 
 
// after all, draw scope
if (COSD_FLAGS_CONFIG & COSD_FLAG_SHOW_SCOPE) {
// after all, draw scope WHEN configured AND flying OR Stats are off
if ((COSD_FLAGS_CONFIG & COSD_FLAG_SHOW_SCOPE)
&& ((naviData.FCFlags & FCFLAG_MOTOR_RUN)
|| !((COSD_FLAGS_RUNTIME & COSD_WASFLYING) && (COSD_FLAGS_MODES & COSD_FLAG_STATS)))) {
draw_scope();
}
}