Cockpit: activate the RIO controls -- L4CONTROLS=PAD before the DEV default

The single-window cockpit's on-screen RIO button banks + analog controls
run on the PadRIO virtual-RIO surface, but L4MFDSPLIT set L4CONTROLS=PAD
only AFTER the platform-profile block had already defaulted it to
KEYBOARD -- so the guard saw it set and PAD never engaged.  The log
proved it: 'DEV (single window + keyboard)' + 'Mech has no controls
mapping -- bring-up RIO fallback', no PadRIO, dark/inert buttons.

Move the cockpit's PAD control default BEFORE the platform block so it
wins over the DEV keyboard default (an explicit L4CONTROLS=RIO still
overrides for a real serial board).

Verified: cockpit now logs 'PadRIO: virtual RIO active', installs the
'L4' RIO mapping table via the PrimaryRIO path, and the mech drives --
throttle ramps 0.09->1.0 (speedDemand 5->61.5 u/s), stick turns
(turnDemand=1 with the speed-vs-turn clamp).  The on-screen buttons
inject into the same live PadRIO surface.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-07-16 20:59:08 -05:00
co-authored by Claude Fable 5
parent 230fc50f58
commit 5b8c814029
+13 -7
View File
@@ -256,6 +256,15 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
// `-platform pod` ATTEMPTS the path (FindBestAdapterIndices degrades to the
// primary adapter) -- selectable for bring-up, not fully validated off-pod.
// ---------------------------------------------------------------------------
// SINGLE-WINDOW COCKPIT (L4MFDSPLIT): the desktop cockpit's on-screen RIO
// button banks + analog controls run on the PadRIO virtual-RIO surface, so
// PAD is the cockpit's control DEFAULT -- established HERE, before the
// platform-profile block, so the DEV keyboard default (below) does not win
// (that left the RIO controls inert). An explicit L4CONTROLS still
// overrides (e.g. L4CONTROLS=RIO for a real serial board).
if (getenv("L4MFDSPLIT") != NULL && getenv("L4CONTROLS") == NULL)
putenv("L4CONTROLS=PAD");
int gBTPlatformPod = 0;
{
const char *pe = getenv("BT_PLATFORM");
@@ -319,13 +328,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
// SINGLE-WINDOW COCKPIT (L4MFDSPLIT=1, RP412's flag): the 3D viewscreen fills
// the window and the six instrument surfaces frame it (BTDrawCockpitPanel).
// Like the dev-gauge path it needs the gauge renderer awake (L4GAUGE); the
// window itself is sized to the 1920x1080 cockpit canvas below. PAD controls
// come along for the ride (a desktop cockpit has no serial RIO).
if (getenv("L4MFDSPLIT") != NULL)
{
if (getenv("L4GAUGE") == NULL) putenv("L4GAUGE=640x480x16");
if (getenv("L4CONTROLS") == NULL) putenv("L4CONTROLS=PAD");
}
// window itself is sized to the 1920x1080 cockpit canvas below. (The PAD
// control default is set earlier, before the platform-profile block.)
if (getenv("L4MFDSPLIT") != NULL && getenv("L4GAUGE") == NULL)
putenv("L4GAUGE=640x480x16");
std::cout << "[boot] platform profile: "
<< (gBTPlatformPod ? "POD (RIO cockpit input; multi-surface gauges/MFDs via pod hardware or explicit L4GAUGE)"