Skip to content

Commit bd757f4

Browse files
authored
Merge pull request #621 from spuder/small_angle
Configure Small_angle
2 parents ef9823f + 614f2b5 commit bd757f4

File tree

6 files changed

+66
-2
lines changed

6 files changed

+66
-2
lines changed

_locales/en/messages.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,12 @@
685685
"configurationAccelTrimPitch": {
686686
"message": "Accelerometer Pitch Trim"
687687
},
688+
"configurationArming": {
689+
"message": "Arming"
690+
},
691+
"configurationArmingHelp": {
692+
"message": "Some Arming options may require accelerometer be enabled"
693+
},
688694
"configurationMagDeclination": {
689695
"message": "Magnetometer Declination [deg]"
690696
},
@@ -2602,6 +2608,12 @@
26022608
"configurationMagHardware": {
26032609
"message": "Magnetometer (if supported)"
26042610
},
2611+
"configurationSmallAngle": {
2612+
"message": "Maximum ARM Angle [degrees]"
2613+
},
2614+
"configurationSmallAngleHelp": {
2615+
"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"
2616+
},
26052617
"configurationBatteryVoltage": {
26062618
"message": "Battery Voltage"
26072619
},

js/fc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ var FC = {
229229
ARMING_CONFIG = {
230230
auto_disarm_delay: 0,
231231
disarm_kill_switch: 0,
232+
small_angle: 0,
232233
};
233234

234235
FC_CONFIG = {

js/msp/MSPHelper.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,9 @@ MspHelper.prototype.process_data = function(dataHandler) {
322322
ARMING_CONFIG.auto_disarm_delay = data.readU8();
323323
ARMING_CONFIG.disarm_kill_switch = data.readU8();
324324
}
325+
if (semver.gte(CONFIG.apiVersion, "1.37.0")) {
326+
ARMING_CONFIG.small_angle = data.readU8();
327+
}
325328
break;
326329
case MSPCodes.MSP_LOOP_TIME:
327330
if (semver.gte(CONFIG.apiVersion, "1.8.0")) {
@@ -1254,6 +1257,9 @@ MspHelper.prototype.crunch = function(code) {
12541257
case MSPCodes.MSP_SET_ARMING_CONFIG:
12551258
buffer.push8(ARMING_CONFIG.auto_disarm_delay)
12561259
.push8(ARMING_CONFIG.disarm_kill_switch);
1260+
if (semver.gte(CONFIG.apiVersion, "1.37.0")) {
1261+
buffer.push8(ARMING_CONFIG.small_angle);
1262+
}
12571263
break;
12581264
case MSPCodes.MSP_SET_LOOP_TIME:
12591265
buffer.push16(FC_CONFIG.loopTime);

tabs/configuration.css

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,8 +500,14 @@
500500
}
501501

502502
.tab-configuration ._3dSettings {
503-
margin-top: 10px;
504-
float: left;
503+
margin-top: 10px;
504+
float: left;
505+
width: 100%;
506+
}
507+
508+
.tab-configuration ._smallAngle {
509+
margin-top: 10px;
510+
float: left;
505511
width: 100%;
506512
}
507513

tabs/configuration.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,23 @@
314314
</div>
315315
</div>
316316
</div>
317+
<div class="gui_box grey">
318+
<div class="gui_box_titlebar">
319+
<div class="spacer_box_title" i18n="configurationArming"></div>
320+
<div class="helpicon cf_tip" i18n_title="configurationArmingHelp"></div>
321+
</div>
322+
<div class="spacer_box">
323+
<div class="_smallAngle">
324+
<div class="number">
325+
<label>
326+
<input type="number" id="configurationSmallAngle" step="1" min="1" max="180" />
327+
<span i18n="configurationSmallAngle"></span>
328+
<div class="helpicon cf_tip" i18n_title="configurationSmallAngleHelp"></div>
329+
</label>
330+
</div>
331+
</div>
332+
</div>
333+
</div>
317334
</div>
318335

319336
</td>

tabs/configuration.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,14 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
609609

610610
$('div.cycles').show();
611611
}
612+
if(semver.gte(CONFIG.apiVersion, "1.37.0")) {
613+
$('input[id="configurationSmallAngle"]').val(ARMING_CONFIG.small_angle);
614+
if (SENSOR_CONFIG.acc_hardware !== 1) {
615+
$('._smallAngle').show();
616+
} else {
617+
$('._smallAngle').hide();
618+
}
619+
}
612620

613621
// fill throttle
614622
$('input[name="minthrottle"]').val(MOTOR_CONFIG.minthrottle);
@@ -796,6 +804,17 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
796804
}
797805
});
798806

807+
$('input[id="accHardwareSwitch"]').change(function() {
808+
if(semver.gte(CONFIG.apiVersion, "1.37.0")) {
809+
var checked = $(this).is(':checked');
810+
if (checked) {
811+
$('._smallAngle').show()
812+
} else {
813+
$('._smallAngle').hide()
814+
}
815+
}
816+
});
817+
799818
$(features_e).filter('select').change(function () {
800819
var element = $(this);
801820

@@ -852,6 +871,9 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
852871
ARMING_CONFIG.auto_disarm_delay = parseInt($('input[name="autodisarmdelay"]').val());
853872
ARMING_CONFIG.disarm_kill_switch = $('input[id="disarmkillswitch"]').is(':checked') ? 1 : 0;
854873
}
874+
if(semver.gte(CONFIG.apiVersion, "1.37.0")) {
875+
ARMING_CONFIG.small_angle = parseInt($('input[id="configurationSmallAngle"]').val());
876+
}
855877

856878
MOTOR_CONFIG.minthrottle = parseInt($('input[name="minthrottle"]').val());
857879
MOTOR_CONFIG.maxthrottle = parseInt($('input[name="maxthrottle"]').val());

0 commit comments

Comments
 (0)