Xbox controller plugin not sending button press to other plu

This is where you talk about Plugins. How they are made and how they work, show examples.

Re: Xbox controller plugin not sending button press to other

Postby dezsoe » Tue Aug 22, 2023 7:18 pm

I understand what the issue is, but it does not exist. In my environment I often call buttons from other plugins. In the video below you can see a button bar on the bottom: that is a plugin that can call buttons and it does it. I also have other stuff that calls buttons from the probe screen (which is also a plugin). They all work.

As you asked, I wrote a second plugin which can call any button and the button executes as you can see in the console window.

dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Xbox controller plugin not sending button press to other

Postby eabrust » Wed Aug 23, 2023 12:45 am

Gerry, Dezsoe,

I may have an idea what is going on.

Gerry, the 'template' plugin sub for a 'button press_event' makes use of the boolean variable 'OnScreen', and conditionally only does something if 'OnScreen' is true.

I was playing around and found that when a plugin sends a button press, 'Onscreen is false'. Do you still have a check based on the template that requires 'Onscreen' to be true? I did, and if you take that away or make the plugin do something if it is 'false', then the plugin will respond to the xbox control sending a button press of any number. Hope that is it, and it is easy fix for you.

The Template code:
Code: Select all
    Public Sub Buttonpress_event(ByVal ButtonNumber As Integer, ByVal OnScreen As Boolean)
        If OnScreen Then
            UC.AddStatusmessage("Onscreen Button#:  " & ButtonNumber)
            MessageBox.Show("onscreen button #:  " & ButtonNumber)
            'If ButtonNumber = 128 Then
            '    ' Code...
            'End If
        End If
    End Sub


Changed so a Plugin will respond to another plugin pushing the button:
Code: Select all
    Public Sub Buttonpress_event(ByVal ButtonNumber As Integer, ByVal OnScreen As Boolean)
        If OnScreen Then
            UC.AddStatusmessage("Onscreen Button#:  " & ButtonNumber)
            MessageBox.Show("onscreen button #:  " & ButtonNumber)
            'If ButtonNumber = 128 Then
            '    ' Code...
            'End If
        Else  '  <-------  Plugin will only do something from an 'onscreen=false' event caused by other plugin.
            UC.AddStatusmessage("Offscreen Button#:  " & ButtonNumber)
            MessageBox.Show("Offscreen Button#:  " & ButtonNumber)
        End If
    End Sub



regards
Eric
CraftyCNC: Plugins for UCCNC (and other neat stuff): http://www.craftycnc.com/plugins-for-uccnc/
eabrust
 
Posts: 357
Joined: Fri Sep 16, 2016 2:32 am
Location: Near Shirland IL, USA

Re: Xbox controller plugin not sending button press to other

Postby dezsoe » Wed Aug 23, 2023 4:23 am

Eric, I think you're right. I removed that condition from my template many years ago, so I didn't think of it, but I'm sure that that is the problem.
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Xbox controller plugin not sending button press to other

Postby ger21 » Wed Aug 23, 2023 11:29 am

I can't check until later, but yes, I do believe you are correct.
Much easier fix. :D Thanks for finding this for me.
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2714
Joined: Sat Sep 03, 2016 2:17 am

Previous

Return to Plugins

Who is online

Users browsing this forum: No registered users and 5 guests