Rev 1197 | Rev 1437 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1197 | Rev 1281 | ||
---|---|---|---|
Line 49... | Line 49... | ||
49 | const char VM_PAL[] PROGMEM = "PAL "; |
49 | const char VM_PAL[] PROGMEM = "PAL "; |
50 | const char VM_NTSC[] PROGMEM = "NTSC"; |
50 | const char VM_NTSC[] PROGMEM = "NTSC"; |
Line 51... | Line 51... | ||
51 | 51 | ||
Line 52... | Line -... | ||
52 | const displaymode_t * mode; |
- | |
53 | 52 | const displaymode_t * mode; |
|
54 | 53 | ||
55 | /** |
54 | /** |
56 | * read data saved in eeprom, print out message if <verbose> is set |
55 | * read data saved in eeprom, print out message if <verbose> is set |
57 | */ |
56 | */ |
58 | void get_eeprom(uint8_t verbose) { |
57 | void get_eeprom(uint8_t verbose) { |
59 | if (eeprom_read_byte(&ee_checkbyte1) == CHECKBYTE1 && eeprom_read_byte(&ee_checkbyte2) == CHECKBYTE2) { |
58 | if (eeprom_read_byte(&ee_checkbyte1) == CHECKBYTE1 && eeprom_read_byte(&ee_checkbyte2) == CHECKBYTE2) { |
60 | if (verbose) write_ascii_string_pgm(2, 2, PSTR("Loading from EEPROM")); // Loading data |
59 | if (verbose) write_ascii_string_pgm(2, 6, PSTR("Loading from EEPROM")); // Loading data |
61 | COSD_FLAGS_MODES = eeprom_read_byte(&ee_COSD_FLAGS_MODES); |
60 | COSD_FLAGS_MODES = eeprom_read_byte(&ee_COSD_FLAGS_MODES); |
62 | COSD_FLAGS_CONFIG = eeprom_read_byte(&ee_COSD_FLAGS_CONFIG); |
61 | COSD_FLAGS_CONFIG = eeprom_read_byte(&ee_COSD_FLAGS_CONFIG); |
63 | COSD_DISPLAYMODE = eeprom_read_byte(&ee_COSD_DISPLAYMODE); |
62 | COSD_DISPLAYMODE = eeprom_read_byte(&ee_COSD_DISPLAYMODE); |
64 | //if (verbose) write_ndigit_number_u(23, 11, COSD_DISPLAYMODE, 2, 0); |
63 | //if (verbose) write_ndigit_number_u(23, 11, COSD_DISPLAYMODE, 2, 0); |
65 | for (int i = 0; i < 12; i++) { |
64 | for (int i = 0; i < 12; i++) { |
66 | scope[i] = eeprom_read_byte(&ee_COSD_SCOPE[i]); |
65 | scope[i] = eeprom_read_byte(&ee_COSD_SCOPE[i]); |
67 | } |
66 | } |
68 | } else { |
67 | } else { |
69 | if (verbose) write_ascii_string_pgm(2, 2, PSTR("No Data in EEPROM")); // Loading data |
68 | if (verbose) write_ascii_string_pgm(2, 6, PSTR("No Data in EEPROM")); // Loading data |
Line 70... | Line 69... | ||
70 | } |
69 | } |
71 | } |
70 | } |
Line 87... | Line 86... | ||
87 | /** |
86 | /** |
88 | * auto config some stuff on startup, currently only battery cells |
87 | * auto config some stuff on startup, currently only battery cells |
89 | */ |
88 | */ |
90 | void init_cosd(uint8_t UBat) { |
89 | void init_cosd(uint8_t UBat) { |
91 | clear(); |
90 | clear(); |
- | 91 | ||
92 | write_ascii_string_pgm(2, 1, PSTR("C-OSD Init")); |
92 | write_ascii_string_pgm(2, 1, PSTR("C-OSD")); |
- | 93 | write_ascii_string_pgm(3, 2, PSTR("boot")); |
|
- | 94 | draw_logo(11, 1); |
|
- | 95 | ||
93 | write_ascii_string_pgm(2, 4, PSTR(BUILDDATE)); |
96 | write_ascii_string_pgm(2, 5, PSTR(BUILDDATE)); |
- | 97 | ||
- | 98 | get_eeprom(1); |
|
- | 99 | ||
- | 100 | //write_ascii_string_pgm(23, 2, vm[COSD_FLAGS & COSD_FLAG_NTSC]); |
|
- | 101 | if (COSD_FLAGS_CONFIG & COSD_FLAG_NTSC) { |
|
- | 102 | write_ascii_string_pgm(23, 1, VM_NTSC); |
|
- | 103 | } else { |
|
- | 104 | write_ascii_string_pgm(23, 1, VM_PAL); |
|
- | 105 | } |
|
- | 106 | ||
Line 94... | Line 107... | ||
94 | 107 | ||
95 | #if FCONLY |
108 | #if FCONLY |
96 | write_ascii_string_pgm(2, 3, PSTR("FC only Mode")); |
109 | write_ascii_string_pgm(2, 4, PSTR("FC only Mode")); |
97 | #else |
110 | #else |
Line 98... | Line 111... | ||
98 | write_ascii_string_pgm(2, 3, PSTR("NaviCtrl Mode")); |
111 | write_ascii_string_pgm(2, 4, PSTR("NaviCtrl Mode")); |
99 | 112 | ||
100 | usart1_EnableTXD(); |
113 | usart1_EnableTXD(); |
101 | usart1_puts_pgm(PSTR(REQUEST_UART_TO_FC)); |
114 | usart1_puts_pgm(PSTR(REQUEST_UART_TO_FC)); |
Line 108... | Line 121... | ||
108 | //write_ascii_char(4 + 12 * 30, rxd_buffer[2]); |
121 | //write_ascii_char(4 + 12 * 30, rxd_buffer[2]); |
Line 109... | Line 122... | ||
109 | 122 | ||
110 | paramset_serial setting; |
123 | paramset_serial setting; |
Line 111... | Line 124... | ||
111 | setting = *((paramset_serial*)pRxData); |
124 | setting = *((paramset_serial*)pRxData); |
112 | 125 | ||
113 | write_ascii_string_pgm(2, 6, PSTR("Setting :")); |
126 | write_ascii_string_pgm(2, 7, PSTR("Setting :")); |
Line 114... | Line 127... | ||
114 | write_ndigit_number_u(10, 6, setting.SettingsIndex, 1, 1); |
127 | write_ndigit_number_u(10, 7, setting.SettingsIndex, 1, 1); |
115 | write_ascii_string_len(13, 6, setting.param.Name, 12); |
128 | write_ascii_string_len(13, 7, setting.param.Name, 12); |
116 | 129 | ||
117 | uint8_t cells = 0; |
130 | uint8_t cells = 0; |
Line 143... | Line 156... | ||
143 | write_ascii_string_pgm(2, 9, PSTR("Warn:")); // Warn Voltage |
156 | write_ascii_string_pgm(2, 9, PSTR("Warn:")); // Warn Voltage |
144 | write_ndigit_number_s_10th(8, 9, min_voltage, 3, 0); |
157 | write_ndigit_number_s_10th(8, 9, min_voltage, 3, 0); |
145 | write_ascii_string_pgm(14, 9, PSTR("Max:")); // Max Voltage |
158 | write_ascii_string_pgm(14, 9, PSTR("Max:")); // Max Voltage |
146 | write_ndigit_number_s_10th(20, 9, max_voltage, 3, 0); |
159 | write_ndigit_number_s_10th(20, 9, max_voltage, 3, 0); |
Line 147... | Line -... | ||
147 | - | ||
Line 148... | Line -... | ||
148 | get_eeprom(1); |
- | |
149 | - | ||
150 | //write_ascii_string_pgm(23, 2, vm[COSD_FLAGS & COSD_FLAG_NTSC]); |
- | |
151 | if (COSD_FLAGS_CONFIG & COSD_FLAG_NTSC) { |
- | |
152 | write_ascii_string_pgm(23, 1, VM_NTSC); |
- | |
153 | } else { |
- | |
Line 154... | Line 160... | ||
154 | write_ascii_string_pgm(23, 1, VM_PAL); |
160 | |
155 | } |
161 | |
156 | 162 | ||
157 | // request version from board |
163 | // request version from board |