-
-
- CONFIGURATOR
-
-
+
+
+
+
+ CONFIGURATOR
+
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
- No dataflash
chip found
- chip found
-
-
-
- Dataflash: free space-
-
-
- -
-
-
- Gyro-
-
-
- Accel-
-
-
- Mag-
-
-
- Baro-
-
-
- GPS-
-
-
- Sonar-
-
-
-
-
-
-
- Battery voltage
-
-
-
-
-
-
- Show Log
+
+
-
+
-
-
- No dataflash
chip found
+ chip found
-
+
-
+ Dataflash: free space+
+
+
+
-
diff --git a/main.js b/main.js
index 0f85ae9f..2e86bc10 100644
--- a/main.js
+++ b/main.js
@@ -28,23 +28,26 @@ $(document).ready(function () {
}
// check for newer releases online to inform people in case they are running an old release
-
- chrome.storage.local.get(['lastVersionChecked', 'lastVersionAvailableOnline'], function(result) {
- if (typeof result.lastVersionChecked === undefined || ($.now() - result.lastVersionChecked) > 3600*1000) {
+
+ chrome.storage.local.get(['lastVersionChecked', 'lastVersionAvailableOnline'], function (result) {
+ if (typeof result.lastVersionChecked === undefined || ($.now() - result.lastVersionChecked) > 3600 * 1000) {
try {
var url = 'https://api.github.com/repos/betaflight/betaflight-configurator/tags';
$.get(url).done(function (data) {
- var versions = data.sort(function (v1, v2) {
- try {
- return semver.compare(v2.name, v1.name);
- } catch (e) {
- return false;
- }
- });
- chrome.storage.local.set({'lastVersionChecked': $.now(), 'lastVersionAvailableOnline': versions[0].name}, function(result) {
- console.log("Latest version available online: "+ versions[0].name);
- });
- notifyOutdatedVersion(versions[0].name);
+ var versions = data.sort(function (v1, v2) {
+ try {
+ return semver.compare(v2.name, v1.name);
+ } catch (e) {
+ return false;
+ }
+ });
+ chrome.storage.local.set({
+ 'lastVersionChecked': $.now(),
+ 'lastVersionAvailableOnline': versions[0].name
+ }, function (result) {
+ console.log("Latest version available online: " + versions[0].name);
+ });
+ notifyOutdatedVersion(versions[0].name);
});
} catch (e) {
// Just to catch and supress warnings if no internet connection is available
@@ -57,7 +60,7 @@ $(document).ready(function () {
chrome.storage.local.get('logopen', function (result) {
if (result.logopen) {
$("#showlog").trigger('click');
- }
+ }
});
// log webgl capability
@@ -206,12 +209,30 @@ $(document).ready(function () {
if (typeof result.update_notify === 'undefined' || result.update_notify) {
$('div.notifications input').prop('checked', true);
}
+
+ $('div.notifications input').change(function () {
+ var check = $(this).is(':checked');
+
+ chrome.storage.local.set({'update_notify': check});
+ });
});
- $('div.notifications input').change(function () {
- var check = $(this).is(':checked');
+ chrome.storage.local.get('permanentExpertMode', function (result) {
+ if (result.permanentExpertMode) {
+ $('div.permanentExpertMode input').prop('checked', true);
+ }
- chrome.storage.local.set({'update_notify': check});
+ $('div.permanentExpertMode input').change(function () {
+ var checked = $(this).is(':checked');
+
+ chrome.storage.local.set({'permanentExpertMode': checked});
+
+ $('input[name="expertModeCheckbox"]').prop('checked', checked).change();
+ if (BF_CONFIG) {
+ updateTabList(BF_CONFIG.features);
+ }
+
+ }).change();
});
function close_and_cleanup(e) {
@@ -307,37 +328,48 @@ $(document).ready(function () {
}
});
- $("#showlog").on('click', function() {
- var state = $(this).data('state');
- if ( state ) {
- $("#log").animate({height: 27}, 200, function() {
- var command_log = $('div#log');
- command_log.scrollTop($('div.wrapper', command_log).height());
- });
- $("#log").removeClass('active');
- $("#content").removeClass('logopen');
- $(".tab_container").removeClass('logopen');
- $("#scrollicon").removeClass('active');
- chrome.storage.local.set({'logopen': false});
+ $("#showlog").on('click', function () {
+ var state = $(this).data('state');
+ if (state) {
+ $("#log").animate({height: 27}, 200, function () {
+ var command_log = $('div#log');
+ command_log.scrollTop($('div.wrapper', command_log).height());
+ });
+ $("#log").removeClass('active');
+ $("#content").removeClass('logopen');
+ $(".tab_container").removeClass('logopen');
+ $("#scrollicon").removeClass('active');
+ chrome.storage.local.set({'logopen': false});
- state = false;
- }else{
- $("#log").animate({height: 111}, 200);
- $("#log").addClass('active');
- $("#content").addClass('logopen');
- $(".tab_container").addClass('logopen');
- $("#scrollicon").addClass('active');
- chrome.storage.local.set({'logopen': true});
+ state = false;
+ } else {
+ $("#log").animate({height: 111}, 200);
+ $("#log").addClass('active');
+ $("#content").addClass('logopen');
+ $(".tab_container").addClass('logopen');
+ $("#scrollicon").addClass('active');
+ chrome.storage.local.set({'logopen': true});
- state = true;
- }
- $(this).text(state ? 'Hide Log' : 'Show Log');
- $(this).data('state', state);
+ state = true;
+ }
+ $(this).text(state ? 'Hide Log' : 'Show Log');
+ $(this).data('state', state);
+ });
+ chrome.storage.local.get('permanentExpertMode', function (result) {
+ if (result.permanentExpertMode) {
+ $('input[name="expertModeCheckbox"]').prop('checked', true);
+ }
+
+ $('input[name="expertModeCheckbox"]').change(function () {
+ if (BF_CONFIG) {
+ updateTabList(BF_CONFIG.features);
+ }
+ }).change();
});
});
-function notifyOutdatedVersion (version) {
+function notifyOutdatedVersion(version) {
if (semver.lt(chrome.runtime.getManifest().version, version)) {
GUI.log('You are using an old version of ' + chrome.runtime.getManifest().name + '. Version ' + version + ' is available online with possible improvements and fixes.');
}
@@ -379,45 +411,52 @@ function bytesToSize(bytes) {
return bytes;
}
-Number.prototype.clamp = function(min, max) {
- return Math.min(Math.max(this, min), max);
-};
-
-/**
- * String formatting now supports currying (partial application).
- * For a format string with N replacement indices, you can call .format
- * with M <= N arguments. The result is going to be a format string
- * with N-M replacement indices, properly counting from 0 .. N-M.
- * The following Example should explain the usage of partial applied format:
- * "{0}:{1}:{2}".format("a","b","c") === "{0}:{1}:{2}".format("a","b").format("c")
- * "{0}:{1}:{2}".format("a").format("b").format("c") === "{0}:{1}:{2}".format("a").format("b", "c")
- **/
-String.prototype.format = function () {
- var args = arguments;
- return this.replace(/\{(\d+)\}/g, function (t, i) {
- return args[i] !== void 0 ? args[i] : "{"+(i-args.length)+"}";
- });
-};
-
+function isExpertModeEnabled() {
+ return $('input[name="expertModeCheckbox"]').is(':checked');
+}
function updateTabList(features) {
- if (features.isEnabled('GPS')) {
+ if (features.isEnabled('GPS') && isExpertModeEnabled()) {
$('#tabs ul.mode-connected li.tab_gps').show();
} else {
$('#tabs ul.mode-connected li.tab_gps').hide();
}
- if (features.isEnabled('FAILSAFE')) {
+ if (isExpertModeEnabled()) {
$('#tabs ul.mode-connected li.tab_failsafe').show();
} else {
$('#tabs ul.mode-connected li.tab_failsafe').hide();
}
+ if (isExpertModeEnabled()) {
+ $('#tabs ul.mode-connected li.tab_adjustments').show();
+ } else {
+ $('#tabs ul.mode-connected li.tab_adjustments').hide();
+ }
+
+ if (isExpertModeEnabled()) {
+ $('#tabs ul.mode-connected li.tab_servos').show();
+ } else {
+ $('#tabs ul.mode-connected li.tab_servos').hide();
+ }
+
if (features.isEnabled('LED_STRIP')) {
$('#tabs ul.mode-connected li.tab_led_strip').show();
} else {
$('#tabs ul.mode-connected li.tab_led_strip').hide();
}
+ if (isExpertModeEnabled()) {
+ $('#tabs ul.mode-connected li.tab_sensors').show();
+ } else {
+ $('#tabs ul.mode-connected li.tab_sensors').hide();
+ }
+
+ if (isExpertModeEnabled()) {
+ $('#tabs ul.mode-connected li.tab_logging').show();
+ } else {
+ $('#tabs ul.mode-connected li.tab_logging').hide();
+ }
+
if (features.isEnabled('BLACKBOX')) {
$('#tabs ul.mode-connected li.tab_onboard_logging').show();
} else {
diff --git a/tabs/failsafe.css b/tabs/failsafe.css
index f9e59c42..27ea6fd9 100644
--- a/tabs/failsafe.css
+++ b/tabs/failsafe.css
@@ -252,6 +252,37 @@
height: 90px;
}
+.tab-failsafe .featuresNew {
+ width: 100%;
+}
+
+.tab-failsafe .featuresNew tr {
+ width: 100%;
+ border-bottom: 1px solid #ddd;
+ float: left;
+ padding: 0px;
+ padding-bottom: 6px;
+ margin-bottom: 3px;
+}
+
+.tab-failsafe .featuresNew td:first-child {
+ width: 52px;
+}
+
+.tab-failsafe .featuresNew td:last-child {
+ width: calc(100% - 125px);
+ margin-right: 0px;
+}
+
+.tab-failsafe .featuresNew td {
+ float: left;
+ margin-right: 10px;
+}
+
+.tab-failsafe .featuresNew .helpicon {
+ margin-right: -2px;
+}
+
.tab-failsafe table {
width: 100%;
}
diff --git a/tabs/failsafe.html b/tabs/failsafe.html
index 6c568664..55e5a8c1 100644
--- a/tabs/failsafe.html
+++ b/tabs/failsafe.html
@@ -22,6 +22,11 @@
-
-
-
-
-
-
-
- D: 0% U: 0%
-
-
- 0
-
-
- 0
-
-
- 0
-
-
-
-
-
-
-
-
-
+
+
-
Waiting for data ...
+
+
+
+
+
+
+ Battery voltage
+
+
+
+
+
+
+
+
+
+ Show Log
+
+
+
+
+
+
+ D: 0% U: 0%
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+
+
+
+
+
+
+
+
+
+ Waiting for data ...
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tabs/failsafe.js b/tabs/failsafe.js
index a7fdb58c..28a9fcce 100644
--- a/tabs/failsafe.js
+++ b/tabs/failsafe.js
@@ -63,6 +63,15 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
}
function process_html() {
+ // fill stage 2 fields
+ function toggleStage2(doShow) {
+ if (doShow) {
+ $('div.stage2').show();
+ } else {
+ $('div.stage2').hide();
+ }
+ }
+
// Conditionally hide the old or the new control pane's
if(apiVersionGte1_15_0) {
var oldPane = $('div.oldpane');
@@ -199,6 +208,14 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
channel_mode_array[i].change();
}
+ BF_CONFIG.features.generateElements($('.tab-failsafe .featuresNew'));
+
+ var failsafeFeature = $('input[name="FAILSAFE"]');
+ failsafeFeature.change(function () {
+ toggleStage2($(this).is(':checked'));
+ });
+ toggleStage2(BF_CONFIG.features.isEnabled('FAILSAFE'));
+
$('input[name="failsafe_throttle"]').val(FAILSAFE_CONFIG.failsafe_throttle);
$('input[name="failsafe_off_delay"]').val(FAILSAFE_CONFIG.failsafe_off_delay);
$('input[name="failsafe_throttle_low_delay"]').val(FAILSAFE_CONFIG.failsafe_throttle_low_delay);
@@ -244,6 +261,7 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
$('input[name="failsafe_kill_switch"]').prop('checked', FAILSAFE_CONFIG.failsafe_kill_switch);
} else {
+ BF_CONFIG.features.generateElements($('.tab-failsafe .featuresOld'));
// fill failsafe_throttle field (pre API 1.15.0)
$('input[name="failsafe_throttle_old"]').val(MISC.failsafe_throttle);
}
@@ -251,6 +269,8 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
$('a.save').click(function () {
// gather data that doesn't have automatic change event bound
+ BF_CONFIG.features.updateData($('input[name="FAILSAFE"]'));
+
if(apiVersionGte1_15_0) {
RX_CONFIG.rx_min_usec = parseInt($('input[name="rx_min_usec"]').val());
RX_CONFIG.rx_max_usec = parseInt($('input[name="rx_max_usec"]').val());
diff --git a/tabs/options.html b/tabs/options.html
index bf5d9d93..d99c3b5b 100644
--- a/tabs/options.html
+++ b/tabs/options.html
@@ -1,6 +1,6 @@
-
-
+
+