+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+
+
+
+
+
+
diff --git a/tabs/pid_tuning.js b/tabs/pid_tuning.js
index 111cac3e..d5d206d4 100755
--- a/tabs/pid_tuning.js
+++ b/tabs/pid_tuning.js
@@ -170,12 +170,21 @@ TABS.pid_tuning.initialize = function (callback) {
});
// Fill in data from RC_tuning object
- $('.rate-tpa input[name="roll-pitch"]').val(RC_tuning.roll_pitch_rate.toFixed(2));
- $('.rate-tpa input[name="roll"]').val(RC_tuning.roll_rate.toFixed(2));
- $('.rate-tpa input[name="pitch"]').val(RC_tuning.pitch_rate.toFixed(2));
- $('.rate-tpa input[name="yaw"]').val(RC_tuning.yaw_rate.toFixed(2));
- $('.rate-tpa input[name="tpa"]').val(RC_tuning.dynamic_THR_PID.toFixed(2));
- $('.rate-tpa input[name="tpa-breakpoint"]').val(RC_tuning.dynamic_THR_breakpoint);
+ $('.pid_tuning input[name="rc_rate"]').val(RC_tuning.RC_RATE.toFixed(2));
+ $('.pid_tuning input[name="roll_pitch_rate"]').val(RC_tuning.roll_pitch_rate.toFixed(2));
+ $('.pid_tuning input[name="roll_rate"]').val(RC_tuning.roll_rate.toFixed(2));
+ $('.pid_tuning input[name="pitch_rate"]').val(RC_tuning.pitch_rate.toFixed(2));
+ $('.pid_tuning input[name="yaw_rate"]').val(RC_tuning.yaw_rate.toFixed(2));
+ $('.pid_tuning input[name="rc_expo"]').val(RC_tuning.RC_EXPO.toFixed(2));
+ $('.pid_tuning input[name="rc_yaw_expo"]').val(RC_tuning.RC_YAW_EXPO.toFixed(2));
+
+ $('.tpa input[name="tpa"]').val(RC_tuning.dynamic_THR_PID.toFixed(2));
+ $('.tpa input[name="tpa-breakpoint"]').val(RC_tuning.dynamic_THR_breakpoint);
+
+ if (semver.lt(CONFIG.apiVersion, "1.10.0")) {
+ $('.pid_tuning input[name="rc_yaw_expo"]').hide();
+ $('.pid_tuning input[name="rc_expo"]').attr("rowspan", "3");
+ }
}
function form_to_pid_and_rc() {
@@ -231,12 +240,16 @@ TABS.pid_tuning.initialize = function (callback) {
});
// catch RC_tuning changes
- RC_tuning.roll_pitch_rate = parseFloat($('.rate-tpa input[name="roll-pitch"]').val());
- RC_tuning.roll_rate = parseFloat($('.rate-tpa input[name="roll"]').val());
- RC_tuning.pitch_rate = parseFloat($('.rate-tpa input[name="pitch"]').val());
- RC_tuning.yaw_rate = parseFloat($('.rate-tpa input[name="yaw"]').val());
- RC_tuning.dynamic_THR_PID = parseFloat($('.rate-tpa input[name="tpa"]').val());
- RC_tuning.dynamic_THR_breakpoint = parseInt($('.rate-tpa input[name="tpa-breakpoint"]').val());
+ RC_tuning.RC_RATE = parseFloat($('.pid_tuning input[name="rc_rate"]').val());
+ RC_tuning.roll_pitch_rate = parseFloat($('.pid_tuning input[name="roll_pitch_rate"]').val());
+ RC_tuning.roll_rate = parseFloat($('.pid_tuning input[name="roll_rate"]').val());
+ RC_tuning.pitch_rate = parseFloat($('.pid_tuning input[name="pitch_rate"]').val());
+ RC_tuning.yaw_rate = parseFloat($('.pid_tuning input[name="yaw_rate"]').val());
+ RC_tuning.RC_EXPO = parseFloat($('.pid_tuning input[name="rc_expo"]').val());
+ RC_tuning.RC_YAW_EXPO = parseFloat($('.pid_tuning input[name="rc_yaw_expo"]').val());
+
+ RC_tuning.dynamic_THR_PID = parseFloat($('.tpa input[name="tpa"]').val());
+ RC_tuning.dynamic_THR_breakpoint = parseInt($('.tpa input[name="tpa-breakpoint"]').val());
}
function hideUnusedPids(sensors_detected) {
$('.tab-pid_tuning table.pid_tuning').hide();
@@ -331,14 +344,63 @@ TABS.pid_tuning.initialize = function (callback) {
}
if (semver.lt(CONFIG.apiVersion, "1.7.0")) {
- $('.rate-tpa .tpa-breakpoint').hide();
- $('.rate-tpa .roll').hide();
- $('.rate-tpa .pitch').hide();
+ $('.tpa .tpa-breakpoint').hide();
+
+ $('.pid_tuning .roll_rate').hide();
+ $('.pid_tuning .pitch_rate').hide();
} else {
- $('.rate-tpa .roll-pitch').hide();
+ $('.pid_tuning .roll_pitch_rate').hide();
+ }
+
+ function setCanvasDimensions(canvas) {
+ canvas.width = canvas.parentNode.clientWidth;
+ canvas.height = canvas.parentNode.clientHeight;
+ }
+ setCanvasDimensions($('.pitch_roll_curve canvas').get(0));
+ setCanvasDimensions($('.yaw_curve canvas').get(0));
+
+ function drawRateCurve(rateElement, expoElement, canvasElement) {
+ var rate = parseFloat(rateElement.val()),
+ expo = parseFloat(expoElement.val()),
+ context = canvasElement.getContext("2d");
+
+ // local validation to deal with input event
+ if (rate >= parseFloat(rateElement.prop('min')) &&
+ rate <= parseFloat(rateElement.prop('max')) &&
+ expo >= parseFloat(expoElement.prop('min')) &&
+ expo <= parseFloat(expoElement.prop('max'))) {
+
+ var rateHeight = canvasElement.height;
+ var rateWidth = canvasElement.width;
+
+ // math magic by englishman
+ var ratey = rateHeight * rate;
+
+ // draw
+ context.clearRect(0, 0, rateWidth, rateHeight);
+ context.beginPath();
+ context.moveTo(0, rateHeight);
+ context.quadraticCurveTo(rateWidth * 11 / 20, rateHeight - ((ratey / 2) * (1 - expo)), rateWidth, rateHeight - ratey);
+ context.lineWidth = 2;
+ context.strokeStyle = '#ffbb00';
+ context.stroke();
+ }
}
// UI Hooks
+ // curves
+ $('.pid_tuning').on('input change', function () {
+ setTimeout(function () { // let global validation trigger and adjust the values first
+ var rateElement = $('.pid_tuning input[name="rc_rate"]'),
+ expoElement = $('.pid_tuning input[name="rc_expo"]'),
+ yawExpoElement = $('.pid_tuning input[name="rc_yaw_expo"]'),
+ rcCurveElement = $('.pitch_roll_curve canvas').get(0),
+ rcYawCurveElement = $('.yaw_curve canvas').get(0);
+
+ drawRateCurve(rateElement, expoElement, rcCurveElement);
+ drawRateCurve(rateElement, yawExpoElement, rcYawCurveElement);
+ }, 0);
+ }).trigger('input');
$('a.refresh').click(function () {
GUI.tab_switch_cleanup(function () {
@@ -410,4 +472,4 @@ TABS.pid_tuning.cleanup = function (callback) {
if (callback) {
callback();
}
-};
\ No newline at end of file
+};
diff --git a/tabs/receiver.css b/tabs/receiver.css
index df26f132..ed4c83b1 100644
--- a/tabs/receiver.css
+++ b/tabs/receiver.css
@@ -156,15 +156,6 @@
margin-bottom: 10px;
}
-.tab-receiver .tunings .rate {
- margin-bottom: 10px;
-}
-
-.tab-receiver .tunings .yaw_rate {
- margin-left: 0px;
- margin-bottom: 10px;
-}
-
.tab-receiver .tunings table, .tab-receiver .tunings table th, .tab-receiver .tunings table td {
padding: 4px;
text-align: left;
@@ -319,17 +310,6 @@
background-position: center;
}
-.tab-receiver .pitch_roll_curve {
- margin: 0 0px 0px 0;
- width: 200px;
- height: 117px;
- border: 1px solid silver;
- border-radius: 3px;
- background-image: url(../images/paper.jpg);
- background-size: 200%;
- background-position: center;
-}
-
.tab-receiver select[name="rx_refresh_rate"] {
float: right;
border: 1px solid silver;
@@ -437,4 +417,4 @@
stroke: none;
fill: #828885;
font-size: 10px;
-}
\ No newline at end of file
+}
diff --git a/tabs/receiver.html b/tabs/receiver.html
index c5843b9c..05b756ac 100644
--- a/tabs/receiver.html
+++ b/tabs/receiver.html
@@ -71,35 +71,6 @@
-
diff --git a/tabs/receiver.js b/tabs/receiver.js
index ea10ec6c..846a0c76 100644
--- a/tabs/receiver.js
+++ b/tabs/receiver.js
@@ -51,14 +51,6 @@ TABS.receiver.initialize = function (callback) {
$('.tunings .throttle input[name="mid"]').val(RC_tuning.throttle_MID.toFixed(2));
$('.tunings .throttle input[name="expo"]').val(RC_tuning.throttle_EXPO.toFixed(2));
- $('.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));
-
- if (semver.lt(CONFIG.apiVersion, "1.10.0")) {
- $('.tunings .yaw_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();
@@ -248,39 +240,6 @@ TABS.receiver.initialize = function (callback) {
}, 0);
}).trigger('input');
- $('.tunings .rate input').on('input change', function () {
- setTimeout(function () { // let global validation trigger and adjust the values first
- var rateE = $('.tunings .rate input[name="rate"]'),
- expoE = $('.tunings .rate input[name="expo"]'),
- rate = parseFloat(rateE.val()),
- expo = parseFloat(expoE.val()),
- pitch_roll_curve = $('.pitch_roll_curve canvas').get(0),
- context = pitch_roll_curve.getContext("2d");
-
- // local validation to deal with input event
- if (rate >= parseFloat(rateE.prop('min')) &&
- rate <= parseFloat(rateE.prop('max')) &&
- expo >= parseFloat(expoE.prop('min')) &&
- expo <= parseFloat(expoE.prop('max'))) {
- // continue
- } else {
- return;
- }
-
- // math magic by englishman
- var ratey = rateHeight * rate;
-
- // draw
- context.clearRect(0, 0, 200, rateHeight);
- context.beginPath();
- context.moveTo(0, rateHeight);
- context.quadraticCurveTo(110, rateHeight - ((ratey / 2) * (1 - expo)), 200, rateHeight - ratey);
- context.lineWidth = 2;
- context.strokeStyle = '#ffbb00';
- context.stroke();
- }, 0);
- }).trigger('input');
-
$('a.refresh').click(function () {
MSP.send_message(MSP_codes.MSP_RC_TUNING, false, false, function () {
GUI.log(chrome.i18n.getMessage('receiverDataRefreshed'));
@@ -289,12 +248,8 @@ TABS.receiver.initialize = function (callback) {
$('.tunings .throttle input[name="mid"]').val(RC_tuning.throttle_MID.toFixed(2));
$('.tunings .throttle input[name="expo"]').val(RC_tuning.throttle_EXPO.toFixed(2));
- $('.tunings .rate input[name="rate"]').val(RC_tuning.RC_RATE.toFixed(2));
- $('.tunings .rate input[name="expo"]').val(RC_tuning.RC_EXPO.toFixed(2));
-
// update visual representation
$('.tunings .throttle input').change();
- $('.tunings .rate input').change();
});
});
@@ -303,10 +258,6 @@ TABS.receiver.initialize = function (callback) {
RC_tuning.throttle_MID = parseFloat($('.tunings .throttle input[name="mid"]').val());
RC_tuning.throttle_EXPO = parseFloat($('.tunings .throttle input[name="expo"]').val());
- 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 .yaw_rate input[name="yaw_expo"]').val());
-
if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
RC_deadband.yaw_deadband = parseInt($('.deadband input[name="yaw_deadband"]').val());
RC_deadband.deadband = parseInt($('.deadband input[name="deadband"]').val());