From 55385f5831ca316cb73d6d94eda1a73de6b71c64 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Mon, 7 May 2018 20:32:56 +0200 Subject: Servo tab cleanup --- js/fc.js | 9 +++++-- main.css | 4 ++++ src/css/tabs/servos.css | 16 ------------- tabs/servos.html | 2 +- tabs/servos.js | 63 ++++++++++++++++++++++++++----------------------- 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 @@
-
+ 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 + ''; - } - servoHeader = servoHeader + ''; + if (semver.lt(CONFIG.flightControllerVersion, "2.0.0")) { + for (i = 0; i < RC.active_channels - 4; i++) { + servoHeader = servoHeader + ''; + } + servoHeader = servoHeader + ''; - for (i = 0; i < RC.active_channels; i++) { - servoCheckbox = servoCheckbox + ''; - } + for (i = 0; i < RC.active_channels; i++) { + servoCheckbox = servoCheckbox + ''; + } - $servoConfigTable.find('tr.main').append(servoHeader); + $servoConfigTable.find('tr.main').append(servoHeader); + } else { + $servoConfigTable.find('tr.main').html('\ + \ + \ + \ + \ + \ + '); + } function process_servos(name, alternate, obj) { $servoConfigTable.append('\ \ - \ + \ \ \ \ ' + servoCheckbox + '\ - \ \ '); + //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(''); - - var select = $servoConfigTable.find('tr:last td.direction select'); - - for (var i = FC.MAX_SERVO_RATE; i >= FC.MIN_SERVO_RATE; i--) { - select.append(''); - } - - // select current rate - select.val(SERVO_CONFIG[obj].rate); + $servoConfigTable.find('tr:last td.direction').append( + '' + ); $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 -- cgit v1.2.3
CH' + (i + 5) + 'CH' + (i + 5) + '
' + name + '' + name + '\ + \