Rev 728 |
Go to most recent revision |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
/****************************************************************************
* Copyright (C) 2009 by Claas Anders "CaScAdE" Rathje *
* admiralcascade@gmail.com *
* Project-URL: http://www.mylifesucks.de/oss/c-osd/ *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
* This is an alternative FC-mode contributed by Josef "jopl" Plasil *
* who is using the FC with an MK3Mag and the OSD *
****************************************************************************/
#include "main.h"
#include "max7456_software_spi.h"
#include "osd_helpers.h"
#include "osd_fcmode_default.h"
#if !(ALLCHARSDEBUG|(WRITECHARS != -1))
// jopl Vario
static int16_t last_Altimeter = 0;
static int16_t Vario = 0;
int osd_fcmode_jopl() {
if (COSD_FLAGS_MODES & COSD_FLAG_HUD) {
// write icons at init or after menu/mode-switch
if (!(COSD_FLAGS_RUNTIME & COSD_ICONS_WRITTEN)) {
write_char_xy(10, top_line, 0xCA); // RC-transmitter
// jopl ... compass
write_char_xy(16, top_line, 0xD0); // degree symbol
// end jopl
write_char_xy(26, top_line, 0xCC); // small meters m height
write_char_xy(7, bottom_line, 0x9E); // small v
if (COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) {
write_char_xy(7, bottom_line - 1, 0x9F); // small A
write_char_xy(14, bottom_line - 1, 0xB5); // mah
if (COSD_FLAGS_MODES & COSD_FLAG_STROMVOLT) {
write_char_xy(21, bottom_line - 1, 0x9E); // small V
}
}
// jopl ... Times
write_char_xy(14, bottom_line, 0xD1); // on clock
write_char_xy(21, bottom_line, 0xD2); // fly clock
// end jopl
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) {
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);
}
// jopl ... compass
write_ndigit_number_u(13, top_line, debugData.Analog[8], 3, 0);
write_ascii_string_pgm(17, top_line, (const char *) (pgm_read_word(&(directions[heading_conv(debugData.Analog[8])]))));
// end jopl
// jopl Altimeter modification
if ((debugData.Analog[5] > 100) || (debugData.Analog[5] < -100)) {
// above 10m only write full meters
write_ndigit_number_s(22, top_line, debugData.Analog[5] / 10, 4, 0);
} else {
// up to 10m write meters.dm
write_ndigit_number_s_10th(22, top_line, debugData.Analog[5], 3, 0);
}
Vario = debugData.Analog[5] - last_Altimeter;
draw_variometer(27, top_line, Vario);
if (COSD_FLAGS_MODES & COSD_FLAG_BIGVARIO) {
draw_big_variometer(27, 8, Vario);
}
last_Altimeter = debugData.Analog[5];
// end jopl
if (debugData.Analog[5] > max_Altimeter) max_Altimeter = debugData.Analog[5];
if (COSD_FLAGS_MODES & COSD_FLAG_ARTHORIZON) {
draw_artificial_horizon(top_line + 2, bottom_line - 1, debugData.Analog[0], debugData.Analog[1]);
}
// jopl ... compass heading
// seccond line
draw_compass(11, top_line + 1, debugData.Analog[8]);
// end jopl
// pre-bottom line
if (COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) {
//write_ndigit_number_s(3, bottom_line - 1, ampere, 4, 0);
write_ndigit_number_u_10th(3, bottom_line - 1, ampere / 10, 3, 0);
write_ndigit_number_s(10, bottom_line - 1, ampere_wasted / 10, 4, 0);
if (COSD_FLAGS_MODES & COSD_FLAG_STROMVOLT) {
write_ndigit_number_u_10th(17, bottom_line - 1, s_volt, 3, 0);
}
}
draw_battery(2, bottom_line, min_voltage, debugData.Analog[9], max_voltage);
write_ndigit_number_u_10th(3, bottom_line, debugData.Analog[9], 3, 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);
}
// jopl ... Times
write_time(8, bottom_line, uptime);
write_time(15, bottom_line, flytime_fc);
// Test ... show Gas value
// write_ndigit_number_s(22, bottom_line, debugData.Analog[5], 5, 0);
// end jopl
}
// remember last values
last_UBat = debugData.Analog[9];
last_RC_Quality = debugData.Analog[10];
/*
debugData.Analog[0]); // AngleNick
debugData.Analog[1]); // AngleRoll
debugData.Analog[2]); // AccNick
debugData.Analog[3]); // AccRoll
debugData.Analog[4]); // GyroGier
debugData.Analog[5]); // Height Value
debugData.Analog[6]); // AccZ
debugData.Analog[7]); // Throttle
debugData.Analog[8]); // Compass Value
debugData.Analog[9]); // Voltage
debugData.Analog[10]);// RC Signal
debugData.Analog[11]);// Gyro compass
debugData.Analog[12]);// Motor Front
debugData.Analog[13]);// Motor Rear
debugData.Analog[14]);// Motor Left
debugData.Analog[15]);// Motor Right
debugData.Analog[16]);//
debugData.Analog[17]);//
debugData.Analog[18]);//
debugData.Analog[19]);// MK3Mag CalState
debugData.Analog[20]);// Servo
debugData.Analog[21]);//
debugData.Analog[22]);//
debugData.Analog[23]);//
debugData.Analog[24]);//
debugData.Analog[25]);//
debugData.Analog[26]);//
debugData.Analog[27]);// Kalman_MaxDrift
debugData.Analog[28]);//
debugData.Analog[29]);//
debugData.Analog[30]);// GPS_Nick
debugData.Analog[31]);// GPS_Roll
*/
seconds_since_last_data = 0;
return 0;
}
#endif