Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 953 → Rev 954

/C-OSD/trunk/osd_fcmode_default.c
22,10 → 22,16
#include "max7456_software_spi.h"
#include "osd_helpers.h"
#include "osd_fcmode_default.h"
#include "usart1.h"
 
#if (!(ALLCHARSDEBUG || (WRITECHARS != -1)) && FCONLY)
 
int osd_fcmode_default() {
static signed int rc_quality = 0;
#ifndef ACT_RSSI_FROM_LCD
rc_quality = debugData.Analog[10];
#endif
 
if (COSD_FLAGS_MODES & COSD_FLAG_HUD) {
// write icons at init or after menu/mode-switch
if (!(COSD_FLAGS_RUNTIME & COSD_ICONS_WRITTEN)) {
42,11 → 48,11
COSD_FLAGS_RUNTIME |= COSD_ICONS_WRITTEN;
}
 
write_ndigit_number_u(7, top_line, debugData.Analog[10], 3, 0);
if (debugData.Analog[10] <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) {
write_ndigit_number_u(7, top_line, rc_quality, 3, 0);
if (rc_quality <= 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) {
} else if (rc_quality > RCLVL_WRN && last_RC_Quality <= RCLVL_WRN) {
for (uint8_t x = 0; x < 4; x++)
write_char_att_xy(7 + x, top_line, 0);
}
97,7 → 103,27
debugData.Analog[11]);// Gyro compass
*/
seconds_since_last_data = 0;
//
 
// really dirty way to get the RSSI out of the display
#ifdef ACT_RSSI_FROM_LCD
#define REQUEST_FC_LCD_8 "#al?===Dc\r"
usart1_request_blocking('L', PSTR(REQUEST_FC_LCD_8));
char* str = ((char*)pRxData) + 2;
/*
write_ascii_string_len(2, 5, str, 20);
write_ascii_string_len(2, 6, str + 20, 20);
write_ascii_string_len(2, 7, str + 40, 20);
write_ascii_string_len(2, 8, str + 60, 20);
*/
uint8_t rssi_index = 30; // middle of 2nd line
while (str[rssi_index] == 0) rssi_index++;
int lcd_rssi = atoi(str[rssi_index]);
write_ndigit_number_u(7, top_line, lcd_rssi, 3, 0);
rc_quality = lcd_rssi;
 
#endif
 
return 0;
}