Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -2548,5 +2548,8 @@
},
"confirm_reset_settings": {
"message": "Do you really want to reset all settings?\nATTENTION: All settings are lost! You have to setup the whole aircraft after this operation!"
},
"servoTableInfo": {
"message": "This table shows only servos configured using servo mixer"
}
}
14 changes: 14 additions & 0 deletions js/servoMixerRuleCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,19 @@ var ServoMixerRuleCollection = function () {
return data.length < self.getServoRulesCount();
};

self.isServoConfigured = function(servoId) {

for (let ruleIndex in data) {
if (data.hasOwnProperty(ruleIndex)) {
let rule = data[ruleIndex];

if (rule.getTarget() == servoId && rule.isUsed()) {
return true;
}
}
}
return false;
}

return self;
};
5 changes: 5 additions & 0 deletions main.css
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,11 @@ dialog {
font-family: 'open_sansregular', Arial, serif;
}

.note--big {
font-size: 1.15em;
padding: 0.6em;
}

.note_spacer {
padding: 5px 7px 5px 7px;
}
Expand Down
1 change: 1 addition & 0 deletions tabs/servos.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<a id="button-documentation" href="" target="_blank"></a>
</div>
<div>
<p data-i18n="servoTableInfo" class="requires-v2_0 note note--big"></p>
<!-- <div class="title" data-i18n="servosChangeDirection"></div> -->
<table id="servo-config-table" class="fields">
<tr class="main">
Expand Down
23 changes: 17 additions & 6 deletions tabs/servos.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*global fc*/
/*global fc,mspHelper,TABS*/
'use strict';

TABS.servos = {};
Expand All @@ -12,6 +12,7 @@ TABS.servos.initialize = function (callback) {
let loadChainer = new MSPChainerClass();

loadChainer.setChain([
mspHelper.loadServoMixRules,
mspHelper.loadServoConfiguration,
mspHelper.loadRcData,
mspHelper.loadBfConfig,
Expand Down Expand Up @@ -52,6 +53,9 @@ TABS.servos.initialize = function (callback) {
servoHeader = '';

if (semver.lt(CONFIG.flightControllerVersion, "2.0.0")) {

$('.requires-v2_0').hide();

for (i = 0; i < RC.active_channels - 4; i++) {
servoHeader = servoHeader + '<th class="short">CH' + (i + 5) + '</th>';
}
Expand Down Expand Up @@ -88,29 +92,36 @@ TABS.servos.initialize = function (callback) {
</tr> \
');

let $currentRow = $servoConfigTable.find('tr:last');

//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);
$currentRow.find('td.channel input').eq(SERVO_CONFIG[obj].indexOfChannelToForward).prop('checked', true);
}

// adding select box and generating options
$servoConfigTable.find('tr:last td.rate').append(
$currentRow.find('td.rate').append(
'<input class="rate-input" type="number" min="' + FC.MIN_SERVO_RATE + '" max="' + FC.MAX_SERVO_RATE + '" value="' + Math.abs(SERVO_CONFIG[obj].rate) + '" />'
);

$servoConfigTable.find('tr:last td.reverse').append(
$currentRow.find('td.reverse').append(
'<input type="checkbox" class="reverse-input togglemedium" ' + (SERVO_CONFIG[obj].rate < 0 ? ' checked ' : '') + '/>'
);

$servoConfigTable.find('tr:last').data('info', { 'obj': obj });
$currentRow.data('info', { 'obj': obj });

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 () {
$currentRow.find('td.channel input').click(function () {
if ($(this).is(':checked')) {
$(this).parent().parent().find('.channel input').not($(this)).prop('checked', false);
}
});
} else {
//For 2.0 and above hide a row when servo is not configured
if (!SERVO_RULES.isServoConfigured(obj)) {
$servoConfigTable.find('tr:last').hide();
}
}
}

Expand Down