1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-19 14:25:14 +03:00

Merge pull request #621 from spuder/small_angle

Configure Small_angle
This commit is contained in:
Michael Keller 2017-10-13 19:53:27 +13:00 committed by GitHub
commit bd757f49af
6 changed files with 66 additions and 2 deletions

View file

@ -685,6 +685,12 @@
"configurationAccelTrimPitch": { "configurationAccelTrimPitch": {
"message": "Accelerometer Pitch Trim" "message": "Accelerometer Pitch Trim"
}, },
"configurationArming": {
"message": "Arming"
},
"configurationArmingHelp": {
"message": "Some Arming options may require accelerometer be enabled"
},
"configurationMagDeclination": { "configurationMagDeclination": {
"message": "Magnetometer Declination [deg]" "message": "Magnetometer Declination [deg]"
}, },
@ -2602,6 +2608,12 @@
"configurationMagHardware": { "configurationMagHardware": {
"message": "Magnetometer (if supported)" "message": "Magnetometer (if supported)"
}, },
"configurationSmallAngle": {
"message": "Maximum ARM Angle [degrees]"
},
"configurationSmallAngleHelp": {
"message": "Craft will not ARM if tilted more than specified number of degrees. Only applies if accelerometer is enabled. Setting to 180 will effectivly disable check"
},
"configurationBatteryVoltage": { "configurationBatteryVoltage": {
"message": "Battery Voltage" "message": "Battery Voltage"
}, },

View file

@ -229,6 +229,7 @@ var FC = {
ARMING_CONFIG = { ARMING_CONFIG = {
auto_disarm_delay: 0, auto_disarm_delay: 0,
disarm_kill_switch: 0, disarm_kill_switch: 0,
small_angle: 0,
}; };
FC_CONFIG = { FC_CONFIG = {

View file

@ -322,6 +322,9 @@ MspHelper.prototype.process_data = function(dataHandler) {
ARMING_CONFIG.auto_disarm_delay = data.readU8(); ARMING_CONFIG.auto_disarm_delay = data.readU8();
ARMING_CONFIG.disarm_kill_switch = data.readU8(); ARMING_CONFIG.disarm_kill_switch = data.readU8();
} }
if (semver.gte(CONFIG.apiVersion, "1.37.0")) {
ARMING_CONFIG.small_angle = data.readU8();
}
break; break;
case MSPCodes.MSP_LOOP_TIME: case MSPCodes.MSP_LOOP_TIME:
if (semver.gte(CONFIG.apiVersion, "1.8.0")) { if (semver.gte(CONFIG.apiVersion, "1.8.0")) {
@ -1254,6 +1257,9 @@ MspHelper.prototype.crunch = function(code) {
case MSPCodes.MSP_SET_ARMING_CONFIG: case MSPCodes.MSP_SET_ARMING_CONFIG:
buffer.push8(ARMING_CONFIG.auto_disarm_delay) buffer.push8(ARMING_CONFIG.auto_disarm_delay)
.push8(ARMING_CONFIG.disarm_kill_switch); .push8(ARMING_CONFIG.disarm_kill_switch);
if (semver.gte(CONFIG.apiVersion, "1.37.0")) {
buffer.push8(ARMING_CONFIG.small_angle);
}
break; break;
case MSPCodes.MSP_SET_LOOP_TIME: case MSPCodes.MSP_SET_LOOP_TIME:
buffer.push16(FC_CONFIG.loopTime); buffer.push16(FC_CONFIG.loopTime);

View file

@ -505,6 +505,12 @@
width: 100%; width: 100%;
} }
.tab-configuration ._smallAngle {
margin-top: 10px;
float: left;
width: 100%;
}
.tab-configuration .gpsSettings .note { .tab-configuration .gpsSettings .note {
margin-top: 10px; margin-top: 10px;
} }

View file

@ -314,6 +314,23 @@
</div> </div>
</div> </div>
</div> </div>
<div class="gui_box grey">
<div class="gui_box_titlebar">
<div class="spacer_box_title" i18n="configurationArming"></div>
<div class="helpicon cf_tip" i18n_title="configurationArmingHelp"></div>
</div>
<div class="spacer_box">
<div class="_smallAngle">
<div class="number">
<label>
<input type="number" id="configurationSmallAngle" step="1" min="1" max="180" />
<span i18n="configurationSmallAngle"></span>
<div class="helpicon cf_tip" i18n_title="configurationSmallAngleHelp"></div>
</label>
</div>
</div>
</div>
</div>
</div> </div>
</td> </td>

View file

@ -609,6 +609,14 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
$('div.cycles').show(); $('div.cycles').show();
} }
if(semver.gte(CONFIG.apiVersion, "1.37.0")) {
$('input[id="configurationSmallAngle"]').val(ARMING_CONFIG.small_angle);
if (SENSOR_CONFIG.acc_hardware !== 1) {
$('._smallAngle').show();
} else {
$('._smallAngle').hide();
}
}
// fill throttle // fill throttle
$('input[name="minthrottle"]').val(MOTOR_CONFIG.minthrottle); $('input[name="minthrottle"]').val(MOTOR_CONFIG.minthrottle);
@ -796,6 +804,17 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
} }
}); });
$('input[id="accHardwareSwitch"]').change(function() {
if(semver.gte(CONFIG.apiVersion, "1.37.0")) {
var checked = $(this).is(':checked');
if (checked) {
$('._smallAngle').show()
} else {
$('._smallAngle').hide()
}
}
});
$(features_e).filter('select').change(function () { $(features_e).filter('select').change(function () {
var element = $(this); var element = $(this);
@ -852,6 +871,9 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
ARMING_CONFIG.auto_disarm_delay = parseInt($('input[name="autodisarmdelay"]').val()); ARMING_CONFIG.auto_disarm_delay = parseInt($('input[name="autodisarmdelay"]').val());
ARMING_CONFIG.disarm_kill_switch = $('input[id="disarmkillswitch"]').is(':checked') ? 1 : 0; ARMING_CONFIG.disarm_kill_switch = $('input[id="disarmkillswitch"]').is(':checked') ? 1 : 0;
} }
if(semver.gte(CONFIG.apiVersion, "1.37.0")) {
ARMING_CONFIG.small_angle = parseInt($('input[id="configurationSmallAngle"]').val());
}
MOTOR_CONFIG.minthrottle = parseInt($('input[name="minthrottle"]').val()); MOTOR_CONFIG.minthrottle = parseInt($('input[name="minthrottle"]').val());
MOTOR_CONFIG.maxthrottle = parseInt($('input[name="maxthrottle"]').val()); MOTOR_CONFIG.maxthrottle = parseInt($('input[name="maxthrottle"]').val());