mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-24 00:35:26 +03:00
Bump API_VERSION_ACCEPTED and semver cleanup (#3104)
Firmware flasher: build config help icons style fix (#3092) Co-authored-by: Ivan Efimov <gendalf44@yandex.ru>
This commit is contained in:
parent
7df8d627e9
commit
867b59d204
31 changed files with 1702 additions and 4113 deletions
|
@ -1,4 +1,3 @@
|
|||
import semver from 'semver';
|
||||
import { i18n } from '../localization';
|
||||
|
||||
const power = {
|
||||
|
@ -54,13 +53,9 @@ power.initialize = function (callback) {
|
|||
$('#content').load("./tabs/power.html", process_html);
|
||||
}
|
||||
|
||||
this.supported = semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_33);
|
||||
this.supported = true;
|
||||
|
||||
if (!this.supported) {
|
||||
load_html();
|
||||
} else {
|
||||
load_status();
|
||||
}
|
||||
load_status();
|
||||
|
||||
function updateDisplay(voltageDataSource, currentDataSource) {
|
||||
// voltage meters
|
||||
|
@ -227,18 +222,16 @@ power.initialize = function (callback) {
|
|||
const elementBatteryConfiguration = templateBatteryConfiguration.clone();
|
||||
destinationBatteryConfiguration.append(elementBatteryConfiguration);
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_41)) {
|
||||
$('input[name="mincellvoltage"]').prop('step','0.01');
|
||||
$('input[name="maxcellvoltage"]').prop('step','0.01');
|
||||
$('input[name="warningcellvoltage"]').prop('step','0.01');
|
||||
}
|
||||
$('input[name="mincellvoltage"]').prop('step','0.01');
|
||||
$('input[name="maxcellvoltage"]').prop('step','0.01');
|
||||
$('input[name="warningcellvoltage"]').prop('step','0.01');
|
||||
|
||||
$('input[name="mincellvoltage"]').val(FC.BATTERY_CONFIG.vbatmincellvoltage);
|
||||
$('input[name="maxcellvoltage"]').val(FC.BATTERY_CONFIG.vbatmaxcellvoltage);
|
||||
$('input[name="warningcellvoltage"]').val(FC.BATTERY_CONFIG.vbatwarningcellvoltage);
|
||||
$('input[name="capacity"]').val(FC.BATTERY_CONFIG.capacity);
|
||||
|
||||
const haveFc = (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_35) || (FC.CONFIG.boardType == 0 || FC.CONFIG.boardType == 2));
|
||||
const haveFc = FC.CONFIG.boardType === 0 || FC.CONFIG.boardType === 2;
|
||||
|
||||
const batteryMeterTypes = [
|
||||
i18n.getMessage('powerBatteryVoltageMeterTypeNone'),
|
||||
|
@ -264,10 +257,7 @@ power.initialize = function (callback) {
|
|||
if (haveFc) {
|
||||
currentMeterTypes.push(i18n.getMessage('powerBatteryCurrentMeterTypeVirtual'));
|
||||
currentMeterTypes.push(i18n.getMessage('powerBatteryCurrentMeterTypeEsc'));
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_36)) {
|
||||
currentMeterTypes.push(i18n.getMessage('powerBatteryCurrentMeterTypeMsp'));
|
||||
}
|
||||
currentMeterTypes.push(i18n.getMessage('powerBatteryCurrentMeterTypeMsp'));
|
||||
}
|
||||
|
||||
let currentMeterType_e = $('select.currentmetersource');
|
||||
|
@ -495,19 +485,11 @@ power.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function save_voltage_config() {
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_36)) {
|
||||
mspHelper.sendVoltageConfig(save_amperage_config);
|
||||
} else {
|
||||
MSP.send_message(MSPCodes.MSP_SET_VOLTAGE_METER_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_VOLTAGE_METER_CONFIG), false, save_amperage_config);
|
||||
}
|
||||
mspHelper.sendVoltageConfig(save_amperage_config);
|
||||
}
|
||||
|
||||
function save_amperage_config() {
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_36)) {
|
||||
mspHelper.sendCurrentConfig(save_to_eeprom);
|
||||
} else {
|
||||
MSP.send_message(MSPCodes.MSP_SET_CURRENT_METER_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_CURRENT_METER_CONFIG), false, save_to_eeprom);
|
||||
}
|
||||
mspHelper.sendCurrentConfig(save_to_eeprom);
|
||||
}
|
||||
|
||||
function save_to_eeprom() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue