Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/iNavFlight/inav-configurator.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPawel Spychalski (DzikuVx) <pspychalski@gmail.com>2018-05-07 21:32:56 +0300
committerPawel Spychalski (DzikuVx) <pspychalski@gmail.com>2018-05-07 21:32:56 +0300
commit55385f5831ca316cb73d6d94eda1a73de6b71c64 (patch)
treebb49799f17c3455e5fb1e9909c1c284cab7e61ba
parentcf176f220123926d2b8c0b1310a7603210c08f5b (diff)
Servo tab cleanup
-rw-r--r--js/fc.js9
-rw-r--r--main.css4
-rw-r--r--src/css/tabs/servos.css16
-rwxr-xr-xtabs/servos.html2
-rwxr-xr-xtabs/servos.js63
5 files changed, 45 insertions, 49 deletions
diff --git a/js/fc.js b/js/fc.js
index d8375dcf..4b19d52b 100644
--- a/js/fc.js
+++ b/js/fc.js
@@ -507,10 +507,15 @@ var FC = {
{bit: 15, group: 'other', name: 'RSSI_ADC', haveTip: true, showNameInTip: true},
{bit: 16, group: 'other', name: 'LED_STRIP', showNameInTip: true},
{bit: 17, group: 'other', name: 'DISPLAY', showNameInTip: true},
- {bit: 19, group: 'other', name: 'BLACKBOX', haveTip: true, showNameInTip: true},
- {bit: 20, group: 'other', name: 'CHANNEL_FORWARDING', showNameInTip: true}
+ {bit: 19, group: 'other', name: 'BLACKBOX', haveTip: true, showNameInTip: true}
];
+ if (semver.lt(CONFIG.flightControllerVersion, "2.0.0")) {
+ features.push(
+ {bit: 20, group: 'other', name: 'CHANNEL_FORWARDING', showNameInTip: true}
+ );
+ }
+
if (semver.lt(CONFIG.flightControllerVersion, "1.6.0")) {
features.push(
{bit: 2, group: 'other', name: 'INFLIGHT_ACC_CAL', showNameInTip: true},
diff --git a/main.css b/main.css
index f83a90ac..d81d2981 100644
--- a/main.css
+++ b/main.css
@@ -2026,4 +2026,8 @@ select {
.position-relative {
position: relative;
+}
+
+.text-center {
+ text-align: center;
} \ No newline at end of file
diff --git a/src/css/tabs/servos.css b/src/css/tabs/servos.css
index 5b1694f7..935656b2 100644
--- a/src/css/tabs/servos.css
+++ b/src/css/tabs/servos.css
@@ -50,22 +50,6 @@
background-color: #f9f9f9;
}
-.tab-servos table td:nth-child(2) {
- width: 140px;
-}
-
-.tab-servos table td:nth-child(3) {
- width: 140px;
-}
-
-.tab-servos table td:nth-child(4) {
- width: 140px;
-}
-
-.tab-servos table td:nth-child(19) {
- width: 110px;
-}
-
.tab-servos table .main {
font-weight: bold;
text-align: center;
diff --git a/tabs/servos.html b/tabs/servos.html
index d16dd4a3..3e7e6d61 100755
--- a/tabs/servos.html
+++ b/tabs/servos.html
@@ -5,7 +5,7 @@
<a id="button-documentation" href="" target="_blank"></a>
</div>
<div>
- <div class="title" data-i18n="servosChangeDirection"></div>
+ <!-- <div class="title" data-i18n="servosChangeDirection"></div> -->
<table id="servo-config-table" class="fields">
<tr class="main">
<th width="110px" data-i18n="servosName"></th>
diff --git a/tabs/servos.js b/tabs/servos.js
index cbd09b65..88641fc6 100755
--- a/tabs/servos.js
+++ b/tabs/servos.js
@@ -51,64 +51,67 @@ TABS.servos.initialize = function (callback) {
let servoCheckbox = '',
servoHeader = '';
- for (i = 0; i < RC.active_channels - 4; i++) {
- servoHeader = servoHeader + '<th class="short">CH' + (i + 5) + '</th>';
- }
- servoHeader = servoHeader + '<th data-i18n="servosDirectionAndRate"></th>';
+ if (semver.lt(CONFIG.flightControllerVersion, "2.0.0")) {
+ for (i = 0; i < RC.active_channels - 4; i++) {
+ servoHeader = servoHeader + '<th class="short">CH' + (i + 5) + '</th>';
+ }
+ servoHeader = servoHeader + '<th data-i18n="servosDirectionAndRate"></th>';
- for (i = 0; i < RC.active_channels; i++) {
- servoCheckbox = servoCheckbox + '<td class="channel"><input type="checkbox"/></td>';
- }
+ for (i = 0; i < RC.active_channels; i++) {
+ servoCheckbox = servoCheckbox + '<td class="channel"><input type="checkbox"/></td>';
+ }
- $servoConfigTable.find('tr.main').append(servoHeader);
+ $servoConfigTable.find('tr.main').append(servoHeader);
+ } else {
+ $servoConfigTable.find('tr.main').html('\
+ <th width="110px" data-i18n="servosName"></th>\
+ <th data-i18n="servosMid"></th>\
+ <th data-i18n="servosMin"></th>\
+ <th data-i18n="servosMax"></th>\
+ <th data-i18n="servosDirectionAndRate"></th>\
+ ');
+ }
function process_servos(name, alternate, obj) {
$servoConfigTable.append('\
<tr> \
- <td style="text-align: center">' + name + '</td>\
+ <td class="text-center">' + name + '</td>\
<td class="middle"><input type="number" min="500" max="2500" value="' + SERVO_CONFIG[obj].middle + '" /></td>\
<td class="min"><input type="number" min="500" max="2500" value="' + SERVO_CONFIG[obj].min + '" /></td>\
<td class="max"><input type="number" min="500" max="2500" value="' + SERVO_CONFIG[obj].max + '" /></td>\
' + servoCheckbox + '\
- <td class="direction">\
+ <td class="text-center direction">\
</td>\
</tr> \
');
+ //This routine is pre 2.0 only
if (SERVO_CONFIG[obj].indexOfChannelToForward >= 0) {
$servoConfigTable.find('tr:last td.channel input').eq(SERVO_CONFIG[obj].indexOfChannelToForward).prop('checked', true);
}
// adding select box and generating options
- $servoConfigTable.find('tr:last td.direction').append('<select class="rate" name="rate"></select>');
-
- var select = $servoConfigTable.find('tr:last td.direction select');
-
- for (var i = FC.MAX_SERVO_RATE; i >= FC.MIN_SERVO_RATE; i--) {
- select.append('<option value="' + i + '">Rate: ' + i + '%</option>');
- }
-
- // select current rate
- select.val(SERVO_CONFIG[obj].rate);
+ $servoConfigTable.find('tr:last td.direction').append(
+ '<input class="rate-input" type="number" min="' + FC.MIN_SERVO_RATE + '" max="' + FC.MAX_SERVO_RATE + '" value="' + SERVO_CONFIG[obj].rate + '" />'
+ );
$servoConfigTable.find('tr:last').data('info', { 'obj': obj });
- // UI hooks
-
- // only one checkbox for indicating a channel to forward can be selected at a time, perhaps a radio group would be best here.
- $servoConfigTable.find('tr:last td.channel input').click(function () {
- if ($(this).is(':checked')) {
- $(this).parent().parent().find('.channel input').not($(this)).prop('checked', false);
- }
- });
+ if (semver.lt(CONFIG.flightControllerVersion, "2.0.0")) {
+ // only one checkbox for indicating a channel to forward can be selected at a time, perhaps a radio group would be best here.
+ $servoConfigTable.find('tr:last td.channel input').click(function () {
+ if ($(this).is(':checked')) {
+ $(this).parent().parent().find('.channel input').not($(this)).prop('checked', false);
+ }
+ });
+ }
}
function servos_update(save_configuration_to_eeprom) {
$servoConfigTable.find('tr:not(".main")').each(function () {
var info = $(this).data('info');
-
var selection = $('.channel input', this);
var channelIndex = parseInt(selection.index(selection.filter(':checked')));
if (channelIndex == -1) {
@@ -120,7 +123,7 @@ TABS.servos.initialize = function (callback) {
SERVO_CONFIG[info.obj].middle = parseInt($('.middle input', this).val());
SERVO_CONFIG[info.obj].min = parseInt($('.min input', this).val());
SERVO_CONFIG[info.obj].max = parseInt($('.max input', this).val());
- SERVO_CONFIG[info.obj].rate = parseInt($('.direction select', this).val());
+ SERVO_CONFIG[info.obj].rate = parseInt($('.rate-input', this).val());
});
//Save configuration to FC