Subversion Repositories Projects

Rev

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

Rev 902 Rev 954
Line 20... Line 20...
20
 
20
 
21
#include "main.h"
21
#include "main.h"
22
#include "max7456_software_spi.h"
22
#include "max7456_software_spi.h"
23
#include "osd_helpers.h"
23
#include "osd_helpers.h"
-
 
24
#include "osd_fcmode_default.h"
Line 24... Line 25...
24
#include "osd_fcmode_default.h"
25
#include "usart1.h"
Line 25... Line 26...
25
 
26
 
-
 
27
#if (!(ALLCHARSDEBUG || (WRITECHARS != -1)) && FCONLY)
-
 
28
 
-
 
29
int osd_fcmode_default() {
-
 
30
    static signed int rc_quality = 0;
-
 
31
#ifndef ACT_RSSI_FROM_LCD
26
#if (!(ALLCHARSDEBUG || (WRITECHARS != -1)) && FCONLY)
32
    rc_quality = debugData.Analog[10];
27
 
33
#endif
28
int osd_fcmode_default() {
34
 
29
    if (COSD_FLAGS_MODES & COSD_FLAG_HUD) {
35
    if (COSD_FLAGS_MODES & COSD_FLAG_HUD) {
30
        // write icons at init or after menu/mode-switch
36
        // write icons at init or after menu/mode-switch
Line 40... Line 46...
40
                }
46
                }
41
            }
47
            }
42
            COSD_FLAGS_RUNTIME |= COSD_ICONS_WRITTEN;
48
            COSD_FLAGS_RUNTIME |= COSD_ICONS_WRITTEN;
43
        }
49
        }
Line 44... Line 50...
44
 
50
 
45
        write_ndigit_number_u(7, top_line, debugData.Analog[10], 3, 0);
51
        write_ndigit_number_u(7, top_line, rc_quality, 3, 0);
46
        if (debugData.Analog[10] <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) {
52
        if (rc_quality <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) {
47
            for (uint8_t x = 0; x < 4; x++)
53
            for (uint8_t x = 0; x < 4; x++)
48
                write_char_att_xy(7 + x, top_line, BLINK);
54
                write_char_att_xy(7 + x, top_line, BLINK);
49
        } else if (debugData.Analog[10] > RCLVL_WRN && last_RC_Quality <= RCLVL_WRN) {
55
        } else if (rc_quality > RCLVL_WRN && last_RC_Quality <= RCLVL_WRN) {
50
            for (uint8_t x = 0; x < 4; x++)
56
            for (uint8_t x = 0; x < 4; x++)
51
                write_char_att_xy(7 + x, top_line, 0);
57
                write_char_att_xy(7 + x, top_line, 0);
Line 52... Line 58...
52
        }
58
        }
Line 95... Line 101...
95
    debugData.Analog[9]); // Voltage
101
    debugData.Analog[9]); // Voltage
96
    debugData.Analog[10]);// RC Signal
102
    debugData.Analog[10]);// RC Signal
97
    debugData.Analog[11]);// Gyro compass
103
    debugData.Analog[11]);// Gyro compass
98
     */
104
     */
99
    seconds_since_last_data = 0;
105
    seconds_since_last_data = 0;
-
 
106
    //
-
 
107
 
-
 
108
    // really dirty way to get the RSSI out of the display
-
 
109
#ifdef ACT_RSSI_FROM_LCD
-
 
110
#define REQUEST_FC_LCD_8 "#al?===Dc\r"
-
 
111
    usart1_request_blocking('L', PSTR(REQUEST_FC_LCD_8));
-
 
112
    char* str = ((char*)pRxData) + 2;
-
 
113
    /*
-
 
114
                write_ascii_string_len(2, 5, str, 20);
-
 
115
                write_ascii_string_len(2, 6, str + 20, 20);
-
 
116
                write_ascii_string_len(2, 7, str + 40, 20);
-
 
117
                write_ascii_string_len(2, 8, str + 60, 20);
-
 
118
     */
-
 
119
    uint8_t rssi_index = 30; // middle of 2nd line
-
 
120
    while (str[rssi_index] == 0) rssi_index++;
-
 
121
    int lcd_rssi = atoi(str[rssi_index]);
-
 
122
    write_ndigit_number_u(7, top_line, lcd_rssi, 3, 0);
-
 
123
    rc_quality = lcd_rssi;
-
 
124
 
-
 
125
#endif
Line 100... Line 126...
100
 
126
 
101
    return 0;
127
    return 0;
Line 102... Line 128...
102
}
128
}