mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-20 14:55:21 +03:00
removing all code depending on CONFIG.capability that i could find on the first swoop
This commit is contained in:
parent
81a2872360
commit
ecd34bf113
5 changed files with 65 additions and 478 deletions
|
@ -10,18 +10,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
googleAnalytics.sendAppView('Configuration');
|
googleAnalytics.sendAppView('Configuration');
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_compatibility() {
|
|
||||||
if (bit_check(CONFIG.capability, 30)) {
|
|
||||||
// new stuff supported, continue fetching configuration data
|
|
||||||
load_config();
|
|
||||||
} else {
|
|
||||||
// old version, deny access
|
|
||||||
$('#content').text('We are sorry, but advanced configuration is only available for boards with latest firmware, please update');
|
|
||||||
|
|
||||||
if (callback) callback();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function load_config() {
|
function load_config() {
|
||||||
MSP.send_message(MSP_codes.MSP_CONFIG, false, false, load_rc_map);
|
MSP.send_message(MSP_codes.MSP_CONFIG, false, false, load_rc_map);
|
||||||
}
|
}
|
||||||
|
@ -42,7 +30,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
$('#content').load("./tabs/configuration.html", process_html);
|
$('#content').load("./tabs/configuration.html", process_html);
|
||||||
}
|
}
|
||||||
|
|
||||||
MSP.send_message(MSP_codes.MSP_IDENT, false, false, check_compatibility);
|
MSP.send_message(MSP_codes.MSP_IDENT, false, false, load_config);
|
||||||
|
|
||||||
function process_html() {
|
function process_html() {
|
||||||
// translate to user-selected language
|
// translate to user-selected language
|
||||||
|
|
117
tabs/receiver.js
117
tabs/receiver.js
|
@ -18,12 +18,7 @@ TABS.receiver.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_rc_map() {
|
function get_rc_map() {
|
||||||
// TODO remove this after compatibility period
|
MSP.send_message(MSP_codes.MSP_RCMAP, false, false, load_html);
|
||||||
if (bit_check(CONFIG.capability, 30)) {
|
|
||||||
MSP.send_message(MSP_codes.MSP_RCMAP, false, false, load_html);
|
|
||||||
} else {
|
|
||||||
load_html();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_html() {
|
function load_html() {
|
||||||
|
@ -109,70 +104,66 @@ TABS.receiver.initialize = function (callback) {
|
||||||
$(window).on('resize', self.resize).resize(); // trigger so labels get correctly aligned on creation
|
$(window).on('resize', self.resize).resize(); // trigger so labels get correctly aligned on creation
|
||||||
|
|
||||||
// handle rcmap & rssi aux channel
|
// handle rcmap & rssi aux channel
|
||||||
if (bit_check(CONFIG.capability, 30)) {
|
var RC_MAP_Letters = ['A', 'E', 'R', 'T', '1', '2', '3', '4'];
|
||||||
var RC_MAP_Letters = ['A', 'E', 'R', 'T', '1', '2', '3', '4'];
|
|
||||||
|
|
||||||
var strBuffer = [];
|
var strBuffer = [];
|
||||||
for (var i = 0; i < RC_MAP.length; i++) {
|
for (var i = 0; i < RC_MAP.length; i++) {
|
||||||
strBuffer[RC_MAP[i]] = RC_MAP_Letters[i];
|
strBuffer[RC_MAP[i]] = RC_MAP_Letters[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
// reconstruct
|
||||||
|
var str = strBuffer.join('');
|
||||||
|
|
||||||
|
// set current value
|
||||||
|
$('input[name="rcmap"]').val(str);
|
||||||
|
|
||||||
|
// validation / filter
|
||||||
|
var last_valid = str;
|
||||||
|
|
||||||
|
$('input[name="rcmap"]').on('input', function () {
|
||||||
|
var val = $(this).val();
|
||||||
|
|
||||||
|
// limit length to max 8
|
||||||
|
if (val.length > 8) {
|
||||||
|
val = val.substr(0, 8);
|
||||||
|
$(this).val(val);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('input[name="rcmap"]').focusout(function () {
|
||||||
|
var val = $(this).val(),
|
||||||
|
strBuffer = val.split(''),
|
||||||
|
duplicityBuffer = [];
|
||||||
|
|
||||||
|
if (val.length != 8) {
|
||||||
|
$(this).val(last_valid);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// reconstruct
|
// check if characters inside are all valid, also check for duplicity
|
||||||
var str = strBuffer.join('');
|
for (var i = 0; i < val.length; i++) {
|
||||||
|
if (RC_MAP_Letters.indexOf(strBuffer[i]) < 0) {
|
||||||
// set current value
|
|
||||||
$('input[name="rcmap"]').val(str);
|
|
||||||
|
|
||||||
// validation / filter
|
|
||||||
var last_valid = str;
|
|
||||||
|
|
||||||
$('input[name="rcmap"]').on('input', function () {
|
|
||||||
var val = $(this).val();
|
|
||||||
|
|
||||||
// limit length to max 8
|
|
||||||
if (val.length > 8) {
|
|
||||||
val = val.substr(0, 8);
|
|
||||||
$(this).val(val);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('input[name="rcmap"]').focusout(function () {
|
|
||||||
var val = $(this).val(),
|
|
||||||
strBuffer = val.split(''),
|
|
||||||
duplicityBuffer = [];
|
|
||||||
|
|
||||||
if (val.length != 8) {
|
|
||||||
$(this).val(last_valid);
|
$(this).val(last_valid);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if characters inside are all valid, also check for duplicity
|
if (duplicityBuffer.indexOf(strBuffer[i]) < 0) {
|
||||||
for (var i = 0; i < val.length; i++) {
|
duplicityBuffer.push(strBuffer[i]);
|
||||||
if (RC_MAP_Letters.indexOf(strBuffer[i]) < 0) {
|
} else {
|
||||||
$(this).val(last_valid);
|
$(this).val(last_valid);
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
if (duplicityBuffer.indexOf(strBuffer[i]) < 0) {
|
|
||||||
duplicityBuffer.push(strBuffer[i]);
|
|
||||||
} else {
|
|
||||||
$(this).val(last_valid);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// handle helper
|
// handle helper
|
||||||
$('select[name="rcmap_helper"]').val(0); // go out of bounds
|
$('select[name="rcmap_helper"]').val(0); // go out of bounds
|
||||||
$('select[name="rcmap_helper"]').change(function () {
|
$('select[name="rcmap_helper"]').change(function () {
|
||||||
$('input[name="rcmap"]').val($(this).val());
|
$('input[name="rcmap"]').val($(this).val());
|
||||||
});
|
});
|
||||||
|
|
||||||
// rssi aux
|
// rssi aux
|
||||||
$('select[name="rssi_aux_channel"]').val(MISC.rssi_aux_channel);
|
$('select[name="rssi_aux_channel"]').val(MISC.rssi_aux_channel);
|
||||||
} else {
|
|
||||||
$('.rcmap_wrapper, .rssi_aux_wrapper').hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
// UI Hooks
|
// UI Hooks
|
||||||
// curves
|
// curves
|
||||||
|
@ -297,11 +288,7 @@ TABS.receiver.initialize = function (callback) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bit_check(CONFIG.capability, 30)) {
|
MSP.send_message(MSP_codes.MSP_SET_RC_TUNING, MSP.crunch(MSP_codes.MSP_SET_RC_TUNING), false, save_rc_map);
|
||||||
MSP.send_message(MSP_codes.MSP_SET_RC_TUNING, MSP.crunch(MSP_codes.MSP_SET_RC_TUNING), false, save_rc_map);
|
|
||||||
} else {
|
|
||||||
MSP.send_message(MSP_codes.MSP_SET_RC_TUNING, MSP.crunch(MSP_codes.MSP_SET_RC_TUNING), false, save_to_eeprom);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('select[name="rx_refresh_rate"]').change(function () {
|
$('select[name="rx_refresh_rate"]').change(function () {
|
||||||
|
|
190
tabs/setup.css
190
tabs/setup.css
|
@ -1,19 +1,17 @@
|
||||||
/* temporary styles that are used during compatibility period */
|
/* requires cleanup */
|
||||||
.tab-setup .CAP_BASEFLIGHT_CONFIG,
|
.tab-setup .CAP_BASEFLIGHT_CONFIG {
|
||||||
.tab-setup .COMPATIBILITY {
|
|
||||||
display: none;
|
|
||||||
height: calc(100% - 138px);
|
height: calc(100% - 138px);
|
||||||
}
|
}
|
||||||
.tab-setup .CAP_BASEFLIGHT_CONFIG #interactive_block {
|
.tab-setup #interactive_block {
|
||||||
width: calc(100% - 199px);
|
width: calc(100% - 199px);
|
||||||
}
|
}
|
||||||
.tab-setup .CAP_BASEFLIGHT_CONFIG .gps {
|
.tab-setup .gps {
|
||||||
width: 185px;
|
width: 185px;
|
||||||
}
|
}
|
||||||
.tab-setup .CAP_BASEFLIGHT_CONFIG .gps .fields {
|
.tab-setup .gps .fields {
|
||||||
padding: 5px 5px 3px 5px;
|
padding: 5px 5px 3px 5px;
|
||||||
}
|
}
|
||||||
.tab-setup .CAP_BASEFLIGHT_CONFIG .gps dt {
|
.tab-setup .gps dt {
|
||||||
float: left;
|
float: left;
|
||||||
|
|
||||||
width: 85px;
|
width: 85px;
|
||||||
|
@ -23,7 +21,7 @@
|
||||||
|
|
||||||
line-height: 20px;
|
line-height: 20px;
|
||||||
}
|
}
|
||||||
.tab-setup .CAP_BASEFLIGHT_CONFIG .gps dd {
|
.tab-setup .gps dd {
|
||||||
height: 20px;
|
height: 20px;
|
||||||
|
|
||||||
margin-left: 85px;
|
margin-left: 85px;
|
||||||
|
@ -31,7 +29,6 @@
|
||||||
|
|
||||||
line-height: 20px;
|
line-height: 20px;
|
||||||
}
|
}
|
||||||
/* temporary styles end*/
|
|
||||||
.tab-setup {
|
.tab-setup {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
@ -97,29 +94,6 @@
|
||||||
border: 1px solid silver;
|
border: 1px solid silver;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
}
|
}
|
||||||
#interactive_block .model {
|
|
||||||
float: left;
|
|
||||||
height: 15px;
|
|
||||||
margin: 10px 0 0 10px;
|
|
||||||
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
#interactive_block .modelMixDiagram {
|
|
||||||
position: absolute;
|
|
||||||
|
|
||||||
top: 32px;
|
|
||||||
left: 10px;
|
|
||||||
|
|
||||||
height: 95px;
|
|
||||||
}
|
|
||||||
#interactive_block .modelMixAirplane { /* Position airplane correctly */
|
|
||||||
height: 115px;
|
|
||||||
padding-left: 0px;
|
|
||||||
}
|
|
||||||
#interactive_block .modelMixCustom { /* Position question mark correctly */
|
|
||||||
height: 75px;
|
|
||||||
padding-left: 25px;
|
|
||||||
}
|
|
||||||
#interactive_block .heading {
|
#interactive_block .heading {
|
||||||
float: right;
|
float: right;
|
||||||
height: 15px;
|
height: 15px;
|
||||||
|
@ -180,37 +154,9 @@
|
||||||
border-bottom: 1px solid silver;
|
border-bottom: 1px solid silver;
|
||||||
background-color: #ececec;
|
background-color: #ececec;
|
||||||
}
|
}
|
||||||
.tab-setup .mixer {
|
|
||||||
width: 200px;
|
|
||||||
}
|
|
||||||
.tab-setup .mixer .preview {
|
|
||||||
display: block;
|
|
||||||
|
|
||||||
width: 200px;
|
|
||||||
height: 140px;
|
|
||||||
|
|
||||||
margin: 5px 0 5px 0;
|
|
||||||
}
|
|
||||||
.tab-setup .mixer select {
|
|
||||||
display: block;
|
|
||||||
|
|
||||||
padding-left: 5px;
|
|
||||||
|
|
||||||
width: 100%;
|
|
||||||
height: 20px;
|
|
||||||
line-height: 20px;
|
|
||||||
|
|
||||||
font-weight: bold;
|
|
||||||
|
|
||||||
border-top: 1px solid silver;
|
|
||||||
}
|
|
||||||
.tab-setup .block .info {
|
.tab-setup .block .info {
|
||||||
width: 200px;
|
width: 200px;
|
||||||
}
|
}
|
||||||
.tab-setup .battery,
|
|
||||||
.tab-setup .throttle,
|
|
||||||
.tab-setup .acc-trim,
|
|
||||||
.tab-setup .magnetometer,
|
|
||||||
.tab-setup .info {
|
.tab-setup .info {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
|
@ -221,131 +167,9 @@
|
||||||
|
|
||||||
border: 1px solid silver;
|
border: 1px solid silver;
|
||||||
}
|
}
|
||||||
.tab-setup .battery .head,
|
|
||||||
.tab-setup .throttle .head,
|
|
||||||
.tab-setup .acc-trim .head,
|
|
||||||
.tab-setup .magnetometer .head,
|
|
||||||
.tab-setup .info .head {
|
|
||||||
display: block;
|
|
||||||
|
|
||||||
text-align: center;
|
|
||||||
line-height: 20px;
|
|
||||||
font-weight: bold;
|
|
||||||
|
|
||||||
border-bottom: 1px solid silver;
|
|
||||||
background-color: #ececec;
|
|
||||||
}
|
|
||||||
.tab-setup .battery .fields,
|
|
||||||
.tab-setup .throttle .fields,
|
|
||||||
.tab-setup .magnetometer .fields,
|
|
||||||
.tab-setup .info .fields {
|
.tab-setup .info .fields {
|
||||||
padding: 5px 5px 3px 5px;
|
padding: 5px 5px 3px 5px;
|
||||||
}
|
}
|
||||||
.tab-setup .acc-trim .fields {
|
|
||||||
padding: 5px 5px 3px 5px;
|
|
||||||
}
|
|
||||||
.tab-setup .magnetometer .fields {
|
|
||||||
padding: 5px 5px 5px 5px;
|
|
||||||
}
|
|
||||||
.tab-setup .battery dt {
|
|
||||||
float: left;
|
|
||||||
|
|
||||||
width: 105px;
|
|
||||||
height: 22px;
|
|
||||||
|
|
||||||
margin-bottom: 2px;
|
|
||||||
|
|
||||||
line-height: 22px;
|
|
||||||
}
|
|
||||||
.tab-setup .battery dd {
|
|
||||||
height: 22px;
|
|
||||||
|
|
||||||
margin-left: 105px;
|
|
||||||
margin-bottom: 2px;
|
|
||||||
|
|
||||||
line-height: 22px;
|
|
||||||
}
|
|
||||||
.tab-setup .battery input {
|
|
||||||
width: 68px;
|
|
||||||
height: 20px;
|
|
||||||
line-height: 20px;
|
|
||||||
|
|
||||||
border: 1px solid silver;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.tab-setup .throttle dt {
|
|
||||||
float: left;
|
|
||||||
|
|
||||||
width: 90px;
|
|
||||||
height: 22px;
|
|
||||||
|
|
||||||
margin-bottom: 2px;
|
|
||||||
|
|
||||||
line-height: 22px;
|
|
||||||
}
|
|
||||||
.tab-setup .throttle dd {
|
|
||||||
height: 22px;
|
|
||||||
|
|
||||||
margin-left: 90px;
|
|
||||||
margin-bottom: 2px;
|
|
||||||
|
|
||||||
line-height: 22px;
|
|
||||||
}
|
|
||||||
.tab-setup .throttle input {
|
|
||||||
width: 60px;
|
|
||||||
height: 20px;
|
|
||||||
line-height: 20px;
|
|
||||||
|
|
||||||
border: 1px solid silver;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.tab-setup .acc-trim dt {
|
|
||||||
float: left;
|
|
||||||
|
|
||||||
width: 65px;
|
|
||||||
height: 22px;
|
|
||||||
line-height: 22px;
|
|
||||||
|
|
||||||
margin-bottom: 2px;
|
|
||||||
}
|
|
||||||
.tab-setup .acc-trim dd {
|
|
||||||
height: 22px;
|
|
||||||
|
|
||||||
margin-left: 65px;
|
|
||||||
margin-bottom: 2px;
|
|
||||||
}
|
|
||||||
.tab-setup .acc-trim input {
|
|
||||||
width: 60px;
|
|
||||||
height: 20px;
|
|
||||||
line-height: 20px;
|
|
||||||
|
|
||||||
border: 1px solid silver;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.tab-setup .magnetometer dt {
|
|
||||||
float: left;
|
|
||||||
|
|
||||||
width: 90px;
|
|
||||||
height: 20px;
|
|
||||||
line-height: 22px;
|
|
||||||
|
|
||||||
margin-bottom: 2px;
|
|
||||||
}
|
|
||||||
.tab-setup .magnetometer dd {
|
|
||||||
height: 20px;
|
|
||||||
line-height: 22px;
|
|
||||||
|
|
||||||
margin-left: 90px;
|
|
||||||
margin-bottom: 2px;
|
|
||||||
}
|
|
||||||
.tab-setup .magnetometer input {
|
|
||||||
width: 60px;
|
|
||||||
height: 20px;
|
|
||||||
line-height: 20px;
|
|
||||||
|
|
||||||
border: 1px solid silver;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.tab-setup .info dt {
|
.tab-setup .info dt {
|
||||||
float: left;
|
float: left;
|
||||||
|
|
||||||
|
|
|
@ -51,69 +51,4 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="COMPATIBILITY">
|
|
||||||
<div id="interactive_block">
|
|
||||||
<div id="canvas_wrapper">
|
|
||||||
<canvas id="canvas"></canvas>
|
|
||||||
</div>
|
|
||||||
<span class="model"></span>
|
|
||||||
<img class="modelMixDiagram" src="" alt="">
|
|
||||||
<span class="heading"></span>
|
|
||||||
<a class="reset" href="#" i18n="initialSetupButtonResetZaxis"></a>
|
|
||||||
</div>
|
|
||||||
<div class="block_wrapper">
|
|
||||||
<div class="throttle">
|
|
||||||
<span class="head" i18n="initialSetupThrottleHead"></span>
|
|
||||||
<div class="fields">
|
|
||||||
<dl>
|
|
||||||
<dt i18n="initialSetupMinimum"></dt><dd><input type="number" name="minthrottle" min="0" max="2000" /></dd>
|
|
||||||
<dt i18n="initialSetupMaximum"></dt><dd><input type="number" name="maxthrottle" min="0" max="2000" /></dd>
|
|
||||||
<dt i18n="initialSetupFailsafe"></dt><dd><input type="number" name="failsafe_throttle" min="0" max="2000" /></dd>
|
|
||||||
<dt i18n="initialSetupMinCommand"></dt><dd><input type="number" name="mincommand" min="0" max="2000" /></dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="battery">
|
|
||||||
<span class="head" i18n="initialSetupBatteryHead"></span>
|
|
||||||
<div class="fields">
|
|
||||||
<dl>
|
|
||||||
<dt i18n="initialSetupMinCellV"></dt><dd><input type="number" name="mincellvoltage" step="0.1" min="1" max="5" /></dd>
|
|
||||||
<dt i18n="initialSetupMaxCellV"></dt><dd><input type="number" name="maxcellvoltage" step="0.1" min="1" max="5" /></dd>
|
|
||||||
<dt i18n="initialSetupVoltageScale"></dt><dd><input type="number" name="voltagescale" step="1" min="10" max="200" /></dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="acc-trim">
|
|
||||||
<span class="head" i18n="initialSetupAccelTrimsHead"></span>
|
|
||||||
<div class="fields">
|
|
||||||
<dl>
|
|
||||||
<dt i18n="initialSetupPitch"></dt><dd><input type="number" name="pitch" min="-300" max="300" /></dd>
|
|
||||||
<dt i18n="initialSetupRoll"></dt><dd><input type="number" name="roll" min="-300" max="300" /></dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="magnetometer">
|
|
||||||
<span class="head" i18n="initialSetupMagHead"></span>
|
|
||||||
<div class="fields">
|
|
||||||
<dl>
|
|
||||||
<dt i18n="initialSetupDeclination"></dt><dd><input type="number" name="mag_declination" step="0.1" min="-180" max="180" /></dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="info">
|
|
||||||
<span class="head" i18n="initialSetupInfoHead"></span>
|
|
||||||
<div class="fields">
|
|
||||||
<dl>
|
|
||||||
<dt i18n="initialSetupBattery"></dt><dd class="bat-voltage">0 V</dd>
|
|
||||||
<dt i18n="initialSetupDrawn"></dt><dd class="bat-mah-drawn">0 mAh</dd>
|
|
||||||
<dt i18n="initialSetupDrawing"></dt><dd class="bat-mah-drawing">0 A</dd>
|
|
||||||
<dt i18n="initialSetupRSSI"></dt><dd class="rssi">0 %</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="buttons">
|
|
||||||
<a class="update" href="#" i18n="initialSetupButtonSave"></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
157
tabs/setup.js
157
tabs/setup.js
|
@ -17,11 +17,7 @@ TABS.setup.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_config() {
|
function load_config() {
|
||||||
if (bit_check(CONFIG.capability, 30)) {
|
MSP.send_message(MSP_codes.MSP_CONFIG, false, false, load_misc_data);
|
||||||
MSP.send_message(MSP_codes.MSP_CONFIG, false, false, load_misc_data);
|
|
||||||
} else {
|
|
||||||
load_misc_data();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_misc_data() {
|
function load_misc_data() {
|
||||||
|
@ -38,154 +34,11 @@ TABS.setup.initialize = function (callback) {
|
||||||
// translate to user-selected language
|
// translate to user-selected language
|
||||||
localize();
|
localize();
|
||||||
|
|
||||||
// if CAP_BASEFLIGHT_CONFIG (30)
|
// initialize 3D
|
||||||
if (bit_check(CONFIG.capability, 30)) {
|
self.initialize3D(false);
|
||||||
// current stuff, this will become default when the compatibility period ends
|
|
||||||
$('.CAP_BASEFLIGHT_CONFIG').show();
|
|
||||||
|
|
||||||
// initialize 3D
|
// set heading in interactive block
|
||||||
self.initialize3D(false);
|
$('span.heading').text(chrome.i18n.getMessage('initialSetupheading', [0]));
|
||||||
|
|
||||||
// set heading in interactive block
|
|
||||||
$('span.heading').text(chrome.i18n.getMessage('initialSetupheading', [0]));
|
|
||||||
} else {
|
|
||||||
// old stuff
|
|
||||||
$('.COMPATIBILITY').show();
|
|
||||||
|
|
||||||
// initialize 3D
|
|
||||||
self.initialize3D(true);
|
|
||||||
|
|
||||||
// Fill in misc stuff
|
|
||||||
$('input[name="mincellvoltage"]').val(MISC.vbatmincellvoltage);
|
|
||||||
$('input[name="maxcellvoltage"]').val(MISC.vbatmaxcellvoltage);
|
|
||||||
$('input[name="voltagescale"]').val(MISC.vbatscale);
|
|
||||||
|
|
||||||
$('input[name="minthrottle"]').val(MISC.minthrottle);
|
|
||||||
$('input[name="maxthrottle"]').val(MISC.maxthrottle);
|
|
||||||
$('input[name="failsafe_throttle"]').val(MISC.failsafe_throttle);
|
|
||||||
$('input[name="mincommand"]').val(MISC.mincommand);
|
|
||||||
|
|
||||||
$('input[name="mag_declination"]').val(MISC.mag_declination / 10);
|
|
||||||
|
|
||||||
// Fill in the accel trimms from CONFIG object
|
|
||||||
$('input[name="pitch"]').val(CONFIG.accelerometerTrims[0]);
|
|
||||||
$('input[name="roll"]').val(CONFIG.accelerometerTrims[1]);
|
|
||||||
|
|
||||||
// Display multiType and motor diagram (if such exist)
|
|
||||||
var str;
|
|
||||||
switch (CONFIG.multiType) {
|
|
||||||
case 1: // TRI
|
|
||||||
str = 'TRI';
|
|
||||||
$('.modelMixDiagram').attr('src', './resources/motor_order/tri.svg').addClass('modelMixTri');
|
|
||||||
break;
|
|
||||||
case 2: // QUAD +
|
|
||||||
str = 'Quad +';
|
|
||||||
$('.modelMixDiagram').attr('src', './resources/motor_order/quad_p.svg').addClass('modelMixQuadP');
|
|
||||||
break;
|
|
||||||
case 3: // QUAD X
|
|
||||||
str = 'Quad X';
|
|
||||||
$('.modelMixDiagram').attr('src', './resources/motor_order/quad_x.svg').addClass('modelMixQuadX');
|
|
||||||
break;
|
|
||||||
case 4: // BI
|
|
||||||
str = 'BI';
|
|
||||||
break;
|
|
||||||
case 5: // GIMBAL
|
|
||||||
str = 'Gimbal';
|
|
||||||
break;
|
|
||||||
case 6: // Y6
|
|
||||||
str = 'Y6';
|
|
||||||
$('.modelMixDiagram').attr('src', './resources/motor_order/y6.svg').addClass('modelMixY6');
|
|
||||||
break;
|
|
||||||
case 7: // HEX 6
|
|
||||||
str = 'HEX 6';
|
|
||||||
$('.modelMixDiagram').attr('src', './resources/motor_order/hex_p.svg').addClass('modelMixHex6P');
|
|
||||||
break;
|
|
||||||
case 8: // FLYING_WING
|
|
||||||
str = 'Flying Wing';
|
|
||||||
break;
|
|
||||||
case 9: // Y4
|
|
||||||
str = 'Y4';
|
|
||||||
$('.modelMixDiagram').attr('src', './resources/motor_order/y4.svg').addClass('modelMixY4');
|
|
||||||
break;
|
|
||||||
case 10: // HEX6 X
|
|
||||||
str = 'HEX6 X';
|
|
||||||
$('.modelMixDiagram').attr('src', './resources/motor_order/hex_x.svg').addClass('modelMixHex6X');
|
|
||||||
break;
|
|
||||||
case 11: // OCTO X8
|
|
||||||
case 12:
|
|
||||||
case 13:
|
|
||||||
str = 'OCTO X8';
|
|
||||||
$('.modelMixDiagram').attr('src', './resources/motor_order/octo_flat_x.svg').addClass('modelMixOctoX');
|
|
||||||
break;
|
|
||||||
case 14: // AIRPLANE
|
|
||||||
str = 'Airplane';
|
|
||||||
$('.modelMixDiagram').attr('src', './resources/motor_order/airplane.svg').addClass('modelMixAirplane');
|
|
||||||
break;
|
|
||||||
case 15: // Heli 120
|
|
||||||
str = 'Heli 120';
|
|
||||||
break;
|
|
||||||
case 16: // Heli 90
|
|
||||||
str = 'Heli 90';
|
|
||||||
break;
|
|
||||||
case 17: // Vtail
|
|
||||||
str = 'Vtail';
|
|
||||||
$('.modelMixDiagram').attr('src', './resources/motor_order/vtail_quad.svg').addClass('modelMixVtail');
|
|
||||||
break;
|
|
||||||
case 18: // HEX6 H
|
|
||||||
str = 'HEX6 H';
|
|
||||||
$('.modelMixDiagram').attr("src", './resources/motor_order/custom.svg').addClass('modelMixCustom');
|
|
||||||
break;
|
|
||||||
case 19: // PPM to SERVO
|
|
||||||
str = 'PPM to SERVO';
|
|
||||||
$('.modelMixDiagram').attr("src", './resources/motor_order/custom.svg').addClass('modelMixCustom');
|
|
||||||
break;
|
|
||||||
case 20: // Dualcopter
|
|
||||||
str = 'Dualcopter';
|
|
||||||
$('.modelMixDiagram').attr("src", './resources/motor_order/custom.svg').addClass('modelMixCustom');
|
|
||||||
break;
|
|
||||||
case 21: // Singlecopter
|
|
||||||
str = 'Singlecopter';
|
|
||||||
$('.modelMixDiagram').attr("src", './resources/motor_order/custom.svg').addClass('modelMixCustom');
|
|
||||||
break;
|
|
||||||
case 22: // Custom
|
|
||||||
str = 'Custom';
|
|
||||||
$('.modelMixDiagram').attr("src", './resources/motor_order/custom.svg').addClass('modelMixCustom');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$('span.model').text(chrome.i18n.getMessage('initialSetupModel', [str]));
|
|
||||||
|
|
||||||
// Heading
|
|
||||||
$('span.heading').text(chrome.i18n.getMessage('initialSetupheading', [0]));
|
|
||||||
|
|
||||||
$('a.update').click(function () {
|
|
||||||
CONFIG.accelerometerTrims[0] = parseInt($('input[name="pitch"]').val());
|
|
||||||
CONFIG.accelerometerTrims[1] = parseInt($('input[name="roll"]').val());
|
|
||||||
|
|
||||||
MISC.vbatmincellvoltage = parseFloat($('input[name="mincellvoltage"]').val()) * 10;
|
|
||||||
MISC.vbatmaxcellvoltage = parseFloat($('input[name="maxcellvoltage"]').val()) * 10;
|
|
||||||
MISC.vbatscale = parseInt($('input[name="voltagescale"]').val());
|
|
||||||
|
|
||||||
MISC.minthrottle = parseInt($('input[name="minthrottle"]').val());
|
|
||||||
MISC.maxthrottle = parseInt($('input[name="maxthrottle"]').val());
|
|
||||||
MISC.failsafe_throttle = parseInt($('input[name="failsafe_throttle"]').val());
|
|
||||||
MISC.mincommand = parseInt($('input[name="mincommand"]').val());
|
|
||||||
|
|
||||||
MISC.mag_declination = parseFloat($('input[name="mag_declination"]').val()) * 10;
|
|
||||||
|
|
||||||
function save_to_eeprom() {
|
|
||||||
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function () {
|
|
||||||
GUI.log(chrome.i18n.getMessage('initialSetupEepromSaved'));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send over the new trims
|
|
||||||
MSP.send_message(MSP_codes.MSP_SET_ACC_TRIM, MSP.crunch(MSP_codes.MSP_SET_ACC_TRIM));
|
|
||||||
|
|
||||||
// Send over new misc
|
|
||||||
MSP.send_message(MSP_codes.MSP_SET_MISC, MSP.crunch(MSP_codes.MSP_SET_MISC), false, save_to_eeprom);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if we have magnetometer
|
// check if we have magnetometer
|
||||||
if (!bit_check(CONFIG.activeSensors, 2)) {
|
if (!bit_check(CONFIG.activeSensors, 2)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue