mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-19 22:35:17 +03:00
Merge pull request #369 from gaelj/Finer-mag_declination-control-in-GUI
Issue #153: finer mag_declination in GUI
This commit is contained in:
commit
bc6d5d2f05
3 changed files with 14 additions and 6 deletions
14
js/msp.js
14
js/msp.js
|
@ -435,7 +435,10 @@ var MSP = {
|
||||||
MISC.multiwiicurrentoutput = data.getUint8(offset++);
|
MISC.multiwiicurrentoutput = data.getUint8(offset++);
|
||||||
MISC.rssi_channel = data.getUint8(offset++);
|
MISC.rssi_channel = data.getUint8(offset++);
|
||||||
MISC.placeholder2 = data.getUint8(offset++);
|
MISC.placeholder2 = data.getUint8(offset++);
|
||||||
MISC.mag_declination = data.getInt16(offset, 1) / 10; // -18000-18000
|
if (semver.lt(CONFIG.apiVersion, "1.18.0"))
|
||||||
|
MISC.mag_declination = data.getInt16(offset, 1) / 10; // -1800-1800
|
||||||
|
else
|
||||||
|
MISC.mag_declination = data.getInt16(offset, 1) / 100; // -18000-18000
|
||||||
offset += 2;
|
offset += 2;
|
||||||
MISC.vbatscale = data.getUint8(offset++, 1); // 10-200
|
MISC.vbatscale = data.getUint8(offset++, 1); // 10-200
|
||||||
MISC.vbatmincellvoltage = data.getUint8(offset++, 1) / 10; // 10-50
|
MISC.vbatmincellvoltage = data.getUint8(offset++, 1) / 10; // 10-50
|
||||||
|
@ -1237,8 +1240,13 @@ MSP.crunch = function (code) {
|
||||||
buffer.push(MISC.multiwiicurrentoutput);
|
buffer.push(MISC.multiwiicurrentoutput);
|
||||||
buffer.push(MISC.rssi_channel);
|
buffer.push(MISC.rssi_channel);
|
||||||
buffer.push(MISC.placeholder2);
|
buffer.push(MISC.placeholder2);
|
||||||
buffer.push(lowByte(Math.round(MISC.mag_declination * 10)));
|
if (semver.lt(CONFIG.apiVersion, "1.18.0")) {
|
||||||
buffer.push(highByte(Math.round(MISC.mag_declination * 10)));
|
buffer.push(lowByte(Math.round(MISC.mag_declination * 10)));
|
||||||
|
buffer.push(highByte(Math.round(MISC.mag_declination * 10)));
|
||||||
|
} else {
|
||||||
|
buffer.push(lowByte(Math.round(MISC.mag_declination * 100)));
|
||||||
|
buffer.push(highByte(Math.round(MISC.mag_declination * 100)));
|
||||||
|
}
|
||||||
buffer.push(MISC.vbatscale);
|
buffer.push(MISC.vbatscale);
|
||||||
buffer.push(Math.round(MISC.vbatmincellvoltage * 10));
|
buffer.push(Math.round(MISC.vbatmincellvoltage * 10));
|
||||||
buffer.push(Math.round(MISC.vbatmaxcellvoltage * 10));
|
buffer.push(Math.round(MISC.vbatmaxcellvoltage * 10));
|
||||||
|
|
|
@ -384,7 +384,7 @@
|
||||||
<span i18n="configurationGPSubxSbas"></span>
|
<span i18n="configurationGPSubxSbas"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="number">
|
<div class="number">
|
||||||
<label> <input type="number" name="mag_declination" step="0.1" min="-180" max="180" />
|
<label> <input type="number" name="mag_declination" step="0.01" min="-180" max="180" />
|
||||||
<span i18n="configurationMagDeclination"></span>
|
<span i18n="configurationMagDeclination"></span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -363,7 +363,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
$('input[name="pitch"]').val(CONFIG.accelerometerTrims[0]);
|
$('input[name="pitch"]').val(CONFIG.accelerometerTrims[0]);
|
||||||
|
|
||||||
// fill magnetometer
|
// fill magnetometer
|
||||||
$('input[name="mag_declination"]').val(MISC.mag_declination);
|
$('input[name="mag_declination"]').val(MISC.mag_declination.toFixed(2));
|
||||||
|
|
||||||
//fill motor disarm params and FC loop time
|
//fill motor disarm params and FC loop time
|
||||||
if(semver.gte(CONFIG.apiVersion, "1.8.0")) {
|
if(semver.gte(CONFIG.apiVersion, "1.8.0")) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue