Skip to content

Namespace OpenSkyhawk

Namespace List > OpenSkyhawk

Thin wrapper over Adafruit_ADS1115; see ADS1115.h .

Namespaces

Type Name
namespace Boot
namespace FirmwareImage
namespace Pdu

Classes

Type Name
struct AccelPoint
One point on the acceleration curve (SwitecX25 form).
class ActionButton
Momentary push button driving a control that latches in the sim. Self-registers into PanelGroup 'sInputBase list.
struct AnalogConfig
Tuning for an AnalogInput . Every field has a default, so a sketch sets only what differs, by name:{ .hysteresis = 32, .ewmaShift = 4, .pollMs = 2 } (#295).
class AnalogInput
Continuous analog input — one analog PinRef , normalised to a 16-bit value 0..65535. Emits the smoothed value over CAN (MULTIPOS transport). Self-registers intoPanelGroup 'sInputBase list.
class AnalogMultiPos
Resistor-ladder multi-position selector — one analog PinRef , a different voltage per position. Emits the resolved position index 0..N-1 over CAN (MULTIPOS dispatch).
class AnalogOutput
Abstract base for outputs driven by one 16-bit DCS-BIOS value (FirmwarePlan D16).
struct AngleConfig
Tuning for an AngleSensorInput — theAnalogConfig fields that still mean something once the raw window comes from the centre and travel (#295). Set by name:{ .hysteresis = 512 } . Fields are only ever appended, each with a default.
class AngleSensorInput
Magnetic angle sensor (AS5600 / MT6701) as an absolute knob or axis.
struct AxisCal
Captured endpoints for one axis, unsigned 0–65535 throughout.
class BoardThermal
struct CalBlob
The whole persisted calibration set, written and erased as one unit.
class Dimmer
PWM dimmer output — the DcsBios::Dimmer equivalent. Maps a 16-bit DCS-BIOS value to PWM duty on a direct GPIO timer pin.
class DrumDisplay
Rolling-drum OLED readout. One instance == one OLED panel.
struct DrumFlag
Optional 2-state (or N-state) flag tape — hemisphere N/S · E/W, or a mode letter.
struct DrumGlyph
A fixed (non-rolling) glyph painted between digit columns — '.', ' ', ':' etc.
struct DrumReadout
Complete description of one rolling readout: its sources, geometry, glyphs, flag.
struct DrumSource
One DCS-BIOS digit source feeding a DrumReadout .
class FaultSource
A source of node faults — implemented by any object that can fault (#163).
struct GaugeCal
Value → position calibration for one gauge.
class HIDAxis
HID axis handler. Declared at sketch scope for each joystick axis.
class HIDButton
HID button handler. Declared at sketch scope for each button.
class HIDHatSwitch
HID hat switch handler. Declared at sketch scope for each hat switch.
struct HomeSensor
Home-sensor parameters ( HomeMode::SENSOR only).
class I2cHealth
Per-device I2C circuit breaker. Mix into any class that talks to an I2C device.
class I2cMux
Selects one downstream channel of a TCA9548A I2C multiplexer.
class InputBase
Abstract base for all hardware-polled input objects.
class IntegerOutput
Callback output — the DcsBios::IntegerBuffer equivalent, for outputs no built-in class covers (a custom display, an LCD, a bespoke actuator).
class LED
Digital LED output. Drives a pin based on a DCS-BIOS state value.
struct LinkRecovery
Ladder state. Zero-initialised = healthy, no backoff.
class MotorDriver
Common interface every motor/servo backend implements.
class MultiPosInput
Base for the MULTIPOS input family — selectors that emit an absolute position index 0..N-1 over CAN. Self-registers into PanelGroup 'sInputBase list.
class NeedleGauge
DCS-driven pointer gauge over any MotorDriver backend.
class OutputBase
Abstract base for all DCS-driven output objects.
class RailMonitor
class RotaryAcceleratedEncoder
RotaryEncoder plus the two behaviours ofDcsBios::RotaryAcceleratedEncoder , both on by construction. Header-only: the logic lives in theRotaryEncoder family base.
class RotaryEncoder
Incremental quadrature encoder on two pins (A/B). Emits a signed relative value per detent over CAN — direction in the sign, magnitude set by the mode. Self-registers intoPanelGroup 'sInputBase list.
class ShiftBus
One shared SPI shift-register bus ('165 inputs + '595 outputs).
struct StepperConfig
Full per-instance stepper configuration. Authored per sketch (panel wiring).
class StepperMotor
Non-blocking instrument-gauge stepper driven through PinRef coils.
class Switch2Pos
Debounced 2-position switch. Self-registers into PanelGroup 'sInputBase list.
class Switch3Pos
Three-position switch (ON-OFF-ON / spring-centred) on two pins. Emits 0 / 1 / 2 over CAN (MULTIPOS dispatch).
class SwitchMultiPos
Multi-position rotary selector — N discrete pins, exactly one active at a time. Emits the active position index 0..N-1 over CAN (MULTIPOS dispatch).
class SwitchWithCover2Pos
Guarded switch — the DcsBios::SwitchWithCover2Pos equivalent. One physical switch pin drives two sim controls: the guard cover and the switch it protects.

Public Types

Type Name
enum uint8_t CalAckField
ACK payload (1 byte, device→client).
enum uint8_t CalCommitField
COMMIT payload (9 bytes, client→device) — exactly one axis.
enum uint8_t CalDataField
CAL_DATA payload (82 bytes, device→client): two bitmasks, then AXIS_CAL_SLOTS records.
enum uint8_t CalDataRecField
Field offsets within one CAL_DATA record (record i starts at CAL_DATA_RECORDS + i × 10).
enum uint8_t CalDiagField
enum uint8_t CalDiagResetReason
Why this boot happened, as reported in DIAG .
enum uint8_t CalHelloAckField
HELLO_ACK payload (6 bytes, device→client).
enum uint8_t CalNackField
NACK payload (3 bytes, device→client).
enum uint8_t CalNackReason
enum uint8_t CalRawField
RAW payload (5 bytes, device→client).
enum uint8_t CalResetField
RESET payload (1 byte, client→device).
enum uint8_t CalSessionAckField
SESSION_ACK payload (5 bytes, device→client).
enum uint8_t CalSessionOpenField
SESSION_OPEN payload (1 byte, client→device).
enum uint8_t CalStreamSelectField
STREAM_SELECT payload (1 byte, client→device).
enum uint8_t CalType
enum uint8_t DrumFont
Glyph font size. Maps to a fixed monospace ProFont face.
enum uint8_t DrumScroll
Scroll behaviour per readout.
enum uint8_t EncoderMode
Relative-dispatch mode — picks the DCS-BIOS interface the bridge drives, hence the CAN frame + payload encoding this encoder uses per detent. Scoped enum.
enum uint8_t EncoderStepsPerDetent
Quadrature transitions per mechanical detent (match to the encoder). Scoped enum.
enum uint8_t HomeMode
How the driver establishes its zero reference at boot.
enum uint8_t LeadingZero
Leading-zero handling for a readout's high-order digit cells.
enum uint8_t LinkAction
What the caller should do this tick.
enum uint8_t StepPattern
Coil energising sequence.
enum uint8_t UplBeginField
UPL_BEGIN (8 bytes, client→device).
enum uint8_t UplDataField
UPL_DATA (260 bytes, client→device).
enum uint8_t UplFlashField
UPL_FLASH (2 bytes, client→device).
enum uint8_t UplInfoAckField
UPL_INFO_ACK (16 bytes, device→client).
enum uint8_t UplPhase
Where a flash is (UPL_STATUS phase ).
enum uint8_t UplResult
How a flash ended (UPL_RESULT result , UPL_INFO_ACKlastResult ).
enum uint8_t UplResultField
UPL_RESULT (8 bytes, device→client).
enum uint8_t UplState
What the uploader is doing (UPL_INFO_ACK state ).
enum uint8_t UplStatusField
UPL_STATUS (8 bytes, device→client).

Public Attributes

Type Name
constexpr uint8_t AXIS_CAL_SLOTS = 8
HID report axis slots. Fixed by the report descriptor, not by how many a cockpit populates.
constexpr uint8_t CAL_AXIS_NONE = 0xFF
RESET and the axis-selection fields use this to mean "all" / "none".
constexpr uint8_t CAL_DATA_REC_BYTES = 10
One CAL_DATA record's length in bytes.
constexpr uint8_t CAL_DIAG_BYTES = 64
DIAG payload length — 47 bytes in use, the rest reserved.
constexpr uint16_t CAL_ENVELOPE_BYTES = 10
magic 4 + type 1 + seq 1 + len 2 + crc 2
constexpr uint8_t CAL_FRAME_MAGIC = { 0xAA, 0x53, 0x4B, 0x43 }
constexpr uint32_t CAL_MAGIC = /* multi line expression */
Blob signature. Little-endian in flash, so a hexdump reads "OSKC".
constexpr uint16_t CAL_MAX_FRAME = [**CAL\_ENVELOPE\_BYTES**](namespaceOpenSkyhawk.md#variable-cal_envelope_bytes) + [**CAL\_MAX\_PAYLOAD**](namespaceOpenSkyhawk.md#variable-cal_max_payload)
constexpr uint16_t CAL_MAX_INBOUND_FRAME = [**CAL\_ENVELOPE\_BYTES**](namespaceOpenSkyhawk.md#variable-cal_envelope_bytes) + [**CAL\_MAX\_INBOUND\_PAYLOAD**](namespaceOpenSkyhawk.md#variable-cal_max_inbound_payload)
constexpr uint16_t CAL_MAX_INBOUND_PAYLOAD = 260
constexpr uint16_t CAL_MAX_PAYLOAD = 82
CAL_DATA, the largest payload the device sends.
constexpr uint8_t CAL_PROTO_VERSION = 1
constexpr uint16_t CAL_VERSION = 1
Blob layout version.
constexpr uint32_t LINK_BACKOFF_MS = 60000
after a recovery reboot: re-attach period
constexpr uint32_t LINK_BAD_MS = 5000
unhealthy this long → first re-attach
constexpr uint32_t LINK_REATTACH_GAP_MS = 100
detached this long before attach
constexpr uint32_t LINK_REBOOT_AFTER_MS = 5000
re-attached, still unhealthy → reboot
constexpr uint16_t UPL_CHUNK_BYTES = 256
UPL_DATA's data field.
constexpr uint32_t UPL_MAX_IMAGE_BYTES = 124u \* 1024u
an app on a 128 KB STM32F103CB (4 KB bootloader)
constexpr uint8_t UPL_NODE_ID_KEEP = 0xFF
UPL_FLASH newNodeId : don't change it.
constexpr uint8_t UPL_PROTO_VERSION = 1
constexpr uint8_t UPL_RETRIES = 2
whole-flash retries after a transport failure
constexpr uint8_t UPL_TARGET_BRIDGE = 0x00
UPL_FLASH target .
constexpr uint8_t UPL_TARGET_UNCONFIGURED = 0xFE
the one bootloader on the bus with no NODE_ID yet
const AccelPoint kSwitecDefaultAccel = /* multi line expression */
Default SwitecX25 acceleration table; fits the X27/VID-29/BKA-30 air-core family.
constexpr uint8_t kSwitecDefaultAccelN = 5

Public Static Attributes

Type Name
constexpr uint16_t ACTION_TOGGLE = 0
Payload selector for the DCS-BIOS TOGGLE action argument.
constexpr uint16_t ANALOG_NC = [**MultiPosInput::NO\_POSITION**](classOpenSkyhawk_1_1MultiPosInput.md#variable-no_position)
posVals[] sentinel: a position with no physical detent (no distinct voltage).
const float EASE = 0.30f
const uint32_t FRAME_MS = 16
const uint8_t KIND_DIGIT = 0
const uint8_t KIND_FLAG = 2
const uint8_t KIND_GLYPH = 1
const float PX_PER_MM = 4.35f
const float SETTLE_EPS = 0.02f
const float SNAP_LANDING = 1.5f

Public Functions

Type Name
NodeFaultCode aggregateFaults (const char ** detailOut=nullptr)
Roll up the registered fault sources into a single node fault code (#163).
uint16_t axisCalApply (const AxisCal & cal, uint16_t raw)
Map a raw axis reading through the two-segment calibration.
bool axisCalValid (const AxisCal & cal)
True when both segments have a non-zero divisor, i.e. the axis is calibrated.
void calBlobClear (CalBlob & blob)
Zero a blob so every axis reads as uncalibrated.
uint16_t calBlobCrc (const CalBlob & blob)
CRC of a blob's covered region, i.e. everything before the crc field itself.
void calBlobSeal (CalBlob & blob)
Stamp magic, version, and a fresh CRC onto a blob ahead of persisting it.
bool calBlobValid (const CalBlob & blob)
True when a blob carries the right signature, version, and checksum.
uint16_t calBuildFrame (uint8_t * out, uint16_t outCap, uint8_t type, uint8_t seq, const uint8_t * payload, uint16_t len)
Build a complete frame into a caller-supplied buffer.
uint16_t calCrc16 (const uint8_t * data, size_t len)
CRC-16/CCITT-FALSE — poly 0x1021, init 0xFFFF, no reflection, no final XOR.
bool calFrameCrcOk (const uint8_t * frame, uint16_t n)
Verify the CRC of a complete, already-assembled frame.
bool calLenValidForType (uint8_t type, uint16_t len)
Is len the only length thistype may legally carry?
void linkRecoveryBegin (LinkRecovery & s, bool afterRecoveryReboot)
Reset the ladder.
LinkAction linkRecoveryStep (LinkRecovery & s, uint32_t now, bool healthy)
Advance the ladder one tick.
StepperConfig makeX27Config (int16_t homePosition, int16_t parkPosition, int16_t minPos, int16_t maxPos, HomeMode home=HomeMode::STALL)
Build a StepperConfig for an X27-family gauge from its travel.

Public Static Functions

Type Name
long pow10l (uint8_t n)

Public Types Documentation

enum CalAckField

ACK payload (1 byte, device→client).

enum OpenSkyhawk::CalAckField {
    CAL_ACK_TYPE = 0
};


enum CalCommitField

COMMIT payload (9 bytes, client→device) — exactly one axis.

enum OpenSkyhawk::CalCommitField {
    CAL_COMMIT_IDX = 0,
    CAL_COMMIT_MIN = 1,
    CAL_COMMIT_CENTRE = 3,
    CAL_COMMIT_MAX = 5,
    CAL_COMMIT_DEADZONE = 7
};


enum CalDataField

CAL_DATA payload (82 bytes, device→client): two bitmasks, then AXIS_CAL_SLOTS records.

enum OpenSkyhawk::CalDataField {
    CAL_DATA_PRESENT_MASK = 0,
    CAL_DATA_CALIBRATED_MASK = 1,
    CAL_DATA_RECORDS = 2
};


enum CalDataRecField

Field offsets within one CAL_DATA record (record i starts at CAL_DATA_RECORDS + i × 10).

enum OpenSkyhawk::CalDataRecField {
    CAL_DATA_REC_CONTROL_ID = 0,
    CAL_DATA_REC_MIN = 2,
    CAL_DATA_REC_CENTRE = 4,
    CAL_DATA_REC_MAX = 6,
    CAL_DATA_REC_DEADZONE = 8
};


enum CalDiagField

enum OpenSkyhawk::CalDiagField {
    CAL_DIAG_UPTIME_MS = 0,
    CAL_DIAG_FIRST_UART_ERR_MS = 4,
    CAL_DIAG_LAST_UART_ERR_MS = 8,
    CAL_DIAG_FIRST_USB_LOSS_MS = 12,
    CAL_DIAG_LAST_USB_LOSS_MS = 16,
    CAL_DIAG_UART_OVERRUN = 20,
    CAL_DIAG_UART_FRAMING = 22,
    CAL_DIAG_UART_BREAK = 24,
    CAL_DIAG_UART_PARITY = 26,
    CAL_DIAG_UART_RX_OVERFLOW = 28,
    CAL_DIAG_LINES_DROPPED = 30,
    CAL_DIAG_LINES_CORRUPT = 32,
    CAL_DIAG_LINES_OVERLONG = 34,
    CAL_DIAG_FRAMES_DROPPED = 36,
    CAL_DIAG_UART_RESTARTS = 38,
    CAL_DIAG_USB_REATTACHES = 40,
    CAL_DIAG_CDC_STALLS = 42,
    CAL_DIAG_RECOVERY_REBOOTS = 44,
    CAL_DIAG_WATCHDOG_RESETS = 45,
    CAL_DIAG_RESET_REASON = 46,
    CAL_DIAG_RESERVED = 47
};

DIAG payload (64 bytes, device→client): link-health counters and event times (#355).

Times are millis() since this boot; 0 means "never". Counters are u16 and saturate at 0xFFFF rather than wrap, so a large number never reads as a small one. The four UART error counters count status ticks on which that PL011 RSR bit was set — the core's UART IRQ owns the data register, so per-character counts are not available. The three u8 fields at the end survive a warm reboot (watchdog scratch registers) and reset on power-on.

Bytes 47–63 are reserved (#295): transmit 0, ignore on receive. A calibration frame's LEN is fixed per type, so DIAG can't grow in place — a new counter fills reserved bytes instead, a minor change that older clients simply don't read.


enum CalDiagResetReason

Why this boot happened, as reported in DIAG .

enum OpenSkyhawk::CalDiagResetReason {
    CAL_DIAG_RESET_POWER_ON = 0,
    CAL_DIAG_RESET_WATCHDOG = 1,
    CAL_DIAG_RESET_RECOVERY = 2
};


enum CalHelloAckField

HELLO_ACK payload (6 bytes, device→client).

enum OpenSkyhawk::CalHelloAckField {
    CAL_HELLO_ACK_PROTO = 0,
    CAL_HELLO_ACK_BLOB_VERSION = 1,
    CAL_HELLO_ACK_AXIS_SLOTS = 2,
    CAL_HELLO_ACK_FW_MAJOR = 3,
    CAL_HELLO_ACK_FW_MINOR = 4,
    CAL_HELLO_ACK_FW_PATCH = 5
};


enum CalNackField

NACK payload (3 bytes, device→client).

enum OpenSkyhawk::CalNackField {
    CAL_NACK_TYPE = 0,
    CAL_NACK_REASON = 1,
    CAL_NACK_DETAIL = 2
};


enum CalNackReason

enum OpenSkyhawk::CalNackReason {
    CAL_NACK_BAD_CRC = 0x01,
    CAL_NACK_BAD_LENGTH = 0x02,
    CAL_NACK_BAD_TYPE = 0x03,
    CAL_NACK_BAD_INDEX = 0x04,
    CAL_NACK_BAD_ORDER = 0x05,
    CAL_NACK_NO_SESSION = 0x06,
    CAL_NACK_NO_STORAGE = 0x07,
    CAL_NACK_BAD_DEADZONE = 0x08,
    CAL_NACK_BUSY = 0x09,
    CAL_NACK_TOO_LARGE = 0x0A,
    CAL_NACK_BAD_OFFSET = 0x0B,
    CAL_NACK_IMAGE_CRC = 0x0C,
    CAL_NACK_BAD_IMAGE = 0x0D,
    CAL_NACK_NOT_STAGED = 0x0E
};

NACK reasons. detail names the offending axis where one applies, else 0xFF. 0x09-0x0E are the firmware updater's (#366).


enum CalRawField

RAW payload (5 bytes, device→client).

enum OpenSkyhawk::CalRawField {
    CAL_RAW_IDX = 0,
    CAL_RAW_RAW = 1,
    CAL_RAW_CAL = 3
};


enum CalResetField

RESET payload (1 byte, client→device).

enum OpenSkyhawk::CalResetField {
    CAL_RESET_IDX = 0
};


enum CalSessionAckField

SESSION_ACK payload (5 bytes, device→client).

enum OpenSkyhawk::CalSessionAckField {
    CAL_SESSION_ACK_TIMEOUT_MS = 0,
    CAL_SESSION_ACK_AXIS_IDX = 4
};


enum CalSessionOpenField

SESSION_OPEN payload (1 byte, client→device).

enum OpenSkyhawk::CalSessionOpenField {
    CAL_SESSION_OPEN_AXIS_IDX = 0
};


enum CalStreamSelectField

STREAM_SELECT payload (1 byte, client→device).

enum OpenSkyhawk::CalStreamSelectField {
    CAL_STREAM_SELECT_AXIS_IDX = 0
};


enum CalType

enum OpenSkyhawk::CalType {
    CAL_T_HELLO = 0x01,
    CAL_T_GET_CAL = 0x02,
    CAL_T_SESSION_OPEN = 0x03,
    CAL_T_SESSION_CLOSE = 0x04,
    CAL_T_COMMIT = 0x05,
    CAL_T_RESET = 0x06,
    CAL_T_KEEPALIVE = 0x07,
    CAL_T_STREAM_SELECT = 0x08,
    CAL_T_GET_DIAG = 0x09,
    CAL_T_UPL_INFO = 0x10,
    CAL_T_UPL_BEGIN = 0x11,
    CAL_T_UPL_DATA = 0x12,
    CAL_T_UPL_END = 0x13,
    CAL_T_UPL_FLASH = 0x14,
    CAL_T_UPL_ABORT = 0x15,
    CAL_T_HELLO_ACK = 0x81,
    CAL_T_CAL_DATA = 0x82,
    CAL_T_SESSION_ACK = 0x83,
    CAL_T_ACK = 0x84,
    CAL_T_NACK = 0x85,
    CAL_T_RAW = 0x86,
    CAL_T_DIAG = 0x87,
    CAL_T_UPL_INFO_ACK = 0x90,
    CAL_T_UPL_STATUS = 0x91,
    CAL_T_UPL_RESULT = 0x92
};

Message types. High bit set = device→client, so direction is readable in a capture. 0x10-0x1F (client→device) and 0x90-0x9F (device→client) are the firmware updater's (#295, assigned from #366 — UploadProtocol.h holds their payloads); 0x16-0x1F / 0x93-0x9F still free.


enum DrumFont

Glyph font size. Maps to a fixed monospace ProFont face.

enum OpenSkyhawk::DrumFont {
    SMALL = 0,
    LARGE = 1
};

Note:

SMALL = u8g2_font_profont22_mr, LARGE = u8g2_font_profont29_mr (mono, ASCII). Mono guarantees the flag glyph ('N'/'S'/'E'/'W') is no wider than a digit cell.


enum DrumScroll

Scroll behaviour per readout.

enum OpenSkyhawk::DrumScroll {
    EASE_ONLY = 0,
    SNAP_SETTLE = 1
};

Note:

SNAP_SETTLE adds the prototype-missing jump handling: deltas above the readout's snapThreshold teleport the tape near the target, then ease the final step, so a sudden 130→250 KIAS change doesn't spin every wheel through 120 intermediate values.


enum EncoderMode

Relative-dispatch mode — picks the DCS-BIOS interface the bridge drives, hence the CAN frame + payload encoding this encoder uses per detent. Scoped enum.

enum OpenSkyhawk::EncoderMode {
    Rel,
    Dir
};


enum EncoderStepsPerDetent

Quadrature transitions per mechanical detent (match to the encoder). Scoped enum.

enum OpenSkyhawk::EncoderStepsPerDetent {
    One = 1,
    Two = 2,
    Four = 4,
    Eight = 8
};


enum HomeMode

How the driver establishes its zero reference at boot.

enum OpenSkyhawk::HomeMode {
    STALL,
    SENSOR
};


enum LeadingZero

Leading-zero handling for a readout's high-order digit cells.

enum OpenSkyhawk::LeadingZero {
    Keep = 0,
    Suppress = 1
};

Note:

Suppress blanks the high-order zero cells down to the target's significant-digit count (units always shows, so 0 renders "0"); animation is unchanged. Keep is fixed width.


enum LinkAction

What the caller should do this tick.

enum OpenSkyhawk::LinkAction {
    NONE,
    DETACH,
    ATTACH,
    REBOOT
};


enum StepPattern

Coil energising sequence.

enum OpenSkyhawk::StepPattern {
    SWITEC_6STATE,
    FULL_4STATE
};


enum UplBeginField

UPL_BEGIN (8 bytes, client→device).

enum OpenSkyhawk::UplBeginField {
    UPL_BEGIN_LENGTH = 0,
    UPL_BEGIN_CRC = 4
};


enum UplDataField

UPL_DATA (260 bytes, client→device).

enum OpenSkyhawk::UplDataField {
    UPL_DATA_OFFSET = 0,
    UPL_DATA_BYTES = 4
};


enum UplFlashField

UPL_FLASH (2 bytes, client→device).

enum OpenSkyhawk::UplFlashField {
    UPL_FLASH_TARGET = 0,
    UPL_FLASH_NEW_NODE_ID = 1
};


enum UplInfoAckField

UPL_INFO_ACK (16 bytes, device→client).

enum OpenSkyhawk::UplInfoAckField {
    UPL_INFO_ACK_PROTO = 0,
    UPL_INFO_ACK_MAX_IMAGE_KB = 1,
    UPL_INFO_ACK_CHUNK = 2,
    UPL_INFO_ACK_STATE = 4,
    UPL_INFO_ACK_LAST_TARGET = 5,
    UPL_INFO_ACK_LAST_RESULT = 6,
    UPL_INFO_ACK_LAST_MAJOR = 7,
    UPL_INFO_ACK_LAST_MINOR = 8,
    UPL_INFO_ACK_LAST_PATCH = 9,
    UPL_INFO_ACK_BRIDGE_MAJOR = 10,
    UPL_INFO_ACK_BRIDGE_MINOR = 11,
    UPL_INFO_ACK_BRIDGE_PATCH = 12,
    UPL_INFO_ACK_RESERVED = 13
};


enum UplPhase

Where a flash is (UPL_STATUS phase ).

enum OpenSkyhawk::UplPhase {
    UPL_PHASE_ENTERING_BOOT = 1,
    UPL_PHASE_CONNECTED = 2,
    UPL_PHASE_SETTING_ID = 3,
    UPL_PHASE_ERASING = 4,
    UPL_PHASE_WRITING = 5,
    UPL_PHASE_VERIFYING = 6,
    UPL_PHASE_REBOOTING = 7,
    UPL_PHASE_CONFIRMING = 8
};


enum UplResult

How a flash ended (UPL_RESULT result , UPL_INFO_ACKlastResult ).

enum OpenSkyhawk::UplResult {
    UPL_RESULT_NONE = 0x00,
    UPL_RESULT_OK = 0x01,
    UPL_RESULT_NO_RESPONSE = 0x02,
    UPL_RESULT_NO_BOOTLOADER = 0x03,
    UPL_RESULT_ID_MISMATCH = 0x04,
    UPL_RESULT_KIND_MISMATCH = 0x05,
    UPL_RESULT_TOO_BIG_FOR_BOARD = 0x06,
    UPL_RESULT_WRITE_FAILED = 0x07,
    UPL_RESULT_VERIFY_FAILED = 0x08,
    UPL_RESULT_VERSION_MISMATCH = 0x09,
    UPL_RESULT_TIMEOUT = 0x0A,
    UPL_RESULT_UNSUPPORTED = 0x0B
};


enum UplResultField

UPL_RESULT (8 bytes, device→client).

enum OpenSkyhawk::UplResultField {
    UPL_RESULT_RESULT = 0,
    UPL_RESULT_TARGET = 1,
    UPL_RESULT_MAJOR = 2,
    UPL_RESULT_MINOR = 3,
    UPL_RESULT_PATCH = 4,
    UPL_RESULT_ATTEMPTS = 5,
    UPL_RESULT_SECONDS = 6
};


enum UplState

What the uploader is doing (UPL_INFO_ACK state ).

enum OpenSkyhawk::UplState {
    UPL_STATE_IDLE = 0,
    UPL_STATE_STAGING = 1,
    UPL_STATE_STAGED = 2,
    UPL_STATE_FLASHING = 3
};


enum UplStatusField

UPL_STATUS (8 bytes, device→client).

enum OpenSkyhawk::UplStatusField {
    UPL_STATUS_PHASE = 0,
    UPL_STATUS_TARGET = 1,
    UPL_STATUS_ATTEMPT = 2,
    UPL_STATUS_BLOCK = 3,
    UPL_STATUS_BLOCKS = 5,
    UPL_STATUS_RESERVED = 7
};


Public Attributes Documentation

variable AXIS_CAL_SLOTS

HID report axis slots. Fixed by the report descriptor, not by how many a cockpit populates.

constexpr uint8_t OpenSkyhawk::AXIS_CAL_SLOTS;


variable CAL_AXIS_NONE

RESET and the axis-selection fields use this to mean "all" / "none".

constexpr uint8_t OpenSkyhawk::CAL_AXIS_NONE;


variable CAL_DATA_REC_BYTES

One CAL_DATA record's length in bytes.

constexpr uint8_t OpenSkyhawk::CAL_DATA_REC_BYTES;


variable CAL_DIAG_BYTES

DIAG payload length — 47 bytes in use, the rest reserved.

constexpr uint8_t OpenSkyhawk::CAL_DIAG_BYTES;


variable CAL_ENVELOPE_BYTES

magic 4 + type 1 + seq 1 + len 2 + crc 2

constexpr uint16_t OpenSkyhawk::CAL_ENVELOPE_BYTES;


variable CAL_FRAME_MAGIC

constexpr uint8_t OpenSkyhawk::CAL_FRAME_MAGIC[4];

Frame lead-in. 0xAA leads all non-DCS data on this link, matching the HID frame magic. Distinct from CAL_MAGIC above, which signs the stored blob rather than a wire frame.


variable CAL_MAGIC

Blob signature. Little-endian in flash, so a hexdump reads "OSKC".

constexpr uint32_t OpenSkyhawk::CAL_MAGIC;


variable CAL_MAX_FRAME

constexpr uint16_t OpenSkyhawk::CAL_MAX_FRAME;

variable CAL_MAX_INBOUND_FRAME

constexpr uint16_t OpenSkyhawk::CAL_MAX_INBOUND_FRAME;

variable CAL_MAX_INBOUND_PAYLOAD

constexpr uint16_t OpenSkyhawk::CAL_MAX_INBOUND_PAYLOAD;

UPL_DATA (#366), the largest payload the device receives — client → device only, so every device → client frame stays within CAL_MAX_FRAME.


variable CAL_MAX_PAYLOAD

CAL_DATA, the largest payload the device sends.

constexpr uint16_t OpenSkyhawk::CAL_MAX_PAYLOAD;


variable CAL_PROTO_VERSION

constexpr uint8_t OpenSkyhawk::CAL_PROTO_VERSION;

variable CAL_VERSION

Blob layout version.

constexpr uint16_t OpenSkyhawk::CAL_VERSION;

Note:

A mismatch means "absent" — every axis falls back to identity and flash is left untouched until the user commits. No migration and no auto-rewrite: a downgrade-then-upgrade cycle would silently destroy data.


after a recovery reboot: re-attach period

constexpr uint32_t OpenSkyhawk::LINK_BACKOFF_MS;


unhealthy this long → first re-attach

constexpr uint32_t OpenSkyhawk::LINK_BAD_MS;


detached this long before attach

constexpr uint32_t OpenSkyhawk::LINK_REATTACH_GAP_MS;


re-attached, still unhealthy → reboot

constexpr uint32_t OpenSkyhawk::LINK_REBOOT_AFTER_MS;


variable UPL_CHUNK_BYTES

UPL_DATA's data field.

constexpr uint16_t OpenSkyhawk::UPL_CHUNK_BYTES;


variable UPL_MAX_IMAGE_BYTES

an app on a 128 KB STM32F103CB (4 KB bootloader)

constexpr uint32_t OpenSkyhawk::UPL_MAX_IMAGE_BYTES;


variable UPL_NODE_ID_KEEP

UPL_FLASH newNodeId : don't change it.

constexpr uint8_t OpenSkyhawk::UPL_NODE_ID_KEEP;


variable UPL_PROTO_VERSION

constexpr uint8_t OpenSkyhawk::UPL_PROTO_VERSION;

variable UPL_RETRIES

whole-flash retries after a transport failure

constexpr uint8_t OpenSkyhawk::UPL_RETRIES;


variable UPL_TARGET_BRIDGE

UPL_FLASH target .

constexpr uint8_t OpenSkyhawk::UPL_TARGET_BRIDGE;

the Gateway's own PanelBridge, over USART2 (#367): the staged image, else the bundled one


variable UPL_TARGET_UNCONFIGURED

the one bootloader on the bus with no NODE_ID yet

constexpr uint8_t OpenSkyhawk::UPL_TARGET_UNCONFIGURED;


variable kSwitecDefaultAccel

Default SwitecX25 acceleration table; fits the X27/VID-29/BKA-30 air-core family.

const AccelPoint OpenSkyhawk::kSwitecDefaultAccel;


variable kSwitecDefaultAccelN

constexpr uint8_t OpenSkyhawk::kSwitecDefaultAccelN;

Public Static Attributes Documentation

variable ACTION_TOGGLE

Payload selector for the DCS-BIOS TOGGLE action argument.

constexpr uint16_t OpenSkyhawk::ACTION_TOGGLE;


variable ANALOG_NC

posVals[] sentinel: a position with no physical detent (no distinct voltage).

constexpr uint16_t OpenSkyhawk::ANALOG_NC;

The uint16_t analog of SwitchMultiPos's PIN_NC — same "this position index has no physical input" role, but a different sentinel because an analog ladder is an array of ADC values (uint16_t), not PinRefs. Kept == MultiPosInput::NO_POSITION (both 0xFFFF) so there is one sentinel value across the MULTIPOS family.


variable EASE

const float OpenSkyhawk::EASE;

variable FRAME_MS

const uint32_t OpenSkyhawk::FRAME_MS;

variable KIND_DIGIT

const uint8_t OpenSkyhawk::KIND_DIGIT;

variable KIND_FLAG

const uint8_t OpenSkyhawk::KIND_FLAG;

variable KIND_GLYPH

const uint8_t OpenSkyhawk::KIND_GLYPH;

variable PX_PER_MM

const float OpenSkyhawk::PX_PER_MM;

variable SETTLE_EPS

const float OpenSkyhawk::SETTLE_EPS;

variable SNAP_LANDING

const float OpenSkyhawk::SNAP_LANDING;

Public Functions Documentation

function aggregateFaults

Roll up the registered fault sources into a single node fault code (#163).

NodeFaultCode OpenSkyhawk::aggregateFaults (
    const char ** detailOut=nullptr
) 

Walks FaultSource::head() and returns the first source reporting a non-NONE faultCode(); if detailOut is non-null it is set to that source's faultDetail(). Returns NodeFaultCode::NONE when every source is healthy. *detailOut is always a non-null string ("" when healthy or a source returns null) — callers never null-check.

Note:

Iteration is registry order = reverse construction order (the intrusive list pushes at head), so the last-constructed fault source has priority. With one active fault at a time on the wire this rarely matters; a node with concurrent faults reports the head-most.

Note:

Cheap/const — sources report cached state only. Called on the periodic health path.

Parameters:

  • detailOut Optional out-param for the local DiagSerial detail string (never null on return).

Returns:

The primary NodeFaultCode, or NONE if no source is faulted.


function axisCalApply

Map a raw axis reading through the two-segment calibration.

uint16_t OpenSkyhawk::axisCalApply (
    const AxisCal & cal,
    uint16_t raw
) 

Parameters:

  • cal Endpoints for this axis.
  • raw Unsigned 0–65535 as emitted by the node.

Returns:

Unsigned 0–65535, with cal.centre landing exactly on 32768.

Returns raw unchanged when the axis is uncalibrated, so an unwritten blob behaves identically to a build without this feature.

Note:

Integer only, by design — the arithmetic must be reproducible exactly, and a curve would stack with the per-aircraft curves DCS already applies.

Note:

The uint32_t cast must sit on the multiply operand. Worst case is 65534 × 32768 = 2 147 418 112, inside uint32_t with 2× headroom. int is 32-bit on RP2040 so the wrong form would work here by accident; the explicit cast is the portable contract.

Note:

65535 is reachable only via the upper clamp — the upper segment's arithmetic tops out at 65534. Both map to +32767 after the caller's −32768, so this is correct, but it is the kind of asymmetry someone will otherwise "fix".


function axisCalValid

True when both segments have a non-zero divisor, i.e. the axis is calibrated.

bool OpenSkyhawk::axisCalValid (
    const AxisCal & cal
) 

Parameters:

  • cal Endpoints to check.

Returns:

true if min < centre < max allowing for the deadzone.

Note:

This doubles as the calibrated/uncalibrated predicate — there is no stored validity flag, because a flag could only duplicate or contradict this. An all-zero blob (.bss, never loaded) and an all-0xFF blob (erased flash) both fail it, so both fail closed to identity.

Note:

Widened to uint32_t deliberately. The obvious min < centre - deadzone underflows on uint16_t when deadzone > centre. The wire protocol rejects a non-zero deadzone, but this guard's whole job is preventing a divide-by-zero in axisCalApply(), so it must not depend on a check one layer up.


function calBlobClear

Zero a blob so every axis reads as uncalibrated.

void OpenSkyhawk::calBlobClear (
    CalBlob & blob
) 

Parameters:

  • blob Blob to clear.

Note:

Clears RAM only. Nothing here writes flash.


function calBlobCrc

CRC of a blob's covered region, i.e. everything before the crc field itself.

uint16_t OpenSkyhawk::calBlobCrc (
    const CalBlob & blob
) 

Parameters:

  • blob Blob to checksum.

Returns:

The CRC to store in, or compare against, blob.crc.


function calBlobSeal

Stamp magic, version, and a fresh CRC onto a blob ahead of persisting it.

void OpenSkyhawk::calBlobSeal (
    CalBlob & blob
) 

Parameters:

  • blob Blob whose axes are already populated.

function calBlobValid

True when a blob carries the right signature, version, and checksum.

bool OpenSkyhawk::calBlobValid (
    const CalBlob & blob
) 

Parameters:

  • blob Blob as read from storage.

Returns:

true if the blob should be trusted.


function calBuildFrame

Build a complete frame into a caller-supplied buffer.

uint16_t OpenSkyhawk::calBuildFrame (
    uint8_t * out,
    uint16_t outCap,
    uint8_t type,
    uint8_t seq,
    const uint8_t * payload,
    uint16_t len
) 

Parameters:

  • out Destination, at least CAL_ENVELOPE_BYTES + len bytes.
  • outCap Capacity of out.
  • type Message type.
  • seq Sequence byte — echoed from the request, or a counter for unsolicited RAW.
  • payload Payload bytes; may be nullptr when len is 0.
  • len Payload length. Must satisfy calLenValidForType().

Returns:

Bytes written, or 0 if the arguments are inconsistent or out is too small.


function calCrc16

CRC-16/CCITT-FALSE — poly 0x1021, init 0xFFFF, no reflection, no final XOR.

uint16_t OpenSkyhawk::calCrc16 (
    const uint8_t * data,
    size_t len
) 

Parameters:

  • data Bytes to cover.
  • len Byte count.

Returns:

The CRC.

Note:

Canonical check: "123456789" → 0x29B1. Init is 0xFFFF rather than 0x0000 so that leading zero bytes change the result — an all-zero blob is a realistic corruption mode, and a 0x0000 init would not distinguish it from a shorter all-zero one. Bitwise and table-free: ~70 bytes of input costs a few microseconds, irrelevant beside the ~45 ms sector erase it protects.


function calFrameCrcOk

Verify the CRC of a complete, already-assembled frame.

bool OpenSkyhawk::calFrameCrcOk (
    const uint8_t * frame,
    uint16_t n
) 

Parameters:

  • frame Whole frame including magic and trailing CRC.
  • n Frame length in bytes.

Returns:

true if the trailing CRC matches the computed one.

Note:

Coverage is TYPE‖SEQ‖LEN‖PAYLOAD — the magic is excluded, and so is the CRC field itself. Checksumming constant bytes adds no detection power.


function calLenValidForType

Is len the only length thistype may legally carry?

bool OpenSkyhawk::calLenValidForType (
    uint8_t type,
    uint16_t len
) 

Parameters:

  • type Message type byte.
  • len Candidate payload length, as read off the wire.

Returns:

true if the pair is legal.

This is the framing-layer gate, and it is checked before the payload is buffered. len is read before the CRC can be verified, so on a false frame it is noise: a stray magic in DCS-BIOS text can decode a length near 65535, and a receiver that waits for that many bytes stalls. Every type therefore has an exact length rather than a shared bound.

Note:

There are no variable-length types. COMMIT carries exactly one axis, so the rule is uniform: one legal length per type, no exception to state or to get wrong. An earlier draft let COMMIT batch up to eight axes, which allowed a batch to name the same axis twice with different values and silently apply the last.

Note:

An unknown type is rejected. Protocol versions must match — HELLO_ACK carries proto for exactly that — so an unrecognised type is an error, not something to skip.


function linkRecoveryBegin

Reset the ladder.

void OpenSkyhawk::linkRecoveryBegin (
    LinkRecovery & s,
    bool afterRecoveryReboot
) 

Parameters:

  • s Ladder state.
  • afterRecoveryReboot True when this boot was caused by the ladder's own REBOOT. Puts the ladder straight into backoff, so it never reboots twice in a row.

function linkRecoveryStep

Advance the ladder one tick.

LinkAction OpenSkyhawk::linkRecoveryStep (
    LinkRecovery & s,
    uint32_t now,
    bool healthy
) 

Parameters:

  • s Ladder state.
  • now millis().
  • healthy The host link is usable: mounted, not suspended with a recent UART fault, and the CDC IN endpoint not stalled.

Returns:

The action to apply now. At most one per tick.

Note:

A DETACH is always followed by its ATTACH, whatever healthy says in between — a detached device is unmounted by definition, and a half-run ladder must never leave the pull-up off.


function makeX27Config

Build a StepperConfig for an X27-family gauge from its travel.

StepperConfig OpenSkyhawk::makeX27Config (
    int16_t homePosition,
    int16_t parkPosition,
    int16_t minPos,
    int16_t maxPos,
    HomeMode home=HomeMode::STALL
) 

Every other field keeps the StepperConfig default (1080 steps/rev, SWITEC_6STATE, the SwitecX25 accel table, 945-step stop-to-stop range, deadband 1, …). To change one of those, write the config by name instead: { .homePosition = 0, .maxPos = 960, .rangeSteps = 960 }.

Parameters:

  • homePosition step index at the home reference.
  • parkPosition rest position after homing.
  • minPos lower moveTo travel clamp (ignored if wrap).
  • maxPos upper moveTo travel clamp (ignored if wrap).
  • home homing strategy. Default STALL.

Returns:

Populated StepperConfig.


Public Static Functions Documentation

function pow10l

static long OpenSkyhawk::pow10l (
    uint8_t n
) 


The documentation for this class was generated from the following file Firmware/Libraries/BootProtocol/BootProtocol.h