Skip to content

Commit

Permalink
Servo tab: Rearrange mid, min, max and translate Rate: (betaflight#3623)
Browse files Browse the repository at this point in the history
Rearrange mid, min, max and translate Rate:
  • Loading branch information
HThuren authored Nov 2, 2023
1 parent ad3520b commit af9ec79
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
8 changes: 6 additions & 2 deletions locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -2704,8 +2704,12 @@
"servosAngleAtMax": {
"message": "Angle at max"
},
"servosDirectionAndRate": {
"message": "Direction and rate"
"servosRateAndDirection": {
"message": "Rate and direction"
},
"servosRate": {
"message": "Rate:",
"description": "Label for 'Rate:' direction"
},
"servosLiveMode": {
"message": "Enable Live mode"
Expand Down
7 changes: 4 additions & 3 deletions src/js/tabs/servos.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ servos.initialize = function (callback) {
for (let i = 0; i < FC.RC.active_channels-4; i++) {
servoHeader += `<th>A${(i+1)}</th>`;
}
servoHeader += '<th style="width: 110px" i18n="servosDirectionAndRate"></th>';
servoHeader += '<th style="width: 110px" i18n="servosRateAndDirection"></th>';

for (let i = 0; i < FC.RC.active_channels; i++) {
servoCheckbox += `<td class="channel"><input type="checkbox"/></td>`;
Expand All @@ -69,8 +69,8 @@ servos.initialize = function (callback) {
const subElement = `<input type="number" min="500" max="2500" value="`;

let element = `<tr><td style="text-align: center">${name}</td>`;
element += `<td class="middle">${subElement}${FC.SERVO_CONFIG[obj].middle}" /></td>`;
element += `<td class="min">${subElement}${FC.SERVO_CONFIG[obj].min}" /></td>`;
element += `<td class="middle">${subElement}${FC.SERVO_CONFIG[obj].middle}" /></td>`;
element += `<td class="max">${subElement}${FC.SERVO_CONFIG[obj].max}" /></td>`;
element += `${servoCheckbox}<td class="direction"></td></tr>`;

Expand All @@ -85,8 +85,9 @@ servos.initialize = function (callback) {

const select = $('div.tab-servos table.fields tr:last td.direction select');

let rateLabel = i18n.getMessage('servosRate');
for (let i = 100; i > -101; i--) {
select.append(`<option value="${i}">Rate: ${i}%</option>`);
select.append(`<option value="${i}">${rateLabel} ${i}%</option>`);
}

// select current rate
Expand Down
2 changes: 1 addition & 1 deletion src/tabs/servos.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<table class="fields">
<tr class="main">
<th width="110px" i18n="servosName"></th>
<th i18n="servosMid"></th>
<th i18n="servosMin"></th>
<th i18n="servosMid"></th>
<th i18n="servosMax"></th>
<th class="short">CH1</th>
<th class="short">CH2</th>
Expand Down

0 comments on commit af9ec79

Please sign in to comment.