mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-23 16:25:19 +03:00
Merge pull request #964 from iNavFlight/dzikuvx-i2cs_peed
Configurable I2C Speed
This commit is contained in:
commit
ff73015cad
3 changed files with 63 additions and 6 deletions
|
@ -3334,5 +3334,17 @@
|
|||
},
|
||||
"functionFlags": {
|
||||
"message": "Flags"
|
||||
},
|
||||
"configurationI2cSpeed": {
|
||||
"message": "I2C Speed"
|
||||
},
|
||||
"configurationI2cSpeedHelp": {
|
||||
"message": "I2C speed should be kept at the highest level that allows for all connected devices to work. Default 400kHz is a save value and it is suggested to switch to 800kHz in case of Multirotors."
|
||||
},
|
||||
"i2cSpeedSuggested800khz": {
|
||||
"message": "Please switch to 800kHz if connected hardware allows for it"
|
||||
},
|
||||
"i2cSpeedTooLow": {
|
||||
"message": "This I2C speed is too low!"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,16 @@
|
|||
</label>
|
||||
<div class="helpicon cf_tip" data-i18n_title="configurationLoopTimeHelp"></div>
|
||||
</div>
|
||||
|
||||
<div id="i2c_speed-info" class="info-box"></div>
|
||||
<div class="select">
|
||||
<select id="i2c_speed" data-setting="i2c_speed" />
|
||||
<label for="looptime">
|
||||
<span data-i18n="configurationI2cSpeed"></span>
|
||||
</label>
|
||||
<div class="helpicon cf_tip" data-i18n_title="configurationI2cSpeedHelp"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="config-section sensors gui_box grey">
|
||||
|
|
|
@ -63,9 +63,14 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
mspHelper.saveVTXConfig,
|
||||
saveCraftName,
|
||||
mspHelper.saveMiscV2,
|
||||
saveSettings,
|
||||
mspHelper.saveToEeprom
|
||||
];
|
||||
|
||||
function saveSettings(onComplete) {
|
||||
Settings.saveInputs().then(onComplete);
|
||||
}
|
||||
|
||||
saveChainer.setChain(saveChain);
|
||||
saveChainer.setExitPoint(reboot);
|
||||
|
||||
|
@ -85,7 +90,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
}
|
||||
|
||||
function load_html() {
|
||||
GUI.load("./tabs/configuration.html", process_html);
|
||||
GUI.load("./tabs/configuration.html", Settings.processHtml(process_html));
|
||||
}
|
||||
|
||||
function process_html() {
|
||||
|
@ -278,6 +283,39 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
$('#battery_capacity_critical').val(MISC.battery_capacity_critical * 100 / MISC.battery_capacity);
|
||||
$('#battery_capacity_unit').val(MISC.battery_capacity_unit);
|
||||
|
||||
let $i2cSpeed = $('#i2c_speed'),
|
||||
$i2cSpeedInfo = $('#i2c_speed-info');
|
||||
|
||||
$i2cSpeed.change(function () {
|
||||
let $this = $(this),
|
||||
value = $this.children("option:selected").text();
|
||||
|
||||
if (value == "400KHZ") {
|
||||
|
||||
$i2cSpeedInfo.removeClass('ok-box');
|
||||
$i2cSpeedInfo.addClass('info-box');
|
||||
$i2cSpeedInfo.removeClass('warning-box');
|
||||
|
||||
$i2cSpeedInfo.html(chrome.i18n.getMessage('i2cSpeedSuggested800khz'));
|
||||
$i2cSpeedInfo.show();
|
||||
|
||||
} else if (value == "800KHZ") {
|
||||
$i2cSpeedInfo.removeClass('ok-box');
|
||||
$i2cSpeedInfo.removeClass('info-box');
|
||||
$i2cSpeedInfo.removeClass('warning-box');
|
||||
$i2cSpeedInfo.hide();
|
||||
} else {
|
||||
$i2cSpeedInfo.removeClass('ok-box');
|
||||
$i2cSpeedInfo.removeClass('info-box');
|
||||
$i2cSpeedInfo.addClass('warning-box');
|
||||
$i2cSpeedInfo.html(chrome.i18n.getMessage('i2cSpeedTooLow'));
|
||||
$i2cSpeedInfo.show();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$i2cSpeed.change();
|
||||
|
||||
var $looptime = $("#looptime");
|
||||
|
||||
var $gyroLpf = $("#gyro-lpf"),
|
||||
|
@ -460,12 +498,8 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
}
|
||||
|
||||
googleAnalytics.sendEvent('Setting', 'Looptime', FC_CONFIG.loopTime);
|
||||
|
||||
/*
|
||||
* send gyro LPF and async_mode tracking
|
||||
*/
|
||||
googleAnalytics.sendEvent('Setting', 'GyroLpf', FC.getGyroLpfValues()[INAV_PID_CONFIG.gyroscopeLpf].label);
|
||||
googleAnalytics.sendEvent('Setting', 'AsyncMode', FC.getAsyncModes()[INAV_PID_CONFIG.asynchronousMode]);
|
||||
googleAnalytics.sendEvent('Setting', 'I2CSpeed', $('#i2c_speed').children("option:selected").text());
|
||||
|
||||
googleAnalytics.sendEvent('Board', 'Accelerometer', FC.getAccelerometerNames()[SENSOR_CONFIG.accelerometer]);
|
||||
googleAnalytics.sendEvent('Board', 'Magnetometer', FC.getMagnetometerNames()[SENSOR_CONFIG.magnetometer]);
|
||||
|
@ -479,6 +513,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
helper.features.reset();
|
||||
helper.features.fromUI($('.tab-configuration'));
|
||||
helper.features.execute(function () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue