by adamscncmachine » Wed Jul 31, 2024 1:42 am
I apologize for reviving such an old thread. I am having trouble implementing this macro, I have a couple questions that pertain:
First, would the construction of this macro be any different if using a different screenset than the one this was made for? I am using the default2019 profile and maybe that's why I can't get it to run properly. I have been able to get somewhat of a response from the machine using one version of the various code clips posted in this thread (but I don't remember which one). But all it seems to do is rapid fire my mist relay like it's in infinite loop.
My default 2019 screenset has a mist button on the main screen that I would like to be able to continue using for it's intended purpose, toggling on and off the air blast. But I would like this macro to begin running when the spindle is turned on and it is reading gcode.
I have been helpless as to getting this macro stuff to work, c# and coding seems to be too abstract for me to get my head around. I am usually good at identifying patterns and reworking them to get my result, but I am getting nowhere.
So to be clear from my end:
My mist button on the main screen acts as a toggle button (it is assigned to buttonnumber 116), it hasn't been changed from the factory settings other than when i first set up the machine, assigning the output pins for the m7 blast in the spindle settings.
I would like to slide one of my unused buttons on the main screen behind something else and create a button for this macro, I tried to make a button on the "User" page that has blank space, and then somehow managed to delete the entire user page using the edit screen tool and now it's white where the user menu would be, and the user button is gone now. Oh well, the program still works. Can anyone help me? I even resorted to asking chatgpt and it's giving me almost the identical same code, so I am probably making a dumb mistake somewhere. I won't post the code here because of redundancy, but I have tried both iterations that users have posted so far with no luck.
As a user posted above, now I have changed the port and pin to 0 and 0 in the M7 section of the spindle settings, and in output settings assigned port 1 pin 3 to LED 52. field 228 is in fact my work z DRO.
In the end, I'd like the mist/air blast/m7 relay to come on when the Z axis goes below 0, but only when code is running and the spindle is on. And for this cycle to end/turn off at the end of the file. In a perfect world I would like to be able to override/pause this macro so the air compressor can catch up, or I can selectively use the macro during heavy cutting and then manually toggle when doing smaller stuff.
Would this be too much to ask? I have been reading these forums voraciously and dezsoe (sp?) Dan911 and alex_S and cncdrive's posts have been worth so much to me! I'm endlessly amazed by the knowledge in here.
Thank you,
Adam