2013-05-29 17:24:34 +00:00
|
|
|
function tab_initialize_gps () {
|
2013-08-26 13:16:49 +00:00
|
|
|
ga_tracker.sendAppView('GPS Page');
|
2014-02-14 21:17:51 +00:00
|
|
|
GUI.active_tab = 'gps';
|
2014-03-08 05:25:15 +00:00
|
|
|
|
2014-04-11 13:11:59 +00:00
|
|
|
send_message(MSP_codes.MSP_RAW_GPS, false, false, load_html);
|
2014-03-22 23:28:41 +00:00
|
|
|
|
|
|
|
function load_html() {
|
|
|
|
$('#content').load("./tabs/gps.html", process_html);
|
|
|
|
}
|
|
|
|
|
|
|
|
function process_html() {
|
|
|
|
function get_raw_gps_data() {
|
2014-04-11 13:11:59 +00:00
|
|
|
send_message(MSP_codes.MSP_RAW_GPS, false, false, get_gpsvinfo_data);
|
2014-03-22 23:28:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function get_gpsvinfo_data() {
|
2014-04-11 13:11:59 +00:00
|
|
|
send_message(MSP_codes.MSP_GPSSVINFO, false, false, update_ui);
|
2014-03-22 23:28:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function update_ui() {
|
|
|
|
$('.GPS_info td.alt').html(GPS_DATA.alt + ' m');
|
|
|
|
$('.GPS_info td.lat').html((GPS_DATA.lat / 10000000).toFixed(4) + ' deg');
|
|
|
|
$('.GPS_info td.lon').html((GPS_DATA.lon / 10000000).toFixed(4) + ' deg');
|
|
|
|
$('.GPS_info td.speed').html(GPS_DATA.speed + ' cm/s');
|
|
|
|
$('.GPS_info td.sats').html(GPS_DATA.numSat);
|
|
|
|
$('.GPS_info td.distToHome').html(GPS_DATA.distanceToHome + ' m');
|
|
|
|
|
|
|
|
// Update GPS Signal Strengths
|
|
|
|
var e_ss_table = $('div.GPS_signal_strength table tr:not(.titles)');
|
|
|
|
|
|
|
|
for (var i = 0; i < GPS_DATA.chn.length; i++) {
|
|
|
|
var row = e_ss_table.eq(i);
|
|
|
|
|
|
|
|
$('td', row).eq(0).html(GPS_DATA.svid[i]);
|
|
|
|
$('td', row).eq(1).html(GPS_DATA.quality[i]);
|
|
|
|
$('td', row).eq(2).find('progress').val(GPS_DATA.cno[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// enable data pulling
|
2014-03-30 09:51:16 +00:00
|
|
|
GUI.interval_add('gps_pull', get_raw_gps_data, 75, true);
|
|
|
|
|
|
|
|
// status data pulled via separate timer with static speed
|
|
|
|
GUI.interval_add('status_pull', function() {
|
2014-04-11 13:11:59 +00:00
|
|
|
send_message(MSP_codes.MSP_STATUS);
|
2014-03-30 09:51:16 +00:00
|
|
|
}, 250, true);
|
2014-03-22 23:28:41 +00:00
|
|
|
}
|
2013-05-29 17:24:34 +00:00
|
|
|
}
|