mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[ntcore] Reduce limit on flush and update rate to 5 ms
This commit is contained in:
@@ -203,9 +203,9 @@ void DispatcherBase::Stop() {
|
||||
}
|
||||
|
||||
void DispatcherBase::SetUpdateRate(double interval) {
|
||||
// don't allow update rates faster than 10 ms or slower than 1 second
|
||||
if (interval < 0.01)
|
||||
interval = 0.01;
|
||||
// don't allow update rates faster than 5 ms or slower than 1 second
|
||||
if (interval < 0.005)
|
||||
interval = 0.005;
|
||||
else if (interval > 1.0)
|
||||
interval = 1.0;
|
||||
m_update_rate = static_cast<unsigned int>(interval * 1000);
|
||||
@@ -220,8 +220,8 @@ void DispatcherBase::Flush() {
|
||||
auto now = std::chrono::steady_clock::now();
|
||||
{
|
||||
std::scoped_lock lock(m_flush_mutex);
|
||||
// don't allow flushes more often than every 10 ms
|
||||
if ((now - m_last_flush) < std::chrono::milliseconds(10)) return;
|
||||
// don't allow flushes more often than every 5 ms
|
||||
if ((now - m_last_flush) < std::chrono::milliseconds(5)) return;
|
||||
m_last_flush = now;
|
||||
m_do_flush = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user