2 * This file is part of Betaflight.
4 * Betaflight is free software. You can redistribute this software
5 * and/or modify this software under the terms of the GNU General
6 * Public License as published by the Free Software Foundation,
7 * either version 3 of the License, or (at your option) any later
10 * Betaflight is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 * See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public
17 * License along with this software.
19 * If not, see <http://www.gnu.org/licenses/>.
27 #ifdef USE_VIRTUAL_GPS
29 #include "io/gps_virtual.h"
31 static gpsSolutionData_t gpsVirtualData
;
33 void setVirtualGPS(double latitude
, double longitude
, double altiutude
, double speed
, double speed3D
, double course
)
35 gpsVirtualData
.numSat
= 12; // satellites_in_view
36 gpsVirtualData
.acc
.hAcc
= 500; // horizontal_pos_accuracy - convert cm to mm
37 gpsVirtualData
.acc
.vAcc
= 500; // vertical_pos_accuracy - convert cm to mm
38 gpsVirtualData
.acc
.sAcc
= 400; // horizontal_vel_accuracy - convert cm to mm
39 gpsVirtualData
.dop
.pdop
= 10; // hdop in 4.4 and earlier, pdop in 4.5 and above
40 gpsVirtualData
.llh
.lon
= (int32_t)(longitude
* GPS_DEGREES_DIVIDER
);
41 gpsVirtualData
.llh
.lat
= (int32_t)(latitude
* GPS_DEGREES_DIVIDER
);
42 gpsVirtualData
.llh
.altCm
= (int32_t)(altiutude
* 100.0); // alt, cm
43 gpsVirtualData
.groundSpeed
= (uint16_t)(speed
* 100.0); // cm/sec
44 gpsVirtualData
.speed3d
= (uint16_t)(speed3D
* 100.0); // cm/sec
45 gpsVirtualData
.groundCourse
= (uint16_t)(course
* 10.0); // decidegrees
48 void getVirtualGPS(gpsSolutionData_t
*gpsSolData
)
50 *gpsSolData
= gpsVirtualData
;