Subversion Repositories Projects

Rev

Rev 932 | Rev 1281 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 932 Rev 1197
Line 30... Line 30...
30
#include "usart1.h"
30
#include "usart1.h"
31
#include "osd_helpers.h"
31
#include "osd_helpers.h"
32
 
32
 
33
#if !(ALLCHARSDEBUG|(WRITECHARS != -1))
33
#if !(ALLCHARSDEBUG|(WRITECHARS != -1))
34
 
34
 
-
 
35
// EEPROM bytes
35
uint8_t EEMEM ee_checkbyte1 = CHECKBYTE1;
36
uint8_t EEMEM ee_checkbyte1 = CHECKBYTE1;
36
uint8_t EEMEM ee_checkbyte2 = CHECKBYTE2;
37
uint8_t EEMEM ee_checkbyte2 = CHECKBYTE2;
37
uint8_t EEMEM ee_COSD_FLAGS_MODES = 0;
38
uint8_t EEMEM ee_COSD_FLAGS_MODES = 0;
38
uint8_t EEMEM ee_COSD_FLAGS_CONFIG = 0;
39
uint8_t EEMEM ee_COSD_FLAGS_CONFIG = 0;
39
uint8_t EEMEM ee_COSD_DISPLAYMODE = 0;
40
uint8_t EEMEM ee_COSD_DISPLAYMODE = 0;
Line 48... Line 49...
48
const char VM_PAL[] PROGMEM = "PAL ";
49
const char VM_PAL[] PROGMEM = "PAL ";
49
const char VM_NTSC[] PROGMEM = "NTSC";
50
const char VM_NTSC[] PROGMEM = "NTSC";
50
 
51
 
51
const displaymode_t * mode;
52
const displaymode_t * mode;
52
 
53
 
53
const char ee_message0[] PROGMEM = "Loading from EEPROM";
-
 
54
const char ee_message1[] PROGMEM = "No Data in EEPROM";
-
 
55
const char* ee_msg[] PROGMEM = {ee_message0, ee_message1};
-
 
56
 
54
 
57
/**
55
/**
58
 * read data saved in eeprom, print out message if <verbose> is set
56
 * read data saved in eeprom, print out message if <verbose> is set
59
 */
57
 */
60
void get_eeprom(uint8_t verbose) {
58
void get_eeprom(uint8_t verbose) {
61
    if (eeprom_read_byte(&ee_checkbyte1) == CHECKBYTE1 && eeprom_read_byte(&ee_checkbyte2) == CHECKBYTE2) {
59
    if (eeprom_read_byte(&ee_checkbyte1) == CHECKBYTE1 && eeprom_read_byte(&ee_checkbyte2) == CHECKBYTE2) {
62
        if (verbose) write_ascii_string_pgm(2, 2, ee_msg[0]); // Loading data
60
        if (verbose) write_ascii_string_pgm(2, 2, PSTR("Loading from EEPROM")); // Loading data
63
        COSD_FLAGS_MODES = eeprom_read_byte(&ee_COSD_FLAGS_MODES);
61
        COSD_FLAGS_MODES = eeprom_read_byte(&ee_COSD_FLAGS_MODES);
64
        COSD_FLAGS_CONFIG = eeprom_read_byte(&ee_COSD_FLAGS_CONFIG);
62
        COSD_FLAGS_CONFIG = eeprom_read_byte(&ee_COSD_FLAGS_CONFIG);
65
        COSD_DISPLAYMODE = eeprom_read_byte(&ee_COSD_DISPLAYMODE);
63
        COSD_DISPLAYMODE = eeprom_read_byte(&ee_COSD_DISPLAYMODE);
66
        //if (verbose) write_ndigit_number_u(23, 11, COSD_DISPLAYMODE, 2, 0);
64
        //if (verbose) write_ndigit_number_u(23, 11, COSD_DISPLAYMODE, 2, 0);
67
        for (int i = 0; i < 12; i++) {
65
        for (int i = 0; i < 12; i++) {
68
            scope[i] = eeprom_read_byte(&ee_COSD_SCOPE[i]);
66
            scope[i] = eeprom_read_byte(&ee_COSD_SCOPE[i]);
69
        }
67
        }
70
    } else {
68
    } else {
71
        if (verbose) write_ascii_string_pgm(2, 2, ee_msg[1]); // Loading data
69
        if (verbose) write_ascii_string_pgm(2, 2, PSTR("No Data in EEPROM")); // Loading data
72
    }
70
    }
73
}
71
}
74
 
72
 
75
/**
73
/**
76
 * save data to eeprom
74
 * save data to eeprom