Rev 1197 | Rev 1437 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
471 | cascade | 1 | /**************************************************************************** |
902 | - | 2 | * Copyright (C) 2009-2011 by Claas Anders "CaScAdE" Rathje * |
471 | cascade | 3 | * admiralcascade@gmail.com * |
4 | * Project-URL: http://www.mylifesucks.de/oss/c-osd/ * |
||
5 | * * |
||
6 | * This program is free software; you can redistribute it and/or modify * |
||
7 | * it under the terms of the GNU General Public License as published by * |
||
8 | * the Free Software Foundation; either version 2 of the License. * |
||
9 | * * |
||
10 | * This program is distributed in the hope that it will be useful, * |
||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
||
13 | * GNU General Public License for more details. * |
||
14 | * * |
||
15 | * You should have received a copy of the GNU General Public License * |
||
16 | * along with this program; if not, write to the * |
||
17 | * Free Software Foundation, Inc., * |
||
18 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
||
19 | ****************************************************************************/ |
||
20 | |||
800 | - | 21 | #include "main.h" |
471 | cascade | 22 | #include <avr/io.h> |
23 | #include <avr/eeprom.h> |
||
24 | #include <avr/pgmspace.h> |
||
25 | #include <avr/interrupt.h> |
||
26 | #include <util/delay.h> |
||
27 | #include "max7456_software_spi.h" |
||
28 | #include "config.h" |
||
29 | #include "buttons.h" |
||
30 | #include "usart1.h" |
||
837 | - | 31 | #include "osd_helpers.h" |
471 | cascade | 32 | |
762 | - | 33 | #if !(ALLCHARSDEBUG|(WRITECHARS != -1)) |
34 | |||
1197 | - | 35 | // EEPROM bytes |
471 | cascade | 36 | uint8_t EEMEM ee_checkbyte1 = CHECKBYTE1; |
37 | uint8_t EEMEM ee_checkbyte2 = CHECKBYTE2; |
||
523 | cascade | 38 | uint8_t EEMEM ee_COSD_FLAGS_MODES = 0; |
39 | uint8_t EEMEM ee_COSD_FLAGS_CONFIG = 0; |
||
497 | cascade | 40 | uint8_t EEMEM ee_COSD_DISPLAYMODE = 0; |
902 | - | 41 | uint8_t EEMEM ee_COSD_SCOPE [12] = { |
42 | 5, 5, 0, |
||
43 | 25, 5, 0, |
||
44 | 5, 10, 0, |
||
45 | 25, 10, 0 |
||
837 | - | 46 | }; |
471 | cascade | 47 | |
474 | cascade | 48 | // video modes |
489 | woggle | 49 | const char VM_PAL[] PROGMEM = "PAL "; |
50 | const char VM_NTSC[] PROGMEM = "NTSC"; |
||
474 | cascade | 51 | |
497 | cascade | 52 | const displaymode_t * mode; |
53 | |||
471 | cascade | 54 | /** |
474 | cascade | 55 | * read data saved in eeprom, print out message if <verbose> is set |
471 | cascade | 56 | */ |
474 | cascade | 57 | void get_eeprom(uint8_t verbose) { |
761 | - | 58 | if (eeprom_read_byte(&ee_checkbyte1) == CHECKBYTE1 && eeprom_read_byte(&ee_checkbyte2) == CHECKBYTE2) { |
1281 | - | 59 | if (verbose) write_ascii_string_pgm(2, 6, PSTR("Loading from EEPROM")); // Loading data |
761 | - | 60 | COSD_FLAGS_MODES = eeprom_read_byte(&ee_COSD_FLAGS_MODES); |
61 | COSD_FLAGS_CONFIG = eeprom_read_byte(&ee_COSD_FLAGS_CONFIG); |
||
62 | COSD_DISPLAYMODE = eeprom_read_byte(&ee_COSD_DISPLAYMODE); |
||
63 | //if (verbose) write_ndigit_number_u(23, 11, COSD_DISPLAYMODE, 2, 0); |
||
902 | - | 64 | for (int i = 0; i < 12; i++) { |
837 | - | 65 | scope[i] = eeprom_read_byte(&ee_COSD_SCOPE[i]); |
66 | } |
||
761 | - | 67 | } else { |
1281 | - | 68 | if (verbose) write_ascii_string_pgm(2, 6, PSTR("No Data in EEPROM")); // Loading data |
761 | - | 69 | } |
471 | cascade | 70 | } |
71 | |||
72 | /** |
||
73 | * save data to eeprom |
||
74 | */ |
||
75 | void save_eeprom() { |
||
761 | - | 76 | eeprom_write_byte(&ee_checkbyte1, CHECKBYTE1); |
77 | eeprom_write_byte(&ee_checkbyte2, CHECKBYTE2); |
||
78 | eeprom_write_byte(&ee_COSD_FLAGS_MODES, COSD_FLAGS_MODES); |
||
79 | eeprom_write_byte(&ee_COSD_FLAGS_CONFIG, COSD_FLAGS_CONFIG); |
||
80 | eeprom_write_byte(&ee_COSD_DISPLAYMODE, COSD_DISPLAYMODE); |
||
902 | - | 81 | for (int i = 0; i < 12; i++) { |
837 | - | 82 | eeprom_write_byte(&ee_COSD_SCOPE[i], scope[i]); |
83 | } |
||
471 | cascade | 84 | } |
85 | |||
86 | /** |
||
87 | * auto config some stuff on startup, currently only battery cells |
||
88 | */ |
||
89 | void init_cosd(uint8_t UBat) { |
||
90 | clear(); |
||
783 | - | 91 | |
1281 | - | 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 | |||
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 | |||
107 | |||
471 | cascade | 108 | #if FCONLY |
1281 | - | 109 | write_ascii_string_pgm(2, 4, PSTR("FC only Mode")); |
471 | cascade | 110 | #else |
1281 | - | 111 | write_ascii_string_pgm(2, 4, PSTR("NaviCtrl Mode")); |
783 | - | 112 | |
800 | - | 113 | usart1_EnableTXD(); |
114 | usart1_puts_pgm(PSTR(REQUEST_UART_TO_FC)); |
||
115 | usart1_DisableTXD(); |
||
471 | cascade | 116 | #endif |
783 | - | 117 | |
118 | |||
800 | - | 119 | usart1_request_blocking('Q', PSTR(REQUEST_CURRENT_SETTING)); |
783 | - | 120 | |
800 | - | 121 | //write_ascii_char(4 + 12 * 30, rxd_buffer[2]); |
783 | - | 122 | |
123 | paramset_serial setting; |
||
124 | setting = *((paramset_serial*)pRxData); |
||
125 | |||
1281 | - | 126 | write_ascii_string_pgm(2, 7, PSTR("Setting :")); |
127 | write_ndigit_number_u(10, 7, setting.SettingsIndex, 1, 1); |
||
128 | write_ascii_string_len(13, 7, setting.param.Name, 12); |
||
783 | - | 129 | |
800 | - | 130 | uint8_t cells = 0; |
131 | write_ascii_string_pgm(2, 8, PSTR("Battery:")); // Guessing Number of Cells |
||
132 | if (CELL_NUM == -1) { |
||
133 | #define MAX_CELL_VOLTAGE 43 // max cell volatage for LiPO |
||
783 | - | 134 | |
800 | - | 135 | if (setting.param.UnterspannungsWarnung < 50) { |
136 | // up to 6s LiPo, less than 2s is technical impossible |
||
137 | for (cells = 2; cells < 7; cells++) { |
||
138 | if (UBat < cells * MAX_CELL_VOLTAGE) break; |
||
139 | } |
||
140 | |||
141 | min_voltage = cells * setting.param.UnterspannungsWarnung; |
||
142 | } else { |
||
143 | min_voltage = setting.param.UnterspannungsWarnung; |
||
144 | cells = min_voltage / CELL_VOLT_MIN; |
||
145 | } |
||
146 | //write_ndigit_number_u(10, 13, setting.param.UnterspannungsWarnung, 3, 1); |
||
471 | cascade | 147 | } else { |
783 | - | 148 | cells = CELL_NUM; |
800 | - | 149 | min_voltage = cells * CELL_VOLT_MIN; |
471 | cascade | 150 | } |
151 | |||
800 | - | 152 | max_voltage = cells * CELL_VOLT_MAX; |
153 | |||
783 | - | 154 | write_ndigit_number_u(11, 8, cells, 1, 0); |
800 | - | 155 | write_ascii_string_pgm(13, 8, PSTR("Cells")); // Number of Cells |
783 | - | 156 | write_ascii_string_pgm(2, 9, PSTR("Warn:")); // Warn Voltage |
157 | write_ndigit_number_s_10th(8, 9, min_voltage, 3, 0); |
||
158 | write_ascii_string_pgm(14, 9, PSTR("Max:")); // Max Voltage |
||
159 | write_ndigit_number_s_10th(20, 9, max_voltage, 3, 0); |
||
160 | |||
471 | cascade | 161 | |
474 | cascade | 162 | |
761 | - | 163 | // request version from board |
164 | #if FCONLY |
||
165 | //usart1_request_mk_data(0, 'v', 0); |
||
166 | write_ascii_string_pgm(2, 11, PSTR("FC VERSION: ........")); |
||
800 | - | 167 | usart1_request_blocking('V', PSTR(REQUEST_FC_VERSION)); |
761 | - | 168 | #else |
800 | - | 169 | usart1_request_nc_uart(); |
826 | - | 170 | _delay_ms(200); |
171 | usart1_request_nc_uart(); |
||
837 | - | 172 | |
761 | - | 173 | //usart1_request_mk_data(1, 'v', 0); |
174 | write_ascii_string_pgm(2, 11, PSTR("NC VERSION: ........")); |
||
800 | - | 175 | usart1_request_blocking('V', PSTR(REQUEST_NC_VERSION)); |
761 | - | 176 | #endif |
177 | str_VersionInfo VersionInfo; |
||
178 | VersionInfo = *((str_VersionInfo*)pRxData); |
||
497 | cascade | 179 | |
761 | - | 180 | write_ndigit_number_u(14, 11, VersionInfo.SWMajor, 3, 1); |
181 | write_ndigit_number_u(18, 11, VersionInfo.SWMinor, 3, 1); |
||
182 | write_ascii_char(22 + 11 * 30, 'a' + VersionInfo.SWPatch); |
||
183 | // end version request |
||
677 | cascade | 184 | |
497 | cascade | 185 | |
783 | - | 186 | |
187 | |||
761 | - | 188 | #if FCONLY |
189 | COSD_DISPLAYMODE %= (sizeof (fcdisplaymodes) / sizeof (displaymode_t)); |
||
190 | mode = fcdisplaymodes; |
||
191 | mode += COSD_DISPLAYMODE; |
||
192 | osd_fcmode = (int(*)(void)) pgm_read_word(&mode->dfun); |
||
193 | // re-request data ever 100ms from FC; |
||
194 | //usart1_request_mk_data(0, 'd', 100); |
||
195 | #else |
||
196 | COSD_DISPLAYMODE %= (sizeof (ncdisplaymodes) / sizeof (displaymode_t)); |
||
197 | mode = ncdisplaymodes; |
||
198 | mode += COSD_DISPLAYMODE; |
||
199 | osd_ncmode = (int(*)(void)) pgm_read_word(&mode->dfun); |
||
200 | // re-request OSD Data from NC every 100ms |
||
201 | //usart1_request_mk_data(1, 'o', 100); |
||
202 | #endif |
||
203 | |||
783 | - | 204 | _delay_ms(5000); |
471 | cascade | 205 | clear(); |
206 | // update flags to paint display again because of clear |
||
523 | cascade | 207 | COSD_FLAGS_RUNTIME &= ~COSD_ICONS_WRITTEN; |
826 | - | 208 | |
209 | // we got data |
||
210 | COSD_FLAGS_RUNTIME |= COSD_DATARECEIVED; |
||
471 | cascade | 211 | } |
212 | |||
213 | /* ########################################################################## |
||
214 | * A simple config menu for the flags |
||
215 | * ##########################################################################*/ |
||
216 | |||
217 | /** |
||
736 | cascade | 218 | * helper function for flag display |
219 | */ |
||
761 | - | 220 | void onoff(uint8_t col, uint8_t line, uint8_t onoff) { |
221 | if (onoff) { |
||
222 | write_ascii_string_pgm(col, line, PSTR("ON ")); |
||
223 | } else { |
||
224 | write_ascii_string_pgm(col, line, PSTR("OFF")); |
||
225 | } |
||
736 | cascade | 226 | } |
227 | |||
228 | /** |
||
471 | cascade | 229 | * helper function for menu updating |
230 | */ |
||
231 | void config_menu_drawings(uint8_t chosen) { |
||
761 | - | 232 | static uint8_t old_y = 0; |
233 | uint8_t x = MENU_LEFT, y = MENU_TOP, line = MENU_TOP; |
||
902 | - | 234 | //************************************************* 13 to 14 |
235 | if (chosen > 6 && chosen < 15) { // right |
||
761 | - | 236 | x = MENU_MIDDLE; |
902 | - | 237 | y = chosen - 7 + MENU_TOP; |
238 | } else if (chosen < 8) { |
||
761 | - | 239 | y = chosen + MENU_TOP; |
240 | } else { |
||
902 | - | 241 | y = chosen - 7 + MENU_TOP; |
761 | - | 242 | } |
757 | cascade | 243 | |
244 | // clear prevoius _cursor_ and draw current |
||
761 | - | 245 | for (uint8_t myx = MENU_LEFT; myx < 29; myx++) { |
246 | write_char_att_xy(myx, old_y, 0); |
||
247 | if (myx > x - 1 && myx < x + 14) { |
||
248 | write_char_att_xy(myx, y, BLACKBG | INVERT); |
||
249 | } |
||
250 | }; |
||
474 | cascade | 251 | |
761 | - | 252 | write_ascii_string_pgm(MENU_LEFT, line, PSTR("Video")); |
253 | if (COSD_FLAGS_CONFIG & COSD_FLAG_NTSC) { |
||
254 | write_ascii_string_pgm(MENU_LEFT + 10, line, VM_NTSC); |
||
255 | } else { |
||
256 | write_ascii_string_pgm(MENU_LEFT + 10, line, VM_PAL); |
||
257 | } |
||
757 | cascade | 258 | |
761 | - | 259 | write_ascii_string_pgm(MENU_LEFT, ++line, PSTR("Full HUD")); |
260 | onoff(MENU_LEFT + 10, line, COSD_FLAGS_MODES & COSD_FLAG_HUD); |
||
261 | |||
262 | write_ascii_string_pgm(MENU_LEFT, ++line, PSTR("Horizon")); |
||
263 | onoff(MENU_LEFT + 10, line, COSD_FLAGS_MODES & COSD_FLAG_ARTHORIZON); |
||
264 | |||
265 | write_ascii_string_pgm(MENU_LEFT, ++line, PSTR("Aggr.Hor.")); |
||
266 | onoff(MENU_LEFT + 10, line, COSD_FLAGS_MODES & COSD_FLAG_AGGRHORIZON); |
||
267 | |||
268 | write_ascii_string_pgm(MENU_LEFT, ++line, PSTR("Stats")); |
||
757 | cascade | 269 | onoff(MENU_LEFT + 10, line, COSD_FLAGS_MODES & COSD_FLAG_STATS); |
736 | cascade | 270 | |
761 | - | 271 | write_ascii_string_pgm(MENU_LEFT, ++line, PSTR("A by FC")); |
272 | onoff(MENU_LEFT + 10, line, COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT); |
||
736 | cascade | 273 | |
902 | - | 274 | write_ascii_string_pgm(MENU_LEFT, ++line, PSTR("GPS Pos")); |
275 | onoff(MENU_LEFT + 10, line, COSD_FLAGS_CONFIG & COSD_FLAG_SHOW_COORDS); |
||
276 | |||
761 | - | 277 | // 2nd col |
278 | line = 2; |
||
736 | cascade | 279 | |
761 | - | 280 | write_ascii_string_pgm(MENU_MIDDLE, line, PSTR("V C-Strom")); |
281 | onoff(MENU_MIDDLE + 10, line, COSD_FLAGS_MODES & COSD_FLAG_STROMVOLT); |
||
736 | cascade | 282 | |
761 | - | 283 | write_ascii_string_pgm(MENU_MIDDLE, ++line, PSTR("Height by")); |
284 | if (COSD_FLAGS_CONFIG & COSD_FLAG_GPSHEIGHT) { |
||
285 | write_ascii_string_pgm(MENU_MIDDLE + 10, line, PSTR(" GPS")); |
||
286 | } else { |
||
287 | write_ascii_string_pgm(MENU_MIDDLE + 10, line, PSTR("BARO")); |
||
288 | } |
||
757 | cascade | 289 | |
761 | - | 290 | write_ascii_string_pgm(MENU_MIDDLE, ++line, PSTR("Feet/mph")); |
291 | onoff(MENU_MIDDLE + 10, line, COSD_FLAGS_CONFIG & COSD_FLAG_FEET); |
||
757 | cascade | 292 | |
761 | - | 293 | write_ascii_string_pgm(MENU_MIDDLE, ++line, PSTR("Big Vario")); |
294 | onoff(MENU_MIDDLE + 10, line, COSD_FLAGS_MODES & COSD_FLAG_BIGVARIO); |
||
757 | cascade | 295 | |
902 | - | 296 | write_ascii_string_pgm(MENU_MIDDLE, ++line, PSTR("Big Speed")); |
297 | onoff(MENU_MIDDLE + 10, line, COSD_FLAGS_CONFIG & COSD_FLAG_BIGSPEED); |
||
298 | |||
826 | - | 299 | write_ascii_string_pgm(MENU_MIDDLE, ++line, PSTR("Passive")); |
300 | onoff(MENU_MIDDLE + 10, line, COSD_FLAGS_CONFIG & COSD_FLAG_PASSIVE); |
||
757 | cascade | 301 | |
837 | - | 302 | write_ascii_string_pgm(MENU_MIDDLE, ++line, PSTR("Cam Scope")); |
303 | onoff(MENU_MIDDLE + 10, line, COSD_FLAGS_CONFIG & COSD_FLAG_SHOW_SCOPE); |
||
826 | - | 304 | |
837 | - | 305 | write_ascii_string_pgm(MENU_MIDDLE, ++line, PSTR("Move Scope")); |
306 | |||
307 | |||
761 | - | 308 | // bottom |
902 | - | 309 | write_ascii_string_pgm(MENU_LEFT, 10, PSTR("Reset uptime")); |
757 | cascade | 310 | |
902 | - | 311 | write_ascii_string_pgm(MENU_LEFT, 11, PSTR("Display Mode")); |
312 | write_ascii_string_pgm(15, 11, (const char *)(pgm_read_word(&(mode->desc)))); |
||
761 | - | 313 | |
902 | - | 314 | write_ascii_string_pgm(MENU_LEFT, 12, PSTR("Save config")); |
315 | write_ascii_string_pgm(MENU_LEFT, 13, PSTR("EXIT")); |
||
761 | - | 316 | |
317 | old_y = y; |
||
471 | cascade | 318 | } |
319 | |||
320 | /** |
||
321 | * some sort of clicking response in the menu |
||
322 | */ |
||
736 | cascade | 323 | void config_menu_doclick(uint8_t chosen) { |
932 | - | 324 | write_ascii_string_pgm(MENU_LEFT, chosen + MENU_TOP - 7, PSTR("DONE ")); |
471 | cascade | 325 | _delay_ms(500); |
736 | cascade | 326 | config_menu_drawings(chosen); |
471 | cascade | 327 | } |
328 | |||
329 | /** |
||
837 | - | 330 | * move around the four scope edges |
331 | */ |
||
332 | void move_scope() { |
||
333 | uint8_t mode = 0; |
||
334 | clear(); |
||
335 | draw_scope(); |
||
336 | _delay_ms(500); |
||
902 | - | 337 | while (mode < 12) { |
837 | - | 338 | if (s2_pressed()) { // next |
339 | mode++; |
||
340 | _delay_ms(500); |
||
341 | } else if (s1_pressed()) { |
||
902 | - | 342 | if (mode % 3 == 2) { |
343 | scope[mode] = (scope[mode] + 1) % 2; |
||
344 | } else { |
||
345 | scope[mode] = (scope[mode] + 1) % ((mode % 3) % 2 == 0 ? 30 : bottom_line); |
||
346 | } |
||
837 | - | 347 | clear(); |
348 | draw_scope(); |
||
349 | _delay_ms(100); |
||
350 | } |
||
351 | } |
||
352 | clear(); |
||
353 | } |
||
354 | |||
355 | /** |
||
471 | cascade | 356 | * a simple config menu tryout |
357 | */ |
||
358 | void config_menu(void) { |
||
359 | // disable interrupts (makes the menu more smoothely) |
||
360 | cli(); |
||
361 | |||
362 | // clear screen |
||
363 | clear(); |
||
364 | |||
365 | uint8_t chosen = 0; |
||
761 | - | 366 | uint8_t inmenu = 1; |
523 | cascade | 367 | write_ascii_string_pgm(6, 1, PSTR("C-OSD Config Menu")); |
471 | cascade | 368 | |
369 | // wait a bit before doing stuff so user has chance to release button |
||
370 | _delay_ms(250); |
||
371 | |||
372 | config_menu_drawings(chosen); |
||
373 | |||
374 | while (inmenu) { |
||
375 | if (s2_pressed()) { |
||
902 | - | 376 | chosen = (chosen + 1) % 19; |
837 | - | 377 | //if (chosen == 12) chosen = 13; // SKIP unused menu space for now |
761 | - | 378 | config_menu_drawings(chosen); |
379 | _delay_ms(500); |
||
471 | cascade | 380 | } else if (s1_pressed()) { |
381 | switch (chosen) { |
||
523 | cascade | 382 | case 0: // NTSC or PAL |
383 | COSD_FLAGS_CONFIG ^= COSD_FLAG_NTSC; |
||
761 | - | 384 | // Setup Video Mode |
385 | if (COSD_FLAGS_CONFIG & COSD_FLAG_NTSC) { |
||
386 | // NTSC + enable display immediately (VM0) |
||
387 | spi_send_byte(0x00, 0b00001000); |
||
474 | cascade | 388 | |
761 | - | 389 | bottom_line = 12; |
390 | } else { |
||
391 | // PAL + enable display immediately (VM0) |
||
392 | spi_send_byte(0x00, 0b01001000); |
||
474 | cascade | 393 | |
761 | - | 394 | bottom_line = 14; |
395 | } |
||
474 | cascade | 396 | break; |
397 | case 1: // full HUD |
||
523 | cascade | 398 | COSD_FLAGS_MODES ^= COSD_FLAG_HUD; |
471 | cascade | 399 | break; |
474 | cascade | 400 | case 2: // art horizon |
523 | cascade | 401 | COSD_FLAGS_MODES ^= COSD_FLAG_ARTHORIZON; |
471 | cascade | 402 | break; |
757 | cascade | 403 | case 3: // aggressiva horizon |
404 | COSD_FLAGS_MODES ^= COSD_FLAG_AGGRHORIZON; |
||
471 | cascade | 405 | break; |
474 | cascade | 406 | case 4: // statistics |
523 | cascade | 407 | COSD_FLAGS_MODES ^= COSD_FLAG_STATS; |
471 | cascade | 408 | break; |
728 | cascade | 409 | case 5: // current by fc |
410 | COSD_FLAGS_MODES ^= COSD_FLAG_FCCURRENT; |
||
471 | cascade | 411 | break; |
902 | - | 412 | case 6: // GPS coordinates while flying |
413 | COSD_FLAGS_CONFIG ^= COSD_FLAG_SHOW_COORDS; |
||
414 | break; |
||
415 | case 7: // 2nd voltage by c-strom |
||
523 | cascade | 416 | COSD_FLAGS_MODES ^= COSD_FLAG_STROMVOLT; |
507 | cascade | 417 | break; |
902 | - | 418 | case 8: // GPS or BARO height |
757 | cascade | 419 | COSD_FLAGS_CONFIG ^= COSD_FLAG_GPSHEIGHT; |
420 | break; |
||
902 | - | 421 | case 9: // Feet and mph? |
757 | cascade | 422 | COSD_FLAGS_CONFIG ^= COSD_FLAG_FEET; |
423 | break; |
||
902 | - | 424 | case 10: // big vario |
757 | cascade | 425 | COSD_FLAGS_MODES ^= COSD_FLAG_BIGVARIO; |
426 | break; |
||
902 | - | 427 | case 11: // big Speed |
428 | COSD_FLAGS_CONFIG ^= COSD_FLAG_BIGSPEED; |
||
429 | break; |
||
430 | case 12: // passive |
||
826 | - | 431 | COSD_FLAGS_CONFIG ^= COSD_FLAG_PASSIVE; |
432 | break; |
||
902 | - | 433 | case 13: // scope |
837 | - | 434 | COSD_FLAGS_CONFIG ^= COSD_FLAG_SHOW_SCOPE; |
435 | break; |
||
902 | - | 436 | case 14: // move scope |
837 | - | 437 | move_scope(); |
438 | break; |
||
902 | - | 439 | case 15: // reset uptime |
471 | cascade | 440 | uptime = 0; |
761 | - | 441 | config_menu_doclick(chosen); |
471 | cascade | 442 | break; |
902 | - | 443 | case 16: // change mode |
761 | - | 444 | #if FCONLY |
445 | COSD_DISPLAYMODE = (COSD_DISPLAYMODE + 1) % (sizeof (fcdisplaymodes) / sizeof (displaymode_t)); |
||
446 | mode = fcdisplaymodes; |
||
447 | mode += COSD_DISPLAYMODE; |
||
448 | osd_fcmode = (int(*)(void)) pgm_read_word(&mode->dfun); |
||
449 | #else |
||
450 | COSD_DISPLAYMODE = (COSD_DISPLAYMODE + 1) % (sizeof (ncdisplaymodes) / sizeof (displaymode_t)); |
||
451 | mode = ncdisplaymodes; |
||
452 | mode += COSD_DISPLAYMODE; |
||
453 | osd_ncmode = (int(*)(void)) pgm_read_word(&mode->dfun); |
||
454 | #endif |
||
471 | cascade | 455 | break; |
902 | - | 456 | case 17: // save |
471 | cascade | 457 | save_eeprom(); |
761 | - | 458 | config_menu_doclick(chosen); |
471 | cascade | 459 | break; |
902 | - | 460 | case 18: // exit |
761 | - | 461 | inmenu = 0; |
462 | config_menu_doclick(chosen); |
||
471 | cascade | 463 | break; |
464 | } |
||
761 | - | 465 | config_menu_drawings(chosen); |
471 | cascade | 466 | _delay_ms(250); |
467 | } |
||
468 | } |
||
469 | |||
470 | // clear screen up again |
||
471 | clear(); |
||
472 | |||
473 | // update flags to paint display again if needed |
||
523 | cascade | 474 | COSD_FLAGS_RUNTIME &= ~COSD_ICONS_WRITTEN; |
471 | cascade | 475 | |
476 | // enable interrupts again |
||
477 | sei(); |
||
478 | } |
||
479 | |||
480 | #endif |