- Place frame on a level surface, proceed with calibration, ensure it is not moving during this period.
+ Place frame on a level surface, proceed with calibration, ensure it is not moving during this period.
- Click the button, move multirotor atleast 360 degrees on all axis of rotation.
- You have 30 seconds to perform this task.
+ Click the button, move multirotor atleast 360 degrees on all axis of rotation.
+ You have 30 seconds to perform this task.
\ No newline at end of file
diff --git a/tabs/pid_tuning.html b/tabs/pid_tuning.html
index 3b1b0172f4..44b7265bd7 100644
--- a/tabs/pid_tuning.html
+++ b/tabs/pid_tuning.html
@@ -59,4 +59,5 @@
+ Update
\ No newline at end of file
diff --git a/tabs/pid_tuning.js b/tabs/pid_tuning.js
index d02786a32c..f1cd2bd58a 100644
--- a/tabs/pid_tuning.js
+++ b/tabs/pid_tuning.js
@@ -1,4 +1,5 @@
function tab_initialize_pid_tuning() {
+ // Fill in the data from PIDs array
var needle = 0;
var i = 0;
@@ -53,6 +54,50 @@ function tab_initialize_pid_tuning() {
$('.pid_tuning .MAG input').each(function() {
$(this).val(PIDs[needle][i++].toFixed(2));
});
- needle++;
+ needle++;
+
+ // UI Hooks
+
+ $('.pid_tuning input').change(function() {
+ // if any of the fields changed, unlock update button
+ $('a.update').addClass('active');
+ });
+
+ $('a.update').click(function() {
+ if ($(this).hasClass('active')) {
+ // Catch all the changes and stuff the inside PIDs array
+ var needle_main = 0;
+ var needle_secondary = 0;
+
+ $('.pid_tuning input').each(function() {
+ PIDs[needle_main][needle_secondary] = parseFloat($(this).val());
+ needle_secondary++;
+
+ // exceptions (required for the "shorter" PID arrays, 2 fields, 1 field, etc)
+ if (needle_main == 4) {
+ if (needle_secondary >= 2) {
+ needle_main++;
+ needle_secondary = 0;
+ }
+ } else if (needle_main == 8) {
+ if (needle_secondary >= 1) {
+ needle_main++;
+ needle_secondary = 0;
+ }
+ } else {
+ if (needle_secondary >= 3) {
+ needle_main++;
+ needle_secondary = 0;
+ }
+ }
+ });
+
+ // Send over the changes
+
+
+ // remove the active status
+ $(this).removeClass('active');
+ }
+ });
}
\ No newline at end of file