Skip to content

Commit 4f76835

Browse files
committed
Implement version checking part 3
1 parent eaaebf8 commit 4f76835

File tree

3 files changed

+48
-30
lines changed

3 files changed

+48
-30
lines changed

tabs/configuration.css

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@
160160
margin-right: 5px;
161161
}
162162

163+
.tab-configuration .disarm .checkboxPwm {
164+
margin-top: 2px;
165+
margin-right: 5px;
166+
}
167+
163168
.tab-configuration .disarm .checkbox div {
164169
margin-bottom: 0px;
165170
margin-top: 0px;
@@ -227,6 +232,26 @@
227232
float: left;
228233
}
229234

235+
.tab-configuration .selectProtocol
236+
{
237+
margin-bottom: 5px;
238+
clear: left;
239+
padding-bottom: 5px;
240+
border-bottom: 1px solid #ddd;
241+
width: 100%;
242+
float: left;
243+
}
244+
245+
.tab-configuration .pidProcessDenom
246+
{
247+
margin-bottom: 5px;
248+
clear: left;
249+
padding-bottom: 5px;
250+
border-bottom: 1px solid #ddd;
251+
width: 100%;
252+
float: left;
253+
}
254+
230255
.tab-configuration .number:last-child,
231256
.tab-configuration .select:last-child {
232257
border-bottom: none;

tabs/configuration.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<div class="spacer_box_title" i18n="configurationEscFeatures"></div>
3333
</div>
3434
<div class="spacer_box">
35-
<div class="select">
35+
<div class="selectProtocol">
3636
<label>
3737
<select class="escprotocol">
3838
<!-- list generated here -->
@@ -41,7 +41,7 @@
4141
</label>
4242
</div>
4343

44-
<div class="checkbox" style="border-bottom: 1px solid #ddd; padding-bottom: 5px;">
44+
<div class="checkboxPwm" style="border-bottom: 1px solid #ddd; padding-bottom: 5px;">
4545
<div style="float: left; height: 20px; margin-right: 5px; margin-left: 3px;">
4646
<input type="checkbox" name="unsyncedPWMSwitch" class="toggle" />
4747
</div>
@@ -363,7 +363,7 @@
363363
<span i18n="configurationGyroSyncDenom"></span>
364364
</label>
365365
</div>
366-
<div class="select">
366+
<div class="selectPidProcessDenom">
367367
<label>
368368
<select class="pidProcessDenom">
369369
<!-- list generated here -->

tabs/configuration.js

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
6363

6464
function esc_protocol() {
6565
var next_callback = load_sensor_alignment;
66-
if (semver.gte(CONFIG.apiVersion, "1.16.0")) {
66+
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.gte(CONFIG.flightControllerVersion, "2.8.1")) {
6767
MSP.send_message(MSP_codes.MSP_PID_ADVANCED_CONFIG, false, false, next_callback);
6868
} else {
6969
next_callback();
@@ -94,17 +94,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
9494
}
9595

9696
MSP.send_message(MSP_codes.MSP_IDENT, false, false, load_config);
97-
98-
function recalculate_cycles_sec() {
99-
var looptime = $('input[name="looptime"]').val();
100-
101-
var message = 'Max';
102-
if (looptime > 0) {
103-
message = parseFloat((1 / looptime) * 1000 * 1000).toFixed(0);
104-
}
105-
106-
$('input[name="looptimehz"]').val(message);
107-
}
10897

10998
function process_html() {
11099

@@ -354,8 +343,13 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
354343
$('select.pidProcessDenom option[value="'+(i+1)+'"]').text((pidF / 100).toString()+'KHz');}
355344

356345
});
357-
358-
346+
347+
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.lt(CONFIG.flightControllerVersion, "2.8.1")) {
348+
$('.selectProtocol').hide();
349+
$('.checkboxPwm').hide();
350+
$('.selectPidProcessDenom').hide();
351+
}
352+
359353
// generate GPS
360354
var gpsProtocols = [
361355
'NMEA',
@@ -472,12 +466,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
472466
$('div.disarmdelay').show();
473467
else
474468
$('div.disarmdelay').hide();
475-
476-
// fill FC loop time
477-
$('input[name="looptime"]').val(FC_CONFIG.loopTime);
478469

479-
recalculate_cycles_sec();
480-
481470
$('div.cycles').show();
482471
}
483472

@@ -512,11 +501,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
512501
}
513502
}
514503

515-
// UI hooks
516-
$('input[name="looptime"]').change(function() {
517-
recalculate_cycles_sec();
518-
});
519-
520504
$('input[type="checkbox"].feature', features_e).change(function () {
521505
var element = $(this),
522506
index = element.data('bit'),
@@ -579,7 +563,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
579563
if(semver.gte(CONFIG.apiVersion, "1.8.0")) {
580564
ARMING_CONFIG.auto_disarm_delay = parseInt($('input[name="autodisarmdelay"]').val());
581565
ARMING_CONFIG.disarm_kill_switch = ~~$('input[name="disarmkillswitch"]').is(':checked'); // ~~ boolean to decimal conversion
582-
FC_CONFIG.loopTime = parseInt($('input[name="looptime"]').val());
583566
}
584567

585568
MISC.minthrottle = parseInt($('input[name="minthrottle"]').val());
@@ -645,7 +628,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
645628
}
646629
function save_esc_protocol() {
647630
var next_callback = save_acc_trim;
648-
if(semver.gte(CONFIG.apiVersion, "1.16.0")) {
631+
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.gte(CONFIG.flightControllerVersion, "2.8.1")) {
649632
MSP.send_message(MSP_codes.MSP_SET_PID_ADVANCED_CONFIG, MSP.crunch(MSP_codes.MSP_SET_PID_ADVANCED_CONFIG), false, next_callback);
650633
} else {
651634
next_callback();
@@ -658,7 +641,17 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
658641
}
659642

660643
function save_arming_config() {
661-
MSP.send_message(MSP_codes.MSP_SET_ARMING_CONFIG, MSP.crunch(MSP_codes.MSP_SET_ARMING_CONFIG), false, save_to_eeprom);
644+
MSP.send_message(MSP_codes.MSP_SET_ARMING_CONFIG, MSP.crunch(MSP_codes.MSP_SET_ARMING_CONFIG), false, save_looptime_config);
645+
}
646+
647+
function save_looptime_config() {
648+
var next_callback = save_to_eeprom;
649+
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.lt(CONFIG.flightControllerVersion, "2.8.1")) {
650+
FC_CONFIG.loopTime = PID_ADVANCED_CONFIG.gyro_sync_denom * 125;
651+
MSP.send_message(MSP_codes.MSP_SET_LOOP_TIME, MSP.crunch(MSP_codes.MSP_SET_LOOP_TIME), false, next_callback);
652+
} else {
653+
next_callback();
654+
}
662655
}
663656

664657
function save_to_eeprom() {

0 commit comments

Comments
 (0)