Subversion Repositories Projects

Rev

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

Rev 2099 Rev 2225
Line 1... Line 1...
1
/****************************************************************************
1
/****************************************************************************
2
 *   Copyright (C) 2009-2015 by Claas Anders "CaScAdE" Rathje               *
2
 *   Copyright (C) 2009-2016 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 118... Line 118...
118
                    write_ndigit_number_s_10th(23, top_line, (int16_t)(naviData.CurrentPosition.Altitude / 100 - altimeter_offset * 10), 3, 0); // GPS
118
                    write_ndigit_number_s_10th(23, top_line, (int16_t)(naviData.CurrentPosition.Altitude / 100 - altimeter_offset * 10), 3, 0); // GPS
119
                }
119
                }
120
            }
120
            }
121
        } else {
121
        } else {
122
            if (COSD_FLAGS_CONFIG & COSD_FLAG_FEET) {
122
            if (COSD_FLAGS_CONFIG & COSD_FLAG_FEET) {
123
                write_ndigit_number_s(23, top_line, naviData.Altimeter / 10 * 32 / 20, 4, 0); // BARO
123
                write_ndigit_number_s(23, top_line, naviData.Altimeter_5cm / 10 * 32 / 20, 4, 0); // BARO
124
            } else {
124
            } else {
125
                //cite:killagreg "Faktor 20 bis 21 w�re korrekt." (http://forum.mikrokopter.de/topic-post211192.html#post211192)
125
                //cite:killagreg "Faktor 20 bis 21 w�re korrekt." (http://forum.mikrokopter.de/topic-post211192.html#post211192)
126
                if (naviData.Altimeter > 200 || naviData.Altimeter < -200) {
126
                if (naviData.Altimeter_5cm > 200 || naviData.Altimeter_5cm < -200) {
127
                    // above 10m only write full meters
127
                    // above 10m only write full meters
128
                    write_ndigit_number_s(23, top_line, naviData.Altimeter / 20, 4, 0); // BARO
128
                    write_ndigit_number_s(23, top_line, naviData.Altimeter_5cm / 20, 4, 0); // BARO
129
                } else {
129
                } else {
130
                    // up to 10m write meters.dm
130
                    // up to 10m write meters.dm
131
                    write_ndigit_number_s_10th(23, top_line, naviData.Altimeter / 2, 3, 0); // BARO
131
                    write_ndigit_number_s_10th(23, top_line, naviData.Altimeter_5cm / 2, 3, 0); // BARO
132
                }
132
                }
133
            }
133
            }
134
        }
134
        }
135
 
135
 
136
 
136
 
Line 168... Line 168...
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
172
                } else {
172
                } else {
173
                    altimeter_offset = naviData.Altimeter / 20; // BARO
173
                    altimeter_offset = naviData.Altimeter_5cm / 20; // BARO
174
                }
174
                }
175
                // set wasted counter to current offset
175
                // set wasted counter to current offset
176
                if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) && !(COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) {
176
                if ((COSD_FLAGS_RUNTIME & COSD_FLAG_STROMREC) && !(COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT)) {
177
                    wasted_ampere_offset = ampere_wasted / 10;
177
                    wasted_ampere_offset = ampere_wasted / 10;
178
                } else if (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT) {
178
                } else if (COSD_FLAGS_MODES & COSD_FLAG_FCCURRENT) {
Line 295... Line 295...
295
    // remember statistics (only when engines running)
295
    // remember statistics (only when engines running)
296
    if (naviData.FCStatusFlags & 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_5cm / 20 > max_Altimeter) max_Altimeter = naviData.Altimeter_5cm / 20;
301
        }
301
        }
302
        if (naviData.GroundSpeed > max_GroundSpeed) max_GroundSpeed = naviData.GroundSpeed;
302
        if (naviData.GroundSpeed > max_GroundSpeed) max_GroundSpeed = naviData.GroundSpeed;
303
        if (naviData.HomePositionDeviation.Distance > max_Distance) {
303
        if (naviData.HomePositionDeviation.Distance > max_Distance) {
304
            max_Distance = naviData.HomePositionDeviation.Distance;
304
            max_Distance = naviData.HomePositionDeviation.Distance;
305
        }
305
        }