Compare commits

..

No commits in common. "0cb87e8f81fe9de1fec3c3f333434de291a9d495" and "0035efb61c9b52b8c071c84121c19060042c3a07" have entirely different histories.

View File

@ -35,7 +35,7 @@ public class OSCCollar
private DateTime _lastNilMessageSent = DateTime.UnixEpoch; private DateTime _lastNilMessageSent = DateTime.UnixEpoch;
private DateTime _lastConsoleOutput = DateTime.UnixEpoch; private DateTime _lastConsoleOutput = DateTime.UnixEpoch;
private static readonly TimeSpan ConsoleUpdateInterval = TimeSpan.FromMilliseconds(100); private static readonly TimeSpan ConsoleUpdateInterval = TimeSpan.FromMilliseconds(100);
private static readonly TimeSpan UpdateInterval = TimeSpan.FromMilliseconds(10); private static readonly TimeSpan UpdateInterval = TimeSpan.FromMilliseconds(1);
private static readonly TimeSpan MessageMinInterval = TimeSpan.FromMilliseconds(400); private static readonly TimeSpan MessageMinInterval = TimeSpan.FromMilliseconds(400);
private readonly double _radius; private readonly double _radius;
private GPS GPS1 { get; init; } private GPS GPS1 { get; init; }
@ -185,21 +185,18 @@ public class OSCCollar
{ {
this.Client.Send("/input/Vertical", 0f); this.Client.Send("/input/Vertical", 0f);
this.Client.Send("/input/Horizontal", 0f); this.Client.Send("/input/Horizontal", 0f);
this.Client.Send("/input/Run", 0);
this._lastNilMessageSent = DateTime.Now; this._lastNilMessageSent = DateTime.Now;
_nilSent++; _nilSent++;
}else if (_allowMoving) }
if (_allowMoving)
{ {
Thread.Sleep(1);
if (_leashStretch > 0.1) if (_leashStretch > 0.1)
{ {
this.Client.Send("/input/Vertical", Convert.ToSingle(_verticalMovement)); this.Client.Send("/input/Vertical", Convert.ToSingle(_verticalMovement));
this.Client.Send("/input/Horizontal", Convert.ToSingle(_horizontalMovement)); this.Client.Send("/input/Horizontal", Convert.ToSingle(_horizontalMovement));
} }
if (_leashStretch > 0.4)
this.Client.Send("/input/Run", 1);
else
this.Client.Send("/input/Run", 0);
} }
if (_lastConsoleOutput.Add(ConsoleUpdateInterval) < DateTime.Now) if (_lastConsoleOutput.Add(ConsoleUpdateInterval) < DateTime.Now)