From 85f07b534f43d4cbf03dc2caaebb58684f38d973 Mon Sep 17 00:00:00 2001 From: Jesus Altuve Date: Sat, 21 Mar 2026 13:28:43 -0400 Subject: [PATCH 1/2] WiFI DEBUG Ringbuffer set to 0 --- Config.h | 2 +- HID Manager/settings.ini | 2 +- label_creator/creator_prefs.json | 2 +- src/LABELS/LABEL_SET_IFEI/.last_run | 2 +- src/LABELS/LABEL_SET_WINGFOLD_TEST/.last_run | 1 + .../CT_Display.cpp.DISABLED | 58 ++ .../LABEL_SET_WINGFOLD_TEST/CT_Display.h | 23 + .../LABEL_SET_WINGFOLD_TEST/CoverGates.h | 10 + .../LABEL_SET_WINGFOLD_TEST/CustomPins.h | 122 +++++ .../DCSBIOSBridgeData.h | 251 +++++++++ .../DisplayMapping.cpp.DISABLED | 35 ++ .../LABEL_SET_WINGFOLD_TEST/DisplayMapping.h | 63 +++ .../LABEL_SET_WINGFOLD_TEST/InputMapping.h | 112 ++++ .../LABEL_SET_WINGFOLD_TEST/LEDMapping.h | 113 ++++ .../LABEL_SET_WINGFOLD_TEST/LabelSetConfig.h | 9 + .../LABEL_SET_WINGFOLD_TEST/LatchedButtons.h | 10 + .../METADATA/CommonData.json | 494 ++++++++++++++++++ .../METADATA/Custom.json | 3 + .../METADATA/MetadataEnd.json | 38 ++ .../METADATA/MetadataStart.json | 19 + .../LABEL_SET_WINGFOLD_TEST/aircraft.txt | 1 + .../LABEL_SET_WINGFOLD_TEST/display_gen.py | 12 + .../LABEL_SET_WINGFOLD_TEST/generate_data.py | 12 + src/LABELS/LABEL_SET_WINGFOLD_TEST/panels.txt | 81 +++ .../LABEL_SET_WINGFOLD_TEST/reset_data.py | 12 + .../selected_panels.txt | 89 ++++ 26 files changed, 1572 insertions(+), 4 deletions(-) create mode 100644 src/LABELS/LABEL_SET_WINGFOLD_TEST/.last_run create mode 100644 src/LABELS/LABEL_SET_WINGFOLD_TEST/CT_Display.cpp.DISABLED create mode 100644 src/LABELS/LABEL_SET_WINGFOLD_TEST/CT_Display.h create mode 100644 src/LABELS/LABEL_SET_WINGFOLD_TEST/CoverGates.h create mode 100644 src/LABELS/LABEL_SET_WINGFOLD_TEST/CustomPins.h create mode 100644 src/LABELS/LABEL_SET_WINGFOLD_TEST/DCSBIOSBridgeData.h create mode 100644 src/LABELS/LABEL_SET_WINGFOLD_TEST/DisplayMapping.cpp.DISABLED create mode 100644 src/LABELS/LABEL_SET_WINGFOLD_TEST/DisplayMapping.h create mode 100644 src/LABELS/LABEL_SET_WINGFOLD_TEST/InputMapping.h create mode 100644 src/LABELS/LABEL_SET_WINGFOLD_TEST/LEDMapping.h create mode 100644 src/LABELS/LABEL_SET_WINGFOLD_TEST/LabelSetConfig.h create mode 100644 src/LABELS/LABEL_SET_WINGFOLD_TEST/LatchedButtons.h create mode 100644 src/LABELS/LABEL_SET_WINGFOLD_TEST/METADATA/CommonData.json create mode 100644 src/LABELS/LABEL_SET_WINGFOLD_TEST/METADATA/Custom.json create mode 100644 src/LABELS/LABEL_SET_WINGFOLD_TEST/METADATA/MetadataEnd.json create mode 100644 src/LABELS/LABEL_SET_WINGFOLD_TEST/METADATA/MetadataStart.json create mode 100644 src/LABELS/LABEL_SET_WINGFOLD_TEST/aircraft.txt create mode 100644 src/LABELS/LABEL_SET_WINGFOLD_TEST/display_gen.py create mode 100644 src/LABELS/LABEL_SET_WINGFOLD_TEST/generate_data.py create mode 100644 src/LABELS/LABEL_SET_WINGFOLD_TEST/panels.txt create mode 100644 src/LABELS/LABEL_SET_WINGFOLD_TEST/reset_data.py create mode 100644 src/LABELS/LABEL_SET_WINGFOLD_TEST/selected_panels.txt diff --git a/Config.h b/Config.h index d8b30855..50649c79 100644 --- a/Config.h +++ b/Config.h @@ -151,7 +151,7 @@ #endif // WiFi Debug Ring Buffer -#define WIFI_DEBUG_USE_RINGBUFFER 1 // Should be use a ring buffer for WiFi Debug messages? helps when using WiFi DCS Mode. If WiFi is not used, this value is ignored anyway. Also, if using CDC + WiFi Debug, this is REQUIRED to avoid CDC stalls +#define WIFI_DEBUG_USE_RINGBUFFER 0 // Should be use a ring buffer for WiFi Debug messages? helps when using WiFi DCS Mode. If WiFi is not used, this value is ignored anyway. Also, if using CDC + WiFi Debug, this is REQUIRED to avoid CDC stalls #if WIFI_DEBUG_USE_RINGBUFFER #define WIFI_DBG_SEND_RINGBUF_SIZE 32 // How many slots in our buffer #define WIFI_DBG_MSG_MAXLEN 64 // Max size for each slot diff --git a/HID Manager/settings.ini b/HID Manager/settings.ini index 9a8e216e..1211064f 100644 --- a/HID Manager/settings.ini +++ b/HID Manager/settings.ini @@ -2,7 +2,7 @@ vid = 0xCAFE [DCS] -udp_source_ip = 192.168.7.77 +udp_source_ip = 192.168.7.166 [MAIN] console = 1 diff --git a/label_creator/creator_prefs.json b/label_creator/creator_prefs.json index f04e2e82..b006bfe1 100644 --- a/label_creator/creator_prefs.json +++ b/label_creator/creator_prefs.json @@ -1,5 +1,5 @@ { "last_template": "LABEL_SET_MAIN", "last_aircraft": "FA-18C_hornet", - "last_label_set": "LABEL_SET_IFEI" + "last_label_set": "LABEL_SET_WINGFOLD_TEST" } \ No newline at end of file diff --git a/src/LABELS/LABEL_SET_IFEI/.last_run b/src/LABELS/LABEL_SET_IFEI/.last_run index 573f8acf..50e0f71c 100644 --- a/src/LABELS/LABEL_SET_IFEI/.last_run +++ b/src/LABELS/LABEL_SET_IFEI/.last_run @@ -1 +1 @@ -2026-03-18T14:06:43.397880 \ No newline at end of file +2026-03-20T00:53:04.409085 \ No newline at end of file diff --git a/src/LABELS/LABEL_SET_WINGFOLD_TEST/.last_run b/src/LABELS/LABEL_SET_WINGFOLD_TEST/.last_run new file mode 100644 index 00000000..e4fc4b0f --- /dev/null +++ b/src/LABELS/LABEL_SET_WINGFOLD_TEST/.last_run @@ -0,0 +1 @@ +2026-03-19T17:52:21.450107 \ No newline at end of file diff --git a/src/LABELS/LABEL_SET_WINGFOLD_TEST/CT_Display.cpp.DISABLED b/src/LABELS/LABEL_SET_WINGFOLD_TEST/CT_Display.cpp.DISABLED new file mode 100644 index 00000000..063d3365 --- /dev/null +++ b/src/LABELS/LABEL_SET_WINGFOLD_TEST/CT_Display.cpp.DISABLED @@ -0,0 +1,58 @@ +#include "../../Globals.h" +#include "CT_Display.h" +#include "DisplayMapping.h" + + +DisplayBufferEntry CT_DisplayBuffers[] = { +}; +const size_t numCTDisplayBuffers = sizeof(CT_DisplayBuffers)/sizeof(CT_DisplayBuffers[0]); + +const DisplayBufferHashEntry CT_DisplayBufferHash[2] = { + {nullptr, nullptr}, + {nullptr, nullptr}, +}; + +const DisplayBufferEntry* findDisplayBufferByLabel(const char* label) { + uint16_t startH = labelHash(label) % 2; + for (uint16_t i = 0; i < 2; ++i) { + uint16_t idx = (startH + i >= 2) ? (startH + i - 2) : (startH + i); + const auto& entry = CT_DisplayBufferHash[idx]; + if (!entry.label) return nullptr; + if (strcmp(entry.label, label) == 0) return entry.entry; + } + return nullptr; +} + + + void renderField(const char* label, const char* strValue, + const DisplayFieldDefLabel* defOverride, + FieldState* stateOverride) { + const DisplayFieldDefLabel* def = defOverride ? defOverride : findFieldDefByLabel(label); + if (!def) return; + if (!def->renderFunc) { debugPrintf("[DISPLAY] No renderFunc for label '%s', skipping\n", def->label); return; } + + FieldState* state = stateOverride; + if (!state) { + int idx = def - fieldDefs; + state = &fieldStates[idx]; + } + + bool valid = true; + if (def->type == FIELD_NUMERIC) { + const int value = strToIntFast(strValue); + valid = (value >= def->minValue && value <= def->maxValue); + } + const char* toShow = valid ? strValue : state->lastValue; + + // bound compare/copy by field length, clamp to cache size + uint8_t need = def->numDigits ? def->numDigits : 1; + if (need > sizeof(state->lastValue)) need = sizeof(state->lastValue); + + if (memcmp(toShow, state->lastValue, need) == 0) return; + + memcpy(state->lastValue, toShow, need); + if (def->clearFunc) def->clearFunc(def->driver, def->segMap, *def); + def->renderFunc(def->driver, def->segMap, toShow, *def); + } + + \ No newline at end of file diff --git a/src/LABELS/LABEL_SET_WINGFOLD_TEST/CT_Display.h b/src/LABELS/LABEL_SET_WINGFOLD_TEST/CT_Display.h new file mode 100644 index 00000000..0ed8814c --- /dev/null +++ b/src/LABELS/LABEL_SET_WINGFOLD_TEST/CT_Display.h @@ -0,0 +1,23 @@ +// Auto-generated — DO NOT EDIT +#pragma once + +#include "../../../lib/CUtils/src/CUtils.h" + +// Buffers and dirty flags for all display fields (global) + +extern DisplayBufferEntry CT_DisplayBuffers[]; +extern const size_t numCTDisplayBuffers; +extern const DisplayBufferHashEntry CT_DisplayBufferHash[]; +const DisplayBufferEntry* findDisplayBufferByLabel(const char* label); + + + // --- Forward declarations for opaque driver pointer types --- + typedef void* DisplayDriverPtr; + + // --- Forward declaration for field def struct (real type in DisplayMapping.h) --- + struct DisplayFieldDefLabel; + struct FieldState; + + void renderField(const char* label, const char* value, const DisplayFieldDefLabel* defOverride = nullptr, FieldState* stateOverride = nullptr); + + \ No newline at end of file diff --git a/src/LABELS/LABEL_SET_WINGFOLD_TEST/CoverGates.h b/src/LABELS/LABEL_SET_WINGFOLD_TEST/CoverGates.h new file mode 100644 index 00000000..c132afac --- /dev/null +++ b/src/LABELS/LABEL_SET_WINGFOLD_TEST/CoverGates.h @@ -0,0 +1,10 @@ +// CoverGates.h -- Per-label-set cover gate configuration +// Defines selectors/buttons that are physically guarded by a cover. +// Edit via the Label Creator tool or manually. + +#pragma once + +static const CoverGateDef kCoverGates[] = { + // { "ACTION", "RELEASE_OR_nullptr", "COVER", CoverGateKind::Selector, delay_ms, close_delay_ms }, +}; +static const unsigned kCoverGateCount = sizeof(kCoverGates) / sizeof(kCoverGates[0]); diff --git a/src/LABELS/LABEL_SET_WINGFOLD_TEST/CustomPins.h b/src/LABELS/LABEL_SET_WINGFOLD_TEST/CustomPins.h new file mode 100644 index 00000000..e152d6df --- /dev/null +++ b/src/LABELS/LABEL_SET_WINGFOLD_TEST/CustomPins.h @@ -0,0 +1,122 @@ +// CustomPins.h - Label-set-specific pin definitions for CockpitOS +// +// This file is automatically included by LabelSetConfig.h if present. +// Uncomment and set ONLY the pins your hardware actually uses. +// The PIN(X) macro converts S2 pins to S3 equivalents automatically. +// +// ============================================================================ + +#pragma once + +// --- Feature Enables -------------------------------------------------------- +#define ENABLE_TFT_GAUGES 0 // 1 = Enable TFT gauge rendering (only if TFT displays are present) +#define ENABLE_PCA9555 0 // 1 = Enable PCA9555 I/O expander logic (only if PCA chips are present) + +// --- I2C Pins --------------------------------------------------------------- +// Used by PCA9555 expanders, OLED displays, or any I2C peripherals. +// #define SDA_PIN PIN(8) +// #define SCL_PIN PIN(9) + +// --- HC165 Shift Register --------------------------------------------------- +// For reading banks of physical switches via daisy-chained 74HC165 chips. +// HC165_BITS = total number of inputs across all chained chips (8 per chip). +// Set to 0 or leave commented to disable. +// #define HC165_BITS 16 +// #define HC165_CONTROLLER_PL PIN(39) // Latch (PL) +// #define HC165_CONTROLLER_CP PIN(38) // Clock (CP) +// #define HC165_CONTROLLER_QH PIN(40) // Data (QH) + +// --- WS2812B Addressable LED Strip ------------------------------------------ +// #define WS2812B_PIN PIN(35) + +// --- Mode Switch ------------------------------------------------------------ +// HID selector switch for mode control (e.g., rotary or toggle). +// #define MODE_SWITCH_PIN PIN(33) + +// --- TM1637 / HT16K33 7-Segment Displays ----------------------------------- +// Pairs of DIO + CLK pins for each 7-segment display module. +// #define LA_DIO_PIN PIN(39) // Left Angle display DIO +// #define LA_CLK_PIN PIN(37) // Left Angle display CLK +// #define RA_DIO_PIN PIN(40) // Right Angle display DIO +// #define RA_CLK_PIN PIN(37) // Right Angle display CLK +// #define CA_DIO_PIN PIN(36) // Caution Advisory display DIO +// #define CA_CLK_PIN PIN(37) // Caution Advisory display CLK +// #define JETT_DIO_PIN PIN(8) // Jettison Select display DIO +// #define JETT_CLK_PIN PIN(9) // Jettison Select display CLK + +// --- TFT Gauge Display Pins ------------------------------------------------ +// Each TFT gauge needs: CS, DC, MOSI, SCLK (required) + RST, MISO (optional). +// Use -1 for unused RST/MISO pins. +// +// Example (Cabin Pressure gauge): +// #define CABIN_PRESSURE_CS_PIN PIN(36) +// #define CABIN_PRESSURE_DC_PIN PIN(18) +// #define CABIN_PRESSURE_MOSI_PIN PIN(39) +// #define CABIN_PRESSURE_SCLK_PIN PIN(40) +// #define CABIN_PRESSURE_RST_PIN -1 // Not connected +// #define CABIN_PRESSURE_MISO_PIN -1 // Not connected +// +// Example (Brake Pressure gauge): +// #define BRAKE_PRESSURE_CS_PIN PIN(5) +// #define BRAKE_PRESSURE_DC_PIN PIN(7) +// #define BRAKE_PRESSURE_MOSI_PIN PIN(10) +// #define BRAKE_PRESSURE_SCLK_PIN PIN(11) +// #define BRAKE_PRESSURE_RST_PIN -1 +// #define BRAKE_PRESSURE_MISO_PIN -1 +// +// Example (Hydraulic Pressure gauge): +// #define HYD_PRESSURE_CS_PIN PIN(17) +// #define HYD_PRESSURE_DC_PIN PIN(3) +// #define HYD_PRESSURE_MOSI_PIN PIN(4) +// #define HYD_PRESSURE_SCLK_PIN PIN(12) +// #define HYD_PRESSURE_RST_PIN -1 +// #define HYD_PRESSURE_MISO_PIN -1 +// +// Example (Radar Altimeter gauge): +// #define RADARALT_CS_PIN PIN(10) +// #define RADARALT_DC_PIN PIN(11) +// #define RADARALT_MOSI_PIN PIN(13) +// #define RADARALT_SCLK_PIN PIN(14) +// #define RADARALT_RST_PIN -1 +// #define RADARALT_MISO_PIN -1 +// +// Example (Battery gauge): +// #define BATTERY_CS_PIN PIN(36) +// #define BATTERY_DC_PIN PIN(13) +// #define BATTERY_MOSI_PIN PIN(8) +// #define BATTERY_SCLK_PIN PIN(9) +// #define BATTERY_RST_PIN PIN(12) + +// --- IFEI LCD Panel Pins ---------------------------------------------------- +// Parallel-interface LCD pairs (left + right) for the IFEI display. +// #define DATA0_PIN PIN(34) // Left LCD data +// #define WR0_PIN PIN(35) // Left LCD write enable +// #define CS0_PIN PIN(36) // Left LCD chip select +// #define DATA1_PIN PIN(18) // Right LCD data +// #define WR1_PIN PIN(21) // Right LCD write enable +// #define CS1_PIN PIN(33) // Right LCD chip select + +// --- IFEI Backlight Pins ---------------------------------------------------- +// #define BL_GREEN_PIN PIN(1) // Day mode backlight +// #define BL_WHITE_PIN PIN(2) // White backlight +// #define BL_NVG_PIN PIN(4) // NVG mode backlight + +// --- ALR-67 Countermeasures Panel ------------------------------------------- +// #define ALR67_STROBE_1 PIN(16) +// #define ALR67_STROBE_2 PIN(17) +// #define ALR67_STROBE_3 PIN(21) +// #define ALR67_STROBE_4 PIN(37) +// #define ALR67_DataPin PIN(38) +// #define ALR67_BACKLIGHT_PIN PIN(14) + +// --- RS485 Communication Pins ----------------------------------------------- +// Only needed for RS485 Slave or Master label sets. +// #define RS485_TX_PIN 17 // GPIO for TX (connect to RS485 board DI) +// #define RS485_RX_PIN 18 // GPIO for RX (connect to RS485 board RO) +// #define RS485_DE_PIN -1 // GPIO for DE pin (-1 if not used) + +// --- RS485 Test Pins (development only, remove for production) -------------- +// All three feed into int8_t fields → use -1 for disabled. +// #define RS485_TEST_BUTTON_GPIO -1 +// #define RS485_TEST_SWITCH_GPIO -1 +// #define RS485_TEST_LED_GPIO -1 diff --git a/src/LABELS/LABEL_SET_WINGFOLD_TEST/DCSBIOSBridgeData.h b/src/LABELS/LABEL_SET_WINGFOLD_TEST/DCSBIOSBridgeData.h new file mode 100644 index 00000000..0c01c4f3 --- /dev/null +++ b/src/LABELS/LABEL_SET_WINGFOLD_TEST/DCSBIOSBridgeData.h @@ -0,0 +1,251 @@ +// Auto-generated DCSBIOS Bridge Data (JSON‑only) - DO NOT EDIT +#pragma once + +#define DCSBIOS_ACFT_NAME "FA-18C_hornet" +static constexpr const char* DCSBIOS_AIRCRAFT_NAME = "FA-18C_hornet"; + +enum ControlType : uint8_t { + CT_LED, + CT_ANALOG, + CT_GAUGE, + CT_SELECTOR, + CT_DISPLAY, + CT_METADATA +}; + +// --- Command History Tracking Struct --- +struct CommandHistoryEntry { + const char* label; + uint16_t lastValue; + unsigned long lastSendTime; + bool isSelector; + uint16_t group; + uint16_t pendingValue; + unsigned long lastChangeTime; + bool hasPending; + uint16_t maxPositions; + uint8_t lastReport[GAMEPAD_REPORT_SIZE]; + uint8_t pendingReport[GAMEPAD_REPORT_SIZE]; + unsigned long lastHidSendTime; +}; + +struct DcsOutputEntry { uint16_t addr, mask; uint8_t shift; uint16_t max_value; const char* label; ControlType controlType; }; +static const DcsOutputEntry DcsOutputTable[] = { + {0x74A0,0x0800,11,1,"WING_FOLD_PULL",CT_SELECTOR}, + {0x74A0,0x3000,12,2,"WING_FOLD_ROTATE",CT_SELECTOR}, +}; +static const size_t DcsOutputTableSize = sizeof(DcsOutputTable)/sizeof(DcsOutputTable[0]); + +// Static flat address-to-output entry lookup +struct AddressEntry { + uint16_t addr; + const DcsOutputEntry* entries[2]; // max entries per address + uint8_t count; +}; + +static const AddressEntry dcsAddressTable[] = { + { 0x74A0, { &DcsOutputTable[0], &DcsOutputTable[1] }, 2 }, +}; + +// Address hash entry +struct DcsAddressHashEntry { + uint16_t addr; + const AddressEntry* entry; +}; + +static const DcsAddressHashEntry dcsAddressHashTable[53] = { + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + { 0x74A0, &dcsAddressTable[0] }, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, + {0xFFFF, nullptr}, +}; + +// Simple address hash (modulo) +constexpr uint16_t addrHash(uint16_t addr) { + return addr % 53; +} + +inline const AddressEntry* findDcsOutputEntries(uint16_t addr) { + uint16_t startH = addrHash(addr); + for (uint16_t i = 0; i < 53; ++i) { + uint16_t idx = (startH + i >= 53) ? (startH + i - 53) : (startH + i); + const auto& entry = dcsAddressHashTable[idx]; + if (entry.addr == 0xFFFF) return nullptr; + if (entry.addr == addr) return entry.entry; + } + return nullptr; +} + +struct SelectorEntry { const char* label; const char* dcsCommand; uint16_t value; const char* controlType; uint16_t group; const char* posLabel; }; +static const SelectorEntry SelectorMap[] = { + { "WING_FOLD_PULL_POS0","WING_FOLD_PULL",0,"selector",2,"POS0" }, + { "WING_FOLD_PULL_POS1","WING_FOLD_PULL",1,"selector",2,"POS1" }, + { "WING_FOLD_ROTATE_UNFOLD","WING_FOLD_ROTATE",0,"selector",1,"UNFOLD" }, + { "WING_FOLD_ROTATE_HOLD","WING_FOLD_ROTATE",1,"selector",1,"HOLD" }, + { "WING_FOLD_ROTATE_FOLD","WING_FOLD_ROTATE",2,"selector",1,"FOLD" }, +}; +static const size_t SelectorMapSize = sizeof(SelectorMap)/sizeof(SelectorMap[0]); + +// O(1) hash lookup for SelectorMap[] by (dcsCommand, value) +struct SelectorHashEntry { const char* dcsCommand; uint16_t value; const SelectorEntry* entry; }; +static const SelectorHashEntry selectorHashTable[53] = { + {nullptr, 0, nullptr}, + {"WING_FOLD_ROTATE", 1, &SelectorMap[3]}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {"WING_FOLD_ROTATE", 2, &SelectorMap[4]}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {"WING_FOLD_PULL", 0, &SelectorMap[0]}, + {"WING_FOLD_ROTATE", 0, &SelectorMap[2]}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {"WING_FOLD_PULL", 1, &SelectorMap[1]}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, + {nullptr, 0, nullptr}, +}; + +// Composite hash: labelHash(dcsCommand) ^ (value * 7919) +inline const SelectorEntry* findSelectorByDcsAndValue(const char* dcsCommand, uint16_t value) { + uint16_t startH = (labelHash(dcsCommand) ^ (value * 7919u)) % 53; + for (uint16_t i = 0; i < 53; ++i) { + uint16_t idx = (startH + i >= 53) ? (startH + i - 53) : (startH + i); + const auto& entry = selectorHashTable[idx]; + if (!entry.dcsCommand) return nullptr; + if (entry.value == value && strcmp(entry.dcsCommand, dcsCommand) == 0) return entry.entry; + } + return nullptr; +} + + +// Unified Command History Table (used for throttling, optional keep-alive, and HID dedupe) +static CommandHistoryEntry commandHistory[] = { + { "WING_FOLD_PULL", 0, 0, true, 2, 0, 0, false, 0, {0}, {0}, 0 }, + { "WING_FOLD_ROTATE", 0, 0, true, 1, 0, 0, false, 0, {0}, {0}, 0 }, +}; +static const size_t commandHistorySize = sizeof(commandHistory)/sizeof(CommandHistoryEntry); + +// --- Auto-generated display string field grouping --- +struct DisplayFieldDef { + const char* panel; + const char* label; + uint16_t base_addr; + uint8_t length; +}; +static const DisplayFieldDef displayFields[] = { +}; +static constexpr size_t numDisplayFields = sizeof(displayFields)/sizeof(displayFields[0]); + +struct DisplayFieldHashEntry { const char* label; const DisplayFieldDef* def; }; +static const DisplayFieldHashEntry displayFieldsByLabel[2] = { + {nullptr, nullptr}, + {nullptr, nullptr}, +}; + +// Shared recursive hash implementation for display label lookup +constexpr uint16_t labelHash(const char* s); + +inline const DisplayFieldDef* findDisplayFieldByLabel(const char* label) { + uint16_t startH = labelHash(label) % 2; + for (uint16_t i = 0; i < 2; ++i) { + uint16_t idx = (startH + i >= 2) ? (startH + i - 2) : (startH + i); + const auto& entry = displayFieldsByLabel[idx]; + if (!entry.label) return nullptr; + if (strcmp(entry.label, label) == 0) return entry.def; + } + return nullptr; +} + +// No tracked metadata fields found +struct MetadataState { const char* label; uint16_t value; }; +static MetadataState metadataStates[] __attribute__((unused)) = {}; +static const size_t numMetadataStates __attribute__((unused)) = 0; +inline MetadataState* findMetadataState(const char*) { return nullptr; } diff --git a/src/LABELS/LABEL_SET_WINGFOLD_TEST/DisplayMapping.cpp.DISABLED b/src/LABELS/LABEL_SET_WINGFOLD_TEST/DisplayMapping.cpp.DISABLED new file mode 100644 index 00000000..ed619ae5 --- /dev/null +++ b/src/LABELS/LABEL_SET_WINGFOLD_TEST/DisplayMapping.cpp.DISABLED @@ -0,0 +1,35 @@ +// DisplayMapping.cpp - Defines the display fields +#include "../../Globals.h" +#include "DisplayMapping.h" + +const DisplayFieldDefLabel fieldDefs[] = { +}; +size_t numFieldDefs = sizeof(fieldDefs) / sizeof(fieldDefs[0]); +FieldState fieldStates[sizeof(fieldDefs) / sizeof(fieldDefs[0])]; + +// --- Hash Table for fieldDefs[] --- +struct FieldDefHashEntry { const char* label; const DisplayFieldDefLabel* def; }; +static const size_t FIELD_HASH_SIZE = 2; +static const FieldDefHashEntry fieldDefHashTable[FIELD_HASH_SIZE] = { + {nullptr, nullptr}, + {nullptr, nullptr}, +}; + +// --- labelHash-based lookup (uses shared labelHash from CUtils.h) --- +const DisplayFieldDefLabel* findFieldDefByLabel(const char* label) { + uint16_t startH = labelHash(label) % FIELD_HASH_SIZE; + for (uint16_t i = 0; i < FIELD_HASH_SIZE; ++i) { + uint16_t idx = (startH + i >= FIELD_HASH_SIZE) ? (startH + i - FIELD_HASH_SIZE) : (startH + i); + const auto& entry = fieldDefHashTable[idx]; + if (!entry.label) return nullptr; + if (strcmp(entry.label, label) == 0) return entry.def; + } + return nullptr; +} + + + const DisplayFieldDefLabel* findFieldByLabel(const char* /*label*/) { + return nullptr; + } + + \ No newline at end of file diff --git a/src/LABELS/LABEL_SET_WINGFOLD_TEST/DisplayMapping.h b/src/LABELS/LABEL_SET_WINGFOLD_TEST/DisplayMapping.h new file mode 100644 index 00000000..4d220650 --- /dev/null +++ b/src/LABELS/LABEL_SET_WINGFOLD_TEST/DisplayMapping.h @@ -0,0 +1,63 @@ +// DisplayMapping.h - Auto-generated +#pragma once + +#include "../../../lib/CUtils/src/CUtils.h" + + +// Enums for FieldType, DisplayDeviceType +enum FieldType { FIELD_LABEL, FIELD_STRING, FIELD_NUMERIC, FIELD_MIXED, FIELD_BARGRAPH }; +enum DisplayDeviceType { DISPLAY_HUD, DISPLAY_IFEI, DISPLAY_UFC }; + +class HUDDisplay; +class IFEIDisplay; +class UFCDisplay; + +enum FieldRenderType : uint8_t { + FIELD_RENDER_7SEG, + FIELD_RENDER_7SEG_SHARED, + FIELD_RENDER_LABEL, + FIELD_RENDER_BINGO, + FIELD_RENDER_BARGRAPH, + FIELD_RENDER_FUEL, + FIELD_RENDER_RPM, + FIELD_RENDER_ALPHA_NUM_FUEL, + FIELD_RENDER_CUSTOM, +}; + +// Structure for a field definition +struct DisplayFieldDefLabel { + const char* label; + const SegmentMap* segMap; + uint8_t numDigits; + uint8_t segsPerDigit; + int minValue; + int maxValue; + FieldType type; + uint8_t barCount; + void* driver; + DisplayDeviceType deviceType; + void (*renderFunc)(void*, const SegmentMap*, const char*, const DisplayFieldDefLabel&); + void (*clearFunc)(void*, const SegmentMap*, const DisplayFieldDefLabel&); + FieldRenderType renderType; +}; + +struct FieldState { + char lastValue[8]; +}; + +const DisplayFieldDefLabel* findFieldByLabel(const char* label); +const DisplayFieldDefLabel* findFieldDefByLabel(const char* label); + +extern const DisplayFieldDefLabel fieldDefs[]; +extern size_t numFieldDefs; +extern FieldState fieldStates[]; +extern HUDDisplay hud; +extern IFEIDisplay ifei; +extern UFCDisplay ufc; +extern void renderHUDDispatcher(void*, const SegmentMap*, const char*, const DisplayFieldDefLabel&); +extern void clearHUDDispatcher(void*, const SegmentMap*, const DisplayFieldDefLabel&); +extern void renderIFEIDispatcher(void*, const SegmentMap*, const char*, const DisplayFieldDefLabel&); +extern void clearIFEIDispatcher(void*, const SegmentMap*, const DisplayFieldDefLabel&); +extern void renderUFCDispatcher(void*, const SegmentMap*, const char*, const DisplayFieldDefLabel&); +extern void clearUFCDispatcher(void*, const SegmentMap*, const DisplayFieldDefLabel&); +// Function pointers (renderFunc, clearFunc) are nullptr in all generated records unless otherwise preserved. diff --git a/src/LABELS/LABEL_SET_WINGFOLD_TEST/InputMapping.h b/src/LABELS/LABEL_SET_WINGFOLD_TEST/InputMapping.h new file mode 100644 index 00000000..9b82b66b --- /dev/null +++ b/src/LABELS/LABEL_SET_WINGFOLD_TEST/InputMapping.h @@ -0,0 +1,112 @@ +// THIS FILE IS AUTO-GENERATED; ONLY EDIT INDIVIDUAL RECORDS, DO NOT ADD OR DELETE THEM HERE +// You can use a PIN(X) macro where X is an S2 PIN to AUTO-CONVERT to its equivalent position in an S3 device. +// So, PIN(4) will always be PIN 4 if you compile with an S2 but will get automatically converted to 5 if you compile the firmware on an S3. +// This is to easily use S2 or S3 devices on same backplane/hardware physically connected to specific PINs +#pragma once + +struct InputMapping { + const char* label; // Unique selector label, auto-generated. + const char* source; // Hardware source identifier. (e.g PCA_0x26, HC165, GPIO, NONE etc) + int8_t port; // Port index (For PCA use port 0 or 1, HC165 does not use port. For GPIO use PIN and use -1 when sharing GPIOs to differentiate HIGH/LOW) + int8_t bit; // Bit position is used for PCA & HC165. GPIO also uses it but ONLY for one-hot selectors (GPIO assigned for each position) in such cases set as -1 + int8_t hidId; // HID usage ID + const char* oride_label; // Override command label (dcsCommand) + uint16_t oride_value; // Override command value (value) + const char* controlType; // Control type, e.g., "selector" + uint16_t group; // Group ID for exclusive selectors + uint16_t releaseValue; // Deferred release value (0 = default, >0 = atomic press-delay-release) +}; + +// label source port bit hidId DCSCommand value Type group rel +static const InputMapping InputMappings[] = { + { "WING_FOLD_PULL_POS0" , "NONE" , 0 , 0 , -1 , "WING_FOLD_PULL" , 0 , "selector", 1 , 0 }, + { "WING_FOLD_PULL_POS1" , "NONE" , 0 , 0 , -1 , "WING_FOLD_PULL" , 1 , "selector", 1 , 0 }, + { "WING_FOLD_ROTATE_UNFOLD", "GPIO" , 39 , 0 , -1 , "WING_FOLD_ROTATE", 0 , "selector", 2 , 0 }, + { "WING_FOLD_ROTATE_HOLD" , "GPIO" , -1 , 0 , -1 , "WING_FOLD_ROTATE", 1 , "selector", 2 , 0 }, + { "WING_FOLD_ROTATE_FOLD" , "GPIO" , 40 , 0 , -1 , "WING_FOLD_ROTATE", 2 , "selector", 2 , 0 }, +}; +static const size_t InputMappingSize = sizeof(InputMappings)/sizeof(InputMappings[0]); + +// Auto-generated: selector DCS labels with group > 0 (panel sync) +static const char* const TrackedSelectorLabels[] = { + "WING_FOLD_PULL", + "WING_FOLD_ROTATE", +}; +static const size_t TrackedSelectorLabelsCount = sizeof(TrackedSelectorLabels)/sizeof(TrackedSelectorLabels[0]); + + +// Static hash lookup table for InputMappings[] +struct InputHashEntry { const char* label; const InputMapping* mapping; }; +static const InputHashEntry inputHashTable[53] = { + {"WING_FOLD_ROTATE_FOLD", &InputMappings[4]}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {"WING_FOLD_ROTATE_HOLD", &InputMappings[3]}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {"WING_FOLD_PULL_POS1", &InputMappings[1]}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {"WING_FOLD_PULL_POS0", &InputMappings[0]}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {"WING_FOLD_ROTATE_UNFOLD", &InputMappings[2]}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, +}; + +// Shared recursive hash implementation for display label lookup +constexpr uint16_t labelHash(const char* s); + + +// Preserve existing signature +constexpr uint16_t inputHash(const char* s) { return labelHash(s); } + +inline const InputMapping* findInputByLabel(const char* label) { + uint16_t startH = inputHash(label) % 53; + for (uint16_t i = 0; i < 53; ++i) { + uint16_t idx = (startH + i >= 53) ? (startH + i - 53) : (startH + i); + const auto& entry = inputHashTable[idx]; + if (!entry.label) return nullptr; + if (strcmp(entry.label, label) == 0) return entry.mapping; + } + return nullptr; +} diff --git a/src/LABELS/LABEL_SET_WINGFOLD_TEST/LEDMapping.h b/src/LABELS/LABEL_SET_WINGFOLD_TEST/LEDMapping.h new file mode 100644 index 00000000..a84fdd2e --- /dev/null +++ b/src/LABELS/LABEL_SET_WINGFOLD_TEST/LEDMapping.h @@ -0,0 +1,113 @@ +// THIS FILE IS AUTO-GENERATED; ONLY EDIT INDIVIDUAL LED/GAUGE RECORDS, DO NOT ADD OR DELETE THEM HERE +#pragma once + +// Embedded LEDMapping structure and enums +enum LEDDeviceType { + DEVICE_GPIO, + DEVICE_GAUGE, + DEVICE_PCA9555, + DEVICE_TM1637, + DEVICE_GN1640T, + DEVICE_WS2812, + DEVICE_MAGNETIC, + DEVICE_STEPPER, + DEVICE_NONE, +}; + +struct LEDMapping { + const char* label; + LEDDeviceType deviceType; + union { + struct { int8_t gpio; } gpioInfo; + struct { uint8_t gpio; uint16_t minPulse; uint16_t maxPulse; uint16_t period; } gaugeInfo; + struct { uint8_t address; uint8_t port; uint8_t bit; } pcaInfo; + struct { uint8_t clkPin; uint8_t dioPin; uint8_t segment; uint8_t bit; } tm1637Info; + struct { uint8_t address; uint8_t column; uint8_t row; } gn1640Info; + struct { uint8_t index; uint8_t pin; uint8_t defR; uint8_t defG; uint8_t defB; uint8_t defBright; } ws2812Info; + struct { uint8_t gpioA; uint8_t gpioB; } magneticInfo; // gpioB=255 → single solenoid (2-pos) + struct { uint8_t pin1; uint8_t pin2; uint8_t pin3; uint8_t pin4; uint16_t totalSteps; uint16_t usPerStep; uint8_t stateCount; bool continuous; } stepperInfo; + } info; + bool dimmable; + bool activeLow; +}; + +// Auto-generated panelLEDs array +static const LEDMapping panelLEDs[] = { + { "WING_FOLD_PULL" , DEVICE_NONE , {.gpioInfo = {0}}, false, false }, // No Info, + { "WING_FOLD_ROTATE", DEVICE_NONE , {.gpioInfo = {0}}, false, false }, // No Info +}; + +static constexpr uint16_t panelLEDsCount = sizeof(panelLEDs)/sizeof(panelLEDs[0]); + +// Auto-generated hash table +struct LEDHashEntry { const char* label; const LEDMapping* led; }; +static const LEDHashEntry ledHashTable[53] = { + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {"WING_FOLD_PULL", &panelLEDs[0]}, + {"WING_FOLD_ROTATE", &panelLEDs[1]}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, + {nullptr, nullptr}, +}; + +// Reuse shared recursive hash implementation +constexpr uint16_t ledHash(const char* s) { return labelHash(s); } + +// findLED lookup +inline const LEDMapping* findLED(const char* label) { + uint16_t startH = ledHash(label) % 53; + for (uint16_t i = 0; i < 53; ++i) { + uint16_t idx = (startH + i >= 53) ? (startH + i - 53) : (startH + i); + const auto& entry = ledHashTable[idx]; + if (!entry.label) return nullptr; + if (strcmp(entry.label, label) == 0) return entry.led; + } + return nullptr; +} diff --git a/src/LABELS/LABEL_SET_WINGFOLD_TEST/LabelSetConfig.h b/src/LABELS/LABEL_SET_WINGFOLD_TEST/LabelSetConfig.h new file mode 100644 index 00000000..60a75d51 --- /dev/null +++ b/src/LABELS/LABEL_SET_WINGFOLD_TEST/LabelSetConfig.h @@ -0,0 +1,9 @@ +#if __has_include("./CustomPins.h") +#include "./CustomPins.h" +#endif + +#define LABEL_SET_NAME "WINGFOLD_TEST" +#define HAS_HID_MODE_SELECTOR 0 +#define LABEL_SET_FULLNAME "CockpitOS Panel WINGFOLD_TEST" // You can safely change this +#define HAS_WINGFOLD_TEST +#define AUTOGEN_USB_PID 0xB12A // DO NOT EDIT THIS diff --git a/src/LABELS/LABEL_SET_WINGFOLD_TEST/LatchedButtons.h b/src/LABELS/LABEL_SET_WINGFOLD_TEST/LatchedButtons.h new file mode 100644 index 00000000..a88e8281 --- /dev/null +++ b/src/LABELS/LABEL_SET_WINGFOLD_TEST/LatchedButtons.h @@ -0,0 +1,10 @@ +// LatchedButtons.h -- Per-label-set latched button configuration +// Buttons listed here toggle ON/OFF instead of acting as momentary press/release. +// Edit via the Label Creator tool or manually. + +#pragma once + +static const char* kLatchedButtons[] = { + // ...add labels of buttons that should latch +}; +static const unsigned kLatchedButtonCount = sizeof(kLatchedButtons)/sizeof(kLatchedButtons[0]); diff --git a/src/LABELS/LABEL_SET_WINGFOLD_TEST/METADATA/CommonData.json b/src/LABELS/LABEL_SET_WINGFOLD_TEST/METADATA/CommonData.json new file mode 100644 index 00000000..05d092a2 --- /dev/null +++ b/src/LABELS/LABEL_SET_WINGFOLD_TEST/METADATA/CommonData.json @@ -0,0 +1,494 @@ +{ + "Altitude": { + "ALT_MSL_FT": { + "category": "Altitude", + "control_type": "metadata", + "description": "Altitude MSL (ft)", + "identifier": "ALT_MSL_FT", + "inputs": [ ], + "outputs": [ { + "address": 1076, + "address_identifier": "CommonData_ALT_MSL_FT_A", + "address_mask_shift_identifier": "CommonData_ALT_MSL_FT", + "description": "Altitude MSL (ft)", + "mask": 65535, + "max_value": 65535, + "shift_by": 0, + "suffix": "", + "type": "integer" + } ] + } + }, + "Heading": { + "HDG_DEG": { + "category": "Heading", + "control_type": "metadata", + "description": "Heading (Degrees)", + "identifier": "HDG_DEG", + "inputs": [ ], + "outputs": [ { + "address": 1078, + "address_mask_shift_identifier": "CommonData_HDG_DEG", + "description": "Heading (Degrees)", + "mask": 511, + "max_value": 360, + "shift_by": 0, + "suffix": "", + "type": "integer" + } ] + }, + "HDG_DEG_FRAC": { + "category": "Heading", + "control_type": "metadata", + "description": "Heading (Fractional Degrees, divide by 127)", + "identifier": "HDG_DEG_FRAC", + "inputs": [ ], + "outputs": [ { + "address": 1078, + "address_mask_shift_identifier": "CommonData_HDG_DEG_FRAC", + "description": "Heading (Fractional Degrees, divide by 127)", + "mask": 65024, + "max_value": 127, + "shift_by": 9, + "suffix": "", + "type": "integer" + } ] + }, + "HDG_DEG_MAG": { + "category": "Heading", + "control_type": "metadata", + "description": "Magnetic Heading", + "identifier": "HDG_DEG_MAG", + "inputs": [ ], + "outputs": [ { + "address": 1124, + "address_mask_shift_identifier": "CommonData_HDG_DEG_MAG", + "description": "Magnetic Heading", + "mask": 511, + "max_value": 359, + "shift_by": 0, + "suffix": "", + "type": "integer" + } ] + } + }, + "Metadata": { + "DCS_BIOS": { + "category": "Metadata", + "control_type": "display", + "deprecated": { + "since": "0.11.2", + "use_instead": "VERSION" + }, + "description": "DCS Bios Version", + "identifier": "DCS_BIOS", + "inputs": [ ], + "outputs": [ { + "address": 1024, + "address_identifier": "CommonData_DCS_BIOS_A", + "description": "DCS Bios Version", + "max_length": 6, + "suffix": "", + "type": "string" + } ] + }, + "PILOTNAME": { + "category": "Metadata", + "control_type": "display", + "description": "Pilot Name", + "identifier": "PILOTNAME", + "inputs": [ ], + "outputs": [ { + "address": 1030, + "address_identifier": "CommonData_PILOTNAME_A", + "description": "Pilot Name", + "max_length": 24, + "suffix": "", + "type": "string" + } ] + }, + "VERSION": { + "category": "Metadata", + "control_type": "display", + "description": "DCS-BIOS Version", + "identifier": "VERSION", + "inputs": [ ], + "outputs": [ { + "address": 1126, + "address_identifier": "CommonData_VERSION_A", + "description": "DCS-BIOS Version", + "max_length": 24, + "suffix": "", + "type": "string" + } ] + } + }, + "Position": { + "LAT_DEG": { + "category": "Position", + "control_type": "metadata", + "description": "Latitude Degrees", + "identifier": "LAT_DEG", + "inputs": [ ], + "outputs": [ { + "address": 1054, + "address_mask_shift_identifier": "CommonData_LAT_DEG", + "description": "Latitude Degrees", + "mask": 32512, + "max_value": 90, + "shift_by": 8, + "suffix": "", + "type": "integer" + } ] + }, + "LAT_SEC": { + "category": "Position", + "control_type": "metadata", + "description": "Latitude Seconds", + "identifier": "LAT_SEC", + "inputs": [ ], + "outputs": [ { + "address": 1056, + "address_mask_shift_identifier": "CommonData_LAT_SEC", + "description": "Latitude Seconds", + "mask": 63, + "max_value": 59, + "shift_by": 0, + "suffix": "", + "type": "integer" + } ] + }, + "LAT_SEC_FRAC": { + "category": "Position", + "control_type": "metadata", + "description": "Latitude Fractional Seconds (divide by 65535)", + "identifier": "LAT_SEC_FRAC", + "inputs": [ ], + "outputs": [ { + "address": 1058, + "address_identifier": "CommonData_LAT_SEC_FRAC_A", + "address_mask_shift_identifier": "CommonData_LAT_SEC_FRAC", + "description": "Latitude Fractional Seconds (divide by 65535)", + "mask": 65535, + "max_value": 65535, + "shift_by": 0, + "suffix": "", + "type": "integer" + } ] + }, + "LAT_Z_DIR": { + "category": "Position", + "control_type": "display", + "description": "Latitude Direction", + "identifier": "LAT_Z_DIR", + "inputs": [ ], + "outputs": [ { + "address": 1054, + "address_identifier": "CommonData_LAT_Z_DIR_A", + "description": "Latitude Direction", + "max_length": 1, + "suffix": "", + "type": "string" + } ] + }, + "LON_DEG": { + "category": "Position", + "control_type": "metadata", + "description": "Longitude Degrees", + "identifier": "LON_DEG", + "inputs": [ ], + "outputs": [ { + "address": 1056, + "address_mask_shift_identifier": "CommonData_LON_DEG", + "description": "Longitude Degrees", + "mask": 16320, + "max_value": 180, + "shift_by": 6, + "suffix": "", + "type": "integer" + } ] + }, + "LON_SEC": { + "category": "Position", + "control_type": "metadata", + "description": "Longitude Seconds", + "identifier": "LON_SEC", + "inputs": [ ], + "outputs": [ { + "address": 1072, + "address_mask_shift_identifier": "CommonData_LON_SEC", + "description": "Longitude Seconds", + "mask": 16128, + "max_value": 59, + "shift_by": 8, + "suffix": "", + "type": "integer" + } ] + }, + "LON_SEC_FRAC": { + "category": "Position", + "control_type": "metadata", + "description": "Longitude Fractional Seconds (divide by 65535)", + "identifier": "LON_SEC_FRAC", + "inputs": [ ], + "outputs": [ { + "address": 1074, + "address_identifier": "CommonData_LON_SEC_FRAC_A", + "address_mask_shift_identifier": "CommonData_LON_SEC_FRAC", + "description": "Longitude Fractional Seconds (divide by 65535)", + "mask": 65535, + "max_value": 65535, + "shift_by": 0, + "suffix": "", + "type": "integer" + } ] + }, + "LON_Z_DIR": { + "category": "Position", + "control_type": "display", + "description": "Longitude Direction", + "identifier": "LON_Z_DIR", + "inputs": [ ], + "outputs": [ { + "address": 1072, + "address_identifier": "CommonData_LON_Z_DIR_A", + "description": "Longitude Direction", + "max_length": 1, + "suffix": "", + "type": "string" + } ] + } + }, + "Speed": { + "ANGULAR_VELOCITY_X": { + "category": "Speed", + "control_type": "display", + "description": "Angular X Velocity", + "identifier": "ANGULAR_VELOCITY_X", + "inputs": [ ], + "outputs": [ { + "address": 1106, + "address_identifier": "CommonData_ANGULAR_VELOCITY_X_A", + "description": "Angular X Velocity", + "max_length": 6, + "suffix": "", + "type": "string" + } ] + }, + "ANGULAR_VELOCITY_Y": { + "category": "Speed", + "control_type": "display", + "description": "Angular Y Velocity", + "identifier": "ANGULAR_VELOCITY_Y", + "inputs": [ ], + "outputs": [ { + "address": 1112, + "address_identifier": "CommonData_ANGULAR_VELOCITY_Y_A", + "description": "Angular Y Velocity", + "max_length": 6, + "suffix": "", + "type": "string" + } ] + }, + "ANGULAR_VELOCITY_Z": { + "category": "Speed", + "control_type": "display", + "description": "Angular Z Velocity", + "identifier": "ANGULAR_VELOCITY_Z", + "inputs": [ ], + "outputs": [ { + "address": 1118, + "address_identifier": "CommonData_ANGULAR_VELOCITY_Z_A", + "description": "Angular Z Velocity", + "max_length": 6, + "suffix": "", + "type": "string" + } ] + }, + "G_LOAD": { + "category": "Speed", + "control_type": "display", + "description": "G Load", + "identifier": "G_LOAD", + "inputs": [ ], + "outputs": [ { + "address": 1102, + "address_identifier": "CommonData_G_LOAD_A", + "description": "G Load", + "max_length": 4, + "suffix": "", + "type": "string" + } ] + }, + "IAS_EU": { + "category": "Speed", + "control_type": "display", + "description": "Indicated Airspeed KM H", + "identifier": "IAS_EU", + "inputs": [ ], + "outputs": [ { + "address": 1060, + "address_identifier": "CommonData_IAS_EU_A", + "description": "Indicated Airspeed KM H", + "max_length": 4, + "suffix": "", + "type": "string" + } ] + }, + "IAS_EU_INT": { + "category": "Speed", + "control_type": "metadata", + "description": "Indicated Airspeed KM H (Int)", + "identifier": "IAS_EU_INT", + "inputs": [ ], + "outputs": [ { + "address": 1068, + "address_identifier": "CommonData_IAS_EU_INT_A", + "address_mask_shift_identifier": "CommonData_IAS_EU_INT", + "description": "Indicated Airspeed KM H (Int)", + "mask": 65535, + "max_value": 65535, + "shift_by": 0, + "suffix": "", + "type": "integer" + } ] + }, + "IAS_US": { + "category": "Speed", + "control_type": "display", + "description": "Indicated Airspeed KNT", + "identifier": "IAS_US", + "inputs": [ ], + "outputs": [ { + "address": 1064, + "address_identifier": "CommonData_IAS_US_A", + "description": "Indicated Airspeed KNT", + "max_length": 4, + "suffix": "", + "type": "string" + } ] + }, + "IAS_US_INT": { + "category": "Speed", + "control_type": "metadata", + "description": "Indicated Airspeed KNT (Int)", + "identifier": "IAS_US_INT", + "inputs": [ ], + "outputs": [ { + "address": 1070, + "address_identifier": "CommonData_IAS_US_INT_A", + "address_mask_shift_identifier": "CommonData_IAS_US_INT", + "description": "Indicated Airspeed KNT (Int)", + "mask": 65535, + "max_value": 65535, + "shift_by": 0, + "suffix": "", + "type": "integer" + } ] + } + }, + "Time": { + "MISS_TIME": { + "category": "Time", + "control_type": "display", + "description": "Mission Start Time", + "identifier": "MISS_TIME", + "inputs": [ ], + "outputs": [ { + "address": 1080, + "address_identifier": "CommonData_MISS_TIME_A", + "description": "Mission Start Time", + "max_length": 8, + "suffix": "", + "type": "string" + } ] + }, + "MOD_TIME": { + "category": "Time", + "control_type": "display", + "description": "Model Time in sec", + "identifier": "MOD_TIME", + "inputs": [ ], + "outputs": [ { + "address": 1088, + "address_identifier": "CommonData_MOD_TIME_A", + "description": "Model Time in sec", + "max_length": 6, + "suffix": "", + "type": "string" + } ] + }, + "TIME_MODEL_HIGH": { + "category": "Time", + "control_type": "metadata", + "description": "Model time high bits in hundredth of a second", + "identifier": "TIME_MODEL_HIGH", + "inputs": [ ], + "outputs": [ { + "address": 1098, + "address_identifier": "CommonData_TIME_MODEL_HIGH_A", + "address_mask_shift_identifier": "CommonData_TIME_MODEL_HIGH", + "description": "Model time high bits in hundredth of a second", + "mask": 65535, + "max_value": 65535, + "shift_by": 0, + "suffix": "", + "type": "integer" + } ] + }, + "TIME_MODEL_LOW": { + "category": "Time", + "control_type": "metadata", + "description": "Model time low bits in hundredth of a second", + "identifier": "TIME_MODEL_LOW", + "inputs": [ ], + "outputs": [ { + "address": 1100, + "address_identifier": "CommonData_TIME_MODEL_LOW_A", + "address_mask_shift_identifier": "CommonData_TIME_MODEL_LOW", + "description": "Model time low bits in hundredth of a second", + "mask": 65535, + "max_value": 65535, + "shift_by": 0, + "suffix": "", + "type": "integer" + } ] + }, + "TIME_START_HIGH": { + "category": "Time", + "control_type": "metadata", + "description": "Start time high bits in seconds", + "identifier": "TIME_START_HIGH", + "inputs": [ ], + "outputs": [ { + "address": 1094, + "address_identifier": "CommonData_TIME_START_HIGH_A", + "address_mask_shift_identifier": "CommonData_TIME_START_HIGH", + "description": "Start time high bits in seconds", + "mask": 65535, + "max_value": 65535, + "shift_by": 0, + "suffix": "", + "type": "integer" + } ] + }, + "TIME_START_LOW": { + "category": "Time", + "control_type": "metadata", + "description": "Start time low bits in seconds", + "identifier": "TIME_START_LOW", + "inputs": [ ], + "outputs": [ { + "address": 1096, + "address_identifier": "CommonData_TIME_START_LOW_A", + "address_mask_shift_identifier": "CommonData_TIME_START_LOW", + "description": "Start time low bits in seconds", + "mask": 65535, + "max_value": 65535, + "shift_by": 0, + "suffix": "", + "type": "integer" + } ] + } + } +} \ No newline at end of file diff --git a/src/LABELS/LABEL_SET_WINGFOLD_TEST/METADATA/Custom.json b/src/LABELS/LABEL_SET_WINGFOLD_TEST/METADATA/Custom.json new file mode 100644 index 00000000..6be5adec --- /dev/null +++ b/src/LABELS/LABEL_SET_WINGFOLD_TEST/METADATA/Custom.json @@ -0,0 +1,3 @@ +{ + "Custom": {} +} diff --git a/src/LABELS/LABEL_SET_WINGFOLD_TEST/METADATA/MetadataEnd.json b/src/LABELS/LABEL_SET_WINGFOLD_TEST/METADATA/MetadataEnd.json new file mode 100644 index 00000000..fd0076c0 --- /dev/null +++ b/src/LABELS/LABEL_SET_WINGFOLD_TEST/METADATA/MetadataEnd.json @@ -0,0 +1,38 @@ +{ + "Metadata": { + "_UPDATE_COUNTER": { + "category": "Metadata", + "control_type": "metadata", + "description": "Update Counter", + "identifier": "_UPDATE_COUNTER", + "inputs": [ ], + "outputs": [ { + "address": 65534, + "address_mask_shift_identifier": "MetadataEnd_UPDATE_COUNTER", + "description": "Update Counter", + "mask": 255, + "max_value": 255, + "shift_by": 0, + "suffix": "", + "type": "integer" + } ] + }, + "_UPDATE_SKIP_COUNTER": { + "category": "Metadata", + "control_type": "metadata", + "description": "Update Skip Counter", + "identifier": "_UPDATE_SKIP_COUNTER", + "inputs": [ ], + "outputs": [ { + "address": 65534, + "address_mask_shift_identifier": "MetadataEnd_UPDATE_SKIP_COUNTER", + "description": "Update Skip Counter", + "mask": 65280, + "max_value": 255, + "shift_by": 8, + "suffix": "", + "type": "integer" + } ] + } + } +} \ No newline at end of file diff --git a/src/LABELS/LABEL_SET_WINGFOLD_TEST/METADATA/MetadataStart.json b/src/LABELS/LABEL_SET_WINGFOLD_TEST/METADATA/MetadataStart.json new file mode 100644 index 00000000..145c073f --- /dev/null +++ b/src/LABELS/LABEL_SET_WINGFOLD_TEST/METADATA/MetadataStart.json @@ -0,0 +1,19 @@ +{ + "Metadata": { + "_ACFT_NAME": { + "category": "Metadata", + "control_type": "display", + "description": "Aircraft Name (or NONE), null-terminated", + "identifier": "_ACFT_NAME", + "inputs": [ ], + "outputs": [ { + "address": 0, + "address_identifier": "MetadataStart_ACFT_NAME_A", + "description": "Aircraft Name (or NONE), null-terminated", + "max_length": 24, + "suffix": "", + "type": "string" + } ] + } + } +} \ No newline at end of file diff --git a/src/LABELS/LABEL_SET_WINGFOLD_TEST/aircraft.txt b/src/LABELS/LABEL_SET_WINGFOLD_TEST/aircraft.txt new file mode 100644 index 00000000..3550f4b9 --- /dev/null +++ b/src/LABELS/LABEL_SET_WINGFOLD_TEST/aircraft.txt @@ -0,0 +1 @@ +FA-18C_hornet diff --git a/src/LABELS/LABEL_SET_WINGFOLD_TEST/display_gen.py b/src/LABELS/LABEL_SET_WINGFOLD_TEST/display_gen.py new file mode 100644 index 00000000..f00f3f65 --- /dev/null +++ b/src/LABELS/LABEL_SET_WINGFOLD_TEST/display_gen.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 +""" +CockpitOS Display Generator Wrapper +==================================== +Thin wrapper - all logic lives in ../_core/display_gen_core.py +DO NOT EDIT THIS FILE - edit the core module instead. +""" +import os, sys +os.chdir(os.path.dirname(os.path.abspath(__file__))) +sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '_core')) +from display_gen_core import run +run() diff --git a/src/LABELS/LABEL_SET_WINGFOLD_TEST/generate_data.py b/src/LABELS/LABEL_SET_WINGFOLD_TEST/generate_data.py new file mode 100644 index 00000000..4f7995da --- /dev/null +++ b/src/LABELS/LABEL_SET_WINGFOLD_TEST/generate_data.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 +""" +CockpitOS Generator Wrapper +=========================== +Thin wrapper - all logic lives in ../_core/generator_core.py +DO NOT EDIT THIS FILE - edit the core module instead. +""" +import os, sys +os.chdir(os.path.dirname(os.path.abspath(__file__))) +sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '_core')) +from generator_core import run +run() diff --git a/src/LABELS/LABEL_SET_WINGFOLD_TEST/panels.txt b/src/LABELS/LABEL_SET_WINGFOLD_TEST/panels.txt new file mode 100644 index 00000000..a5323e49 --- /dev/null +++ b/src/LABELS/LABEL_SET_WINGFOLD_TEST/panels.txt @@ -0,0 +1,81 @@ +AMPCD +APU Fire Warning Extinguisher Light +Angle of Attack Indexer Lights +Antenna Select Panel +Arresting Hook Handle and Light +Auxiliary Power Unit Panel +Canopy Internal Jettison Handle +Caution Light Panel +Clock +Cockpit Altimeter +Comms frequency +Communication Panel +Defog Panel +Dispenser/EMC Panel +ECM Dispenser Button +Ejection Seat +Electrical Power Panel +Emergency Jettison Button +Emergency and Parking Brake Handle +Environment Control Louver +Environment Control System Panel +Exterior Lights Panel +External Aircraft Model +Fire Systems +Fire Test Panel +Flaps, Landing Gear, Stores Indicator Panel +Flight Computer Cool Switch +Flight Control System Panel +Fuel Panel +Generator Tie Control Switch +Ground Power Panel +HUD +HUD Control Panel +HUD Video Bit Panel +HUD Video Record Panel +HYD 1 and HYD Pressure Indicator +Heading and Course Set Switches +Integrated Fuel/Engine Indicator (IFEI) +Interior Lights Panel +Internal Canopy Switch +Internal Lights +KY-58 Control +LH Advisory Panel +LOX Indicator +Landing Gear Handle and Warning Tone Silence +Left DDI +Left Engine Fire Warning Extinguisher Light +Left Essential Circuit Breakers +Lock Shoot Lights +Map Gain/Spin Recovery Panel +Master Arm Panel +Master Caution Light +Mission Computer and Hydraulic Isolate Panel +RH Advisory Panel +RWR Control Indicator +Radar Altimeter +Radio Frequencies +Right DDI +Right Engine Fire Warning Extinguisher Light +Right Essential Circuit Breakers +Rudder Pedal Adjust Level +Select Jettison Button +Sensor Panel +Standby Airspeed Indicator +Standby Altimeter +Standby Attitude Reference Indicator +Standby Compass +Standby Rate of Climb Indicator +Station Jettison Select +Stick +TODO +Throttle Quadrant +Up Front Controller (UFC) +Wing Fold Switch +Altitude +Heading +Metadata +Position +Speed +Time +Custom diff --git a/src/LABELS/LABEL_SET_WINGFOLD_TEST/reset_data.py b/src/LABELS/LABEL_SET_WINGFOLD_TEST/reset_data.py new file mode 100644 index 00000000..3fad5d2e --- /dev/null +++ b/src/LABELS/LABEL_SET_WINGFOLD_TEST/reset_data.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 +""" +CockpitOS Reset Data Wrapper +============================ +Thin wrapper - all logic lives in ../_core/reset_core.py +DO NOT EDIT THIS FILE - edit the core module instead. +""" +import os, sys +os.chdir(os.path.dirname(os.path.abspath(__file__))) +sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '_core')) +from reset_core import run +run() diff --git a/src/LABELS/LABEL_SET_WINGFOLD_TEST/selected_panels.txt b/src/LABELS/LABEL_SET_WINGFOLD_TEST/selected_panels.txt new file mode 100644 index 00000000..752a5361 --- /dev/null +++ b/src/LABELS/LABEL_SET_WINGFOLD_TEST/selected_panels.txt @@ -0,0 +1,89 @@ +# selected_panels.txt - List panels to include, one per line. +# To enable a panel, remove the leading '#'. Only panels listed in panels.txt are valid. +# Example: +# Master Arm Panel +# Caution Light Panel +# +# To update the list of available panels, just re-run this script. + +# AMPCD +# APU Fire Warning Extinguisher Light +# Altitude +# Angle of Attack Indexer Lights +# Antenna Select Panel +# Arresting Hook Handle and Light +# Auxiliary Power Unit Panel +# Canopy Internal Jettison Handle +# Caution Light Panel +# Clock +# Cockpit Altimeter +# Comms frequency +# Communication Panel +# Custom +# Defog Panel +# Dispenser/EMC Panel +# ECM Dispenser Button +# Ejection Seat +# Electrical Power Panel +# Emergency Jettison Button +# Emergency and Parking Brake Handle +# Environment Control Louver +# Environment Control System Panel +# Exterior Lights Panel +# External Aircraft Model +# Fire Systems +# Fire Test Panel +# Flaps, Landing Gear, Stores Indicator Panel +# Flight Computer Cool Switch +# Flight Control System Panel +# Fuel Panel +# Generator Tie Control Switch +# Ground Power Panel +# HUD +# HUD Control Panel +# HUD Video Bit Panel +# HUD Video Record Panel +# HYD 1 and HYD Pressure Indicator +# Heading +# Heading and Course Set Switches +# Integrated Fuel/Engine Indicator (IFEI) +# Interior Lights Panel +# Internal Canopy Switch +# Internal Lights +# KY-58 Control +# LH Advisory Panel +# LOX Indicator +# Landing Gear Handle and Warning Tone Silence +# Left DDI +# Left Engine Fire Warning Extinguisher Light +# Left Essential Circuit Breakers +# Lock Shoot Lights +# Map Gain/Spin Recovery Panel +# Master Arm Panel +# Master Caution Light +# Metadata +# Mission Computer and Hydraulic Isolate Panel +# Position +# RH Advisory Panel +# RWR Control Indicator +# Radar Altimeter +# Radio Frequencies +# Right DDI +# Right Engine Fire Warning Extinguisher Light +# Right Essential Circuit Breakers +# Rudder Pedal Adjust Level +# Select Jettison Button +# Sensor Panel +# Speed +# Standby Airspeed Indicator +# Standby Altimeter +# Standby Attitude Reference Indicator +# Standby Compass +# Standby Rate of Climb Indicator +# Station Jettison Select +# Stick +# TODO +# Throttle Quadrant +# Time +# Up Front Controller (UFC) +Wing Fold Switch From 7da83f28ec66b53e16dbac52407c4ffa0c8c131b Mon Sep 17 00:00:00 2001 From: Jesus Altuve <136034141+BojoteX@users.noreply.github.com> Date: Sun, 27 Sep 2026 08:44:01 -0400 Subject: [PATCH 2/2] Fix CI compilation after restoring legacy Arduino metadata --- .github/workflows/ci-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 554b6305..d4945e21 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -133,6 +133,7 @@ jobs: set -o pipefail FQBN="esp32:esp32:esp32s3:UploadSpeed=921600,CDCOnBoot=default,FlashSize=16M,PartitionScheme=noota_ffat,USBMode=default" + arduino-cli core list arduino-cli compile \ --fqbn "$FQBN" \ --warnings all \