Subversion Repositories Projects

Rev

Rev 474 | Rev 507 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 474 Rev 497
Line 15... Line 15...
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
 
-
 
21
#include "main.h"
-
 
22
#include "max7456_software_spi.h"
-
 
23
#include "osd_helpers.h"
-
 
24
#include "osd_fcmode_default.h"
-
 
25
 
-
 
26
#if !(ALLCHARSDEBUG|(WRITECHARS != -1))
-
 
27
 
-
 
28
int osd_fcmode_default() {
20
if (COSD_FLAGS & COSD_FLAG_HUD) {
29
        if (COSD_FLAGS & COSD_FLAG_HUD) {
21
        // write icons at init or after menu/mode-switch
30
                // write icons at init or after menu/mode-switch
22
        if (!(COSD_FLAGS2 & COSD_ICONS_WRITTEN)) {
31
                if (!(COSD_FLAGS2 & COSD_ICONS_WRITTEN)) {
23
            write_char_xy(10, top_line, 0xCA); // RC-transmitter
32
                    write_char_xy(10, top_line, 0xCA); // RC-transmitter
24
            write_char_xy(27, top_line, 0xCC); // small meters m height
33
                    write_char_xy(27, top_line, 0xCC); // small meters m height
25
            write_char_xy(7, bottom_line, 0x9E); // small v
34
                    write_char_xy(7, bottom_line, 0x9E); // small v
26
                if (COSD_FLAGS2 & COSD_FLAG_STROMREC) {
35
                        if (COSD_FLAGS2 & COSD_FLAG_STROMREC) {
27
                        write_char_xy(7, bottom_line - 1, 0x9F); // small A
36
                                write_char_xy(7, bottom_line - 1, 0x9F); // small A
28
                        write_char_xy(14, bottom_line - 1, 0xB5); // mah
37
                                write_char_xy(14, bottom_line - 1, 0xB5); // mah
-
 
38
                        }
-
 
39
                        COSD_FLAGS2 |= COSD_ICONS_WRITTEN;
29
                }
40
                }
30
                COSD_FLAGS2 |= COSD_ICONS_WRITTEN;
-
 
31
        }
-
 
32
 
41
 
33
        write_ndigit_number_u(7, top_line, debugData.Analog[10], 100, 0);
42
                write_ndigit_number_u(7, top_line, debugData.Analog[10], 100, 0);
34
        if (debugData.Analog[10] <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) {
43
                if (debugData.Analog[10] <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) {
35
            for (uint8_t x = 0; x < 4; x++)
44
                    for (uint8_t x = 0; x < 4; x++)
36
                write_char_att_xy(7 + x, top_line, BLINK);
45
                        write_char_att_xy(7 + x, top_line, BLINK);
37
        } else if (debugData.Analog[10] > RCLVL_WRN && last_RC_Quality <= RCLVL_WRN) {
46
                } else if (debugData.Analog[10] > RCLVL_WRN && last_RC_Quality <= RCLVL_WRN) {
38
            for (uint8_t x = 0; x < 4; x++)
47
                    for (uint8_t x = 0; x < 4; x++)
39
                write_char_att_xy(7 + x, top_line, 0);
48
                        write_char_att_xy(7 + x, top_line, 0);
40
        }
49
                }
41
       
50
       
42
        if (debugData.Analog[5] > 300 || debugData.Analog[5] < -300) {
51
                if (debugData.Analog[5] > 300 || debugData.Analog[5] < -300) {
43
            // above 10m only write full meters
52
                    // above 10m only write full meters
44
            write_ndigit_number_s(23, top_line, debugData.Analog[5] / 30, 1000, 0);
53
                    write_ndigit_number_s(23, top_line, debugData.Analog[5] / 30, 1000, 0);
45
        } else {
54
                } else {
46
            // up to 10m write meters.dm
55
                    // up to 10m write meters.dm
47
            write_ndigit_number_s_10th(23, top_line, debugData.Analog[5] / 3, 100, 0);
56
                    write_ndigit_number_s_10th(23, top_line, debugData.Analog[5] / 3, 100, 0);
48
        }
57
                }
49
        if (debugData.Analog[5] > max_Altimeter) max_Altimeter = debugData.Analog[5];
58
                if (debugData.Analog[5] > max_Altimeter) max_Altimeter = debugData.Analog[5];
50
 
59
 
51
        if (COSD_FLAGS & COSD_FLAG_ARTHORIZON) {
60
                if (COSD_FLAGS & COSD_FLAG_ARTHORIZON) {
52
                draw_artificial_horizon(top_line + 2, bottom_line - 1, debugData.Analog[0], debugData.Analog[1]);
61
                        draw_artificial_horizon(top_line + 2, bottom_line - 1, debugData.Analog[0], debugData.Analog[1]);
53
        }
62
                }
54
 
63
 
55
        // pre-bottom line
64
                // pre-bottom line
56
        if (COSD_FLAGS2 & COSD_FLAG_STROMREC) {
65
                if (COSD_FLAGS2 & COSD_FLAG_STROMREC) {
57
                //write_ndigit_number_s(3, bottom_line - 1, ampere, 1000, 0);
66
                        //write_ndigit_number_s(3, bottom_line - 1, ampere, 1000, 0);
58
                write_ndigit_number_u_10th(3, bottom_line - 1, ampere / 10, 100, 0);
67
                        write_ndigit_number_u_10th(3, bottom_line - 1, ampere / 10, 100, 0);
59
                write_ndigit_number_s(10, bottom_line - 1, ampere_wasted / 10, 1000, 0);
68
                        write_ndigit_number_s(10, bottom_line - 1, ampere_wasted / 10, 1000, 0);
60
        }
69
                }
61
 
70
 
62
        draw_battery(2, bottom_line, min_voltage, debugData.Analog[9], max_voltage);
71
                draw_battery(2, bottom_line, min_voltage, debugData.Analog[9], max_voltage);
63
        write_ndigit_number_u_10th(3, bottom_line, debugData.Analog[9], 100, 0);
72
                write_ndigit_number_u_10th(3, bottom_line, debugData.Analog[9], 100, 0);
64
        if (debugData.Analog[9] <= min_voltage && last_UBat > min_voltage) {
73
                if (debugData.Analog[9] <= min_voltage && last_UBat > min_voltage) {
65
            for (uint8_t x = 2; x < 8; x++)
74
                    for (uint8_t x = 2; x < 8; x++)
66
                write_char_att_xy(x, bottom_line, BLINK);
75
                        write_char_att_xy(x, bottom_line, BLINK);
67
        } else if (debugData.Analog[9] > min_voltage && last_UBat < min_voltage) {
76
                } else if (debugData.Analog[9] > min_voltage && last_UBat < min_voltage) {
68
            for (uint8_t x = 2; x < 8; x++)
77
                    for (uint8_t x = 2; x < 8; x++)
69
                write_char_att_xy(x, bottom_line, 0);
78
                        write_char_att_xy(x, bottom_line, 0);
-
 
79
                }
70
        }
80
        }
-
 
81
        // remember last values
-
 
82
        last_UBat = debugData.Analog[9];
-
 
83
        last_RC_Quality = debugData.Analog[10];
-
 
84
 
-
 
85
        /*
-
 
86
        debugData.Analog[0]); // AngleNick
-
 
87
        debugData.Analog[1]); // AngleRoll
-
 
88
        debugData.Analog[5]); // Height
-
 
89
        debugData.Analog[9]); // Voltage
-
 
90
        debugData.Analog[10]);// RC Signal
-
 
91
        debugData.Analog[11]);// Gyro compass
-
 
92
         */
-
 
93
        seconds_since_last_data = 0;
-
 
94
 
-
 
95
        return 0;
71
}
96
}
72
// remember last values
-
 
73
last_UBat = debugData.Analog[9];
-
 
74
last_RC_Quality = debugData.Analog[10];
-
 
75
 
97
 
76
/*
-
 
77
debugData.Analog[0]); // AngleNick
-
 
78
debugData.Analog[1]); // AngleRoll
-
 
79
debugData.Analog[5]); // Height
-
 
80
debugData.Analog[9]); // Voltage
-
 
81
debugData.Analog[10]);// RC Signal
-
 
82
debugData.Analog[11]);// Gyro compass
-
 
83
 */
98
#endif
84
seconds_since_last_data = 0;
-