Subversion Repositories Projects

Rev

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

Rev 728 Rev 734
Line 39... Line 39...
39
 
39
 
40
// store more fixed strings in progmen
40
// store more fixed strings in progmen
41
char ON[] PROGMEM = "ON ";
41
char ON[] PROGMEM = "ON ";
Line 42... Line -...
42
char OFF[] PROGMEM = "OFF";
-
 
43
 
-
 
44
// store init strings in progmem
-
 
45
const char init_0[] PROGMEM = "C-OSD Initialisation";
-
 
46
const char init_1[] PROGMEM = "FC only Mode";
-
 
47
const char init_2[] PROGMEM = "NaviCtrl Mode";
-
 
48
const char init_3[] PROGMEM = "Guessing Number of Cells";
-
 
49
const char init_4[] PROGMEM = "Number of Cells:";
-
 
50
const char init_5[] PROGMEM = "Warn Voltage   :";
-
 
51
const char init_6[] PROGMEM = "Max Voltage    :";
-
 
52
const char* init_point[] PROGMEM = {init_0, init_1, init_2, init_3, init_4, init_5, init_6};
42
char OFF[] PROGMEM = "OFF";
53
 
43
 
54
// video modes
44
// video modes
Line 55... Line 45...
55
const char VM_PAL[] PROGMEM = "PAL ";
45
const char VM_PAL[] PROGMEM = "PAL ";
Line 116... Line 106...
116
 * auto config some stuff on startup, currently only battery cells
106
 * auto config some stuff on startup, currently only battery cells
117
 * TODO: this is testing stuff, strings should go progmem and so on...
107
 * TODO: this is testing stuff, strings should go progmem and so on...
118
 */
108
 */
119
void init_cosd(uint8_t UBat) {
109
void init_cosd(uint8_t UBat) {
120
    clear();
110
    clear();
121
        write_ascii_string_pgm(2, 1, init_point[0]); // C-OSD Initialisation
111
        write_ascii_string_pgm(2, 1, PSTR("C-OSD Initialisation")); // C-OSD Initialisation
122
    //write_ascii_string(2, 1, "C-OSD Initialisation");
-
 
123
#if FCONLY
112
#if FCONLY
124
        write_ascii_string_pgm(2, 2, init_point[1]); // FC only mode
113
        write_ascii_string_pgm(2, 2, PSTR("FC only Mode")); // FC only mode
125
    //write_ascii_string(2, 2, "FC only Mode");
-
 
126
#else
114
#else
127
        write_ascii_string_pgm(2, 2, init_point[2]); // NaviCtrl Mode
115
        write_ascii_string_pgm(2, 2, PSTR("NaviCtrl Mode")); // NaviCtrl Mode
128
    //write_ascii_string(2, 2, "NaviCtrl Mode");
-
 
129
#endif
116
#endif
130
    write_ascii_string_pgm(2, 3, PSTR(BUILDDATE));
117
    write_ascii_string_pgm(2, 3, PSTR(BUILDDATE));
131
    uint8_t cellnum = 0;
118
    uint8_t cellnum = 0;
132
    if (CELL_NUM == -1) {
119
    if (CELL_NUM == -1) {
133
                write_ascii_string_pgm(2, 4, init_point[3]); // Guessing Number of Cells
120
                write_ascii_string_pgm(2, 4, PSTR("Guessing Number of Cells")); // Guessing Number of Cells
134
        //write_ascii_string(2, 6, "Guessing Number of Cells");
-
 
135
        do {
121
        do {
136
            cellnum++;
122
            cellnum++;
137
        } while (UBat > ((cellnum * CELL_VOLT_MAX) + 23));
123
        } while (UBat > ((cellnum * CELL_VOLT_MAX) + 23));
138
    } else {
124
    } else {
139
        cellnum = CELL_NUM;
125
        cellnum = CELL_NUM;
140
    }
126
    }
141
    min_voltage = cellnum * CELL_VOLT_MIN;
127
    min_voltage = cellnum * CELL_VOLT_MIN;
142
    max_voltage = cellnum * CELL_VOLT_MAX;
128
    max_voltage = cellnum * CELL_VOLT_MAX;
143
        write_ascii_string_pgm(2, 5, init_point[4]); // Number of Cells
129
        write_ascii_string_pgm(2, 5, PSTR("Number of Cells:")); // Number of Cells
144
    //write_ascii_string(2, 5, "Number of Cells:");
-
 
145
    write_ndigit_number_u(21, 5, cellnum, 1, 0);
130
    write_ndigit_number_u(21, 5, cellnum, 1, 0);
146
        write_ascii_string_pgm(2, 6, init_point[5]); // Warn Voltage
131
        write_ascii_string_pgm(2, 6, PSTR("Warn Voltage   :")); // Warn Voltage
147
    //write_ascii_string(2, 6, "Warn Voltage   :");
-
 
148
    write_ndigit_number_s_10th(20, 6, min_voltage, 3, 0);
132
    write_ndigit_number_s_10th(20, 6, min_voltage, 3, 0);
149
        write_ascii_string_pgm(2, 7, init_point[6]); // Max Voltage
133
        write_ascii_string_pgm(2, 7, PSTR("Max Voltage    :")); // Max Voltage
150
    //write_ascii_string(2, 7, "Max Voltage    :");
-
 
151
    write_ndigit_number_s_10th(20, 7, max_voltage, 3, 0);
134
    write_ndigit_number_s_10th(20, 7, max_voltage, 3, 0);
Line 152... Line 135...
152
 
135
 
Line 153... Line 136...
153
        get_eeprom(1);
136
        get_eeprom(1);
Line 196... Line 179...
196
        osd_ncmode = (int(*)(void)) pgm_read_word(&mode->dfun);
179
        osd_ncmode = (int(*)(void)) pgm_read_word(&mode->dfun);
197
        // re-request OSD Data from NC every 100ms
180
        // re-request OSD Data from NC every 100ms
198
        usart1_request_mk_data(1, 'o', 100);
181
        usart1_request_mk_data(1, 'o', 100);
199
        #endif
182
        #endif
Line 200... Line 183...
200
 
183
 
201
    _delay_ms(2000);
184
    _delay_ms(3000);
202
    clear();
185
    clear();
203
    // update flags to paint display again because of clear
186
    // update flags to paint display again because of clear
204
    COSD_FLAGS_RUNTIME &= ~COSD_ICONS_WRITTEN;
187
    COSD_FLAGS_RUNTIME &= ~COSD_ICONS_WRITTEN;