Port the analog calibration math and the plasma/VFD command set: - Calibration/: AxisCalibrator ports UpdateThrottle/UpdatePadal/UpdateJoystick (riovjoy2.cpp#L1504+) — throttle deadzone + ratchet field, pedal deadzones, joystick X/Y auto-ranging from observed min/max, rudder mixing (enableZR), and the per-axis invert flags. Stateful (start positions, last outputs, observed extremes) like the legacy globals, with the RIOcmd axis resets. Final outputs clamp to the documented 0..32766 range (also guards a legacy compounding quirk). AxisOutputs carries the six values; IJoystickSink gains SetAxis(JoyAxis,value) so calibrated axes reach the HID feeder. - Plasma/: PlasmaCommands builds the CPlasma ESC sequences (clear/cursor/font/ attr/box draw+fill/text) + GetFontSize + the PlasmaPosText auto-fit/centering; PlasmaDisplay writes them over the secondary COM transport. - tests: 21 new xUnit tests (105 total) for throttle proportional/saturation/ invert, pedal ZR mix vs. direct, joystick centering/direction/invert/reset, the output clamp, and plasma byte sequences/font sizes/auto-fit positioning. Hardware verification of axis feel + plasma output remains; the game-specific PlasmaScoreDraw layout is deferred to profile content (Phase 5/7). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
31 lines
1.2 KiB
C#
31 lines
1.2 KiB
C#
using RioJoy.Core.Mapping;
|
|
|
|
namespace RioJoy.Core.Tests.Mapping;
|
|
|
|
/// <summary>
|
|
/// Records every routed output as an ordered, human-readable log so tests can
|
|
/// assert both <i>what</i> happened and <i>in what order</i>.
|
|
/// </summary>
|
|
internal sealed class RecordingSink : IInputSink, IJoystickSink, ILampSink, IRioCommandSink
|
|
{
|
|
public List<string> Log { get; } = new();
|
|
|
|
public void KeyDown(byte virtualKey, bool extended) => Log.Add($"KeyDown(0x{virtualKey:X2},ext={extended})");
|
|
|
|
public void KeyUp(byte virtualKey, bool extended) => Log.Add($"KeyUp(0x{virtualKey:X2},ext={extended})");
|
|
|
|
public void MouseMove(int dx, int dy) => Log.Add($"MouseMove({dx},{dy})");
|
|
|
|
public void MouseButton(MouseButton button, bool down) => Log.Add($"MouseButton({button},{down})");
|
|
|
|
public void SetButton(int button, bool pressed) => Log.Add($"Joy({button},{pressed})");
|
|
|
|
public void SetHat(RioHat position) => Log.Add($"Hat({position})");
|
|
|
|
public void SetAxis(RioJoy.Core.Calibration.JoyAxis axis, int value) => Log.Add($"Axis({axis},{value})");
|
|
|
|
public void SetLamp(int address, byte lampState) => Log.Add($"Lamp(0x{address:X2},0x{lampState:X2})");
|
|
|
|
public void Execute(RioCommandCode command) => Log.Add($"Cmd({command})");
|
|
}
|