1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-17 13:25:24 +03:00

First rework of Configuration Tab

… also minor fixes to switchery buttons
This commit is contained in:
skaman82 2015-10-30 09:46:53 +01:00
parent b93349b14f
commit 54d7c24e82
14 changed files with 622 additions and 151 deletions

View file

@ -9,14 +9,14 @@
.switchery {
background-color: #fff;
border: 2px solid #fff;
border: 1px solid #fff;
border-radius: 20px;
cursor: pointer;
display: inline-block;
height: 16px;
position: relative;
vertical-align: middle;
width: 42px;
width: 45px;
-moz-user-select: none;
-khtml-user-select: none;

View file

@ -123,13 +123,39 @@ $(document).ready(function () {
}
chrome.storage.local.set({'auto_connect': GUI.auto_connect});
});
/** toggle switch **/
var elems = Array.prototype.slice.call(document.querySelectorAll('#togglesmall'));
elems.forEach(function(html) {
var switchery = new Switchery(html,
{
size: 'small',
color: '#59aa29',
secondaryColor: '#c4c4c4'
});
});
/** toggle switch END **/
});
PortHandler.initialize();
PortUsage.initialize();
});
function onOpen(openInfo) {
if (openInfo) {
// update connected_to
@ -394,4 +420,6 @@ function bit_set(num, bit) {
function bit_clear(num, bit) {
return num & ~(1 << bit);
}
}

View file

@ -64,7 +64,7 @@ a:hover {
.cf_doc_version_bt a {
padding:1px 9px 1px 9px;
margin-top: -25px;
margin-top: -45px;
background-color:#59aa29;
border-radius:3px;
border: 1px solid #4c8829;
@ -1098,7 +1098,8 @@ dialog {
}
.grey {
background-color:#f5f5f5;
/* background-color:#f5f5f5; */
background-color:#f9f9f9
}

View file

@ -36,6 +36,7 @@
<link type="text/css" rel="stylesheet" href="./styles/dropdown-lists/css/style_lists.css" media="all" />
<link type="text/css" rel="stylesheet" href="./js/libraries/switchery/dist/switchery.css" media="all" />
<script type="text/javascript" src="./js/libraries/q.js"></script>
<script type="text/javascript" src="./js/libraries/google-analytics-bundle.js"></script>

24
main.js
View file

@ -211,7 +211,7 @@ $(document).ready(function () {
googleAnalyticsConfig.setTrackingPermitted(check);
});
// TEST
// CSS TEST
var css = $("#default");
$("div#options-window #remove").click(function(){
css.remove();
@ -220,7 +220,7 @@ $("div#options-window #remove").click(function(){
$("div#options-window #restore").click(function(){
$("head").append(css);
});
// TEST
// CSS TEST END
function close_and_cleanup(e) {
@ -401,23 +401,3 @@ $("#showlog").on('click', function() {
/** toggle switch **/
$(document).ready(function () {
var elems = Array.prototype.slice.call(document.querySelectorAll('#togglesmall'));
elems.forEach(function(html) {
var switchery = new Switchery(html,
{
size: 'small',
color: '#59aa29',
secondaryColor: '#c4c4c4'
});
});
});

View file

@ -1,30 +1,47 @@
.tab-configuration .help {
padding: 0px;
background-color: #ffcb18;
margin-bottom: 00px;
}
.tab-configuration table {
margin-bottom: 10px;
width:100%;
float:left;
border-collapse: collapse;
}
.tab-configuration table,
.tab-configuration table th,
.tab-configuration table td {
padding: 4px;
border: 1px solid #8b8b8b;
}
.tab-configuration table tr td:first-child {
text-align: center;
}
.tab-configuration table td {
padding: 2px 10px;
padding: 0px;
padding-left:0px;
text-align:left;
}
.tab-configuration table thead tr:first-child,
.tab-configuration table tr:nth-child(even) {
.tab-configuration table th {
padding-left:3px;
padding: 3px;
border-bottom: 1px solid #ddd;
}
.tab-configuration table td {
padding-left:5px;
border-bottom: 1px solid #ddd;
}
.tab-configuration table tr td:first-child {
text-align: left;
width:50px;
}
.tab-configuration table td {
padding: 5px 3px;
}
.tab-configuration table thead tr:first-child {
background-color: #ececec;
}
@ -41,15 +58,13 @@
}
.tab-configuration .leftWrapper {
float: left;
width: 50%;
margin: 0 0 10px 0;
width: calc(50% - 20px);
0 10px 20px 0px
}
.tab-configuration .rightWrapper {
float: left;
width: calc(50% - 10px);
margin: 0 0 10px 10px;
width: calc(50% - 0px);
margin: 0 0 10px 20px;
}
.tab-configuration .mixerPreview {
width: 180px;
@ -91,24 +106,23 @@
clear: left;
}
.tab-configuration .number input {
width: 60px;
width: 48px;
height: 20px;
line-height: 20px;
text-align: right;
border: 1px solid silver;
border-radius:3px;
margin-right:11px;
}
.tab-configuration .number input.disabled {
width: 50px;
width: 48px;
padding: 0px 5px;
background-color: #ececec;
}
.tab-configuration .number span {
margin-left: 10px;
line-height: 20px;
margin-left: 0px;
}
.tab-configuration .gps .line {
clear: left;
@ -127,7 +141,7 @@
line-height: 20px;
}
.tab-configuration .serialRX {
width: 160px;
width: 100%;
border: 1px solid silver;
margin-bottom: 5px;
@ -140,26 +154,25 @@
width: 60px;
}
.tab-configuration .current .checkbox div input {
display: block;
margin: 2px auto 0 auto;
display: ;
margin: 0px;
}
.tab-configuration .current .checkbox span {
margin-left: 15px;
margin-left: 0px;
}
.tab-configuration .disarm .checkbox {
margin-top: 2px;
}
.tab-configuration .disarm .checkbox div {
float: left;
width: 60px;
margin-bottom: 5px;
margin-bottom: 0px;
margin-top: 0px;
}
.tab-configuration .disarm .checkbox div input {
display: block;
margin: 2px auto 0 auto;
display:;
margin:0px;
}
.tab-configuration .disarm .checkbox span {
margin-left: 15px;
margin-left: 0px;
}
.tab-configuration .save {
display: block;
@ -181,3 +194,75 @@
}
.tab-configuration .freelabel {
margin-left:10px;
position:relative;
}
.tab-configuration input {
float:left;
}
.tab-configuration span {
margin:0px
}
.tab-configuration .disarm .checkbox {
float:left;
padding-left:3px;
margin-top: -5px;
padding-bottom:5px;
border-bottom: 1px solid #ddd;
width:100%;
}
.tab-configuration .spacer_box {
padding-bottom 10px;
float: left;
width: calc(100% - 20px);
}
.tab-configuration .number {
padding-bottom:5px;
border-bottom: 1px solid #ddd;
width:100%;
float: left;
}
.tab-configuration .disarm {
margin-bottom:5px;
float:left;
border-bottom: 1px solid #ddd;
width:100%;
}
.disarmdelay { margin-top: 5px; float:left; width:100%; border-bottom: 1px solid #ddd;
}
.tab-configuration .number:last-child {
border-bottom:none;
padding-bottom:0px;
}
.tab-configuration .gui_box_titlebar {
margin-bottom: 0px; }
.tab-configuration .numberspacer {
float:left; width:60px; height:20px;}
.tab-configuration thead {
display:none;
}
.tab-configuration .gui_box {
margin-bottom:10px;
}

View file

@ -1,12 +1,23 @@
<div class="tab-configuration">
<div class="help">
<p i18n="configurationFeaturesHelp"></p>
</div>
<div class="tab_title" i18n="tabConfiguration">Configuration</div>
<div class="cf_doc_version_bt">
<a id="button-documentation" href="https://github.com/cleanflight/cleanflight/releases" target="_blank"></a></div>
<div class="note" style="margin-bottom:20px;">
<div class="note_spacer"><p i18n="configurationFeaturesHelp"></p></div>
</div>
<div class="leftWrapper">
<div class="groupTitle" i18n="configurationMixer"></div>
<div class="gui_box grey" style="min-height:288px;">
<div class="gui_box_titlebar"><div class="spacer_box_title" i18n="configurationMixer"></div>
<div class="helpicon"></div></div><div class="spacer_box">
<div class="mixerPreview">
<img src="./resources/motor_order/custom.svg" />
</div>
@ -14,14 +25,25 @@
<!-- list generated here -->
</select>
</div>
</div></div>
<div class="rightWrapper">
<div class="groupTitle" i18n="configurationEscFeatures"></div>
<table>
<thead>
<div class="gui_box grey">
<div class="gui_box_titlebar"><div class="spacer_box_title" i18n="configurationEscFeatures"></div>
<div class="helpicon"></div></div><div class="spacer_box">
<table cellpadding="0" cellspacing="0">
<thead style="display:none;">
<tr>
<th i18n="configurationFeatureEnabled"></th>
<th i18n="configurationFeatureName"></th>
<th i18n="configurationFeatureDescription"></th>
<th i18n="configurationFeatureName"></th>
</tr>
</thead>
<tbody class="features esc">
@ -30,50 +52,65 @@
</table>
<!-- -->
<div class="disarm">
<div class="number disarmdelay" style="display: none;">
<label>
<input type="number" name="autodisarmdelay" min="0" max="60" />
<div class="checkbox">
<label><div style="float:left; width:57px; height:20px;">
<input type="checkbox" name="disarmkillswitch" id="toggle"/></div>
<div class="freelabel" i18n="configurationDisarmKillSwitch"></div>
</label>
</div>
<div class="number disarmdelay" style="display:none;">
<label><div class="numberspacer">
<input type="number" name="autodisarmdelay" min="0" max="60" /></div>
<span i18n="configurationAutoDisarmDelay"></span>
</label>
</div>
<div class="checkbox">
<label>
<div>
<input type="checkbox" name="disarmkillswitch" />
</div>
<span i18n="configurationDisarmKillSwitch"></span>
</label>
</div>
</div>
<!-- -->
<div class="number">
<label>
<label><div class="numberspacer">
<input type="number" name="minthrottle" min="0" max="2000" />
<span i18n="configurationThrottleMinimum"></span>
</div> <span i18n="configurationThrottleMinimum"></span>
</label>
</div>
<div class="number">
<label>
<label><div class="numberspacer">
<input type="number" name="midthrottle" min="0" max="2000" />
<span i18n="configurationThrottleMid"></span>
</div><span i18n="configurationThrottleMid"></span>
</label>
</div>
<div class="number">
<label>
<label><div class="numberspacer">
<input type="number" name="maxthrottle" min="0" max="2000" />
<span i18n="configurationThrottleMaximum"></span>
</div><span i18n="configurationThrottleMaximum"></span>
</label>
</div>
<div class="number">
<label>
<input type="number" name="mincommand" min="0" max="2000" />
<span i18n="configurationThrottleMinimumCommand"></span>
<label><div class="numberspacer">
<input type="number" name="mincommand" min="0" max="2000" />
</div><span i18n="configurationThrottleMinimumCommand"></span>
</label>
</div>
</div>
</div></div>
<div class="clear-both"></div>
<div class="leftWrapper">
<div class="groupTitle" i18n="configurationBoardAlignment"></div>
<div class="gui_box grey">
<div class="gui_box_titlebar"><div class="spacer_box_title" i18n="configurationBoardAlignment"></div>
<div class="helpicon"></div></div><div class="spacer_box">
<div class="number">
<label>
<input type="number" name="board_align_roll" step="1" min="-180" max="360" />
@ -92,9 +129,14 @@
<span i18n="configurationBoardAlignmentYaw"></span>
</label>
</div>
</div>
</div></div></div>
<div class="rightWrapper">
<div class="groupTitle" i18n="configurationAccelTrims"></div>
<div class="gui_box grey" style="min-height:142px;">
<div class="gui_box_titlebar"><div class="spacer_box_title" i18n="configurationAccelTrims"></div>
<div class="helpicon"></div></div><div class="spacer_box">
<div class="number">
<label>
<input type="number" name="roll" min="-300" max="300" />
@ -107,16 +149,22 @@
<span i18n="configurationAccelTrimPitch"></span>
</label>
</div>
</div>
</div></div></div>
<div class="clear-both"></div>
<div class="leftWrapper">
<div class="groupTitle" i18n="configurationReceiver"></div>
<table>
<div class="gui_box grey">
<div class="gui_box_titlebar"><div class="spacer_box_title" i18n="configurationReceiver"></div>
<div class="helpicon"></div></div><div class="spacer_box">
<table cellpadding="0" cellspacing="0">
<thead>
<tr>
<th i18n="configurationFeatureEnabled"></th>
<th i18n="configurationFeatureName"></th>
<th i18n="configurationFeatureDescription"></th>
<th i18n="configurationFeatureName"></th>
</tr>
</thead>
<tbody class="features rxMode">
@ -124,22 +172,35 @@
</tbody>
</table>
<div class="groupTitle" i18n="configurationSerialRX"></div>
</div></div>
<div class="gui_box grey">
<div class="gui_box_titlebar"><div class="spacer_box_title" i18n="configurationSerialRX"></div>
<div class="helpicon"></div></div><div class="spacer_box">
<div class="note">
<div class="note_spacer"><p i18n="configurationSerialRXHelp"></p></div> </div>
<select class="serialRX" size="4">
<!-- list generated here -->
</select>
<div class="help">
<p i18n="configurationSerialRXHelp"></p>
</div>
<div class="groupTitle" i18n="configurationFailsafe"></div>
<table>
</div></div>
<div class="gui_box grey">
<div class="gui_box_titlebar"><div class="spacer_box_title" i18n="configurationFailsafe"></div>
<div class="helpicon"></div></div><div class="spacer_box">
<table cellpadding="0" cellspacing="0">
<thead>
<tr>
<th i18n="configurationFeatureEnabled"></th>
<th i18n="configurationFeatureName"></th>
<th i18n="configurationFeatureDescription"></th>
<th i18n="configurationFeatureName"></th>
</tr>
</thead>
<tbody class="features rxFailsafe">
@ -153,14 +214,23 @@
</label>
</div>
</div>
</div></div>
<div class="rightWrapper current voltage">
<div class="groupTitle" i18n="configurationBatteryVoltage"></div>
<table>
<div class="gui_box grey">
<div class="gui_box_titlebar"><div class="spacer_box_title" i18n="configurationBatteryVoltage"></div>
<div class="helpicon"></div></div><div class="spacer_box">
<table cellpadding="0" cellspacing="0">
<thead>
<tr>
<th i18n="configurationFeatureEnabled"></th>
<th i18n="configurationFeatureName"></th>
<th i18n="configurationFeatureDescription"></th>
<th i18n="configurationFeatureName"></th>
</tr>
</thead>
<tbody class="features batteryVoltage">
@ -191,14 +261,19 @@
<input type="number" name="voltagescale" step="1" min="10" max="255" />
<span i18n="configurationBatteryScale"></span>
</label>
</div>
<div class="groupTitle" i18n="configurationCurrent"></div>
<table>
</div></div></div>
<div class="gui_box grey" style="min-height:0px;">
<div class="gui_box_titlebar"><div class="spacer_box_title" i18n="configurationCurrent"></div>
<div class="helpicon"></div></div><div class="spacer_box">
<table cellpadding="0" cellspacing="0">
<thead>
<tr>
<th i18n="configurationFeatureEnabled"></th>
<th i18n="configurationFeatureName"></th>
<th i18n="configurationFeatureDescription"></th>
<th i18n="configurationFeatureName"></th>
</tr>
</thead>
<tbody class="features batteryCurrent">
@ -218,24 +293,28 @@
</label>
</div>
<div class="checkbox">
<label>
<div>
<input type="checkbox" name="multiwiicurrentoutput" />
</div>
<label><div class="numberspacer">
<input type="checkbox" name="multiwiicurrentoutput" id="toggle"/></div>
<span i18n="configurationBatteryMultiwiiCurrent"></span>
</label>
</div>
</div>
</div></div></div>
<div class="clear-both"></div>
<div class="leftWrapper rssi">
<div class="groupTitle" i18n="configurationRSSI"></div>
<table>
<div class="gui_box grey" style="min-height:0px;">
<div class="gui_box_titlebar"><div class="spacer_box_title" i18n="configurationRSSI"></div>
<div class="helpicon"></div></div><div class="spacer_box">
<table cellpadding="0" cellspacing="0">
<thead>
<tr>
<th i18n="configurationFeatureEnabled"></th>
<th i18n="configurationFeatureName"></th>
<th i18n="configurationFeatureDescription"></th>
<th i18n="configurationFeatureName"></th>
</tr>
</thead>
<tbody class="features rssi">
@ -243,9 +322,20 @@
</tbody>
</table>
</div>
</div></div>
<div class="rightWrapper system">
<div class="groupTitle" i18n="configurationSystem"></div>
<div class="number">
<div class="gui_box grey" style="min-height:0px;">
<div class="gui_box_titlebar"><div class="spacer_box_title" i18n="configurationSystem"></div>
<div class="helpicon"></div></div><div class="spacer_box">
<div class="note">
<div class="note_spacer"><p i18n="configurationLoopTimeHelp"></p></div></div>
<div class="number">
<label>
<input type="number" name="looptime" step="100" min="0" max="9000"/>
<span i18n="configurationLoopTime"></span>
@ -253,22 +343,32 @@
</div>
<div class="number">
<label>
<input type="text" name="looptimehz" readonly="readonly" class="disabled"/>
<input type="text" name="looptimehz" readonly class="disabled"/>
<span i18n="configurationCalculatedCyclesSec"></span>
</label>
</div>
<p class="help" i18n="configurationLoopTimeHelp"></p>
</div>
</div></div></div>
<div class="clear-both"></div>
<div class="leftWrapper gps">
<div class="groupTitle" i18n="configurationGPS"></div>
<table>
<div class="gui_box grey" style="min-height:0px;">
<div class="gui_box_titlebar"><div class="spacer_box_title" i18n="configurationGPS"></div>
<div class="helpicon"></div></div><div class="spacer_box">
<div class="note">
<div class="note_spacer"><p i18n="configurationGPSHelp"></p></div>
</div>
<table cellpadding="0" cellspacing="0">
<thead>
<tr>
<th i18n="configurationFeatureEnabled"></th>
<th i18n="configurationFeatureName"></th>
<th i18n="configurationFeatureDescription"></th>
<th i18n="configurationFeatureName"></th>
</tr>
</thead>
<tbody class="features gps">
@ -301,26 +401,32 @@
</label>
</div>
<div class="help">
<p i18n="configurationGPSHelp"></p>
</div>
</div></div>
</div>
<div class="rightWrapper">
<div class="groupTitle" i18n="configurationFeatures"></div>
<table>
<div class="gui_box grey" style="min-height:0px;">
<div class="gui_box_titlebar"><div class="spacer_box_title" i18n="configurationFeatures"></div>
<div class="helpicon"></div></div><div class="spacer_box">
<table cellpadding="0" cellspacing="0">
<thead>
<tr>
<th i18n="configurationFeatureEnabled"></th>
<th i18n="configurationFeatureName"></th>
<th i18n="configurationFeatureDescription"></th>
<th i18n="configurationFeatureName"></th>
</tr>
</thead>
<tbody class="features other">
<!-- table generated here -->
</tbody>
</table>
</div>
</div></div></div>
<div class="clear-both"></div>

View file

@ -47,6 +47,9 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
$('#content').load("./tabs/configuration.html", process_html);
}
MSP.send_message(MSP_codes.MSP_IDENT, false, false, load_config);
function recalculate_cycles_sec() {
@ -134,13 +137,13 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
+ '</td>');
radioGroups.push(features[i].group);
} else {
row_e = $('<tr><td><input class="feature" id="feature-'
row_e = $('<tr><td><input class="feature"'
+ i
+ '" name="'
+ features[i].name
+ '" title="'
+ features[i].name
+ '" type="checkbox" /></td><td><label for="feature-'
+ '" type="checkbox" id="toggle"/></td><td><label for="feature-'
+ i
+ '">'
+ features[i].name
@ -356,6 +359,23 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
});
});
// load switchery
var elems = Array.prototype.slice.call(document.querySelectorAll('#toggle'));
elems.forEach(function(html) {
var switchery = new Switchery(html,
{
color: '#59aa29',
secondaryColor: '#c4c4c4'
});
});
// load switchery END
$('a.save').click(function () {
// gather data that doesn't have automatic change event bound
BF_CONFIG.board_align_roll = parseInt($('input[name="board_align_roll"]').val());
@ -448,6 +468,9 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
}
};
TABS.configuration.cleanup = function (callback) {
TABS.configuration.cleanup = function (callback) {
if (callback) callback();
};
};

View file

@ -27,7 +27,7 @@ elems.forEach(function(html) {
secondaryColor: '#c4c4c4'
});
});
function parse_hex(str, callback) {
// parsing hex in different thread

45
tabs/gps_old.css Normal file
View file

@ -0,0 +1,45 @@
.tab-gps {
}
.tab-gps .GPS_info {
float: left;
display: block;
width: 190px;
border: 1px solid silver;
}
.tab-gps .GPS_info table {
padding: 5px;
line-height: 18px;
}
.tab-gps .GPS_signal_strength {
float: left;
margin-left: 10px;
width: 200px;
border: 1px solid silver;
}
.tab-gps .GPS_signal_strength table {
padding: 5px;
line-height: 18px;
}
.tab-gps .GPS_info .head,
.tab-gps .GPS_signal_strength .head {
display: block;
text-align: center;
line-height: 20px;
font-weight: bold;
border-bottom: 1px solid silver;
background-color: #ececec;
}
.tab-gps a {
font-weight: bold;
}
.tab-gps a:hover {
text-decoration: underline;
}

125
tabs/gps_old.html Normal file
View file

@ -0,0 +1,125 @@
<div class="tab-gps">
<div class="GPS_info">
<span class="head" i18n="gpsHead"></span>
<table>
<tr>
<td style="width: 85px" i18n="gps3dFix"></td>
<td class="fix" i18n="gpsFixFalse"></td>
</tr>
<tr>
<td i18n="gpsAltitude"></td>
<td class="alt">0 m</td>
</tr>
<tr>
<td i18n="gpsLat"></td>
<td class="lat"><a href="#" target="_blank">0.0000 deg</a></td>
</tr>
<tr>
<td i18n="gpsLon"></td>
<td class="lon"><a href="#" target="_blank">0.0000 deg</a></td>
</tr>
<tr>
<td i18n="gpsSpeed"></td>
<td class="speed">0 cm/s</td>
</tr>
<tr>
<td i18n="gpsSats"></td>
<td class="sats">0</td>
</tr>
<tr>
<td i18n="gpsDistToHome"></td>
<td class="distToHome"></td>
</tr>
</table>
</div>
<div class="GPS_signal_strength">
<span class="head" i18n="gpsSignalStrHead"></span>
<table>
<tr class="titles">
<td style="width: 40px;">Sat ID</td>
<td style="width: 30px;">Qty</td>
<td i18n="gpsSignalStr">Signal Strength</td>
</tr>
<tr>
<td>0</td>
<td>0</td>
<td><progress value="0" max="99"></progress></td>
</tr>
<tr>
<td>0</td>
<td>0</td>
<td><progress value="0" max="99"></progress></td>
</tr>
<tr>
<td>0</td>
<td>0</td>
<td><progress value="0" max="99"></progress></td>
</tr>
<tr>
<td>0</td>
<td>0</td>
<td><progress value="0" max="99"></progress></td>
</tr>
<tr>
<td>0</td>
<td>0</td>
<td><progress value="0" max="99"></progress></td>
</tr>
<tr>
<td>0</td>
<td>0</td>
<td><progress value="0" max="99"></progress></td>
</tr>
<tr>
<td>0</td>
<td>0</td>
<td><progress value="0" max="99"></progress></td>
</tr>
<tr>
<td>0</td>
<td>0</td>
<td><progress value="0" max="99"></progress></td>
</tr>
<tr>
<td>0</td>
<td>0</td>
<td><progress value="0" max="99"></progress></td>
</tr>
<tr>
<td>0</td>
<td>0</td>
<td><progress value="0" max="99"></progress></td>
</tr>
<tr>
<td>0</td>
<td>0</td>
<td><progress value="0" max="99"></progress></td>
</tr>
<tr>
<td>0</td>
<td>0</td>
<td><progress value="0" max="99"></progress></td>
</tr>
<tr>
<td>0</td>
<td>0</td>
<td><progress value="0" max="99"></progress></td>
</tr>
<tr>
<td>0</td>
<td>0</td>
<td><progress value="0" max="99"></progress></td>
</tr>
<tr>
<td>0</td>
<td>0</td>
<td><progress value="0" max="99"></progress></td>
</tr>
<tr>
<td>0</td>
<td>0</td>
<td><progress value="0" max="99"></progress></td>
</tr>
</table>
</div>
</div>

80
tabs/gps_old.js Normal file
View file

@ -0,0 +1,80 @@
'use strict';
TABS.gps = {};
TABS.gps.initialize = function (callback) {
var self = this;
if (GUI.active_tab != 'gps') {
GUI.active_tab = 'gps';
googleAnalytics.sendAppView('GPS');
}
function load_html() {
$('#content').load("./tabs/gps.html", process_html);
}
MSP.send_message(MSP_codes.MSP_STATUS, false, false, load_html);
function process_html() {
// translate to user-selected language
localize();
function get_raw_gps_data() {
MSP.send_message(MSP_codes.MSP_RAW_GPS, false, false, get_comp_gps_data);
}
function get_comp_gps_data() {
MSP.send_message(MSP_codes.MSP_COMP_GPS, false, false, get_gpsvinfo_data);
}
function get_gpsvinfo_data() {
MSP.send_message(MSP_codes.MSP_GPS_SV_INFO, false, false, update_ui);
}
function update_ui() {
var lat = GPS_DATA.lat / 10000000;
var lon = GPS_DATA.lon / 10000000;
var url = 'https://maps.google.com/?q=' + lat + ',' + lon;
$('.GPS_info td.fix').html((GPS_DATA.fix) ? chrome.i18n.getMessage('gpsFixTrue') : chrome.i18n.getMessage('gpsFixFalse'));
$('.GPS_info td.alt').text(GPS_DATA.alt + ' m');
$('.GPS_info td.lat a').prop('href', url).text(lat.toFixed(4) + ' deg');
$('.GPS_info td.lon a').prop('href', url).text(lon.toFixed(4) + ' deg');
$('.GPS_info td.speed').text(GPS_DATA.speed + ' cm/s');
$('.GPS_info td.sats').text(GPS_DATA.numSat);
$('.GPS_info td.distToHome').text(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).text(GPS_DATA.svid[i]);
$('td', row).eq(1).text(GPS_DATA.quality[i]);
$('td', row).eq(2).find('progress').val(GPS_DATA.cno[i]);
}
}
// enable data pulling
GUI.interval_add('gps_pull', function gps_update() {
// avoid usage of the GPS commands until a GPS sensor is detected for targets that are compiled without GPS support.
if (!have_sensor(CONFIG.activeSensors, 'gps')) {
return;
}
get_raw_gps_data();
}, 75, true);
// status data pulled via separate timer with static speed
GUI.interval_add('status_pull', function status_pull() {
MSP.send_message(MSP_codes.MSP_STATUS);
}, 250, true);
if (callback) callback();
}
};
TABS.gps.cleanup = function (callback) {
if (callback) callback();
};

View file

@ -1,9 +1,7 @@
<div class="tab-ports">
<div class="tab_title">Ports
<div class="cf_doc_version_bt">
<div class="tab_title" i18n="tabPorts">Ports</div>
<div class="cf_doc_version_bt">
<a id="button-documentation" href="https://github.com/cleanflight/cleanflight/releases" target="_blank"></a></div>
</div>
<div class="require-support">
<div class="note" style="margin-bottom:20px;">

View file

@ -2,11 +2,10 @@
<div class="tab-setup"> <!-- should be the first DIV on each tab -->
<div class="cf_column full" style="margin-bottom:10px;">
<div class="tab_title">Setup
<div class="cf_doc_version_bt">
<div class="tab_title" i18n="tabSetup">Setup</div>
<div class="cf_doc_version_bt">
<a id="button-documentation" href="https://github.com/cleanflight/cleanflight/releases" target="_blank"></a></div>
</div>
<div class="cf_column fourth" style="min-height:100px;">
<div class="spacer_right">