Zum Inhalt

Migration

Diese Seite wurde aus der AirSimTech MediaWiki migriert.

MCDU Keypress to Screen Update

Overview

When a pilot presses a key on the external MCDU hardware, the input travels over INET UDP, is received by the ASTLibrary INetClient1 control on the Windows Forms UI thread, forwarded to INetActor, published on the Akka EventStream, and then dispatched into the appropriate McduActor. The actor invokes the active IPage implementation, which builds a list of VB6-format command strings. McduCommandParser converts those strings into bytes written into an Arinc429ScreenBuffer. The buffer's BuildDifferentialMessage method performs an XOR-diff against the last transmission to produce a minimal byte payload, which is sent via INetActor to Arinc429UdpSender and transmitted over UDP as INET register 7100. The entire path from keypress to screen update completes in well under 100 ms regardless of any background trajectory computation.

Inbound Register Assignments

Register assignments are defined in McduActor.vb and match the VB6 frmMain DataRx handler exactly.

Register Side Purpose
2258 CPT Scratchpad text (string)
2260 CPT Keystroke value (LSK = 1000–1011, hardkeys = 0–11, NEXT/PREV = 97–98)
2254 CPT CLR key signal ("1" = pressed, "0" = released)
2357 FO Scratchpad text (string)
2358 FO Keystroke value (same encoding as CPT)
2353 FO CLR key signal ("1" = pressed, "0" = released)

End-to-End Data Flow

The twelve-step flow from hardware keypress to UDP screen transmission:

Keystroke Dispatch

HandleKeystroke in McduActor dispatches on the integer value received via the keystroke register:

Hardkeys (values 0–11): Page-switch keys mapped to McduPageType : 0 = DIR, 1 = PROG (flight-phase dependent), 2 = PERF (flight-phase dependent), 3 = INIT A, 4 = DATA1, 5 = F-PLN, 6 = RAD NAV, 7 = FUEL PRED, 8 = SEC INDEX, 9 = ATSU1, 10 = MCDU MENU (toggles McduMenu1/McduMenu2), 11 = AIRPORT (scrolls FPLN to destination)

Cursor keys (values 14–15): Circular scroll for FPLN and DIR pages. FPLN scrolling is inverted (VB6 parity): up-key (14) scrolls the leg list down (higher indices), down-key (15) scrolls up. Only scrolls when the MCDU leg list exceeds 5 entries; wraps around from last leg to first and vice versa. DIR page scrolling: up-key decreases _dirTopIndex, down-key increases it.

NEXT PAGE / PREV PAGE (values 97–98): Calls HandleNextPrevPage() to advance multi-page views.

LSK keys (values 1000–1011): Mapped to McduLskKey enum via CType(keyVal - 1000, McduLskKey) : 1000–1005 = L1–L6 (left softkeys), 1006–1011 = R1–R6 (right softkeys)

After each keystroke is processed, SendKeystrokeAck() resets the keystroke register to "-1" to acknowledge receipt (D-14).

CLR key (registers 2254/2353): Handled separately from the keystroke register. Value "1" = pressed (latched), "0" = released (reset by external MCDU). The _clearCommand flag is latched True on press and consumed (reset to False) by the next LSK action. When pressed: if _scratchpadMessage is non-empty it is cleared first; otherwise _scratchpad is cleared. On the FPLN page, CLR+LSK delete is triggered when _clearCommand = True AND the scratchpad contains the literal text " CLR" (three spaces + CLR, as sent by the external MCDU hardware). This matches the VB6 CLR key priority behaviour.

Scratchpad to external MCDU: After each render, SendScratchpad() sends the current scratchpad text to the external MCDU display via INET register 5339. Captain uses sub-address prefix "02257", FO uses "02356". A clear command (prefix & "a") is sent first, then the content. This matches VB6 PageHandle.cls SendScratchpad.

McduCommandParser Format

McduCommandParser.ParseAndRender (in McduCommandParser.vb) interprets a sequence of VB6-format command strings and writes the result into an Arinc429ScreenBuffer. Format ported from VB6 PageHandle.cls WriteScreenArinc429MCDU.

Control commands: : LISTCLEAR — Clears the entire buffer and resets parser state to White + Large font. Must be the first entry in every render list. : LISTCOMPLETE — No-op end-of-list marker. Parsing stops after this entry.

Line content format: "LLBODY" : LL = two-digit 1-based line number (01–13). Line 14 (scratchpad area) is handled separately. : BODY = sequence of inline tokens:

Token Effect
\|CC Set 1-based column position (CC is two-digit decimal). Internally converted to 0-based.
@s Switch to Small font (McduFont.Small)
@l Switch to Large font (McduFont.Large)
~w Switch to White color
~b Switch to Cyan color
~g Switch to Green color
~y Switch to Yellow color
~r Switch to Red color
~a Switch to Amber color
~m Switch to Magenta color
Any other char Write character byte via Arinc429SpecialChars.MapSpecialChar; advance column

Color and font state persists across entries within a single ParseAndRender call but resets to White + Large on LISTCLEAR.

Screen Buffer Output

Each McduActor owns one Arinc429ScreenBuffer instance exclusively — the buffer is never shared between actors. The buffer holds 13 lines × 24 columns = 312 positions, with parallel _charBuffer and _ctrlBuffer byte arrays. Each control byte encodes both font and color: CByte(CType(font, Byte) Or CType(color, Byte)).

After McduCommandParser.ParseAndRender writes the page content, two parallel output paths are prepared:

  1. _screenBuffer.BuildDifferentialMessage(isCaptain) — computes an XOR diff against the previous transmission for ARINC 429 binary output.
  2. _screenBuffer.LastCommands — the raw VB6-format command list cached by ParseAndRender. These are the same strings the IPage produced (e.g. {"LISTCLEAR", "01|08INIT A", ..., "LISTCOMPLETE"}) — no binary-to-text reconstruction needed, the commands are the lstMCDU data. ParseAndRender automatically appends LISTCOMPLETE if the page omitted it.
  3. Both are wrapped in a SendScreenBuffer(isCaptain, bytes, lstMcduLines) message and Told to INetActor.

INetActor.HandleSendScreenBuffer then sends via two paths:

Path 1 — ARINC 429 binary (hardware MCDUs): : Passes the differential byte array to Arinc429UdpSender, which transmits via UDP broadcast to port 65520 (register 7100 equivalent).

Path 2 — INET register 5339 text (software MCDU display): : Joins the lstMCDU lines with Chr(26) as delimiter and sends via INetClient1.DataTX 5339, 0, prefix & payload. Captain uses sub-address prefix "02631", FO uses "02632". A heartbeat follows on sub-address "02637" (CPT) / "02638" (FO) with format "HEARTBEAT" & counter.ToString("D3") & Chr(26). Counter ranges 1–254, wrapping past 0. This matches the VB6 WritelstMCDUCPT / WritelstMCDUFO pattern in PageHandle.cls.

The complete ARINC 429 buffer pipeline is detailed in ARINC 429 Screen Buffer Pipeline.

Source Files

  • A320_FMGC/Mcdu/McduActor.vb — register constants, HandleKeystroke, CLR key handler, RenderActivePage, SendKeystrokeAck
  • A320_FMGC/Mcdu/McduCommandParser.vbParseAndRender, token format, color/font state machine
  • A320_FMGC/Mcdu/IPage.vb — page interface contract (HandleLsk, Render)
  • A320_FMGC/Mcdu/McduContext.vb — shared state snapshot passed to each page (includes procedure scroll indices: SidTopIndex, SidTransTopIndex, StarTopIndex, StarTransTopIndex, ViaTopIndex, AdepRwyTopIndex, AdesRwyTopIndex; runway caches: AdepRunways, AdesRunways; ILS lists: AdepIlsList, AdesIlsList; ComputedFlightPlan — merged nav+trajectory prediction structure iterated directly by the F-PLN page for UTC, SPD/ALT, EFOB, T WIND, and BRG/DIST columns; TmpyComputedFlightPlan — the TMPY ComputedFlightPlan with VNAV markers, used by McduFplnLegBuilder instead of raw TmpyFlightPlan when available; MagneticVariationDeg — magnetic variation from KernelActor register 1705, used by F-PLN page for TRK label conversion from true to magnetic track)
  • A320_FMGC/Inet/Arinc429ScreenBuffer.vb — 13×24 buffer, dirty range, BuildDifferentialMessage
  • A320_FMGC/Inet/Arinc429UdpSender.vb — UDP socket, register 7100 transmission
  • A320_FMGC/Inet/INetActor.vb — EventStream bridge, SendScreenBuffer handler