Subversion Repositories Projects

Rev

Rev 459 | Rev 471 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 459 Rev 468
1
/****************************************************************************
1
/****************************************************************************
2
 *   Copyright (C) 2009 by Claas Anders "CaScAdE" Rathje                    *
2
 *   Copyright (C) 2009 by Claas Anders "CaScAdE" Rathje                    *
3
 *   admiralcascade@gmail.com                                               *
3
 *   admiralcascade@gmail.com                                               *
4
 *   Project-URL: http://www.mylifesucks.de/oss/c-osd/                      *
4
 *   Project-URL: http://www.mylifesucks.de/oss/c-osd/                      *
5
 *                                                                          *
5
 *                                                                          *
6
 *   This program is free software; you can redistribute it and/or modify   *
6
 *   This program is free software; you can redistribute it and/or modify   *
7
 *   it under the terms of the GNU General Public License as published by   *
7
 *   it under the terms of the GNU General Public License as published by   *
8
 *   the Free Software Foundation; either version 2 of the License.         *
8
 *   the Free Software Foundation; either version 2 of the License.         *
9
 *                                                                          *
9
 *                                                                          *
10
 *   This program is distributed in the hope that it will be useful,        *
10
 *   This program is distributed in the hope that it will be useful,        *
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of         *
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of         *
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
13
 *   GNU General Public License for more details.                           *
13
 *   GNU General Public License for more details.                           *
14
 *                                                                          *
14
 *                                                                          *
15
 *   You should have received a copy of the GNU General Public License      *
15
 *   You should have received a copy of the GNU General Public License      *
16
 *   along with this program; if not, write to the                          *
16
 *   along with this program; if not, write to the                          *
17
 *   Free Software Foundation, Inc.,                                        *
17
 *   Free Software Foundation, Inc.,                                        *
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.              *
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.              *
19
 ****************************************************************************/
19
 ****************************************************************************/
20
 
20
 
21
// write icons at init or after menu/mode-switch
21
// write icons at init or after menu/mode-switch
22
if (!(COSD_FLAGS & COSD_ICONS_WRITTEN)) {
22
if (!(COSD_FLAGS & COSD_ICONS_WRITTEN)) {
23
    write_char_xy(10, top_line, 0xCA); // RC-transmitter
23
    write_char_xy(10, top_line, 0xCA); // RC-transmitter
24
    write_char_xy(27, top_line, 0xCC); // small meters m height
24
    write_char_xy(27, top_line, 0xCC); // small meters m height
25
    write_char_xy(7, bottom_line, 0x9E); // small v
25
    write_char_xy(7, bottom_line, 0x9E); // small v
-
 
26
        if (COSD_FLAGS2 & COSD_FLAG_STROMREC) {
-
 
27
                write_char_xy(7, bottom_line - 1, 0x9F); // small A
-
 
28
                write_char_xy(14, bottom_line - 1, 0xB5); // mah
-
 
29
        }
26
        COSD_FLAGS |= COSD_ICONS_WRITTEN;
30
        COSD_FLAGS |= COSD_ICONS_WRITTEN;
27
}
31
}
28
 
32
 
29
write_ndigit_number_u(7, top_line, debugData.Analog[10], 100, 0);
33
write_ndigit_number_u(7, top_line, debugData.Analog[10], 100, 0);
30
if (debugData.Analog[10] <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) {
34
if (debugData.Analog[10] <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) {
31
    for (uint8_t x = 0; x < 4; x++)
35
    for (uint8_t x = 0; x < 4; x++)
32
        write_char_att_xy(7 + x, top_line, BLINK);
36
        write_char_att_xy(7 + x, top_line, BLINK);
33
} else if (debugData.Analog[10] > RCLVL_WRN && last_RC_Quality <= RCLVL_WRN) {
37
} else if (debugData.Analog[10] > RCLVL_WRN && last_RC_Quality <= RCLVL_WRN) {
34
    for (uint8_t x = 0; x < 4; x++)
38
    for (uint8_t x = 0; x < 4; x++)
35
        write_char_att_xy(7 + x, top_line, 0);
39
        write_char_att_xy(7 + x, top_line, 0);
36
}
40
}
37
last_RC_Quality = debugData.Analog[10];
41
last_RC_Quality = debugData.Analog[10];
38
 
42
 
39
 
43
 
40
if (debugData.Analog[5] > 300 || debugData.Analog[5] < -300) {
44
if (debugData.Analog[5] > 300 || debugData.Analog[5] < -300) {
41
    // above 10m only write full meters
45
    // above 10m only write full meters
42
    write_ndigit_number_s(23, top_line, debugData.Analog[5] / 30, 1000, 0);
46
    write_ndigit_number_s(23, top_line, debugData.Analog[5] / 30, 1000, 0);
43
} else {
47
} else {
44
    // up to 10m write meters.dm
48
    // up to 10m write meters.dm
45
    write_ndigit_number_s_10th(23, top_line, debugData.Analog[5] / 3, 100, 0);
49
    write_ndigit_number_s_10th(23, top_line, debugData.Analog[5] / 3, 100, 0);
46
}
50
}
47
if (debugData.Analog[5] > max_Altimeter) max_Altimeter = debugData.Analog[5];
51
if (debugData.Analog[5] > max_Altimeter) max_Altimeter = debugData.Analog[5];
48
 
52
 
49
if (COSD_FLAGS & COSD_FLAG_ARTHORIZON) {
53
if (COSD_FLAGS & COSD_FLAG_ARTHORIZON) {
50
    draw_artificial_horizon(top_line + 2, bottom_line - 1, debugData.Analog[0], debugData.Analog[1]);
54
    draw_artificial_horizon(top_line + 2, bottom_line - 1, debugData.Analog[0], debugData.Analog[1]);
51
}
55
}
-
 
56
 
-
 
57
// pre-bottom line
-
 
58
if (COSD_FLAGS2 & COSD_FLAG_STROMREC) {
-
 
59
        //write_ndigit_number_s(3, bottom_line - 1, ampere, 1000, 0);
-
 
60
        write_ndigit_number_u_10th(3, bottom_line - 1, ampere / 10, 100, 0);
-
 
61
}
52
 
62
 
53
draw_battery(2, bottom_line, min_voltage, debugData.Analog[9], max_voltage);
63
draw_battery(2, bottom_line, min_voltage, debugData.Analog[9], max_voltage);
54
write_ndigit_number_u_10th(3, bottom_line, debugData.Analog[9], 100, 0);
64
write_ndigit_number_u_10th(3, bottom_line, debugData.Analog[9], 100, 0);
55
if (debugData.Analog[9] <= min_voltage && last_UBat > min_voltage) {
65
if (debugData.Analog[9] <= min_voltage && last_UBat > min_voltage) {
56
    for (uint8_t x = 2; x < 8; x++)
66
    for (uint8_t x = 2; x < 8; x++)
57
        write_char_att_xy(x, bottom_line, BLINK);
67
        write_char_att_xy(x, bottom_line, BLINK);
58
} else if (debugData.Analog[9] > min_voltage && last_UBat < min_voltage) {
68
} else if (debugData.Analog[9] > min_voltage && last_UBat < min_voltage) {
59
    for (uint8_t x = 2; x < 8; x++)
69
    for (uint8_t x = 2; x < 8; x++)
60
        write_char_att_xy(x, bottom_line, 0);
70
        write_char_att_xy(x, bottom_line, 0);
61
}
71
}
62
// remember last values
72
// remember last values
63
last_UBat = debugData.Analog[9];
73
last_UBat = debugData.Analog[9];
64
 
74
 
65
/*
75
/*
66
debugData.Analog[0]); // AngleNick
76
debugData.Analog[0]); // AngleNick
67
debugData.Analog[1]); // AngleRoll
77
debugData.Analog[1]); // AngleRoll
68
debugData.Analog[5]); // Height
78
debugData.Analog[5]); // Height
69
debugData.Analog[9]); // Voltage
79
debugData.Analog[9]); // Voltage
70
debugData.Analog[10]);// RC Signal
80
debugData.Analog[10]);// RC Signal
71
debugData.Analog[11]);// Gyro compass
81
debugData.Analog[11]);// Gyro compass
72
 */
82
 */
73
seconds_since_last_data = 0;
83
seconds_since_last_data = 0;
74
 
84