Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 836 → Rev 837

/C-OSD/trunk/config.c/config.c
28,6 → 28,7
#include "config.h"
#include "buttons.h"
#include "usart1.h"
#include "osd_helpers.h"
 
#if !(ALLCHARSDEBUG|(WRITECHARS != -1))
 
36,6 → 37,12
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
};
 
// video modes
const char VM_PAL[] PROGMEM = "PAL ";
57,6 → 64,9
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++) {
scope[i] = eeprom_read_byte(&ee_COSD_SCOPE[i]);
}
} else {
if (verbose) write_ascii_string_pgm(2, 2, ee_msg[1]); // Loading data
}
71,6 → 81,9
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++) {
eeprom_write_byte(&ee_COSD_SCOPE[i], scope[i]);
}
}
 
/**
152,7 → 165,7
usart1_request_nc_uart();
_delay_ms(200);
usart1_request_nc_uart();
 
//usart1_request_mk_data(1, 'v', 0);
write_ascii_string_pgm(2, 11, PSTR("NC VERSION: ........"));
usart1_request_blocking('V', PSTR(REQUEST_NC_VERSION));
215,7 → 228,7
static uint8_t old_y = 0;
uint8_t x = MENU_LEFT, y = MENU_TOP, line = MENU_TOP;
 
if (chosen > 5 && chosen < 12) { // right
if (chosen > 5 && chosen < 13) { // right
x = MENU_MIDDLE;
y = chosen - 6 + MENU_TOP;
} else if (chosen < 7) {
276,9 → 289,12
write_ascii_string_pgm(MENU_MIDDLE, ++line, PSTR("Passive"));
onoff(MENU_MIDDLE + 10, line, COSD_FLAGS_CONFIG & COSD_FLAG_PASSIVE);
 
/*write_ascii_string_pgm(MENU_MIDDLE, ++line, PSTR("?????"));
onoff(MENU_MIDDLE + 10, line, COSD_FLAGS_CONFIG & COSD_FLAG_PASSIVE);*/
write_ascii_string_pgm(MENU_MIDDLE, ++line, PSTR("Cam Scope"));
onoff(MENU_MIDDLE + 10, line, COSD_FLAGS_CONFIG & COSD_FLAG_SHOW_SCOPE);
 
write_ascii_string_pgm(MENU_MIDDLE, ++line, PSTR("Move Scope"));
 
 
// bottom
write_ascii_string_pgm(MENU_LEFT, 9, PSTR("Reset uptime"));
 
301,6 → 317,28
}
 
/**
* move around the four scope edges
*/
void move_scope() {
uint8_t mode = 0;
clear();
draw_scope();
_delay_ms(500);
while (mode < 8) {
if (s2_pressed()) { // next
mode++;
_delay_ms(500);
} else if (s1_pressed()) {
scope[mode] = (scope[mode] + 1) % (mode % 2 == 0 ? 30 : bottom_line);
clear();
draw_scope();
_delay_ms(100);
}
}
clear();
}
 
/**
* a simple config menu tryout
*/
void config_menu(void) {
322,7 → 360,7
while (inmenu) {
if (s2_pressed()) {
chosen = (chosen + 1) % 17;
if (chosen == 11) chosen = 13; // SKIP unused menu space for now
//if (chosen == 12) chosen = 13; // SKIP unused menu space for now
config_menu_drawings(chosen);
_delay_ms(500);
} else if (s1_pressed()) {
372,6 → 410,12
case 10: // passive
COSD_FLAGS_CONFIG ^= COSD_FLAG_PASSIVE;
break;
case 11: // scope
COSD_FLAGS_CONFIG ^= COSD_FLAG_SHOW_SCOPE;
break;
case 12: // move scope
move_scope();
break;
case 13: // reset uptime
uptime = 0;
config_menu_doclick(chosen);