diff --git a/LinuxCNC_ArduinoConnector.ino b/LinuxCNC_ArduinoConnector.ino index 7a289cb..0812cb5 100644 --- a/LinuxCNC_ArduinoConnector.ino +++ b/LinuxCNC_ArduinoConnector.ino @@ -209,7 +209,7 @@ const int numCols = 4; // Define the number of columns in the matrix const int rowPins[numRows] = {2, 3, 4, 5}; const int colPins[numCols] = {6, 7, 8, 9}; -//####################################### END OF CONFIG ########################### + int keys[numRows][numCols] = { {1,2,3,4}, @@ -223,6 +223,7 @@ int lastKey= 0; //#define DEBUG +//####################################### END OF CONFIG ########################### //###Misc Settings### const int timeout = 10000; // timeout after 10 sec not receiving Stuff diff --git a/arduino.py b/arduino.py index 430994f..5a42359 100644 --- a/arduino.py +++ b/arduino.py @@ -312,11 +312,13 @@ while True: elif cmd == "M": firstcom = 1 - if value == 1 & LinuxKeyboardInput & Destination[io]: - subprocess.call(["xdotool", "key", Chars[io]]) - else: - c["MKey.{}".format(Chars[io])] = 1 - if(Debug):print("MKey{}:{}".format(Chars[io],1)) + if value == 1: + if Destination[io] == 0 and LinuxKeyboardInput == 1: + subprocess.call(["xdotool", "key", Chars[io]]) + if(Debug):print("Emulating Keypress{}".format(Chars[io])) + else: + c["MKey.{}".format(Chars[io])] = 1 + if(Debug):print("MKey{}:{}".format(Chars[io],1)) if value == 0 & Destination[io] == 0: c["MKey.{}".format(Chars[io])] = 0