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