mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-17 21:35:44 +03:00
first CAP_BASEFLIGHT_CONFIG implementation (unfinished) for initial tab, including temporary backwards compatibility support
This commit is contained in:
parent
df738f9daf
commit
875f3bfa15
3 changed files with 484 additions and 211 deletions
|
@ -1,3 +1,14 @@
|
|||
/* temporary styles that are used during compatibility period */
|
||||
.tab-initial_setup .CAP_BASEFLIGHT_CONFIG,
|
||||
.tab-initial_setup .COMPATIBILITY {
|
||||
display: none;
|
||||
height: calc(100% - 142px);
|
||||
}
|
||||
.tab-initial_setup .CAP_BASEFLIGHT_CONFIG #interactive_block {
|
||||
width: calc(100% - 411px);
|
||||
}
|
||||
/* temporary styles end*/
|
||||
|
||||
.tab-initial_setup {
|
||||
height: 100%;
|
||||
}
|
||||
|
@ -48,7 +59,7 @@
|
|||
float: left;
|
||||
position: relative;
|
||||
|
||||
height: calc(100% - 142px);
|
||||
height: 100%;
|
||||
width: calc(100% - 522px);
|
||||
|
||||
border: 1px solid silver;
|
||||
|
@ -119,6 +130,55 @@
|
|||
.tab-initial_setup .block_wrapper {
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
.tab-initial_setup .block {
|
||||
float: left;
|
||||
display: block;
|
||||
|
||||
margin-left: 10px;
|
||||
|
||||
border: 1px solid silver;
|
||||
}
|
||||
.tab-initial_setup .block .head {
|
||||
display: block;
|
||||
|
||||
text-align: center;
|
||||
line-height: 20px;
|
||||
font-weight: bold;
|
||||
|
||||
border-bottom: 1px solid silver;
|
||||
background-color: #ececec;
|
||||
}
|
||||
.tab-initial_setup .mixer {
|
||||
width: 200px;
|
||||
}
|
||||
.tab-initial_setup .mixer .preview {
|
||||
display: block;
|
||||
|
||||
width: 200px;
|
||||
height: 140px;
|
||||
|
||||
margin: 5px 0 5px 0;
|
||||
}
|
||||
.tab-initial_setup .mixer select {
|
||||
display: block;
|
||||
|
||||
padding-left: 5px;
|
||||
|
||||
width: 100%;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
|
||||
font-weight: bold;
|
||||
|
||||
border-top: 1px solid silver;
|
||||
}
|
||||
.tab-initial_setup .block .info {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.tab-initial_setup .battery,
|
||||
.tab-initial_setup .throttle,
|
||||
.tab-initial_setup .acc-trim,
|
||||
|
|
|
@ -20,55 +20,44 @@
|
|||
<p i18n="initialSetupBackupRestoreText">
|
||||
</p>
|
||||
</div>
|
||||
<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="1000" max="2000" /></dd>
|
||||
<dt i18n="initialSetupMinCommand"></dt><dd><input type="number" name="mincommand" min="0" max="2000" /></dd>
|
||||
</dl>
|
||||
<div class="CAP_BASEFLIGHT_CONFIG">
|
||||
<div id="interactive_block">
|
||||
<div id="canvas_wrapper">
|
||||
<canvas id="canvas"></canvas>
|
||||
</div>
|
||||
<span class="model"></span>
|
||||
<span class="heading"></span>
|
||||
<a class="reset" href="#" i18n="initialSetupButtonResetZaxis"></a>
|
||||
</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 class="block mixer">
|
||||
<span class="head" i18n="initialSetupMixerHead"></span>
|
||||
<img class="preview" src="" />
|
||||
<select name="mixer">
|
||||
<option value="1">TRI</option>
|
||||
<option value="2">Quad +</option>
|
||||
<option value="3">Quad X</option>
|
||||
<option value="4">BI</option>
|
||||
<option value="5">Gimbal</option>
|
||||
<option value="6">Y 6</option>
|
||||
<option value="7">HEX 6</option>
|
||||
<option value="8">Flying Wing</option>
|
||||
<option value="9">Y 4</option>
|
||||
<option value="10">HEX 6 X</option>
|
||||
<option value="11">OCTO X8</option>
|
||||
<option value="12">OCTO X8 - TODO</option>
|
||||
<option value="13">OCTO X8 - TODO</option>
|
||||
<option value="14">Airplane</option>
|
||||
<option value="15">Heli 120</option>
|
||||
<option value="16">Heli 90</option>
|
||||
<option value="17">Vtail</option>
|
||||
<option value="18">Hex 6 H</option>
|
||||
<option value="19">PPM to SERVO</option>
|
||||
<option value="20">Dualcopter</option>
|
||||
<option value="21">Singlecopter</option>
|
||||
<option value="22">Custom</option>
|
||||
</select>
|
||||
</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">
|
||||
<div class="block info">
|
||||
<span class="head" i18n="initialSetupInfoHead"></span>
|
||||
<div class="fields">
|
||||
<dl>
|
||||
|
@ -80,6 +69,68 @@
|
|||
</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="1000" 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>
|
||||
<div class="buttons">
|
||||
<a class="update" href="#" i18n="initialSetupButtonSave"></a>
|
||||
</div>
|
||||
|
|
|
@ -11,7 +11,15 @@ TABS.initial_setup.initialize = function (callback) {
|
|||
googleAnalytics.sendAppView('Initial Setup');
|
||||
|
||||
function load_ident() {
|
||||
MSP.send_message(MSP_codes.MSP_IDENT, false, false, load_misc_data);
|
||||
MSP.send_message(MSP_codes.MSP_IDENT, false, false, load_config);
|
||||
}
|
||||
|
||||
function load_config() {
|
||||
if (bit_check(CONFIG.capability, 30)) {
|
||||
MSP.send_message(MSP_codes.MSP_CONFIG, false, false, load_misc_data);
|
||||
} else {
|
||||
load_misc_data();
|
||||
}
|
||||
}
|
||||
|
||||
function load_misc_data() {
|
||||
|
@ -28,112 +36,320 @@ TABS.initial_setup.initialize = function (callback) {
|
|||
// translate to user-selected language
|
||||
localize();
|
||||
|
||||
// initialize 3D
|
||||
self.initialize3D();
|
||||
// if CAP_BASEFLIGHT_CONFIG (30)
|
||||
if (bit_check(CONFIG.capability, 30)) {
|
||||
// current stuff, this will become default when the compatibility period ends
|
||||
$('.CAP_BASEFLIGHT_CONFIG').show();
|
||||
|
||||
// Fill in misc stuff
|
||||
$('input[name="mincellvoltage"]').val(MISC.vbatmincellvoltage);
|
||||
$('input[name="maxcellvoltage"]').val(MISC.vbatmaxcellvoltage);
|
||||
$('input[name="voltagescale"]').val(MISC.vbatscale);
|
||||
// initialize 3D
|
||||
self.initialize3D(false);
|
||||
|
||||
$('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);
|
||||
// Display multiType and motor diagram (if such exist)
|
||||
var str;
|
||||
switch (CONFIG.multiType) {
|
||||
case 1: // TRI
|
||||
str = 'TRI';
|
||||
break;
|
||||
case 2: // QUAD +
|
||||
str = 'Quad +';
|
||||
break;
|
||||
case 3: // QUAD X
|
||||
str = 'Quad X';
|
||||
break;
|
||||
case 4: // BI
|
||||
str = 'BI';
|
||||
break;
|
||||
case 5: // GIMBAL
|
||||
str = 'Gimbal';
|
||||
break;
|
||||
case 6: // Y6
|
||||
str = 'Y6';
|
||||
break;
|
||||
case 7: // HEX 6
|
||||
str = 'HEX 6';
|
||||
break;
|
||||
case 8: // FLYING_WING
|
||||
str = 'Flying Wing';
|
||||
break;
|
||||
case 9: // Y4
|
||||
str = 'Y4';
|
||||
break;
|
||||
case 10: // HEX6 X
|
||||
str = 'HEX6 X';
|
||||
break;
|
||||
case 11: // OCTO X8
|
||||
case 12:
|
||||
case 13:
|
||||
str = 'OCTO X8';
|
||||
break;
|
||||
case 14: // AIRPLANE
|
||||
str = 'Airplane';
|
||||
break;
|
||||
case 15: // Heli 120
|
||||
str = 'Heli 120';
|
||||
break;
|
||||
case 16: // Heli 90
|
||||
str = 'Heli 90';
|
||||
break;
|
||||
case 17: // Vtail
|
||||
str = 'Vtail';
|
||||
break;
|
||||
case 18: // HEX6 H
|
||||
str = 'HEX6 H';
|
||||
break;
|
||||
case 19: // PPM to SERVO
|
||||
str = 'PPM to SERVO';
|
||||
break;
|
||||
case 20: // Dualcopter
|
||||
str = 'Dualcopter';
|
||||
break;
|
||||
case 21: // Singlecopter
|
||||
str = 'Singlecopter';
|
||||
break;
|
||||
case 22: // Custom
|
||||
str = 'Custom';
|
||||
break;
|
||||
}
|
||||
|
||||
$('input[name="mag_declination"]').val(MISC.mag_declination / 10);
|
||||
// set model name in interactive block
|
||||
$('span.model').text(chrome.i18n.getMessage('initialSetupModel', [str]));
|
||||
|
||||
// Fill in the accel trimms from CONFIG object
|
||||
$('input[name="pitch"]').val(CONFIG.accelerometerTrims[0]);
|
||||
$('input[name="roll"]').val(CONFIG.accelerometerTrims[1]);
|
||||
// set heading in interactive block
|
||||
$('span.heading').text(chrome.i18n.getMessage('initialSetupheading', [0]));
|
||||
|
||||
// Display multiType and motor diagram (if such exist)
|
||||
var str = '';
|
||||
switch (CONFIG.multiType) {
|
||||
case 1: // TRI
|
||||
str = 'TRI';
|
||||
$('.modelMixDiagram').attr('src', './images/motor_order/tri.svg').addClass('modelMixTri');
|
||||
break;
|
||||
case 2: // QUAD +
|
||||
str = 'Quad +';
|
||||
$('.modelMixDiagram').attr('src', './images/motor_order/quadp.svg').addClass('modelMixQuadP');
|
||||
break;
|
||||
case 3: // QUAD X
|
||||
str = 'Quad X';
|
||||
$('.modelMixDiagram').attr('src', './images/motor_order/quadx.svg').addClass('modelMixQuadX');
|
||||
break;
|
||||
case 4: // BI
|
||||
str = 'BI';
|
||||
break;
|
||||
case 5: // GIMBAL
|
||||
str = 'Gimbal';
|
||||
break;
|
||||
case 6: // Y6
|
||||
str = 'Y6';
|
||||
$('.modelMixDiagram').attr('src', './images/motor_order/y6.svg').addClass('modelMixY6');
|
||||
break;
|
||||
case 7: // HEX 6
|
||||
str = 'HEX 6';
|
||||
$('.modelMixDiagram').attr('src', './images/motor_order/hex6p.svg').addClass('modelMixHex6P');
|
||||
break;
|
||||
case 8: // FLYING_WING
|
||||
str = 'Flying Wing';
|
||||
break;
|
||||
case 9: // Y4
|
||||
str = 'Y4';
|
||||
$('.modelMixDiagram').attr('src', './images/motor_order/y4.svg').addClass('modelMixY4');
|
||||
break;
|
||||
case 10: // HEX6 X
|
||||
str = 'HEX6 X';
|
||||
$('.modelMixDiagram').attr('src', './images/motor_order/hex6x.svg').addClass('modelMixHex6X');
|
||||
break;
|
||||
case 11: // OCTO X8
|
||||
case 12:
|
||||
case 13:
|
||||
str = 'OCTO X8';
|
||||
$('.modelMixDiagram').attr('src', './images/motor_order/octox.svg').addClass('modelMixOctoX');
|
||||
break;
|
||||
case 14: // AIRPLANE
|
||||
str = 'Airplane';
|
||||
$('.modelMixDiagram').attr('src', './images/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', './images/motor_order/vtail.svg').addClass('modelMixVtail');
|
||||
break;
|
||||
case 18: // HEX6 H
|
||||
str = 'HEX6 H';
|
||||
$('.modelMixDiagram').attr("src", './images/motor_order/custom.svg').addClass('modelMixCustom');
|
||||
break;
|
||||
case 19: // PPM to SERVO
|
||||
str = 'PPM to SERVO';
|
||||
$('.modelMixDiagram').attr("src", './images/motor_order/custom.svg').addClass('modelMixCustom');
|
||||
break;
|
||||
case 20: // Dualcopter
|
||||
str = 'Dualcopter';
|
||||
$('.modelMixDiagram').attr("src", './images/motor_order/custom.svg').addClass('modelMixCustom');
|
||||
break;
|
||||
case 21: // Singlecopter
|
||||
str = 'Singlecopter';
|
||||
$('.modelMixDiagram').attr("src", './images/motor_order/custom.svg').addClass('modelMixCustom');
|
||||
break;
|
||||
case 22: // Custom
|
||||
str = 'Custom';
|
||||
$('.modelMixDiagram').attr("src", './images/motor_order/custom.svg').addClass('modelMixCustom');
|
||||
break;
|
||||
// UI hook handling mixer type change that swaps the image representation
|
||||
$('.mixer select').change(function () {
|
||||
var val = $(this).val();
|
||||
|
||||
var imageArray = [
|
||||
'custom', // there is no type 0, we will use custom image as spacer
|
||||
'tri',
|
||||
'quadp',
|
||||
'quadx',
|
||||
'custom', // bi
|
||||
'custom', // gimbal
|
||||
'y6',
|
||||
'hex6p',
|
||||
'custom', // flying wing
|
||||
'y4',
|
||||
'hex6x',
|
||||
'octox',
|
||||
'octox',
|
||||
'octox',
|
||||
'airplane',
|
||||
'custom',
|
||||
'custom',
|
||||
'vtail',
|
||||
'custom',
|
||||
'custom',
|
||||
'custom',
|
||||
'custom',
|
||||
'custom',
|
||||
];
|
||||
|
||||
$('.mixer .preview').attr('src', './images/motor_order/' + imageArray[val] + '.svg');
|
||||
});
|
||||
|
||||
// update mixer type with current value
|
||||
$('.mixer select').val(BF_CONFIG.mixerConfiguration).change();
|
||||
|
||||
// save
|
||||
$('a.update').click(function () {
|
||||
// update object
|
||||
BF_CONFIG.mixerConfiguration = parseInt($('.mixer select').val());
|
||||
|
||||
function save_to_eeprom() {
|
||||
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, reboot);
|
||||
}
|
||||
|
||||
function reboot() {
|
||||
GUI.log(chrome.i18n.getMessage('initialSetupEepromSaved'));
|
||||
GUI.tab_switch_cleanup();
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_SET_REBOOT, false, false, reinitialize);
|
||||
}
|
||||
|
||||
function reinitialize() {
|
||||
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_IDENT, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('deviceReady'));
|
||||
TABS.initial_setup.initialize();
|
||||
});
|
||||
}
|
||||
|
||||
MSP.send_message(MSP_codes.MSP_SET_CONFIG, MSP.crunch('BF_CONFIG'), false, save_to_eeprom); // TODO reply byte is missing on the firmware side so this is where it fails
|
||||
});
|
||||
} 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', './images/motor_order/tri.svg').addClass('modelMixTri');
|
||||
break;
|
||||
case 2: // QUAD +
|
||||
str = 'Quad +';
|
||||
$('.modelMixDiagram').attr('src', './images/motor_order/quadp.svg').addClass('modelMixQuadP');
|
||||
break;
|
||||
case 3: // QUAD X
|
||||
str = 'Quad X';
|
||||
$('.modelMixDiagram').attr('src', './images/motor_order/quadx.svg').addClass('modelMixQuadX');
|
||||
break;
|
||||
case 4: // BI
|
||||
str = 'BI';
|
||||
break;
|
||||
case 5: // GIMBAL
|
||||
str = 'Gimbal';
|
||||
break;
|
||||
case 6: // Y6
|
||||
str = 'Y6';
|
||||
$('.modelMixDiagram').attr('src', './images/motor_order/y6.svg').addClass('modelMixY6');
|
||||
break;
|
||||
case 7: // HEX 6
|
||||
str = 'HEX 6';
|
||||
$('.modelMixDiagram').attr('src', './images/motor_order/hex6p.svg').addClass('modelMixHex6P');
|
||||
break;
|
||||
case 8: // FLYING_WING
|
||||
str = 'Flying Wing';
|
||||
break;
|
||||
case 9: // Y4
|
||||
str = 'Y4';
|
||||
$('.modelMixDiagram').attr('src', './images/motor_order/y4.svg').addClass('modelMixY4');
|
||||
break;
|
||||
case 10: // HEX6 X
|
||||
str = 'HEX6 X';
|
||||
$('.modelMixDiagram').attr('src', './images/motor_order/hex6x.svg').addClass('modelMixHex6X');
|
||||
break;
|
||||
case 11: // OCTO X8
|
||||
case 12:
|
||||
case 13:
|
||||
str = 'OCTO X8';
|
||||
$('.modelMixDiagram').attr('src', './images/motor_order/octox.svg').addClass('modelMixOctoX');
|
||||
break;
|
||||
case 14: // AIRPLANE
|
||||
str = 'Airplane';
|
||||
$('.modelMixDiagram').attr('src', './images/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', './images/motor_order/vtail.svg').addClass('modelMixVtail');
|
||||
break;
|
||||
case 18: // HEX6 H
|
||||
str = 'HEX6 H';
|
||||
$('.modelMixDiagram').attr("src", './images/motor_order/custom.svg').addClass('modelMixCustom');
|
||||
break;
|
||||
case 19: // PPM to SERVO
|
||||
str = 'PPM to SERVO';
|
||||
$('.modelMixDiagram').attr("src", './images/motor_order/custom.svg').addClass('modelMixCustom');
|
||||
break;
|
||||
case 20: // Dualcopter
|
||||
str = 'Dualcopter';
|
||||
$('.modelMixDiagram').attr("src", './images/motor_order/custom.svg').addClass('modelMixCustom');
|
||||
break;
|
||||
case 21: // Singlecopter
|
||||
str = 'Singlecopter';
|
||||
$('.modelMixDiagram').attr("src", './images/motor_order/custom.svg').addClass('modelMixCustom');
|
||||
break;
|
||||
case 22: // Custom
|
||||
str = 'Custom';
|
||||
$('.modelMixDiagram').attr("src", './images/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());
|
||||
|
||||
var buffer_out = new Array();
|
||||
buffer_out[0] = lowByte(CONFIG.accelerometerTrims[0]);
|
||||
buffer_out[1] = highByte(CONFIG.accelerometerTrims[0]);
|
||||
buffer_out[2] = lowByte(CONFIG.accelerometerTrims[1]);
|
||||
buffer_out[3] = highByte(CONFIG.accelerometerTrims[1]);
|
||||
|
||||
// Send over the new trims
|
||||
MSP.send_message(MSP_codes.MSP_SET_ACC_TRIM, buffer_out);
|
||||
|
||||
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;
|
||||
|
||||
// we also have to fill the unsupported bytes
|
||||
var buffer_out = new Array();
|
||||
buffer_out[0] = 0; // powerfailmeter
|
||||
buffer_out[1] = 0;
|
||||
buffer_out[2] = lowByte(MISC.minthrottle);
|
||||
buffer_out[3] = highByte(MISC.minthrottle);
|
||||
buffer_out[4] = lowByte(MISC.maxthrottle);
|
||||
buffer_out[5] = highByte(MISC.maxthrottle);
|
||||
buffer_out[6] = lowByte(MISC.mincommand);
|
||||
buffer_out[7] = highByte(MISC.mincommand);
|
||||
buffer_out[8] = lowByte(MISC.failsafe_throttle);
|
||||
buffer_out[9] = highByte(MISC.failsafe_throttle);
|
||||
buffer_out[10] = 0;
|
||||
buffer_out[11] = 0;
|
||||
buffer_out[12] = 0;
|
||||
buffer_out[13] = 0;
|
||||
buffer_out[14] = 0;
|
||||
buffer_out[15] = 0;
|
||||
buffer_out[16] = lowByte(MISC.mag_declination);
|
||||
buffer_out[17] = highByte(MISC.mag_declination);
|
||||
buffer_out[18] = MISC.vbatscale;
|
||||
buffer_out[19] = MISC.vbatmincellvoltage;
|
||||
buffer_out[20] = MISC.vbatmaxcellvoltage;
|
||||
buffer_out[21] = 0; // vbatlevel_crit (unused)
|
||||
|
||||
// Send over new misc
|
||||
MSP.send_message(MSP_codes.MSP_SET_MISC, buffer_out, false, save_to_eeprom);
|
||||
|
||||
function save_to_eeprom() {
|
||||
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('initialSetupEepromSaved'));
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('span.model').text(chrome.i18n.getMessage('initialSetupModel', [str]));
|
||||
|
||||
// Heading
|
||||
$('span.heading').text(chrome.i18n.getMessage('initialSetupheading', [0]));
|
||||
|
||||
// UI Hooks
|
||||
$('a.calibrateAccel').click(function () {
|
||||
var self = $(this);
|
||||
|
@ -185,66 +401,6 @@ TABS.initial_setup.initialize = function (callback) {
|
|||
});
|
||||
});
|
||||
|
||||
|
||||
$('a.update').click(function () {
|
||||
CONFIG.accelerometerTrims[0] = parseInt($('input[name="pitch"]').val());
|
||||
CONFIG.accelerometerTrims[1] = parseInt($('input[name="roll"]').val());
|
||||
|
||||
var buffer_out = new Array();
|
||||
buffer_out[0] = lowByte(CONFIG.accelerometerTrims[0]);
|
||||
buffer_out[1] = highByte(CONFIG.accelerometerTrims[0]);
|
||||
buffer_out[2] = lowByte(CONFIG.accelerometerTrims[1]);
|
||||
buffer_out[3] = highByte(CONFIG.accelerometerTrims[1]);
|
||||
|
||||
// Send over the new trims
|
||||
MSP.send_message(MSP_codes.MSP_SET_ACC_TRIM, buffer_out);
|
||||
|
||||
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;
|
||||
|
||||
// we also have to fill the unsupported bytes
|
||||
var buffer_out = new Array();
|
||||
buffer_out[0] = 0; // powerfailmeter
|
||||
buffer_out[1] = 0;
|
||||
buffer_out[2] = lowByte(MISC.minthrottle);
|
||||
buffer_out[3] = highByte(MISC.minthrottle);
|
||||
buffer_out[4] = lowByte(MISC.maxthrottle);
|
||||
buffer_out[5] = highByte(MISC.maxthrottle);
|
||||
buffer_out[6] = lowByte(MISC.mincommand);
|
||||
buffer_out[7] = highByte(MISC.mincommand);
|
||||
buffer_out[8] = lowByte(MISC.failsafe_throttle);
|
||||
buffer_out[9] = highByte(MISC.failsafe_throttle);
|
||||
buffer_out[10] = 0;
|
||||
buffer_out[11] = 0;
|
||||
buffer_out[12] = 0;
|
||||
buffer_out[13] = 0;
|
||||
buffer_out[14] = 0;
|
||||
buffer_out[15] = 0;
|
||||
buffer_out[16] = lowByte(MISC.mag_declination);
|
||||
buffer_out[17] = highByte(MISC.mag_declination);
|
||||
buffer_out[18] = MISC.vbatscale;
|
||||
buffer_out[19] = MISC.vbatmincellvoltage;
|
||||
buffer_out[20] = MISC.vbatmaxcellvoltage;
|
||||
buffer_out[21] = 0; // vbatlevel_crit (unused)
|
||||
|
||||
// Send over new misc
|
||||
MSP.send_message(MSP_codes.MSP_SET_MISC, buffer_out, false, save_to_eeprom);
|
||||
|
||||
function save_to_eeprom() {
|
||||
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function () {
|
||||
GUI.log(chrome.i18n.getMessage('initialSetupEepromSaved'));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// display current yaw fix value (important during tab re-initialization)
|
||||
$('div#interactive_block > a.reset').text(chrome.i18n.getMessage('initialSetupButtonResetZaxisValue', [self.yaw_fix]));
|
||||
|
||||
|
@ -286,7 +442,7 @@ TABS.initial_setup.initialize = function (callback) {
|
|||
GUI.interval_add('initial_setup_data_pull', get_analog_data, 50, true);
|
||||
|
||||
// status data pulled via separate timer with static speed
|
||||
GUI.interval_add('status_pull', function () {
|
||||
GUI.interval_add('status_pull', function status_pull () {
|
||||
MSP.send_message(MSP_codes.MSP_STATUS);
|
||||
}, 250, true);
|
||||
|
||||
|
@ -294,10 +450,16 @@ TABS.initial_setup.initialize = function (callback) {
|
|||
}
|
||||
};
|
||||
|
||||
TABS.initial_setup.initialize3D = function () {
|
||||
TABS.initial_setup.initialize3D = function (compatibility) {
|
||||
var self = this;
|
||||
var canvas = $('#canvas');
|
||||
var wrapper = $('#canvas_wrapper');
|
||||
|
||||
if (compatibility) {
|
||||
var canvas = $('.COMPATIBILITY #canvas');
|
||||
var wrapper = $('.COMPATIBILITY #canvas_wrapper');
|
||||
} else {
|
||||
var canvas = $('.CAP_BASEFLIGHT_CONFIG #canvas');
|
||||
var wrapper = $('.CAP_BASEFLIGHT_CONFIG #canvas_wrapper');
|
||||
}
|
||||
|
||||
var camera = new THREE.PerspectiveCamera(50, wrapper.width() / wrapper.height(), 1, 10000);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue