Panel readout shows the wire values while the dot stays physical
With Invert Y checked the readout claimed "Y 80" while the AnalogReply carried -80. The flip is factored into VRioDevice.WireY, shared by the reply builder and the new GetWireAxis accessor; the canvas readout uses a WireAxisProvider fed from it, and toggling the checkbox repaints so the sign flips in place. Dot and gauges keep tracking the stick. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -108,6 +108,20 @@ public sealed class VRioDevice
|
||||
lock (_gate) return _axes[(int)axis];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Axis value as the next AnalogReply will carry it — same as
|
||||
/// <see cref="GetAxis"/> except for the <see cref="InvertJoystickY"/> flip.
|
||||
/// </summary>
|
||||
public short GetWireAxis(RioAxis axis)
|
||||
{
|
||||
short value = GetAxis(axis);
|
||||
return axis == RioAxis.JoystickY ? WireY(value) : value;
|
||||
}
|
||||
|
||||
private short WireY(short y) => InvertJoystickY
|
||||
? (short)Math.Min(AnalogCodec.Max, -y) // clamp: -Min (8192) is one past the 14-bit Max
|
||||
: y;
|
||||
|
||||
/// <summary>
|
||||
/// Move an axis. Values are clamped to the 14-bit signed range the wire
|
||||
/// can carry; the new value is returned by the next AnalogReply.
|
||||
@@ -281,9 +295,7 @@ public sealed class VRioDevice
|
||||
y = _axes[(int)RioAxis.JoystickY];
|
||||
x = _axes[(int)RioAxis.JoystickX];
|
||||
}
|
||||
if (InvertJoystickY) // clamp: -Min (8192) is one past the 14-bit Max
|
||||
y = (short)Math.Min(AnalogCodec.Max, -y);
|
||||
Send(PacketBuilder.AnalogReply(t, l, r, y, x));
|
||||
Send(PacketBuilder.AnalogReply(t, l, r, WireY(y), x));
|
||||
break;
|
||||
|
||||
case RioCommand.ResetRequest:
|
||||
|
||||
Reference in New Issue
Block a user