Hello Guest it is April 24, 2024, 06:15:55 AM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - cncman172

Pages: 1 2 »
1
Mach4 General Discussion / LUA code seems to disable the machine?
« on: January 28, 2017, 03:58:13 PM »
I am having a strange issue I can't seem to get my head around.  I have the ESS which works fine, and I also have the Pokeys Plugin which I have been attempting to turn into a pendant.  Much of that works as well.

I have defined Port3-Pin16 on the ESS as SERVO ON, then inside of MACH4, i define Enable#2 as SERVO ON.

I use a relay enabled by Port3-Pin16 to enable the servo drivers, that all works perfect.  I can run gcode and that all works the servos are enabled.

Now when I move my Axis selector switch on my pendant that disables MACH4?

If I don't touch the pendant the message "No Axis Selected" prints on the console.  I just put these messages in to verify it was seeing the switches.  I can even comment out those messages for like the A Axis, the next switch position next to OFF, but it still disables MACH4.

If I enable Mach4 after this happens then I can use the pendant and jog the given axis.  I must be doing something wrong here and can't seem to figure out where I went wrong.


Any help or suggests are welcome, I am sure I did something stupid.  I remember this code all working before?



ESS Port3-Pin16 defined as SERVO ON
Mach4 Enable#2 SERVO ON

LUA code

if XSelect == 1 then
      mc.mcMpgSetAxis(inst,0,0)  -- X Axis
      mc.mcCntlSetLastError(inst,"X Selected")
      mc.mcSignalSetState(PenHandleLED,1)
                mc.mcCntlSetLastError(inst,"Handle LED ON")
   elseif YSelect == 1 then
      mc.mcMpgSetAxis(inst,0,1)  -- Y Axis
      mc.mcCntlSetLastError(inst,"Y Selected")
      mc.mcSignalSetState(PenHandleLED,1)
   elseif ZSelect == 1 then
      mc.mcMpgSetAxis(inst,0,2)  -- Z Axis
      mc.mcCntlSetLastError(inst,"Z Selected")
      mc.mcSignalSetState(PenHandleLED,1)
   elseif ASelect == 1 then
      mc.mcMpgSetAxis(inst,0,3)  -- A Axis
       mc.mcCntlSetLastError(inst,"A Selected")
      -- mc.mcSignalSetState(PenHandleLED,1)
   elseif OFFSelect == 1 then
      mc.mcMpgSetAxis(inst,0,-1)  -- No Axis
      mc.mcCntlSetLastError(inst,"No Axis Selected")
                mc.mcSignalSetState(PenHandleLED,0)
    end

2
Mach4 General Discussion / Copy DRO to external display
« on: December 04, 2016, 11:39:10 AM »
Guys,

I have a few questions.  I am attempting to copy the current DROs for X,Y,Z,A to an external LCD display.

I have looked in the Wx4 screenset and see the dro name in the screenset is droCurrentX for the X axis.

I also looked at #variables and there seems to be several with the DRO contents.  5221,5222,5223,5224 appear to hold the G54 DROs, and I think the Machine coordinates are held in 5021,5022,5023,5024

What I really want is whatever is displayed in the droCurrentX or whatever axis to get copied to a plugin register.

Each LCD line on the display has a plugin register as follows:
Pokeys Plugin Registers
PoKeys_32062/LCD Line1:
PoKeys_32062/LCD Line2:
PoKeys_32062/LCD Line3:
PoKeys_32062/LCD Line4:

I can look under Diagnostics/Regfile/Pokey_32062 and look at the various registers.  I can click on those register and it opens a value screen and I can key in a number and the display updates.

The display is 4x20

Then I decided can I actually read the register and display it in LUA code, after reviewing the scripting manual.  I have many switches and MPG, etc. all work fine in the LUA code.

local pval, hreg = mc.mcRegGetHandle(inst, string.format("PoKeys_32062/LCD Line1:/%s", regname))

pval = mc.mcRegGetValueString(hreg)
wx.wxMessageBox(pval)

I tried something like this and got nothing.  I am sure the way you access register must be wrong or something.  I just followed the example but nothing seems to work.

Is there a better way to do what I want to accomplish?  Thanks

Russ









3
Mach4 General Discussion / MACH4 Profiles
« on: November 17, 2016, 12:57:11 PM »
Quick question on Mach4 profiles.

I used the MACH4 loader and had it copy Mach4mill and created a new version that I could test new LUA code.  I had lots of that code working but decided I wanted to work on a plugin that was causing issues, which was the POKEYS plugin.  I decided to help the Polab troubleshoot the issue I would go back to the unmodified version of Mach4mill and created another profile that copied Mach4mill and used that version to make changes in the LUA code.  Today I wanted to go back to my previous version which had lots of working LUA code and when I did all the LUA code was gone, it was back to the the code that came standard in Mach4mill.  My understanding is that profiles copied all the changes you made to the WX4 screen and kept all that code in the profile directory.  When I was using the profile for Pokeys it only had a few lines of LUA code, buy my RussMill profile had everything.  It seems like the Profile does not save all the LUA code in Screen Load, PLC, etc.


Anyone else seen this happen?  Good thing I can copied all of this stuff and pasted it to a Word document so at least I can get working code back by pasting the LUA back into a new profile.

Russ

4
Mach4 General Discussion / LUA Debugging Challenges
« on: October 30, 2016, 04:42:07 PM »
Guys,

I have been playing with LUA this weekend in an attempt to get my pendant to work.  I am getting some strange behavior..

If I add some code to the Screen Load section it all goes in and seems fine.  I even try to compile it and it compiles successful.  Then I try to go into Debug and get the follow error?

Compilation successful!
Output: "C:\Users\Russ\AppData\Local\Temp\leEBAB.mcc"
Compilation successful!
Output: "C:\Users\Russ\AppData\Local\Temp\leEBAB.mcc"
Waiting for client connection...
Debug server disconnected.
Debugger socket not created. Debugger EvaluateExpr
Killed debuggee process 4800.
Debug session finished.

I decide to try to debug again and it opens and steps into the first line of the Screen Load script I hit the F11 hit and step in several lines.  All looks good...
If I hover of any of the lines in the top of the code after I have stepped by them I can see their actual value, just what I want... However, as I get down into the Signal Library area I start to get something else.

pageId = 0
screenId = 0
testcount = 0
machState = 0
machStateOld = -1
machEnabled = 0
machWasEnabled = 0
inst = mc.mcGetInstance()

---------------------------------------------------------------
-- Signal Library
---------------------------------------------------------------
SigLib = {
[mc.OSIG_MACHINE_ENABLED] = function (state)
    machEnabled = state;
    ButtonEnable()
end,

[mc.ISIG_INPUT0] = function (state)
   
end,

As I try to check any input by hovering over it after I have stepped past that line of code I get the following.
string : Lua : Syntax error during pre-compilation

Strange thing is some of the code I had in the Screen Load script that worked before I added some more inputs still works.  For example hitting a key to enter feedhold is another input and that still works?


This is some of the new code I added but this is pretty standard stuff, not sure where to start to figure out what is causing the issue.
[mc.ISIG_INPUT40] = function (state)
SRO()
--Spindle RPM Rate switch pokeys pin 47
end,
[mc.ISIG_INPUT41] = function (state)
SRO()
--Spindle RPM Rate switch pokeys pin 50
end,
[mc.ISIG_INPUT42] = function (state)

The function SRO is defined below all the inputs just like a few other sample functions but it not even getting to the function because of the lack on input data?


Thanks
Russ









5
Guys,

Quick question I could not find in the manuals.  I had several scripts written and working and decided to upgrade to the latest version of MACH4.  I save my XML file and when I installed the new version I put my old XML file in the director and all the axis and everything worked except all my LUA code just disappeared.  Does this get saved in some other file that I forgot to save?  Thanks

Russ

6
Mach4 General Discussion / Working with LUA
« on: March 28, 2016, 10:23:51 AM »

Hey Gang,
I have tried for the last few weeks to get things to work in LUA and it is challenging.  I can get some very basic code to work but I decided to try the pendant code under examples and each time the code hits
the third line of code in the main() program where it sets the color I get the error below.  Anyone have any idea what I might be doing incorrectly?  Thanks

Russ


function main()
    panel = mcLuaPanelParent;
    mc.mcCntlSetLastError(0, 'panel is parent!!!');
    panel:SetBackgroundColour(wx.wxColour(255,255,255));

**********************

mcLua ERROR: Lua: Error while running chunk
[string "C:\Mach4Hobby\LuaExamples\Pendant Project\Mai..."]:58: attempt to index upvalue 'panel' (a nil value)
stack traceback:
   [string "C:\Mach4Hobby\LuaExamples\Pendant Project\Mai..."]:58: in function 'main'
   [string "C:\Mach4Hobby\LuaExamples\Pendant Project\Mai..."]:382: in main chunk


mcLua ERROR: Lua: Error while running chunk

Debug session finished.

7
Mach4 General Discussion / MPG mode Always On
« on: March 11, 2016, 11:02:37 AM »
I have MACH4 configured with a POKEY pendant.  The selector switches for X,Y,Z,A,B all work and when I rotate the MPG the selected axis moves as expected.

The issue is the MPG always moves the machine, even during Gcode processing if you turn the MPG the motion is impacted.

Inside the Pokey Plugin configuration I do have a dedicated switch assigned to the Deadman feature. When the switch is activated the MPG moves the axis like normal.  If I disable the pendant with the deadman switch the MPG axis selector switches are not recognized as expected, but if you turn the MPG wheel the last axis that was moved moves again with the MPG wheel.

I even has set MPG JOG inside the POKEY plugin to always OFF, saved, exited, restarted MACH4 and the MPG still moves the last axis.

There must be something somewhere to fix this issue.  Any help guys?

Russ

8
Mach4 General Discussion / 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.

9
Mach4 General Discussion / MACH4 & ESS & POKEYS pendant
« on: March 06, 2016, 06:26:30 PM »
Hey Guys,

I have MACH4 version 2.2914, Pokeys 7.24.0.2914, and the last release of ESS plugin.

I can move the X,Y,Z axis and run gcode and all seems to work fine.

I then setup the Water Cooled Spindle using CNC4PC board C41 and the relays and the analog voltage outputs range 0-10V

So, the next step before the big switch from Mach3 was to get my pendant working which is based on the Pokeys 56U, the USB version.

The pendant works perfect on MACH3 with their plugin no issues at all.


POKEY 56U version of firmware is 3.1.68 which is the latest for this particular POKEYS it checks each time you run the POKEYS software.

First thing I configured was the Matrix keyboard which is 8x6, then the LCD 4x20, then the LED Matrix.  All of the configuration looks identical to the way it is setup under MACH3.

I decided to take this in small steps.  I decided since the Axis Selector switch (X,Y,Z,A,B) was connected directly on dedicated POKEY pins it should be easy to get working.

On the Pokeys Plugin configuration page for Pendant the following are set.
Enable Pendant Mode
Pendant on Pokeys I/O
I did NOT have the MAP pendant Signals to MACH4 checked might be an issue, not sure.

The enable Dead-man switch I could not get to work by using the 5th axis position as OFF, so I figured I can always add a dedicated switch to enable the pendant later, so I Set that switch to Always ON for debugging.
MPG1-X is switch,Pin44,inverted
MPG1-Y is switch, Pin43, inverted
MPG1-Z is switch, Pin42, inverted
MPG1-A is switch, Pin 41, inverted
MPG1-B is switch, Pin 40, inverted.
Emergency Switch, pin 55, estop switch

On the POKEYS encoder page
Encoder 1, Pin1, Pin2 is enabled.

When I save this and exit and then restart MACH4, I can get in and enable MACH4, then move the MPG selector to X,Y,or Z and spin the MPG and the axis move as expected.  So I started to get excited as this is the first time I have ever been able to get the Pokey plugin to move an axis with the MPG.  I still need to work out the dead-man switch issue so the MPG is not enabled all the time.

Next I decided to do something simple like turn on an LED on the pendant, sounds pretty simple.  The LEDS are all connected to the POKEYS on the 2nd LED Matrix.  If I use the Pokey application I can tell it to turn on all the LEDs on the pendant and that works perfect.  So the next step was to just turn on one LED from inside of MACH4.

I decided that an easy on would be "Feed Hold"

I configure MACH4 Output signals as follows:

Feed Hold, mapping enabled, Pokeys_32062 Matrix LED2, Row 6, Column 7, and did not activate it low... i actually tried it active high and low still nothing.

To test if this worked.  I exited MACH4 came back in and ensured all the configuration was still valid, and it was all exactly the same, so it saved the configuration.

Next I enabled MACH4, and loaded the roadrunner Gcode file.  I pressed cycle start and the axis start moving drawing the roadrunner.  I  press Feed Hold on the MACH4 screen and the program is paused and stops motion.  However, the Feed Hold LED on the pendant does not light up and no other LED lights up either.

Now I go back into the pokey standalone application and go to the diagnostic page to test peripherals, and manually light up R6,C7 and the Feed Holder LED lights right up perfect.

I also decided to test some of the other peripherals, I figure I should check the Matrix Keyboard, which all works perfect on prior version of Pokeys for MACH3 and the pokey application.

This time I discover the Matrix Keyboard is not seeing all the keys.  The keyboard is setup as an 8x6 keyboard.   Eight Rows 1-8, and six Columns A-F
A1,A2,B1,B2,C1,C2,D1,D2,E1,E2,F1,F2, and A5 are not working.

The next thing I discovered was I could not get the LCD to function on the Pendant either, again this is not a MACH4 issue, the standalone Pokey application would not initial the display this all works on prior versions under MACH3.

Not sure if the latest release of POKEYS had issues with the Matrix Keyboard and the LCD???

Anyway I was still trying to get some of the LEDs to light but it appears to have something to do with the MATRIX feature in the POKEYS.

Anyone else had any luck getting this stuff to work.  Thanks

Russ

 

10
Mach4 General Discussion / Mach4 & ESS and G43 issues
« on: February 08, 2016, 09:47:18 AM »
I decided to test MACH4 and my ESS after waiting another six months to see if it is now stable.  I have installed Build 4.2.0.2872, the latest ESS plugin and have the machine moving fine and homing works fine as well.  I decided to load a small Gcode file that I have run on MACH3 fine as just a little test to see if things look good before getting the license for MACH4.

My little Gcode file is to build a small bracket and it uses four tools.  I do not have an automatic tool changer so for the test I did not even turn on my spindle, nor did I have any tool in the spindle.  I referenced all axis and that worked fine.  Then I put in a offset of three inches in X and Y and zero those DROs.  I set the Z0 about two inches off the table as this was just going to be an air cut to see how well motion was working.

The first part of the code worked just fine.  It hits the first tool change and I click ok.  There is no tool so I just tell it to proceed with cycle start and it does the next segment just fine as well.  On the third tool change things go wrong.

N480 M01
N490 T3 M6
N500 G0 G90 G54 X.8028 Y.6692 S8000 M3
N510 G43 H3 Z.1
N520 G99 G83 Z-.407 R.1 Q.1 F4.28

On line N510 the Z axis goes full speed all the way down into the table.  No tool broken and I hit the emergency stop to avoid damage to the ballscrew.

This segment of code is pretty much identical to the two previous parts of the code after a tool change.  The DRO reads something like Z 1.5 when the spindle is crashing into the table.

T1 M6
G43 H1 Z1.5

T2 M6
G43 H2 Z1.5

T3 M6
G43 H3 Z.1     *** this one crashes....

I just looked at the release notes for this version and it says they cleaned up fixture offset corrupting the tool table.   Well something seems corrupted for sure....

Keep in mind this code works perfect under MACH3 with no changes.  Since I am not using the automatic tool changer, I never populate the Tool table.  I assume and seems to be confirmed by others that MACH should use a zero offset and use the Z setting created when using G54.

This is a very short program and it is next to impossible to troubleshoot the issues due to the fact they have the timeout value for the DEMO version so short you can't do much testing.  The previous Gcode lines of code limit seemed to work much better at least you could test to see if everything seemed to be working.  Anyway this appears to be a bug unless I have just done something completely wrong.  Any help or suggestions would be much appreciated.  Thanks

Russ




Build 4.2.0.2872 - 01 February 2016

1) Update core API documentation covering threading, rigid tapping,
   and general recommended practices for plugins.

2) Updated handling of canned cycles to address issues with spindle
   speed override and soft limits violations.

3) Fix problems resulting from use of Unicode characters in file names.

4) Added infrastructure needed to support user controllable CV modes.
   No user interface yet though.

5) Cleaned up some issues with fixture offsets corruptings tool table values.

6) Allow jog rate override to work while jogging is active.

7) Added plugin to allow send and receive from RS-232 serial port.

8) Convert LUA environment to use dynamic runtime to support loadable
   LUA modules. LUA RS232, LFS file system, LUA Sockets with TCP modules
   now provided.

9) Update SIM plugin to support CALLBACK function allow SIM to be used
   to monitor other plugins.

10) 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.

11) Provide autofill of function call paramaters while using LUA editor.

12) Added new control type to provide gage control to replace the default
    Windows gage (which could not set colors, and had flicker issues).

13) Added ability to turn menu bar on and off in screen sets from a screen
    script.

14) Fixed screen offsetting issue when editing a screen in a scrolled view.

15) Fixed tool path mouse events not working after a screen edit.

16) No screen set updates in this release.

Pages: 1 2 »