Subversion Repositories Projects

Compare Revisions

Regard whitespace Rev 756 → Rev 757

/C-OSD/trunk/CHANGE.LOG
18,6 → 18,12
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
****************************************************************************/
 
20100412-2125
*added mph/ft (two new chars added, reflash characters if you need ft/mph)
*AGRESSiVA-horizion now switchable via menu
*reworked menu a bit
*switched from -O2 to -Os because of the added stuff
 
20100403-0115
*RC-RSSI now shown if available (RC_Quality is still fallback, still needs FC patch)
+AGRESSiVA-horizion to main trunk (NEW_ARTHORIZON 1 to test, needs new chars)
/C-OSD/trunk/c-osd.aws
1,0 → 0,0
<AVRWorkspace><IOSettings><CurrentRegisters/></IOSettings><part name="ATMEGA162"/><Files><File00000 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\main.c" Position="961 153 1646 610" LineCol="130 0" State="Maximized"/><File00001 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\mk-data-structs.h" Position="983 175 1660 602" LineCol="68 0" State="Maximized"/><File00002 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\max7456_software_spi.h" Position="1005 197 1682 624" LineCol="0 0" State="Maximized"/><File00003 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\max7456_software_spi.c" Position="1027 219 1704 646" LineCol="162 0" State="Maximized"/><File00004 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\usart1.c" Position="1049 241 1726 668" LineCol="117 0" State="Maximized"/><File00005 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\usart1.h" Position="1071 263 1748 690" LineCol="0 0" State="Maximized"/><File00006 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\characters.c" Position="1093 285 1770 712" LineCol="5928 0" State="Maximized"/><File00007 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\main.h" Position="1115 307 1792 734" LineCol="33 0" State="Maximized"/><File00008 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_helpers.c" Position="1137 329 1814 756" LineCol="173 0" State="Maximized"/><File00009 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_helpers.h" Position="1159 351 1836 778" LineCol="69 0" State="Maximized"/><File00010 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_ncmode_default.c" Position="961 153 1638 580" LineCol="28 0" State="Maximized"/><File00011 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_fcmode_default.c" Position="983 175 1660 602" LineCol="104 0" State="Maximized"/><File00012 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\config.c" Position="1005 197 1682 624" LineCol="201 0" State="Maximized"/><File00013 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\config.h" Position="1027 219 1704 646" LineCol="0 0" State="Maximized"/><File00014 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\spi.c" Position="1049 241 1726 668" LineCol="0 0" State="Maximized"/><File00015 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\spi.h" Position="1071 263 1748 690" LineCol="0 0" State="Maximized"/><File00016 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\buttons.c" Position="1093 285 1770 712" LineCol="0 0" State="Maximized"/><File00017 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\buttons.h" Position="1115 307 1792 734" LineCol="0 0" State="Maximized"/><File00018 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\ppm.c" Position="1137 329 1814 756" LineCol="0 0" State="Maximized"/><File00019 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\ppm.h" Position="1159 351 1836 778" LineCol="0 0" State="Maximized"/><File00020 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_ncmode_minimal.c" Position="957 130 1844 786" LineCol="171 0" State="Maximized"/><File00021 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_ncmode_default.h" Position="983 175 1660 602" LineCol="0 0" State="Maximized"/><File00022 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_ncmode_minimal.h" Position="1005 197 1682 624" LineCol="0 0" State="Maximized"/><File00023 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_fcmode_default.h" Position="1027 219 1704 646" LineCol="7 0" State="Maximized"/><File00024 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\characters.h" Position="1049 241 1726 668" LineCol="24 0" State="Maximized"/><File00025 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_fcmode_jopl.c" Position="1071 263 1748 690" LineCol="28 0" State="Maximized"/><File00026 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\default\Makefile" Position="1093 285 1770 712" LineCol="79 0" State="Maximized"/></Files></AVRWorkspace>
<AVRWorkspace><IOSettings><CurrentRegisters/></IOSettings><part name="ATMEGA162"/><Files><File00000 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\main.c" Position="1015 148 1700 605" LineCol="130 0" State="Maximized"/><File00001 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\mk-data-structs.h" Position="1037 170 1714 597" LineCol="68 0" State="Maximized"/><File00002 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\max7456_software_spi.h" Position="1059 192 1736 619" LineCol="0 0" State="Maximized"/><File00003 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\max7456_software_spi.c" Position="1081 214 1758 641" LineCol="182 0" State="Maximized"/><File00004 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\usart1.c" Position="1103 236 1780 663" LineCol="117 0" State="Maximized"/><File00005 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\usart1.h" Position="1125 258 1802 685" LineCol="0 0" State="Maximized"/><File00006 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\characters.c" Position="1147 280 1824 707" LineCol="2924 13" State="Maximized"/><File00007 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\main.h" Position="989 103 1925 759" LineCol="50 23" State="Maximized"/><File00008 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_helpers.c" Position="1191 324 1868 751" LineCol="206 0" State="Maximized"/><File00009 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_helpers.h" Position="993 126 1670 553" LineCol="70 38" State="Maximized"/><File00010 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_ncmode_default.c" Position="1015 148 1692 575" LineCol="204 2" State="Maximized"/><File00011 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_fcmode_default.c" Position="1037 170 1714 597" LineCol="104 0" State="Maximized"/><File00012 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\config.c" Position="1059 192 1736 619" LineCol="324 20" State="Maximized"/><File00013 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\config.h" Position="1081 214 1758 641" LineCol="25 16" State="Maximized"/><File00014 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\spi.c" Position="1103 236 1780 663" LineCol="0 0" State="Maximized"/><File00015 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\spi.h" Position="1125 258 1802 685" LineCol="0 0" State="Maximized"/><File00016 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\buttons.c" Position="1147 280 1824 707" LineCol="0 0" State="Maximized"/><File00017 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\buttons.h" Position="1169 302 1846 729" LineCol="0 0" State="Maximized"/><File00018 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\ppm.c" Position="1191 324 1868 751" LineCol="0 0" State="Maximized"/><File00019 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\ppm.h" Position="993 126 1670 553" LineCol="0 0" State="Maximized"/><File00020 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_ncmode_minimal.c" Position="1015 148 1692 575" LineCol="171 0" State="Maximized"/><File00021 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_ncmode_default.h" Position="1037 170 1714 597" LineCol="0 0" State="Maximized"/><File00022 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_ncmode_minimal.h" Position="1059 192 1736 619" LineCol="0 0" State="Maximized"/><File00023 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_fcmode_default.h" Position="1081 214 1758 641" LineCol="7 0" State="Maximized"/><File00024 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\characters.h" Position="1103 236 1780 663" LineCol="24 0" State="Maximized"/><File00025 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\osd_fcmode_jopl.c" Position="1125 258 1802 685" LineCol="28 0" State="Maximized"/><File00026 Name="G:\Eigene Dateien\C-Projects\C-OSD\trunk\default\Makefile" Position="1147 280 1824 707" LineCol="11 20" State="Maximized"/></Files></AVRWorkspace>
/C-OSD/trunk/c-osd.mcm
8001,55 → 8001,61
01010101
01010101
01010101
01011001
01010101
01010101
10010110
01010101
01010101
01100101
01100101
01010101
01010101
01100101
01010101
00000000
00000001
01010101
01100101
00101010
10100001
01010101
00100010
00100001
01010101
01100101
00100010
00100001
01010101
00000000
00000000
01010101
01100101
01010101
10101001
01101010
10101010
00101000
01010101
01100101
01010101
00100010
00010101
01010101
01100101
00101000
01010101
01010101
01100101
00100000
00010101
01010101
00100000
10000101
01010101
01100101
00000000
10000000
01010101
01010100
10101000
01010101
01100101
01010100
10001000
01010101
01010100
10001000
01010101
01100101
01010100
00010000
01010101
01010101
01011001
01010101
01010110
01010110
10101010
10101001
01010101
01010101
01010101
8065,54 → 8071,23
01010101
01010101
01010101
01011001
01010101
01010101
10010110
01010101
01010101
01100101
01010101
01011001
01010101
01010101
01011001
01010101
01101010
10101010
10101001
01010101
01011001
01010101
01010101
01011001
01010101
01010101
01011001
01010101
01010110
01011001
01100101
01010110
01011001
01100101
01011001
01011001
01011001
01011001
01011001
01011001
01011001
01011001
01011001
01100101
01011001
01010110
01010101
01011001
01010101
01010101
01011001
01010101
01010101
01010101
8121,14 → 8096,39
01010101
01010101
01010101
01010000
01000000
01010101
01001010
01001000
01010101
00100000
00101010
00010101
00101000
01001000
01010101
00100001
01001000
01010101
00100001
01001000
01010101
01000101
01010001
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01010101
01011001
01010101
01010101
/C-OSD/trunk/characters.c
33,7 → 33,7
*/
// chars 0 - 255 with 54 byte per char
// orginal filename: c-osd.mcm
// Sat, 03 Apr 2010 01:02:05 +0200
// Mon, 12 Apr 2010 19:12:55 +0200
 
 
 
2912,50 → 2912,50
const char chr124[] PROGMEM = {0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x40,0x00,0x01,0x2a,0xaa,0xa8,0x2a,0xaa,0xa8,0x40,0x00,0x01};
 
 
// 0 ---------- -
// 1 -------- --
// 2 --------- --
// 3 - ----------
// 4 - ----------
// 5 - ----------
// 6 - ----------
// 7 - ------ -
// 8 - ----
// 9 - ----------
// 10 - ----------
// 11 - ----------
// 12 - ----------
// 13 - ----------
// 14 - ----------
// 15 -- --------
// 16 --- -
// 17 ------------
// 0 ------------
// 1 ------------
// 2 ------------
// 3 #######-----
// 4 # #-----
// 5 # # # #-----
// 6 # # # #-----
// 7 ########----
// 8 ----# #----
// 9 ----# # #---
// 10 ----# #----
// 11 ----# ###---
// 12 ----# ## #--
// 13 ----#### ###
// 14 -------# #
// 15 -------# # #
// 16 -------# # #
// 17 -------##-##
// 000000000011
// 012345678901
const char chr125[] PROGMEM = {0x55,0x55,0x59,0x55,0x55,0x96,0x55,0x55,0x65,0x65,0x55,0x55,0x65,0x55,0x55,0x65,0x55,0x55,0x65,0x55,0x55,0x65,0x55,0xa9,0x6a,0xaa,0x55,0x65,0x55,0x55,0x65,0x55,0x55,0x65,0x55,0x55,0x65,0x55,0x55,0x65,0x55,0x55,0x65,0x55,0x55,0x59,0x55,0x56,0x56,0xaa,0xa9,0x55,0x55,0x55};
const char chr125[] PROGMEM = {0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x00,0x01,0x55,0x2a,0xa1,0x55,0x22,0x21,0x55,0x22,0x21,0x55,0x00,0x00,0x55,0x55,0x28,0x55,0x55,0x22,0x15,0x55,0x28,0x55,0x55,0x20,0x15,0x55,0x20,0x85,0x55,0x00,0x80,0x55,0x54,0xa8,0x55,0x54,0x88,0x55,0x54,0x88,0x55,0x54,0x10};
 
 
// 0 ---------- -
// 1 -------- --
// 2 --------- --
// 3 ------ -----
// 4 ------ -----
// 5 - -
// 6 ------ -----
// 7 ------ -----
// 8 ------ -----
// 9 --- -- -- --
// 10 --- -- -- --
// 11 -- --- --- -
// 12 -- --- --- -
// 13 -- --- --- -
// 14 - ---- ----
// 15 ------ -----
// 16 ------ -----
// 17 ------------
// 0 ------------
// 1 ------------
// 2 ------------
// 3 ------------
// 4 ------------
// 5 ------------
// 6 ------------
// 7 ------------
// 8 ------------
// 9 ------------
// 10 ------------
// 11 --##-###----
// 12 -# -# #----
// 13 # ### #---
// 14 # #-# #----
// 15 # #--# #----
// 16 # #--# #----
// 17 -#----#-----
// 000000000011
// 012345678901
const char chr126[] PROGMEM = {0x55,0x55,0x59,0x55,0x55,0x96,0x55,0x55,0x65,0x55,0x59,0x55,0x55,0x59,0x55,0x6a,0xaa,0xa9,0x55,0x59,0x55,0x55,0x59,0x55,0x55,0x59,0x55,0x56,0x59,0x65,0x56,0x59,0x65,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x65,0x59,0x56,0x55,0x59,0x55,0x55,0x59,0x55,0x55,0x55,0x55};
const char chr126[] PROGMEM = {0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x50,0x40,0x55,0x4a,0x48,0x55,0x20,0x2a,0x15,0x28,0x48,0x55,0x21,0x48,0x55,0x21,0x48,0x55,0x45,0x51,0x55};
 
 
// 0 ---------- -
/C-OSD/trunk/config.c
84,7 → 84,6
 
/**
* auto config some stuff on startup, currently only battery cells
* TODO: this is testing stuff, strings should go progmem and so on...
*/
void init_cosd(uint8_t UBat) {
clear();
178,69 → 177,91
/**
* helper function for flag display
*/
void onoff(uint8_t line, uint8_t onoff) {
void onoff(uint8_t col, uint8_t line, uint8_t onoff) {
if (onoff) {
write_ascii_string_pgm(23, line, PSTR("ON "));
write_ascii_string_pgm(col, line, PSTR("ON "));
} else {
write_ascii_string_pgm(23, line, PSTR("OFF"));
write_ascii_string_pgm(col, line, PSTR("OFF"));
}
}
 
 
/**
* helper function for menu updating
*/
void config_menu_drawings(uint8_t chosen) {
uint8_t line = 2;
static uint8_t old_y = 0;
uint8_t x = MENU_LEFT, y = MENU_TOP, line = MENU_TOP;
 
// clear prevoius _cursor_
//write_char_xy(3, line + ((chosen + 11) % 12), 0x00);
for (uint8_t x = 2; x < 28; x++) {
write_char_att_xy(x, line + ((chosen + 11) % 12), 0);
write_char_att_xy(x, line + chosen, BLACKBG | INVERT);
if (chosen > 5 && chosen < 12) { // right
x = MENU_MIDDLE;
y = chosen - 6 + MENU_TOP;
} else if (chosen < 7) {
y = chosen + MENU_TOP;
} else {
y = chosen - 6 + MENU_TOP;
}
 
// clear prevoius _cursor_ and draw current
for (uint8_t myx = MENU_LEFT; myx < 29; myx++) {
write_char_att_xy(myx, old_y, 0);
if (myx > x - 1 && myx < x + 14) {
write_char_att_xy(myx, y, BLACKBG | INVERT);
}
};
// draw current _cursor_
//write_char_xy(3, line + chosen, 0xD9);
 
write_ascii_string_pgm(4, line, PSTR("Video Mode"));
write_ascii_string_pgm(MENU_LEFT, line, PSTR("Video"));
if (COSD_FLAGS_CONFIG & COSD_FLAG_NTSC) {
write_ascii_string_pgm(23, line, VM_NTSC);
write_ascii_string_pgm(MENU_LEFT + 10, line, VM_NTSC);
} else {
write_ascii_string_pgm(23, line, VM_PAL);
write_ascii_string_pgm(MENU_LEFT + 10, line, VM_PAL);
}
write_ascii_string_pgm(4, ++line, PSTR("Full HUD"));
onoff(line, COSD_FLAGS_MODES & COSD_FLAG_HUD);
write_ascii_string_pgm(MENU_LEFT, ++line, PSTR("Full HUD"));
onoff(MENU_LEFT + 10, line, COSD_FLAGS_MODES & COSD_FLAG_HUD);
write_ascii_string_pgm(4, ++line, PSTR("Art Horizon in HUD"));
onoff(line, COSD_FLAGS_MODES & COSD_FLAG_ARTHORIZON);
write_ascii_string_pgm(MENU_LEFT, ++line, PSTR("Horizon"));
onoff(MENU_LEFT + 10, line, COSD_FLAGS_MODES & COSD_FLAG_ARTHORIZON);
write_ascii_string_pgm(4, ++line, PSTR("Big Vario bar"));
onoff(line, COSD_FLAGS_MODES & COSD_FLAG_BIGVARIO);
write_ascii_string_pgm(MENU_LEFT, ++line, PSTR("Aggr.Hor."));
onoff(MENU_LEFT + 10, line, COSD_FLAGS_MODES & COSD_FLAG_AGGRHORIZON);
 
write_ascii_string_pgm(4, ++line, PSTR("Statistics"));
onoff(line, COSD_FLAGS_MODES & COSD_FLAG_STATS);
write_ascii_string_pgm(MENU_LEFT, ++line, PSTR("Stats"));
onoff(MENU_LEFT + 10, line, COSD_FLAGS_MODES & COSD_FLAG_STATS);
 
write_ascii_string_pgm(4, ++line, PSTR("Current by FC"));
onoff(line, COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT);
write_ascii_string_pgm(MENU_LEFT, ++line, PSTR("A by FC"));
onoff(MENU_LEFT + 10, line, COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT);
 
write_ascii_string_pgm(4, ++line, PSTR("Voltage by C-Strom"));
onoff(line, COSD_FLAGS_MODES & COSD_FLAG_STROMVOLT);
// 2nd col
line = 2;
 
write_ascii_string_pgm(4, ++line, PSTR("Reset uptime"));
write_ascii_string_pgm(MENU_MIDDLE, line, PSTR("V C-Strom"));
onoff(MENU_MIDDLE + 10, line, COSD_FLAGS_MODES & COSD_FLAG_STROMVOLT);
write_ascii_string_pgm(4, ++line, PSTR("Display Mode"));
write_ascii_string_pgm(18, line, (const char *) (pgm_read_word(&(mode->desc))));
write_ascii_string_pgm(4, ++line, PSTR("Height by"));
write_ascii_string_pgm(MENU_MIDDLE, ++line, PSTR("Height by"));
if (COSD_FLAGS_CONFIG & COSD_FLAG_GPSHEIGHT) {
write_ascii_string_pgm(20, line, PSTR(" GPS"));
write_ascii_string_pgm(MENU_MIDDLE + 10, line, PSTR(" GPS"));
} else {
write_ascii_string_pgm(20, line, PSTR("BARO"));
write_ascii_string_pgm(MENU_MIDDLE + 10, line, PSTR("BARO"));
}
 
write_ascii_string_pgm(4, ++line, PSTR("Save config"));
write_ascii_string_pgm(4, ++line, PSTR("EXIT"));
write_ascii_string_pgm(MENU_MIDDLE, ++line, PSTR("Feet/mph"));
onoff(MENU_MIDDLE + 10, line, COSD_FLAGS_CONFIG & COSD_FLAG_FEET);
 
write_ascii_string_pgm(MENU_MIDDLE, ++line, PSTR("Big Vario"));
onoff(MENU_MIDDLE + 10, line, COSD_FLAGS_MODES & COSD_FLAG_BIGVARIO);
 
 
// bottom
write_ascii_string_pgm(MENU_LEFT, 9, PSTR("Reset uptime"));
 
write_ascii_string_pgm(MENU_LEFT, 10, PSTR("Display Mode"));
write_ascii_string_pgm(18, 10, (const char *) (pgm_read_word(&(mode->desc))));
write_ascii_string_pgm(MENU_LEFT, 11, PSTR("Save config"));
write_ascii_string_pgm(MENU_LEFT, 12, PSTR("EXIT"));
 
old_y = y;
}
 
/**
247,7 → 268,7
* some sort of clicking response in the menu
*/
void config_menu_doclick(uint8_t chosen) {
write_ascii_string_pgm(4, chosen + 2, PSTR("DONE "));
write_ascii_string_pgm(MENU_LEFT, chosen + MENU_TOP - 6, PSTR("DONE "));
_delay_ms(500);
config_menu_drawings(chosen);
}
273,7 → 294,8
 
while (inmenu) {
if (s2_pressed()) {
chosen = (chosen + 1) % 12;
chosen = (chosen + 1) % 17;
if (chosen == 10) chosen = 13; // SKIP unused menu space for now
config_menu_drawings(chosen);
_delay_ms(500);
} else if (s1_pressed()) {
292,41 → 314,39
 
bottom_line = 14;
}
config_menu_drawings(chosen);
break;
case 1: // full HUD
COSD_FLAGS_MODES ^= COSD_FLAG_HUD;
config_menu_drawings(chosen);
break;
case 2: // art horizon
COSD_FLAGS_MODES ^= COSD_FLAG_ARTHORIZON;
config_menu_drawings(chosen);
break;
case 3: // big vario
COSD_FLAGS_MODES ^= COSD_FLAG_BIGVARIO;
config_menu_drawings(chosen);
case 3: // aggressiva horizon
COSD_FLAGS_MODES ^= COSD_FLAG_AGGRHORIZON;
break;
case 4: // statistics
COSD_FLAGS_MODES ^= COSD_FLAG_STATS;
config_menu_drawings(chosen);
break;
/*case 5: // warnings
COSD_FLAGS_MODES ^= COSD_FLAG_WARNINGS;
config_menu_drawings(chosen);
break;*/
case 5: // current by fc
COSD_FLAGS_MODES ^= COSD_FLAG_FCCURRENT;
config_menu_drawings(chosen);
break;
case 6: // 2nd voltage by c-strom
COSD_FLAGS_MODES ^= COSD_FLAG_STROMVOLT;
config_menu_drawings(chosen);
break;
case 7: // reset uptime
case 7: // GPS or BARO height
COSD_FLAGS_CONFIG ^= COSD_FLAG_GPSHEIGHT;
break;
case 8: // Feet and mph?
COSD_FLAGS_CONFIG ^= COSD_FLAG_FEET;
break;
case 9: // big vario
COSD_FLAGS_MODES ^= COSD_FLAG_BIGVARIO;
break;
case 13: // reset uptime
uptime = 0;
config_menu_doclick(chosen);
break;
case 8: // change mode
case 14: // change mode
#if FCONLY
COSD_DISPLAYMODE = (COSD_DISPLAYMODE + 1) % (sizeof(fcdisplaymodes) / sizeof(displaymode_t));
mode = fcdisplaymodes;
338,20 → 358,17
mode += COSD_DISPLAYMODE;
osd_ncmode = (int(*)(void)) pgm_read_word(&mode->dfun);
#endif
config_menu_drawings(chosen);
break;
case 9: // GPS or BARO height
COSD_FLAGS_CONFIG ^= COSD_FLAG_GPSHEIGHT;
config_menu_drawings(chosen);
break;
case 10: // save
case 15: // save
save_eeprom();
config_menu_doclick(chosen);
break;
case 11: // exit
case 16: // exit
inmenu = 0;
config_menu_doclick(chosen);
break;
}
config_menu_drawings(chosen);
_delay_ms(250);
}
}
/C-OSD/trunk/config.h
18,9 → 18,13
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
****************************************************************************/
 
#define CHECKBYTE1 46
#define CHECKBYTE2 23
#define CHECKBYTE1 64
#define CHECKBYTE2 46
 
#define MENU_LEFT 1
#define MENU_MIDDLE 15
#define MENU_TOP 2
 
extern uint8_t COSD_FLAGS_MODES, COSD_FLAGS_CONFIG, COSD_FLAGS_RUNTIME, COSD_DISPLAYMODE;
extern uint8_t min_voltage;
extern uint8_t max_voltage;
/C-OSD/trunk/default/Makefile
14,7 → 14,7
## Compile options common for all C compilation units.
CFLAGS += $(COMMON)
##CFLAGS += -fno-common
CFLAGS += -Wall -gdwarf-2 -std=gnu99 -DF_CPU=16000000UL -O2 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
CFLAGS += -Wall -gdwarf-2 -std=gnu99 -DF_CPU=16000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d
 
## Assembly specific flags
/C-OSD/trunk/default/dist.bat
19,7 → 19,7
:: * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
:: ****************************************************************************/
 
set DATE=20100403-0115
set DATE=20100412-2125
:: date /T
 
:: clean up first
/C-OSD/trunk/main.h
42,8 → 42,6
#define FCONLY 0 // set to 1 if you do NOT have a NaviCtrl and the OSD is
#endif // connected to the FC directly
 
#define NEW_ARTHORIZON 0 // set to 1 for full artificial horizon (agr type)
 
#define HUD 1 // set to 0 to disable HUD by default
#define ARTHORIZON 0 // set to 1 to enable roll&nick artificial horizon by default
#define BIGVARIO 0 // set to 1 to enable the big vario bar on right side
62,6 → 60,9
#define INVERT 0b00101111 // attribute byte for inverted characters
#define BLACKBG 0b10001111 // attribute byte for _black background_ on characters
 
// ### constants
#define MtoFT 32808399 // 3,2808399
 
/* ##########################################################################
* FLAGS usable during runtime that get saved
* ##########################################################################*/
72,11 → 73,13
#define COSD_FLAG_WARNINGS 16
#define COSD_FLAG_STROMVOLT 32
#define COSD_FLAG_FCCURRENT 64
#define COSD_FLAG_AGGRHORIZON 128
 
 
#define COSD_FLAG_NTSC 1
#define COSD_FLAG_GPSHEIGHT 2
#define COSD_FLAG_FCMODE 4
#define COSD_FLAG_FEET 8
 
/* ##########################################################################
* FLAGS only usable during runtime (not saved)
/C-OSD/trunk/max7456_software_spi.c
180,7 → 180,7
else if (c == ',') c = 69; // remap
// else if (c == '?') c = 66; // remap
// else if (c == '\'') c = 70; // remap
// else if (c == '/') c = 71; // remap
else if (c == '/') c = 71; // remap
// else if (c == '"') c = 72; // remap
// else if (c == '<') c = 74; // remap
// else if (c == '>') c = 75; // remap
/C-OSD/trunk/osd_helpers.c
180,7 → 180,6
write_string_pgm_down(x, y-2, (const char *) (pgm_read_word ( &(vario_pnt[index]))), 5);
}
 
#if (NEW_ARTHORIZON == 1)
/* ##########################################################################
* NEW artificial horizon By AGRESSiVA --=-- COPTERTRONiC
* ##########################################################################*/
205,7 → 204,7
* calculate the rails of artificial horizon
* receive <nick> and <roll> values
*/
void draw_artificial_horizon(uint8_t firstline, uint8_t lastline, int16_t nick, int16_t roll) {
void draw_agressiva_artificial_horizon(uint8_t firstline, uint8_t lastline, int16_t nick, int16_t roll) {
static int8_t old_ticy = 1,old_ticx = 0;
static int8_t old1 = 0,old2 = 0,old3 = 0,old4, old5 = 0, old6 = 0,old7 = 0,old8 = 0;
int8_t ticy = 0, ticx = 0;
245,7 → 244,6
old_ticx = ticx;
}
 
#else
 
/* ##########################################################################
* OLD artificial horizon
309,6 → 307,5
old_af_y = nicky;
}
 
#endif
 
#endif
/C-OSD/trunk/osd_helpers.h
67,3 → 67,5
* from line <firstline> to <listlines> for given <nick> and <roll> values
*/
void draw_artificial_horizon(uint8_t, uint8_t, int16_t, int16_t);
 
void draw_agressiva_artificial_horizon(uint8_t, uint8_t, int16_t, int16_t);
/C-OSD/trunk/osd_ncmode_default.c
31,13 → 31,23
if (COSD_FLAGS_MODES & COSD_FLAG_HUD) {
// write icons at init or after menu/mode-switch
if (!(COSD_FLAGS_RUNTIME & COSD_ICONS_WRITTEN)) {
if (COSD_FLAGS_CONFIG & COSD_FLAG_FEET) {
write_char_xy(5, top_line, 0x7D); // mph
write_char_xy(27, top_line + 1, 0x7E); // small feet ft home
write_char_xy(27, top_line, 0x7E); // small feet ft height
} else {
write_char_xy(5, top_line, 0xCB); // km/h
write_char_xy(27, top_line + 1, 0xCC); // small meters m home
write_char_xy(27, top_line, 0xCC); // small meters m height
}
write_char_xy(10, top_line, 0xCA); // RC-transmitter
write_char_xy(16, top_line, 0xD0); // degree symbol
write_char_xy(27, top_line, 0xCC); // small meters m height
write_char_xy(20, top_line + 1, 0xB0); // left circle
write_char_xy(22, top_line + 1, 0xB2); // right circle
write_char_xy(27, top_line + 1, 0xCC); // small meters m home
 
 
write_char_xy(7, bottom_line, 0x9E); // small V
if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) || (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) {
write_char_xy(7, bottom_line - 1, 0x9F); // small A
54,7 → 64,12
}
 
// first line
if (COSD_FLAGS_CONFIG & COSD_FLAG_FEET) {
// experimental cm/s -> mph
write_ndigit_number_u(2, top_line, (uint16_t) (((uint32_t) naviData.GroundSpeed * (uint32_t) 279) / (uint32_t) 12500), 3, 0);
} else {
write_ndigit_number_u(2, top_line, (uint16_t) (((uint32_t) naviData.GroundSpeed * (uint32_t) 9) / (uint32_t) 250), 3, 0);
}
 
write_ndigit_number_u(7, top_line, rc_signal, 3, 0);
if (rc_signal <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) {
79,6 → 94,10
draw_variometer(21, top_line, naviData.Variometer);
 
if (COSD_FLAGS_CONFIG & COSD_FLAG_GPSHEIGHT) {
if (COSD_FLAGS_CONFIG & COSD_FLAG_FEET) {
// feet
write_ndigit_number_s(23, top_line, (int16_t) (naviData.CurrentPosition.Altitude / 1000 - altimeter_offset) * 32 / 10, 4, 0); // GPS
} else {
if (naviData.CurrentPosition.Altitude / 1000 - altimeter_offset > 10 || naviData.CurrentPosition.Altitude / 1000 - altimeter_offset < -10) {
// above 10m only write full meters
write_ndigit_number_s(23, top_line, (int16_t) (naviData.CurrentPosition.Altitude / 1000 - altimeter_offset), 4, 0); // GPS
86,7 → 105,11
// up to 10m write meters.dm
write_ndigit_number_s_10th(23, top_line, (int16_t) (naviData.CurrentPosition.Altitude / 100 - altimeter_offset * 10), 3, 0); // GPS
}
}
} else {
if (COSD_FLAGS_CONFIG & COSD_FLAG_FEET) {
write_ndigit_number_s(23, top_line, naviData.Altimeter / 10 * 32 / 30, 4, 0); // BARO
} else {
//note:lephisto:according to several sources it's /30
if (naviData.Altimeter > 300 || naviData.Altimeter < -300) {
// above 10m only write full meters
96,6 → 119,7
write_ndigit_number_s_10th(23, top_line, naviData.Altimeter / 3, 3, 0); // BARO
}
}
}
// seccond line
@@ -107,7 +131,12 @@
// finer resolution, 0xa0 is first character and we add the index 0 <= index < 16
write_char_xy(21, top_line + 1, 0xa0 + heading_fine_conv(heading_home));
+ if (COSD_FLAGS_CONFIG & COSD_FLAG_FEET) {
+ // feet
+ write_ndigit_number_u(24, top_line + 1, naviData.HomePositionDeviation.Distance / 10 * 32 / 10, 3, 0);
+ } else {
write_ndigit_number_u(24, top_line + 1, naviData.HomePositionDeviation.Distance / 10, 3, 0);
+ }
// center
if (naviData.FCFlags & FLAG_MOTOR_RUN) { // should be engines running
@@ -138,14 +167,25 @@
if ((COSD_FLAGS_RUNTIME & COSD_WASFLYING) && (COSD_FLAGS_MODES & COSD_FLAG_STATS)) {
uint8_t line = 3;
write_ascii_string_pgm(1, line, (const char *) (pgm_read_word(&(stats_item_pointers[0])))); // max Altitude
+ write_ascii_string_pgm(1, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[1])))); // max Speed
+ write_ascii_string_pgm(1, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[2])))); // max Distance
+
+ if (COSD_FLAGS_CONFIG & COSD_FLAG_FEET) {
+ write_ndigit_number_s(16, line, max_Altimeter * 32 / 10, 4, 0);
+ write_char_xy(20, line - 2, 0x7E); // small feet ft
+ write_ndigit_number_u(17, line, (uint16_t) (((uint32_t) max_GroundSpeed * (uint32_t) 279) / (uint32_t) 12500), 3, 0);
+ write_char_xy(20, line - 1, 0x7D); // mp/h
+ write_ndigit_number_u(17, line, max_Distance / 10 * 32 / 10, 3, 0);
+ write_char_xy(20, line - 0, 0x7E); // small feet ft
+ } else {
write_ndigit_number_s(16, line, max_Altimeter, 4, 0);
- write_char_xy(20, line, 204); // small meters m
- write_ascii_string_pgm(1, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[1])))); // max Speed
+ write_char_xy(20, line - 2, 204); // small meters m
write_ndigit_number_u(17, line, (uint16_t) (((uint32_t) max_GroundSpeed * (uint32_t) 9) / (uint32_t) 250), 3, 0);
- write_char_xy(20, line, 203); // km/h
- write_ascii_string_pgm(1, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[2])))); // max Distance
+ write_char_xy(20, line - 1, 203); // km/h
write_ndigit_number_u(17, line, max_Distance / 10, 3, 0);
- write_char_xy(20, line, 204); // small meters m
+ write_char_xy(20, line - 0, 204); // small meters m
+ }
+
write_ascii_string_pgm(1, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[3])))); // min voltage
write_ndigit_number_u_10th(16, line, min_UBat, 3, 0);
write_char_xy(20, line, 0x9E); // small V
@@ -172,10 +212,14 @@
write_ascii_string_pgm(1, ++line, (const char *) (pgm_read_word(&(stats_item_pointers[6])))); // latitude
write_gps_pos(14, line, naviData.CurrentPosition.Latitude);
} else if (COSD_FLAGS_MODES & COSD_FLAG_ARTHORIZON) { // if no stats there is space horizon
+ uint8_t horizon_bottom = bottom_line - 1;
if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) || (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) {
- draw_artificial_horizon(top_line + 2, bottom_line - 2, naviData.AngleNick, naviData.AngleRoll);
+ horizon_bottom--;
+ }
+ if (COSD_FLAGS_MODES & COSD_FLAG_AGGRHORIZON) {
+ draw_agressiva_artificial_horizon(top_line + 2, horizon_bottom, naviData.AngleNick, naviData.AngleRoll);
} else {
- draw_artificial_horizon(top_line + 2, bottom_line - 1, naviData.AngleNick, naviData.AngleRoll);
+ draw_artificial_horizon(top_line + 2, horizon_bottom, naviData.AngleNick, naviData.AngleRoll);
}
}
}