From c1d74c4c2d2d19e9fae05010e0403d33f148ef81 Mon Sep 17 00:00:00 2001 From: Arribe <47125808+Arribe@users.noreply.github.com> Date: Mon, 25 Mar 2024 23:35:52 -0500 Subject: [PATCH 01/16] New Sketch 2A13-BACKLIGHT_CONTROLLER --- .../2A13-BACKLIGHT_CONTROLLER.h | 68 +++++ .../2A13-BACKLIGHT_CONTROLLER.ino | 139 ++++++++++ .../OH_BL_PANELS/1A2A1_MASTER_ARM_BL.h | 130 +++++++++ .../OH_BL_PANELS/1A4_L_EWI_BL.h | 253 ++++++++++++++++++ 4 files changed, 590 insertions(+) create mode 100644 embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h create mode 100644 embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.ino create mode 100644 embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/OH_BL_PANELS/1A2A1_MASTER_ARM_BL.h create mode 100644 embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/OH_BL_PANELS/1A4_L_EWI_BL.h diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h new file mode 100644 index 0000000..1fb205a --- /dev/null +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h @@ -0,0 +1,68 @@ +/************************************************************************************** + * ____ _ _ _ + * / __ \ | | | | | | + * | | | |_ __ ___ _ __ | |__| | ___ _ __ _ __ ___| |_ + * | | | | '_ \ / _ \ '_ \| __ |/ _ \| '__| '_ \ / _ \ __| + * | |__| | |_) | __/ | | | | | | (_) | | | | | | __/ |_ + * \____/| .__/ \___|_| |_|_| |_|\___/|_| |_| |_|\___|\__| + * | | + * |_| + * ---------------------------------------------------------------------------------- + * Copyright 2016-2024 OpenHornet + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ---------------------------------------------------------------------------------- + * Note: All other portions of OpenHornet not within the 'OpenHornet-Software' + * GitHub repository is released under the Creative Commons Attribution - + * Non-Commercial - Share Alike License. (CC BY-NC-SA 4.0) + * ---------------------------------------------------------------------------------- + * This Project uses Doxygen as a documentation generator. + * Please use Doxygen capable comments. + **************************************************************************************/ +/** + * @file 2A13-BACKLIGHT_CONTROLLER.H + * @author Arribe + * @date 03.25.2024 + * @version u.0.0.1 (untested) + * @copyright Copyright 2016-2024 OpenHornet. Licensed under the Apache License, Version 2.0. + * @warning This sketch is based on a wiring diagram, and was not yet tested on hardware. (Remove this line once tested on hardware and in system.) + * @brief Header file for the backlighting to split out code for panel specific lighting support.c:\Users\Thoma\Documents\Arduino\2A13-BACKLIGHT_CONTROLLER\OH_BL_PANELS\1A4_L_EWI.h +*/ + +#include "DcsBios.h" +#include "Adafruit_NeoPixel.h" + +/** +* @brief UIP Backlights +* @todo Add if defined statements here to test if the panels are included prior to including them in the main LED counts. +*/ +#define MASTER_ARM_LED_START_INDEX 0 +#define MA_LED_COUNT 29 + +#define L_EWI_LED_START_INDEX 29 +#define L_EWI_LED_COUNT 30 + +#define UIP_LED_COUNT MA_LED_COUNT + L_EWI_LED_COUNT + +Adafruit_NeoPixel uipBLCh1 = Adafruit_NeoPixel(UIP_LED_COUNT, UIP_BL_CH1, NEO_GRB + NEO_KHZ800); + +#include "OH_BL_PANELS\1A2A1_MASTER_ARM_BL.h" +#include "OH_BL_PANELS\1A4_L_EWI_BL.h" + +namespace OpenHornet { +void setup() { + uipBLCh1.begin(); + uipBLCh1.show(); + uipBLCh1.setBrightness(BRIGHTNESS); +} +} diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.ino b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.ino new file mode 100644 index 0000000..3722ed3 --- /dev/null +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.ino @@ -0,0 +1,139 @@ +/************************************************************************************** + * ____ _ _ _ + * / __ \ | | | | | | + * | | | |_ __ ___ _ __ | |__| | ___ _ __ _ __ ___| |_ + * | | | | '_ \ / _ \ '_ \| __ |/ _ \| '__| '_ \ / _ \ __| + * | |__| | |_) | __/ | | | | | | (_) | | | | | | __/ |_ + * \____/| .__/ \___|_| |_|_| |_|\___/|_| |_| |_|\___|\__| + * | | + * |_| + * ---------------------------------------------------------------------------------- + * Copyright 2016-2024 OpenHornet + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ---------------------------------------------------------------------------------- + * Note: All other portions of OpenHornet not within the 'OpenHornet-Software' + * GitHub repository is released under the Creative Commons Attribution - + * Non-Commercial - Share Alike License. (CC BY-NC-SA 4.0) + * ---------------------------------------------------------------------------------- + * This Project uses Doxygen as a documentation generator. + * Please use Doxygen capable comments. + **************************************************************************************/ +/** + * @file 2A13-BACKLIGHT_CONTROLLER.ino + * @author Arribe + * @date 03.25.2024 + * @version u.0.0.1 (untested) + * @copyright Copyright 2016-2024 OpenHornet. Licensed under the Apache License, Version 2.0. + * @warning This sketch is based on a wiring diagram, and was not yet tested on hardware. (Remove this line once tested on hardware and in system.) + * @brief Controls the backlighting (and some annunciators) for the entire pit. + * + * @details + * + * * **Reference Designator:** 2A13 + * * **Intended Board:** ABSIS BACKLIGHT CONTROLLER + * * **RS485 Bus Address:** NA + * + * * **Intended Board:** + * ABSIS BACKLIGHT CONTROLLER + * + * * ** Processor ** + * Arduino Mega + Backlight Shield + * + * **Wiring diagram:** + * + * PIN | Function + * --- | --- + * 13 | J2 LIP_BL_CH1 + * 12 | J3 LIP_BL_CH2 + * 11 | J4 UIP_BL_CH1 + * 10 | J5 UIP_BL_CH2 + * 9 | J6 LC_BL_CH1 + * 8 | J7 LC_BL_CH2 + * 7 | J8 RC_BL_CH1 + * 6 | J9 RC_BL_CH2 + * 5 | J10 NC + * 4 | J11 NC + * 24 | J14 SIMPWR_BLM_A + * 23 | J14 SIMPWR_BLM_B + * 22 | J14 SIMPWR_PUSH + * SDA | TEMP SNSR + * SCL | TEMP SNSR + * 2 | J12 & J13 Cooling fan headers. + */ + +/** + * Check if we're on a Mega328 or Mega2560 and define the correct + * serial interface + * + */ +#if defined(__AVR_ATmega328P__) || defined(__AVR_ATmega2560__) +#define DCSBIOS_IRQ_SERIAL ///< This enables interrupt-driven serial communication for DCS-BIOS. (Only used with the ATmega328P or ATmega2560 microcontrollers.) +#else +#define DCSBIOS_DEFAULT_SERIAL ///< This enables the default serial communication for DCS-BIOS. (Used with all other microcontrollers than the ATmega328P or ATmega2560.) +#endif + +#ifdef __AVR__ +#include +#endif + +#include "DcsBios.h" +#include "Adafruit_NeoPixel.h" + + +// Define pins for DCS-BIOS per interconnect diagram, and Bakclight control kicad sketch. +#define LIP_BL_CH1 13 ///< J2 LIP_BL_CH1 +#define LIP_BL_CH2 12 ///< J3 LIP_BL_CH2 +#define UIP_BL_CH1 11 ///< J4 UIP_BL_CH1 +#define UIP_BL_CH2 10 ///< J5 UIP_BL_CH2 +#define LC_BL_CH1 9 ///< J6 LC_BL_CH1 +#define LC_BL_CH2 8 ///< J7 LC_BL_CH2 +#define RC_BL_CH1 7 ///< J8 RC_BL_CH1 +#define RC_BL_CH2 6 ///< J9 RC_BL_CH2 +//#define 5 ///< J10 NC +//#define 4 ///< J11 NC +#define SIMPWR_BLM_A 24 ///< J14 SIMPWR_BLM_A +#define SIMPWR_BLM_B 23 ///< J14 SIMPWR_BLM_B +#define SIMPWR_PUSH 22 ///< J14 SIMPWR_PUSHc:\Users\Thoma\Documents\Arduino\2A13-BACKLIGHT_CONTROLLER\OH_BL_PANELS\1A2A1_MASTER_ARM_BL.h +//#define SDA | TEMP SNSR +//#define SCL | TEMP SNSR +#define COOLING_FANS 2 ///< J12 & J13 Cooling fan headers. + +#define BRIGHTNESS 50 ///< Brightness value used by the panels. + +#include "2A13-BACKLIGHT_CONTROLLER.h" + +/** +* Arduino Setup Function +* +* Arduino standard Setup Function. Code who should be executed +* only once at the programm start, belongs in this function. +*/ +void setup() { + + // Run DCS Bios setup function + DcsBios::setup(); + OpenHornet::setup(); +} + +/** +* Arduino Loop Function +* +* Arduino standard Loop Function. Code who should be executed +* over and over in a loop, belongs in this function. +*/ +void loop() { + + //Run DCS Bios loop function + DcsBios::loop(); +} diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/OH_BL_PANELS/1A2A1_MASTER_ARM_BL.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/OH_BL_PANELS/1A2A1_MASTER_ARM_BL.h new file mode 100644 index 0000000..ebf3a74 --- /dev/null +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/OH_BL_PANELS/1A2A1_MASTER_ARM_BL.h @@ -0,0 +1,130 @@ +/************************************************************************************** + * ____ _ _ _ + * / __ \ | | | | | | + * | | | |_ __ ___ _ __ | |__| | ___ _ __ _ __ ___| |_ + * | | | | '_ \ / _ \ '_ \| __ |/ _ \| '__| '_ \ / _ \ __| + * | |__| | |_) | __/ | | | | | | (_) | | | | | | __/ |_ + * \____/| .__/ \___|_| |_|_| |_|\___/|_| |_| |_|\___|\__| + * | | + * |_| + * ---------------------------------------------------------------------------------- + * Copyright 2016-2024 OpenHornet + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ---------------------------------------------------------------------------------- + * Note: All other portions of OpenHornet not within the 'OpenHornet-Software' + * GitHub repository is released under the Creative Commons Attribution - + * Non-Commercial - Share Alike License. (CC BY-NC-SA 4.0) + * ---------------------------------------------------------------------------------- + * This Project uses Doxygen as a documentation generator. + * Please use Doxygen capable comments. + **************************************************************************************/ +/** + * @file 1A2A1_MASTER_ARM_BL.h + * @author Arribe + * @date 03.25.2024 + * @version u.0.0.1 (untested) + * @copyright Copyright 2016-2024 OpenHornet. Licensed under the Apache License, Version 2.0. + * @warning This sketch is based on a wiring diagram, and was not yet tested on hardware. (Remove this line once tested on hardware and in system.) + * @brief Header file for the Master Arm panel backlighting /w annunciators to split out code for panel specific lighting support. +*/ + +#include "DcsBios.h" +#include "Adafruit_NeoPixel.h" + +#define READY_START 0 + MASTER_ARM_LED_START_INDEX +#define READY_COUNT 2 +#define DISCH_START 2 + MASTER_ARM_LED_START_INDEX +#define DISCH_COUNT 2 +#define MM_AG_START 25 + MASTER_ARM_LED_START_INDEX +#define MM_AG_COUNT 2 +#define MM_AA_START 27 + MASTER_ARM_LED_START_INDEX +#define MM_AA_COUNT 2 +#define BL_START 4 + MASTER_ARM_LED_START_INDEX +#define BL_LENGTH 21 + +/** +* @brief Setup maserArmPanel's neopixel and then set the DCS Bios methods to read sim state and set +* backlighting / annunciators accordingly. +* +*/ + +void onMcReadyChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, READY_START, READY_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(255, 255, 0), READY_START, READY_COUNT); ///< Set light to Yellow + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer mcReadyBuffer(0x740c, 0x8000, 15, onMcReadyChange); + +void onMcDischChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, DISCH_START, DISCH_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), DISCH_START, DISCH_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer mcDischBuffer(0x740c, 0x4000, 14, onMcDischChange); + +void onMasterModeAgLtChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, MM_AG_START, MM_AG_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), MM_AG_START, MM_AG_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer masterModeAgLtBuffer(0x740c, 0x0400, 10, onMasterModeAgLtChange); + +void onMasterModeAaLtChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, MM_AA_START, MM_AA_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), MM_AA_START, MM_AA_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer masterModeAaLtBuffer(0x740c, 0x0200, 9, onMasterModeAaLtChange); + +void onInstPnlDimmerChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, MASTER_ARM_LED_START_INDEX + BL_START, BL_LENGTH); ///< Off + uipBLCh1.show(); + break; + default: + uipBLCh1.fill(uipBLCh1.Color(0, map(newValue, 0, 65535, 0, 255), 0), MASTER_ARM_LED_START_INDEX + BL_START, BL_LENGTH); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer instPnlDimmerBuffer(0x7546, 0xffff, 0, onInstPnlDimmerChange); \ No newline at end of file diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/OH_BL_PANELS/1A4_L_EWI_BL.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/OH_BL_PANELS/1A4_L_EWI_BL.h new file mode 100644 index 0000000..7e19af9 --- /dev/null +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/OH_BL_PANELS/1A4_L_EWI_BL.h @@ -0,0 +1,253 @@ +/************************************************************************************** + * ____ _ _ _ + * / __ \ | | | | | | + * | | | |_ __ ___ _ __ | |__| | ___ _ __ _ __ ___| |_ + * | | | | '_ \ / _ \ '_ \| __ |/ _ \| '__| '_ \ / _ \ __| + * | |__| | |_) | __/ | | | | | | (_) | | | | | | __/ |_ + * \____/| .__/ \___|_| |_|_| |_|\___/|_| |_| |_|\___|\__| + * | | + * |_| + * ---------------------------------------------------------------------------------- + * Copyright 2016-2024 OpenHornet + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ---------------------------------------------------------------------------------- + * Note: All other portions of OpenHornet not within the 'OpenHornet-Software' + * GitHub repository is released under the Creative Commons Attribution - + * Non-Commercial - Share Alike License. (CC BY-NC-SA 4.0) + * ---------------------------------------------------------------------------------- + * This Project uses Doxygen as a documentation generator. + * Please use Doxygen capable comments. + **************************************************************************************/ +/** + * @file 1A4_L_EWI_BL.h + * @author Arribe + * @date 03.25.2024 + * @version u.0.0.1 (untested) + * @copyright Copyright 2016-2024 OpenHornet. Licensed under the Apache License, Version 2.0. + * @warning This sketch is based on a wiring diagram, and was not yet tested on hardware. (Remove this line once tested on hardware and in system.) + * @brief Header file for the Left EWI panel annunciators to split out code for panel specific lighting support. +*/ + +#include "DcsBios.h" +#include "Adafruit_NeoPixel.h" + +#define FIRE_START 0 + L_EWI_LED_START_INDEX +#define FIRE_COUNT 4 +#define MC_START 4 + L_EWI_LED_START_INDEX +#define MC_COUNT 4 +#define GO_START 8 + L_EWI_LED_START_INDEX +#define GO_COUNT 2 +#define NO_GO_START 10 + L_EWI_LED_START_INDEX +#define NO_GO_COUNT 2 +#define R_BLEED_START 12 + L_EWI_LED_START_INDEX +#define R_BLEED_COUNT 2 +#define L_BLEED_START 14 + L_EWI_LED_START_INDEX +#define L_BLEED_COUNT 2 +#define SPD_BRK_START 16 + L_EWI_LED_START_INDEX +#define SPD_BRK_COUNT 2 +#define STBY_START 18 + L_EWI_LED_START_INDEX +#define STBY_COUNT 2 +#define REC_START 20 + L_EWI_LED_START_INDEX +#define REC_COUNT 2 +#define L_BAR1_START 22 + L_EWI_LED_START_INDEX +#define L_BAR1_COUNT 2 +#define L_BAR2_START 24 + L_EWI_LED_START_INDEX +#define L_BAR2_COUNT 2 +#define XMIT_START 26 + L_EWI_LED_START_INDEX +#define XMIT_COUNT 2 +#define ASPJ_ON_START 28 + L_EWI_LED_START_INDEX +#define ASPJ_ON_COUNT 2 + + +void onFireLeftLtChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, FIRE_START, FIRE_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(255, 0, 0), FIRE_START, FIRE_COUNT); ///< Set light to Red + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer fireLeftLtBuffer(0x7408, 0x0040, 6, onFireLeftLtChange); + +void onMasterCautionLtChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, MC_START, MC_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(255, 255, 0), MC_START, MC_COUNT); ///< Set light to Yellow + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer masterCautionLtBuffer(0x7408, 0x0200, 9, onMasterCautionLtChange); + +void onLhAdvAspjOhChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, ASPJ_ON_START, ASPJ_ON_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(255, 255, 0), ASPJ_ON_START, ASPJ_ON_COUNT); ///< Set light to Yellow + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer lhAdvAspjOhBuffer(0x740a, 0x0008, 3, onLhAdvAspjOhChange); + +void onLhAdvGoChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, GO_START, GO_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), GO_START, GO_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer lhAdvGoBuffer(0x740a, 0x0010, 4, onLhAdvGoChange); + +void onLhAdvLBarGreenChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, L_BAR2_START, L_BAR2_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), L_BAR2_START, L_BAR2_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer lhAdvLBarGreenBuffer(0x740a, 0x0002, 1, onLhAdvLBarGreenChange); + +void onLhAdvLBarRedChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, L_BAR1_START, L_BAR1_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(255, 0, 0), L_BAR1_START, L_BAR1_COUNT); ///< Set light to Red + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer lhAdvLBarRedBuffer(0x7408, 0x8000, 15, onLhAdvLBarRedChange); + +void onLhAdvLBleedChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, L_BLEED_START, L_BLEED_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(255, 0, 0), L_BLEED_START, L_BLEED_COUNT); ///< Set light to Red + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer lhAdvLBleedBuffer(0x7408, 0x0800, 11, onLhAdvLBleedChange); + +void onLhAdvNoGoChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, NO_GO_START, NO_GO_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(255, 255, 0), NO_GO_START, NO_GO_COUNT); ///< Set light to Yellow + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer lhAdvNoGoBuffer(0x740a, 0x0020, 5, onLhAdvNoGoChange); + +void onLhAdvRBleedChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, R_BLEED_START, R_BLEED_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(255, 0, 0), R_BLEED_START, R_BLEED_COUNT); ///< Set light to Red + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer lhAdvRBleedBuffer(0x7408, 0x1000, 12, onLhAdvRBleedChange); + +void onLhAdvRecChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, REC_START, REC_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), REC_START, REC_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer lhAdvRecBuffer(0x740a, 0x0001, 0, onLhAdvRecChange); + +void onLhAdvSpdBrkChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, SPD_BRK_START, SPD_BRK_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), SPD_BRK_START, SPD_BRK_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer lhAdvSpdBrkBuffer(0x7408, 0x2000, 13, onLhAdvSpdBrkChange); + +void onLhAdvStbyChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, STBY_START, STBY_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), STBY_START, STBY_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer lhAdvStbyBuffer(0x7408, 0x4000, 14, onLhAdvStbyChange); + +void onLhAdvXmitChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, XMIT_START, XMIT_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), XMIT_START, XMIT_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer lhAdvXmitBuffer(0x740a, 0x0004, 2, onLhAdvXmitChange); \ No newline at end of file From 07f885842c7b956db043dec0f78c74cd3a07afa3 Mon Sep 17 00:00:00 2001 From: Arribe <47125808+Arribe@users.noreply.github.com> Date: Mon, 25 Mar 2024 23:42:32 -0500 Subject: [PATCH 02/16] Create Makefile --- .../2A13-BACKLIGHT_CONTROLLER/Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/Makefile diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/Makefile b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/Makefile new file mode 100644 index 0000000..f3e74ef --- /dev/null +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/Makefile @@ -0,0 +1,8 @@ +# Any extra libraries included by this sketch (space separated) +LIBRARIES = Adafruit_NeoPixel Servo dcs-bios-arduino-library TCA9534 Wire ArduinoJoystickLibrary + +# Uncomment one of the following to choose the target board +include $(ROOTDIR)/include/mega2560.mk +# include $(ROOTDIR)/include/promicro.mk +# include $(ROOTDIR)/include/promini.mk +# include $(ROOTDIR)/include/s2mini.mk From 12286608e6e9138c7726d51e1cf4c4128dac5e76 Mon Sep 17 00:00:00 2001 From: Arribe <47125808+Arribe@users.noreply.github.com> Date: Mon, 25 Mar 2024 23:47:08 -0500 Subject: [PATCH 03/16] Update 2A13-BACKLIGHT_CONTROLLER.h --- .../2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h index 1fb205a..2a489e4 100644 --- a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h @@ -36,7 +36,7 @@ * @version u.0.0.1 (untested) * @copyright Copyright 2016-2024 OpenHornet. Licensed under the Apache License, Version 2.0. * @warning This sketch is based on a wiring diagram, and was not yet tested on hardware. (Remove this line once tested on hardware and in system.) - * @brief Header file for the backlighting to split out code for panel specific lighting support.c:\Users\Thoma\Documents\Arduino\2A13-BACKLIGHT_CONTROLLER\OH_BL_PANELS\1A4_L_EWI.h + * @brief Header file for the backlighting to split out code for panel specific lighting support. */ #include "DcsBios.h" From 248f576f6cba58293a7cc1adb7ac3bdd14121c21 Mon Sep 17 00:00:00 2001 From: Arribe <47125808+Arribe@users.noreply.github.com> Date: Tue, 26 Mar 2024 00:00:37 -0500 Subject: [PATCH 04/16] refactored to remove header subfolder The CI hates subfolders. --- .../{OH_BL_PANELS => }/1A2A1_MASTER_ARM_BL.h | 2 +- .../{OH_BL_PANELS => }/1A4_L_EWI_BL.h | 0 .../2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h | 6 +++--- 3 files changed, 4 insertions(+), 4 deletions(-) rename embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/{OH_BL_PANELS => }/1A2A1_MASTER_ARM_BL.h (96%) rename embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/{OH_BL_PANELS => }/1A4_L_EWI_BL.h (100%) diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/OH_BL_PANELS/1A2A1_MASTER_ARM_BL.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A2A1_MASTER_ARM_BL.h similarity index 96% rename from embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/OH_BL_PANELS/1A2A1_MASTER_ARM_BL.h rename to embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A2A1_MASTER_ARM_BL.h index ebf3a74..ac950d1 100644 --- a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/OH_BL_PANELS/1A2A1_MASTER_ARM_BL.h +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A2A1_MASTER_ARM_BL.h @@ -42,7 +42,7 @@ #include "DcsBios.h" #include "Adafruit_NeoPixel.h" -#define READY_START 0 + MASTER_ARM_LED_START_INDEX +#define READY_START 0 + MASTER_ARM_LED_START_INDEXd:\OpenHornet-Software\embedded\OH2_Lower_Instrument_Panel\2A13-BACKLIGHT_CONTROLLER\OH_BL_PANELS\1A4_L_EWI_BL.h #define READY_COUNT 2 #define DISCH_START 2 + MASTER_ARM_LED_START_INDEX #define DISCH_COUNT 2 diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/OH_BL_PANELS/1A4_L_EWI_BL.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A4_L_EWI_BL.h similarity index 100% rename from embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/OH_BL_PANELS/1A4_L_EWI_BL.h rename to embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A4_L_EWI_BL.h diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h index 2a489e4..246c567 100644 --- a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h @@ -27,7 +27,7 @@ * Non-Commercial - Share Alike License. (CC BY-NC-SA 4.0) * ---------------------------------------------------------------------------------- * This Project uses Doxygen as a documentation generator. - * Please use Doxygen capable comments. + * Please use Doxygen capable comments.d:\OpenHornet-Software\embedded\OH2_Lower_Instrument_Panel\2A13-BACKLIGHT_CONTROLLER\OH_BL_PANELS\1A2A1_MASTER_ARM_BL.h **************************************************************************************/ /** * @file 2A13-BACKLIGHT_CONTROLLER.H @@ -56,8 +56,8 @@ Adafruit_NeoPixel uipBLCh1 = Adafruit_NeoPixel(UIP_LED_COUNT, UIP_BL_CH1, NEO_GRB + NEO_KHZ800); -#include "OH_BL_PANELS\1A2A1_MASTER_ARM_BL.h" -#include "OH_BL_PANELS\1A4_L_EWI_BL.h" +#include "1A2A1_MASTER_ARM_BL.h" +#include "1A4_L_EWI_BL.h" namespace OpenHornet { void setup() { From 05308845b836b4a6b8f46e0e28ceee34f091382c Mon Sep 17 00:00:00 2001 From: Arribe <47125808+Arribe@users.noreply.github.com> Date: Tue, 26 Mar 2024 00:05:59 -0500 Subject: [PATCH 05/16] fixed copy and paste errors. --- .../2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h | 6 +++--- .../2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.ino | 2 +- .../{ => OH_BL_PANELS}/1A2A1_MASTER_ARM_BL.h | 4 ++-- .../{ => OH_BL_PANELS}/1A4_L_EWI_BL.h | 0 4 files changed, 6 insertions(+), 6 deletions(-) rename embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/{ => OH_BL_PANELS}/1A2A1_MASTER_ARM_BL.h (96%) rename embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/{ => OH_BL_PANELS}/1A4_L_EWI_BL.h (100%) diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h index 246c567..2a489e4 100644 --- a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h @@ -27,7 +27,7 @@ * Non-Commercial - Share Alike License. (CC BY-NC-SA 4.0) * ---------------------------------------------------------------------------------- * This Project uses Doxygen as a documentation generator. - * Please use Doxygen capable comments.d:\OpenHornet-Software\embedded\OH2_Lower_Instrument_Panel\2A13-BACKLIGHT_CONTROLLER\OH_BL_PANELS\1A2A1_MASTER_ARM_BL.h + * Please use Doxygen capable comments. **************************************************************************************/ /** * @file 2A13-BACKLIGHT_CONTROLLER.H @@ -56,8 +56,8 @@ Adafruit_NeoPixel uipBLCh1 = Adafruit_NeoPixel(UIP_LED_COUNT, UIP_BL_CH1, NEO_GRB + NEO_KHZ800); -#include "1A2A1_MASTER_ARM_BL.h" -#include "1A4_L_EWI_BL.h" +#include "OH_BL_PANELS\1A2A1_MASTER_ARM_BL.h" +#include "OH_BL_PANELS\1A4_L_EWI_BL.h" namespace OpenHornet { void setup() { diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.ino b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.ino index 3722ed3..b238e39 100644 --- a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.ino +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.ino @@ -104,7 +104,7 @@ //#define 4 ///< J11 NC #define SIMPWR_BLM_A 24 ///< J14 SIMPWR_BLM_A #define SIMPWR_BLM_B 23 ///< J14 SIMPWR_BLM_B -#define SIMPWR_PUSH 22 ///< J14 SIMPWR_PUSHc:\Users\Thoma\Documents\Arduino\2A13-BACKLIGHT_CONTROLLER\OH_BL_PANELS\1A2A1_MASTER_ARM_BL.h +#define SIMPWR_PUSH 22 ///< J14 SIMPWR_PUSH //#define SDA | TEMP SNSR //#define SCL | TEMP SNSR #define COOLING_FANS 2 ///< J12 & J13 Cooling fan headers. diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A2A1_MASTER_ARM_BL.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/OH_BL_PANELS/1A2A1_MASTER_ARM_BL.h similarity index 96% rename from embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A2A1_MASTER_ARM_BL.h rename to embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/OH_BL_PANELS/1A2A1_MASTER_ARM_BL.h index ac950d1..351cd22 100644 --- a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A2A1_MASTER_ARM_BL.h +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/OH_BL_PANELS/1A2A1_MASTER_ARM_BL.h @@ -42,7 +42,7 @@ #include "DcsBios.h" #include "Adafruit_NeoPixel.h" -#define READY_START 0 + MASTER_ARM_LED_START_INDEXd:\OpenHornet-Software\embedded\OH2_Lower_Instrument_Panel\2A13-BACKLIGHT_CONTROLLER\OH_BL_PANELS\1A4_L_EWI_BL.h +#define READY_START 0 + MASTER_ARM_LED_START_INDEX #define READY_COUNT 2 #define DISCH_START 2 + MASTER_ARM_LED_START_INDEX #define DISCH_COUNT 2 @@ -108,7 +108,7 @@ void onMasterModeAaLtChange(unsigned int newValue) { uipBLCh1.show(); break; case 1: - uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), MM_AA_START, MM_AA_COUNT); ///< Set light to Green + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), MM_AA_START, MM_AA_COUNT); ///< Set light to Greend:\OpenHornet-Software\embedded\OH2_Lower_Instrument_Panel\2A13-BACKLIGHT_CONTROLLER\OH_BL_PANELS\1A4_L_EWI_BL.h uipBLCh1.show(); break; } diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A4_L_EWI_BL.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/OH_BL_PANELS/1A4_L_EWI_BL.h similarity index 100% rename from embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A4_L_EWI_BL.h rename to embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/OH_BL_PANELS/1A4_L_EWI_BL.h From 2d94a20466d4ee347491f33574f1a52dd0737dca Mon Sep 17 00:00:00 2001 From: Arribe <47125808+Arribe@users.noreply.github.com> Date: Tue, 26 Mar 2024 00:09:41 -0500 Subject: [PATCH 06/16] Update 2A13-BACKLIGHT_CONTROLLER.h trying to get the CI automation to work with header sub-folder. --- .../2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h index 2a489e4..73c4ec0 100644 --- a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h @@ -56,8 +56,8 @@ Adafruit_NeoPixel uipBLCh1 = Adafruit_NeoPixel(UIP_LED_COUNT, UIP_BL_CH1, NEO_GRB + NEO_KHZ800); -#include "OH_BL_PANELS\1A2A1_MASTER_ARM_BL.h" -#include "OH_BL_PANELS\1A4_L_EWI_BL.h" +#include ".\OH_BL_PANELS\1A2A1_MASTER_ARM_BL.h" +#include ".\OH_BL_PANELS\1A4_L_EWI_BL.h" namespace OpenHornet { void setup() { From 7043e8108582567219e9cce0144e95908d96f953 Mon Sep 17 00:00:00 2001 From: Arribe <47125808+Arribe@users.noreply.github.com> Date: Tue, 26 Mar 2024 00:11:55 -0500 Subject: [PATCH 07/16] refactored to remove the BL header subfolder. --- .../{OH_BL_PANELS => }/1A2A1_MASTER_ARM_BL.h | 0 .../{OH_BL_PANELS => }/1A4_L_EWI_BL.h | 0 .../2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h | 4 ++-- 3 files changed, 2 insertions(+), 2 deletions(-) rename embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/{OH_BL_PANELS => }/1A2A1_MASTER_ARM_BL.h (100%) rename embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/{OH_BL_PANELS => }/1A4_L_EWI_BL.h (100%) diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/OH_BL_PANELS/1A2A1_MASTER_ARM_BL.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A2A1_MASTER_ARM_BL.h similarity index 100% rename from embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/OH_BL_PANELS/1A2A1_MASTER_ARM_BL.h rename to embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A2A1_MASTER_ARM_BL.h diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/OH_BL_PANELS/1A4_L_EWI_BL.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A4_L_EWI_BL.h similarity index 100% rename from embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/OH_BL_PANELS/1A4_L_EWI_BL.h rename to embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A4_L_EWI_BL.h diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h index 73c4ec0..fe43a04 100644 --- a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h @@ -56,8 +56,8 @@ Adafruit_NeoPixel uipBLCh1 = Adafruit_NeoPixel(UIP_LED_COUNT, UIP_BL_CH1, NEO_GRB + NEO_KHZ800); -#include ".\OH_BL_PANELS\1A2A1_MASTER_ARM_BL.h" -#include ".\OH_BL_PANELS\1A4_L_EWI_BL.h" +#include "1A2A1_MASTER_ARM_BL.h" +#include "1A4_L_EWI_BL.h" namespace OpenHornet { void setup() { From 8d32405cff5765d8d76521d451b6d064977db78e Mon Sep 17 00:00:00 2001 From: Arribe <47125808+Arribe@users.noreply.github.com> Date: Tue, 26 Mar 2024 00:15:37 -0500 Subject: [PATCH 08/16] Update Makefile removed joystick library due to CI failure note. --- .../2A13-BACKLIGHT_CONTROLLER/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/Makefile b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/Makefile index f3e74ef..99bebd8 100644 --- a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/Makefile +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/Makefile @@ -1,5 +1,5 @@ # Any extra libraries included by this sketch (space separated) -LIBRARIES = Adafruit_NeoPixel Servo dcs-bios-arduino-library TCA9534 Wire ArduinoJoystickLibrary +LIBRARIES = Adafruit_NeoPixel Servo dcs-bios-arduino-library TCA9534 Wire # Uncomment one of the following to choose the target board include $(ROOTDIR)/include/mega2560.mk From b9475e5c2769528583f574c816c1d92a05193c45 Mon Sep 17 00:00:00 2001 From: Arribe <47125808+Arribe@users.noreply.github.com> Date: Tue, 26 Mar 2024 12:20:21 -0500 Subject: [PATCH 09/16] Updated comments, refactored onInstPnlDimmerChange onInstPnlDimmerChange controls multiple backlighting channels so needs to be at the top level header so it can fill in the associated UIP/LIP backlighting channel's panels. --- .../1A2A1_MASTER_ARM_BL.h | 21 ++----- .../2A13-BACKLIGHT_CONTROLLER/1A4_L_EWI_BL.h | 7 ++- .../2A13-BACKLIGHT_CONTROLLER.h | 59 ++++++++++++++++--- .../2A13-BACKLIGHT_CONTROLLER.ino | 2 + 4 files changed, 65 insertions(+), 24 deletions(-) diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A2A1_MASTER_ARM_BL.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A2A1_MASTER_ARM_BL.h index 351cd22..04a0432 100644 --- a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A2A1_MASTER_ARM_BL.h +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A2A1_MASTER_ARM_BL.h @@ -39,6 +39,9 @@ * @brief Header file for the Master Arm panel backlighting /w annunciators to split out code for panel specific lighting support. */ +#ifndef __MASTER_ARM_BL_H +#define __MASTER_ARM_BL_H + #include "DcsBios.h" #include "Adafruit_NeoPixel.h" @@ -50,8 +53,8 @@ #define MM_AG_COUNT 2 #define MM_AA_START 27 + MASTER_ARM_LED_START_INDEX #define MM_AA_COUNT 2 -#define BL_START 4 + MASTER_ARM_LED_START_INDEX -#define BL_LENGTH 21 +#define MA_BL_START 4 + MASTER_ARM_LED_START_INDEX +#define MA_BL_LENGTH 21 /** * @brief Setup maserArmPanel's neopixel and then set the DCS Bios methods to read sim state and set @@ -115,16 +118,4 @@ void onMasterModeAaLtChange(unsigned int newValue) { } DcsBios::IntegerBuffer masterModeAaLtBuffer(0x740c, 0x0200, 9, onMasterModeAaLtChange); -void onInstPnlDimmerChange(unsigned int newValue) { - switch (newValue) { - case 0: - uipBLCh1.fill(0, MASTER_ARM_LED_START_INDEX + BL_START, BL_LENGTH); ///< Off - uipBLCh1.show(); - break; - default: - uipBLCh1.fill(uipBLCh1.Color(0, map(newValue, 0, 65535, 0, 255), 0), MASTER_ARM_LED_START_INDEX + BL_START, BL_LENGTH); ///< Set light to Green - uipBLCh1.show(); - break; - } -} -DcsBios::IntegerBuffer instPnlDimmerBuffer(0x7546, 0xffff, 0, onInstPnlDimmerChange); \ No newline at end of file +#endif \ No newline at end of file diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A4_L_EWI_BL.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A4_L_EWI_BL.h index 7e19af9..90d23f2 100644 --- a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A4_L_EWI_BL.h +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A4_L_EWI_BL.h @@ -39,6 +39,9 @@ * @brief Header file for the Left EWI panel annunciators to split out code for panel specific lighting support. */ +#ifndef __L_EWI_BL_H +#define __L_EWI_BL_H + #include "DcsBios.h" #include "Adafruit_NeoPixel.h" @@ -250,4 +253,6 @@ void onLhAdvXmitChange(unsigned int newValue) { break; } } -DcsBios::IntegerBuffer lhAdvXmitBuffer(0x740a, 0x0004, 2, onLhAdvXmitChange); \ No newline at end of file +DcsBios::IntegerBuffer lhAdvXmitBuffer(0x740a, 0x0004, 2, onLhAdvXmitChange); + +#endif \ No newline at end of file diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h index fe43a04..f983b63 100644 --- a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h @@ -36,7 +36,7 @@ * @version u.0.0.1 (untested) * @copyright Copyright 2016-2024 OpenHornet. Licensed under the Apache License, Version 2.0. * @warning This sketch is based on a wiring diagram, and was not yet tested on hardware. (Remove this line once tested on hardware and in system.) - * @brief Header file for the backlighting to split out code for panel specific lighting support. + * @brief Header file for the DCSBios backlighting to split out code for panel specific lighting support. */ #include "DcsBios.h" @@ -44,25 +44,68 @@ /** * @brief UIP Backlights -* @todo Add if defined statements here to test if the panels are included prior to including them in the main LED counts. +* +* The Panels are listed in the order they appear according to the interconnect guide. +* If any panels are not connected, change the associtated LED COUNT to 0, comment out its header, +* and adjust the other panels' start index accordingly. +* */ -#define MASTER_ARM_LED_START_INDEX 0 -#define MA_LED_COUNT 29 +#define MASTER_ARM_LED_START_INDEX 0 ///< Master Arm panel is the first in the UIP BL Channel 1 string. +#define MA_LED_COUNT 29 ///< Master Arm panel has 29 pixels. -#define L_EWI_LED_START_INDEX 29 -#define L_EWI_LED_COUNT 30 +#define L_EWI_LED_START_INDEX 29 ///< L_EWI is the second panel in the UIP BL Channel 1 string. +#define L_EWI_LED_COUNT 30 ///< L EWI panel has 30 pixels. -#define UIP_LED_COUNT MA_LED_COUNT + L_EWI_LED_COUNT +#define UIP_LED_COUNT MA_LED_COUNT + L_EWI_LED_COUNT ///< add up the connected panels pixel count for the Adafruit_NeoPixel string. Adafruit_NeoPixel uipBLCh1 = Adafruit_NeoPixel(UIP_LED_COUNT, UIP_BL_CH1, NEO_GRB + NEO_KHZ800); +// Include the connected panels. If any panel not connected comment out its header. #include "1A2A1_MASTER_ARM_BL.h" #include "1A4_L_EWI_BL.h" +/** +* @brief LIP Backlights +* @todo all the backlight code / headers. +*/ + +#define LIP_LED_COUNT 10 ///< place holder, replace with actual count method similar to above. + +Adafruit_NeoPixel lipBLCh1 = Adafruit_NeoPixel(LIP_LED_COUNT, LIP_BL_CH1, NEO_GRB + NEO_KHZ800); + +/// @todo If we don't want the namespace rename the setup function and use it in 2A13-BACKLIGHT_CONTROLLER.ino's setup loop, as there can only be one setup per Arduino skectch. namespace OpenHornet { void setup() { uipBLCh1.begin(); - uipBLCh1.show(); + uipBLCh1.show(); // Clear the LEDs uipBLCh1.setBrightness(BRIGHTNESS); + + lipBLCh1.begin(); + lipBLCh1.show(); // Clear the LEDs + lipBLCh1.setBrightness(BRIGHTNESS); +} } + +/** +* This is the DcsBios hook into the Internal Light panel's Instrument Panel Dimmer pot. +* The use of headers and ifdefs should help avoid users from having to manually update the code for any unconnected panels if the associated headers are commented out above. +* +* @todo Add all the backlighting channels and associated panels that run off the onInstPnlDimmerChange pot to light up all the connected panels' backlighting pixels. +*/ +void onInstPnlDimmerChange(unsigned int newValue) { + switch (newValue) { + case 0: + #ifdef __MASTER_ARM_BL_H + uipBLCh1.fill(0, MA_BL_START, MA_BL_LENGTH); ///< Off + #endif + uipBLCh1.show(); + break; + default: + #ifdef __MASTER_ARM_BL_H + uipBLCh1.fill(uipBLCh1.Color(0, map(newValue, 0, 65535, 0, 255), 0), MA_BL_START, MA_BL_LENGTH); ///< Set light to Green + #endif + uipBLCh1.show(); + break; + } } +DcsBios::IntegerBuffer instPnlDimmerBuffer(0x7546, 0xffff, 0, onInstPnlDimmerChange); diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.ino b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.ino index b238e39..ea098fb 100644 --- a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.ino +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.ino @@ -38,6 +38,8 @@ * @warning This sketch is based on a wiring diagram, and was not yet tested on hardware. (Remove this line once tested on hardware and in system.) * @brief Controls the backlighting (and some annunciators) for the entire pit. * + * @Ttodo + * * @details * * * **Reference Designator:** 2A13 From 69eb9059a49aa1157a440069aa941297471c795b Mon Sep 17 00:00:00 2001 From: Arribe <47125808+Arribe@users.noreply.github.com> Date: Tue, 26 Mar 2024 12:31:50 -0500 Subject: [PATCH 10/16] Update 2A13-BACKLIGHT_CONTROLLER.h --- .../2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h index f983b63..844fc1f 100644 --- a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h @@ -73,7 +73,7 @@ Adafruit_NeoPixel uipBLCh1 = Adafruit_NeoPixel(UIP_LED_COUNT, UIP_BL_CH1, NEO_GR Adafruit_NeoPixel lipBLCh1 = Adafruit_NeoPixel(LIP_LED_COUNT, LIP_BL_CH1, NEO_GRB + NEO_KHZ800); -/// @todo If we don't want the namespace rename the setup function and use it in 2A13-BACKLIGHT_CONTROLLER.ino's setup loop, as there can only be one setup per Arduino skectch. +/// @todo If we don't want the namespace rename the setup function and use it in 2A13-BACKLIGHT_CONTROLLER.ino's setup loop, so there is only be one setup per Arduino skectch. namespace OpenHornet { void setup() { uipBLCh1.begin(); From c7f1c9997eeca8a7bdef91a30421f792be484283 Mon Sep 17 00:00:00 2001 From: Arribe <47125808+Arribe@users.noreply.github.com> Date: Tue, 26 Mar 2024 14:44:19 -0500 Subject: [PATCH 11/16] Update New Hud Panel H Updated comments and added HUD Panel header. --- .../1A2A1_MASTER_ARM_BL.h | 23 +++---- .../2A13-BACKLIGHT_CONTROLLER/1A4_L_EWI_BL.h | 52 +++++++------- .../1A7A1_HUD_PANEL_BL.h | 69 +++++++++++++++++++ .../2A13-BACKLIGHT_CONTROLLER.h | 16 ++++- 4 files changed, 119 insertions(+), 41 deletions(-) create mode 100644 embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A7A1_HUD_PANEL_BL.h diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A2A1_MASTER_ARM_BL.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A2A1_MASTER_ARM_BL.h index 04a0432..08f8d53 100644 --- a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A2A1_MASTER_ARM_BL.h +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A2A1_MASTER_ARM_BL.h @@ -45,16 +45,16 @@ #include "DcsBios.h" #include "Adafruit_NeoPixel.h" -#define READY_START 0 + MASTER_ARM_LED_START_INDEX -#define READY_COUNT 2 -#define DISCH_START 2 + MASTER_ARM_LED_START_INDEX -#define DISCH_COUNT 2 -#define MM_AG_START 25 + MASTER_ARM_LED_START_INDEX -#define MM_AG_COUNT 2 -#define MM_AA_START 27 + MASTER_ARM_LED_START_INDEX -#define MM_AA_COUNT 2 -#define MA_BL_START 4 + MASTER_ARM_LED_START_INDEX -#define MA_BL_LENGTH 21 +#define READY_START 0 + MASTER_ARM_LED_START_INDEX ///< Index 1st READY pixel +#define READY_COUNT 2 ///< READY pixel count +#define DISCH_START 2 + MASTER_ARM_LED_START_INDEX ///< Index 1st DISCH pixel +#define DISCH_COUNT 2 ///< DISCH pixel count +#define MM_AG_START 25 + MASTER_ARM_LED_START_INDEX ///< Index 1st A/G pixel +#define MM_AG_COUNT 2 ///< A/G pixel count +#define MM_AA_START 27 + MASTER_ARM_LED_START_INDEX ///< Index 1st A/A pixel +#define MM_AA_COUNT 2 ///< A/A pixel count +#define MA_BL_START 4 + MASTER_ARM_LED_START_INDEX ///< Indes for 1st Master Arm panel backlight pixel +#define MA_BL_LENGTH 21 ///< Master Arm panel backlight pixel count /** * @brief Setup maserArmPanel's neopixel and then set the DCS Bios methods to read sim state and set @@ -111,8 +111,7 @@ void onMasterModeAaLtChange(unsigned int newValue) { uipBLCh1.show(); break; case 1: - uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), MM_AA_START, MM_AA_COUNT); ///< Set light to Greend:\OpenHornet-Software\embedded\OH2_Lower_Instrument_Panel\2A13-BACKLIGHT_CONTROLLER\OH_BL_PANELS\1A4_L_EWI_BL.h - uipBLCh1.show(); + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), MM_AA_START, MM_AA_COUNT); ///< Set light to Green break; } } diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A4_L_EWI_BL.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A4_L_EWI_BL.h index 90d23f2..39ccd61 100644 --- a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A4_L_EWI_BL.h +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A4_L_EWI_BL.h @@ -45,32 +45,32 @@ #include "DcsBios.h" #include "Adafruit_NeoPixel.h" -#define FIRE_START 0 + L_EWI_LED_START_INDEX -#define FIRE_COUNT 4 -#define MC_START 4 + L_EWI_LED_START_INDEX -#define MC_COUNT 4 -#define GO_START 8 + L_EWI_LED_START_INDEX -#define GO_COUNT 2 -#define NO_GO_START 10 + L_EWI_LED_START_INDEX -#define NO_GO_COUNT 2 -#define R_BLEED_START 12 + L_EWI_LED_START_INDEX -#define R_BLEED_COUNT 2 -#define L_BLEED_START 14 + L_EWI_LED_START_INDEX -#define L_BLEED_COUNT 2 -#define SPD_BRK_START 16 + L_EWI_LED_START_INDEX -#define SPD_BRK_COUNT 2 -#define STBY_START 18 + L_EWI_LED_START_INDEX -#define STBY_COUNT 2 -#define REC_START 20 + L_EWI_LED_START_INDEX -#define REC_COUNT 2 -#define L_BAR1_START 22 + L_EWI_LED_START_INDEX -#define L_BAR1_COUNT 2 -#define L_BAR2_START 24 + L_EWI_LED_START_INDEX -#define L_BAR2_COUNT 2 -#define XMIT_START 26 + L_EWI_LED_START_INDEX -#define XMIT_COUNT 2 -#define ASPJ_ON_START 28 + L_EWI_LED_START_INDEX -#define ASPJ_ON_COUNT 2 +#define FIRE_START 0 + L_EWI_LED_START_INDEX ///< Starting index of the pixel string, FIRE push button switch +#define FIRE_COUNT 4 ///< Number of pixels under the Fire push button. +#define MC_START 4 + L_EWI_LED_START_INDEX ///< Index for pixel for Master Caution pushbutton switch. +#define MC_COUNT 4 ///< Number of pixels under the Master Caution pushbutton. +#define GO_START 8 + L_EWI_LED_START_INDEX ///< Index for 1st Go pixel +#define GO_COUNT 2 ///< Go pixel count +#define NO_GO_START 10 + L_EWI_LED_START_INDEX ///< Index for 1st No_Go pixel +#define NO_GO_COUNT 2 ///< No Go pixel count +#define R_BLEED_START 12 + L_EWI_LED_START_INDEX ///< Index for 1st R Bleed pixel +#define R_BLEED_COUNT 2 ///< R Bleed pixel count +#define L_BLEED_START 14 + L_EWI_LED_START_INDEX ///< Index for 1st L Bleed pixel +#define L_BLEED_COUNT 2 ///< L Bleed pixel count +#define SPD_BRK_START 16 + L_EWI_LED_START_INDEX ///< Index for 1st SPD BRK pixel +#define SPD_BRK_COUNT 2 ///< SPD BRK pixel count +#define STBY_START 18 + L_EWI_LED_START_INDEX ///< Index for 1st STBY pixel +#define STBY_COUNT 2 ///< SBY pixel count +#define REC_START 20 + L_EWI_LED_START_INDEX ///< Index for 1st REC pixel +#define REC_COUNT 2 ///< REC pixel count +#define L_BAR1_START 22 + L_EWI_LED_START_INDEX ///< Index for 1st L_BAR1 pixel +#define L_BAR1_COUNT 2 ///< L_BAR1 pixel count +#define L_BAR2_START 24 + L_EWI_LED_START_INDEX ///< Index for 1st LBAR2 pixel +#define L_BAR2_COUNT 2 ///< L_BAR2 pixel count +#define XMIT_START 26 + L_EWI_LED_START_INDEX ///< Index for 1st XMIT pixel +#define XMIT_COUNT 2 ///< XMIT pixel count. +#define ASPJ_ON_START 28 + L_EWI_LED_START_INDEX /// Index for 1st ASPJ_ON pixel +#define ASPJ_ON_COUNT 2 ///< ASPJ_ON pixel count. void onFireLeftLtChange(unsigned int newValue) { diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A7A1_HUD_PANEL_BL.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A7A1_HUD_PANEL_BL.h new file mode 100644 index 0000000..cadc19a --- /dev/null +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A7A1_HUD_PANEL_BL.h @@ -0,0 +1,69 @@ +/************************************************************************************** + * ____ _ _ _ + * / __ \ | | | | | | + * | | | |_ __ ___ _ __ | |__| | ___ _ __ _ __ ___| |_ + * | | | | '_ \ / _ \ '_ \| __ |/ _ \| '__| '_ \ / _ \ __| + * | |__| | |_) | __/ | | | | | | (_) | | | | | | __/ |_ + * \____/| .__/ \___|_| |_|_| |_|\___/|_| |_| |_|\___|\__| + * | | + * |_| + * ---------------------------------------------------------------------------------- + * Copyright 2016-2024 OpenHornet + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ---------------------------------------------------------------------------------- + * Note: All other portions of OpenHornet not within the 'OpenHornet-Software' + * GitHub repository is released under the Creative Commons Attribution - + * Non-Commercial - Share Alike License. (CC BY-NC-SA 4.0) + * ---------------------------------------------------------------------------------- + * This Project uses Doxygen as a documentation generator. + * Please use Doxygen capable comments. + **************************************************************************************/ +/** + * @file 1A7A1_HUD_PANEL_BL.h + * @author Arribe + * @date 03.25.2024 + * @version u.0.0.1 (untested) + * @copyright Copyright 2016-2024 OpenHornet. Licensed under the Apache License, Version 2.0. + * @warning This sketch is based on a wiring diagram, and was not yet tested on hardware. (Remove this line once tested on hardware and in system.) + * @brief Header file for the HUD panel backlighting. +*/ + +#ifndef __HUD_PANEL_BL_H +#define __HUD_PANEL_BL_H + +#include "DcsBios.h" +#include "Adafruit_NeoPixel.h" + +#define HUD_REJECT_START 0 + HUD_PANEL_START_INDEX ///< Index 1st HUD REJECT pixel +#define HUD_REJECT_COUNT 6 ///< HUD REJECT pixel count +#define HUD_BRT_START 6 + HUD_PANEL_START_INDEX ///< Index 1st HUD BRT pixel +#define HUD_BRT_COUNT 4 ///< HUD BRT pixel count +#define HUD_MODE_START 10 + HUD_PANEL_START_INDEX ///< Index 1st HUD MODE pixel +#define HUD_MODE_COUNT 5 ///< HUD MODE pixel count +#define BLK_LVL_START 15 + HUD_PANEL_START_INDEX ///< Index 1st BLK LVL pixel +#define BLK_LVL_COUNT 6 ///< BLK LVL pixel count +#define WB_START 21 + HUD_PANEL_START_INDEX ///< Index 1st WB pixel +#define WB_COUNT 5 ///< WB pixel count +#define BAL_START 26 + HUD_PANEL_START_INDEX ///< Index 1st BAL pixel +#define BAL_COUNT 5 ///< BAL pixel count. +#define ATT_START 31 + HUD_PANEL_START_INDEX ///< Index 1st ATT pixel +#define ATT_COUNT 6 ///< ATT pixel count. +#define ALT_START 37 + HUD_PANEL_START_INDEX ///< Index 1st ALT pixel +#define ALT_COUNT 7 ///< ALT pixel count. +#define AOA_START 44 + HUD_PANEL_START_INDEX ///< Index 1st AOA pixel +#define AOA_COUNT 5 ///< AOA pixel count +#define HUD_PANEL_BL_START 0 + HUD_PANEL_START_INDEX ///< Index of 1st pixel in the backlighting string +#define HUD_PANEL_BL_LENGTH 50 ///< Number of pixels in the backlighting string + +#endif \ No newline at end of file diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h index 844fc1f..88c733e 100644 --- a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h @@ -51,18 +51,22 @@ * */ #define MASTER_ARM_LED_START_INDEX 0 ///< Master Arm panel is the first in the UIP BL Channel 1 string. -#define MA_LED_COUNT 29 ///< Master Arm panel has 29 pixels. +#define MA_LED_COUNT 29 ///< Master Arm panel has 29 pixels with backlighting. #define L_EWI_LED_START_INDEX 29 ///< L_EWI is the second panel in the UIP BL Channel 1 string. -#define L_EWI_LED_COUNT 30 ///< L EWI panel has 30 pixels. +#define L_EWI_LED_COUNT 30 ///< L EWI panel has 30 pixels, no backlighting. + +#define HUD_PANEL_START_INDEX 59 ///< HUD_PANEL is the 3rd panel in the UIP BL Channel 1 string. +#define HUD_PANEL_LED_COUNT 50 ///< HUD_PANEL had 50 pixels, all for backlighting. #define UIP_LED_COUNT MA_LED_COUNT + L_EWI_LED_COUNT ///< add up the connected panels pixel count for the Adafruit_NeoPixel string. Adafruit_NeoPixel uipBLCh1 = Adafruit_NeoPixel(UIP_LED_COUNT, UIP_BL_CH1, NEO_GRB + NEO_KHZ800); // Include the connected panels. If any panel not connected comment out its header. -#include "1A2A1_MASTER_ARM_BL.h" +#include "1A2A1_MASTER_ARM_BL.h" #include "1A4_L_EWI_BL.h" +#include "1A7A1_HUD_PANEL_BL.h" /** * @brief LIP Backlights @@ -98,12 +102,18 @@ void onInstPnlDimmerChange(unsigned int newValue) { #ifdef __MASTER_ARM_BL_H uipBLCh1.fill(0, MA_BL_START, MA_BL_LENGTH); ///< Off #endif + #ifdef __HUD_PANEL_BL_H + uipBLCh1.fill(0, HUD_PANEL_BL_START, HUD_PANEL_BL_LENGTH); ///< Off + #endif uipBLCh1.show(); break; default: #ifdef __MASTER_ARM_BL_H uipBLCh1.fill(uipBLCh1.Color(0, map(newValue, 0, 65535, 0, 255), 0), MA_BL_START, MA_BL_LENGTH); ///< Set light to Green #endif + #ifdef __HUD_PANEL_BL_H + uipBLCh1.fill(uipBLCh1.Color(0, map(newValue, 0, 65535, 0, 255), 0), HUD_PANEL_BL_START, HUD_PANEL_BL_LENGTH); ///< Set light to Green + #endif uipBLCh1.show(); break; } From 1640365a46f5fc05f079aced451dbf735f89bb19 Mon Sep 17 00:00:00 2001 From: Arribe <47125808+Arribe@users.noreply.github.com> Date: Tue, 26 Mar 2024 16:39:55 -0500 Subject: [PATCH 12/16] updated based on rev4 hardware. --- .../1A7A1_HUD_PANEL_BL.h | 16 ++++++++-------- .../2A13-BACKLIGHT_CONTROLLER.h | 7 ++++--- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A7A1_HUD_PANEL_BL.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A7A1_HUD_PANEL_BL.h index cadc19a..1c16ee1 100644 --- a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A7A1_HUD_PANEL_BL.h +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A7A1_HUD_PANEL_BL.h @@ -50,20 +50,20 @@ #define HUD_BRT_START 6 + HUD_PANEL_START_INDEX ///< Index 1st HUD BRT pixel #define HUD_BRT_COUNT 4 ///< HUD BRT pixel count #define HUD_MODE_START 10 + HUD_PANEL_START_INDEX ///< Index 1st HUD MODE pixel -#define HUD_MODE_COUNT 5 ///< HUD MODE pixel count -#define BLK_LVL_START 15 + HUD_PANEL_START_INDEX ///< Index 1st BLK LVL pixel +#define HUD_MODE_COUNT 6 ///< HUD MODE pixel count +#define BLK_LVL_START 16 + HUD_PANEL_START_INDEX ///< Index 1st BLK LVL pixel #define BLK_LVL_COUNT 6 ///< BLK LVL pixel count -#define WB_START 21 + HUD_PANEL_START_INDEX ///< Index 1st WB pixel +#define WB_START 22 + HUD_PANEL_START_INDEX ///< Index 1st WB pixel #define WB_COUNT 5 ///< WB pixel count -#define BAL_START 26 + HUD_PANEL_START_INDEX ///< Index 1st BAL pixel +#define BAL_START 27 + HUD_PANEL_START_INDEX ///< Index 1st BAL pixel #define BAL_COUNT 5 ///< BAL pixel count. -#define ATT_START 31 + HUD_PANEL_START_INDEX ///< Index 1st ATT pixel +#define ATT_START 32 + HUD_PANEL_START_INDEX ///< Index 1st ATT pixel #define ATT_COUNT 6 ///< ATT pixel count. -#define ALT_START 37 + HUD_PANEL_START_INDEX ///< Index 1st ALT pixel +#define ALT_START 38 + HUD_PANEL_START_INDEX ///< Index 1st ALT pixel #define ALT_COUNT 7 ///< ALT pixel count. -#define AOA_START 44 + HUD_PANEL_START_INDEX ///< Index 1st AOA pixel +#define AOA_START 45 + HUD_PANEL_START_INDEX ///< Index 1st AOA pixel #define AOA_COUNT 5 ///< AOA pixel count #define HUD_PANEL_BL_START 0 + HUD_PANEL_START_INDEX ///< Index of 1st pixel in the backlighting string -#define HUD_PANEL_BL_LENGTH 50 ///< Number of pixels in the backlighting string +#define HUD_PANEL_BL_LENGTH 50 ///< Number of pixels in the backlighting string, rev4 hardware has 50 LEDs, rev3 had 56. #endif \ No newline at end of file diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h index 88c733e..9ab4703 100644 --- a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h @@ -57,9 +57,9 @@ #define L_EWI_LED_COUNT 30 ///< L EWI panel has 30 pixels, no backlighting. #define HUD_PANEL_START_INDEX 59 ///< HUD_PANEL is the 3rd panel in the UIP BL Channel 1 string. -#define HUD_PANEL_LED_COUNT 50 ///< HUD_PANEL had 50 pixels, all for backlighting. +#define HUD_PANEL_LED_COUNT 50 ///< HUD_PANEL rev4 has 50 pixels, all for backlighting. If using an older revision may be 56. -#define UIP_LED_COUNT MA_LED_COUNT + L_EWI_LED_COUNT ///< add up the connected panels pixel count for the Adafruit_NeoPixel string. +#define UIP_LED_COUNT MA_LED_COUNT + L_EWI_LED_COUNT + HUD_PANEL_LED_COUNT ///< add up the connected panels pixel count for the Adafruit_NeoPixel string. Adafruit_NeoPixel uipBLCh1 = Adafruit_NeoPixel(UIP_LED_COUNT, UIP_BL_CH1, NEO_GRB + NEO_KHZ800); @@ -112,7 +112,8 @@ void onInstPnlDimmerChange(unsigned int newValue) { uipBLCh1.fill(uipBLCh1.Color(0, map(newValue, 0, 65535, 0, 255), 0), MA_BL_START, MA_BL_LENGTH); ///< Set light to Green #endif #ifdef __HUD_PANEL_BL_H - uipBLCh1.fill(uipBLCh1.Color(0, map(newValue, 0, 65535, 0, 255), 0), HUD_PANEL_BL_START, HUD_PANEL_BL_LENGTH); ///< Set light to Green + uipBLCh1.fill(uipBLCh1.Color(0, map(newValue, 0, 65535, 0, 255), 0), HUD_PANEL_BL_START, 56); ///< Set light to Green + //uipBLCh1.fill(uipBLCh1.Color(0, map(newValue, 0, 65535, 0, 255), 0), BAL_START, BAL_COUNT); ///< Set light to Green #endif uipBLCh1.show(); break; From 8fa2e60b8b2eac3bdf84213e6941abacd3557d07 Mon Sep 17 00:00:00 2001 From: Arribe <47125808+Arribe@users.noreply.github.com> Date: Tue, 26 Mar 2024 16:46:12 -0500 Subject: [PATCH 13/16] Update 2A13-BACKLIGHT_CONTROLLER.h --- .../2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h index 9ab4703..413aff5 100644 --- a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h @@ -112,8 +112,7 @@ void onInstPnlDimmerChange(unsigned int newValue) { uipBLCh1.fill(uipBLCh1.Color(0, map(newValue, 0, 65535, 0, 255), 0), MA_BL_START, MA_BL_LENGTH); ///< Set light to Green #endif #ifdef __HUD_PANEL_BL_H - uipBLCh1.fill(uipBLCh1.Color(0, map(newValue, 0, 65535, 0, 255), 0), HUD_PANEL_BL_START, 56); ///< Set light to Green - //uipBLCh1.fill(uipBLCh1.Color(0, map(newValue, 0, 65535, 0, 255), 0), BAL_START, BAL_COUNT); ///< Set light to Green + uipBLCh1.fill(uipBLCh1.Color(0, map(newValue, 0, 65535, 0, 255), 0), HUD_PANEL_BL_START, HUD_PANEL_BL_LENGTH); ///< Set light to Green #endif uipBLCh1.show(); break; From 5595c003fa340c6c2f8ac6df753baa0682f563af Mon Sep 17 00:00:00 2001 From: Arribe <47125808+Arribe@users.noreply.github.com> Date: Tue, 26 Mar 2024 16:57:54 -0500 Subject: [PATCH 14/16] Update 2A13-BACKLIGHT_CONTROLLER.h --- .../2A13-BACKLIGHT_CONTROLLER.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h index 413aff5..c75c4fb 100644 --- a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h @@ -61,7 +61,7 @@ #define UIP_LED_COUNT MA_LED_COUNT + L_EWI_LED_COUNT + HUD_PANEL_LED_COUNT ///< add up the connected panels pixel count for the Adafruit_NeoPixel string. -Adafruit_NeoPixel uipBLCh1 = Adafruit_NeoPixel(UIP_LED_COUNT, UIP_BL_CH1, NEO_GRB + NEO_KHZ800); +Adafruit_NeoPixel uipBLCh1 = Adafruit_NeoPixel(UIP_LED_COUNT, UIP_BL_CH1, NEO_GRB + NEO_KHZ800); ///< Setup the UIP BL Ch1 string. // Include the connected panels. If any panel not connected comment out its header. #include "1A2A1_MASTER_ARM_BL.h" @@ -75,11 +75,12 @@ Adafruit_NeoPixel uipBLCh1 = Adafruit_NeoPixel(UIP_LED_COUNT, UIP_BL_CH1, NEO_GR #define LIP_LED_COUNT 10 ///< place holder, replace with actual count method similar to above. -Adafruit_NeoPixel lipBLCh1 = Adafruit_NeoPixel(LIP_LED_COUNT, LIP_BL_CH1, NEO_GRB + NEO_KHZ800); +Adafruit_NeoPixel lipBLCh1 = Adafruit_NeoPixel(LIP_LED_COUNT, LIP_BL_CH1, NEO_GRB + NEO_KHZ800); ///< Setup the LIP BL Ch1 string. -/// @todo If we don't want the namespace rename the setup function and use it in 2A13-BACKLIGHT_CONTROLLER.ino's setup loop, so there is only be one setup per Arduino skectch. -namespace OpenHornet { -void setup() { + +namespace OpenHornet { +/// @todo If we don't want the namespace rename the setup function and use it in 2A13-BACKLIGHT_CONTROLLER.ino's setup loop, so there is only one setup() per Arduino skectch. +void setup() { uipBLCh1.begin(); uipBLCh1.show(); // Clear the LEDs uipBLCh1.setBrightness(BRIGHTNESS); From f55b20c4e5134bec9bb88c329217b3396e3e80f0 Mon Sep 17 00:00:00 2001 From: Arribe <47125808+Arribe@users.noreply.github.com> Date: Tue, 26 Mar 2024 20:58:07 -0500 Subject: [PATCH 15/16] added R EWI Panel Added R EWI panel, and updated hud panel to account for my Rev3 hardware using a define. Listed the Rev3 as a todo to remove when finished with programming/testing. --- .../2A13-BACKLIGHT_CONTROLLER/1A5_R_EWI_BL.h | 257 ++++++++++++++++++ .../1A7A1_HUD_PANEL_BL.h | 6 + .../2A13-BACKLIGHT_CONTROLLER.h | 23 +- 3 files changed, 284 insertions(+), 2 deletions(-) create mode 100644 embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A5_R_EWI_BL.h diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A5_R_EWI_BL.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A5_R_EWI_BL.h new file mode 100644 index 0000000..ca9451b --- /dev/null +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A5_R_EWI_BL.h @@ -0,0 +1,257 @@ +/************************************************************************************** + * ____ _ _ _ + * / __ \ | | | | | | + * | | | |_ __ ___ _ __ | |__| | ___ _ __ _ __ ___| |_ + * | | | | '_ \ / _ \ '_ \| __ |/ _ \| '__| '_ \ / _ \ __| + * | |__| | |_) | __/ | | | | | | (_) | | | | | | __/ |_ + * \____/| .__/ \___|_| |_|_| |_|\___/|_| |_| |_|\___|\__| + * | | + * |_| + * ---------------------------------------------------------------------------------- + * Copyright 2016-2024 OpenHornet + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ---------------------------------------------------------------------------------- + * Note: All other portions of OpenHornet not within the 'OpenHornet-Software' + * GitHub repository is released under the Creative Commons Attribution - + * Non-Commercial - Share Alike License. (CC BY-NC-SA 4.0) + * ---------------------------------------------------------------------------------- + * This Project uses Doxygen as a documentation generator. + * Please use Doxygen capable comments. + **************************************************************************************/ +/** + * @file 1A5_R_EWI_BL.h + * @author Arribe + * @date 03.25.2024 + * @version u.0.0.1 (untested) + * @copyright Copyright 2016-2024 OpenHornet. Licensed under the Apache License, Version 2.0. + * @warning This sketch is based on a wiring diagram, and was not yet tested on hardware. (Remove this line once tested on hardware and in system.) + * @brief Header file for the Right EWI panel annunciators to split out code for panel specific lighting support. +*/ + +#ifndef __R_EWI_BL_H +#define __R_EWI_BL_H + +#include "DcsBios.h" +#include "Adafruit_NeoPixel.h" + +#define R_FIRE_START 0 + R_EWI_LED_START_INDEX ///< Starting index of the pixel string, FIRE push button switch +#define R_FIRE_COUNT 4 ///< Number of pixels under the Fire push button. +#define APU_FIRE_START 4 + R_EWI_LED_START_INDEX ///< Index for pixel for APU Fire pushbutton switch. +#define APU_FIRE_COUNT 4 ///< Number of pixels under the APU Fire pushbutton. +#define DISP_START 8 + R_EWI_LED_START_INDEX ///< Index for 1st DISP pixel +#define DISP_COUNT 2 ///< DISP pixel count +#define RCDRON_ON_START 10 + R_EWI_LED_START_INDEX ///< Index for 1st RCDRON ON pixel +#define RCDRON_ON_COUNT 2 ///< RCDRON ON pixel count +#define L_BLANK_START 12 + R_EWI_LED_START_INDEX ///< Index for 1st BLANK pixel +#define L_BLANK_COUNT 2 ///< R Bleed pixel count +#define R_BLANK_START 14 + R_EWI_LED_START_INDEX ///< Index for 1st BLANK pixel +#define R_BLANK_COUNT 2 ///< BLANK pixel count +#define R_BLANK2_START 16 + R_EWI_LED_START_INDEX ///< Index for 1st BLANK pixel +#define R_BLANK2_COUNT 2 ///< BLANK pixel count +#define L_BLANK2_START 18 + R_EWI_LED_START_INDEX ///< Index for 1st BLANK pixel +#define L_BLANK2_COUNT 2 ///< BLANK pixel count +#define L_BLANK3_START 20 + R_EWI_LED_START_INDEX ///< Index for 1st BLANK pixel +#define L_BLANK3_COUNT 2 ///< BLANK pixel count +#define SAM_START 22 + R_EWI_LED_START_INDEX ///< Index for 1st SAM pixel +#define SAM_COUNT 2 ///< SAM pixel count +#define AAA_START 24 + R_EWI_LED_START_INDEX ///< Index for 1st AAA pixel +#define AAA_COUNT 2 ///< AAA pixel count +#define AI_START 26 + R_EWI_LED_START_INDEX ///< Index for 1st AI pixel +#define AI_COUNT 2 ///< AI pixel count. +#define CW_START 28 + R_EWI_LED_START_INDEX /// Index for 1st CW pixel +#define CW_COUNT 2 ///< CW pixel count. + +void onFireRightLtChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, R_FIRE_START, R_FIRE_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(255, 0, 0), R_FIRE_START, R_FIRE_COUNT); ///< Set light to Red + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer fireRightLtBuffer(0x740c, 0x0010, 4, onFireRightLtChange); + +void onFireApuLtChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, APU_FIRE_START, APU_FIRE_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(255, 0, 0), APU_FIRE_START, APU_FIRE_COUNT); ///< Set light to Red + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer fireApuLtBuffer(0x740c, 0x0004, 2, onFireApuLtChange); + +void onRhAdvAaaChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, AAA_START, AAA_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), AAA_START, AAA_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer rhAdvAaaBuffer(0x740a, 0x0800, 11, onRhAdvAaaChange); + +void onRhAdvAiChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, AI_START, AI_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), AI_START, AI_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer rhAdvAiBuffer(0x740a, 0x0400, 10, onRhAdvAiChange); + +void onRhAdvCwChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, CW_START, CW_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), CW_START, CW_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer rhAdvCwBuffer(0x740a, 0x1000, 12, onRhAdvCwChange); + +void onRhAdvDispChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, DISP_START, DISP_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), DISP_START, DISP_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer rhAdvDispBuffer(0x740a, 0x0100, 8, onRhAdvDispChange); + +void onRhAdvRcdrOnChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, RCDRON_ON_START, RCDRON_ON_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), RCDRON_ON_START, RCDRON_ON_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer rhAdvRcdrOnBuffer(0x740a, 0x0080, 7, onRhAdvRcdrOnChange); + +void onRhAdvSamChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, SAM_START, SAM_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), SAM_START, SAM_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer rhAdvSamBuffer(0x740a, 0x0200, 9, onRhAdvSamChange); + +void onRhAdvSpareRh1Change(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, L_BLANK_START, L_BLANK_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), L_BLANK_START, L_BLANK_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer rhAdvSpareRh1Buffer(0x740a, 0x2000, 13, onRhAdvSpareRh1Change); + +void onRhAdvSpareRh2Change(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, R_BLANK_START, R_BLANK_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), R_BLANK_START, R_BLANK_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer rhAdvSpareRh2Buffer(0x740a, 0x4000, 14, onRhAdvSpareRh2Change); + +void onRhAdvSpareRh3Change(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, R_BLANK2_START, R_BLANK2_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), R_BLANK2_START, R_BLANK2_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer rhAdvSpareRh3Buffer(0x740a, 0x8000, 15, onRhAdvSpareRh3Change); + +void onRhAdvSpareRh4Change(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, L_BLANK2_START, L_BLANK2_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), L_BLANK2_START, L_BLANK2_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer rhAdvSpareRh4Buffer(0x740c, 0x0001, 0, onRhAdvSpareRh4Change); + +void onRhAdvSpareRh5Change(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, L_BLANK3_START, L_BLANK3_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), L_BLANK3_START, L_BLANK3_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer rhAdvSpareRh5Buffer(0x740c, 0x0002, 1, onRhAdvSpareRh5Change); + +#endif \ No newline at end of file diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A7A1_HUD_PANEL_BL.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A7A1_HUD_PANEL_BL.h index 1c16ee1..1ea035c 100644 --- a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A7A1_HUD_PANEL_BL.h +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A7A1_HUD_PANEL_BL.h @@ -64,6 +64,12 @@ #define AOA_START 45 + HUD_PANEL_START_INDEX ///< Index 1st AOA pixel #define AOA_COUNT 5 ///< AOA pixel count #define HUD_PANEL_BL_START 0 + HUD_PANEL_START_INDEX ///< Index of 1st pixel in the backlighting string + +/// @todo remove ifdef for HUD_PANEL_REV3 as it's for my ease of testing +#ifdef HUD_PANEL_REV3 +#define HUD_PANEL_BL_LENGTH 56 ///< Number of pixels in the backlighting string, rev4 hardware has 50 LEDs, rev3 had 56. +#else #define HUD_PANEL_BL_LENGTH 50 ///< Number of pixels in the backlighting string, rev4 hardware has 50 LEDs, rev3 had 56. +#endif #endif \ No newline at end of file diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h index c75c4fb..738e57b 100644 --- a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h @@ -42,6 +42,9 @@ #include "DcsBios.h" #include "Adafruit_NeoPixel.h" +/// @todo remove ifdef for HUD_PANEL_REV3 as it's for my ease of testing +#define HUD_PANEL_REV3 + /** * @brief UIP Backlights * @@ -57,16 +60,32 @@ #define L_EWI_LED_COUNT 30 ///< L EWI panel has 30 pixels, no backlighting. #define HUD_PANEL_START_INDEX 59 ///< HUD_PANEL is the 3rd panel in the UIP BL Channel 1 string. + +/// @todo remove ifdef for HUD_PANEL_REV3 as it's for my ease of testing +#ifdef HUD_PANEL_REV3 +#define HUD_PANEL_LED_COUNT 56 ///< HUD_PANEL rev4 has 50 pixels, all for backlighting. If using an older revision may be 56. +#else #define HUD_PANEL_LED_COUNT 50 ///< HUD_PANEL rev4 has 50 pixels, all for backlighting. If using an older revision may be 56. +#endif + +/// @todo remove ifdef for HUD_PANEL_REV3 as it's for my ease of testing +#ifdef HUD_PANEL_REV3 +#define R_EWI_LED_START_INDEX 115 ///< R_EWI is the 4th panel in the UIP BL Channel 1 string. +#else +#define R_EWI_LED_START_INDEX 109 ///< R_EWI is the 4th panel in the UIP BL Channel 1 string. +#endif + +#define R_EWI_LED_COUNT 30 ///< R EWI panel has 30 pixels, no backlighting. -#define UIP_LED_COUNT MA_LED_COUNT + L_EWI_LED_COUNT + HUD_PANEL_LED_COUNT ///< add up the connected panels pixel count for the Adafruit_NeoPixel string. +#define UIP_LED_COUNT MA_LED_COUNT + L_EWI_LED_COUNT + HUD_PANEL_LED_COUNT + R_EWI_LED_COUNT ///< add up the connected panels pixel count for the Adafruit_NeoPixel string. Adafruit_NeoPixel uipBLCh1 = Adafruit_NeoPixel(UIP_LED_COUNT, UIP_BL_CH1, NEO_GRB + NEO_KHZ800); ///< Setup the UIP BL Ch1 string. -// Include the connected panels. If any panel not connected comment out its header. +// Include the connected panels. If any panel not connected comment out its header, and change its LED count above along with updating downstream panel(s)' start index. #include "1A2A1_MASTER_ARM_BL.h" #include "1A4_L_EWI_BL.h" #include "1A7A1_HUD_PANEL_BL.h" +#include "1A5_R_EWI_BL.h" /** * @brief LIP Backlights From e4153bbd90aa7f2854a0b746004915a706f5bcd1 Mon Sep 17 00:00:00 2001 From: Arribe <47125808+Arribe@users.noreply.github.com> Date: Wed, 27 Mar 2024 17:10:18 -0500 Subject: [PATCH 16/16] added SPN RCVY Panel --- .../1A6A1_SPN_RCVY_BL.h | 101 ++++++++++++++++++ .../2A13-BACKLIGHT_CONTROLLER.h | 25 ++++- .../2A13-BACKLIGHT_CONTROLLER.ino | 2 +- 3 files changed, 126 insertions(+), 2 deletions(-) create mode 100644 embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A6A1_SPN_RCVY_BL.h diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A6A1_SPN_RCVY_BL.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A6A1_SPN_RCVY_BL.h new file mode 100644 index 0000000..3345369 --- /dev/null +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A6A1_SPN_RCVY_BL.h @@ -0,0 +1,101 @@ +/************************************************************************************** + * ____ _ _ _ + * / __ \ | | | | | | + * | | | |_ __ ___ _ __ | |__| | ___ _ __ _ __ ___| |_ + * | | | | '_ \ / _ \ '_ \| __ |/ _ \| '__| '_ \ / _ \ __| + * | |__| | |_) | __/ | | | | | | (_) | | | | | | __/ |_ + * \____/| .__/ \___|_| |_|_| |_|\___/|_| |_| |_|\___|\__| + * | | + * |_| + * ---------------------------------------------------------------------------------- + * Copyright 2016-2024 OpenHornet + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ---------------------------------------------------------------------------------- + * Note: All other portions of OpenHornet not within the 'OpenHornet-Software' + * GitHub repository is released under the Creative Commons Attribution - + * Non-Commercial - Share Alike License. (CC BY-NC-SA 4.0) + * ---------------------------------------------------------------------------------- + * This Project uses Doxygen as a documentation generator. + * Please use Doxygen capable comments. + **************************************************************************************/ +/** + * @file 1A6A1_SPN_RCVY_BL.h + * @author Arribe + * @date 03.25.2024 + * @version u.0.0.1 (untested) + * @copyright Copyright 2016-2024 OpenHornet. Licensed under the Apache License, Version 2.0. + * @warning This sketch is based on a wiring diagram, and was not yet tested on hardware. (Remove this line once tested on hardware and in system.) + * @brief Header file for the Spin Recovery panel backlighting /w annunciators to split out code for panel specific lighting support. +*/ + +#ifndef __SPN_RCVY_BL_H +#define __SPN_RCVY_BL_H + +#include "DcsBios.h" +#include "Adafruit_NeoPixel.h" + +#define SPN_START 29 + SPN_RCVY_LED_START_INDEX ///< Index 1st SPN pixel +#define SPN_COUNT 1 ///< SPN pixel count +/// @todo remove ifdef for SPN_RCVY_REV3 as it's for my ease of testing +#ifdef SPN_RCVY_REV3 +#define SPN2_START 36 + SPN_RCVY_LED_START_INDEX ///< Index 2nd SPN pixel +#else +#define SPN2_START 32 + SPN_RCVY_LED_START_INDEX ///< Index 2nd SPN pixel +#endif +#define SPN2_COUNT 1 ///< SPN2 pixel count + +#define SPN_RCVY_BL_START 0 + SPN_RCVY_LED_START_INDEX ///< Index for 1st block of SPN RCVY panel backlight pixels +#define SPN_RCVY_LENGTH 29 ///< SPN RCVY panel backlight block 1 pixel count + +#define SPN_RCVY2_BL_START 30 + SPN_RCVY_LED_START_INDEX ///< Index for 2nd block of SPN RCVY panel backlight pixels + +/// @todo remove ifdef for SPN_RCVY_REV3 as it's for my ease of testing +#ifdef SPN_RCVY_REV3 +#define SPN_RCVY2_LENGTH 5 ///< 2 SPN RCVY panel backlight block 2 pixel count +#else +#define SPN_RCVY2_LENGTH 2 ///< 2 SPN RCVY panel backlight block 2 pixel count +#endif + +/// @todo remove ifdef for SPN_RCVY_REV3 as it's for my ease of testing +#ifdef SPN_RCVY_REV3 +#define SPN_RCVY3_BL_START 37 + SPN_RCVY_LED_START_INDEX ///< 36 Index for 3nd block of SPN RCVY panel backlight pixels +#define SPN_RCVY3_LENGTH 26 ///< 19 SPN RCVY panel backlight block 2 pixel count +#else +#define SPN_RCVY3_BL_START 36 + SPN_RCVY_LED_START_INDEX ///< 36 Index for 3nd block of SPN RCVY panel backlight pixels +#define SPN_RCVY3_LENGTH 19 ///< 19 SPN RCVY panel backlight block 2 pixel count +#endif + +/** +* @brief Setup SPN RCVY panel's neopixel and then set the DCS Bios methods to read sim state and set +* backlighting / annunciators accordingly. +* +*/ + +void onSpinLtChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, SPN_START, SPN_COUNT); ///< Off + uipBLCh1.fill(0, SPN2_START, SPN2_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(255, 255, 0), SPN_START, SPN_COUNT); ///< Set light to Yellow + uipBLCh1.fill(uipBLCh1.Color(255, 255, 0), SPN2_START, SPN2_COUNT); ///< Set light to Yellow + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer spinLtBuffer(0x742a, 0x0800, 11, onSpinLtChange); + +#endif \ No newline at end of file diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h index 738e57b..f9f3b88 100644 --- a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h @@ -45,6 +45,9 @@ /// @todo remove ifdef for HUD_PANEL_REV3 as it's for my ease of testing #define HUD_PANEL_REV3 +/// @todo remove ifdef for SPN_RCVY_REV3 as it's for my ease of testing +#define SPN_RCVY_REV3 + /** * @brief UIP Backlights * @@ -77,7 +80,21 @@ #define R_EWI_LED_COUNT 30 ///< R EWI panel has 30 pixels, no backlighting. -#define UIP_LED_COUNT MA_LED_COUNT + L_EWI_LED_COUNT + HUD_PANEL_LED_COUNT + R_EWI_LED_COUNT ///< add up the connected panels pixel count for the Adafruit_NeoPixel string. +/// @todo remove ifdef for HUD_PANEL_REV3 as it's for my ease of testing +#ifdef HUD_PANEL_REV3 +#define SPN_RCVY_LED_START_INDEX 145 ///< SPN RCVY is the 5th and final panel in the UIP BL Channel 1 string. +#else + +#define SPN_RCVY_LED_START_INDEX 139 ///< SPN RCVY is the 5th and final panel in the UIP BL Channel 1 string. +#endif +/// @todo remove ifdef for SPN_RCVY_REV3 as it's for my ease of testing +#ifdef SPN_RCVY_REV3 +#define SPN_RCVY_LED_COUNT 63 ///< SPN RCVY rev3 panel had 63 pixels with backlighting. +#else +#define SPN_RCVY_LED_COUNT 52 ///< SPN RCVY panel has 52 pixels with backlighting. +#endif + +#define UIP_LED_COUNT MA_LED_COUNT + L_EWI_LED_COUNT + HUD_PANEL_LED_COUNT + R_EWI_LED_COUNT + SPN_RCVY_LED_COUNT ///< add up the connected panels pixel count for the Adafruit_NeoPixel string. Adafruit_NeoPixel uipBLCh1 = Adafruit_NeoPixel(UIP_LED_COUNT, UIP_BL_CH1, NEO_GRB + NEO_KHZ800); ///< Setup the UIP BL Ch1 string. @@ -86,6 +103,7 @@ Adafruit_NeoPixel uipBLCh1 = Adafruit_NeoPixel(UIP_LED_COUNT, UIP_BL_CH1, NEO_GR #include "1A4_L_EWI_BL.h" #include "1A7A1_HUD_PANEL_BL.h" #include "1A5_R_EWI_BL.h" +#include "1A6A1_SPN_RCVY_BL.h" /** * @brief LIP Backlights @@ -134,6 +152,11 @@ void onInstPnlDimmerChange(unsigned int newValue) { #ifdef __HUD_PANEL_BL_H uipBLCh1.fill(uipBLCh1.Color(0, map(newValue, 0, 65535, 0, 255), 0), HUD_PANEL_BL_START, HUD_PANEL_BL_LENGTH); ///< Set light to Green #endif + #ifdef __SPN_RCVY_BL_H + uipBLCh1.fill(uipBLCh1.Color(0, map(newValue, 0, 65535, 0, 255), 0), SPN_RCVY_BL_START, SPN_RCVY_LENGTH); ///< Set light to Green + uipBLCh1.fill(uipBLCh1.Color(0, map(newValue, 0, 65535, 0, 255), 0), SPN_RCVY2_BL_START, SPN_RCVY2_LENGTH); ///< Set light to Green + uipBLCh1.fill(uipBLCh1.Color(0, map(newValue, 0, 65535, 0, 255), 0), SPN_RCVY3_BL_START, SPN_RCVY3_LENGTH); ///< Set light to Green + #endif uipBLCh1.show(); break; } diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.ino b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.ino index ea098fb..9924e23 100644 --- a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.ino +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.ino @@ -10,7 +10,7 @@ * ---------------------------------------------------------------------------------- * Copyright 2016-2024 OpenHornet * - * Licensed under the Apache License, Version 2.0 (the "License"); + * Licensed under the Apache License, Version 2.0 (the "License");d:\OpenHornet-Software\embedded\OH2_Lower_Instrument_Panel\2A13-BACKLIGHT_CONTROLLER\1A6A1_SPN_RCVY_BL.h * you may not use this file except in compliance with the License. * You may obtain a copy of the License at *