mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-26 17:55:24 +03:00
Merge branch 'destos-rate-charts' into development
This commit is contained in:
commit
9b820499a9
3 changed files with 21 additions and 16 deletions
|
@ -224,7 +224,7 @@
|
||||||
margin: 0 10px 10px 0;
|
margin: 0 10px 10px 0;
|
||||||
|
|
||||||
width: 220px;
|
width: 220px;
|
||||||
height: 58px;
|
height: 120px;
|
||||||
|
|
||||||
border: 1px solid silver;
|
border: 1px solid silver;
|
||||||
}
|
}
|
||||||
|
@ -232,7 +232,7 @@
|
||||||
margin: 0 10px 0 0;
|
margin: 0 10px 0 0;
|
||||||
|
|
||||||
width: 220px;
|
width: 220px;
|
||||||
height: 58px;
|
height: 120px;
|
||||||
|
|
||||||
border: 1px solid silver;
|
border: 1px solid silver;
|
||||||
}
|
}
|
||||||
|
@ -342,4 +342,4 @@
|
||||||
fill: none;
|
fill: none;
|
||||||
stroke: #000;
|
stroke: #000;
|
||||||
shape-rendering: crispEdges;
|
shape-rendering: crispEdges;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,10 +57,10 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="curves">
|
<div class="curves">
|
||||||
<div class="throttle_curve">
|
<div class="throttle_curve">
|
||||||
<canvas width="220" height="58"></canvas>
|
<canvas width="220" height="120"></canvas>
|
||||||
</div>
|
</div>
|
||||||
<div class="pitch_roll_curve">
|
<div class="pitch_roll_curve">
|
||||||
<canvas width="220" height="58"></canvas>
|
<canvas width="220" height="120"></canvas>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="clear-both"></div>
|
<div class="clear-both"></div>
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
TABS.receiver = {};
|
TABS.receiver = {
|
||||||
|
rateChartHeight: 120
|
||||||
|
};
|
||||||
|
|
||||||
TABS.receiver.initialize = function (callback) {
|
TABS.receiver.initialize = function (callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
@ -43,11 +46,11 @@ TABS.receiver.initialize = function (callback) {
|
||||||
$('.tunings .rate input[name="rate"]').val(RC_tuning.RC_RATE.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 .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();
|
$('.tunings .yaw_rate input[name="yaw_expo"]').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
chrome.storage.local.get('rx_refresh_rate', function (result) {
|
chrome.storage.local.get('rx_refresh_rate', function (result) {
|
||||||
if (result.rx_refresh_rate) {
|
if (result.rx_refresh_rate) {
|
||||||
$('select[name="rx_refresh_rate"]').val(result.rx_refresh_rate).change();
|
$('select[name="rx_refresh_rate"]').val(result.rx_refresh_rate).change();
|
||||||
|
@ -186,6 +189,8 @@ TABS.receiver.initialize = function (callback) {
|
||||||
|
|
||||||
$('select[name="rssi_channel"]').val(MISC.rssi_channel);
|
$('select[name="rssi_channel"]').val(MISC.rssi_channel);
|
||||||
|
|
||||||
|
var rateHeight = TABS.receiver.rateChartHeight;
|
||||||
|
|
||||||
// UI Hooks
|
// UI Hooks
|
||||||
// curves
|
// curves
|
||||||
$('.tunings .throttle input').on('input change', function () {
|
$('.tunings .throttle input').on('input change', function () {
|
||||||
|
@ -211,14 +216,14 @@ TABS.receiver.initialize = function (callback) {
|
||||||
var midx = 220 * mid,
|
var midx = 220 * mid,
|
||||||
midxl = midx * 0.5,
|
midxl = midx * 0.5,
|
||||||
midxr = (((220 - midx) * 0.5) + midx),
|
midxr = (((220 - midx) * 0.5) + midx),
|
||||||
midy = 58 - (midx * (58 / 220)),
|
midy = rateHeight - (midx * (rateHeight / 220)),
|
||||||
midyl = 58 - ((58 - midy) * 0.5 *(expo + 1)),
|
midyl = rateHeight - ((rateHeight - midy) * 0.5 *(expo + 1)),
|
||||||
midyr = (midy / 2) * (expo + 1);
|
midyr = (midy / 2) * (expo + 1);
|
||||||
|
|
||||||
// draw
|
// draw
|
||||||
context.clearRect(0, 0, 220, 58);
|
context.clearRect(0, 0, 220, rateHeight);
|
||||||
context.beginPath();
|
context.beginPath();
|
||||||
context.moveTo(0, 58);
|
context.moveTo(0, rateHeight);
|
||||||
context.quadraticCurveTo(midxl, midyl, midx, midy);
|
context.quadraticCurveTo(midxl, midyl, midx, midy);
|
||||||
context.moveTo(midx, midy);
|
context.moveTo(midx, midy);
|
||||||
context.quadraticCurveTo(midxr, midyr, 220, 0);
|
context.quadraticCurveTo(midxr, midyr, 220, 0);
|
||||||
|
@ -247,13 +252,13 @@ TABS.receiver.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// math magic by englishman
|
// math magic by englishman
|
||||||
var ratey = 58 * rate;
|
var ratey = rateHeight * rate;
|
||||||
|
|
||||||
// draw
|
// draw
|
||||||
context.clearRect(0, 0, 220, 58);
|
context.clearRect(0, 0, 220, rateHeight);
|
||||||
context.beginPath();
|
context.beginPath();
|
||||||
context.moveTo(0, 58);
|
context.moveTo(0, rateHeight);
|
||||||
context.quadraticCurveTo(110, 58 - ((ratey / 2) * (1 - expo)), 220, 58 - ratey);
|
context.quadraticCurveTo(110, rateHeight - ((ratey / 2) * (1 - expo)), 220, rateHeight - ratey);
|
||||||
context.lineWidth = 2;
|
context.lineWidth = 2;
|
||||||
context.stroke();
|
context.stroke();
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue