Hello Guest it is April 23, 2024, 08:53:39 PM

Author Topic: PLUGIN signals access via LUA?  (Read 4163 times)

0 Members and 1 Guest are viewing this topic.

PLUGIN signals access via LUA?
« on: March 09, 2016, 04:00:10 PM »

I have been working with the POKEYS plugin for MACH4 and after much experimentation I think I have reached the conclusion the only way to implement a MPG pendant with buttons and LCD with via LUA scripts.

My question is when you have a plugin that provides access to input signals like on a pendant that require that plugin.  How do you access those signals via scripts?  In the case of the POKEY plugin you normally access a matrix key press by configuring MACH4 in the input signal page and assign it to POKEYS_123  Row6, Column3 for example.  I can find no example where you access these via a LUA script, and the POKEYS MACH4 plugin documentation does not mention anything in this area.  The release note listed below on one of the last MACH4 releases seems to imply their might be a way?

Thanks
Russ
 :D

Release Notes: Added mcPluginPanel control to allow a plugin to have a panel that is integrated into the screen set as opposed to a floating window. If this is used, a button must be provided on this panel to access the normal plugin configuration dialog if needed. SIM plugin updated to include example.

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: PLUGIN signals access via LUA?
« Reply #1 on: March 09, 2016, 04:11:41 PM »
The plugin panel is purely for plugins to implement a panel direct from the plugin, if you go into your screen editor and add a panel you will find an example from the sim called sim0/panel0, this way plugins can have panels connected directly from the core.

POKEYS would have to write the panel into their plugin.

DazTheGas
New For 2022 - Instagram: dazthegas
Re: PLUGIN signals access via LUA?
« Reply #2 on: March 09, 2016, 04:16:33 PM »
DasTheGas,

So there is no way to access any of the signals generated by a outside device that uses a plugin like POKEYS?

You get into very limited ways to use a plugin if you can't access those inputs, because when you assign them in MACH4 only one thing can be assigned at a time.  For example I assigned the POKEYS plugin to send an output to a MATRIX LED for Feedhold when the Feedhold button inside of MACH4 was pressed.  That works, but things like Spindle Forward, Spindle Stop, Spindle Reverse are not accessible because they are linked to the ESS plugin, so you can get that to feed Pokeys as well.

Just started reading all the LUA stuff and have been looking at examples.

Thanks for you help.

Russ

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: PLUGIN signals access via LUA?
« Reply #3 on: March 09, 2016, 04:23:34 PM »
I know nothing about the POKEY but its about time i did, i perhaps download and take a quick look at plugin as if its using signals then there`s normaly a way to manipulate these.

DazTheGas
New For 2022 - Instagram: dazthegas
Re: PLUGIN signals access via LUA?
« Reply #4 on: March 09, 2016, 04:31:01 PM »
Daz,
The POKEYS device is pretty amazing and very cheap, with lots of IO.  Without a device not sure the plugin will allow you to configure the device.  You can certainly load the plugin and when you go to configure the device it will come back and tell you it can not find a device.  The make these devices for the USB bus as well as Ethernet interface and they are expandable.  I noticed you played with a keyboard plugin when you did the board with four button switches or something.  These POKEYS devices can control LCD displays, have matrix keyboards, matrix LED displays, output analog voltages, read sensors, etc.  They are pretty amazing tiny devices.

Russ
Re: PLUGIN signals access via LUA?
« Reply #5 on: March 09, 2016, 04:35:32 PM »
Daz,

The thing that made me think they any plugin might be accessible is because when I read the LUA documentation they claim all variables on a screen are globally accessible.  When you go to configure MACH with the POKEYS plugin it shows the device just like an ESS shows up. When you configure an output in MACH4 and you assign that to a matrix LED you refer to the POKEYS and the Row and Column.  Seems like these would be available for access in LUA.  Maybe I am off in dreamland... LOL   

Russ
Re: PLUGIN signals access via LUA?
« Reply #6 on: March 09, 2016, 04:51:55 PM »
DaxTheGas,

OK, I read the LUA document and they mentioned the best way to implement things was via Registers.  They said to go to the MACH4 diagnostic page and click on Register Diagnostics, this is a realtime view of the registers defined and their contents.

POKEYS shows up. 
Encoder values, Analog inputs, counters, debug?, LCD Line 1-4, PWM duty cycle, etc.

My hunch was correct much of this is available via registers.  What I did not find was the MATRIX implementations for the keyboard and LED.  I need to keep digging because clearly the plugin implements much of this info making it available to the core.

Russ

Offline dude1

*
  •  1,253 1,253
    • View Profile
Re: PLUGIN signals access via LUA?
« Reply #7 on: March 09, 2016, 05:45:24 PM »
you need to ask the pokeys people about it, it also depends what board you have it sounds like you have the 57cnc if you do there is a slight diffrences between 1.1 and 1.2, 1.2 is more do almost anything
Re: PLUGIN signals access via LUA?
« Reply #8 on: March 09, 2016, 05:58:56 PM »
Blockhead,

I actually have a Pokey56U, but the software now calls it a 57U, they are almost identical.  The Global Registers have many things that say Debug, but I could not tell where it stores the keys pressed on a matrix keyboard or the LED to be illuminated for a Matrix LED.

Russ
 

Offline dude1

*
  •  1,253 1,253
    • View Profile
Re: PLUGIN signals access via LUA?
« Reply #9 on: March 09, 2016, 06:29:46 PM »
the 56U is a almost out the window board, if you go into the pokeys config an bring up the matrix keyboard settings and the led setting it has what you need you just need to translate it back to the pokeys config inside mach and map it.

and you can use the digital inputs and output and analog to find what is active or not in the pokeys config.

it's just mapping the correct pin to the function in mach.

it is difficult I have a 57cnc v1.2 and it was easy to set up the basic stuff, but mapping the spindle and other functions is a bit harder, if you stuff it up I found if I reset the pokeys in the pokeys dialog and power cycled it and don't change anything in the mach pokeys dialog, it pushed the mach settings onto the board when you start mach back up, they are crazy arise boards how the almost set there self up when you have everything connected,

mine in the pokeys dialog it only shows the pwm signal and nothing else but if I go into the digital inputs and output and analog inputs and output it shows what pin is working.

DAZ they are very interesting boards to use but the ESS is close to being as good, if I was to requirement a board for M4 it will be the ESS or pokeys 57U or E the 57cnc V1.2 is more than the ESS could be but that's only because it has a tonne of IO and does not need a bob