Hello Guest it is April 27, 2024, 01:51:10 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 - brianthechemist

Pages: « 1 2 3 4 5 6 7 »
41
Mach4 General Discussion / Re: How to trigger "action" with an input?
« on: January 10, 2023, 10:56:59 AM »
Beautiful!

Can the new toggle interact with the existing gui buttons? (as in if I activate the soft limits via this mechanism will the soft limits indicator on the GUI light up green?)

42
Mach4 General Discussion / Re: How to trigger "action" with an input?
« on: January 09, 2023, 07:11:20 PM »
Hi,

Quote
I found a workaround to use these actions by way of the scr commands.  They appear to work well but it feels kinda 'hackey' and not the right way.

Quote
Correct, I try to avoid scr commands. The correct way is to place an object, like a button, it does not have to be visible, but then you get the options of UpAction,
DownAction, UpScrpit, DownScript, ClikedScript etc.

hmm, i'm not sure how this would work.  to be clear: I want to have an input from siglib execute an action that is identical to a gui button (that isn't a script).  In some cases, it is a momentary switch that I'd like to actually  toggle the state of the button on the screen (the ones that light up when activated).

how do I have the invisible button on the screen be activated by the siglib input? (it seems like the same problem I started with)...  I'm obviously missing something.

thanks for your patience!!
brian

43
Mach4 General Discussion / Re: How to trigger "action" with an input?
« on: January 09, 2023, 05:48:37 PM »
Ah yes, there is the distinction.  I found a workaround to use these actions by way of the scr commands.  They appear to work well but it feels kinda 'hackey' and not the right way.

Is there a convenient way to have an "include" file or something in the screen script that will pull from a separate lua file of my creation? (for convenience, I'm thinking to modify the actual screen script as little as possible and put my code in one script if at all possible.) 

The process that the screen editor uses with temporary files is a bit buggy for my comfort.

44
Mach4 General Discussion / Re: How to trigger "action" with an input?
« on: January 09, 2023, 12:45:31 PM »
That's great!

Thanks, I can't wait to try it.

45
Mach4 General Discussion / How to trigger "action" with an input?
« on: January 08, 2023, 03:19:54 PM »
Hi guys

I'm trying to incorporate some hard buttons into my machine to take over from GUI buttons.

Is there a general way to execute the "actions" via siglib?  Some of the gui buttons have obvious scripts i can call, others have only these actions.

One example is flood cooling.  The button properties list only "flood toggle".  How can I find the actual command that is triggered by this button? (so that I can copy it into the siglib for my corresponding hard button)

I'm sure this is obvious but it is escaping me

46
Answered my own question:

function map(x, in_min, in_max, out_min, out_max)
 

Stolen from:
https://stackoverflow.com/questions/64755623/how-to-nonlinearly-map-two-number-ranges-in-lua-or-in-general


47
Yea, this is the command in arduino:  i’ll have to dig around to see the Lua analog, but it must exist. 

https://www.arduino.cc/reference/en/language/functions/math/map/

Thats a good point about the hysteresis.  I could put some simple logic in there to ignore everything below 10% or so.

48
Definitely much better than my software skills! But this one is easy enough.

I was actually thinking to make it even easier by doing it in software.  You can map the center position voltage of each pot to ‘0%’ and the voltage at maximum travel going each way to either positive or negative directions by checking if the measured voltage is above or below the 0%

Any values below would be mapped to motion in negative direction, and any above mapped to positive.

Probably impossible to understand from my description,  but super easy in C code (think of reading an analog crossfader, same concept)

Now in LUA? Who knows. But i think you can use C in LUA so we’ll see….

49
I want directional jog plus proportional velocity (think electric wheelchair control joystick: the farther you push in a direction vector, the faster you go that way). 

Perhaps there is a better way to do it.  I was thinking that the only way to dynamically control the movement speed was via the jog rate.

I'm picturing each register/data packet/etc would have X, Y  and direction (+/-) with % max velocity for each.   

I actually think this would be useful for alot of people if it works well enough.  (I have one of those Xhc pendants that has questionable functionality for the precise movements...)

50
Good info! sounds like more than one way to skin the cat.  I think polling is better as well, as the Pokeys will be sampling on some interval anyway to update the register (via modbus TCP).

I wanted cheap proportional control without alot of low level coding, so I went analog: https://www.amazon.com/dp/B09JZ8ZV4L?psc=1&ref=ppx_yo2ov_dt_b_product_details

It is basically just 2 potentiometers, one per axis.  Not as robust as digital hall effect, but since the wire length will be <2cm inside a mostly shielded enclosure I figured it would be good enough.  I can build it a little faraday cage if necessary.

I'm mostly intimidated by getting Mach to see things (as I don't yet have alot of experience with the more advanced Mach stuff).   I could actually write the code to get an arduino-style uC to see this, but then getting mach to talk to it would be a project in itself! (too many mini-projects in this scratch-built 5 axis router already!)

Pages: « 1 2 3 4 5 6 7 »