mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-24 08:45:26 +03:00
Enable Blackbox on blackbox page
This commit is contained in:
parent
78fbb84f9e
commit
73015617c7
7 changed files with 70 additions and 29 deletions
|
@ -1540,12 +1540,8 @@
|
||||||
"loggingAutomaticallyRetained": {
|
"loggingAutomaticallyRetained": {
|
||||||
"message": "Automatically loaded previous log file: <strong>$1</strong>"
|
"message": "Automatically loaded previous log file: <strong>$1</strong>"
|
||||||
},
|
},
|
||||||
|
|
||||||
"blackboxNotSupported": {
|
"blackboxNotSupported": {
|
||||||
"message": "Your flight controller's firmware does not support Blackbox logging."
|
"message": "Your flight controller's firmware does not support Blackbox logging or Blackbox feature is not enabled"
|
||||||
},
|
|
||||||
"blackboxMaybeSupported": {
|
|
||||||
"message": "Your flight controller's firmware is too old to support this tab, or the Blackbox feature is disabled on the Configuration tab."
|
|
||||||
},
|
},
|
||||||
"blackboxConfiguration": {
|
"blackboxConfiguration": {
|
||||||
"message": "Blackbox configuration"
|
"message": "Blackbox configuration"
|
||||||
|
|
|
@ -45,6 +45,19 @@ helper.features = (function() {
|
||||||
toUnset.push(bit);
|
toUnset.push(bit);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
publicScope.fromUI = function ($container) {
|
||||||
|
|
||||||
|
$container.find('[data-bit].feature').each(function () {
|
||||||
|
let $this = $(this);
|
||||||
|
if ($this.is(":checked")) {
|
||||||
|
publicScope.set($this.attr("data-bit"));
|
||||||
|
} else {
|
||||||
|
publicScope.unset($this.attr("data-bit"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
publicScope.execute = function(callback) {
|
publicScope.execute = function(callback) {
|
||||||
exitPoint = callback;
|
exitPoint = callback;
|
||||||
mspHelper.loadBfConfig(privateScope.setBits);
|
mspHelper.loadBfConfig(privateScope.setBits);
|
||||||
|
|
9
main.css
9
main.css
|
@ -101,6 +101,14 @@ input[type="number"]::-webkit-inner-spin-button {
|
||||||
height: calc(100% - 7px);
|
height: calc(100% - 7px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mt1em {
|
||||||
|
margin-top: 1em !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mb1em {
|
||||||
|
margin-bottom: 1em !important;
|
||||||
|
}
|
||||||
|
|
||||||
.margin-top {
|
.margin-top {
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
}
|
}
|
||||||
|
@ -1280,7 +1288,6 @@ dialog {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 27px;
|
height: 27px;
|
||||||
padding-bottom: 0;
|
padding-bottom: 0;
|
||||||
float: left;
|
|
||||||
margin-bottom: 7px;
|
margin-bottom: 7px;
|
||||||
font-family: 'open_sanssemibold', Arial, serif;
|
font-family: 'open_sanssemibold', Arial, serif;
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,7 +174,6 @@
|
||||||
.require-sdcard-ready,
|
.require-sdcard-ready,
|
||||||
.require-sdcard-supported,
|
.require-sdcard-supported,
|
||||||
.require-blackbox-supported,
|
.require-blackbox-supported,
|
||||||
.require-blackbox-maybe-supported,
|
|
||||||
.require-blackbox-unsupported,
|
.require-blackbox-unsupported,
|
||||||
.require-blackbox-config-supported,
|
.require-blackbox-config-supported,
|
||||||
.tab-onboard_logging.dataflash-present .require-dataflash-not-present,
|
.tab-onboard_logging.dataflash-present .require-dataflash-not-present,
|
||||||
|
@ -189,7 +188,6 @@
|
||||||
.tab-onboard_logging.sdcard-ready .require-sdcard-ready,
|
.tab-onboard_logging.sdcard-ready .require-sdcard-ready,
|
||||||
.tab-onboard_logging.sdcard-supported .require-sdcard-supported,
|
.tab-onboard_logging.sdcard-supported .require-sdcard-supported,
|
||||||
.tab-onboard_logging.blackbox-supported .require-blackbox-supported,
|
.tab-onboard_logging.blackbox-supported .require-blackbox-supported,
|
||||||
.tab-onboard_logging.blackbox-maybe-supported .require-blackbox-maybe-supported,
|
|
||||||
.tab-onboard_logging.blackbox-unsupported .require-blackbox-unsupported,
|
.tab-onboard_logging.blackbox-unsupported .require-blackbox-unsupported,
|
||||||
.tab-onboard_logging.blackbox-config-supported .require-blackbox-config-supported {
|
.tab-onboard_logging.blackbox-config-supported .require-blackbox-config-supported {
|
||||||
display: block;
|
display: block;
|
||||||
|
|
|
@ -163,6 +163,7 @@ TABS.motors.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
$('input[type="checkbox"].feature').change(function () {
|
$('input[type="checkbox"].feature').change(function () {
|
||||||
|
|
||||||
let element = $(this),
|
let element = $(this),
|
||||||
|
@ -175,6 +176,7 @@ TABS.motors.initialize = function (callback) {
|
||||||
BF_CONFIG.features = bit_clear(BF_CONFIG.features, index);
|
BF_CONFIG.features = bit_clear(BF_CONFIG.features, index);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
GUI.simpleBind();
|
GUI.simpleBind();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,14 +5,26 @@
|
||||||
<div class="cf_doc_version_bt">
|
<div class="cf_doc_version_bt">
|
||||||
<a id="button-documentation" href="https://github.com/iNavFlight/inav/releases" target="_blank"></a>
|
<a id="button-documentation" href="https://github.com/iNavFlight/inav/releases" target="_blank"></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="require-blackbox-unsupported note">
|
<div class="require-blackbox-unsupported">
|
||||||
<div class="note_spacer">
|
|
||||||
<p data-i18n="blackboxNotSupported"></p>
|
<div class="gui_box grey require-blackbox-config-supported">
|
||||||
</div>
|
<div class="gui_box_titlebar">
|
||||||
</div>
|
<div class="spacer_box_title" data-i18n="blackboxConfiguration"></div>
|
||||||
<div class="require-blackbox-maybe-supported note">
|
</div>
|
||||||
<div class="note_spacer">
|
<div class="spacer_box config-section">
|
||||||
<p data-i18n="blackboxMaybeSupported"></p>
|
<div class="note note_spacer mb1em">
|
||||||
|
<p data-i18n="blackboxNotSupported"></p>
|
||||||
|
</div>
|
||||||
|
<div class="checkbox">
|
||||||
|
<input type="checkbox" data-bit="19" class="feature toggle" name="BLACKBOX" title="BLACKBOX" id="feature-19-1">
|
||||||
|
<label for="feature-19-1">
|
||||||
|
<span data-i18n="featureBLACKBOX"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="line">
|
||||||
|
<a href="#" class="save-blackbox-feature regular-button" data-i18n="blackboxButtonSave"></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="require-blackbox-supported">
|
<div class="require-blackbox-supported">
|
||||||
|
@ -20,13 +32,19 @@
|
||||||
<div class="gui_box_titlebar">
|
<div class="gui_box_titlebar">
|
||||||
<div class="spacer_box_title" data-i18n="blackboxConfiguration"></div>
|
<div class="spacer_box_title" data-i18n="blackboxConfiguration"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="spacer_box">
|
<div class="spacer_box config-section">
|
||||||
<div class="line blackboxDevice">
|
<div class="checkbox">
|
||||||
|
<input checked type="checkbox" data-bit="19" class="feature toggle" name="BLACKBOX" title="BLACKBOX" id="feature-19-2">
|
||||||
|
<label for="feature-19-2">
|
||||||
|
<span data-i18n="featureBLACKBOX"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="select line blackboxDevice">
|
||||||
<select name="blackbox_device">
|
<select name="blackbox_device">
|
||||||
</select>
|
</select>
|
||||||
<span>Blackbox logging device</span>
|
<span>Blackbox logging device</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="line blackboxRate">
|
<div class="select line blackboxRate">
|
||||||
<select name="blackbox_rate">
|
<select name="blackbox_rate">
|
||||||
</select>
|
</select>
|
||||||
<span>Portion of flight loop iterations to log (logging rate)</span>
|
<span>Portion of flight loop iterations to log (logging rate)</span>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*global MSP,MSPCodes*/
|
/*global MSP,MSPCodes,BF_CONFIG,TABS,GUI,CONFIGURATOR,helper,mspHelper*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var
|
var
|
||||||
|
@ -8,8 +8,7 @@ TABS.onboard_logging = {
|
||||||
};
|
};
|
||||||
|
|
||||||
TABS.onboard_logging.initialize = function (callback) {
|
TABS.onboard_logging.initialize = function (callback) {
|
||||||
var
|
let
|
||||||
self = this,
|
|
||||||
saveCancelled, eraseCancelled;
|
saveCancelled, eraseCancelled;
|
||||||
|
|
||||||
if (GUI.active_tab != 'onboard_logging') {
|
if (GUI.active_tab != 'onboard_logging') {
|
||||||
|
@ -62,12 +61,10 @@ TABS.onboard_logging.initialize = function (callback) {
|
||||||
|
|
||||||
var
|
var
|
||||||
dataflashPresent = DATAFLASH.totalSize > 0,
|
dataflashPresent = DATAFLASH.totalSize > 0,
|
||||||
blackboxSupport;
|
blackboxSupport = false;
|
||||||
|
|
||||||
if ((BLACKBOX.supported || DATAFLASH.supported) && bit_check(BF_CONFIG.features, 19)) {
|
if ((BLACKBOX.supported || DATAFLASH.supported) && bit_check(BF_CONFIG.features, 19)) {
|
||||||
blackboxSupport = 'yes';
|
blackboxSupport = true;
|
||||||
} else {
|
|
||||||
blackboxSupport = 'no';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$(".tab-onboard_logging")
|
$(".tab-onboard_logging")
|
||||||
|
@ -76,8 +73,8 @@ TABS.onboard_logging.initialize = function (callback) {
|
||||||
.toggleClass("dataflash-present", dataflashPresent)
|
.toggleClass("dataflash-present", dataflashPresent)
|
||||||
.toggleClass("sdcard-supported", SDCARD.supported)
|
.toggleClass("sdcard-supported", SDCARD.supported)
|
||||||
.toggleClass("blackbox-config-supported", BLACKBOX.supported)
|
.toggleClass("blackbox-config-supported", BLACKBOX.supported)
|
||||||
.toggleClass("blackbox-supported", blackboxSupport == 'yes')
|
.toggleClass("blackbox-supported", blackboxSupport)
|
||||||
.toggleClass("blackbox-unsupported", blackboxSupport == 'no');
|
.toggleClass("blackbox-unsupported", !blackboxSupport);
|
||||||
|
|
||||||
if (dataflashPresent) {
|
if (dataflashPresent) {
|
||||||
// UI hooks
|
// UI hooks
|
||||||
|
@ -91,6 +88,12 @@ TABS.onboard_logging.initialize = function (callback) {
|
||||||
$('.tab-onboard_logging a.save-flash-dismiss').click(dismiss_saving_dialog);
|
$('.tab-onboard_logging a.save-flash-dismiss').click(dismiss_saving_dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('.save-blackbox-feature').click(function () {
|
||||||
|
helper.features.reset();
|
||||||
|
helper.features.fromUI($('.require-blackbox-unsupported'));
|
||||||
|
helper.features.execute(save_to_eeprom);
|
||||||
|
});
|
||||||
|
|
||||||
if (BLACKBOX.supported) {
|
if (BLACKBOX.supported) {
|
||||||
$(".tab-onboard_logging a.save-settings").click(function() {
|
$(".tab-onboard_logging a.save-settings").click(function() {
|
||||||
var rate = $(".blackboxRate select").val().split('/');
|
var rate = $(".blackboxRate select").val().split('/');
|
||||||
|
@ -99,7 +102,11 @@ TABS.onboard_logging.initialize = function (callback) {
|
||||||
BLACKBOX.blackboxRateDenom = parseInt(rate[1], 10);
|
BLACKBOX.blackboxRateDenom = parseInt(rate[1], 10);
|
||||||
BLACKBOX.blackboxDevice = parseInt($(".blackboxDevice select").val(), 10);
|
BLACKBOX.blackboxDevice = parseInt($(".blackboxDevice select").val(), 10);
|
||||||
|
|
||||||
mspHelper.sendBlackboxConfiguration(save_to_eeprom);
|
helper.features.reset();
|
||||||
|
helper.features.fromUI($('.require-blackbox-supported'));
|
||||||
|
helper.features.execute(function () {
|
||||||
|
mspHelper.sendBlackboxConfiguration(save_to_eeprom);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue