Add Race Transponder configuration support.
Also cleans up i18n support for 'features' and adds tooltip support for them on the configuration tab.pull/3/head
parent
5c2273bd65
commit
1a58bfcf82
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="595.281px" height="841.891px" viewBox="0 0 595.281 841.891" enable-background="new 0 0 595.281 841.891"
|
||||
xml:space="preserve">
|
||||
<g>
|
||||
<path fill="#818181" d="M127.71,440.9c-7.142,41.59,6.722,84.439,36.549,114.267s72.677,43.69,114.267,36.549
|
||||
c11.763-2.101,19.745-13.443,18.064-25.206c-0.84-4.621-2.94-8.822-5.881-11.763c-4.621-4.621-11.763-7.142-18.904-6.302
|
||||
c-27.727,4.621-56.293-4.621-76.458-24.365c-20.165-19.745-28.987-47.892-24.366-76.038c2.1-11.763-5.881-23.105-18.064-25.206
|
||||
C140.733,420.735,129.811,429.137,127.71,440.9"/>
|
||||
<path fill="#818181" d="M289.028,652.21c-0.42-5.461-2.521-10.502-6.302-14.283c-4.201-4.201-10.083-6.722-16.804-6.302
|
||||
c-47.892,2.521-94.942-15.543-128.971-49.151c-34.028-33.607-51.672-81.079-48.731-128.971c0.84-12.183-8.402-22.265-20.585-23.105
|
||||
c-12.183-0.84-22.265,8.402-23.105,20.585c-3.36,60.494,19.325,119.309,62.175,162.158c42.85,42.851,101.664,65.115,162.158,62.175
|
||||
C280.626,674.895,289.868,664.392,289.028,652.21"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#818181" d="M480.616,308.596c-10.826,0-19.984,13.633-23.733,32.085h-97.416v32.084h97.416
|
||||
c3.332,18.451,12.491,32.088,23.733,32.088c13.735,0,24.977-21.659,24.977-48.131C505.592,330.255,494.351,308.596,480.616,308.596
|
||||
z"/>
|
||||
<path fill="#818181" d="M297.853,252.445c-29.975,0-55.369,36.899-64.945,88.236h-91.171
|
||||
c-3.331-18.452-12.491-32.085-23.729-32.085c-13.739,0-24.979,21.658-24.979,48.126c0,26.472,11.24,48.131,24.979,48.131
|
||||
c10.822,0,19.982-13.637,23.729-32.088h87.426h132.386h4.995C363.631,304.584,334.073,252.445,297.853,252.445z"/>
|
||||
<rect x="21.007" y="280.52" fill="#818181" width="191.502" height="23.262"/>
|
||||
<rect x="381.115" y="280.52" fill="#818181" width="191.504" height="23.262"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.0 KiB |
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="595.281px" height="841.891px" viewBox="0 0 595.281 841.891" enable-background="new 0 0 595.281 841.891"
|
||||
xml:space="preserve">
|
||||
<g>
|
||||
<path fill="#FFFFFF" d="M127.71,440.9c-7.142,41.59,6.722,84.439,36.549,114.267s72.677,43.69,114.267,36.549
|
||||
c11.763-2.101,19.745-13.443,18.064-25.206c-0.84-4.621-2.94-8.822-5.881-11.763c-4.621-4.621-11.763-7.142-18.904-6.302
|
||||
c-27.727,4.621-56.293-4.621-76.458-24.365c-20.165-19.745-28.987-47.892-24.366-76.038c2.1-11.763-5.881-23.105-18.064-25.206
|
||||
C140.733,420.735,129.811,429.137,127.71,440.9"/>
|
||||
<path fill="#FFFFFF" d="M289.028,652.21c-0.42-5.461-2.521-10.502-6.302-14.283c-4.201-4.201-10.083-6.722-16.804-6.302
|
||||
c-47.892,2.521-94.942-15.543-128.971-49.151c-34.028-33.607-51.672-81.079-48.731-128.971c0.84-12.183-8.402-22.265-20.585-23.105
|
||||
c-12.183-0.84-22.265,8.402-23.105,20.585c-3.36,60.494,19.325,119.309,62.175,162.158c42.85,42.851,101.664,65.115,162.158,62.175
|
||||
C280.626,674.895,289.868,664.392,289.028,652.21"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#FFFFFF" d="M480.616,308.596c-10.826,0-19.984,13.633-23.733,32.085h-97.416v32.084h97.416
|
||||
c3.332,18.451,12.491,32.088,23.733,32.088c13.735,0,24.977-21.659,24.977-48.131C505.592,330.255,494.351,308.596,480.616,308.596
|
||||
z"/>
|
||||
<path fill="#FFFFFF" d="M297.853,252.445c-29.975,0-55.369,36.899-64.945,88.236h-91.171
|
||||
c-3.331-18.452-12.491-32.085-23.729-32.085c-13.739,0-24.979,21.658-24.979,48.126c0,26.472,11.24,48.131,24.979,48.131
|
||||
c10.822,0,19.982-13.637,23.729-32.088h87.426h132.386h4.995C363.631,304.584,334.073,252.445,297.853,252.445z"/>
|
||||
<rect x="21.007" y="280.52" fill="#FFFFFF" width="191.502" height="23.262"/>
|
||||
<rect x="381.115" y="280.52" fill="#FFFFFF" width="191.504" height="23.262"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.0 KiB |
@ -0,0 +1,75 @@
|
||||
.tab-transponder .spacer_box {
|
||||
padding-bottom: 10px;
|
||||
float: left;
|
||||
width: calc(100% - 20px);
|
||||
}
|
||||
|
||||
.tab-transponder .text input {
|
||||
width: 100px;
|
||||
padding-left: 3px;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
text-align: left;
|
||||
border: 1px solid silver;
|
||||
border-radius: 3px;
|
||||
margin-right: 11px;
|
||||
font-size: 12px;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.tab-transponder .text .disabled {
|
||||
width: 43px;
|
||||
padding: 0px 5px;
|
||||
background-color: #ececec;
|
||||
}
|
||||
|
||||
.tab-transponder .text span {
|
||||
margin-left: 0px;
|
||||
}
|
||||
|
||||
.tab-transponder input {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.tab-transponder span {
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.tab-transponder .text
|
||||
{
|
||||
margin-bottom: 5px;
|
||||
clear: left;
|
||||
padding-bottom: 5px;
|
||||
border-bottom: 1px solid #ddd;
|
||||
width: 100%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.tab-transponder .text:last-child {
|
||||
border-bottom: none;
|
||||
padding-bottom: 0px;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
.tab-transponder .textspacer {
|
||||
float: left;
|
||||
width: 115px;
|
||||
height: 21px;
|
||||
}
|
||||
|
||||
.tab-transponder .gui_box span {
|
||||
font-style: normal;
|
||||
font-family: 'open_sansregular', Arial;
|
||||
line-height: 19px;
|
||||
color: #4F4F4F;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.require-transponder-supported,
|
||||
.tab-transponder.transponder-supported .require-transponder-unsupported {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.tab-transponder.transponder-supported .require-transponder-supported {
|
||||
display: block;
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
<div class="tab-transponder toolbar_fixed_bottom">
|
||||
<div class="content_wrapper">
|
||||
<div class="tab_title" i18n="tabTransponder">Transponder</div>
|
||||
<div class="cf_doc_version_bt">
|
||||
<a id="button-documentation" href="https://github.com/cleanflight/cleanflight/releases" target="_blank"></a>
|
||||
</div>
|
||||
|
||||
<div class="require-transponder-unsupported note">
|
||||
<div class="note_spacer">
|
||||
<p i18n="transponderNotSupported"></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="require-transponder-supported">
|
||||
|
||||
<div class="note" style="margin-bottom: 20px;">
|
||||
<div class="note_spacer">
|
||||
<p i18n="transponderHelp"></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="gui_box grey">
|
||||
<div class="gui_box_titlebar">
|
||||
<div class="spacer_box_title" i18n="transponderConfiguration"></div>
|
||||
</div>
|
||||
<div class="spacer_box">
|
||||
<div class="text transponderData">
|
||||
<div class="textspacer" >
|
||||
<input type="text" name="data" spellcheck="false"/>
|
||||
</div>
|
||||
<label for="failsafe_feature_new"><span i18n="transponderData"></span>
|
||||
</label>
|
||||
<div class="helpicon cf_tip" i18n_title="transponderDataHelp"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear-both"></div>
|
||||
</div>
|
||||
|
||||
<div class="note">
|
||||
<div class="note_spacer">
|
||||
<p i18n="transponderInformation"></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="content_toolbar require-transponder-supported">
|
||||
<div class="btn save_btn">
|
||||
<a class="save" href="#" i18n="transponderButtonSave"></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,105 @@
|
||||
'use strict';
|
||||
|
||||
TABS.transponder = {
|
||||
available: false
|
||||
};
|
||||
|
||||
TABS.transponder.initialize = function (callback, scrollPosition) {
|
||||
var self = this;
|
||||
|
||||
if (GUI.active_tab != 'transponder') {
|
||||
GUI.active_tab = 'transponder';
|
||||
googleAnalytics.sendAppView('Transponder');
|
||||
}
|
||||
|
||||
// transponder supported added in MSP API Version 1.16.0
|
||||
TABS.transponder.available = semver.gte(CONFIG.apiVersion, "1.16.0");
|
||||
|
||||
if (!TABS.transponder.available) {
|
||||
load_html();
|
||||
return;
|
||||
}
|
||||
|
||||
function load_html() {
|
||||
$('#content').load("./tabs/transponder.html", process_html);
|
||||
}
|
||||
|
||||
// get the transponder data and a flag to see if transponder support is enabled on the FC
|
||||
MSP.send_message(MSP_codes.MSP_TRANSPONDER_CONFIG, false, false, load_html);
|
||||
|
||||
// Convert a hex string to a byte array
|
||||
function hexToBytes(hex) {
|
||||
for (var bytes = [], c = 0; c < hex.length; c += 2)
|
||||
bytes.push(~parseInt(hex.substr(c, 2), 16));
|
||||
return bytes;
|
||||
}
|
||||
|
||||
function pad(n, width) {
|
||||
n = n + '';
|
||||
return n.length >= width ? n : new Array(width - n.length + 1).join('0') + n;
|
||||
}
|
||||
|
||||
// Convert a byte array to a hex string
|
||||
function bytesToHex(bytes) {
|
||||
for (var hex = [], i = 0; i < bytes.length; i++) {
|
||||
hex.push(pad(((~bytes[i]) & 0xFF).toString(16),2));
|
||||
}
|
||||
return hex.join("").toUpperCase();
|
||||
}
|
||||
function process_html() {
|
||||
// translate to user-selected language
|
||||
localize();
|
||||
|
||||
$(".tab-transponder")
|
||||
.toggleClass("transponder-supported", TABS.transponder.available && TRANSPONDER.supported);
|
||||
|
||||
if (TABS.transponder.available) {
|
||||
|
||||
var data = bytesToHex(TRANSPONDER.data);
|
||||
|
||||
$('input[name="data"]').val(data);
|
||||
$('input[name="data"]').prop('maxLength', data.length);
|
||||
|
||||
$('a.save').click(function () {
|
||||
|
||||
|
||||
// gather data that doesn't have automatic change event bound
|
||||
|
||||
var dataString = $('input[name="data"]').val();
|
||||
var expectedLength = TRANSPONDER.data.length;
|
||||
var hexRegExp = new RegExp('[0-9a-fA-F]{' + (expectedLength * 2) + '}', 'gi');
|
||||
if (!dataString.match(hexRegExp)) {
|
||||
GUI.log(chrome.i18n.getMessage('transponderDataInvalid'));
|
||||
return;
|
||||
}
|
||||
|
||||
TRANSPONDER.data = hexToBytes(dataString);
|
||||
|
||||
|
||||
//
|
||||
// send data to FC
|
||||
//
|
||||
function save_transponder_config() {
|
||||
MSP.send_message(MSP_codes.MSP_SET_TRANSPONDER_CONFIG, MSP.crunch(MSP_codes.MSP_SET_TRANSPONDER_CONFIG), false, save_to_eeprom);
|
||||
}
|
||||
function save_to_eeprom() {
|
||||
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('transponderEepromSaved'));
|
||||
});
|
||||
}
|
||||
|
||||
save_transponder_config();
|
||||
});
|
||||
}
|
||||
// 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);
|
||||
|
||||
GUI.content_ready(callback);
|
||||
}
|
||||
};
|
||||
|
||||
TABS.transponder.cleanup = function (callback) {
|
||||
if (callback) callback();
|
||||
};
|
Loading…
Reference in New Issue