1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 16:25:31 +03:00

fixing the last bugger in curve/value update event

This commit is contained in:
cTn 2014-09-22 11:06:29 +02:00
parent a8b96a9206
commit 0cb69faf00

View file

@ -142,6 +142,7 @@ TABS.receiver.initialize = function (callback) {
// UI Hooks
// curves
$('.tunings .throttle input').on('input change', function () {
setTimeout(function () { // let global validation trigger and adjust the values first
var throttleMidE = $('.tunings .throttle input[name="mid"]'),
throttleExpoE = $('.tunings .throttle input[name="expo"]'),
mid = parseFloat(throttleMidE.val()),
@ -149,7 +150,7 @@ TABS.receiver.initialize = function (callback) {
throttle_curve = $('.throttle_curve canvas').get(0),
context = throttle_curve.getContext("2d");
// built in validation that executes before global validation
// local validation to deal with input event
if (mid >= parseFloat(throttleMidE.prop('min')) &&
mid <= parseFloat(throttleMidE.prop('max')) &&
expo >= parseFloat(throttleExpoE.prop('min')) &&
@ -176,9 +177,11 @@ TABS.receiver.initialize = function (callback) {
context.quadraticCurveTo(midxr, midyr, 220, 0);
context.lineWidth = 2;
context.stroke();
}, 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()),
@ -186,7 +189,7 @@ TABS.receiver.initialize = function (callback) {
pitch_roll_curve = $('.pitch_roll_curve canvas').get(0),
context = pitch_roll_curve.getContext("2d");
// built in validation that executes before global validation
// local validation to deal with input event
if (rate >= parseFloat(rateE.prop('min')) &&
rate <= parseFloat(rateE.prop('max')) &&
expo >= parseFloat(expoE.prop('min')) &&
@ -206,6 +209,7 @@ TABS.receiver.initialize = function (callback) {
context.quadraticCurveTo(110, 58 - ((ratey / 2) * (1 - expo)), 220, 58 - ratey);
context.lineWidth = 2;
context.stroke();
}, 0);
}).trigger('input');
$('a.refresh').click(function () {