Welcome, Guest. Please login or register.
Did you miss your activation email?
May 27, 2018, 12:51:57 PM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  VB and the development of wizards
| | |-+  PoKeys57CNC, Matrix Keyboard and Macro
Pages: 1   Go Down
Print
Author Topic: PoKeys57CNC, Matrix Keyboard and Macro  (Read 411 times)
0 Members and 1 Guest are viewing this topic.
AlexRu
Active Member

Offline Offline

Posts: 6


View Profile
« on: February 13, 2018, 05:40:23 AM »

Hello all together,

I have built a MPG which includes a 4x5 matrix-keyboard. All connected to Pokeys57CNC. All buttons, which are calling OEMButtons working fine.

Now I want to call some functions of the used Schmidt-Screen with the keyboard. When I put the things in macropump, the keys are detected and the functions work. But sometimes when using macropump, some or most buttons of the screen will not work. Also the keys mapped to OEMButtons are not responding (as example: Set X to 0). Looks like mach3 hangs when using macropump tried on Win10 64bit and Win7 32bit).

Now I tried to use OEMTrig#1 to call a macro which contains the function calls. In PoKeys Input-Settings I defined as example OEMLed 1501 and OEMTrig#1 when a key is pressed. Everything is fine and when I test it in a macro, the key press is detected.

code:
If GetOEMLED(1501) =1 Then
 MsgBox("Button 1")
End If


But when I want more keys with different LEDs, only the last MsgBox appears. MsgBox Button 1 and Button 2 is not comming up.

OEMTrig-Macro:

If GetOEMLED(1501) =1 Then
 MsgBox("Button 1")
ElseIf GetOEMLED(1511) =1 Then
 MsgBox("Button 2")
ElseIf GetOEMLED(1512) =1 Then
 MsgBox("Button 3")
End If

alternative also not working:

If GetOEMLED(1501) =1 Then
 MsgBox("Button 1")
End If
If GetOEMLED(1511) =1 Then
 MsgBox("Button 2")
End If
If GetOEMLED(1512) =1 Then
 MsgBox("Button 3")
End If

What do I have to put in the macro, that it will work? Or is this not possible?

For reference the working macropump-code (PoKeys57CNC set to the virtual IOs "Mach3 IO #21-Mach3 IO#24):

If GetIODevInput(0,21) = 1 Then
 MsgBox("Button 1")
End If
If GetIODevInput(0,22) = 1 Then
 MsgBox("Button 2")
End If
If GetIODevInput(0,23) = 1 Then
 MsgBox("Button 3")
End If
If GetIODevInput(0,24) = 1 Then
 MsgBox("Button 4")
End If

Greetings

AlexRu
« Last Edit: February 13, 2018, 05:42:58 AM by AlexRu » Logged
AlexRu
Active Member

Offline Offline

Posts: 6


View Profile
« Reply #1 on: February 13, 2018, 04:45:15 PM »

Hello together,

after testing some more macro-code, I found the solution that works fine for me. Without the need of macropump which causes trouble on my setup under win7 and win10.

In PoKeys config for the matrix-keyboard, set the IOs to OEMTrigger#1 to OEMTrigger#15 (depends on how many keys you need)

In the HotKeys config, set all used OEMTriggers to OEMButton 301, in general config add as example m301 to the initilisation string.

m301-macro:
<code>
SetTriggerMacro 302   'macro called by OEMTriggers when set to OEMButton 301
</code>

Then in the macro which is used for OEMTriggers write the following:

m302-macro:
<code>
If IsActive(OEMTrig1) Then
  MsgBox("Button 1 pressed")
  Code("M1111")    'call Macro M1111
End If

If IsActive(OEMTrig2) Then
  MsgBox("Button 2 pressed")
  If xyz Then
      abc
  End If
End If

If IsActive(OEMTrig3) Then
  MsgBox("Button 3 pressed")
EndIf

and so on...
</code>

With this you are limited to 15 keys or less (if you use OEMTriggers for inputs). But I only need 9 of them and the rest is open for future usage.


I hope this helps somebody, when functions of a screenset or macros are needed on keypress or input activity.

Greets

AlexRu

P.S. Please post a little thanks if this is helpfull and you maybe can use this in future.
Logged
Tweakie.CNC
CNC is only limited by our imagination.
Global Moderator
*
Offline Offline

Posts: 7,231


Super Kitty


View Profile WWW
« Reply #2 on: February 14, 2018, 01:55:23 AM »

Excellent work AlexRu, thank you for sharing.

Tweakie.
Logged

Success consists of going from failure to failure without loss of enthusiasm.  Winston Churchill.
AlexRu
Active Member

Offline Offline

Posts: 6


View Profile
« Reply #3 on: February 17, 2018, 06:05:52 PM »

Hello again,

after watching a youtube video, in which a user of pokyes has shown lag when using IOs to switch OEMTrig in the mapping, I switched over to calling OEMButton 301 and setting OEMLeds in the mappings, only to be sure to have no lag when pressing a button. Working so far.

But again I have got the problem, that sometimes no macro call is working in mach3. Beeing it over my matrix-keyboard or over the screenset itself. I figured out, that every time I use the MPG to move my axis, all macro calls are blocked. When disabling the MPG over the screenset, I can call macros again. Over the matrix-keyboard and the screenset.

Do somebody else have this problem or is it only me? Ist this a mach3 problem or could it be, that it's related to the used Pokeys57CNC?

Greets

Alex
Logged
AlexRu
Active Member

Offline Offline

Posts: 6


View Profile
« Reply #4 on: February 18, 2018, 06:09:59 AM »

Hi,

i have posted the problem in the Pokeys forum, so if somebody has the same problem or an idea, please post there. http://www.machsupport.com/forum/index.php/topic,36629.msg251117.html#msg251117

Greets

Alex
« Last Edit: February 18, 2018, 07:42:52 AM by Tweakie.CNC » Logged
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.20 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!