View Full Version : WIP advanced Integrated Command Panel (CMC NightHawk Style) for X-plane

Lord Merlin
03-21-2013, 08:15 PM
Hi everyone,

During the past weeks I have been working on the source code for an advanced ICP build for my X-plane fighter jets.
The basic design was influenced by the CMC Nighthawk Wide angle HUD system. This was used in the early stages of the F-35 program, and it is also used in the X-plane variant of the Stavatti SM-27 series of aircraft.
It basically has a 4*5 keypad on the left (minus one key), 4 LED displays in the middle, a 3*5 keypad on the right (minus one key again) and 4 switches and 5 rotaries on the bottom.

I won't be adding the bottom functions, as that are not used in the X-plane simulator, and only plan to use numeric LED segments to display the 4 autopilot values on the LED displays (heading, altitude, vertical speed and auto-throttle settings). It also has LED back-lighting and some keys are toggle switches for the autopilot, so these need status lights too.

The code can compile into one Teensy 2.0++ controller but as I just moved to a new country I did not have the room to bring a controller with me, or the chance to order one in advance.

Some work in progress source code is available if anyone is interested, but I had no chance to test if it actually works (I am a programmer, so the code is syntax error free and compiles just fine).

Edit: I will update this thread as I have any progress, and will answer all questions as they are asked.

Lord Merlin
03-22-2013, 08:40 AM
First part of the ICP code: Variable and interface definitions:

#include <Bounce.h>
#include <Keypad.h>

// Defining the serial interface to the LED drivers
const int serial_TX = 18;
const int serial_switch = 19;
const int serial_clock = 20;

// Defining the brightness rotary
const int rotary_pin1 = 21;
const int rotary_pin2 = 22;
Bounce Rotary_plus = Bounce (rotary_pin1,5);
Bounce Rotary_minus = Bounce(rotary_pin2,5);

// Define the Keymap
const byte ROWS = 5;
const byte COLS = 8;
char keys[ROWS][COLS] = {
{' ','+','G','L','C','D',' ',' '}

// Connect keypad rows to these Arduino pins.
byte rowPins[ROWS] = { 9, 8, 7, 6, 5 };
// Connect keypad cols to these Arduino pins.
byte colPins[COLS] = { 17, 16, 15, 14, 13, 12, 11, 10 };
// Create the Keypad
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

// X-Plane input and output
// Autopilot commands
FlightSimCommand Ap_Hdg;
FlightSimCommand Ap_Alt;
FlightSimCommand Ap_Vvi;
FlightSimCommand Ap_Spd;
FlightSimCommand Ap_Ptch;
FlightSimCommand Ap_Flch;
FlightSimCommand Ap_Loc;
FlightSimCommand Ap_Gs;
FlightSimCommand Ap_Wlv;

// Autopilot settings
FlightSimInteger autopilot_Source;
FlightSimInteger autopilot_Heading;
FlightSimInteger autopilot_Altitude;
FlightSimInteger autopilot_VVI;
FlightSimInteger autopilot_Pitch;
FlightSimInteger autopilot_Speed;
FlightSimInteger autopilot_Autothrottle;
FlightSimInteger autopilot_SpeedIsMach;

// Autopilot positions
FlightSimFloat Heading_dial;
FlightSimFloat Altitude_dial;
FlightSimFloat VVI_dial;
FlightSimFloat Airspeed_dial;

// Radio frequencies and channels
FlightSimInteger Nav_freq[2];
FlightSimInteger Com_freq[2];
FlightSimInteger Adf_freq[2];
FlightSimInteger Tcas_code;

// Aircraft essential data
FlightSimFloat supplyVolts;
FlightSimInteger Autopilot_on;
FlightSimInteger Autothrottle_on;
FlightSimInteger Servos_on;

// Internal variables for holding previous loop data
String command_string;
int Heading;
int Altitude;
int VVI;
int Airspeed;

08-30-2014, 02:49 PM
Old thread, but nothing now... i'm very interessing by this post... for learn...

sory for my poor english...
Thank you