Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 496 → Rev 497

/C-OSD/trunk/osd_fcmode_default.c
17,68 → 17,82
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
****************************************************************************/
if (COSD_FLAGS & COSD_FLAG_HUD) {
// write icons at init or after menu/mode-switch
if (!(COSD_FLAGS2 & COSD_ICONS_WRITTEN)) {
write_char_xy(10, top_line, 0xCA); // RC-transmitter
write_char_xy(27, top_line, 0xCC); // small meters m height
write_char_xy(7, bottom_line, 0x9E); // small v
if (COSD_FLAGS2 & COSD_FLAG_STROMREC) {
write_char_xy(7, bottom_line - 1, 0x9F); // small A
write_char_xy(14, bottom_line - 1, 0xB5); // mah
 
#include "main.h"
#include "max7456_software_spi.h"
#include "osd_helpers.h"
#include "osd_fcmode_default.h"
 
#if !(ALLCHARSDEBUG|(WRITECHARS != -1))
 
int osd_fcmode_default() {
if (COSD_FLAGS & COSD_FLAG_HUD) {
// write icons at init or after menu/mode-switch
if (!(COSD_FLAGS2 & COSD_ICONS_WRITTEN)) {
write_char_xy(10, top_line, 0xCA); // RC-transmitter
write_char_xy(27, top_line, 0xCC); // small meters m height
write_char_xy(7, bottom_line, 0x9E); // small v
if (COSD_FLAGS2 & COSD_FLAG_STROMREC) {
write_char_xy(7, bottom_line - 1, 0x9F); // small A
write_char_xy(14, bottom_line - 1, 0xB5); // mah
}
COSD_FLAGS2 |= COSD_ICONS_WRITTEN;
}
COSD_FLAGS2 |= COSD_ICONS_WRITTEN;
}
 
write_ndigit_number_u(7, top_line, debugData.Analog[10], 100, 0);
if (debugData.Analog[10] <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) {
for (uint8_t x = 0; x < 4; x++)
write_char_att_xy(7 + x, top_line, BLINK);
} else if (debugData.Analog[10] > RCLVL_WRN && last_RC_Quality <= RCLVL_WRN) {
for (uint8_t x = 0; x < 4; x++)
write_char_att_xy(7 + x, top_line, 0);
}
write_ndigit_number_u(7, top_line, debugData.Analog[10], 100, 0);
if (debugData.Analog[10] <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) {
for (uint8_t x = 0; x < 4; x++)
write_char_att_xy(7 + x, top_line, BLINK);
} else if (debugData.Analog[10] > RCLVL_WRN && last_RC_Quality <= RCLVL_WRN) {
for (uint8_t x = 0; x < 4; x++)
write_char_att_xy(7 + x, top_line, 0);
}
if (debugData.Analog[5] > 300 || debugData.Analog[5] < -300) {
// above 10m only write full meters
write_ndigit_number_s(23, top_line, debugData.Analog[5] / 30, 1000, 0);
} else {
// up to 10m write meters.dm
write_ndigit_number_s_10th(23, top_line, debugData.Analog[5] / 3, 100, 0);
}
if (debugData.Analog[5] > max_Altimeter) max_Altimeter = debugData.Analog[5];
if (debugData.Analog[5] > 300 || debugData.Analog[5] < -300) {
// above 10m only write full meters
write_ndigit_number_s(23, top_line, debugData.Analog[5] / 30, 1000, 0);
} else {
// up to 10m write meters.dm
write_ndigit_number_s_10th(23, top_line, debugData.Analog[5] / 3, 100, 0);
}
if (debugData.Analog[5] > max_Altimeter) max_Altimeter = debugData.Analog[5];
 
if (COSD_FLAGS & COSD_FLAG_ARTHORIZON) {
draw_artificial_horizon(top_line + 2, bottom_line - 1, debugData.Analog[0], debugData.Analog[1]);
}
if (COSD_FLAGS & COSD_FLAG_ARTHORIZON) {
draw_artificial_horizon(top_line + 2, bottom_line - 1, debugData.Analog[0], debugData.Analog[1]);
}
 
// pre-bottom line
if (COSD_FLAGS2 & COSD_FLAG_STROMREC) {
//write_ndigit_number_s(3, bottom_line - 1, ampere, 1000, 0);
write_ndigit_number_u_10th(3, bottom_line - 1, ampere / 10, 100, 0);
write_ndigit_number_s(10, bottom_line - 1, ampere_wasted / 10, 1000, 0);
// pre-bottom line
if (COSD_FLAGS2 & COSD_FLAG_STROMREC) {
//write_ndigit_number_s(3, bottom_line - 1, ampere, 1000, 0);
write_ndigit_number_u_10th(3, bottom_line - 1, ampere / 10, 100, 0);
write_ndigit_number_s(10, bottom_line - 1, ampere_wasted / 10, 1000, 0);
}
 
draw_battery(2, bottom_line, min_voltage, debugData.Analog[9], max_voltage);
write_ndigit_number_u_10th(3, bottom_line, debugData.Analog[9], 100, 0);
if (debugData.Analog[9] <= min_voltage && last_UBat > min_voltage) {
for (uint8_t x = 2; x < 8; x++)
write_char_att_xy(x, bottom_line, BLINK);
} else if (debugData.Analog[9] > min_voltage && last_UBat < min_voltage) {
for (uint8_t x = 2; x < 8; x++)
write_char_att_xy(x, bottom_line, 0);
}
}
// remember last values
last_UBat = debugData.Analog[9];
last_RC_Quality = debugData.Analog[10];
 
draw_battery(2, bottom_line, min_voltage, debugData.Analog[9], max_voltage);
write_ndigit_number_u_10th(3, bottom_line, debugData.Analog[9], 100, 0);
if (debugData.Analog[9] <= min_voltage && last_UBat > min_voltage) {
for (uint8_t x = 2; x < 8; x++)
write_char_att_xy(x, bottom_line, BLINK);
} else if (debugData.Analog[9] > min_voltage && last_UBat < min_voltage) {
for (uint8_t x = 2; x < 8; x++)
write_char_att_xy(x, bottom_line, 0);
}
/*
debugData.Analog[0]); // AngleNick
debugData.Analog[1]); // AngleRoll
debugData.Analog[5]); // Height
debugData.Analog[9]); // Voltage
debugData.Analog[10]);// RC Signal
debugData.Analog[11]);// Gyro compass
*/
seconds_since_last_data = 0;
 
return 0;
}
// remember last values
last_UBat = debugData.Analog[9];
last_RC_Quality = debugData.Analog[10];
 
/*
debugData.Analog[0]); // AngleNick
debugData.Analog[1]); // AngleRoll
debugData.Analog[5]); // Height
debugData.Analog[9]); // Voltage
debugData.Analog[10]);// RC Signal
debugData.Analog[11]);// Gyro compass
*/
seconds_since_last_data = 0;
#endif