mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-17 21:35:33 +03:00
Merge pull request #359 from basdelfos/battery_meter_type
Added dropdown for current and battery meter selection to configuration tab
This commit is contained in:
commit
acb7a84422
7 changed files with 410 additions and 212 deletions
|
@ -665,6 +665,9 @@
|
||||||
"configurationBatteryCurrent": {
|
"configurationBatteryCurrent": {
|
||||||
"message": "Battery Current"
|
"message": "Battery Current"
|
||||||
},
|
},
|
||||||
|
"configurationBatteryMeterType": {
|
||||||
|
"message": "Battery Meter Type"
|
||||||
|
},
|
||||||
"configurationBatteryMinimum": {
|
"configurationBatteryMinimum": {
|
||||||
"message": "Minimum Cell Voltage"
|
"message": "Minimum Cell Voltage"
|
||||||
},
|
},
|
||||||
|
@ -677,6 +680,9 @@
|
||||||
"configurationBatteryScale": {
|
"configurationBatteryScale": {
|
||||||
"message": "Voltage Scale"
|
"message": "Voltage Scale"
|
||||||
},
|
},
|
||||||
|
"configurationCurrentMeterType": {
|
||||||
|
"message": "Current Meter Type"
|
||||||
|
},
|
||||||
"configurationCurrent": {
|
"configurationCurrent": {
|
||||||
"message": "Current Sensor"
|
"message": "Current Sensor"
|
||||||
},
|
},
|
||||||
|
|
7
js/fc.js
7
js/fc.js
|
@ -74,7 +74,9 @@ var FC = {
|
||||||
board_align_pitch: 0,
|
board_align_pitch: 0,
|
||||||
board_align_yaw: 0,
|
board_align_yaw: 0,
|
||||||
currentscale: 0,
|
currentscale: 0,
|
||||||
currentoffset: 0
|
currentoffset: 0,
|
||||||
|
currentmetertype: 0,
|
||||||
|
batterycapacity: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
LED_STRIP = [];
|
LED_STRIP = [];
|
||||||
|
@ -199,7 +201,8 @@ var FC = {
|
||||||
vbatscale: 0,
|
vbatscale: 0,
|
||||||
vbatmincellvoltage: 0,
|
vbatmincellvoltage: 0,
|
||||||
vbatmaxcellvoltage: 0,
|
vbatmaxcellvoltage: 0,
|
||||||
vbatwarningcellvoltage: 0
|
vbatwarningcellvoltage: 0,
|
||||||
|
batterymetertype: 1, // 1=ADC, 2=ESC
|
||||||
};
|
};
|
||||||
|
|
||||||
_3D = {
|
_3D = {
|
||||||
|
|
|
@ -16,6 +16,9 @@ var MSPCodes = {
|
||||||
MSP_MODE_RANGES: 34,
|
MSP_MODE_RANGES: 34,
|
||||||
MSP_SET_MODE_RANGE: 35,
|
MSP_SET_MODE_RANGE: 35,
|
||||||
|
|
||||||
|
MSP_CURRENT_METER_CONFIG: 40,
|
||||||
|
MSP_SET_CURRENT_METER_CONFIG: 41,
|
||||||
|
|
||||||
MSP_RX_CONFIG: 44,
|
MSP_RX_CONFIG: 44,
|
||||||
MSP_SET_RX_CONFIG: 45,
|
MSP_SET_RX_CONFIG: 45,
|
||||||
MSP_LED_COLORS: 46,
|
MSP_LED_COLORS: 46,
|
||||||
|
@ -27,6 +30,8 @@ var MSPCodes = {
|
||||||
MSP_SET_ADJUSTMENT_RANGE: 53,
|
MSP_SET_ADJUSTMENT_RANGE: 53,
|
||||||
MSP_CF_SERIAL_CONFIG: 54,
|
MSP_CF_SERIAL_CONFIG: 54,
|
||||||
MSP_SET_CF_SERIAL_CONFIG: 55,
|
MSP_SET_CF_SERIAL_CONFIG: 55,
|
||||||
|
MSP_VOLTAGE_METER_CONFIG: 56,
|
||||||
|
MSP_SET_VOLTAGE_METER_CONFIG: 57,
|
||||||
MSP_SONAR: 58,
|
MSP_SONAR: 58,
|
||||||
MSP_PID_CONTROLLER: 59,
|
MSP_PID_CONTROLLER: 59,
|
||||||
MSP_SET_PID_CONTROLLER: 60,
|
MSP_SET_PID_CONTROLLER: 60,
|
||||||
|
@ -111,13 +116,13 @@ var MSPCodes = {
|
||||||
MSP_SET_WP: 209, // Not used
|
MSP_SET_WP: 209, // Not used
|
||||||
MSP_SELECT_SETTING: 210,
|
MSP_SELECT_SETTING: 210,
|
||||||
MSP_SET_HEAD: 211, // Not used
|
MSP_SET_HEAD: 211, // Not used
|
||||||
MSP_SET_SERVO_CONFIGURATION:212,
|
MSP_SET_SERVO_CONFIGURATION: 212,
|
||||||
MSP_SET_MOTOR: 214,
|
MSP_SET_MOTOR: 214,
|
||||||
MSP_SET_3D: 217,
|
MSP_SET_3D: 217,
|
||||||
MSP_SET_RC_DEADBAND: 218,
|
MSP_SET_RC_DEADBAND: 218,
|
||||||
MSP_SET_RESET_CURR_PID: 219,
|
MSP_SET_RESET_CURR_PID: 219,
|
||||||
MSP_SET_SENSOR_ALIGNMENT: 220,
|
MSP_SET_SENSOR_ALIGNMENT: 220,
|
||||||
MSP_SET_LED_STRIP_MODECOLOR:221,
|
MSP_SET_LED_STRIP_MODECOLOR: 221,
|
||||||
|
|
||||||
MSP_SET_ACC_TRIM: 239,
|
MSP_SET_ACC_TRIM: 239,
|
||||||
MSP_ACC_TRIM: 240,
|
MSP_ACC_TRIM: 240,
|
||||||
|
|
|
@ -203,6 +203,21 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
||||||
MISC.vbatmaxcellvoltage = data.readU8() / 10; // 10-50
|
MISC.vbatmaxcellvoltage = data.readU8() / 10; // 10-50
|
||||||
MISC.vbatwarningcellvoltage = data.readU8() / 10; // 10-50
|
MISC.vbatwarningcellvoltage = data.readU8() / 10; // 10-50
|
||||||
break;
|
break;
|
||||||
|
case MSPCodes.MSP_VOLTAGE_METER_CONFIG:
|
||||||
|
MISC.vbatscale = data.readU8(); // 10-200
|
||||||
|
MISC.vbatmincellvoltage = data.readU8() / 10; // 10-50
|
||||||
|
MISC.vbatmaxcellvoltage = data.readU8() / 10; // 10-50
|
||||||
|
MISC.vbatwarningcellvoltage = data.readU8() / 10; // 10-50
|
||||||
|
if (semver.gte(CONFIG.apiVersion, "1.23.0")) {
|
||||||
|
MISC.batterymetertype = data.readU8();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MSPCodes.MSP_CURRENT_METER_CONFIG:
|
||||||
|
BF_CONFIG.currentscale = data.readU16();
|
||||||
|
BF_CONFIG.currentoffset = data.readU16();
|
||||||
|
BF_CONFIG.currentmetertype = data.readU8();
|
||||||
|
BF_CONFIG.batterycapacity = data.readU16();
|
||||||
|
break;
|
||||||
case MSPCodes.MSP_3D:
|
case MSPCodes.MSP_3D:
|
||||||
_3D.deadband3d_low = data.readU16();
|
_3D.deadband3d_low = data.readU16();
|
||||||
_3D.deadband3d_high = data.readU16();
|
_3D.deadband3d_high = data.readU16();
|
||||||
|
@ -342,6 +357,11 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
||||||
case MSPCodes.MSP_EEPROM_WRITE:
|
case MSPCodes.MSP_EEPROM_WRITE:
|
||||||
console.log('Settings Saved in EEPROM');
|
console.log('Settings Saved in EEPROM');
|
||||||
break;
|
break;
|
||||||
|
case MSPCodes.MSP_SET_CURRENT_METER_CONFIG:
|
||||||
|
console.log('Current Settings saved');
|
||||||
|
break;
|
||||||
|
case MSPCodes.MSP_SET_VOLTAGE_METER_CONFIG:
|
||||||
|
console.log('Voltage config saved');
|
||||||
case MSPCodes.MSP_DEBUG:
|
case MSPCodes.MSP_DEBUG:
|
||||||
for (var i = 0; i < 4; i++)
|
for (var i = 0; i < 4; i++)
|
||||||
SENSOR_DATA.debug[i] = data.read16();
|
SENSOR_DATA.debug[i] = data.read16();
|
||||||
|
@ -1009,7 +1029,21 @@ MspHelper.prototype.crunch = function(code) {
|
||||||
.push8(Math.round(MISC.vbatmaxcellvoltage * 10))
|
.push8(Math.round(MISC.vbatmaxcellvoltage * 10))
|
||||||
.push8(Math.round(MISC.vbatwarningcellvoltage * 10));
|
.push8(Math.round(MISC.vbatwarningcellvoltage * 10));
|
||||||
break;
|
break;
|
||||||
|
case MSPCodes.MSP_SET_VOLTAGE_METER_CONFIG:
|
||||||
|
buffer.push8(MISC.vbatscale)
|
||||||
|
.push8(Math.round(MISC.vbatmincellvoltage * 10))
|
||||||
|
.push8(Math.round(MISC.vbatmaxcellvoltage * 10))
|
||||||
|
.push8(Math.round(MISC.vbatwarningcellvoltage * 10));
|
||||||
|
if (semver.gte(CONFIG.apiVersion, "1.23.0")) {
|
||||||
|
buffer.push8(MISC.batterymetertype);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MSPCodes.MSP_SET_CURRENT_METER_CONFIG:
|
||||||
|
buffer.push16(BF_CONFIG.currentscale)
|
||||||
|
.push16(BF_CONFIG.currentoffset)
|
||||||
|
.push8(BF_CONFIG.currentmetertype)
|
||||||
|
.push16(BF_CONFIG.batterycapacity)
|
||||||
|
break;
|
||||||
case MSPCodes.MSP_SET_RX_CONFIG:
|
case MSPCodes.MSP_SET_RX_CONFIG:
|
||||||
buffer.push8(RX_CONFIG.serialrx_provider)
|
buffer.push8(RX_CONFIG.serialrx_provider)
|
||||||
.push16(RX_CONFIG.maxcheck)
|
.push16(RX_CONFIG.maxcheck)
|
||||||
|
|
|
@ -295,6 +295,20 @@
|
||||||
width: 30px;
|
width: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tab-configuration .batterymetertype {
|
||||||
|
border: 1px solid silver;
|
||||||
|
margin-right: 5px;
|
||||||
|
float: left;
|
||||||
|
width: 150px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-configuration .currentmetertype {
|
||||||
|
border: 1px solid silver;
|
||||||
|
margin-right: 5px;
|
||||||
|
float: left;
|
||||||
|
width: 150px;
|
||||||
|
}
|
||||||
|
|
||||||
.tab-configuration .rssi td:nth-child(2) {
|
.tab-configuration .rssi td:nth-child(2) {
|
||||||
width: 30px;
|
width: 30px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -339,6 +339,12 @@
|
||||||
<!-- table generated here -->
|
<!-- table generated here -->
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<div class="select">
|
||||||
|
<label>
|
||||||
|
<select class="batterymetertype"><!-- list generated here --></select>
|
||||||
|
<span i18n="configurationBatteryMeterType"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
<div class="number">
|
<div class="number">
|
||||||
<label> <input type="number" name="mincellvoltage" step="0.1" min="1" max="5" /> <span
|
<label> <input type="number" name="mincellvoltage" step="0.1" min="1" max="5" /> <span
|
||||||
i18n="configurationBatteryMinimum"></span>
|
i18n="configurationBatteryMinimum"></span>
|
||||||
|
@ -383,6 +389,12 @@
|
||||||
<!-- table generated here -->
|
<!-- table generated here -->
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<div class="select">
|
||||||
|
<label>
|
||||||
|
<select class="currentmetertype"><!-- list generated here --></select>
|
||||||
|
<span i18n="configurationCurrentMeterType"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
<div class="number">
|
<div class="number">
|
||||||
<label> <input type="number" name="currentscale" step="1" min="-16000" max="16000" /> <span
|
<label> <input type="number" name="currentscale" step="1" min="-16000" max="16000" /> <span
|
||||||
i18n="configurationCurrentScale"></span>
|
i18n="configurationCurrentScale"></span>
|
||||||
|
|
|
@ -72,7 +72,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
|
|
||||||
function esc_protocol() {
|
function esc_protocol() {
|
||||||
var next_callback = sensor_config;
|
var next_callback = sensor_config;
|
||||||
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.gte(CONFIG.flightControllerVersion, "2.8.1")) {
|
if (semver.gte(CONFIG.flightControllerVersion, "2.8.1")) {
|
||||||
MSP.send_message(MSPCodes.MSP_ADVANCED_CONFIG, false, false, next_callback);
|
MSP.send_message(MSPCodes.MSP_ADVANCED_CONFIG, false, false, next_callback);
|
||||||
} else {
|
} else {
|
||||||
next_callback();
|
next_callback();
|
||||||
|
@ -81,7 +81,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
|
|
||||||
function sensor_config() {
|
function sensor_config() {
|
||||||
var next_callback = load_sensor_alignment;
|
var next_callback = load_sensor_alignment;
|
||||||
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.gte(CONFIG.flightControllerVersion, "2.8.2")) {
|
if (semver.gte(CONFIG.flightControllerVersion, "2.8.2")) {
|
||||||
MSP.send_message(MSPCodes.MSP_SENSOR_CONFIG, false, false, next_callback);
|
MSP.send_message(MSPCodes.MSP_SENSOR_CONFIG, false, false, next_callback);
|
||||||
} else {
|
} else {
|
||||||
next_callback();
|
next_callback();
|
||||||
|
@ -98,14 +98,32 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_name() {
|
function load_name() {
|
||||||
var next_callback = load_html;
|
var next_callback = load_battery;
|
||||||
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
|
if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
|
||||||
MSP.send_message(MSPCodes.MSP_NAME, false, false, next_callback);
|
MSP.send_message(MSPCodes.MSP_NAME, false, false, next_callback);
|
||||||
} else {
|
} else {
|
||||||
next_callback();
|
next_callback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function load_battery() {
|
||||||
|
var next_callback = load_current;
|
||||||
|
if (semver.gte(CONFIG.flightControllerVersion, "3.1.0")) {
|
||||||
|
MSP.send_message(MSPCodes.MSP_VOLTAGE_METER_CONFIG, false, false, next_callback);
|
||||||
|
} else {
|
||||||
|
next_callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function load_current() {
|
||||||
|
var next_callback = load_html;
|
||||||
|
if (semver.gte(CONFIG.flightControllerVersion, "3.1.0")) {
|
||||||
|
MSP.send_message(MSPCodes.MSP_CURRENT_METER_CONFIG, false, false, next_callback);
|
||||||
|
} else {
|
||||||
|
next_callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//Update Analog/Battery Data
|
//Update Analog/Battery Data
|
||||||
function load_analog() {
|
function load_analog() {
|
||||||
|
@ -277,19 +295,19 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
|
|
||||||
|
|
||||||
// Only show these sections for supported FW
|
// Only show these sections for supported FW
|
||||||
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.lt(CONFIG.flightControllerVersion, "2.8.1")) {
|
if (semver.lt(CONFIG.flightControllerVersion, "2.8.1")) {
|
||||||
$('.selectProtocol').hide();
|
$('.selectProtocol').hide();
|
||||||
$('.checkboxPwm').hide();
|
$('.checkboxPwm').hide();
|
||||||
$('.selectPidProcessDenom').hide();
|
$('.selectPidProcessDenom').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.lt(CONFIG.flightControllerVersion, "2.8.2")) {
|
if (semver.lt(CONFIG.flightControllerVersion, "2.8.2")) {
|
||||||
$('.hardwareSelection').hide();
|
$('.hardwareSelection').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
$('input[name="vesselName"]').val(CONFIG.name);
|
$('input[name="vesselName"]').val(CONFIG.name);
|
||||||
|
|
||||||
if (CONFIG.flightControllerIdentifier != "BTFL" || semver.lt(CONFIG.flightControllerVersion, "3.0.0")) {
|
if (semver.lt(CONFIG.flightControllerVersion, "3.0.0")) {
|
||||||
$('.miscSettings').hide();
|
$('.miscSettings').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,12 +444,46 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
$('input[name="mincommand"]').val(MISC.mincommand);
|
$('input[name="mincommand"]').val(MISC.mincommand);
|
||||||
|
|
||||||
// fill battery
|
// fill battery
|
||||||
|
var batteryMeterTypes = [
|
||||||
|
'Onboard ADC',
|
||||||
|
'ESC Sensor',
|
||||||
|
];
|
||||||
|
|
||||||
|
var batteryMeterType_e = $('select.batterymetertype');
|
||||||
|
for (i = 0; i < batteryMeterTypes.length; i++) {
|
||||||
|
batteryMeterType_e.append('<option value="' + i + '">' + batteryMeterTypes[i] + '</option>');
|
||||||
|
}
|
||||||
|
|
||||||
|
batteryMeterType_e.change(function () {
|
||||||
|
MISC.batterymetertype = parseInt($(this).val());
|
||||||
|
checkDisableVbatControls();
|
||||||
|
});
|
||||||
|
batteryMeterType_e.val(MISC.batterymetertype).change();
|
||||||
|
|
||||||
$('input[name="mincellvoltage"]').val(MISC.vbatmincellvoltage);
|
$('input[name="mincellvoltage"]').val(MISC.vbatmincellvoltage);
|
||||||
$('input[name="maxcellvoltage"]').val(MISC.vbatmaxcellvoltage);
|
$('input[name="maxcellvoltage"]').val(MISC.vbatmaxcellvoltage);
|
||||||
$('input[name="warningcellvoltage"]').val(MISC.vbatwarningcellvoltage);
|
$('input[name="warningcellvoltage"]').val(MISC.vbatwarningcellvoltage);
|
||||||
$('input[name="voltagescale"]').val(MISC.vbatscale);
|
$('input[name="voltagescale"]').val(MISC.vbatscale);
|
||||||
|
|
||||||
// fill current
|
// fill current
|
||||||
|
var currentMeterTypes = [
|
||||||
|
'None',
|
||||||
|
'Onboard ADC',
|
||||||
|
'Virtual',
|
||||||
|
'ESC Sensor',
|
||||||
|
];
|
||||||
|
|
||||||
|
var currentMeterType_e = $('select.currentmetertype');
|
||||||
|
for (i = 0; i < currentMeterTypes.length; i++) {
|
||||||
|
currentMeterType_e.append('<option value="' + i + '">' + currentMeterTypes[i] + '</option>');
|
||||||
|
}
|
||||||
|
|
||||||
|
currentMeterType_e.change(function () {
|
||||||
|
BF_CONFIG.currentmetertype = parseInt($(this).val());
|
||||||
|
checkDisableCurrentControls();
|
||||||
|
});
|
||||||
|
currentMeterType_e.val(BF_CONFIG.currentmetertype).change();
|
||||||
|
|
||||||
$('input[name="currentscale"]').val(BF_CONFIG.currentscale);
|
$('input[name="currentscale"]').val(BF_CONFIG.currentscale);
|
||||||
$('input[name="currentoffset"]').val(BF_CONFIG.currentoffset);
|
$('input[name="currentoffset"]').val(BF_CONFIG.currentoffset);
|
||||||
$('input[name="multiwiicurrentoutput"]').prop('checked', MISC.multiwiicurrentoutput !== 0);
|
$('input[name="multiwiicurrentoutput"]').prop('checked', MISC.multiwiicurrentoutput !== 0);
|
||||||
|
@ -475,6 +527,49 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkDisableVbatControls() {
|
||||||
|
if (BF_CONFIG.features.isEnabled('VBAT')) {
|
||||||
|
$('select.batterymetertype').prop('disabled', false);
|
||||||
|
if (MISC.batterymetertype == 1) {
|
||||||
|
$('input[name="mincellvoltage"]').prop('disabled', true);
|
||||||
|
$('input[name="maxcellvoltage"]').prop('disabled', true);
|
||||||
|
$('input[name="warningcellvoltage"]').prop('disabled', true);
|
||||||
|
$('input[name="voltagescale"]').prop('disabled', true);
|
||||||
|
} else {
|
||||||
|
$('input[name="mincellvoltage"]').prop('disabled', false);
|
||||||
|
$('input[name="maxcellvoltage"]').prop('disabled', false);
|
||||||
|
$('input[name="warningcellvoltage"]').prop('disabled', false);
|
||||||
|
$('input[name="voltagescale"]').prop('disabled', false);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$('select.batterymetertype').prop('disabled', true);
|
||||||
|
$('input[name="mincellvoltage"]').prop('disabled', true);
|
||||||
|
$('input[name="maxcellvoltage"]').prop('disabled', true);
|
||||||
|
$('input[name="warningcellvoltage"]').prop('disabled', true);
|
||||||
|
$('input[name="voltagescale"]').prop('disabled', true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkDisableCurrentControls() {
|
||||||
|
if (BF_CONFIG.features.isEnabled('CURRENT_METER')) {
|
||||||
|
$('select.currentmetertype').prop('disabled', false);
|
||||||
|
if (BF_CONFIG.currentmetertype == 0 || BF_CONFIG.currentmetertype == 3) {
|
||||||
|
$('input[name="currentscale"]').prop('disabled', true);
|
||||||
|
$('input[name="currentoffset"]').prop('disabled', true);
|
||||||
|
$('input[name="multiwiicurrentoutput"]').prop('disabled', true);
|
||||||
|
} else {
|
||||||
|
$('input[name="currentscale"]').prop('disabled', false);
|
||||||
|
$('input[name="currentoffset"]').prop('disabled', false);
|
||||||
|
$('input[name="multiwiicurrentoutput"]').prop('disabled', false);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$('select.currentmetertype').prop('disabled', true);
|
||||||
|
$('input[name="currentscale"]').prop('disabled', true);
|
||||||
|
$('input[name="currentoffset"]').prop('disabled', true);
|
||||||
|
$('input[name="multiwiicurrentoutput"]').prop('disabled', true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$(features_e).filter('select').change(function () {
|
$(features_e).filter('select').change(function () {
|
||||||
var element = $(this);
|
var element = $(this);
|
||||||
|
|
||||||
|
@ -485,7 +580,18 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
checkShowSerialRxBox();
|
checkShowSerialRxBox();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(features_e).filter('tbody.features.batteryVoltage').change(function() {
|
||||||
|
checkDisableVbatControls();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(features_e).filter('tbody.features.batteryCurrent').change(function() {
|
||||||
|
checkDisableCurrentControls();
|
||||||
|
});
|
||||||
|
|
||||||
checkShowSerialRxBox();
|
checkShowSerialRxBox();
|
||||||
|
checkDisableVbatControls();
|
||||||
|
checkDisableCurrentControls();
|
||||||
|
|
||||||
$("input[id='unsyncedPWMSwitch']").change(function() {
|
$("input[id='unsyncedPWMSwitch']").change(function() {
|
||||||
if ($(this).is(':checked')) {
|
if ($(this).is(':checked')) {
|
||||||
|
@ -582,7 +688,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
}
|
}
|
||||||
function save_esc_protocol() {
|
function save_esc_protocol() {
|
||||||
var next_callback = save_acc_trim;
|
var next_callback = save_acc_trim;
|
||||||
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.gte(CONFIG.flightControllerVersion, "2.8.1")) {
|
if (semver.gte(CONFIG.flightControllerVersion, "2.8.1")) {
|
||||||
MSP.send_message(MSPCodes.MSP_SET_ADVANCED_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_ADVANCED_CONFIG), false, next_callback);
|
MSP.send_message(MSPCodes.MSP_SET_ADVANCED_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_ADVANCED_CONFIG), false, next_callback);
|
||||||
} else {
|
} else {
|
||||||
next_callback();
|
next_callback();
|
||||||
|
@ -600,7 +706,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
|
|
||||||
function save_looptime_config() {
|
function save_looptime_config() {
|
||||||
var next_callback = save_sensor_config;
|
var next_callback = save_sensor_config;
|
||||||
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.lt(CONFIG.flightControllerVersion, "2.8.1")) {
|
if (semver.lt(CONFIG.flightControllerVersion, "2.8.1")) {
|
||||||
FC_CONFIG.loopTime = PID_ADVANCED_CONFIG.gyro_sync_denom * 125;
|
FC_CONFIG.loopTime = PID_ADVANCED_CONFIG.gyro_sync_denom * 125;
|
||||||
MSP.send_message(MSPCodes.MSP_SET_LOOP_TIME, mspHelper.crunch(MSPCodes.MSP_SET_LOOP_TIME), false, next_callback);
|
MSP.send_message(MSPCodes.MSP_SET_LOOP_TIME, mspHelper.crunch(MSPCodes.MSP_SET_LOOP_TIME), false, next_callback);
|
||||||
} else {
|
} else {
|
||||||
|
@ -610,7 +716,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
function save_sensor_config() {
|
function save_sensor_config() {
|
||||||
var next_callback = save_name;
|
var next_callback = save_name;
|
||||||
|
|
||||||
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.gte(CONFIG.flightControllerVersion, "2.8.2")) {
|
if (semver.gte(CONFIG.flightControllerVersion, "2.8.2")) {
|
||||||
SENSOR_CONFIG.acc_hardware = $('input[id="accHardwareSwitch"]').is(':checked') ? 0 : 1;
|
SENSOR_CONFIG.acc_hardware = $('input[id="accHardwareSwitch"]').is(':checked') ? 0 : 1;
|
||||||
SENSOR_CONFIG.baro_hardware = $('input[id="baroHardwareSwitch"]').is(':checked') ? 0 : 1;
|
SENSOR_CONFIG.baro_hardware = $('input[id="baroHardwareSwitch"]').is(':checked') ? 0 : 1;
|
||||||
SENSOR_CONFIG.mag_hardware = $('input[id="magHardwareSwitch"]').is(':checked') ? 0 : 1;
|
SENSOR_CONFIG.mag_hardware = $('input[id="magHardwareSwitch"]').is(':checked') ? 0 : 1;
|
||||||
|
@ -621,9 +727,9 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function save_name() {
|
function save_name() {
|
||||||
var next_callback = save_to_eeprom;
|
var next_callback = save_battery;
|
||||||
|
|
||||||
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
|
if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
|
||||||
CONFIG.name = $.trim($('input[name="vesselName"]').val());
|
CONFIG.name = $.trim($('input[name="vesselName"]').val());
|
||||||
MSP.send_message(MSPCodes.MSP_SET_NAME, mspHelper.crunch(MSPCodes.MSP_SET_NAME), false, next_callback);
|
MSP.send_message(MSPCodes.MSP_SET_NAME, mspHelper.crunch(MSPCodes.MSP_SET_NAME), false, next_callback);
|
||||||
} else {
|
} else {
|
||||||
|
@ -631,6 +737,24 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function save_battery() {
|
||||||
|
var next_callback = save_current;
|
||||||
|
if (semver.gte(CONFIG.flightControllerVersion, "3.1.0")) {
|
||||||
|
MSP.send_message(MSPCodes.MSP_SET_VOLTAGE_METER_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_VOLTAGE_METER_CONFIG), false, next_callback);
|
||||||
|
} else {
|
||||||
|
next_callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function save_current() {
|
||||||
|
var next_callback = save_to_eeprom;
|
||||||
|
if (semver.gte(CONFIG.flightControllerVersion, "3.1.0")) {
|
||||||
|
MSP.send_message(MSPCodes.MSP_SET_CURRENT_METER_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_CURRENT_METER_CONFIG), false, next_callback);
|
||||||
|
} else {
|
||||||
|
next_callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function save_to_eeprom() {
|
function save_to_eeprom() {
|
||||||
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, reboot);
|
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, reboot);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue