Show model diagram on motors tab.

When testing motors it's more useful to have it present on the motors
tab so you don't have to keep cross-referencing the initial setup tab.
10.3.x-maintenance
Dominic Clifton 2014-09-04 02:59:31 +01:00
parent df491f9478
commit 79505e42ed
9 changed files with 138 additions and 106 deletions

84
js/model.js Normal file
View File

@ -0,0 +1,84 @@
'use strict';
function update_model(multiType) {
// Display multiType and motor diagram (if such exist)
var str = '';
switch (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;
}
$('span.model').text(chrome.i18n.getMessage('initialSetupModel', [str]));
};

View File

@ -116,6 +116,38 @@ input[type="number"]::-webkit-inner-spin-button {
margin: 3px 0 0 5px;
}
.modelPanel .model {
float: left;
height: 15px;
margin: 10px 0 0 10px;
font-weight: bold;
}
.modelPanel {
position: relative;
width:110px;
height: 150px;
float: left;
}
.modelPanel .modelMixDiagram {
position: absolute;
top: 32px;
left: 10px;
}
.modelPanel .modelMixAirplane { /* Position airplane correctly */
height: 35%;
padding-left: 0px;
}
.modelPanel .modelMixCustom { /* Position question mark correctly */
height: 20%; /* resize question mark */
padding-left: 25px;
}
#sensor-status {
float: right;

View File

@ -27,6 +27,7 @@
<script type="text/javascript" src="./js/serial.js"></script>
<script type="text/javascript" src="./js/usb.js"></script>
<script type="text/javascript" src="./js/gui.js"></script>
<script type="text/javascript" src="./js/model.js"></script>
<script type="text/javascript" src="./js/request_balancer.js"></script>
<script type="text/javascript" src="./js/serial_backend.js"></script>
<script type="text/javascript" src="./js/data_storage.js"></script>

View File

@ -53,33 +53,11 @@
border: 1px solid silver;
background-color: white;
}
#interactive_block .model {
float: left;
height: 15px;
margin: 10px 0 0 10px;
font-weight: bold;
}
#interactive_block .modelMixDiagram {
#interactive_block .modelPanel {
position: absolute;
top: 32px;
left: 10px;
height: 30%; /* interactive_block height set to inherit */
}
#interactive_block .modelMixAirplane { /* Position airplane correctly */
height: 35%;
padding-left: 0px;
}
#interactive_block .modelMixCustom { /* Position question mark correctly */
height: 20%; /* resize question mark */
padding-left: 25px;
}
#interactive_block .heading {
float: right;
height: 15px;

View File

@ -21,8 +21,10 @@
</p>
</div>
<div id="interactive_block">
<span class="model"></span>
<img class="modelMixDiagram" src="" alt="">
<div class="modelPanel">
<span class="model"></span>
<img class="modelMixDiagram" src="" alt="">
</div>
<span class="heading"></span>
<div class="clear-both"></div>
<a class="reset" href="#" i18n="initialSetupButtonResetZaxis"></a>

View File

@ -44,86 +44,8 @@ TABS.initial_setup.initialize = function (callback) {
$('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;
}
$('span.model').text(chrome.i18n.getMessage('initialSetupModel', [str]));
update_model(CONFIG.multiType);
// Heading
$('span.heading').text(chrome.i18n.getMessage('initialSetupheading', [0]));

View File

@ -1,3 +1,8 @@
.wrapper.accelAndModel .wrapper.accel {
float: left;
width: calc(100% - 110px);
}
.tab-motor_outputs .plot_control {
float: right;

View File

@ -1,4 +1,9 @@
<div class="tab-motor_outputs">
<div class="wrapper accelAndModel">
<div class="modelPanel">
<span class="model"></span>
<img class="modelMixDiagram" src="" alt="">
</div>
<div class="wrapper accel">
<div class="plot_control">
<div class="title">Accelerometer - <a class="reset_accel_max" href="#" title="Reset overtime maximum">[Reset]</a></div>
@ -44,6 +49,7 @@
</svg>
<div class="clear-both"></div>
</div>
</div>
<div class="left motors">
<div class="title">Motors</div>
<ul class="titles">

View File

@ -138,6 +138,8 @@ TABS.motor_outputs.initialize = function (callback) {
// translate to user-selected language
localize();
update_model(CONFIG.multiType);
// Always start with default/empty sensor data array, clean slate all
initSensorData();