Skip to content

Commit 2ea16bd

Browse files
authored
Merge pull request #1547 from iNavFlight/dzikuvx-refactor-esc-refresh-rate
Drop the possibility to adjust ESC rate from GUI
2 parents 3879eb7 + 9492e08 commit 2ea16bd

File tree

2 files changed

+4
-45
lines changed

2 files changed

+4
-45
lines changed

tabs/outputs.html

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,13 @@
1616
</div>
1717
<!--list of generated features goes here-->
1818
<div id="esc-protocols">
19-
<div id="esc-protocol-warning" class="warning-box"></div>
2019
<div class="select">
2120
<select name="esc-protocol" id="esc-protocol" data-setting-placeholder="motor_pwm_protocol"></select>
2221
<label for="esc-protocol">
2322
<span data-i18n="escProtocol"></span>
2423
</label>
2524
<div for="esc-protocol" class="helpicon cf_tip" data-i18n_title="escProtocolHelp"></div>
2625
</div>
27-
<div class="select hide-for-shot">
28-
<select name="esc-rate" id="esc-rate" data-setting-placeholder="motor_pwm_rate"></select>
29-
<label for="esc-rate">
30-
<span data-i18n="escRefreshRate"></span>
31-
</label>
32-
<div for="esc-rate" class="helpicon cf_tip" data-i18n_title="escRefreshRatelHelp"></div>
33-
</div>
3426
<div class="clear-both"></div>
3527
</div>
3628

tabs/outputs.js

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -99,24 +99,7 @@ TABS.outputs.initialize = function (callback) {
9999
$motorStopWarningBox = $("#motor-stop-warning"),
100100
$reversibleMotorBox = $(".for-reversible-motors");
101101

102-
function buildMotorRates() {
103-
var protocolData = escProtocols[ADVANCED_CONFIG.motorPwmProtocol];
104-
105-
$escRate.find('option').remove();
106-
107-
for (var i in protocolData.rates) {
108-
if (protocolData.rates.hasOwnProperty(i)) {
109-
$escRate.append('<option value="' + i + '">' + protocolData.rates[i] + '</option>');
110-
}
111-
}
112-
113-
/*
114-
* If rate from FC is not on the list, add a new entry
115-
*/
116-
if ($escRate.find('[value="' + ADVANCED_CONFIG.motorPwmRate + '"]').length == 0) {
117-
$escRate.append('<option value="' + ADVANCED_CONFIG.motorPwmRate + '">' + ADVANCED_CONFIG.motorPwmRate + 'Hz</option>');
118-
}
119-
102+
function handleIdleMessageBox() {
120103
$idleInfoBox.hide();
121104
if (ADVANCED_CONFIG.motorPwmProtocol >= 5) {
122105
$('.hide-for-shot').hide();
@@ -133,18 +116,10 @@ TABS.outputs.initialize = function (callback) {
133116
$idleInfoBox.show();
134117
}
135118
}
136-
137-
if (protocolData.message !== null) {
138-
$('#esc-protocol-warning').html(chrome.i18n.getMessage(protocolData.message));
139-
$('#esc-protocol-warning').show();
140-
} else {
141-
$('#esc-protocol-warning').hide();
142-
}
143-
144119
}
145120

146121
let $escProtocol = $('#esc-protocol');
147-
let $escRate = $('#esc-rate');
122+
148123
for (i in escProtocols) {
149124
if (escProtocols.hasOwnProperty(i)) {
150125
var protocolData = escProtocols[i];
@@ -153,21 +128,13 @@ TABS.outputs.initialize = function (callback) {
153128
}
154129

155130
$escProtocol.val(ADVANCED_CONFIG.motorPwmProtocol);
156-
buildMotorRates();
157-
$escRate.val(ADVANCED_CONFIG.motorPwmRate);
158131

159132
$escProtocol.change(function () {
160133
ADVANCED_CONFIG.motorPwmProtocol = $(this).val();
161-
buildMotorRates();
162-
ADVANCED_CONFIG.motorPwmRate = escProtocols[ADVANCED_CONFIG.motorPwmProtocol].defaultRate;
163-
$escRate.val(ADVANCED_CONFIG.motorPwmRate);
164-
});
165-
166-
$escRate.change(function () {
167-
ADVANCED_CONFIG.motorPwmRate = $(this).val();
168134
});
169135

170-
$idlePercent.change(buildMotorRates);
136+
$idlePercent.change(handleIdleMessageBox);
137+
handleIdleMessageBox();
171138

172139
$("#esc-protocols").show();
173140

0 commit comments

Comments
 (0)