Skip to content

File NodeStatus.h

FileList > Firmware > Libraries > NodeStatus > NodeStatus.h

Go to the source code of this file

Neutral node-status contract for every OpenSkyhawk node (PanelGroup ,PanelBridge , PDU).More...

  • #include <stdint.h>

Namespaces

Type Name
namespace OpenSkyhawk
Thin wrapper over Adafruit_ADS1115; see ADS1115.h .

Classes

Type Name
class FaultSource
A source of node faults — implemented by any object that can fault (#163).

Public Types

Type Name
enum uint8_t HeartbeatFlag
HB_n flags bits — CAN controller error state (maps to HeartbeatPayload.flags).
enum uint8_t NodeFaultCode
HEALTH_n faultId dictionary (#163) — cross-node fault codes.
enum uint8_t NodeHealthFlag
HEALTH_n flags bits — node-level health conditions (maps to NodeHealthPayload.flags).
enum uint8_t NodeKind
HEALTH_n nodeKind (byte 5) — what kind of board this node is (#344).
enum uint8_t NodeStatusField
_NODE_STATUS row field offsets, in bytes of the decoded row (hex index = 2 × offset).
enum uint8_t NodeTelemField
_NODE_TELEM row field offsets, in bytes of the decoded row (hex index = 2 × offset).
enum uint8_t PduRailField
PDU_RAIL_12V / PDU_RAIL_5V field offsets, in bytes of the 8-byte TELEM_n frame.
enum uint8_t PduRailFlag
PDU_RAIL_* page byte 1 — per-rail condition bits (all zero = healthy).
enum uint8_t PduStatusField
PDU_STATUS field offsets, in bytes of the 8-byte TELEM_n frame.
enum uint8_t PduStatusFlag
PDU_STATUS page byte 1 — board condition bits (all zero = healthy, calibrated).
enum uint8_t TelemPage
TELEM_n page ids (#216) — byte 0 of TelemPayload, naming the layout of bytes 1-7.

Public Attributes

Type Name
constexpr int8_t DIE_TEMP_UNAVAILABLE = -128
HEALTH_n dieTempC meaning "unavailable / not yet seen" (80 on the wire).
constexpr uint8_t GATEWAY_NODE_ID = 0
Node ID of the Gateway board's PanelBridge MCU — the CAN master.
constexpr uint8_t HB_ESR_REC_SHIFT = 8
HB_n esr field: bit position of the receive error counter (REC, high byte).
constexpr uint8_t HB_ESR_TEC_SHIFT = 0
HB_n esr field: bit position of the transmit error counter (TEC, low byte).
constexpr uint8_t NODE_BOOT_STATE_APP = 0x00
BOOT_STATE values (#365): the app is running; any other value is the bootloader's BootState.
constexpr uint8_t NODE_BOOT_STATE_UPDATING = 0x80
constexpr uint16_t NODE_BOOT_UPDATING_MS = 3000
constexpr uint8_t NODE_STATUS_ROW_BYTES = 19
constexpr uint8_t NODE_TELEM_ROW_BYTES = 9
_NODE_TELEM row length in bytes, sent as twice as many hex chars (9 → 18 hex).
constexpr int16_t NTC_TEMP_UNAVAILABLE = -32768
PDU_STATUS ntcTempDC meaning "unavailable" — no reading yet, or the NTC is open/shorted.

Macros

Type Name
define NODE_FORGET_REQ_ADDR 0xFF04
define NODE_STATUS_END_MSG_NAME "\_NODE\_STATUS\_END"
define NODE_STATUS_MSG_NAME "\_NODE\_STATUS"
define NODE_STATUS_PROTO_VERSION 4
define NODE_STATUS_REQ_ADDR 0xFF00
define NODE_TELEM_MSG_NAME "\_NODE\_TELEM"
define NODE_TELEM_PROTO_VERSION 1

Detailed Description

Owns the cross-node status API — not just health: * the _NODE_STATUS DCS-BIOS host-reporting contract (proto version, request address, message names, GATEWAY_NODE_ID, row layout NodeStatusField) — the canonical source the client's sync-a4ec.ts parses; * HeartbeatFlag + the HB_ESR_* split (HB_n flags / esr fields); * NodeHealthFlag (HEALTH_n flag bits), DIE_TEMP_UNAVAILABLE, and NodeFaultCode (the compact wire faultId dictionary the client maps to labels); * NodeKind (HEALTH_n board-kind byte — what board a NODE_ID is, announced by its firmware); * the _NODE_TELEM host contract and the TELEM_n page vocabulary (TelemPage, PduRailFlag, PduStatusFlag, the per-page field offsets, NTC_TEMP_UNAVAILABLE) — #216;

Every wire value is a named enum class X : T { NAME = literal } or constexpr T NAME = literal so the client sync can read it (#346) — never only a comment, a bare literal or a format string. * FaultSource — the interface a fault-producing object implements so a node-level aggregator can roll it up. A FaultSource is one piece of node status, not the whole story.

This is the neutral home for node-status vocabulary so it isn't shaped around any one node flavour (PanelGroup/OutputBase) or the HID namespace. NodeHealthPayload (the CAN HEALTH_n frame struct) stays in CANProtocol.h; the fault detail strings stay local (DiagSerial), never on the wire. Header-only contract + a tiny FaultSource registry (NodeStatus.cpp).

Copyright:

GPL-2.0-only — see Firmware/LICENSE

Public Types Documentation

enum HeartbeatFlag

HB_n flags bits — CAN controller error state (maps to HeartbeatPayload.flags).

enum HeartbeatFlag {
    BOFF = 0x01,
    EPVF = 0x02
};


enum NodeFaultCode

HEALTH_n faultId dictionary (#163) — cross-node fault codes.

enum NodeFaultCode {
    NONE = 0x00,
    I2C_PERIPHERAL = 0x01,
    OVER_VOLTAGE = 0x02,
    UNDER_VOLTAGE = 0x03,
    SHORT_CIRCUIT = 0x04,
    HOST_LINK_LOST = 0x05,
    FUSE_OPEN = 0x06,
    OVER_TEMPERATURE = 0x07,
    SENSOR_FAULT = 0x08,
    DUPLICATE_NODE_ID = 0x09
};

Coarse, one active at a time on the wire; the exact device is logged locally on DiagSerial, not the frame. The client maps id → human label (SkyHawkClient#40). Each node type contributes the codes relevant to its fault sources; append as new sources appear.


enum NodeHealthFlag

HEALTH_n flags bits — node-level health conditions (maps to NodeHealthPayload.flags).

enum NodeHealthFlag {
    OVERHEAT = 0x01,
    DEGRADED = 0x02
};


enum NodeKind

HEALTH_n nodeKind (byte 5) — what kind of board this node is (#344).

enum NodeKind {
    UNKNOWN = 0x00,
    PANEL_GROUP = 0x01,
    PDU = 0x02,
    BRIDGE = 0x03
};

Announced by the board's own firmware role (each node library passes its kind to CANProtocol::serviceNodeStatus()), never derived from the NODE_ID — a PDU can take any ID. Append-only. 0x00 is what firmware older than #344 sends (the byte was reserved), so the client reads it as "unknown" and never adopts on it.


enum NodeStatusField

_NODE_STATUS row field offsets, in bytes of the decoded row (hex index = 2 × offset).

enum NodeStatusField {
    ID = 0,
    PRESENT = 1,
    HB_FLAGS = 2,
    UPTIME = 3,
    RX_COUNT = 5,
    ESR = 7,
    DIE_TEMP_C = 9,
    HEALTH_FLAGS = 10,
    FAULT_MASK = 11,
    FAULT_ID = 12,
    NODE_KIND = 13,
    FW_MAJOR = 14,
    FW_MINOR = 15,
    FW_PATCH = 16,
    BOOTLOADER = 17,
    BOOT_STATE = 18
};

Each field is its numeric value as fixed-width uppercase hex, most-significant byte first, so the u16 fields read big-endian here although they are little-endian on CAN. A field runs to the next offset; the last runs to NODE_STATUS_ROW_BYTES. The first six come from the node's HB_n (plus present), the next five from its HEALTH_n, the next three from its READY_n (v4, #295), the last two its bootloader state (#365). Fields are only ever appended: a reader parses the fields it knows from a longer row and ignores the rest. (Not NODE_ID: every node build defines that as a macro.)


enum NodeTelemField

_NODE_TELEM row field offsets, in bytes of the decoded row (hex index = 2 × offset).

enum NodeTelemField {
    ID = 0,
    FRAME = 1
};


enum PduRailField

PDU_RAIL_12V / PDU_RAIL_5V field offsets, in bytes of the 8-byte TELEM_n frame.

enum PduRailField {
    FLAGS = 1,
    V_AVG_MV = 2,
    V_MIN_MV = 4,
    I_AVG_MA = 6
};

Byte 0 is the TelemPage; a field runs to the next offset, the last to byte 7. Little-endian.


enum PduRailFlag

PDU_RAIL_* page byte 1 — per-rail condition bits (all zero = healthy).

enum PduRailFlag {
    UNDER_V = 0x01,
    OVER_V = 0x02,
    OVER_CURRENT = 0x04,
    FUSE_OPEN = 0x08,
    SENSOR_FAULT = 0x10
};


enum PduStatusField

PDU_STATUS field offsets, in bytes of the 8-byte TELEM_n frame.

enum PduStatusField {
    FLAGS = 1,
    NTC_TEMP_DC = 2,
    I12_PEAK_MA = 4,
    I5_PEAK_MA = 6
};

Byte 0 is the TelemPage; a field runs to the next offset, the last to byte 7. Little-endian.


enum PduStatusFlag

PDU_STATUS page byte 1 — board condition bits (all zero = healthy, calibrated).

enum PduStatusFlag {
    UNCAL_VDDA = 0x01,
    UNCAL_ZERO = 0x02,
    TEMP_WARN = 0x04,
    TEMP_CRIT = 0x08,
    NTC_FAULT = 0x10
};


enum TelemPage

TELEM_n page ids (#216) — byte 0 of TelemPayload, naming the layout of bytes 1-7.

enum TelemPage {
    INVALID = 0x00,
    PDU_RAIL_12V = 0x01,
    PDU_RAIL_5V = 0x02,
    PDU_STATUS = 0x03
};

Global and append-only: a page id means the same layout whichever node sends it, so the client decodes by page, not by node type. 0x00 is invalid. Each page's layout is its field-offset enum below (PDU_RAIL_* → PduRailField, PDU_STATUS → PduStatusField); multi-byte fields little-endian.


Public Attributes Documentation

variable DIE_TEMP_UNAVAILABLE

HEALTH_n dieTempC meaning "unavailable / not yet seen" (80 on the wire).

constexpr int8_t DIE_TEMP_UNAVAILABLE;

Sent when the die sensor can't be read, and cached by PanelBridge for a node whose first HEALTH_n hasn't arrived. Written as a literal so the client sync can read it; equal to INT8_MIN.


variable GATEWAY_NODE_ID

Node ID of the Gateway board's PanelBridge MCU — the CAN master.

constexpr uint8_t GATEWAY_NODE_ID;

It sends HB_0 / HEALTH_0, and its own row leads every _NODE_STATUS roster reply (#344). CAN nodes take 1–63 (Firmware/NODE_IDS.md).


variable HB_ESR_REC_SHIFT

HB_n esr field: bit position of the receive error counter (REC, high byte).

constexpr uint8_t HB_ESR_REC_SHIFT;


variable HB_ESR_TEC_SHIFT

HB_n esr field: bit position of the transmit error counter (TEC, low byte).

constexpr uint8_t HB_ESR_TEC_SHIFT;


variable NODE_BOOT_STATE_APP

BOOT_STATE values (#365): the app is running; any other value is the bootloader's BootState.

constexpr uint8_t NODE_BOOT_STATE_APP;


variable NODE_BOOT_STATE_UPDATING

constexpr uint8_t NODE_BOOT_STATE_UPDATING;

BOOT_STATE bit: update traffic for this node in the last NODE_BOOT_UPDATING_MS. A board in its bootloader without it is waiting — "stuck" when its state is APP_INVALID or APP_UNSTABLE.


variable NODE_BOOT_UPDATING_MS

constexpr uint16_t NODE_BOOT_UPDATING_MS;

variable NODE_STATUS_ROW_BYTES

constexpr uint8_t NODE_STATUS_ROW_BYTES;

_NODE_STATUS row length in bytes, sent as twice as many hex chars (proto v4: 19 → 38 hex; the two bootloader fields joined v4 before it shipped, #365).


variable NODE_TELEM_ROW_BYTES

_NODE_TELEM row length in bytes, sent as twice as many hex chars (9 → 18 hex).

constexpr uint8_t NODE_TELEM_ROW_BYTES;


variable NTC_TEMP_UNAVAILABLE

PDU_STATUS ntcTempDC meaning "unavailable" — no reading yet, or the NTC is open/shorted.

constexpr int16_t NTC_TEMP_UNAVAILABLE;

0x8000 on the wire. Written as a literal so the client sync can read it; equal to INT16_MIN.


Macro Definition Documentation

define NODE_FORGET_REQ_ADDR

#define NODE_FORGET_REQ_ADDR `0xFF04`

define NODE_STATUS_END_MSG_NAME

#define NODE_STATUS_END_MSG_NAME `"_NODE_STATUS_END"`

define NODE_STATUS_MSG_NAME

#define NODE_STATUS_MSG_NAME `"_NODE_STATUS"`

define NODE_STATUS_PROTO_VERSION

#define NODE_STATUS_PROTO_VERSION `4`

define NODE_STATUS_REQ_ADDR

#define NODE_STATUS_REQ_ADDR `0xFF00`

define NODE_TELEM_MSG_NAME

#define NODE_TELEM_MSG_NAME `"_NODE_TELEM"`

define NODE_TELEM_PROTO_VERSION

#define NODE_TELEM_PROTO_VERSION `1`


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