1,5 → 1,5 |
/**************************************************************************** |
* Copyright (C) 2009-2010 by Claas Anders "CaScAdE" Rathje * |
* Copyright (C) 2009-2011 by Claas Anders "CaScAdE" Rathje * |
* admiralcascade@gmail.com * |
* Project-URL: http://www.mylifesucks.de/oss/c-osd/ * |
* * |
37,11 → 37,11 |
uint8_t EEMEM ee_COSD_FLAGS_MODES = 0; |
uint8_t EEMEM ee_COSD_FLAGS_CONFIG = 0; |
uint8_t EEMEM ee_COSD_DISPLAYMODE = 0; |
uint8_t EEMEM ee_COSD_SCOPE [8] = { |
5, 5, |
25, 5, |
5, 10, |
25, 10 |
uint8_t EEMEM ee_COSD_SCOPE [12] = { |
5, 5, 0, |
25, 5, 0, |
5, 10, 0, |
25, 10, 0 |
}; |
|
// video modes |
64,7 → 64,7 |
COSD_FLAGS_CONFIG = eeprom_read_byte(&ee_COSD_FLAGS_CONFIG); |
COSD_DISPLAYMODE = eeprom_read_byte(&ee_COSD_DISPLAYMODE); |
//if (verbose) write_ndigit_number_u(23, 11, COSD_DISPLAYMODE, 2, 0); |
for (int i = 0; i < 8; i++) { |
for (int i = 0; i < 12; i++) { |
scope[i] = eeprom_read_byte(&ee_COSD_SCOPE[i]); |
} |
} else { |
81,7 → 81,7 |
eeprom_write_byte(&ee_COSD_FLAGS_MODES, COSD_FLAGS_MODES); |
eeprom_write_byte(&ee_COSD_FLAGS_CONFIG, COSD_FLAGS_CONFIG); |
eeprom_write_byte(&ee_COSD_DISPLAYMODE, COSD_DISPLAYMODE); |
for (int i = 0; i < 8; i++) { |
for (int i = 0; i < 12; i++) { |
eeprom_write_byte(&ee_COSD_SCOPE[i], scope[i]); |
} |
} |
227,14 → 227,14 |
void config_menu_drawings(uint8_t chosen) { |
static uint8_t old_y = 0; |
uint8_t x = MENU_LEFT, y = MENU_TOP, line = MENU_TOP; |
|
if (chosen > 5 && chosen < 13) { // right |
//************************************************* 13 to 14 |
if (chosen > 6 && chosen < 15) { // right |
x = MENU_MIDDLE; |
y = chosen - 6 + MENU_TOP; |
} else if (chosen < 7) { |
y = chosen - 7 + MENU_TOP; |
} else if (chosen < 8) { |
y = chosen + MENU_TOP; |
} else { |
y = chosen - 6 + MENU_TOP; |
y = chosen - 7 + MENU_TOP; |
} |
|
// clear prevoius _cursor_ and draw current |
267,6 → 267,9 |
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(MENU_LEFT, ++line, PSTR("GPS Pos")); |
onoff(MENU_LEFT + 10, line, COSD_FLAGS_CONFIG & COSD_FLAG_SHOW_COORDS); |
|
// 2nd col |
line = 2; |
|
286,6 → 289,9 |
write_ascii_string_pgm(MENU_MIDDLE, ++line, PSTR("Big Vario")); |
onoff(MENU_MIDDLE + 10, line, COSD_FLAGS_MODES & COSD_FLAG_BIGVARIO); |
|
write_ascii_string_pgm(MENU_MIDDLE, ++line, PSTR("Big Speed")); |
onoff(MENU_MIDDLE + 10, line, COSD_FLAGS_CONFIG & COSD_FLAG_BIGSPEED); |
|
write_ascii_string_pgm(MENU_MIDDLE, ++line, PSTR("Passive")); |
onoff(MENU_MIDDLE + 10, line, COSD_FLAGS_CONFIG & COSD_FLAG_PASSIVE); |
|
296,13 → 302,13 |
|
|
// bottom |
write_ascii_string_pgm(MENU_LEFT, 9, PSTR("Reset uptime")); |
write_ascii_string_pgm(MENU_LEFT, 10, 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("Display Mode")); |
write_ascii_string_pgm(15, 11, (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")); |
write_ascii_string_pgm(MENU_LEFT, 12, PSTR("Save config")); |
write_ascii_string_pgm(MENU_LEFT, 13, PSTR("EXIT")); |
|
old_y = y; |
} |
324,12 → 330,16 |
clear(); |
draw_scope(); |
_delay_ms(500); |
while (mode < 8) { |
while (mode < 12) { |
if (s2_pressed()) { // next |
mode++; |
_delay_ms(500); |
} else if (s1_pressed()) { |
scope[mode] = (scope[mode] + 1) % (mode % 2 == 0 ? 30 : bottom_line); |
if (mode % 3 == 2) { |
scope[mode] = (scope[mode] + 1) % 2; |
} else { |
scope[mode] = (scope[mode] + 1) % ((mode % 3) % 2 == 0 ? 30 : bottom_line); |
} |
clear(); |
draw_scope(); |
_delay_ms(100); |
359,7 → 369,7 |
|
while (inmenu) { |
if (s2_pressed()) { |
chosen = (chosen + 1) % 17; |
chosen = (chosen + 1) % 19; |
//if (chosen == 12) chosen = 13; // SKIP unused menu space for now |
config_menu_drawings(chosen); |
_delay_ms(500); |
395,32 → 405,38 |
case 5: // current by fc |
COSD_FLAGS_MODES ^= COSD_FLAG_FCCURRENT; |
break; |
case 6: // 2nd voltage by c-strom |
case 6: // GPS coordinates while flying |
COSD_FLAGS_CONFIG ^= COSD_FLAG_SHOW_COORDS; |
break; |
case 7: // 2nd voltage by c-strom |
COSD_FLAGS_MODES ^= COSD_FLAG_STROMVOLT; |
break; |
case 7: // GPS or BARO height |
case 8: // GPS or BARO height |
COSD_FLAGS_CONFIG ^= COSD_FLAG_GPSHEIGHT; |
break; |
case 8: // Feet and mph? |
case 9: // Feet and mph? |
COSD_FLAGS_CONFIG ^= COSD_FLAG_FEET; |
break; |
case 9: // big vario |
case 10: // big vario |
COSD_FLAGS_MODES ^= COSD_FLAG_BIGVARIO; |
break; |
case 10: // passive |
case 11: // big Speed |
COSD_FLAGS_CONFIG ^= COSD_FLAG_BIGSPEED; |
break; |
case 12: // passive |
COSD_FLAGS_CONFIG ^= COSD_FLAG_PASSIVE; |
break; |
case 11: // scope |
case 13: // scope |
COSD_FLAGS_CONFIG ^= COSD_FLAG_SHOW_SCOPE; |
break; |
case 12: // move scope |
case 14: // move scope |
move_scope(); |
break; |
case 13: // reset uptime |
case 15: // reset uptime |
uptime = 0; |
config_menu_doclick(chosen); |
break; |
case 14: // change mode |
case 16: // change mode |
#if FCONLY |
COSD_DISPLAYMODE = (COSD_DISPLAYMODE + 1) % (sizeof (fcdisplaymodes) / sizeof (displaymode_t)); |
mode = fcdisplaymodes; |
433,11 → 449,11 |
osd_ncmode = (int(*)(void)) pgm_read_word(&mode->dfun); |
#endif |
break; |
case 15: // save |
case 17: // save |
save_eeprom(); |
config_menu_doclick(chosen); |
break; |
case 16: // exit |
case 18: // exit |
inmenu = 0; |
config_menu_doclick(chosen); |
break; |