refresh osc services every 10 seconds
This commit is contained in:
parent
950168e856
commit
0857a4763c
@ -43,6 +43,7 @@ public partial class OSCCollar
|
||||
private Vector _movementVector = new(0, 0);
|
||||
private bool _allowMoving = true;
|
||||
private DateTime _lastNilMessageSent = DateTime.UnixEpoch;
|
||||
private DateTime _lastOSCRefresh = DateTime.Now;
|
||||
private static readonly TimeSpan UpdateInterval = TimeSpan.FromMilliseconds(10);
|
||||
private static readonly TimeSpan MessageMinInterval = TimeSpan.FromMilliseconds(400);
|
||||
private GPS _gps1 = null!, _gps2 = null!, _gps3 = null!;
|
||||
@ -208,6 +209,12 @@ public partial class OSCCollar
|
||||
this._client.Send("/input/Vertical", Convert.ToSingle(_movementVector.Y));
|
||||
this._client.Send("/input/Horizontal", Convert.ToSingle(_movementVector.X));
|
||||
}
|
||||
|
||||
if (_lastOSCRefresh.Add(TimeSpan.FromSeconds(10)) > DateTime.Now)
|
||||
{
|
||||
this.OscQueryService?.RefreshServices();
|
||||
_lastOSCRefresh = DateTime.Now;
|
||||
}
|
||||
|
||||
Thread.Sleep(UpdateInterval);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user