From 34c6077b5c9a3ebcfc4bf096d4abd01990eb91a6 Mon Sep 17 00:00:00 2001 From: borisbstyle Date: Fri, 8 May 2015 01:11:43 +0200 Subject: [PATCH 1/4] Yaw Expo Feature --- _locales/en/messages.json | 3 +++ js/data_storage.js | 3 ++- js/msp.js | 6 ++++++ tabs/receiver.html | 2 ++ tabs/receiver.js | 8 +++++++- 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 1ab89c02..c6d6c4aa 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -624,6 +624,9 @@ }, "receiverRcExpo": { "message": "RC Expo" + }, + "receiverRcYawExpo": { + "message": "RC Yaw Expo" }, "receiverChannelMap": { "message": "Channel Map" diff --git a/js/data_storage.js b/js/data_storage.js index cf854511..bef75952 100755 --- a/js/data_storage.js +++ b/js/data_storage.js @@ -75,7 +75,8 @@ var RC_tuning = { dynamic_THR_PID: 0, throttle_MID: 0, throttle_EXPO: 0, - dynamic_THR_breakpoint: 0 + dynamic_THR_breakpoint: 0, + RC_YAW_EXPO: 0 }; var AUX_CONFIG = []; diff --git a/js/msp.js b/js/msp.js index 55bc0ea2..0e50b920 100644 --- a/js/msp.js +++ b/js/msp.js @@ -309,6 +309,9 @@ var MSP = { RC_tuning.throttle_EXPO = parseFloat((data.getUint8(offset++) / 100).toFixed(2)); if (semver.gte(CONFIG.apiVersion, "1.7.0")) { RC_tuning.dynamic_THR_breakpoint = data.getUint16(offset++, 1); + } + if (semver.gte(CONFIG.apiVersion, "1.10.0")) { + RC_tuning.RC_YAW_EXPO = parseFloat((data.getUint8(offset++) / 100).toFixed(2)); } break; case MSP_codes.MSP_PID: @@ -965,6 +968,9 @@ MSP.crunch = function (code) { if (semver.gte(CONFIG.apiVersion, "1.7.0")) { buffer.push(lowByte(RC_tuning.dynamic_THR_breakpoint)); buffer.push(highByte(RC_tuning.dynamic_THR_breakpoint)); + } + if (semver.gte(CONFIG.apiVersion, "1.10.0")) { + buffer.push(parseInt(RC_tuning.RC_YAW_EXPO * 100)); } break; // Disabled, cleanflight does not use MSP_SET_BOX. diff --git a/tabs/receiver.html b/tabs/receiver.html index efb1e63a..b299451a 100644 --- a/tabs/receiver.html +++ b/tabs/receiver.html @@ -17,10 +17,12 @@ + +
diff --git a/tabs/receiver.js b/tabs/receiver.js index 719c5adf..b302c8e2 100644 --- a/tabs/receiver.js +++ b/tabs/receiver.js @@ -37,7 +37,12 @@ TABS.receiver.initialize = function (callback) { $('.tunings .rate input[name="rate"]').val(RC_tuning.RC_RATE.toFixed(2)); $('.tunings .rate input[name="expo"]').val(RC_tuning.RC_EXPO.toFixed(2)); - + $('.tunings .rate input[name="yaw_expo"]').val(RC_tuning.RC_YAW_EXPO.toFixed(2)); + + if (semver.lt(CONFIG.apiVersion, "1.10.0")) { + $('.tunings .rate input[name="yaw_expo"]').hide(); + } + chrome.storage.local.get('rx_refresh_rate', function (result) { if (result.rx_refresh_rate) { $('select[name="rx_refresh_rate"]').val(result.rx_refresh_rate).change(); @@ -268,6 +273,7 @@ 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()); + RC_tuning.RC_YAW_EXPO = parseFloat($('.tunings .rate input[name="yaw_expo"]').val()); // catch rc map var RC_MAP_Letters = ['A', 'E', 'R', 'T', '1', '2', '3', '4']; From 502a70233a6dfa5dd30a6571f02f2979be5fec00 Mon Sep 17 00:00:00 2001 From: borisbstyle Date: Fri, 8 May 2015 01:30:45 +0200 Subject: [PATCH 2/4] update --- tabs/receiver.html | 12 ++++++++++-- tabs/receiver.js | 6 +++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/tabs/receiver.html b/tabs/receiver.html index b299451a..085c4091 100644 --- a/tabs/receiver.html +++ b/tabs/receiver.html @@ -17,12 +17,10 @@ - -
@@ -44,6 +42,16 @@
+
+ + + + + + + +
+
diff --git a/tabs/receiver.js b/tabs/receiver.js index b302c8e2..581933d5 100644 --- a/tabs/receiver.js +++ b/tabs/receiver.js @@ -37,10 +37,10 @@ TABS.receiver.initialize = function (callback) { $('.tunings .rate input[name="rate"]').val(RC_tuning.RC_RATE.toFixed(2)); $('.tunings .rate input[name="expo"]').val(RC_tuning.RC_EXPO.toFixed(2)); - $('.tunings .rate input[name="yaw_expo"]').val(RC_tuning.RC_YAW_EXPO.toFixed(2)); + $('.tunings .yaw_rate input[name="yaw_expo"]').val(RC_tuning.RC_YAW_EXPO.toFixed(2)); if (semver.lt(CONFIG.apiVersion, "1.10.0")) { - $('.tunings .rate input[name="yaw_expo"]').hide(); + $('.tunings .yaw_rate input[name="yaw_expo"]').hide(); } chrome.storage.local.get('rx_refresh_rate', function (result) { @@ -273,7 +273,7 @@ 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()); - RC_tuning.RC_YAW_EXPO = parseFloat($('.tunings .rate input[name="yaw_expo"]').val()); + RC_tuning.RC_YAW_EXPO = parseFloat($('.tunings .yaw_rate input[name="yaw_expo"]').val()); // catch rc map var RC_MAP_Letters = ['A', 'E', 'R', 'T', '1', '2', '3', '4']; From ab883c6dc53f932b95822de519fceb5ad0fda2ef Mon Sep 17 00:00:00 2001 From: ProDrone Date: Sat, 9 May 2015 01:00:59 +0200 Subject: [PATCH 3/4] Cleanup code indention and positioning the rc_yaw_expo field --- js/msp.js | 4 ++-- tabs/receiver.css | 7 +++++++ tabs/receiver.html | 18 ++++++++---------- tabs/receiver.js | 4 ++-- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/js/msp.js b/js/msp.js index 0e50b920..1f6b44c8 100644 --- a/js/msp.js +++ b/js/msp.js @@ -310,8 +310,8 @@ var MSP = { if (semver.gte(CONFIG.apiVersion, "1.7.0")) { RC_tuning.dynamic_THR_breakpoint = data.getUint16(offset++, 1); } - if (semver.gte(CONFIG.apiVersion, "1.10.0")) { - RC_tuning.RC_YAW_EXPO = parseFloat((data.getUint8(offset++) / 100).toFixed(2)); + if (semver.gte(CONFIG.apiVersion, "1.10.0")) { + RC_tuning.RC_YAW_EXPO = parseFloat((data.getUint8(offset++) / 100).toFixed(2)); } break; case MSP_codes.MSP_PID: diff --git a/tabs/receiver.css b/tabs/receiver.css index a8997b10..91d2b7b9 100644 --- a/tabs/receiver.css +++ b/tabs/receiver.css @@ -119,6 +119,13 @@ .tab-receiver .tunings .throttle { margin-bottom: 10px; } +.tab-receiver .tunings .rate { + margin-bottom: 10px; +} +.tab-receiver .tunings .yaw_rate { + margin-left: 127px; + margin-bottom: 10px; +} .tab-receiver .tunings table, .tab-receiver .tunings table th, .tab-receiver .tunings table td { padding: 4px; border: 1px solid #8b8b8b; diff --git a/tabs/receiver.html b/tabs/receiver.html index 085c4091..196f4c04 100644 --- a/tabs/receiver.html +++ b/tabs/receiver.html @@ -23,6 +23,14 @@ + + + + + + + +
-
- - - - - - - -
-
diff --git a/tabs/receiver.js b/tabs/receiver.js index 581933d5..0efb5f18 100644 --- a/tabs/receiver.js +++ b/tabs/receiver.js @@ -37,9 +37,9 @@ TABS.receiver.initialize = function (callback) { $('.tunings .rate input[name="rate"]').val(RC_tuning.RC_RATE.toFixed(2)); $('.tunings .rate input[name="expo"]').val(RC_tuning.RC_EXPO.toFixed(2)); - $('.tunings .yaw_rate input[name="yaw_expo"]').val(RC_tuning.RC_YAW_EXPO.toFixed(2)); + $('.tunings .yaw_rate input[name="yaw_expo"]').val(RC_tuning.RC_YAW_EXPO.toFixed(2)); - if (semver.lt(CONFIG.apiVersion, "1.10.0")) { + if (semver.lt(CONFIG.apiVersion, "1.10.0")) { $('.tunings .yaw_rate input[name="yaw_expo"]').hide(); } From 322b7c10859e02d766811e8a05fbbcf0f06201de Mon Sep 17 00:00:00 2001 From: ProDrone Date: Sat, 9 May 2015 15:46:56 +0200 Subject: [PATCH 4/4] Fix access to `RC_YAW_EXPO` in `MSP_RC_TUNING` data packet --- js/msp.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/msp.js b/js/msp.js index 1f6b44c8..5f6e8649 100644 --- a/js/msp.js +++ b/js/msp.js @@ -308,7 +308,8 @@ var MSP = { RC_tuning.throttle_MID = parseFloat((data.getUint8(offset++) / 100).toFixed(2)); RC_tuning.throttle_EXPO = parseFloat((data.getUint8(offset++) / 100).toFixed(2)); if (semver.gte(CONFIG.apiVersion, "1.7.0")) { - RC_tuning.dynamic_THR_breakpoint = data.getUint16(offset++, 1); + RC_tuning.dynamic_THR_breakpoint = data.getUint16(offset, 1); + offset += 2; // point past 16 bit (2 bytes) } if (semver.gte(CONFIG.apiVersion, "1.10.0")) { RC_tuning.RC_YAW_EXPO = parseFloat((data.getUint8(offset++) / 100).toFixed(2));