From 66fb9151f4d4dba8f3ea6336a947ecb9d75c8c30 Mon Sep 17 00:00:00 2001 From: mikeller Date: Sun, 12 Apr 2020 02:04:42 +1200 Subject: [PATCH] Added analytics data collection for the PID loop frequency. --- src/js/tabs/configuration.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/js/tabs/configuration.js b/src/js/tabs/configuration.js index c71e6b41..aeb44935 100644 --- a/src/js/tabs/configuration.js +++ b/src/js/tabs/configuration.js @@ -1235,7 +1235,20 @@ TABS.configuration.initialize = function (callback, scrollPosition) { PID_ADVANCED_CONFIG.use_unsyncedPwm = $('input[id="unsyncedPWMSwitch"]').is(':checked') ? 1 : 0; PID_ADVANCED_CONFIG.motor_pwm_rate = parseInt($('input[name="unsyncedpwmfreq"]').val()); PID_ADVANCED_CONFIG.gyro_sync_denom = parseInt(gyroSelectElement.val()); - PID_ADVANCED_CONFIG.pid_process_denom = parseInt(pidSelectElement.val()); + + const value = parseInt(pidSelectElement.val()); + + let newDenominator = undefined; + let newFrequency = undefined; + if (value !== PID_ADVANCED_CONFIG.pid_process_denom) { + newDenominator = value; + newFrequency = pidSelectElement.find('option:selected').text(); + } + self.analyticsChanges['PIDLoopDenominator'] = newDenominator; + self.analyticsChanges['PIDLoopFrequency'] = newFrequency; + + PID_ADVANCED_CONFIG.pid_process_denom = value; + PID_ADVANCED_CONFIG.digitalIdlePercent = parseFloat($('input[name="digitalIdlePercent"]').val()); if (semver.gte(CONFIG.apiVersion, "1.25.0") && semver.lt(CONFIG.apiVersion, "1.41.0")) { PID_ADVANCED_CONFIG.gyroUse32kHz = $('input[id="gyroUse32kHz"]').is(':checked') ? 1 : 0;