1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-23 16:25:19 +03:00

Fix support for simulated RX via MSP, increase channels to 12

- Fix detection of MSP_RX to show the button in the receiver tab
- Fix path to the .css file for receiver_msp.html
- Increase number of channels to 12
This commit is contained in:
Alberto García Hierro 2018-05-20 17:05:34 +01:00
parent 15e884acf1
commit 6e80fd2b4d
6 changed files with 56 additions and 19 deletions

View file

@ -116,10 +116,10 @@ sources.mapJs = [
];
sources.receiverCss = [
'./src/css/tabs/receiver_msp.css',
'./css/opensans_webfontkit/fonts.css',
'./js/libraries/jquery.nouislider.min.css',
'./js/libraries/jquery.nouislider.pips.min.css',
'./tabs/receiver_msp.css'
];
sources.receiverJs = [

View file

@ -762,6 +762,15 @@ var FC = {
return rxTypes;
},
isRxTypeEnabled: function(rxType) {
if (typeof rxType === 'string') {
var types = this.getRxTypes();
for (var ii = 0; ii < types.length; ii++) {
if (types[ii].name == rxType) {
rxType = types[ii];
break;
}
}
}
if (semver.gt(CONFIG.flightControllerVersion, "1.7.3")) {
return RX_CONFIG.receiver_type == rxType.value;
}

View file

@ -86,8 +86,8 @@
.slider-label {
position: absolute;
text-align: right;
width: 40px;
left: -65px;
width: 50px;
left: -75px;
}
a {

View file

@ -20,7 +20,7 @@ TABS.receiver.initialize = function (callback) {
mspHelper.loadMisc,
mspHelper.loadRcData,
mspHelper.loadRcMap,
mspHelper.loadBfConfig,
mspHelper.loadRxConfig,
mspHelper.loadRcDeadband
];
@ -337,8 +337,8 @@ TABS.receiver.initialize = function (callback) {
$("a.sticks").click(function () {
var
windowWidth = 370,
windowHeight = 510;
windowWidth = 420,
windowHeight = Math.min(window.innerHeight, 720);
chrome.app.window.create("/tabs/receiver_msp.html", {
id: "receiver_msp",
@ -362,7 +362,7 @@ TABS.receiver.initialize = function (callback) {
});
// Only show the MSP control sticks if the MSP Rx feature is enabled
$(".sticks_btn").toggle(bit_check(BF_CONFIG.features, 14 /* RX_MSP */));
$(".sticks_btn").toggle(FC.isRxTypeEnabled('RX_MSP'));
var plot_update_rate = parseInt($(this).val(), 10);

View file

@ -38,6 +38,26 @@
<span class="slider-label"></span>
</div>
</div>
<div class="control-slider">
<div class="slider">
<span class="slider-label"></span>
</div>
</div>
<div class="control-slider">
<div class="slider">
<span class="slider-label"></span>
</div>
</div>
<div class="control-slider">
<div class="slider">
<span class="slider-label"></span>
</div>
</div>
<div class="control-slider">
<div class="slider">
<span class="slider-label"></span>
</div>
</div>
</div>
<div class="warning">
<p>

View file

@ -11,10 +11,14 @@ var
pitch: 1,
yaw: 3,
throttle: 2,
aux1: 4,
aux2: 5,
aux3: 6,
aux4: 7
ch5: 4,
ch6: 5,
ch7: 6,
ch8: 7,
ch9: 8,
ch10: 9,
ch11: 10,
ch12: 11,
},
// Set reasonable initial stick positions (Mode 2)
@ -23,10 +27,14 @@ var
pitch: CHANNEL_MID_VALUE,
roll: CHANNEL_MID_VALUE,
yaw: CHANNEL_MID_VALUE,
aux1: CHANNEL_MIN_VALUE,
aux2: CHANNEL_MIN_VALUE,
aux3: CHANNEL_MIN_VALUE,
aux4: CHANNEL_MIN_VALUE
ch5: CHANNEL_MIN_VALUE,
ch6: CHANNEL_MIN_VALUE,
ch7: CHANNEL_MIN_VALUE,
ch8: CHANNEL_MIN_VALUE,
ch9: CHANNEL_MIN_VALUE,
ch10: CHANNEL_MIN_VALUE,
ch11: CHANNEL_MIN_VALUE,
ch12: CHANNEL_MIN_VALUE,
},
// First the vertical axis, then the horizontal:
@ -42,7 +50,7 @@ var
function transmitChannels() {
var
channelValues = [0, 0, 0, 0, 0, 0, 0, 0];
channelValues = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
if (!enableTX) {
return;
@ -114,7 +122,7 @@ function localizeAxisNames() {
$(".gimbal-label-horz", gimbal).text(chrome.i18n.getMessage("controlAxis" + gimbals[gimbalIndex][1]));
}
for (var sliderIndex = 0; sliderIndex < 4; sliderIndex++) {
for (var sliderIndex = 0; sliderIndex < 8; sliderIndex++) {
$(".slider-label", sliderElems.get(sliderIndex)).text(chrome.i18n.getMessage("radioChannelShort") + (sliderIndex + 5));
}
}
@ -148,7 +156,7 @@ $(document).ready(function() {
$(".slider", sliderElems).each(function(sliderIndex) {
var
initialValue = stickValues["aux" + (sliderIndex + 1)];
initialValue = stickValues["ch" + (sliderIndex + 5)];
$(this)
.noUiSlider({
@ -160,7 +168,7 @@ $(document).ready(function() {
}).on('slide change set', function(e, value) {
value = Math.round(parseFloat(value));
stickValues["aux" + (sliderIndex + 1)] = value;
stickValues["ch" + (sliderIndex + 5)] = value;
$(".tooltip", this).text(value);
});