added profile select in PID tab

pull/3/head
cTn 11 years ago
parent ddee2f424b
commit 65555b224c

@ -465,6 +465,7 @@ function process_data(code, message_buffer, message_length) {
send_message(MSP_codes.MSP_ACC_TRIM, MSP_codes.MSP_ACC_TRIM);
break;
case MSP_codes.MSP_SELECT_SETTING:
console.log('Profile selected');
break;
case MSP_codes.MSP_SET_SERVO_CONF:
console.log('Servo Configuration saved');

@ -3,11 +3,11 @@
.tab-pid_tuning input[type="number"]::-webkit-inner-spin-button {
border: 0;
}
.tab-pid_tuning table {
float: left;
border-collapse: collapse;
}
.tab-pid_tuning table {
float: left;
border-collapse: collapse;
}
.tab-pid_tuning table,
.tab-pid_tuning table th,
.tab-pid_tuning table td {
@ -39,6 +39,32 @@
padding: 0 5px 0 5px;
text-align: right;
}
.tab-pid_tuning .profile {
float: left;
margin-top: 10px;
width: 70px;
border: 1px solid silver;
}
.tab-pid_tuning .profile .head {
display: block;
text-align: center;
line-height: 20px;
font-weight: bold;
border-bottom: 1px solid silver;
background-color: #ececec;
}
.tab-pid_tuning .profile input {
padding-left: 30px;
width: 40px;
height: 20px;
line-height: 20px;
}
.tab-pid_tuning .rate-tpa {
margin-left: 10px;
}

@ -78,4 +78,9 @@
</table>
<a class="update" href="#">Save</a>
<a class="refresh" href="#">Refresh</a>
<div class="clear-both"></div>
<div class="profile">
<span class="head">Profile</span>
<input type="number" name="profile" min="1" max="3" />
</div>
</div>

@ -142,7 +142,21 @@ function tab_initialize_pid_tuning() {
$('.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));
// Fill in currently selected profile
$('input[name="profile"]').val(CONFIG.profile + 1); // +1 because the range is 0-2
// UI Hooks
$('input[name="profile"]').change(function() {
var profile = parseInt($(this).val());
send_message(MSP_codes.MSP_SELECT_SETTING, [profile - 1], false, function() {
GUI.log('Loaded Profile: <strong>' + profile + '</strong>');
GUI.tab_switch_cleanup(function() {
tab_initialize_pid_tuning();
});
});
});
$('a.refresh').click(function() {
GUI.tab_switch_cleanup(function() {
GUI.log('PID data <strong>refreshed</strong>');

Loading…
Cancel
Save