Refactor update rates of tab controllers

Previous way of controlling when controllers were run was split among
the different controllers, meaning that third parties would require
knowledge of internal state of controllers in order to be on the same
update schedule as them.

This refactor moves the logic into a seperate class.

Additionally, it also stops the use of the `adjustUpdateRate` function
on all tab controllers, since it broke the prime-number-ability of
less collisions.
This commit is contained in:
Vasily
2020-06-06 20:53:34 +02:00
committed by username223
parent 82a0357748
commit 3857c2ac2f
19 changed files with 423 additions and 395 deletions
+2 -17
View File
@@ -44,6 +44,8 @@
#include "alarm_clock/vr_alarm.h"
#include "utils/update_rate.h"
namespace application_strings
{
constexpr auto applicationOrganizationName = "AdvancedSettings-Team";
@@ -61,23 +63,6 @@ constexpr const char* applicationVersionString = APPLICATION_VERSION;
// application namespace
namespace advsettings
{
// These counters set timing for refreshing settings changes in tab ui
// SettingsUpdateCounter values are set as prime numbers to reduce overlap
// of simultaneous settings updates.
// Actual rates of updates are counter * vsync (~11ms)
// Values chosen based on update speed priority
// Avoid setting values to the same numbers.
constexpr int k_audioSettingsUpdateCounter = 89;
constexpr int k_chaperoneSettingsUpdateCounter = 101;
constexpr int k_moveCenterSettingsUpdateCounter = 83;
constexpr int k_settingsTabSettingsUpdateCounter = 157;
constexpr int k_steamVrSettingsUpdateCounter = 97;
constexpr int k_utilitiesSettingsUpdateCounter = 19;
// Dashboard Updates These can be faster as they should only be running while
// Dashboard is active.
constexpr int k_videoDashboardUpdateCounter = 47;
// k_nonVsyncTickRate determines number of ms we wait to force the next event
// loop tick when vsync is too late due to dropped frames.
constexpr int k_nonVsyncTickRate = 20;