diff --git a/_locales/en/messages.json b/_locales/en/messages.json
index 31d5e32c69..ddbbe5a4f7 100644
--- a/_locales/en/messages.json
+++ b/_locales/en/messages.json
@@ -443,6 +443,9 @@
"receiverRcExpo": {
"message": "RC Expo"
},
+ "receiverChannelMap": {
+ "message": "Channel Map"
+ },
"receiverRefreshRateTitle": {
"message": "Graph refresh rate"
},
diff --git a/tabs/configuration.js b/tabs/configuration.js
index 9760d74b7e..be338d328f 100644
--- a/tabs/configuration.js
+++ b/tabs/configuration.js
@@ -47,9 +47,6 @@ TABS.configuration.initialize = function (callback) {
// translate to user-selected language
localize();
- // index references
- var RCMAPlLetters = ['A', 'E', 'R', 'T', '1', '2', '3', '4'];
-
// generate mixer
var mixerList = [
{name: 'Tricopter', image: 'tri'},
diff --git a/tabs/receiver.css b/tabs/receiver.css
index 257a686c1c..f7e3f378cd 100644
--- a/tabs/receiver.css
+++ b/tabs/receiver.css
@@ -79,7 +79,7 @@
border-collapse: collapse;
}
.tab-receiver .tunings .throttle {
- margin-bottom: 22px;
+ margin-bottom: 10px;
}
.tab-receiver .tunings table, .tab-receiver .tunings table th, .tab-receiver .tunings table td {
padding: 4px;
@@ -101,6 +101,42 @@
line-height: 20px;
text-align: right;
}
+ .tab-receiver .rcmap_wrapper {
+ float: right;
+ position: relative;
+
+ width: 126px;
+
+ margin: 10px 0 0 0;
+
+ border: 1px solid #8b8b8b;
+ }
+ .tab-receiver .rcmap_wrapper .head {
+ height: 15px;
+ padding: 4px;
+
+ text-align: center;
+ font-weight: bold;
+
+ border-bottom: 1px solid #8b8b8b;
+ background-color: #ececec;
+ }
+ .tab-receiver .hybrid_element input {
+ position: absolute;
+
+ padding-left: 5px;
+
+ width: calc(100% - 24px);
+ height: 22px;
+
+ z-index: 2;
+ }
+ .tab-receiver .hybrid_element select {
+ width: 100%;
+ height: 22px;
+
+ z-index: 1;
+ }
.tab-receiver .curves {
float: right;
}
diff --git a/tabs/receiver.html b/tabs/receiver.html
index 28418ba8ad..503f8f7c53 100644
--- a/tabs/receiver.html
+++ b/tabs/receiver.html
@@ -22,6 +22,16 @@
|
+
+
+
+
+
+
+
diff --git a/tabs/receiver.js b/tabs/receiver.js
index bd4efa547a..c394568709 100644
--- a/tabs/receiver.js
+++ b/tabs/receiver.js
@@ -7,7 +7,16 @@ TABS.receiver.initialize = function (callback) {
googleAnalytics.sendAppView('Receiver Page');
function get_rc_data() {
- MSP.send_message(MSP_codes.MSP_RC, false, false, load_html);
+ MSP.send_message(MSP_codes.MSP_RC, false, false, get_rc_map);
+ }
+
+ function get_rc_map() {
+ // TODO remove this after compatibility period
+ if (bit_check(CONFIG.capability, 30)) {
+ MSP.send_message(MSP_codes.MSP_RCMAP, false, false, load_html);
+ } else {
+ load_html();
+ }
}
function load_html() {
@@ -68,6 +77,66 @@ TABS.receiver.initialize = function (callback) {
meter_values_array.push($(this));
});
+ // handle rcmap
+ if (bit_check(CONFIG.capability, 30)) {
+ var RCMAPlLetters = ['A', 'E', 'R', 'T', '1', '2', '3', '4'];
+
+ var strBuffer = '';
+ for (var i = 0; i < RC_MAP.length; i++) {
+ strBuffer += RCMAPlLetters[RC_MAP[i]];
+ }
+
+ // set current value
+ $('input[name="rcmap"]').val(strBuffer);
+
+ // validation / filter
+ var last_valid = strBuffer;
+
+ $('input[name="rcmap"]').on('input', function () {
+ var val = $(this).val();
+
+ // limit length to max 8
+ if (val.length > 8) {
+ val = val.substr(0, 8);
+ }
+
+ $(this).val(val);
+ });
+
+ $('input[name="rcmap"]').focusout(function () {
+ var val = $(this).val();
+ var strBuffer = val.split('');
+ var duplicityBuffer = [];
+
+ if (val.length != 8) {
+ $(this).val(last_valid);
+ return false;
+ }
+
+ // check if characters inside are all valid, also check for duplicity
+ for (var i = 0; i < val.length; i++) {
+ if (RCMAPlLetters.indexOf(strBuffer[i]) < 0) {
+ $(this).val(last_valid);
+ return false;
+ }
+
+ if (duplicityBuffer.indexOf(strBuffer[i]) < 0) {
+ duplicityBuffer.push(strBuffer[i]);
+ } else {
+ $(this).val(last_valid);
+ return false;
+ }
+ }
+ });
+
+ // handle helper
+ $('select[name="rcmap_helper"]').change(function () {
+ $('input[name="rcmap"]').val($(this).val());
+ });
+ } else {
+ $('.rcmap_wrapper').hide();
+ }
+
// UI Hooks
// curves
$('.tunings .throttle input').change(function () {
@@ -143,13 +212,28 @@ TABS.receiver.initialize = function (callback) {
RC_tuning.RC_RATE = parseFloat($('.tunings .rate input[name="rate"]').val());
RC_tuning.RC_EXPO = parseFloat($('.tunings .rate input[name="expo"]').val());
+ // catch rc map
+ var strBuffer = $('input[name="rcmap"]').val().split('');
+
+ for (var i = 0; i < RC_MAP.length; i++) {
+ RC_MAP[i] = RCMAPlLetters.indexOf(strBuffer[i]);
+ }
+
+ function save_rc_map() {
+ MSP.send_message(MSP_codes.MSP_SET_RCMAP, MSP.crunch(MSP_codes.MSP_SET_RCMAP), false, save_to_eeprom);
+ }
+
function save_to_eeprom() {
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function () {
GUI.log(chrome.i18n.getMessage('receiverEepromSaved'));
});
}
- MSP.send_message(MSP_codes.MSP_SET_RC_TUNING, MSP.crunch(MSP_codes.MSP_SET_RC_TUNING), false, save_to_eeprom);
+ if (bit_check(CONFIG.capability, 30)) {
+ MSP.send_message(MSP_codes.MSP_SET_RC_TUNING, MSP.crunch(MSP_codes.MSP_SET_RC_TUNING), false, save_rc_map);
+ } else {
+ MSP.send_message(MSP_codes.MSP_SET_RC_TUNING, MSP.crunch(MSP_codes.MSP_SET_RC_TUNING), false, save_to_eeprom);
+ }
});
$('select[name="rx_refresh_rate"]').change(function () {