Subversion Repositories Projects

Rev

Rev 1437 | Rev 1801 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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