mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-17 13:25:24 +03:00
Vbat precision (fixes)
This commit is contained in:
parent
d687e382fe
commit
95f4f1c888
6 changed files with 29 additions and 12 deletions
|
@ -1838,6 +1838,7 @@ dialog {
|
|||
width: 60px;
|
||||
transition: none;
|
||||
margin-top: 4px;
|
||||
margin-left: -4px;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
ANALOG.rssi = data.readU16(); // 0-1023
|
||||
ANALOG.amperage = data.read16() / 100; // A
|
||||
ANALOG.last_received_timestamp = Date.now();
|
||||
if (semver.gte(CONFIG.apiVersion, "1.??.0")) {
|
||||
if (semver.gte(CONFIG.apiVersion, "1.41.0")) {
|
||||
ANALOG.voltage = data.readU16() / 100;
|
||||
}
|
||||
break;
|
||||
|
@ -213,8 +213,8 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
BATTERY_STATE.voltage = data.readU8() / 10.0; // V
|
||||
BATTERY_STATE.mAhDrawn = data.readU16(); // mAh
|
||||
BATTERY_STATE.amperage = data.readU16() / 100; // A
|
||||
if (semver.gte(CONFIG.apiVersion, "1.??.0")) {
|
||||
data.readU8();
|
||||
if (semver.gte(CONFIG.apiVersion, "1.41.0")) {
|
||||
BATTERY_STATE.batteryState = data.readU8();
|
||||
BATTERY_STATE.voltage = data.readU16() / 100;
|
||||
}
|
||||
break;
|
||||
|
@ -288,7 +288,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
BATTERY_CONFIG.capacity = data.readU16();
|
||||
BATTERY_CONFIG.voltageMeterSource = data.readU8();
|
||||
BATTERY_CONFIG.currentMeterSource = data.readU8();
|
||||
if (semver.gte(CONFIG.apiVersion, "1.??.0")) {
|
||||
if (semver.gte(CONFIG.apiVersion, "1.41.0")) {
|
||||
BATTERY_CONFIG.vbatmincellvoltage = data.readU16() / 100;
|
||||
BATTERY_CONFIG.vbatmaxcellvoltage = data.readU16() / 100;
|
||||
BATTERY_CONFIG.vbatwarningcellvoltage = data.readU16() / 100;
|
||||
|
@ -1446,7 +1446,7 @@ MspHelper.prototype.crunch = function(code) {
|
|||
.push16(BATTERY_CONFIG.capacity)
|
||||
.push8(BATTERY_CONFIG.voltageMeterSource)
|
||||
.push8(BATTERY_CONFIG.currentMeterSource);
|
||||
if (semver.gte(CONFIG.apiVersion, "1.??.0")) {
|
||||
if (semver.gte(CONFIG.apiVersion, "1.41.0")) {
|
||||
buffer.push16(Math.round(BATTERY_CONFIG.vbatmincellvoltage * 100))
|
||||
.push16(Math.round(BATTERY_CONFIG.vbatmaxcellvoltage * 100))
|
||||
.push16(Math.round(BATTERY_CONFIG.vbatwarningcellvoltage * 100));
|
||||
|
|
|
@ -757,6 +757,12 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
$('div.batterymetertype').hide();
|
||||
}
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.41.0")) {
|
||||
$('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(MISC.vbatmincellvoltage);
|
||||
$('input[name="maxcellvoltage"]').val(MISC.vbatmaxcellvoltage);
|
||||
$('input[name="warningcellvoltage"]').val(MISC.vbatwarningcellvoltage);
|
||||
|
|
|
@ -181,6 +181,12 @@ TABS.power.initialize = function (callback) {
|
|||
var element = template.clone();
|
||||
destination.append(element);
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.41.0")) {
|
||||
$('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(BATTERY_CONFIG.vbatmincellvoltage);
|
||||
$('input[name="maxcellvoltage"]').val(BATTERY_CONFIG.vbatmaxcellvoltage);
|
||||
$('input[name="warningcellvoltage"]').val(BATTERY_CONFIG.vbatwarningcellvoltage);
|
||||
|
@ -247,7 +253,11 @@ TABS.power.initialize = function (callback) {
|
|||
for (var i = 0; i < VOLTAGE_METERS.length; i++) {
|
||||
var elementName = '#voltage-meter-' + i + ' .value';
|
||||
var element = $(elementName);
|
||||
element.text(i18n.getMessage('powerVoltageValue', [VOLTAGE_METERS[i].voltage]));
|
||||
if (semver.gte(CONFIG.apiVersion, "1.41.0")) {
|
||||
element.text(i18n.getMessage('powerVoltageValue', [ANALOG.voltage]));
|
||||
} else {
|
||||
element.text(i18n.getMessage('powerVoltageValue', [VOLTAGE_METERS[i].voltage]));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -587,17 +587,17 @@
|
|||
</label>
|
||||
</div>
|
||||
<div class="number vbatmonitoring">
|
||||
<label> <input type="number" name="mincellvoltage" step="0.01" min="1" max="5" /> <span
|
||||
<label> <input type="number" name="mincellvoltage" step="0.1" min="1" max="5" /> <span
|
||||
i18n="configurationBatteryMinimum"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="number vbatmonitoring">
|
||||
<label> <input type="number" name="maxcellvoltage" step="0.01" min="1" max="5" /> <span
|
||||
<label> <input type="number" name="maxcellvoltage" step="0.1" min="1" max="5" /> <span
|
||||
i18n="configurationBatteryMaximum"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="number vbatmonitoring">
|
||||
<label> <input type="number" name="warningcellvoltage" step="0.01" min="1" max="5" /> <span
|
||||
<label> <input type="number" name="warningcellvoltage" step="0.1" min="1" max="5" /> <span
|
||||
i18n="configurationBatteryWarning"></span>
|
||||
</label>
|
||||
</div>
|
||||
|
|
|
@ -155,17 +155,17 @@
|
|||
</div>
|
||||
|
||||
<div class="number">
|
||||
<label> <input type="number" name="mincellvoltage" step="0.01" min="1" max="5" /> <span
|
||||
<label> <input type="number" name="mincellvoltage" step="0.1" min="1" max="5" /> <span
|
||||
i18n="powerBatteryMinimum"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="number">
|
||||
<label> <input type="number" name="maxcellvoltage" step="0.01" min="1" max="5" /> <span
|
||||
<label> <input type="number" name="maxcellvoltage" step="0.1" min="1" max="5" /> <span
|
||||
i18n="powerBatteryMaximum"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="number">
|
||||
<label> <input type="number" name="warningcellvoltage" step="0.01" min="1" max="5" /> <span
|
||||
<label> <input type="number" name="warningcellvoltage" step="0.1" min="1" max="5" /> <span
|
||||
i18n="powerBatteryWarning"></span>
|
||||
</label>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue