Subversion Repositories Projects

Rev

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

Rev 1951 Rev 2039
Line 1... Line 1...
1
/****************************************************************************
1
/****************************************************************************
2
 *   Copyright (C) 2009-2013 by Claas Anders "CaScAdE" Rathje               *
2
 *   Copyright (C) 2009-2014 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 68... Line 68...
68
        } else {
68
        } else {
69
            write_ndigit_number_u(2, top_line, (uint16_t)(((uint32_t)naviData.GroundSpeed * (uint32_t)9) / (uint32_t)250), 3, 0);
69
            write_ndigit_number_u(2, top_line, (uint16_t)(((uint32_t)naviData.GroundSpeed * (uint32_t)9) / (uint32_t)250), 3, 0);
70
70
71
            // draw big speed-meter only if configure AND not flying OR stats off and not flying
71
            // draw big speed-meter only if configure AND not flying OR stats off and not flying
72
            if ((COSD_FLAGS_CONFIG & COSD_FLAG_BIGSPEED)
72
            if ((COSD_FLAGS_CONFIG & COSD_FLAG_BIGSPEED)
73
                && ((naviData.FCFlags & FCFLAG_MOTOR_RUN)
73
                && ((naviData.FCStatusFlags & FCFLAG_MOTOR_RUN)
74
                || !((COSD_FLAGS_RUNTIME & COSD_WASFLYING) && (COSD_FLAGS_MODES & COSD_FLAG_STATS)))) {
74
                || !((COSD_FLAGS_RUNTIME & COSD_WASFLYING) && (COSD_FLAGS_MODES & COSD_FLAG_STATS)))) {
75
75
76
                draw_big_variometer(2, 8, (uint16_t)((uint32_t)naviData.GroundSpeed / (uint32_t)125));
76
                draw_big_variometer(2, 8, (uint16_t)((uint32_t)naviData.GroundSpeed / (uint32_t)125));
77
            }
77
            }
78
        }
78
        }
Line 150... Line 150...
150
            write_ndigit_number_u(23, top_line + 1, naviData.HomePositionDeviation.Distance / 10, 4, 0);
150
            write_ndigit_number_u(23, top_line + 1, naviData.HomePositionDeviation.Distance / 10, 4, 0);
151
        }
151
        }
152
152
153
        // show coords only when configure AND stats are off OR stats are on and motors are off
153
        // show coords only when configure AND stats are off OR stats are on and motors are off
154
        if ((COSD_FLAGS_CONFIG & COSD_FLAG_SHOW_COORDS)
154
        if ((COSD_FLAGS_CONFIG & COSD_FLAG_SHOW_COORDS)
155
            && ((naviData.FCFlags & FCFLAG_MOTOR_RUN)
155
            && ((naviData.FCStatusFlags & FCFLAG_MOTOR_RUN)
156
            || !((COSD_FLAGS_RUNTIME & COSD_WASFLYING) && (COSD_FLAGS_MODES & COSD_FLAG_STATS)))) {
156
            || !((COSD_FLAGS_RUNTIME & COSD_WASFLYING) && (COSD_FLAGS_MODES & COSD_FLAG_STATS)))) {
157
                        uint8_t gps_start_line = bottom_line - 2;
157
                        uint8_t gps_start_line = bottom_line - 2;
158
                        if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) && COSD_FLAGS_MODES & COSD_FLAG_STROMVOLT) {
158
                        if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) && COSD_FLAGS_MODES & COSD_FLAG_STROMVOLT) {
159
                                gps_start_line--;
159
                                gps_start_line--;
160
                        }
160
                        }
161
            write_gps_pos(15, gps_start_line, naviData.CurrentPosition.Longitude);
161
            write_gps_pos(15, gps_start_line, naviData.CurrentPosition.Longitude);
162
            write_gps_pos(15, gps_start_line+1, naviData.CurrentPosition.Latitude);
162
            write_gps_pos(15, gps_start_line+1, naviData.CurrentPosition.Latitude);
163
        }
163
        }
164
164
165
        // center
165
        // center
166
        if (naviData.FCFlags & FCFLAG_MOTOR_RUN) { // should be engines running
166
        if (naviData.FCStatusFlags & FCFLAG_MOTOR_RUN) { // should be engines running
167
            if (!(old_MKFlags & FCFLAG_MOTOR_RUN)) { // motors just started, clear middle
167
            if (!(old_MKFlags & FCFLAG_MOTOR_RUN)) { // motors just started, clear middle
168
                clear();
168
                clear();
169
                // remember current heigth for offsets
169
                // remember current heigth for offsets
170
                if (COSD_FLAGS_CONFIG & COSD_FLAG_GPSHEIGHT) {
170
                if (COSD_FLAGS_CONFIG & COSD_FLAG_GPSHEIGHT) {
171
                    altimeter_offset = naviData.CurrentPosition.Altitude / 1000; // GPS
171
                    altimeter_offset = naviData.CurrentPosition.Altitude / 1000; // GPS
Line 281... Line 281...
281
            write_char_xy(27, bottom_line, 201); // sat2 (free)
281
            write_char_xy(27, bottom_line, 201); // sat2 (free)
282
        }
282
        }
283
283
284
        // after all, draw scope WHEN configured AND flying OR Stats are off
284
        // after all, draw scope WHEN configured AND flying OR Stats are off
285
        if ((COSD_FLAGS_CONFIG & COSD_FLAG_SHOW_SCOPE)
285
        if ((COSD_FLAGS_CONFIG & COSD_FLAG_SHOW_SCOPE)
286
            && ((naviData.FCFlags & FCFLAG_MOTOR_RUN)
286
            && ((naviData.FCStatusFlags & FCFLAG_MOTOR_RUN)
287
            || !((COSD_FLAGS_RUNTIME & COSD_WASFLYING) && (COSD_FLAGS_MODES & COSD_FLAG_STATS)))) {
287
            || !((COSD_FLAGS_RUNTIME & COSD_WASFLYING) && (COSD_FLAGS_MODES & COSD_FLAG_STATS)))) {
288
            draw_scope();
288
            draw_scope();
289
        }
289
        }
290
    }
290
    }
291
291
292
    //write_number_s(8, 5, RxDataLen);
292
    //write_number_s(8, 5, RxDataLen);
293
    //write_number_s(16, 5, setsReceived++);
293
    //write_number_s(16, 5, setsReceived++);
294
294
295
    // remember statistics (only when engines running)
295
    // remember statistics (only when engines running)
296
    if (naviData.FCFlags & FCFLAG_MOTOR_RUN) {
296
    if (naviData.FCStatusFlags & FCFLAG_MOTOR_RUN) {
297
        if (COSD_FLAGS_CONFIG & COSD_FLAG_GPSHEIGHT) {
297
        if (COSD_FLAGS_CONFIG & COSD_FLAG_GPSHEIGHT) {
298
            if (naviData.CurrentPosition.Altitude / 1000 - altimeter_offset > max_Altimeter) max_Altimeter = naviData.CurrentPosition.Altitude / 1000;
298
            if (naviData.CurrentPosition.Altitude / 1000 - altimeter_offset > max_Altimeter) max_Altimeter = naviData.CurrentPosition.Altitude / 1000;
299
        } else {
299
        } else {
300
            if (naviData.Altimeter / 20 > max_Altimeter) max_Altimeter = naviData.Altimeter / 20;
300
            if (naviData.Altimeter / 20 > max_Altimeter) max_Altimeter = naviData.Altimeter / 20;
301
        }
301
        }
Line 313... Line 313...
313
    }
313
    }
314
314
315
    // remember last values
315
    // remember last values
316
    last_RC_Quality = naviData.RC_Quality;
316
    last_RC_Quality = naviData.RC_Quality;
317
    last_UBat = naviData.UBat;
317
    last_UBat = naviData.UBat;
318
    old_MKFlags = naviData.FCFlags;
318
    old_MKFlags = naviData.FCStatusFlags;
319
    old_NCFlags = naviData.NCFlags;
319
    old_NCFlags = naviData.NCFlags;
320
    seconds_since_last_data = 0;
320
    seconds_since_last_data = 0;
321
321
322
    return 0;
322
    return 0;
323
}
323
}