diff --git a/gulpfile.js b/gulpfile.js index caf35ba1..04ad8a66 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -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 = [ diff --git a/js/fc.js b/js/fc.js index 24df2fd6..a480860d 100644 --- a/js/fc.js +++ b/js/fc.js @@ -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; } diff --git a/src/css/tabs/receiver_msp.css b/src/css/tabs/receiver_msp.css index d58a9233..1b80d18a 100644 --- a/src/css/tabs/receiver_msp.css +++ b/src/css/tabs/receiver_msp.css @@ -86,8 +86,8 @@ .slider-label { position: absolute; text-align: right; - width: 40px; - left: -65px; + width: 50px; + left: -75px; } a { diff --git a/tabs/receiver.js b/tabs/receiver.js index b95c45d2..5c9bd48f 100644 --- a/tabs/receiver.js +++ b/tabs/receiver.js @@ -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); diff --git a/tabs/receiver_msp.html b/tabs/receiver_msp.html index a0c5c0ad..e7a5dc08 100644 --- a/tabs/receiver_msp.html +++ b/tabs/receiver_msp.html @@ -38,6 +38,26 @@ +
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+

diff --git a/tabs/receiver_msp.js b/tabs/receiver_msp.js index c6967a36..0fce9a63 100644 --- a/tabs/receiver_msp.js +++ b/tabs/receiver_msp.js @@ -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); });