diff --git a/_locales/en/messages.json b/_locales/en/messages.json index c8ac6162..9d8bc7ba 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1635,5 +1635,11 @@ }, "configurationUnsyncedPWMFreq": { "message": "Unsynced PWM frequency" - } + }, + "configurationGyroSyncDenom": { + "message": "Gyro update frequency" + }, + "configurationPidProcessDenom": { + "message": "PID loop frequency" + } } diff --git a/tabs/configuration.html b/tabs/configuration.html index 40a41d88..27c657cf 100644 --- a/tabs/configuration.html +++ b/tabs/configuration.html @@ -355,16 +355,23 @@

-
-
diff --git a/tabs/configuration.js b/tabs/configuration.js index b86dc978..f5853306 100644 --- a/tabs/configuration.js +++ b/tabs/configuration.js @@ -297,6 +297,65 @@ TABS.configuration.initialize = function (callback, scrollPosition) { $('div.unsyncedpwmfreq').hide(); } + // Gyro and PID update + var gyroFreq = [ + "8KHz", + "4KHz", + "2.67KHz", + "2KHz", + "1.6KHz", + "1.33KHz", + "1.14KHz", + "1KHz" + ]; + + var gyro_select_e = $('select.gyroSyncDenom'); + + for (var i = 0; i < gyroFreq.length; i++) { + gyro_select_e.append(''); + } + gyro_select_e.val(PID_ADVANCED_CONFIG.gyro_sync_denom); + + var gyroDenom = PID_ADVANCED_CONFIG.gyro_sync_denom; + var pidFreq = [ + 8 / (gyroDenom * 1), + 8 / (gyroDenom * 2), + 8 / (gyroDenom * 3), + 8 / (gyroDenom * 4), + 8 / (gyroDenom * 5), + 8 / (gyroDenom * 6), + 8 / (gyroDenom * 7), + 8 / (gyroDenom * 8) + ]; + + var pid_select_e = $('select.pidProcessDenom'); + for (var i = 0; i < pidFreq.length; i++) { + var pidF = (1000 * pidFreq[i] / 10); // Could be done better + pidF = pidF.toFixed(0); + pid_select_e.append(''); + } + pid_select_e.val(PID_ADVANCED_CONFIG.pid_process_denom); + + $('select.gyroSyncDenom').change(function() { + var gyroDenom = $('select.gyroSyncDenom').val(); + var newPidFreq = [ + 8 / (gyroDenom * 1), + 8 / (gyroDenom * 2), + 8 / (gyroDenom * 3), + 8 / (gyroDenom * 4), + 8 / (gyroDenom * 5), + 8 / (gyroDenom * 6), + 8 / (gyroDenom * 7), + 8 / (gyroDenom * 8) + ]; + for (var i=0; i