Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: TonyMemphis on July 29, 2021, 11:51:01 PM

Title: Jog Rate lost each shutdown
Post by: TonyMemphis on July 29, 2021, 11:51:01 PM
I asked about this a while back, but I don't think I got any replies.  Mach 4 doesn't save my current jog rate.  I can manually change it in the ini file and that works.  Am I doing something wrong?

Not a big deal, but just something I'd like to fix if possible. 

I am using the Avid screenset.  Mach 4.  Nothing unique. 

Thanks for the help.

Tony
Title: Re: Jog Rate lost each shutdown
Post by: SwiftyJ on July 31, 2021, 04:41:28 AM
I think it depends on how Avid have set this up.. When you update the ini file manually which parameter are you changing? If you can upload the screenset I could have a look at it. Which mach4 build are using also?
Title: Re: Jog Rate lost each shutdown
Post by: TonyMemphis on July 31, 2021, 04:54:48 PM
I am using Mach 4 Version 4.2.0.43222    Build 4322.  The profile is AvidCNC. 

In the machine.ini file, there is a variable on a line by itself:

JogRate=20.000000

Whatever I set that value to using Notepad, loads when I start Mach 4.   BUt if I change it in Mach 4, it is not ever saved.  I know it had to have saved a value at one point because it was set to something like 3 (not sure why).

Also, I am using an ESS  (WARP 9 - Build 253).

Thanks for the help!

Tony
Title: Re: Jog Rate lost each shutdown
Post by: joeaverage on August 01, 2021, 05:46:11 AM
Hi,
you may be familiar with the ScreenLoad script, which as described populates all the screen elements
but what you may not be familiar with is the ScreenUnLoad script......it has code that saves all the pertinent data
for the next session.  Why not include an instruction to save the jog rate at the moment of shutdown?.

Craig
Title: Re: Jog Rate lost each shutdown
Post by: TonyMemphis on August 02, 2021, 10:03:25 PM
This is from the unload script...

--Save Jog Rate % to .ini
local valJogRate = scr.GetProperty("droJogRate", "Value")
mc.mcProfileWriteString(inst, "Preferences", "JogRate", valJogRate)

Doesn't seem to work though. 
Title: Re: Jog Rate lost each shutdown
Post by: joeaverage on August 04, 2021, 05:26:08 AM
Hi,
 this is the code snippet that is the 'OnModify' event behavior of JogRate%:

Code: [Select]
local inst = mc.mcGetInstance()
local val = scr.GetProperty("droJogRate", "Value")
mc.mcProfileWriteString(inst, "PersistentDROs", "droJogRate", string.format (val)) --Create a register and write the machine coordinates to it

Which suggests that it is a string that must be written to the .ini file.

Try it and see.

Craig
Title: Re: Jog Rate lost each shutdown
Post by: TonyMemphis on August 04, 2021, 06:39:54 PM
Well, it looks like that is what it is trying to do.  The Value it gets is a string I think.

I deleted the JogRate line from the machine.ini file, then ran Mach4.  When I exited, the jog rate was saved.  But the next time I changed it and exited, it was not. 

Thanks for helping!  I appreciate it.  I may just drop a note to the AVID folks. 

Tony
Title: Re: Jog Rate lost each shutdown
Post by: DazTheGas on August 08, 2021, 03:29:42 PM
Like Craig suggested putting it in the shutdown script is good, but one extra thing is in your screen load script or first run of the PLC script is to use 'mc.mcJogSetRate' as a way of setting the jog rate but you will have to set this for all axis xyz etc.

DazTheGas
Title: Re: Jog Rate lost each shutdown
Post by: TonyMemphis on August 08, 2021, 05:21:44 PM
Well, I must not be masking this clear.  Sorry!  But the AVID screen unload script DOES have code that is supposed to save the current jog rate.  But it doesn't.  The only time I can make it work is if I edit the machine.ini file with Notepad and remove the jog rate line.  After that, the rate is saved once but never again. 

Thanks,

Tony

Code: [Select]
--Screen unload
inst = mc.mcGetInstance()

if (Tframe ~= nil) then -- touch plate frame
Tframe:Close()
-- Tframe:Destroy()
end

if (ASframe ~= nil) then -- touch plate advanced settings frame
ASframe:Close()
-- ASframe:Destroy()
end

--Save Jog Rate % to .ini
local valJogRate = scr.GetProperty("droJogRate", "Value")
mc.mcProfileWriteString(inst, "Preferences", "JogRate", valJogRate)

-- check modified state of config files
pf.CheckAllConfigFiles()

Title: Re: Jog Rate lost each shutdown
Post by: TonyMemphis on August 10, 2021, 12:42:53 PM
Well, after a lot of searching and reading, etc., I still can't make it work.  I can use mc.mcJogGetRate for a single axis and that works fine,  The problem seems to be the screen call doesn't ever return anything.  I tried getting the Values and Labels from numerous things on the screen and I never get anything but a nil or a "".   

I am using the AVID setup and my Mach 4 version is 4.2.0.4322.

Any ideas? 

This is what is NOT working:   local valJogRate = scr.GetProperty("droJogRate", "Value")

Thanks,

Tony
Title: Re: Jog Rate lost each shutdown
Post by: TonyMemphis on August 10, 2021, 03:30:30 PM
I've been out in the shop playing with this.  Weird.  If I try scr.get... in a button and display the value in a wx box, it works fine. 

I think something else is saving the jog rate in the ini file after the unload script?  Is that possible?  Here is the setup...

I set the jog rate to 55.  After I exit, the file shows  35.  However, if I get and save that same value under a different key name (Jog for instance), it save correctly every time.  Weird.

Code: [Select]
--Save Jog Rate % to .ini
local valJogRate = scr.GetProperty("droJogRate", "Value")
local jogSTR = tostring(valJogRate)
mc.mcProfileWriteString(inst, "Preferences", "JogRate", jogSTR)

--the above doesn't work
--added by Tony 10AU21 - axis specific but tey are all the same rate
local cRate = mc.mcJogGetRate(inst, 1)
local cRateSTR = tostring(cRate)
mc.mcProfileWriteString(inst, "Preferences", "Jog", cRateSTR)

The second part works every time, but the first one doesn't. 

Thanks,

Tony (dazed and confused at the moment)
Title: Re: Jog Rate lost each shutdown
Post by: DazTheGas on August 10, 2021, 04:41:49 PM
Which version are you using as according to avids site there is a beta version 2.3.1 that is supposed to address this

Release Notes
Version 2.3.1 (8.6.2021)
Update: Revised default soft limit values
Update: Spindle PTC fault warning changed to generic VFD fault warning
Bugfix: Jog rate does not always persist across sessions

DazTheGas
Title: Re: Jog Rate lost each shutdown
Post by: TonyMemphis on August 10, 2021, 09:57:14 PM
Ironically, I got a reply from AVID today and he told me that this was a known issue.  He suggested the Beta too.  I feel much better that it was not my own stupidity!  Ignorance I can handle... 

I did learn a few things in this quest, so that's good.  Not sure I'll try the beta though.  I may just wait until its released for all.  I'm in the middle of a couple of other projects.  I am curious though. 

Thanks for the help everyone,

Tony