1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-23 16:25:19 +03:00

Enable Blackbox on blackbox page

This commit is contained in:
Pawel Spychalski (DzikuVx) 2019-11-21 19:21:14 +01:00
parent 78fbb84f9e
commit 73015617c7
7 changed files with 70 additions and 29 deletions

View file

@ -1540,12 +1540,8 @@
"loggingAutomaticallyRetained": {
"message": "Automatically loaded previous log file: <strong>$1</strong>"
},
"blackboxNotSupported": {
"message": "Your flight controller's firmware does not support Blackbox logging."
},
"blackboxMaybeSupported": {
"message": "Your flight controller's firmware is too old to support this tab, or the Blackbox feature is disabled on the Configuration tab."
"message": "Your flight controller's firmware does not support Blackbox logging or Blackbox feature is not enabled"
},
"blackboxConfiguration": {
"message": "Blackbox configuration"

View file

@ -45,6 +45,19 @@ helper.features = (function() {
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) {
exitPoint = callback;
mspHelper.loadBfConfig(privateScope.setBits);

View file

@ -101,6 +101,14 @@ input[type="number"]::-webkit-inner-spin-button {
height: calc(100% - 7px);
}
.mt1em {
margin-top: 1em !important;
}
.mb1em {
margin-bottom: 1em !important;
}
.margin-top {
margin-top: 20px;
}
@ -1280,7 +1288,6 @@ dialog {
width: 100%;
height: 27px;
padding-bottom: 0;
float: left;
margin-bottom: 7px;
font-family: 'open_sanssemibold', Arial, serif;
}

View file

@ -174,7 +174,6 @@
.require-sdcard-ready,
.require-sdcard-supported,
.require-blackbox-supported,
.require-blackbox-maybe-supported,
.require-blackbox-unsupported,
.require-blackbox-config-supported,
.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-supported .require-sdcard-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-config-supported .require-blackbox-config-supported {
display: block;

View file

@ -163,6 +163,7 @@ TABS.motors.initialize = function (callback) {
}
}
/*
$('input[type="checkbox"].feature').change(function () {
let element = $(this),
@ -175,6 +176,7 @@ TABS.motors.initialize = function (callback) {
BF_CONFIG.features = bit_clear(BF_CONFIG.features, index);
}
});
*/
GUI.simpleBind();
}

View file

@ -5,14 +5,26 @@
<div class="cf_doc_version_bt">
<a id="button-documentation" href="https://github.com/iNavFlight/inav/releases" target="_blank"></a>
</div>
<div class="require-blackbox-unsupported note">
<div class="note_spacer">
<div class="require-blackbox-unsupported">
<div class="gui_box grey require-blackbox-config-supported">
<div class="gui_box_titlebar">
<div class="spacer_box_title" data-i18n="blackboxConfiguration"></div>
</div>
<div class="spacer_box config-section">
<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 class="require-blackbox-maybe-supported note">
<div class="note_spacer">
<p data-i18n="blackboxMaybeSupported"></p>
</div>
</div>
<div class="require-blackbox-supported">
@ -20,13 +32,19 @@
<div class="gui_box_titlebar">
<div class="spacer_box_title" data-i18n="blackboxConfiguration"></div>
</div>
<div class="spacer_box">
<div class="line blackboxDevice">
<div class="spacer_box config-section">
<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>
<span>Blackbox logging device</span>
</div>
<div class="line blackboxRate">
<div class="select line blackboxRate">
<select name="blackbox_rate">
</select>
<span>Portion of flight loop iterations to log (logging rate)</span>

View file

@ -1,4 +1,4 @@
/*global MSP,MSPCodes*/
/*global MSP,MSPCodes,BF_CONFIG,TABS,GUI,CONFIGURATOR,helper,mspHelper*/
'use strict';
var
@ -8,8 +8,7 @@ TABS.onboard_logging = {
};
TABS.onboard_logging.initialize = function (callback) {
var
self = this,
let
saveCancelled, eraseCancelled;
if (GUI.active_tab != 'onboard_logging') {
@ -62,12 +61,10 @@ TABS.onboard_logging.initialize = function (callback) {
var
dataflashPresent = DATAFLASH.totalSize > 0,
blackboxSupport;
blackboxSupport = false;
if ((BLACKBOX.supported || DATAFLASH.supported) && bit_check(BF_CONFIG.features, 19)) {
blackboxSupport = 'yes';
} else {
blackboxSupport = 'no';
blackboxSupport = true;
}
$(".tab-onboard_logging")
@ -76,8 +73,8 @@ TABS.onboard_logging.initialize = function (callback) {
.toggleClass("dataflash-present", dataflashPresent)
.toggleClass("sdcard-supported", SDCARD.supported)
.toggleClass("blackbox-config-supported", BLACKBOX.supported)
.toggleClass("blackbox-supported", blackboxSupport == 'yes')
.toggleClass("blackbox-unsupported", blackboxSupport == 'no');
.toggleClass("blackbox-supported", blackboxSupport)
.toggleClass("blackbox-unsupported", !blackboxSupport);
if (dataflashPresent) {
// UI hooks
@ -91,6 +88,12 @@ TABS.onboard_logging.initialize = function (callback) {
$('.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) {
$(".tab-onboard_logging a.save-settings").click(function() {
var rate = $(".blackboxRate select").val().split('/');
@ -99,8 +102,12 @@ TABS.onboard_logging.initialize = function (callback) {
BLACKBOX.blackboxRateDenom = parseInt(rate[1], 10);
BLACKBOX.blackboxDevice = parseInt($(".blackboxDevice select").val(), 10);
helper.features.reset();
helper.features.fromUI($('.require-blackbox-supported'));
helper.features.execute(function () {
mspHelper.sendBlackboxConfiguration(save_to_eeprom);
});
});
}
populateLoggingRates();