Hello Guest it is May 12, 2021, 06:49:17 PM

Author Topic: Mouse MPG Module  (Read 637 times)

0 Members and 1 Guest are viewing this topic.

Mouse MPG Module
« on: January 15, 2021, 02:24:58 AM »
I am expiremtning with the mouse mpg I found here https://www.youtube.com/watch?v=MRyaRQwhYWk.

I was wondering if there is any way to listen for the scroll wheel without having to enter the window or a lua panel with the mouse?

I tried making a lua panel the size of the entire screen and then selecting the hidden check box in the screen editor. It worked but then I couldn't press any of the buttons on screen.
Re: Mouse MPG Module
« Reply #1 on: January 15, 2021, 10:00:30 AM »
I don’t think you can do it with Lua. In c++ I know I can do it but it is a low level windows call. This could be done in the keyboard plugin as it has the low level windows hooks.
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com
Re: Mouse MPG Module
« Reply #2 on: January 19, 2021, 10:13:01 PM »
do you think it would be possible for the devs to give us access to a register for the mousewheel rotation in the keyboard plugin? HID devices are easy to emulate with cheap hardware and could open the door to some cool stuff via bluetooth.

currently doing this like the youtube tutorial but only works in panel or wizard:
Code: [Select]
        panel:Connect(wx.wxID_ANY, wx.wxEVT_MOUSEWHEEL, function(event)
mpgRotation = mpgRotation + event:GetWheelRotation()
mc.mcRegSetValueLong(mpgPosReg, (mpgRotation / 120))
         end)

working on a bluetooth conversion for cheap MPG pendant
https://github.com/kethort/esp32-bluetooth-cnc-mpg-mach4
Re: Mouse MPG Module
« Reply #3 on: January 21, 2021, 01:17:52 PM »
Let me see if I can do that .. my list is getting long of things I need to do :( But let me see !
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com
Re: Mouse MPG Module
« Reply #4 on: January 22, 2021, 11:51:08 PM »
I didn’t forget about this. I have been updating the code for the mouse mpg wizard. I will try to make a video showing shuttle mode. It really works slick! I will post it here soon.
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com
Re: Mouse MPG Module
« Reply #5 on: January 23, 2021, 08:39:10 AM »
Hi all,
Here is my updated Mouse MPG code. The code looks a bit rough as I have not gone to clean it back up. I really made this to test the functionality of shuttle mode so I didn't have to wire anything into my development PC. What can I say! Walking over getting a board wiring an MPG is simply more work than sitting at your desk enjoying your coffee. Anyway enough about the origin of this.

Instructions to test it out and use it ... Place the lua file into the Wizards directory (mach4hobby/Wizards). To start it up go to Wizards menu and select MouseMPG .  Now to test it simply select Shuttle. Load of your favorite Gcode files and press cycle start. The machine will NOT move if Shuttle mode is active. Mouse back over and give focus to the MouseMPG window that is up. Move the mouse wheel and proportional to your wheel speed the machine will do the Gcode file. You stop moving it stops.  Now you don't have to go forward only.. You can just wiggle the wheel back and forth. If you select some other selection in the MouseMPG dialog it will take off and start running. at programmed feedrate. I think that should be enough to test. Please tell me how it works for you and if you think this is worth going into the release. I can add it to the installer or even put it as an item on the main screen of 4.

Thanks
Brian
 
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com
Re: Mouse MPG Module
« Reply #6 on: February 01, 2021, 04:36:38 PM »
This shuttle mode is cool, but the original question was a bit different.
 
... I was wondering if there is any way to listen for the scroll wheel without having to enter the window or a lua panel with the mouse? ...

I was asking if the devs could allow listening to scroll wheel in the keyboard plugin so the mouse doesn't have to be in a window or panel in order to get the counts. No worries if not possible, just thought it would be useful.
Re: Mouse MPG Module
« Reply #7 on: February 01, 2021, 04:54:09 PM »
Yeah, it looks like it can be done.. I have been trying to get things off my plate. I will give it an hour tomorrow and see if I can get this https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowshookexa to  work. I have a hook in now to grab the low level keyboard so I should be able to make that work as well. Mucking around with this stuff is on my list of things I don't like so it takes a push to do it :)

Thanks
Brian
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com
Re: Mouse MPG Module
« Reply #8 on: February 02, 2021, 06:45:31 PM »
Update, I got the mouse wheel so I can  read it, the question is do you want the mouse wheel to keep being sent to the rest of windows or do you want me to stop the message propagation? In other words the mouse wheel will stop working in whatever you have selected. I can add a toggle as a key binding or as an output you can map. You asked for it lol
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com
Re: Mouse MPG Module
« Reply #9 on: February 02, 2021, 07:20:43 PM »
That’s cool. Is this feature in the keyboard plugin? Can I get a link to test it out? I won’t really know if the key binding will be necessary until I can test it