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

adding refresh button to PID/Receiver tabs

This commit is contained in:
cTn 2014-01-19 17:30:55 +01:00
parent 27cf1efeae
commit 0ccdc762b4
6 changed files with 34 additions and 4 deletions

View file

@ -43,7 +43,8 @@
.tab-pid_tuning .rate-tpa input {
width: 127px;
}
.tab-pid_tuning .update {
.tab-pid_tuning .update,
.tab-pid_tuning .refresh {
display: block;
float: right;
@ -60,6 +61,10 @@
border: 1px solid silver;
background-color: #ececec;
}
.tab-pid_tuning .update:hover {
.tab-pid_tuning .refresh {
margin-right: 10px;
}
.tab-pid_tuning .update:hover,
.tab-pid_tuning .refresh:hover {
background-color: #dedcdc;
}

View file

@ -71,4 +71,5 @@
</tr>
</table>
<a class="update" href="#">Save</a>
<a class="refresh" href="#">Refresh</a>
</div>

View file

@ -137,6 +137,9 @@ function tab_initialize_pid_tuning() {
$('.rate-tpa input[name="tpa"]').val(RC_tuning.dynamic_THR_PID.toFixed(2));
// UI Hooks
$('a.refresh').click(function() {
tab_initialize_pid_tuning();
});
$('a.update').click(function() {
// Catch all the changes and stuff the inside PIDs array

View file

@ -81,7 +81,8 @@
border: 1px solid silver;
}
.tab-receiver .update {
.tab-receiver .update,
.tab-receiver .refresh {
display: block;
float: right;
@ -98,6 +99,10 @@
border: 1px solid silver;
background-color: #ececec;
}
.tab-receiver .update:hover {
.tab-receiver .refresh {
margin-right: 10px;
}
.tab-receiver .update:hover,
.tab-receiver .refresh:hover {
background-color: #dedcdc;
}

View file

@ -63,6 +63,7 @@
</tr>
</table>
<a class="update" href="#">Save</a>
<a class="refresh" href="#">Refresh</a>
</div>
<div class="curves">
<div class="throttle_curve">

View file

@ -102,6 +102,21 @@ function tab_initialize_receiver() {
}, 0); // race condition, that should always trigger after all events are processed
}).change();
$('a.refresh').click(function() {
send_message(MSP_codes.MSP_RC_TUNING, MSP_codes.MSP_RC_TUNING, false, function() {
// fill in data from RC_tuning
$('.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();
});
});
$('a.update').click(function() {
// catch RC_tuning changes
RC_tuning.throttle_MID = parseFloat($('.tunings .throttle input[name="mid"]').val());