mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-21 23:35:22 +03:00
Increased Vbat precision
This commit is contained in:
parent
d6cdba8d91
commit
d687e382fe
3 changed files with 23 additions and 7 deletions
|
@ -178,6 +178,9 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
||||||
ANALOG.rssi = data.readU16(); // 0-1023
|
ANALOG.rssi = data.readU16(); // 0-1023
|
||||||
ANALOG.amperage = data.read16() / 100; // A
|
ANALOG.amperage = data.read16() / 100; // A
|
||||||
ANALOG.last_received_timestamp = Date.now();
|
ANALOG.last_received_timestamp = Date.now();
|
||||||
|
if (semver.gte(CONFIG.apiVersion, "1.??.0")) {
|
||||||
|
ANALOG.voltage = data.readU16() / 100;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case MSPCodes.MSP_VOLTAGE_METERS:
|
case MSPCodes.MSP_VOLTAGE_METERS:
|
||||||
VOLTAGE_METERS = [];
|
VOLTAGE_METERS = [];
|
||||||
|
@ -210,6 +213,10 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
||||||
BATTERY_STATE.voltage = data.readU8() / 10.0; // V
|
BATTERY_STATE.voltage = data.readU8() / 10.0; // V
|
||||||
BATTERY_STATE.mAhDrawn = data.readU16(); // mAh
|
BATTERY_STATE.mAhDrawn = data.readU16(); // mAh
|
||||||
BATTERY_STATE.amperage = data.readU16() / 100; // A
|
BATTERY_STATE.amperage = data.readU16() / 100; // A
|
||||||
|
if (semver.gte(CONFIG.apiVersion, "1.??.0")) {
|
||||||
|
data.readU8();
|
||||||
|
BATTERY_STATE.voltage = data.readU16() / 100;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSPCodes.MSP_VOLTAGE_METER_CONFIG:
|
case MSPCodes.MSP_VOLTAGE_METER_CONFIG:
|
||||||
|
@ -281,7 +288,11 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
||||||
BATTERY_CONFIG.capacity = data.readU16();
|
BATTERY_CONFIG.capacity = data.readU16();
|
||||||
BATTERY_CONFIG.voltageMeterSource = data.readU8();
|
BATTERY_CONFIG.voltageMeterSource = data.readU8();
|
||||||
BATTERY_CONFIG.currentMeterSource = data.readU8();
|
BATTERY_CONFIG.currentMeterSource = data.readU8();
|
||||||
|
if (semver.gte(CONFIG.apiVersion, "1.??.0")) {
|
||||||
|
BATTERY_CONFIG.vbatmincellvoltage = data.readU16() / 100;
|
||||||
|
BATTERY_CONFIG.vbatmaxcellvoltage = data.readU16() / 100;
|
||||||
|
BATTERY_CONFIG.vbatwarningcellvoltage = data.readU16() / 100;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case MSPCodes.MSP_RC_TUNING:
|
case MSPCodes.MSP_RC_TUNING:
|
||||||
RC_tuning.RC_RATE = parseFloat((data.readU8() / 100).toFixed(2));
|
RC_tuning.RC_RATE = parseFloat((data.readU8() / 100).toFixed(2));
|
||||||
|
@ -1435,6 +1446,11 @@ MspHelper.prototype.crunch = function(code) {
|
||||||
.push16(BATTERY_CONFIG.capacity)
|
.push16(BATTERY_CONFIG.capacity)
|
||||||
.push8(BATTERY_CONFIG.voltageMeterSource)
|
.push8(BATTERY_CONFIG.voltageMeterSource)
|
||||||
.push8(BATTERY_CONFIG.currentMeterSource);
|
.push8(BATTERY_CONFIG.currentMeterSource);
|
||||||
|
if (semver.gte(CONFIG.apiVersion, "1.??.0")) {
|
||||||
|
buffer.push16(Math.round(BATTERY_CONFIG.vbatmincellvoltage * 100))
|
||||||
|
.push16(Math.round(BATTERY_CONFIG.vbatmaxcellvoltage * 100))
|
||||||
|
.push16(Math.round(BATTERY_CONFIG.vbatwarningcellvoltage * 100));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case MSPCodes.MSP_SET_VOLTAGE_METER_CONFIG:
|
case MSPCodes.MSP_SET_VOLTAGE_METER_CONFIG:
|
||||||
if (semver.lt(CONFIG.apiVersion, "1.36.0")) {
|
if (semver.lt(CONFIG.apiVersion, "1.36.0")) {
|
||||||
|
|
|
@ -587,17 +587,17 @@
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="number vbatmonitoring">
|
<div class="number vbatmonitoring">
|
||||||
<label> <input type="number" name="mincellvoltage" step="0.1" min="1" max="5" /> <span
|
<label> <input type="number" name="mincellvoltage" step="0.01" min="1" max="5" /> <span
|
||||||
i18n="configurationBatteryMinimum"></span>
|
i18n="configurationBatteryMinimum"></span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="number vbatmonitoring">
|
<div class="number vbatmonitoring">
|
||||||
<label> <input type="number" name="maxcellvoltage" step="0.1" min="1" max="5" /> <span
|
<label> <input type="number" name="maxcellvoltage" step="0.01" min="1" max="5" /> <span
|
||||||
i18n="configurationBatteryMaximum"></span>
|
i18n="configurationBatteryMaximum"></span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="number vbatmonitoring">
|
<div class="number vbatmonitoring">
|
||||||
<label> <input type="number" name="warningcellvoltage" step="0.1" min="1" max="5" /> <span
|
<label> <input type="number" name="warningcellvoltage" step="0.01" min="1" max="5" /> <span
|
||||||
i18n="configurationBatteryWarning"></span>
|
i18n="configurationBatteryWarning"></span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -155,17 +155,17 @@
|
||||||
</div>
|
</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.01" min="1" max="5" /> <span
|
||||||
i18n="powerBatteryMinimum"></span>
|
i18n="powerBatteryMinimum"></span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="number">
|
<div class="number">
|
||||||
<label> <input type="number" name="maxcellvoltage" step="0.1" min="1" max="5" /> <span
|
<label> <input type="number" name="maxcellvoltage" step="0.01" min="1" max="5" /> <span
|
||||||
i18n="powerBatteryMaximum"></span>
|
i18n="powerBatteryMaximum"></span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="number">
|
<div class="number">
|
||||||
<label> <input type="number" name="warningcellvoltage" step="0.1" min="1" max="5" /> <span
|
<label> <input type="number" name="warningcellvoltage" step="0.01" min="1" max="5" /> <span
|
||||||
i18n="powerBatteryWarning"></span>
|
i18n="powerBatteryWarning"></span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue