Subversion Repositories Projects

Rev

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

Rev 837 Rev 902
Line 1... Line 1...
1
/****************************************************************************
1
/****************************************************************************
2
 *   Copyright (C) 2009-2010 by Claas Anders "CaScAdE" Rathje               *
2
 *   Copyright (C) 2009-2011 by Claas Anders "CaScAdE" Rathje               *
3
 *   admiralcascade@gmail.com                                               *
3
 *   admiralcascade@gmail.com                                               *
4
 *   Project-URL: http://www.mylifesucks.de/oss/c-osd/                      *
4
 *   Project-URL: http://www.mylifesucks.de/oss/c-osd/                      *
5
 *                                                                          *
5
 *                                                                          *
6
 *   This program is free software; you can redistribute it and/or modify   *
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   *
7
 *   it under the terms of the GNU General Public License as published by   *
Line 67... Line 67...
67
        if (COSD_FLAGS_CONFIG & COSD_FLAG_FEET) {
67
        if (COSD_FLAGS_CONFIG & COSD_FLAG_FEET) {
68
            // experimental cm/s -> mph
68
            // experimental cm/s -> mph
69
            write_ndigit_number_u(2, top_line, (uint16_t)(((uint32_t)naviData.GroundSpeed * (uint32_t)279) / (uint32_t)12500), 3, 0);
69
            write_ndigit_number_u(2, top_line, (uint16_t)(((uint32_t)naviData.GroundSpeed * (uint32_t)279) / (uint32_t)12500), 3, 0);
70
        } else {
70
        } else {
71
            write_ndigit_number_u(2, top_line, (uint16_t)(((uint32_t)naviData.GroundSpeed * (uint32_t)9) / (uint32_t)250), 3, 0);
71
            write_ndigit_number_u(2, top_line, (uint16_t)(((uint32_t)naviData.GroundSpeed * (uint32_t)9) / (uint32_t)250), 3, 0);
-
 
72
 
-
 
73
            // draw big speed-meter only if configure AND not flying OR stats off and not flying
-
 
74
            if ((COSD_FLAGS_CONFIG & COSD_FLAG_BIGSPEED)
-
 
75
                && ((naviData.FCFlags & FCFLAG_MOTOR_RUN)
-
 
76
                || !((COSD_FLAGS_RUNTIME & COSD_WASFLYING) && (COSD_FLAGS_MODES & COSD_FLAG_STATS)))) {
-
 
77
 
-
 
78
                draw_big_variometer(2, 8, (uint16_t)((uint32_t)naviData.GroundSpeed / (uint32_t)125));
-
 
79
            }
72
        }
80
        }
73
 
81
 
74
        write_ndigit_number_u(7, top_line, rc_signal, 3, 0);
82
        write_ndigit_number_u(7, top_line, rc_signal, 3, 0);
75
        if (rc_signal <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) {
83
        if (rc_signal <= RCLVL_WRN && last_RC_Quality > RCLVL_WRN) {
76
            for (uint8_t x = 0; x < 4; x++)
84
            for (uint8_t x = 0; x < 4; x++)
Line 176... Line 184...
176
                // update flags to paint display again if needed
184
                // update flags to paint display again if needed
177
                COSD_FLAGS_RUNTIME &= ~COSD_ICONS_WRITTEN;
185
                COSD_FLAGS_RUNTIME &= ~COSD_ICONS_WRITTEN;
178
            }
186
            }
179
            // stats
187
            // stats
180
            if ((COSD_FLAGS_RUNTIME & COSD_WASFLYING) && (COSD_FLAGS_MODES & COSD_FLAG_STATS)) {
188
            if ((COSD_FLAGS_RUNTIME & COSD_WASFLYING) && (COSD_FLAGS_MODES & COSD_FLAG_STATS)) {
181
                uint8_t line = 3;
-
 
182
                write_ascii_string_pgm(1, line, (const char *)(pgm_read_word(&(stats_item_pointers[0])))); // max Altitude
-
 
183
                write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[1])))); // max Speed
-
 
184
                write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[2])))); // max Distance
-
 
185
 
-
 
186
                if (COSD_FLAGS_CONFIG & COSD_FLAG_FEET) {
-
 
187
                    write_ndigit_number_s(16, line - 2, max_Altimeter * 32 / 10, 4, 0);
-
 
188
                    write_char_xy(20, line - 2, 0x7E); // small feet ft
-
 
189
                    write_ndigit_number_u(17, line - 1, (uint16_t)(((uint32_t)max_GroundSpeed * (uint32_t)279) / (uint32_t)12500), 3, 0);
-
 
190
                    write_char_xy(20, line - 1, 0x7D); // mp/h
-
 
191
                    write_ndigit_number_u(16, line - 0, max_Distance / 10 * 32 / 10, 4, 0);
-
 
192
                    write_char_xy(20, line - 0, 0x7E); // small feet ft
-
 
193
                } else {
189
                draw_stats();
194
                    write_ndigit_number_s(16, line - 2, max_Altimeter, 4, 0);
-
 
195
                    write_char_xy(20, line - 2, 204); // small meters m
-
 
196
                    write_ndigit_number_u(17, line - 1, (uint16_t)(((uint32_t)max_GroundSpeed * (uint32_t)9) / (uint32_t)250), 3, 0);
-
 
197
                    write_char_xy(20, line - 1, 203); // km/h
-
 
198
                    write_ndigit_number_u(16, line - 0, max_Distance / 10, 4, 0);
-
 
199
                    write_char_xy(20, line - 0, 204); // small meters m
-
 
200
                }
-
 
201
 
-
 
202
                write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[3])))); // min voltage
-
 
203
                write_ndigit_number_u_10th(16, line, min_UBat, 3, 0);
-
 
204
                write_char_xy(20, line, 0x9E); // small V
-
 
205
                if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) || (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) {
-
 
206
                    write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[7])))); // ampere
-
 
207
                    write_ndigit_number_u_10th(16, line, max_ampere / 10, 3, 0);
-
 
208
                    write_char_xy(20, line, 0x9F); // small A
-
 
209
 
-
 
210
                    // wasted mampere in this flight (will count up after landing)
-
 
211
                    if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) && !(COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) {
-
 
212
                        write_ndigit_number_u(21, line, (ampere_wasted / 10) - wasted_ampere_offset, 5, 0);
-
 
213
                    } else if (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT) {
-
 
214
 
-
 
215
                        write_ndigit_number_u(21, line, naviData.UsedCapacity - wasted_ampere_offset, 5, 0);
-
 
216
                    }
-
 
217
 
-
 
218
                    write_char_xy(26, line, 0xB5); // mah
-
 
219
                }
-
 
220
                write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[4])))); // max time
-
 
221
                write_time(14, line, max_FlyingTime);
-
 
222
                write_char_xy(20, line, 210); // fly clock
-
 
223
                write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[5])))); // longitude
-
 
224
                write_gps_pos(14, line, naviData.CurrentPosition.Longitude);
-
 
225
                write_ascii_string_pgm(1, ++line, (const char *)(pgm_read_word(&(stats_item_pointers[6])))); // latitude
-
 
226
                write_gps_pos(14, line, naviData.CurrentPosition.Latitude);
-
 
227
            } else if (COSD_FLAGS_MODES & COSD_FLAG_ARTHORIZON) { // if no stats there is space horizon
190
            } else if (COSD_FLAGS_MODES & COSD_FLAG_ARTHORIZON) { // if no stats there is space horizon
228
                uint8_t horizon_bottom = bottom_line - 1;
191
                uint8_t horizon_bottom = bottom_line - 1;
229
                if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) || (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) {
192
                if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) || (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) {
230
                    horizon_bottom--;
193
                    horizon_bottom--;
231
                }
194
                }
Line 234... Line 197...
234
                } else {
197
                } else {
235
                    draw_artificial_horizon(top_line + 2, horizon_bottom, naviData.AngleNick, naviData.AngleRoll);
198
                    draw_artificial_horizon(top_line + 2, horizon_bottom, naviData.AngleNick, naviData.AngleRoll);
236
                }
199
                }
237
            }
200
            }
238
        }
201
        }
-
 
202
 
-
 
203
        // show coords only when configure AND stats are off OR stats are on and motors are off
-
 
204
        if ((COSD_FLAGS_CONFIG & COSD_FLAG_SHOW_COORDS)
-
 
205
            && ((naviData.FCFlags & FCFLAG_MOTOR_RUN)
-
 
206
            || !((COSD_FLAGS_RUNTIME & COSD_WASFLYING) && (COSD_FLAGS_MODES & COSD_FLAG_STATS)))) {
-
 
207
            write_gps_pos(15, bottom_line - 2, naviData.CurrentPosition.Longitude);
-
 
208
            write_gps_pos(15, bottom_line - 1, naviData.CurrentPosition.Latitude);
-
 
209
        }
-
 
210
 
239
        if (COSD_FLAGS_MODES & COSD_FLAG_BIGVARIO) {
211
        if (COSD_FLAGS_MODES & COSD_FLAG_BIGVARIO) {
240
            draw_big_variometer(27, 8, naviData.Variometer);
212
            draw_big_variometer(27, 8, naviData.Variometer);
241
        }
213
        }
242
 
214
 
243
        // pre-bottom line
215
        // pre-bottom line
Line 291... Line 263...
291
            write_char_xy(27, bottom_line, 230); // gps ph
263
            write_char_xy(27, bottom_line, 230); // gps ph
292
        } else { // (naviData.NCFlags & NC_FLAG_FREE)
264
        } else { // (naviData.NCFlags & NC_FLAG_FREE)
293
            write_char_xy(27, bottom_line, 201); // sat2 (free)
265
            write_char_xy(27, bottom_line, 201); // sat2 (free)
294
        }
266
        }
295
 
267
 
296
 
-
 
297
        // after all, draw scope
268
        // after all, draw scope WHEN configured AND flying OR Stats are off
298
        if (COSD_FLAGS_CONFIG & COSD_FLAG_SHOW_SCOPE) {
269
        if ((COSD_FLAGS_CONFIG & COSD_FLAG_SHOW_SCOPE)
-
 
270
            && ((naviData.FCFlags & FCFLAG_MOTOR_RUN)
-
 
271
            || !((COSD_FLAGS_RUNTIME & COSD_WASFLYING) && (COSD_FLAGS_MODES & COSD_FLAG_STATS)))) {
299
            draw_scope();
272
            draw_scope();
300
        }
273
        }
301
    }
274
    }
302
 
275
 
303
    //write_number_s(8, 5, RxDataLen);
276
    //write_number_s(8, 5, RxDataLen);