mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-17 05:15:25 +03:00
support for currentscale and currentoffset, ui fully working both read and write
This commit is contained in:
parent
f2ac7369de
commit
0c175725b1
6 changed files with 50 additions and 10 deletions
|
@ -345,8 +345,8 @@
|
|||
"configurationThrottleMinimumCommand": {
|
||||
"message": "Minimum Command"
|
||||
},
|
||||
"configurationBatteryCurrent": {
|
||||
"message": "Battery & Current"
|
||||
"configurationBatteryVoltage": {
|
||||
"message": "Battery Voltage"
|
||||
},
|
||||
"configurationBatteryMinimum": {
|
||||
"message": "Minimum Cell Voltage"
|
||||
|
@ -357,6 +357,15 @@
|
|||
"configurationBatteryScale": {
|
||||
"message": "Voltage Scale"
|
||||
},
|
||||
"configurationCurrent": {
|
||||
"message": "Current Sensor"
|
||||
},
|
||||
"configurationCurrentScale": {
|
||||
"message": "Scale the output voltage to milliamps [1/10th mV/A]"
|
||||
},
|
||||
"configurationCurrentOffset": {
|
||||
"message": "Offset in millivolt steps"
|
||||
},
|
||||
"configurationBatteryMultiwiiCurrent": {
|
||||
"message": "Enable support for legacy Multiwii MSP current output"
|
||||
},
|
||||
|
|
|
@ -29,7 +29,9 @@ var BF_CONFIG = {
|
|||
serialrx_type: 0,
|
||||
board_align_roll: 0,
|
||||
board_align_pitch: 0,
|
||||
board_align_yaw: 0
|
||||
board_align_yaw: 0,
|
||||
currentscale: 0,
|
||||
currentoffset: 0
|
||||
// TBD
|
||||
};
|
||||
|
||||
|
|
|
@ -463,6 +463,8 @@ MSP.process_data = function(code, message_buffer, message_length) {
|
|||
BF_CONFIG.board_align_roll = data.getInt16(6, 1);
|
||||
BF_CONFIG.board_align_pitch = data.getInt16(8, 1);
|
||||
BF_CONFIG.board_align_yaw = data.getInt16(10, 1);
|
||||
BF_CONFIG.currentscale = data.getUint16(12, 1);
|
||||
BF_CONFIG.currentoffset = data.getUint16(14, 1);
|
||||
break;
|
||||
case MSP_codes.MSP_SET_CONFIG:
|
||||
break;
|
||||
|
@ -574,6 +576,10 @@ MSP.crunch = function (code) {
|
|||
buffer.push(specificByte(BF_CONFIG.board_align_pitch, 1));
|
||||
buffer.push(specificByte(BF_CONFIG.board_align_yaw, 0));
|
||||
buffer.push(specificByte(BF_CONFIG.board_align_yaw, 1));
|
||||
buffer.push(lowByte(BF_CONFIG.currentscale));
|
||||
buffer.push(highByte(BF_CONFIG.currentscale));
|
||||
buffer.push(lowByte(BF_CONFIG.currentoffset));
|
||||
buffer.push(highByte(BF_CONFIG.currentoffset));
|
||||
break;
|
||||
case MSP_codes.MSP_SET_PID:
|
||||
for (var i = 0; i < PIDs.length; i++) {
|
||||
|
|
|
@ -94,18 +94,18 @@
|
|||
|
||||
border: 1px solid silver;
|
||||
}
|
||||
.tab-configuration .battery .checkbox {
|
||||
.tab-configuration .current .checkbox {
|
||||
margin-top: 2px;
|
||||
}
|
||||
.tab-configuration .battery .checkbox div {
|
||||
.tab-configuration .current .checkbox div {
|
||||
float: left;
|
||||
width: 60px;
|
||||
}
|
||||
.tab-configuration .battery .checkbox div input {
|
||||
.tab-configuration .current .checkbox div input {
|
||||
display: block;
|
||||
margin: 2px auto 0 auto;
|
||||
}
|
||||
.tab-configuration .battery .checkbox span {
|
||||
.tab-configuration .current .checkbox span {
|
||||
margin-left: 15px;
|
||||
}
|
||||
.tab-configuration .buttons {
|
||||
|
|
|
@ -99,8 +99,8 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="clear-both"></div>
|
||||
<div class="leftWrapper battery">
|
||||
<div class="groupTitle" i18n="configurationBatteryCurrent"></div>
|
||||
<div class="leftWrapper">
|
||||
<div class="groupTitle" i18n="configurationBatteryVoltage"></div>
|
||||
<div class="number">
|
||||
<label>
|
||||
<input type="number" name="mincellvoltage" step="0.1" min="1" max="5" />
|
||||
|
@ -119,6 +119,21 @@
|
|||
<span i18n="configurationBatteryScale"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rightWrapper current">
|
||||
<div class="groupTitle" i18n="configurationCurrent"></div>
|
||||
<div class="number">
|
||||
<label>
|
||||
<input type="number" name="currentscale" step="1" min="1" max="1000" />
|
||||
<span i18n="configurationCurrentScale"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="number">
|
||||
<label>
|
||||
<input type="number" name="currentoffset" step="1" min="1" max="1000" />
|
||||
<span i18n="configurationCurrentOffset"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<div>
|
||||
|
@ -128,7 +143,8 @@
|
|||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rightWrapper">
|
||||
<div class="clear-both"></div>
|
||||
<div class="leftWrapper">
|
||||
<div class="groupTitle" i18n="configurationBoardAlignment"></div>
|
||||
<div class="number">
|
||||
<label>
|
||||
|
|
|
@ -219,6 +219,10 @@ TABS.configuration.initialize = function (callback) {
|
|||
$('input[name="mincellvoltage"]').val(MISC.vbatmincellvoltage);
|
||||
$('input[name="maxcellvoltage"]').val(MISC.vbatmaxcellvoltage);
|
||||
$('input[name="voltagescale"]').val(MISC.vbatscale);
|
||||
|
||||
// fill current
|
||||
$('input[name="currentscale"]').val(BF_CONFIG.currentscale);
|
||||
$('input[name="currentoffset"]').val(BF_CONFIG.currentoffset);
|
||||
$('input[name="multiwiicurrentoutput"]').prop('checked', MISC.multiwiicurrentoutput);
|
||||
|
||||
|
||||
|
@ -254,6 +258,9 @@ TABS.configuration.initialize = function (callback) {
|
|||
MISC.vbatmincellvoltage = parseFloat($('input[name="mincellvoltage"]').val()) * 10;
|
||||
MISC.vbatmaxcellvoltage = parseFloat($('input[name="maxcellvoltage"]').val()) * 10;
|
||||
MISC.vbatscale = parseInt($('input[name="voltagescale"]').val());
|
||||
|
||||
BF_CONFIG.currentscale = parseInt($('input[name="currentscale"]').val());
|
||||
BF_CONFIG.currentoffset = parseInt($('input[name="currentoffset"]').val());
|
||||
MISC.multiwiicurrentoutput = ~~$('input[name="multiwiicurrentoutput"]').is(':checked'); // ~~ boolean to decimal conversion
|
||||
|
||||
function save_misc() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue