Merge pull request #45 from KiteAnton/sensor_config

Added sensor enable/disable to system settings in configuration tab
10.3.x-maintenance
borisbstyle 2016-06-25 17:08:47 +02:00 committed by GitHub
commit f7d4f74bbc
3 changed files with 73 additions and 6 deletions

View File

@ -666,7 +666,7 @@
"message": "Cycles/Sec (Hz)"
},
"configurationLoopTimeHelp": {
"message": "<strong>Note:</strong> Make sure your FC is capable to operate on these speeds! Check CPU and cycletime stability. Changing this may require PID re-tuning. TIP: Disable Accelerometer and other sensors to gain more performance. (CLI commands: set acc_hardware = NONE, set baro_hardware = NONE, set mag_hardware = NONE)"
"message": "<strong>Note:</strong> Make sure your FC is capable to operate on these speeds! Check CPU and cycletime stability. Changing this may require PID re-tuning. TIP: Disable Accelerometer and other sensors to gain more performance."
},
"configurationGPS": {
"message": "GPS"
@ -1647,5 +1647,15 @@
},
"configurationPidProcessDenom": {
"message": "PID loop frequency"
}
},
"configurationAccHardware": {
"message": "Accelerometer"
},
"configurationBaroHardware": {
"message": "Barometer"
},
"configurationMagHardware": {
"message": "Magnetometer"
}
}

View File

@ -363,7 +363,7 @@
<span i18n="configurationGyroSyncDenom"></span>
</label>
</div>
<div class="selectPidProcessDenom">
<div class="select selectPidProcessDenom">
<label>
<select class="pidProcessDenom">
<!-- list generated here -->
@ -371,7 +371,32 @@
<span i18n="configurationPidProcessDenom"></span>
</label>
</div>
<div class="hardwareSelection">
<div class="select">
<div style="float: left; height: 20px; margin-right: 15px; margin-left: 3px;">
<input type="checkbox" name="accHardwareSwitch" class="toggle" />
</div>
<label for="accHardwareSwitch"> <span class="freelabel"
i18n="configurationAccHardware"></span>
</label>
</div>
<div class="select">
<div style="float: left; height: 20px; margin-right: 15px; margin-left: 3px;">
<input type="checkbox" name="baroHardwareSwitch" class="toggle" />
</div>
<label for="baroHardwareSwitch"> <span class="freelabel"
i18n="configurationBaroHardware"></span>
</label>
</div>
<div class="select">
<div style="float: left; height: 20px; margin-right: 15px; margin-left: 3px;">
<input type="checkbox" name="magHardwareSwitch" class="toggle" />
</div>
<label for="magHardwareSwitch"> <span class="freelabel"
i18n="configurationMagHardware"></span>
</label>
</div>
</div>
</div>
</div>
</div>

View File

@ -62,7 +62,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
}
function esc_protocol() {
var next_callback = load_sensor_alignment;
var next_callback = sensor_config;
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.gte(CONFIG.flightControllerVersion, "2.8.1")) {
MSP.send_message(MSP_codes.MSP_PID_ADVANCED_CONFIG, false, false, next_callback);
} else {
@ -70,6 +70,15 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
}
}
function sensor_config() {
var next_callback = load_sensor_alignment;
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.gte(CONFIG.flightControllerVersion, "2.8.2")) {
MSP.send_message(MSP_codes.MSP_SENSOR_CONFIG, false, false, next_callback);
} else {
next_callback();
}
}
function load_sensor_alignment() {
var next_callback = load_html;
if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
@ -344,11 +353,22 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
});
$('input[name="accHardwareSwitch"]').prop('checked', (SENSOR_CONFIG.acc_hardware!=1)?1:0);
$('input[name="baroHardwareSwitch"]').prop('checked', (SENSOR_CONFIG.baro_hardware!=1)?1:0);
$('input[name="magHardwareSwitch"]').prop('checked', (SENSOR_CONFIG.mag_hardware!=1)?1:0);
// Only show these sections for supported FW
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.lt(CONFIG.flightControllerVersion, "2.8.1")) {
$('.selectProtocol').hide();
$('.checkboxPwm').hide();
$('.selectPidProcessDenom').hide();
}
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.lt(CONFIG.flightControllerVersion, "2.8.2")) {
$('.hardwareSelection').hide();
}
// generate GPS
var gpsProtocols = [
@ -645,7 +665,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
}
function save_looptime_config() {
var next_callback = save_to_eeprom;
var next_callback = save_sensor_config;
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.lt(CONFIG.flightControllerVersion, "2.8.1")) {
FC_CONFIG.loopTime = PID_ADVANCED_CONFIG.gyro_sync_denom * 125;
MSP.send_message(MSP_codes.MSP_SET_LOOP_TIME, MSP.crunch(MSP_codes.MSP_SET_LOOP_TIME), false, next_callback);
@ -653,6 +673,18 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
next_callback();
}
}
function save_sensor_config() {
var next_callback = save_to_eeprom;
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.gte(CONFIG.flightControllerVersion, "2.8.2")) {
SENSOR_CONFIG.acc_hardware = $('input[name="accHardwareSwitch"]').is(':checked')?0:1;
SENSOR_CONFIG.baro_hardware = $('input[name="baroHardwareSwitch"]').is(':checked')?0:1;
SENSOR_CONFIG.mag_hardware = $('input[name="magHardwareSwitch"]').is(':checked')?0:1
MSP.send_message(MSP_codes.MSP_SET_SENSOR_CONFIG, MSP.crunch(MSP_codes.MSP_SET_SENSOR_CONFIG), false, next_callback);
} else {
next_callback();
}
}
function save_to_eeprom() {
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, reboot);