1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-24 00:35:20 +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 = [ sources.receiverCss = [
'./src/css/tabs/receiver_msp.css',
'./css/opensans_webfontkit/fonts.css', './css/opensans_webfontkit/fonts.css',
'./js/libraries/jquery.nouislider.min.css', './js/libraries/jquery.nouislider.min.css',
'./js/libraries/jquery.nouislider.pips.min.css', './js/libraries/jquery.nouislider.pips.min.css',
'./tabs/receiver_msp.css'
]; ];
sources.receiverJs = [ sources.receiverJs = [

View file

@ -762,6 +762,15 @@ var FC = {
return rxTypes; return rxTypes;
}, },
isRxTypeEnabled: function(rxType) { 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")) { if (semver.gt(CONFIG.flightControllerVersion, "1.7.3")) {
return RX_CONFIG.receiver_type == rxType.value; return RX_CONFIG.receiver_type == rxType.value;
} }

View file

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

View file

@ -20,7 +20,7 @@ TABS.receiver.initialize = function (callback) {
mspHelper.loadMisc, mspHelper.loadMisc,
mspHelper.loadRcData, mspHelper.loadRcData,
mspHelper.loadRcMap, mspHelper.loadRcMap,
mspHelper.loadBfConfig, mspHelper.loadRxConfig,
mspHelper.loadRcDeadband mspHelper.loadRcDeadband
]; ];
@ -337,8 +337,8 @@ TABS.receiver.initialize = function (callback) {
$("a.sticks").click(function () { $("a.sticks").click(function () {
var var
windowWidth = 370, windowWidth = 420,
windowHeight = 510; windowHeight = Math.min(window.innerHeight, 720);
chrome.app.window.create("/tabs/receiver_msp.html", { chrome.app.window.create("/tabs/receiver_msp.html", {
id: "receiver_msp", 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 // 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); var plot_update_rate = parseInt($(this).val(), 10);

View file

@ -38,6 +38,26 @@
<span class="slider-label"></span> <span class="slider-label"></span>
</div> </div>
</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>
<div class="warning"> <div class="warning">
<p> <p>

View file

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