diff --git a/js/msp.js b/js/msp.js index a560fabb..ec4d9ffb 100644 --- a/js/msp.js +++ b/js/msp.js @@ -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'); diff --git a/tabs/pid_tuning.css b/tabs/pid_tuning.css index 29bedae5..6fdfc014 100644 --- a/tabs/pid_tuning.css +++ b/tabs/pid_tuning.css @@ -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; } diff --git a/tabs/pid_tuning.html b/tabs/pid_tuning.html index 4bce8f2a..91a4c305 100644 --- a/tabs/pid_tuning.html +++ b/tabs/pid_tuning.html @@ -78,4 +78,9 @@ Save Refresh +
+
+ Profile + +
\ No newline at end of file diff --git a/tabs/pid_tuning.js b/tabs/pid_tuning.js index b7e196e1..58c9ee9e 100644 --- a/tabs/pid_tuning.js +++ b/tabs/pid_tuning.js @@ -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: ' + profile + ''); + + GUI.tab_switch_cleanup(function() { + tab_initialize_pid_tuning(); + }); + }); + }); + $('a.refresh').click(function() { GUI.tab_switch_cleanup(function() { GUI.log('PID data refreshed');