MHeironimus / ArduinoJoystickLibrary

An Arduino library that adds one or more joysticks to the list of HID devices an Arduino Leonardo or Arduino Micro can support.
GNU Lesser General Public License v3.0
2.07k stars 403 forks source link

Windows not recognizing arduino as controller when button count set to 32 (works fine under) #290

Open gbrricci opened 4 days ago

gbrricci commented 4 days ago

Description of Issue

Windows is not recognizing the arduino as a controller when I set the button count to the max of 32.

Technical Details

Sketch File that Reproduces Issue

/*-------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------
-------------------------------- Flight sim controls ---------------------------------------
------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------*/

/*
  testing two 5 way nav switches for MFD function while in VR
  //center press on cheap 5 way nav switch is trash, using reset pin as center press instead
*/

#include <Arduino.h>

#include <Joystick.h>
#define JOYSTICK_COUNT 2 //# of separate joysticks for windows to see from single Arduino board

//Joystick setup
Joystick_ Joystick[JOYSTICK_COUNT] = {
    Joystick_(0x04, JOYSTICK_TYPE_JOYSTICK, //joystick address, joystick type (JOYSTICK_TYPE_JOYSTICK, JOYSTICK_TYPE_GAMEPAD, or JOYSTICK_TYPE_MULTI_AXIS)
              32, 0,                       // button count, hat switch count
              false, false, false,         // X, Y, and Z Axis
              false, false, false,         // Rx, Ry, and Rz
              false, false,                // rudder and throttle
              false, false, false),        // accelerator, brake, and steering
    Joystick_(0x05, JOYSTICK_TYPE_JOYSTICK, //joystick address, joystick type (JOYSTICK_TYPE_JOYSTICK, JOYSTICK_TYPE_GAMEPAD, or JOYSTICK_TYPE_MULTI_AXIS)
              26, 0,                       // button count, hat switch count
              false, false, false,         // X, Y, and Z Axis
              false, false, false,         // Rx, Ry, and Rz
              false, false,                // rudder and throttle
              false, false, false),        // accelerator, brake, and steering
};

/*-------------------------------------------------------------------------------------------
*-------------------------------- GLOBAL CONFIGURATION SECTION ---------------------------------------
--------------------------------------------------------------------------------------------*/
int delay_button_press = 50;                     //[ms] delay for joystick button emulation press. SET TO 50 ONCE DONE W/ TESTING------------------------------------------!!!!!!!!!!!!!!
int delay_tripple_toggle = 50;                   //[ms] delay for Arduino to register if a on-off-on toggle went from top all the way to bottom, having issues with joystick stopping at middle button and ignoring last
int delay_loop = 10; //[ms] time to delay at the end of Arduino Loop function.
unsigned int delay_debounce = 50; // [ms] prevents buttons from toggling multiple times per release
int delay_button_encoder_fix = 500; //[ms] time to delay button press after select encoders last toggled

int delay_initialize = 5000; // testing delay for initialize to give initial button setting time to run out encoder and other noise delays

int Region_Select_Timeout = 1000; //[ms] max time for region select to remain active without MFD button press 

/*-------------------------------------------------------------------------------------------
*-------------------------------- TRACKER VARIABLES SECTION ---------------------------------------
--------------------------------------------------------------------------------------------*/

  //button hold debounce tracker

  long pin_debounce_timers[54] = {};
  int pin_last[54] = {}; //helps prevent encoder interference from triggering toggle switches that haven't actually moved

  long Region_Select_Timer_Left_MFD = 0;
  long Region_Select_Timer_Center_MFD = 0;
  long Region_Select_Timer_Right_MFD = 0;

  const int MFD_array_size = 7;

  bool MFD_Left_Region_Select_Top = false;
  bool MFD_Left_Region_Select_Bottom = false;
  bool MFD_Left_Region_Select_Left = false;
  bool MFD_Left_Region_Select_Right = false;
  int i_MFD_Left_array = -1;
  int MFD_Left_Joy_last = -1;
  int MFD_Left_button_last = -1;
  bool MFD_Left_Button_is_held = false;

  bool MFD_Center_Region_Select_Top = false;
  bool MFD_Center_Region_Select_Bottom = false;
  bool MFD_Center_Region_Select_Left = false;
  bool MFD_Center_Region_Select_Right = false;
  int i_MFD_Center_array = -1;
  int MFD_Center_Joy_last = -1;
  int MFD_Center_button_last = -1;
  bool MFD_Center_Button_is_held = false;   

  bool MFD_Right_Region_Select_Top = false;
  bool MFD_Right_Region_Select_Bottom = false;
  bool MFD_Right_Region_Select_Left = false;
  bool MFD_Right_Region_Select_Right = false;
  int i_MFD_Right_array = -1;
  int MFD_Right_Joy_last = -1;
  int MFD_Right_button_last = -1;
  bool MFD_Right_Button_is_held = false;

/*-------------------------------------------------------------------------------------------
*-------------------------------- ARDUINO PIN ASSIGNMENT SECTION ---------------------------------------
--------------------------------------------------------------------------------------------*/

// Left MFD nav switch
unsigned int Left_MFD_Up_pin = 39;
unsigned int Left_MFD_Down_pin = 37;
unsigned int Left_MFD_Left_pin = 35;
unsigned int Left_MFD_Right_pin = 33;
unsigned int Left_MFD_Middle_pin = 27; //31
unsigned int Left_MFD_Set_pin = 29;
//unsigned int Left_MFD_Reset_pin = 27;

unsigned int Left_MFD_pin_array[MFD_array_size] = {Left_MFD_Up_pin, Left_MFD_Down_pin, Left_MFD_Left_pin, Left_MFD_Right_pin, Left_MFD_Middle_pin, Left_MFD_Set_pin};//, Left_MFD_Reset_pin};

// Center MFD nav switch
unsigned int Center_MFD_Up_pin = 52;
unsigned int Center_MFD_Down_pin = 50;
unsigned int Center_MFD_Left_pin = 48;
unsigned int Center_MFD_Right_pin = 46;
unsigned int Center_MFD_Middle_pin = 40; //44
unsigned int Center_MFD_Set_pin = 42;
//unsigned int Center_MFD_Reset_pin = 40;

unsigned int Center_MFD_pin_array[MFD_array_size] = {Left_MFD_Up_pin, Center_MFD_Down_pin, Center_MFD_Left_pin, Center_MFD_Right_pin, Center_MFD_Middle_pin, Center_MFD_Set_pin};//, Center_MFD_Reset_pin};

// Right MFD nav switch
unsigned int Right_MFD_Up_pin = 53;
unsigned int Right_MFD_Down_pin = 51;
unsigned int Right_MFD_Left_pin = 49;
unsigned int Right_MFD_Right_pin = 47;
unsigned int Right_MFD_Middle_pin = 41;//45
unsigned int Right_MFD_Set_pin = 43;
//unsigned int Right_MFD_Reset_pin = 41;

unsigned int Right_MFD_pin_array[MFD_array_size] = {Left_MFD_Up_pin, Right_MFD_Down_pin, Right_MFD_Left_pin, Right_MFD_Right_pin, Right_MFD_Middle_pin, Right_MFD_Set_pin};//, Right_MFD_Reset_pin};

/*-------------------------------------------------------------------------------------------
*-------------------------------- CONTROLLER BUTTON ASSIGNMENT SECTION ---------------------------------------
--------------------------------------------------------------------------------------------*/

const int MFD_Matrix_Column_Count = 4;
const int MFD_Matrix_Row_Count = 5;
const int Joy_Matrix_Column_Count = MFD_Matrix_Column_Count;
const int Joy_Matrix_Row_Count = MFD_Matrix_Row_Count;

// Left MFD nav switch
unsigned int Left_MFD_Top_1 = 0;
unsigned int Left_MFD_Top_2 = 1;
unsigned int Left_MFD_Top_3 = 2;
unsigned int Left_MFD_Top_4 = 3;
unsigned int Left_MFD_Top_5 = 4;

unsigned int Left_MFD_Bottom_1 = 5;
unsigned int Left_MFD_Bottom_2 = 6;
unsigned int Left_MFD_Bottom_3 = 7;
unsigned int Left_MFD_Bottom_4 = 8;
unsigned int Left_MFD_Bottom_5 = 9;

unsigned int Left_MFD_Left_1 = 10;
unsigned int Left_MFD_Left_2 = 11;
unsigned int Left_MFD_Left_3 = 12;
unsigned int Left_MFD_Left_4 = 13;
unsigned int Left_MFD_Left_5 = 14;

unsigned int Left_MFD_Right_1 = 15;
unsigned int Left_MFD_Right_2 = 16;
unsigned int Left_MFD_Right_3 = 17;
unsigned int Left_MFD_Right_4 = 18;
unsigned int Left_MFD_Right_5 = 19;

unsigned int Left_MFD_matrix[MFD_Matrix_Column_Count][MFD_Matrix_Row_Count]={

{Left_MFD_Top_1, Left_MFD_Top_2, Left_MFD_Top_3, Left_MFD_Top_4, Left_MFD_Top_5},
{Left_MFD_Bottom_1, Left_MFD_Bottom_2, Left_MFD_Bottom_3, Left_MFD_Bottom_4, Left_MFD_Bottom_5},
{Left_MFD_Left_1, Left_MFD_Left_2, Left_MFD_Left_3, Left_MFD_Left_4, Left_MFD_Left_5},
{Left_MFD_Right_1, Left_MFD_Right_2, Left_MFD_Right_3, Left_MFD_Right_4, Left_MFD_Right_5}

};

unsigned int Left_Joy_Top_1 = 0;
unsigned int Left_Joy_Top_2 = 0;
unsigned int Left_Joy_Top_3 = 0;
unsigned int Left_Joy_Top_4 = 0;
unsigned int Left_Joy_Top_5 = 0;

unsigned int Left_Joy_Bottom_1 = 0;
unsigned int Left_Joy_Bottom_2 = 0;
unsigned int Left_Joy_Bottom_3 = 0;
unsigned int Left_Joy_Bottom_4 = 0;
unsigned int Left_Joy_Bottom_5 = 0;

unsigned int Left_Joy_Left_1 = 0;
unsigned int Left_Joy_Left_2 = 0;
unsigned int Left_Joy_Left_3 = 0;
unsigned int Left_Joy_Left_4 = 0;
unsigned int Left_Joy_Left_5 = 0;

unsigned int Left_Joy_Right_1 = 0;
unsigned int Left_Joy_Right_2 = 0;
unsigned int Left_Joy_Right_3 = 0;
unsigned int Left_Joy_Right_4 = 0;
unsigned int Left_Joy_Right_5 = 0;

unsigned int Left_Joy_matrix[Joy_Matrix_Column_Count][Joy_Matrix_Row_Count]={

{Left_Joy_Top_1, Left_Joy_Top_2, Left_Joy_Top_3, Left_Joy_Top_4, Left_Joy_Top_5},
{Left_Joy_Bottom_1, Left_Joy_Bottom_2, Left_Joy_Bottom_3, Left_Joy_Bottom_4, Left_Joy_Bottom_5},
{Left_Joy_Left_1, Left_Joy_Left_2, Left_Joy_Left_3, Left_Joy_Left_4, Left_Joy_Left_5},
{Left_Joy_Right_1, Left_Joy_Right_2, Left_Joy_Right_3, Left_Joy_Right_4, Left_Joy_Right_5}

};

// Center MFD nav switch
unsigned int Center_MFD_Top_1 = 20;
unsigned int Center_MFD_Top_2 = 21;
unsigned int Center_MFD_Top_3 = 22;
unsigned int Center_MFD_Top_4 = 23;
unsigned int Center_MFD_Top_5 = 24;

unsigned int Center_MFD_Bottom_1 = 25;
unsigned int Center_MFD_Bottom_2 = 26;
unsigned int Center_MFD_Bottom_3 = 27;
unsigned int Center_MFD_Bottom_4 = 28;
unsigned int Center_MFD_Bottom_5 = 29;

unsigned int Center_MFD_Left_1 = 30;
unsigned int Center_MFD_Left_2 = 31;
unsigned int Center_MFD_Left_3 = 0; //splitting out to controller 1 from here
unsigned int Center_MFD_Left_4 = 1;
unsigned int Center_MFD_Left_5 = 2;

unsigned int Center_MFD_Right_1 = 3;
unsigned int Center_MFD_Right_2 = 4;
unsigned int Center_MFD_Right_3 = 5;
unsigned int Center_MFD_Right_4 = 6;
unsigned int Center_MFD_Right_5 = 7;

unsigned int Center_MFD_matrix[MFD_Matrix_Column_Count][MFD_Matrix_Row_Count]={

{Center_MFD_Top_1, Center_MFD_Top_2, Center_MFD_Top_3, Center_MFD_Top_4, Center_MFD_Top_5},
{Center_MFD_Bottom_1, Center_MFD_Bottom_2, Center_MFD_Bottom_3, Center_MFD_Bottom_4, Center_MFD_Bottom_5},
{Center_MFD_Left_1, Center_MFD_Left_2, Center_MFD_Left_3, Center_MFD_Left_4, Center_MFD_Left_5},
{Center_MFD_Right_1, Center_MFD_Right_2, Center_MFD_Right_3, Center_MFD_Right_4, Center_MFD_Right_5}

};

unsigned int Center_Joy_Top_1 = 0;
unsigned int Center_Joy_Top_2 = 0;
unsigned int Center_Joy_Top_3 = 0;
unsigned int Center_Joy_Top_4 = 0;
unsigned int Center_Joy_Top_5 = 0;

unsigned int Center_Joy_Bottom_1 = 0;
unsigned int Center_Joy_Bottom_2 = 0;
unsigned int Center_Joy_Bottom_3 = 0;
unsigned int Center_Joy_Bottom_4 = 0;
unsigned int Center_Joy_Bottom_5 = 0;

unsigned int Center_Joy_Left_1 = 0;
unsigned int Center_Joy_Left_2 = 0;
unsigned int Center_Joy_Left_3 = 0;
unsigned int Center_Joy_Left_4 = 0;
unsigned int Center_Joy_Left_5 = 0;

unsigned int Center_Joy_Right_1 = 0;
unsigned int Center_Joy_Right_2 = 0;
unsigned int Center_Joy_Right_3 = 0;
unsigned int Center_Joy_Right_4 = 0;
unsigned int Center_Joy_Right_5 = 0;

unsigned int Center_Joy_matrix[Joy_Matrix_Column_Count][Joy_Matrix_Row_Count]={

{Center_Joy_Top_1, Center_Joy_Top_2, Center_Joy_Top_3, Center_Joy_Top_4, Center_Joy_Top_5},
{Center_Joy_Bottom_1, Center_Joy_Bottom_2, Center_Joy_Bottom_3, Center_Joy_Bottom_4, Center_Joy_Bottom_5},
{Center_Joy_Left_1, Center_Joy_Left_2, Center_Joy_Left_3, Center_Joy_Left_4, Center_Joy_Left_5},
{Center_Joy_Right_1, Center_Joy_Right_2, Center_Joy_Right_3, Center_Joy_Right_4, Center_Joy_Right_5}

};

// Right MFD nav switch
unsigned int Right_MFD_Top_1 = 8;
unsigned int Right_MFD_Top_2 = 9;
unsigned int Right_MFD_Top_3 = 10;
unsigned int Right_MFD_Top_4 = 11;
unsigned int Right_MFD_Top_5 = 12;

unsigned int Right_MFD_Bottom_1 = 13;
unsigned int Right_MFD_Bottom_2 = 14;
unsigned int Right_MFD_Bottom_3 = 15;
unsigned int Right_MFD_Bottom_4 = 16;
unsigned int Right_MFD_Bottom_5 = 17;

unsigned int Right_MFD_Left_1 = 18;
unsigned int Right_MFD_Left_2 = 19;
unsigned int Right_MFD_Left_3 = 20;
unsigned int Right_MFD_Left_4 = 21;
unsigned int Right_MFD_Left_5 = 22;

unsigned int Right_MFD_Right_1 = 23;
unsigned int Right_MFD_Right_2 = 24;
unsigned int Right_MFD_Right_3 = 25;
unsigned int Right_MFD_Right_4 = 26;
unsigned int Right_MFD_Right_5 = 27;

unsigned int Right_MFD_matrix[MFD_Matrix_Column_Count][MFD_Matrix_Row_Count]={

{Right_MFD_Top_1, Right_MFD_Top_2, Right_MFD_Top_3, Right_MFD_Top_4, Right_MFD_Top_5},
{Right_MFD_Bottom_1, Right_MFD_Bottom_2, Right_MFD_Bottom_3, Right_MFD_Bottom_4, Right_MFD_Bottom_5},
{Right_MFD_Left_1, Right_MFD_Left_2, Right_MFD_Left_3, Right_MFD_Left_4, Right_MFD_Left_5},
{Right_MFD_Right_1, Right_MFD_Right_2, Right_MFD_Right_3, Right_MFD_Right_4, Right_MFD_Right_5}

};

unsigned int Right_Joy_Top_1 = 0;
unsigned int Right_Joy_Top_2 = 0;
unsigned int Right_Joy_Top_3 = 0;
unsigned int Right_Joy_Top_4 = 0;
unsigned int Right_Joy_Top_5 = 0;

unsigned int Right_Joy_Bottom_1 = 0;
unsigned int Right_Joy_Bottom_2 = 0;
unsigned int Right_Joy_Bottom_3 = 0;
unsigned int Right_Joy_Bottom_4 = 0;
unsigned int Right_Joy_Bottom_5 = 0;

unsigned int Right_Joy_Left_1 = 0;
unsigned int Right_Joy_Left_2 = 0;
unsigned int Right_Joy_Left_3 = 0;
unsigned int Right_Joy_Left_4 = 0;
unsigned int Right_Joy_Left_5 = 0;

unsigned int Right_Joy_Right_1 = 0;
unsigned int Right_Joy_Right_2 = 0;
unsigned int Right_Joy_Right_3 = 0;
unsigned int Right_Joy_Right_4 = 0;
unsigned int Right_Joy_Right_5 = 0;

unsigned int Right_Joy_matrix[Joy_Matrix_Column_Count][Joy_Matrix_Row_Count]={

{Right_Joy_Top_1, Right_Joy_Top_2, Right_Joy_Top_3, Right_Joy_Top_4, Right_Joy_Top_5},
{Right_Joy_Bottom_1, Right_Joy_Bottom_2, Right_Joy_Bottom_3, Right_Joy_Bottom_4, Right_Joy_Bottom_5},
{Right_Joy_Left_1, Right_Joy_Left_2, Right_Joy_Left_3, Right_Joy_Left_4, Right_Joy_Left_5},
{Right_Joy_Right_1, Right_Joy_Right_2, Right_Joy_Right_3, Right_Joy_Right_4, Right_Joy_Right_5}

};

/*-------------------------------------------------------------------------------------------
*-------------------------------- FORWARD FUNCTION DECLARATION SECTION ---------------------------------------
--------------------------------------------------------------------------------------------
*/
void Left_MFD();

void Left_MFD_Up_Switch_Interrupt();
volatile bool Left_MFD_Up_Switch_Interrupt_active = false;
void Left_MFD_Down_Switch_Interrupt();
volatile bool Left_MFD_Down_Switch_Interrupt_active = false;
void Left_MFD_Left_Switch_Interrupt();
volatile bool Left_MFD_Left_Switch_Interrupt_active = false;
void Left_MFD_Right_Switch_Interrupt();
volatile bool Left_MFD_Right_Switch_Interrupt_active = false;
void Left_MFD_Middle_Switch_Interrupt();
volatile bool Left_MFD_Middle_Switch_Interrupt_active = false;
void Left_MFD_Set_Switch_Interrupt();
volatile bool Left_MFD_Set_Switch_Interrupt_active = false;
// void Left_MFD_Reset_Switch_Interrupt();
// volatile bool Left_MFD_Reset_Switch_Interrupt_active = false;

void Center_MFD();

void Center_MFD_Up_Switch_Interrupt();
volatile bool Center_MFD_Up_Switch_Interrupt_active = false;
void Center_MFD_Down_Switch_Interrupt();
volatile bool Center_MFD_Down_Switch_Interrupt_active = false;
void Center_MFD_Left_Switch_Interrupt();
volatile bool Center_MFD_Left_Switch_Interrupt_active = false;
void Center_MFD_Right_Switch_Interrupt();
volatile bool Center_MFD_Right_Switch_Interrupt_active = false;
void Center_MFD_Middle_Switch_Interrupt();
volatile bool Center_MFD_Middle_Switch_Interrupt_active = false;
void Center_MFD_Set_Switch_Interrupt();
volatile bool Center_MFD_Set_Switch_Interrupt_active = false;
// void Center_MFD_Reset_Switch_Interrupt();
// volatile bool Center_MFD_Reset_Switch_Interrupt_active = false;

void Right_MFD();

void Right_MFD_Up_Switch_Interrupt();
volatile bool Right_MFD_Up_Switch_Interrupt_active = false;
void Right_MFD_Down_Switch_Interrupt();
volatile bool Right_MFD_Down_Switch_Interrupt_active = false;
void Right_MFD_Left_Switch_Interrupt();
volatile bool Right_MFD_Left_Switch_Interrupt_active = false;
void Right_MFD_Right_Switch_Interrupt();
volatile bool Right_MFD_Right_Switch_Interrupt_active = false;
void Right_MFD_Middle_Switch_Interrupt();
volatile bool Right_MFD_Middle_Switch_Interrupt_active = false;
void Right_MFD_Set_Switch_Interrupt();
volatile bool Right_MFD_Set_Switch_Interrupt_active = false;
// void Right_MFD_Reset_Switch_Interrupt();
// volatile bool Right_MFD_Reset_Switch_Interrupt_active = false;

// joystick button emulation functions
void Button_hold(int i_joy, int pin_id, int button_id); //for physical push buttons to keep emulated button pressed until released

void Button_wipe(String MFD_side); //sets all joystick buttons to released for a specific MFD

void setup()
{

  // Serial.begin(9600);

  pinMode(Left_MFD_Up_pin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(Left_MFD_Up_pin), Left_MFD_Up_Switch_Interrupt, CHANGE);
  pinMode(Left_MFD_Down_pin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(Left_MFD_Down_pin), Left_MFD_Down_Switch_Interrupt, CHANGE);
  pinMode(Left_MFD_Left_pin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(Left_MFD_Left_pin), Left_MFD_Left_Switch_Interrupt, CHANGE);
  pinMode(Left_MFD_Right_pin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(Left_MFD_Right_pin), Left_MFD_Right_Switch_Interrupt, CHANGE);
  pinMode(Left_MFD_Middle_pin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(Left_MFD_Middle_pin), Left_MFD_Middle_Switch_Interrupt, CHANGE);
  pinMode(Left_MFD_Set_pin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(Left_MFD_Set_pin), Left_MFD_Set_Switch_Interrupt, CHANGE);
  // pinMode(Left_MFD_Reset_pin, INPUT_PULLUP);
  // attachInterrupt(digitalPinToInterrupt(Left_MFD_Reset_pin), Left_MFD_Reset_Switch_Interrupt, FALLING);

  pinMode(Center_MFD_Up_pin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(Center_MFD_Up_pin), Center_MFD_Up_Switch_Interrupt, CHANGE);
  pinMode(Center_MFD_Down_pin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(Center_MFD_Down_pin), Center_MFD_Down_Switch_Interrupt, CHANGE);
  pinMode(Center_MFD_Left_pin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(Center_MFD_Left_pin), Center_MFD_Left_Switch_Interrupt, CHANGE);
  pinMode(Center_MFD_Right_pin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(Center_MFD_Right_pin), Center_MFD_Right_Switch_Interrupt, CHANGE);
  pinMode(Center_MFD_Middle_pin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(Center_MFD_Middle_pin), Center_MFD_Middle_Switch_Interrupt, CHANGE);
  pinMode(Center_MFD_Set_pin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(Center_MFD_Set_pin), Center_MFD_Set_Switch_Interrupt, CHANGE);
  // pinMode(Center_MFD_Reset_pin, INPUT_PULLUP);
  // attachInterrupt(digitalPinToInterrupt(Center_MFD_Reset_pin), Center_MFD_Reset_Switch_Interrupt, FALLING);

  pinMode(Right_MFD_Up_pin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(Right_MFD_Up_pin), Right_MFD_Up_Switch_Interrupt, CHANGE);
  pinMode(Right_MFD_Down_pin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(Right_MFD_Down_pin), Right_MFD_Down_Switch_Interrupt, CHANGE);
  pinMode(Right_MFD_Left_pin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(Right_MFD_Left_pin), Right_MFD_Left_Switch_Interrupt, CHANGE);
  pinMode(Right_MFD_Right_pin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(Right_MFD_Right_pin), Right_MFD_Right_Switch_Interrupt, CHANGE);
  pinMode(Right_MFD_Middle_pin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(Right_MFD_Middle_pin), Right_MFD_Middle_Switch_Interrupt, CHANGE);
  pinMode(Right_MFD_Set_pin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(Right_MFD_Set_pin), Right_MFD_Set_Switch_Interrupt, CHANGE);
  // pinMode(Right_MFD_Reset_pin, INPUT_PULLUP);
  // attachInterrupt(digitalPinToInterrupt(Right_MFD_Reset_pin), Right_MFD_Reset_Switch_Interrupt, FALLING);

  //start joystick emulation
  Joystick[0].begin();
  Joystick[1].begin();

  MFD_Left_Region_Select_Top = false;
  MFD_Left_Region_Select_Bottom = false;
  MFD_Left_Region_Select_Left = false;
  MFD_Left_Region_Select_Right = false;

  MFD_Center_Region_Select_Top = false;
  MFD_Center_Region_Select_Bottom = false;
  MFD_Center_Region_Select_Left = false;
  MFD_Center_Region_Select_Right = false;

  MFD_Right_Region_Select_Top = false;
  MFD_Right_Region_Select_Bottom = false;
  MFD_Right_Region_Select_Left = false;
  MFD_Right_Region_Select_Right = false;

  Left_MFD_Up_Switch_Interrupt_active = false;
  Left_MFD_Down_Switch_Interrupt_active = false;
  Left_MFD_Left_Switch_Interrupt_active = false;
  Left_MFD_Right_Switch_Interrupt_active = false;
  Left_MFD_Middle_Switch_Interrupt_active = false;
  Left_MFD_Set_Switch_Interrupt_active = false;
  // Left_MFD_Reset_Switch_Interrupt_active = false;

  Center_MFD_Up_Switch_Interrupt_active = false;
  Center_MFD_Down_Switch_Interrupt_active = false;
  Center_MFD_Left_Switch_Interrupt_active = false;
  Center_MFD_Right_Switch_Interrupt_active = false;
  Center_MFD_Middle_Switch_Interrupt_active = false;
  Center_MFD_Set_Switch_Interrupt_active = false;
  // Center_MFD_Reset_Switch_Interrupt_active = false;

  Right_MFD_Up_Switch_Interrupt_active = false;
  Right_MFD_Down_Switch_Interrupt_active = false;
  Right_MFD_Left_Switch_Interrupt_active = false;
  Right_MFD_Right_Switch_Interrupt_active = false;
  Right_MFD_Middle_Switch_Interrupt_active = false;
  Right_MFD_Set_Switch_Interrupt_active = false;
  // Right_MFD_Reset_Switch_Interrupt_active = false;

  delay(delay_initialize);

}

void loop()
{

  Left_MFD();

  Center_MFD();

  Right_MFD();

  delay(delay_loop); //was placed before send state in old doc, maybe was placed to resolve issue?

  Joystick[0].sendState();
  Joystick[1].sendState();
}

/*-------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
-------------------------------- JOYSTICK BUTTON EMULATION HANDLING SECTION ---------------------------------------
-------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------*/

void Button_hold(int i_joy, unsigned int i_switch, int i_button){

  if((millis() - pin_debounce_timers[i_switch] > delay_debounce)){

    pin_debounce_timers[i_switch] = millis();
    if (digitalRead(i_switch) == LOW && pin_last[i_switch] != 1)
    {  
      Serial.print("button pressed: ");
      Serial.println(i_button);
      pin_last[i_switch] = 1;
      Joystick[i_joy].setButton(i_button, 1);

      //match key to panel
      for (int i=0; i<MFD_array_size; i++){
        if (i_switch == Left_MFD_pin_array[i]){
          MFD_Left_Button_is_held = true;
          break;
        }
        else if(i_switch == Center_MFD_pin_array[i]){
          MFD_Center_Button_is_held = true;
          break;
        }
        else{
          MFD_Right_Button_is_held = true;
        }

      }

    }
    else if (digitalRead(i_switch) == HIGH && pin_last[i_switch] != 2)
    {
      //Serial.println("released");
      pin_last[i_switch] = 2;
      Joystick[i_joy].setButton(i_button, 0);

      //match key to panel
      for (int i=0; i<MFD_array_size; i++){
        if (i_switch == Left_MFD_pin_array[i]){
          MFD_Left_Button_is_held = false;
          break;
        }
        else if(i_switch == Center_MFD_pin_array[i]){
          MFD_Center_Button_is_held = false;
          break;
        }
        else{
          MFD_Right_Button_is_held = false;
        }
      }
    }
  }
}

void Button_wipe(String MFD_side){

  if(MFD_side == "left"){
        Serial.println("wipe left");
      }
      else if(MFD_side == "center"){
        Serial.println("wipe center");
      }
      else{
        Serial.println("wipe right");
      }

  for(int i =0; i<Joy_Matrix_Column_Count; i++){
    for(int j=0; j<Joy_Matrix_Row_Count; j++){

      if(MFD_side == "left"){
        Joystick[Left_Joy_matrix[i][j]].setButton(Left_MFD_matrix[i][j], 0);
      }
      else if(MFD_side == "center"){
        Joystick[Center_Joy_matrix[i][j]].setButton(Center_MFD_matrix[i][j], 0);
      }
      else{
        Joystick[Right_Joy_matrix[i][j]].setButton(Right_MFD_matrix[i][j], 0);
      }
    }
  }

}

/*-------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
-------------------------------- Button functions ---------------------------
-------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------*/

void Left_MFD()
{

  //if any left MFD directoin triggers have activated
  if(Left_MFD_Up_Switch_Interrupt_active == true or Left_MFD_Down_Switch_Interrupt_active == true or Left_MFD_Left_Switch_Interrupt_active == true or Left_MFD_Right_Switch_Interrupt_active == true or Left_MFD_Middle_Switch_Interrupt_active == true){

    if(Left_MFD_Up_Switch_Interrupt_active == true ){ //testing finicky center button for multi button press
      Left_MFD_Down_Switch_Interrupt_active = false; 
      Left_MFD_Left_Switch_Interrupt_active = false;
      Left_MFD_Right_Switch_Interrupt_active = false;
      Left_MFD_Middle_Switch_Interrupt_active = false;
    }

    Region_Select_Timer_Left_MFD = millis(); //start timer for timeout delay
  }
  else if((MFD_Left_Button_is_held == false and millis() - Region_Select_Timer_Left_MFD > Region_Select_Timeout)){ //} or Left_MFD_Reset_Switch_Interrupt_active == true){ //if reset triggered or timed out then set region selection to false

    if(MFD_Left_Region_Select_Top == true or MFD_Left_Region_Select_Bottom == true or MFD_Left_Region_Select_Left == true or MFD_Left_Region_Select_Right == true){
      MFD_Left_Region_Select_Top = false;
      MFD_Left_Region_Select_Bottom = false;
      MFD_Left_Region_Select_Left = false;
      MFD_Left_Region_Select_Right = false;

      // Button_wipe("left");
    }

    if(i_MFD_Left_array != -1){
      i_MFD_Left_array = -1;
    }

    // if(Left_MFD_Reset_Switch_Interrupt_active == true){

    //   Button_wipe_all();

    //   MFD_Left_Region_Select_Top = false;
    //   MFD_Left_Region_Select_Bottom = false;
    //   MFD_Left_Region_Select_Left = false;
    //   MFD_Left_Region_Select_Right = false;

    //   Left_MFD_Reset_Switch_Interrupt_active = false;

    // }  
  }

  //set initial MFD region selection in 1st array
  if(MFD_Left_Region_Select_Top == false and MFD_Left_Region_Select_Bottom == false and MFD_Left_Region_Select_Left == false and MFD_Left_Region_Select_Right == false){

    if (Left_MFD_Up_Switch_Interrupt_active == true)
    {
      MFD_Left_Region_Select_Top = true;
      i_MFD_Left_array = 0;
      Left_MFD_Up_Switch_Interrupt_active = false;
      // Serial.println("top row");
    }
    else if (Left_MFD_Down_Switch_Interrupt_active == true)
    {
      MFD_Left_Region_Select_Bottom = true;
      i_MFD_Left_array = 1;
      Left_MFD_Down_Switch_Interrupt_active = false;
      // Serial.println("bottom row");
    } 
    else if (Left_MFD_Left_Switch_Interrupt_active == true)
    {
      MFD_Left_Region_Select_Left = true;
      i_MFD_Left_array = 2;
      Left_MFD_Left_Switch_Interrupt_active = false;
      // Serial.println("left row");
    } 
    else if (Left_MFD_Right_Switch_Interrupt_active == true)
    {
      MFD_Left_Region_Select_Right = true;
      i_MFD_Left_array = 3;
      Left_MFD_Right_Switch_Interrupt_active = false;
      // Serial.println("right row");
    } 

    if (Left_MFD_Middle_Switch_Interrupt_active == true){ //if middle button was triggered before a region was selected, reset middle trigger
      Left_MFD_Middle_Switch_Interrupt_active = false;
    }
  }

  //If initial MFD region has been set, get 2nd array
  if((MFD_Left_Region_Select_Top == true or MFD_Left_Region_Select_Bottom == true or MFD_Left_Region_Select_Left == true or MFD_Left_Region_Select_Right == true)){

    if (Left_MFD_Up_Switch_Interrupt_active == true)
    {
      MFD_Left_Joy_last = Left_Joy_matrix[i_MFD_Left_array][0];
      MFD_Left_button_last = Left_MFD_matrix[i_MFD_Left_array][0];
      Button_hold(MFD_Left_Joy_last,Left_MFD_Up_pin,MFD_Left_button_last);
      Left_MFD_Up_Switch_Interrupt_active = false;
      // Serial.println("up");
    }
    else if (Left_MFD_Down_Switch_Interrupt_active == true)
    {
      MFD_Left_Joy_last = Left_Joy_matrix[i_MFD_Left_array][1];
      MFD_Left_button_last = Left_MFD_matrix[i_MFD_Left_array][1];
      Button_hold(MFD_Left_Joy_last,Left_MFD_Down_pin,MFD_Left_button_last);
      Left_MFD_Down_Switch_Interrupt_active = false;
      // Serial.println("down");
    }
    else if (Left_MFD_Left_Switch_Interrupt_active == true)
    {
      MFD_Left_Joy_last = Left_Joy_matrix[i_MFD_Left_array][2];
      MFD_Left_button_last = Left_MFD_matrix[i_MFD_Left_array][2];
      Button_hold(MFD_Left_Joy_last,Left_MFD_Left_pin,MFD_Left_button_last);
      Left_MFD_Left_Switch_Interrupt_active = false;
      // Serial.println("left");
    }
    else if (Left_MFD_Right_Switch_Interrupt_active == true)
    {
      MFD_Left_Joy_last = Left_Joy_matrix[i_MFD_Left_array][3];
      MFD_Left_button_last = Left_MFD_matrix[i_MFD_Left_array][3];
      Button_hold(MFD_Left_Joy_last,Left_MFD_Right_pin,MFD_Left_button_last);
      Left_MFD_Right_Switch_Interrupt_active = false;
      // Serial.println("right");
    }
    else if (Left_MFD_Middle_Switch_Interrupt_active == true)
    {
      MFD_Left_Joy_last = Left_Joy_matrix[i_MFD_Left_array][4];
      MFD_Left_button_last = Left_MFD_matrix[i_MFD_Left_array][4];
      Button_hold(MFD_Left_Joy_last,Left_MFD_Middle_pin,MFD_Left_button_last);
      Left_MFD_Middle_Switch_Interrupt_active = false;
      // Serial.println("center");
    }
  }

  if(Left_MFD_Set_Switch_Interrupt_active == true and MFD_Left_button_last != -1){
    Button_hold(MFD_Left_Joy_last,Left_MFD_Set_pin,MFD_Left_button_last);
    Left_MFD_Set_Switch_Interrupt_active = false;
    // Serial.println("repeat last");
  }
}

void Center_MFD()
{

  //if any left MFD directoin triggers have activated
  if(Center_MFD_Up_Switch_Interrupt_active == true or Center_MFD_Down_Switch_Interrupt_active == true or Center_MFD_Left_Switch_Interrupt_active == true or Center_MFD_Right_Switch_Interrupt_active == true or Center_MFD_Middle_Switch_Interrupt_active == true){
    Region_Select_Timer_Center_MFD = millis(); //start timer for timeout delay
  }
  else if((MFD_Center_Button_is_held == false and millis() - Region_Select_Timer_Center_MFD > Region_Select_Timeout)){ //} or Center_MFD_Reset_Switch_Interrupt_active == true){ //if reset triggered or timed out then set region selection to false

    if(MFD_Center_Region_Select_Top == true or MFD_Center_Region_Select_Bottom == true or MFD_Center_Region_Select_Left == true or MFD_Center_Region_Select_Right == true){
      MFD_Center_Region_Select_Top = false;
      MFD_Center_Region_Select_Bottom = false;
      MFD_Center_Region_Select_Left = false;
      MFD_Center_Region_Select_Right = false;

      // Button_wipe("center");
    }

    if(i_MFD_Center_array != -1){
      i_MFD_Center_array = -1;
    }

    // if(Center_MFD_Reset_Switch_Interrupt_active == true){

    //   Button_wipe_all();

    //   MFD_Center_Region_Select_Top = false;
    //   MFD_Center_Region_Select_Bottom = false;
    //   MFD_Center_Region_Select_Left = false;
    //   MFD_Center_Region_Select_Right = false;

    //   Center_MFD_Reset_Switch_Interrupt_active = false;

    // }  
  }

  //set initial MFD region selection in 1st array
  if(MFD_Center_Region_Select_Top == false and MFD_Center_Region_Select_Bottom == false and MFD_Center_Region_Select_Left == false and MFD_Center_Region_Select_Right == false){

    if (Center_MFD_Up_Switch_Interrupt_active == true)
    {
      MFD_Center_Region_Select_Top = true;
      i_MFD_Center_array = 0;
      Center_MFD_Up_Switch_Interrupt_active = false;
    }
    else if (Center_MFD_Down_Switch_Interrupt_active == true)
    {
      MFD_Center_Region_Select_Bottom = true;
      i_MFD_Center_array = 1;
      Center_MFD_Down_Switch_Interrupt_active = false;
    } 
    else if (Center_MFD_Left_Switch_Interrupt_active == true)
    {
      MFD_Center_Region_Select_Left = true;
      i_MFD_Center_array = 2;
      Center_MFD_Left_Switch_Interrupt_active = false;
    } 
    else if (Center_MFD_Right_Switch_Interrupt_active == true)
    {
      MFD_Center_Region_Select_Right = true;
      i_MFD_Center_array = 3;
      Center_MFD_Right_Switch_Interrupt_active = false;
    } 

    if (Center_MFD_Middle_Switch_Interrupt_active == true){ //if middle button was triggered before a region was selected, reset middle trigger
      Center_MFD_Middle_Switch_Interrupt_active = false;
    }
  }

  //If initial MFD region has been set, get 2nd array
  if((MFD_Center_Region_Select_Top == true or MFD_Center_Region_Select_Bottom == true or MFD_Center_Region_Select_Left == true or MFD_Center_Region_Select_Right == true)){

    if (Center_MFD_Up_Switch_Interrupt_active == true)
    {
      MFD_Center_Joy_last = Center_Joy_matrix[i_MFD_Center_array][0];
      MFD_Center_button_last = Center_MFD_matrix[i_MFD_Center_array][0];
      Button_hold(MFD_Center_Joy_last,Center_MFD_Up_pin,MFD_Center_button_last);
      Center_MFD_Up_Switch_Interrupt_active = false;
    }
    else if (Center_MFD_Down_Switch_Interrupt_active == true)
    {
      MFD_Center_Joy_last = Center_Joy_matrix[i_MFD_Center_array][1];
      MFD_Center_button_last = Center_MFD_matrix[i_MFD_Center_array][1];
      Button_hold(MFD_Center_Joy_last,Center_MFD_Down_pin,MFD_Center_button_last);
      Center_MFD_Down_Switch_Interrupt_active = false;
    }
    else if (Center_MFD_Left_Switch_Interrupt_active == true)
    {
      MFD_Center_Joy_last = Center_Joy_matrix[i_MFD_Center_array][2];
      MFD_Center_button_last = Center_MFD_matrix[i_MFD_Center_array][2];
      Button_hold(MFD_Center_Joy_last,Center_MFD_Left_pin,MFD_Center_button_last);
      Center_MFD_Left_Switch_Interrupt_active = false;
    }
    else if (Center_MFD_Right_Switch_Interrupt_active == true)
    {
      MFD_Center_Joy_last = Center_Joy_matrix[i_MFD_Center_array][3];
      MFD_Center_button_last = Center_MFD_matrix[i_MFD_Center_array][3];
      Button_hold(MFD_Center_Joy_last,Center_MFD_Right_pin,MFD_Center_button_last);
      Center_MFD_Right_Switch_Interrupt_active = false;
    }
    else if (Center_MFD_Middle_Switch_Interrupt_active == true)
    {
      MFD_Center_Joy_last = Center_Joy_matrix[i_MFD_Center_array][4];
      MFD_Center_button_last = Center_MFD_matrix[i_MFD_Center_array][4];
      Button_hold(MFD_Center_Joy_last,Center_MFD_Middle_pin,MFD_Center_button_last);
      Center_MFD_Middle_Switch_Interrupt_active = false;
    }
  }

  if(Center_MFD_Set_Switch_Interrupt_active == true and MFD_Center_button_last != -1){
    Button_hold(MFD_Center_Joy_last,Center_MFD_Set_pin,MFD_Center_button_last);
    Center_MFD_Set_Switch_Interrupt_active = false;
  }
}

void Right_MFD()
{

  //if any left MFD directoin triggers have activated
  if(Right_MFD_Up_Switch_Interrupt_active == true or Right_MFD_Down_Switch_Interrupt_active == true or Right_MFD_Left_Switch_Interrupt_active == true or Right_MFD_Right_Switch_Interrupt_active == true or Right_MFD_Middle_Switch_Interrupt_active == true){
    Region_Select_Timer_Right_MFD = millis(); //start timer for timeout delay
  }
  else if((MFD_Right_Button_is_held == false and millis() - Region_Select_Timer_Right_MFD > Region_Select_Timeout)){  // or Right_MFD_Reset_Switch_Interrupt_active == true){ //if reset triggered or timed out then set region selection to false

    if(MFD_Right_Region_Select_Top == true or MFD_Right_Region_Select_Bottom == true or MFD_Right_Region_Select_Left == true or MFD_Right_Region_Select_Right == true){
      MFD_Right_Region_Select_Top = false;
      MFD_Right_Region_Select_Bottom = false;
      MFD_Right_Region_Select_Left = false;
      MFD_Right_Region_Select_Right = false;

      // Button_wipe("right");
    }

    if(i_MFD_Right_array != -1){
      i_MFD_Right_array = -1;
    }

    // if(Right_MFD_Reset_Switch_Interrupt_active == true){

    //   Button_wipe_all();

    //   MFD_Right_Region_Select_Top = false;
    //   MFD_Right_Region_Select_Bottom = false;
    //   MFD_Right_Region_Select_Left = false;
    //   MFD_Right_Region_Select_Right = false;

    //   // Right_MFD_Reset_Switch_Interrupt_active = false;

    // }  
  }

  //set initial MFD region selection in 1st array
  if(MFD_Right_Region_Select_Top == false and MFD_Right_Region_Select_Bottom == false and MFD_Right_Region_Select_Left == false and MFD_Right_Region_Select_Right == false){

    if (Right_MFD_Up_Switch_Interrupt_active == true)
    {
      MFD_Right_Region_Select_Top = true;
      i_MFD_Right_array = 0;
      Right_MFD_Up_Switch_Interrupt_active = false;
    }
    else if (Right_MFD_Down_Switch_Interrupt_active == true)
    {
      MFD_Right_Region_Select_Bottom = true;
      i_MFD_Right_array = 1;
      Right_MFD_Down_Switch_Interrupt_active = false;
    } 
    else if (Right_MFD_Left_Switch_Interrupt_active == true)
    {
      MFD_Right_Region_Select_Left = true;
      i_MFD_Right_array = 2;
      Right_MFD_Left_Switch_Interrupt_active = false;
    } 
    else if (Right_MFD_Right_Switch_Interrupt_active == true)
    {
      MFD_Right_Region_Select_Right = true;
      i_MFD_Right_array = 3;
      Right_MFD_Right_Switch_Interrupt_active = false;
    } 

    if (Right_MFD_Middle_Switch_Interrupt_active == true){ //if middle button was triggered before a region was selected, reset middle trigger
      Right_MFD_Middle_Switch_Interrupt_active = false;
    }
  }

  //If initial MFD region has been set, get 2nd array
  if((MFD_Right_Region_Select_Top == true or MFD_Right_Region_Select_Bottom == true or MFD_Right_Region_Select_Left == true or MFD_Right_Region_Select_Right == true)){

    if (Right_MFD_Up_Switch_Interrupt_active == true)
    {
      MFD_Right_Joy_last = Right_Joy_matrix[i_MFD_Right_array][0];
      MFD_Right_button_last = Right_MFD_matrix[i_MFD_Right_array][0];
      Button_hold(MFD_Right_Joy_last,Right_MFD_Up_pin,MFD_Right_button_last);
      Right_MFD_Up_Switch_Interrupt_active = false;
    }
    else if (Right_MFD_Down_Switch_Interrupt_active == true)
    {
      MFD_Right_Joy_last = Right_Joy_matrix[i_MFD_Right_array][1];
      MFD_Right_button_last = Right_MFD_matrix[i_MFD_Right_array][1];
      Button_hold(MFD_Right_Joy_last,Right_MFD_Down_pin,MFD_Right_button_last);
      Right_MFD_Down_Switch_Interrupt_active = false;
    }
    else if (Right_MFD_Left_Switch_Interrupt_active == true)
    {
      MFD_Right_Joy_last = Right_Joy_matrix[i_MFD_Right_array][2];
      MFD_Right_button_last = Right_MFD_matrix[i_MFD_Right_array][2];
      Button_hold(MFD_Right_Joy_last,Right_MFD_Left_pin,MFD_Right_button_last);
      Right_MFD_Left_Switch_Interrupt_active = false;
    }
    else if (Right_MFD_Right_Switch_Interrupt_active == true)
    {
      MFD_Right_Joy_last = Right_Joy_matrix[i_MFD_Right_array][3];
      MFD_Right_button_last = Right_MFD_matrix[i_MFD_Right_array][3];
      Button_hold(MFD_Right_Joy_last,Right_MFD_Right_pin,MFD_Right_button_last);
      Right_MFD_Right_Switch_Interrupt_active = false;
    }
    else if (Right_MFD_Middle_Switch_Interrupt_active == true)
    {
      MFD_Right_Joy_last = Right_Joy_matrix[i_MFD_Right_array][4];
      MFD_Right_button_last = Right_MFD_matrix[i_MFD_Right_array][4];
      Button_hold(MFD_Right_Joy_last,Right_MFD_Middle_pin,MFD_Right_button_last);
      Right_MFD_Middle_Switch_Interrupt_active = false;
    }
  }

  if(Right_MFD_Set_Switch_Interrupt_active == true and MFD_Right_button_last != -1){
    Button_hold(MFD_Right_Joy_last,Right_MFD_Set_pin,MFD_Right_button_last);
    Right_MFD_Set_Switch_Interrupt_active = false;
  }
}
/*-------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
-------------------------------- Interrupts triggering ---------------------------
-------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------*/

void Left_MFD_Up_Switch_Interrupt()
{
  Left_MFD_Up_Switch_Interrupt_active = true;
}
void Left_MFD_Down_Switch_Interrupt()
{
  Left_MFD_Down_Switch_Interrupt_active = true;
}
void Left_MFD_Left_Switch_Interrupt()
{
  Left_MFD_Left_Switch_Interrupt_active = true;
}
void Left_MFD_Right_Switch_Interrupt()
{
  Left_MFD_Right_Switch_Interrupt_active = true;
}
void Left_MFD_Middle_Switch_Interrupt()
{
  Left_MFD_Middle_Switch_Interrupt_active = true;
}
void Left_MFD_Set_Switch_Interrupt()
{
  Left_MFD_Set_Switch_Interrupt_active = true;
}
// void Left_MFD_Reset_Switch_Interrupt()
// {
//   Left_MFD_Reset_Switch_Interrupt_active = true;
// }

void Center_MFD_Up_Switch_Interrupt()
{
  Center_MFD_Up_Switch_Interrupt_active = true;
}
void Center_MFD_Down_Switch_Interrupt()
{
  Center_MFD_Down_Switch_Interrupt_active = true;
}
void Center_MFD_Left_Switch_Interrupt()
{
  Center_MFD_Left_Switch_Interrupt_active = true;
}
void Center_MFD_Right_Switch_Interrupt()
{
  Center_MFD_Right_Switch_Interrupt_active = true;
}
void Center_MFD_Middle_Switch_Interrupt()
{
  Center_MFD_Middle_Switch_Interrupt_active = true;
}
void Center_MFD_Set_Switch_Interrupt()
{
  Center_MFD_Set_Switch_Interrupt_active = true;
}
// void Center_MFD_Reset_Switch_Interrupt()
// {
//   Center_MFD_Reset_Switch_Interrupt_active = true;
// }

void Right_MFD_Up_Switch_Interrupt()
{
  Right_MFD_Up_Switch_Interrupt_active = true;
}
void Right_MFD_Down_Switch_Interrupt()
{
  Right_MFD_Down_Switch_Interrupt_active = true;
}
void Right_MFD_Left_Switch_Interrupt()
{
  Right_MFD_Left_Switch_Interrupt_active = true;
}
void Right_MFD_Right_Switch_Interrupt()
{
  Right_MFD_Right_Switch_Interrupt_active = true;
}
void Right_MFD_Middle_Switch_Interrupt()
{
  Right_MFD_Middle_Switch_Interrupt_active = true;
}
void Right_MFD_Set_Switch_Interrupt()
{
  Right_MFD_Set_Switch_Interrupt_active = true;
}
// void Right_MFD_Reset_Switch_Interrupt()
// {
//   Right_MFD_Reset_Switch_Interrupt_active = true;
// }

Wiring Details

pins 53 - 42 and 39-27 wired up to 3 5-way naviation switches using ground to trip digital pins to low

Additional context

Add any other context about the problem here.

gbrricci commented 4 days ago

Just tested a simpler example with button count set to 32 and Windows recognized it fine. I'm going to assume I broke something with my code and will recheck.