Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: RBeaubien on December 23, 2017, 02:53:51 AM

Title: Setting to millimeters
Post by: RBeaubien on December 23, 2017, 02:53:51 AM
I'm trying to calibrate the stepper motors.  I've set a value of 256/unit on all of the motors to start with (which seems to be close).  I've also set the Machine Setup Units to Metric and the Units Mode to Metric.  When I jog any axis by 1 mm, the current position increments by 25.4mm which tells me its converting to 1 inch.  What setting am I missing?  I never want to use inches/mils and only want to see/use millimeters.  (Mach 4  4.2.0.3481)

Thanx.
Title: Re: Setting to millimeters
Post by: Fledermaus on December 23, 2017, 09:52:06 AM
Another user has suggested that this is a bug in version 3481, and that a resolution is to revert to version 3390. I have not tested this, but have seen intermittent cases of my mill jogging 25.4mm when 1mm was expected, USING 3481. Scarey.

Another thing that you might try if you are into LUA is to execute the following to explicitly set the jog units prior to jogging:

    local inst = mc.mcGetInstance()
    local rc = mc.mcJogSetUnitsMode(inst, mc.X_AXIS, 21)

(Repeat line 2 for all axes.)  You might try placing such code in the jog tab On Enter script and open this tab prior to jogging.

In case it has a bearing, which controller do you use? Mine is CS Labs.

Allan
Title: Re: Setting to millimeters
Post by: RBeaubien on December 23, 2017, 12:31:29 PM
I had to edit the screen and change those display fields to use metric instead of inch.  I'm sure there is probably a place in the LUA script to set those values, but I haven't dug that far into all this yet.  I am using the PoKeys57CNC .
Title: Re: Setting to millimeters
Post by: RBeaubien on December 25, 2017, 04:07:12 AM
Just a note of what seems like a bug.  If I simply go into MACH settings, I have to exit MACH4 because it sets the jogging back to inches.
Title: Re: Setting to millimeters
Post by: joeaverage on December 25, 2017, 06:29:10 AM
Hi,
I haven't encountered that bug.

When Mach4 shuts down all its current settings are flushed to the profile file. On starting Mach the profile is read. There are a number of circumstances
where Mach4 will update the profile during a sessiom but the surest way to do so is to shut down and then restart Mach.

Craig
Title: Re: Setting to millimeters
Post by: Fledermaus on December 27, 2017, 10:22:02 AM
Another funny thing.  My setup units are all metric, which is all I ordinarily use.

If I home the machine, and assuming G54 offset is zero, the work coordinates DROs read 0. If I issue a G20 MDI command, then jog X 1 unit, then issue G21, the X DRO reads 25.4 afterwards. If, however, I First switch the display to machine coordinates and then follow the above sequence, the DRO reads 1 afterwards. This doesn’t make sense to me. I can understand that Mach4 may, by design, change the jog units to imperial when the current units are so changed by a G20 command, but why would this depend on which coordinates are on display?
Above with 3485 and SIM. Sounds like another bug to me.

Allan
Title: Re: Setting to millimeters
Post by: RBeaubien on December 27, 2017, 11:41:33 AM
I think I've narrowed the bug down.  If I go to MACH setting and change motor speed on the Motors tab, when I jog 1mm, it goes 24.5mm.  I have to exit and restart after that to fix it.
Title: Re: Setting to millimeters
Post by: Fledermaus on December 28, 2017, 11:06:10 AM
I also find that going to Mach configuration causes the jog units, type, and distance to be reset. The safest practice seems to be to restart Mach4 after configuration changes.

Allan
Title: Re: Setting to millimeters
Post by: joeaverage on December 28, 2017, 12:29:35 PM
Hi,
I've encountered something similar before and it concerns when Mach writes new info to the .ini file and also when it re-reads that file.
Look for  smurphs explanation top of page two.

http://www.machsupport.com/forum/index.php/topic,33866.0.html (http://www.machsupport.com/forum/index.php/topic,33866.0.html)

Craig
Title: Re: Setting to millimeters
Post by: Fledermaus on December 28, 2017, 03:57:25 PM
It would be nice if an event (e.g. a Signal) was raised when this happens so that scripts could react accordingly if required.

Allan
Title: Re: Setting to millimeters
Post by: joeaverage on December 28, 2017, 04:29:42 PM
Hi Allen,
not quite sure what you mean. What event has taken place?

Craig
Title: Re: Setting to millimeters
Post by: RBeaubien on December 28, 2017, 05:03:37 PM
... ConfigureChanged()

Allowing you to handle any updates to the config.
Title: Re: Setting to millimeters
Post by: Fledermaus on December 28, 2017, 05:28:22 PM
The act of visiting MMach's configuration screen has screwed up the jog settings that were previously in use. The event was to close this screen, causing Mach to re-load possibly outdated settings from the .INI file. Maybe I just need to flush data more promptly to it rather than waiting for Mach to close. I may give that a try when I have a moment.

Allan
Title: Re: Setting to millimeters
Post by: joeaverage on December 28, 2017, 06:53:50 PM
Hi Allen,
there is not any signal of that description to my knowledge. To define your own signal I believe requires a plugin which is a whole different kettle of fish.

There are some helpful APIs:

Quote
rc = mc.mcProfileFlush(
      number mInst)


Quote
rc = mc.mcProfileReload(
      number mInst)

Quote
I think I've narrowed the bug down
When I first encountered this behavior I too thought I had found a bug but as smurphs explanation makes plain it was that I did not understand how Mach was organized
not a bug at all.

Title: Re: Setting to millimeters
Post by: RBeaubien on December 28, 2017, 06:56:19 PM
I would call that a bug under any circumstances.  Software should never allow itself to get out of sync with requested settings like that.  It should detect the problem and force a restart or something of that nature.  They clearly understand the issue, they just need to take the time to fix it.
Title: Re: Setting to millimeters
Post by: joeaverage on December 28, 2017, 07:24:58 PM
Hi.
I disagree, Mach never gets out of sync with itself it is we who get out of step with Mach.

As you have discovered shutting down and restarting Mach does the trick OR use the APIs provided.

If I am doing something programmatically the I use the APIs for other tweaks is use the shutdown/restart method.

Craig
Title: Re: Setting to millimeters
Post by: RBeaubien on December 28, 2017, 09:05:06 PM
How would you feel about it if Microsoft Word changed your printer settings after you specifically set something else? And then told you , you have to restart Word anytime you change a printer setting because some machine.ini has conflicting information and is being loaded at the wrong time causing unknown things to happen when you print?  I think you'd agree that was a bug.  Same difference here.  I do software development for a living and if I wrote code like that, I would starve.
Title: Re: Setting to millimeters
Post by: joeaverage on December 29, 2017, 03:11:02 AM
Hi,
read smurphs explanation again, there specific times and circumstances that Mach flushes settings to the ini file and certain occasions when it reads it.
There are APIs to force a flush or re-read. The means are there to have Mach perform as you wish...the question is do you want to take advantage of it.

Craig



Title: Re: Setting to millimeters
Post by: RBeaubien on December 29, 2017, 03:21:45 AM
We're not talking about a setting that hasn't already been saved and loaded due to a reboot, nor are we talking about the setting we are modifying getting out of sync with what is currently loaded.   The current config already has the units set to metric.  The metric setting has already been changed and mach4 rebooted.  Changing the motor Units/min speed should NEVER cause the jog rate to change from metric to inches.  The machine.ini file should contain the metric setting already.  Something is not paying attention to the units selection already loaded and stored and simply setting the jog rate to inches.  That is a bug.  If that doesn't convince you, then we will have to agree to disagree.
Title: Re: Setting to millimeters
Post by: Fledermaus on December 29, 2017, 05:00:22 AM
As far as I can see, JogUnitsMode is always set to imperial following configuration of Mach4. JogMode is likewise set to continuous. These do not appear in machine.ini, however, so are perhaps defaults within the core. Flushing, saving, or re-loading profiles is not going to help.

The problem is that scripts are unaware of these changes. Yet they could easely take steps to re-initialise if a suitable signal were provided to indicate the potential need for this.

I tend to side with Robert  on this one in thinking that this is an unfortunate feature of Mach4, if not an outright bug.

For now, the best remedy is to restart Mach4 after configuration, whether or not changes were made.

Allan
Title: Re: Setting to millimeters
Post by: Fledermaus on December 29, 2017, 05:39:54 AM
Using the default wx4 screen set instead of my own, JogUnitsMode reverts to imperial but JogMode remains at incremental following configuration, so a 1mm jog becomes 25.4mm as Robert observes. 

Allan
Title: Re: Setting to millimeters
Post by: Fledermaus on December 29, 2017, 09:57:50 AM
I think I may have been mistaken in concluding that Mach had set the jog mode to continuous after a configuration. The issue may have been the way my use of the registers core/inst/JogIntx … interacted with Mach. This could result in a supposed 1mm jog causing a movement of 254mm, sending me diving for the eStop in an irrational panic rather than just letting the machine run on and operate the limits if need be.

The problem with JogUnitsMode remains real, however, and occurs not just after Mach configuration but at any time mcProfileReload is executed. Though the profile does not contain any obvious reference to jog units, somehow this gets reset following a profile  load. So caution is needed if this API call is used in scripts.

Allan
Title: Re: Setting to millimeters
Post by: DazTheGas on December 30, 2017, 03:54:31 AM
I have tried for the last couple of hours to recreate a fault using metric and cannot reproduce any of this,

when starting mach4 or when you enter and exit the screen editor it will run the screen load script, its from here that the jog mode gets reverted back to continuous so just a small tweak can fix this.
Check your mach4 config, at the bottom you have initialization codes, make sure you haven't got a G20 within those boxes other than that I would suggest going to the help menu and packaging your profile and uploading, you will be surprised how quick a new set of eyes can pinpoint anything that is out of place.

DazTheGas
Title: Re: Setting to millimeters
Post by: RBeaubien on December 30, 2017, 04:04:47 AM
This has nothing to do with the screen editor.  To reproduce the problem:

1.  Go to Configure|Mach, General Tab.  Set Machine Setup Units to Metric, and Units Mode to Metric.  Save and exit Mach 4.
2.  Load Mach4, Enable, set Button Jog Mode to Incremental, and Incremental Jog Step to 1.0000.  Test jog any direction and you will notice it goes 1mm for every button press.
3.  Disable
4.  Go to Configure|Mach, Motors Tab.  Select any motor and change any setting and save.
5.  Enable and test jog any direction and you will notice it goes 25.4mm instead of 1mm for every button press.  G21 is always set once you change the Units Mode and Machine Setup to Metric.
Title: Re: Setting to millimeters
Post by: DazTheGas on December 30, 2017, 04:25:14 AM
Well yep after following exactly the above I can get it to go 25.4mm, as a quick fix after coming out of the config enable the machine and press reset. This will initialize the unit back to metric and save shutting down mach4.

DazTheGas
Title: Re: Setting to millimeters
Post by: RBeaubien on December 30, 2017, 04:29:17 AM
Kewl.  Thanx for the work around.
Title: Re: Setting to millimeters
Post by: Fledermaus on December 30, 2017, 05:32:45 AM
I completely agree with Robert.

Daz
Great workaround that never occurred to me. To smooth things a little further, I have added the following to the Enable button Down script:

local inst = mc.mcGetInstance()
mc.mcCntlReset(inst)

This seems to do the trick but I just wondered if you can see any downside to it

Allan
Title: Re: Setting to millimeters
Post by: DazTheGas on December 30, 2017, 05:49:10 AM
There prob will be a downside like it will reset things like spindlespeed back to 0 etc everytime you enable the machine.

DazTheGas
Title: Re: Setting to millimeters
Post by: Fledermaus on December 30, 2017, 05:51:47 AM
Thanks Daz, I will keep an eye on it.

Allan
Title: Re: Setting to millimeters
Post by: RBeaubien on August 11, 2018, 10:23:09 PM
I see this still hasn't been fixed in the latest version of MACH4.  Anyway to get Artsoft's attention on this?
Title: Re: Setting to millimeters
Post by: Cbyrdtopper on August 13, 2018, 08:06:35 AM
You can start a help ticket with them.  Under the support tab.