Hello Guest it is May 16, 2024, 09:41:09 PM

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.


Messages - Brian Barker

191
Mach4 General Discussion / Re: X Box here we come!
« on: January 24, 2021, 03:46:53 PM »
I did add some outputs that you could setup as LED’s in the screen designer if you like. My son and I where playing with the the analog gauges and the joysticks of the Xbox controller. That is lots of fun :)

192
Mach4 General Discussion / Re: Spindle speed not correct
« on: January 24, 2021, 03:44:37 PM »
If we put it in the PMC it will be very portable :) I can show you how that is done. Very easy!

193
Mach4 General Discussion / Re: Spindle speed not correct
« on: January 24, 2021, 11:03:09 AM »
The PMC is a place where we can run some code on your machine to customize the machine. It is loaded in the screen edit mode.. Anyway that part is easy ! The hard part is to make the code ... I just happen to have made the code this morning for fun :) What can I say I don't get out much LOL
 Here is the code :
Code: [Select]
-- Fit Spindle Speed with linear interpolation

function buildtbl()
rpmtbl = { points = 0,
   addPoint = function (self, commandRPM, trueRPM )
self[tonumber(self.points)] = {}
self[tonumber(self.points)].commandRPM = commandRPM
self[tonumber(self.points)].trueRPM = trueRPM
self.points = self.points + 1
end,
linearInterp = function(self, RPM)
local low = -1
local high = -1
for i=0, self.points-1,1 do-- loop through the points and get the high and the low around the requested RPM
if (self[i].commandRPM <= RPM) then
low = i
end
if (self[i].commandRPM >= RPM) then
high = i
break
end
end
--check to see if the point is on the table, if not simply return what was input
if(high == -1 or low == -1)then
return RPM
end
if(high == low) then
return self[low].trueRPM
end
--y = y1 + ((x – x1) / (x2 – x1)) * (y2 – y1)
--time to figure it out!
local NewRPM = self[low].trueRPM + ( (RPM - self[low].commandRPM) / ( self[high].commandRPM -self[low].commandRPM )) * (self[high].trueRPM  - self[low].trueRPM )
return NewRPM
end,
}

--To add a point call the addPoint function with the Requested PRM, Than the True RPM (this must be done without this function active)
-- Example Command 500 RPM Spindle is teally going 750 
-- The following call would be made rpmtbl:addPoint(500 ,750)
rpmtbl:addPoint(100,10)
rpmtbl:addPoint(200,100)
rpmtbl:addPoint(2000,2500)
rpmtbl:addPoint(3000,5000)
end



function calcRPM(rpm)
-- take the requested RPM and adjust based on the table fitting points
if(rpmtbl == nil) then--build a global table on the first scan
buildtbl()
end
local adjRPM = rpmtbl:linearInterp(101)

end
local SpindleRPM = 2500
local outputRPM = calcRPM(SpindleRPM)

I know this is scary to see the code but all you really need to do is look at the following lines:
   rpmtbl:addPoint(100,10)
   rpmtbl:addPoint(200,100)
   rpmtbl:addPoint(2000,2500)
   rpmtbl:addPoint(3000,5000)

The first number is the RPM you asked for the 2nd one is what you got for an RPM. You can add as many points as you would like. This thing expands every time you add a point. If you ask for an RPM outside of the range it will just return what you sent . You think you can get that data ? I think you had it in your graph ;)


Thanks
Brian

194
Mach4 General Discussion / Re: Spindle speed not correct
« on: January 24, 2021, 08:43:50 AM »
Hello, the PMC is the programmable Mach controller ... it is much like a PLC and will update each scan. What we will do to make this work is read the spindle speed and set the value to the analog register. This will allow is some room to play around with the values. We can map what you get for a command to what you need for an output. If you want to do this I will make up the code as I think this is a tool that could help others later on. You tell me what you want to do :) funny enough this is how I made the code for surface mapping and screw mapping. The problem and the users change but the math to solve them stays the same lol. I suspect I could make this code in a few hours or so. Make a deal, if I do this we can post the code here and you tell how to make it work, a white paper is what I would call it. Sound like a plan?

195
Mach4 General Discussion / Re: Spindle speed not correct
« on: January 23, 2021, 03:24:06 PM »
Automation direct / delta VFD and you will be happy :) I know it can be fun to try to make the low cost ones work but they can really make you angry trying to set them up.

196
Mach4 General Discussion / Re: X Box here we come!
« on: January 23, 2021, 12:16:42 PM »
I could do a soft rumble to tell you that it is in continuous mode

197
Mach4 General Discussion / Re: X Box here we come!
« on: January 23, 2021, 11:00:53 AM »
Great, I have a few OEM’s testing it as well and they seem to really like it as well. My issue with the incremental mode is how to make it happen. I am sort of thinking that we can have a default mode with an override button. So you could default to incremental and override to continuous or feed velocity. I like this idea because it is sort of a deadman switch... thoughts ? I could code that in later today I think.

198
Mach4 General Discussion / Re: Lua Script and reading register's Help
« on: January 23, 2021, 08:53:19 AM »
Man I had a hard time finding this thread!
Anyway, Gary  Good news your problem with your crashing after edit was found! It was an error in the wxTranslation code so you could localization on your screen. Not that your ever going to do that for yourself :) . Because you didn't have the file it was causing a pointer to go out in memory and stomp on memory! On my PC it will messing with my OpenGL and crashing the machine. Steve found the issue (took days and he is REALLY good) and he patched it up and rebuilt the libs. So next version you should be all good. The latest Dev version has what you need if you want to try it. Wanted everyone to know it was fixed and that you helped to delay release LOL . We have started release testing over AGAIN because of this. The QA part of getting software out takes longer than making the code I think! Mach4 is a MASSIVE project with so many ways to use / customize it that it takes a lot of pokes to see if everything is working as it should.

Okay I have rambled enough, long story longer , check out the new version.

199
Mach4 General Discussion / Re: Mouse MPG Module
« 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
 

200
Mach4 General Discussion / Re: Spindle speed not correct
« on: January 23, 2021, 07:36:10 AM »
Well option number B for bandaid, make some code in the PMC that will scale the value and make it work at the correct speed. I know it’s not the right thing but sometime it’s the best you can do (other than going to automation direct and getting a new VFD) . If you want to do this I can give you a hand. I think if we got 5 points and did linear interpolation through them we could get this really close.