Skip to content

Commit

Permalink
Add VFC support for GPS tab
Browse files Browse the repository at this point in the history
  • Loading branch information
atomgomba committed Feb 23, 2023
1 parent 62f5cec commit 139aee2
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
32 changes: 31 additions & 1 deletion src/js/VirtualFC.js
Expand Up @@ -180,8 +180,20 @@ const VirtualFC = {

// 11 1111 (pass bitchecks)
virtualFC.CONFIG.activeSensors = 63;

virtualFC.GPS_CONFIG = {
provider: 1,
ublox_sbas: 1,
auto_config: 1,
auto_baud: 0,
home_point_once: 1,
ublox_use_galileo: 1,
};

virtualFC.GPS_DATA = SampleGpsData;
},
setupVirtualOSD(){

setupVirtualOSD() {
const virtualOSD = OSD;

virtualOSD.data.video_system = 1;
Expand Down Expand Up @@ -221,4 +233,22 @@ const VirtualFC = {
},
};

const SampleGpsData = {
"fix": 2,
"numSat": 10,
"lat": 474919409,
"lon": 190539766,
"alt": 0,
"speed": 0,
"ground_course": 1337,
"distanceToHome": 0,
"ditectionToHome": 0,
"update": 0,
"chn": [0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 6, 6, 6, 6, 6, 6, 6, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255],
"svid": [1, 2, 10, 15, 18, 23, 26, 123, 136, 1, 15, 2, 3, 4, 9, 10, 16, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"quality": [3, 95, 95, 95, 95, 95, 95, 23, 23, 1, 31, 20, 31, 23, 20, 17, 31, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"cno": [27, 37, 43, 37, 34, 47, 44, 42, 39, 0, 40, 24, 40, 35, 26, 0, 35, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"directionToHome": 0,
};

export default VirtualFC;
8 changes: 6 additions & 2 deletions src/js/tabs/gps.js
Expand Up @@ -271,15 +271,19 @@ gps.initialize = async function (callback) {

if (FC.GPS_DATA.fix) {
gpsWasFixed = true;
frame.contentWindow.postMessage(message, '*');
if (!!frame.contentWindow) {
frame.contentWindow.postMessage(message, '*');
}
$('#loadmap').show();
$('#waiting').hide();
} else if (!gpsWasFixed) {
$('#loadmap').hide();
$('#waiting').show();
} else {
message.action = 'nofix';
frame.contentWindow.postMessage(message, '*');
if (!!frame.contentWindow) {
frame.contentWindow.postMessage(message, '*');
}
}
} else {
gpsWasFixed = false;
Expand Down

0 comments on commit 139aee2

Please sign in to comment.