Ability to use screen buttons in Hotkeys

Here is where you can request new features or special features.

Re: Ability to use screen buttons in Hotkeys

Postby johnsattuk » Thu Feb 10, 2022 1:53 pm

:D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D
Got diagonal jogging
Thank you very much, that must have taken some time and experise, way above my pay grade :lol:
johnsattuk
 
Posts: 79
Joined: Thu Aug 12, 2021 1:24 pm

Re: Ability to use screen buttons in Hotkeys

Postby johnsattuk » Wed Feb 16, 2022 3:01 pm

Have found that the Macro works great for diagonal continuous mode, but not in stepping mode :o

Diagonal UpRight 1mm step
X drives to 1mm y staionary
X drives back to 0 simultaneously Y drives to 1
Result X0 Y1
Also does not respond to feed rates
johnsattuk
 
Posts: 79
Joined: Thu Aug 12, 2021 1:24 pm

Re: Ability to use screen buttons in Hotkeys

Postby johnsattuk » Wed Feb 16, 2022 3:20 pm

Have found that Eric's Jog Panel does not respond to diagonal movements when in Step mode,, probably the best option
johnsattuk
 
Posts: 79
Joined: Thu Aug 12, 2021 1:24 pm

Re: Ability to use screen buttons in Hotkeys

Postby eabrust » Thu Feb 17, 2022 1:35 am

I purposefully 'do nothing' for diagonal buttons in the jog box plugin if step mode is enabled... bad idea to be sneaking up on something 'sideways' :D


I'll probably butcher (mess up) Dezsoe's macro, but at the start of the macro if you do a check for 'step mode' being active (LED 146 on), exit if true.

I just winged it, did not test it, and I don't do much actual C# , so just try it :) .... good luck

Eric

Code: Select all

// ================================================================================================
// Diagonal jog buttons
// ================================================================================================

// Read button press states
bool UpRight = AS3.Getbutton(UpRightBtn);
bool DownRight = AS3.Getbutton(DownRightBtn);
bool UpLeft = AS3.Getbutton(UpLeftBtn);
bool DownLeft = AS3.Getbutton(DownLeftBtn);

//========Add this part here
/// exit if step mode)
if (AS3.GetLED(146)
{
return;
}
/// end exit if step mode
//======== end add this part here

if (UpRight != lastUpRight)
{
  // Button was pressed or released
  if (UpRight)
  {
    // Button was pressed
    exec.Callbutton(JogOn + YPlus);
    exec.Callbutton(JogOn + XPlus);
  }
  else
  {
    // Button was released
    exec.Callbutton(JogOff + YPlus);
    exec.Callbutton(JogOff + XPlus);
  }
  lastUpRight = UpRight;
}

if (DownRight != lastDownRight)
{
  // Button was pressed or released
  if (DownRight)
  {
    // Button was pressed
    exec.Callbutton(JogOn + YMinus);
    exec.Callbutton(JogOn + XPlus);
  }
  else
  {
    // Button was released
    exec.Callbutton(JogOff + YMinus);
    exec.Callbutton(JogOff + XPlus);
  }
  lastDownRight = DownRight;
}

if (UpLeft != lastUpLeft)
{
  // Button was pressed or released
  if (UpLeft)
  {
    // Button was pressed
    exec.Callbutton(JogOn + YPlus);
    exec.Callbutton(JogOn + XMinus);
  }
  else
  {
    // Button was released
    exec.Callbutton(JogOff + YPlus);
    exec.Callbutton(JogOff + XMinus);
  }
  lastUpLeft = UpLeft;
}

if (DownLeft != lastDownLeft)
{
  // Button was pressed or released
  if (DownLeft)
  {
    // Button was pressed
    exec.Callbutton(JogOn + YMinus);
    exec.Callbutton(JogOn + XMinus);
  }
  else
  {
    // Button was released
    exec.Callbutton(JogOff + YMinus);
    exec.Callbutton(JogOff + XMinus);
  }
  lastDownLeft = DownLeft;
}

// ================================================================================================

#Events

// ================================================================================================

const int UpRightBtn = 55550;
const int DownRightBtn = 55551;
const int UpLeftBtn = 55552;
const int DownLeftBtn = 55553;

const int JogOn = 147;
const int JogOff = 229;

const int XPlus = 0;
const int XMinus = 1;
const int YPlus = 2;
const int YMinus = 3;

bool lastUpRight = false;
bool lastDownRight = false;
bool lastUpLeft = false;
bool lastDownLeft = false;

// ================================================================================================

/*
147    JogX+    Jogs the X axis to positive direction.
148    JogX-    Jogs the X axis to negative direction.
149    JogY+    Jogs the Y axis to positive direction.
150    JogY-    Jogs the Y axis to negative direction.

229    JogXplusoff    Switches the X axis positive direction jogging off.
230    JogXminusoff   Switches the X axis negative direction jogging off.
231    JogYplusoff    Switches the Y axis positive direction jogging off.
232    JogYminusoff   Switches the Y axis negative direction jogging off.
*/

// ================================================================================================
 
CraftyCNC: Plugins for UCCNC (and other neat stuff): http://www.craftycnc.com/plugins-for-uccnc/
eabrust
 
Posts: 357
Joined: Fri Sep 16, 2016 2:32 am
Location: Near Shirland IL, USA

Re: Ability to use screen buttons in Hotkeys

Postby johnsattuk » Thu Feb 17, 2022 12:29 pm

Scipt error :(
johnsattuk
 
Posts: 79
Joined: Thu Aug 12, 2021 1:24 pm

Re: Ability to use screen buttons in Hotkeys

Postby eabrust » Thu Feb 17, 2022 12:52 pm

This is a good learning opportunity, take a look at the macro error.txt file in the macros folder after it tried to run, what was the error?

Just eying it, I believe I missed a closing ' ) '

if (AS3.GetLED(146) )


regards,
Eric
CraftyCNC: Plugins for UCCNC (and other neat stuff): http://www.craftycnc.com/plugins-for-uccnc/
eabrust
 
Posts: 357
Joined: Fri Sep 16, 2016 2:32 am
Location: Near Shirland IL, USA

Re: Ability to use screen buttons in Hotkeys

Postby ger21 » Thu Feb 17, 2022 12:53 pm

Try adding a parenthesis to this line:

if (AS3.GetLED(146)

To this

if (AS3.GetLED(146))
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2714
Joined: Sat Sep 03, 2016 2:17 am

Re: Ability to use screen buttons in Hotkeys

Postby johnsattuk » Thu Feb 17, 2022 1:00 pm

Great, it works :D
johnsattuk
 
Posts: 79
Joined: Thu Aug 12, 2021 1:24 pm

Re: Ability to use screen buttons in Hotkeys

Postby johnsattuk » Thu Feb 17, 2022 1:09 pm

Bit premature works for one cycle :(
johnsattuk
 
Posts: 79
Joined: Thu Aug 12, 2021 1:24 pm

Re: Ability to use screen buttons in Hotkeys

Postby eabrust » Fri Feb 18, 2022 12:15 pm

So if that works one time, you've learned that a 'return' out of a macroloop did what you want, but kills it from repeating... So instead of doing a conditional check for 'step mode' being active and exiting, the proper thing to do would be to only continue to evaluate the buttons if it is in 'continuous mode'... try this one

regards,
Eric

Code: Select all


// ================================================================================================
// Diagonal jog buttons
// ================================================================================================

// Read button press states
bool UpRight = AS3.Getbutton(UpRightBtn);
bool DownRight = AS3.Getbutton(DownRightBtn);
bool UpLeft = AS3.Getbutton(UpLeftBtn);
bool DownLeft = AS3.Getbutton(DownLeftBtn);


//========Add this part here
/// continue checks only if continuous mode)
if (AS3.GetLED(145))    /// 145 is continuous mode.  146 was step mode  Make sure to use a closing bracket :)...
{

/// closing bracket for 'if' is at bottom now ////


if (UpRight != lastUpRight)
{
  // Button was pressed or released
  if (UpRight)
  {
    // Button was pressed
    exec.Callbutton(JogOn + YPlus);
    exec.Callbutton(JogOn + XPlus);
  }
  else
  {
    // Button was released
    exec.Callbutton(JogOff + YPlus);
    exec.Callbutton(JogOff + XPlus);
  }
  lastUpRight = UpRight;
}

if (DownRight != lastDownRight)
{
  // Button was pressed or released
  if (DownRight)
  {
    // Button was pressed
    exec.Callbutton(JogOn + YMinus);
    exec.Callbutton(JogOn + XPlus);
  }
  else
  {
    // Button was released
    exec.Callbutton(JogOff + YMinus);
    exec.Callbutton(JogOff + XPlus);
  }
  lastDownRight = DownRight;
}

if (UpLeft != lastUpLeft)
{
  // Button was pressed or released
  if (UpLeft)
  {
    // Button was pressed
    exec.Callbutton(JogOn + YPlus);
    exec.Callbutton(JogOn + XMinus);
  }
  else
  {
    // Button was released
    exec.Callbutton(JogOff + YPlus);
    exec.Callbutton(JogOff + XMinus);
  }
  lastUpLeft = UpLeft;
}

if (DownLeft != lastDownLeft)
{
  // Button was pressed or released
  if (DownLeft)
  {
    // Button was pressed
    exec.Callbutton(JogOn + YMinus);
    exec.Callbutton(JogOn + XMinus);
  }
  else
  {
    // Button was released
    exec.Callbutton(JogOff + YMinus);
    exec.Callbutton(JogOff + XMinus);
  }
  lastDownLeft = DownLeft;
}



/// end check if continuous mode
//======== end add this closing curly bracket part here
}

///


// ================================================================================================

#Events

// ================================================================================================

const int UpRightBtn = 55550;
const int DownRightBtn = 55551;
const int UpLeftBtn = 55552;
const int DownLeftBtn = 55553;

const int JogOn = 147;
const int JogOff = 229;

const int XPlus = 0;
const int XMinus = 1;
const int YPlus = 2;
const int YMinus = 3;

bool lastUpRight = false;
bool lastDownRight = false;
bool lastUpLeft = false;
bool lastDownLeft = false;

// ================================================================================================

/*
147    JogX+    Jogs the X axis to positive direction.
148    JogX-    Jogs the X axis to negative direction.
149    JogY+    Jogs the Y axis to positive direction.
150    JogY-    Jogs the Y axis to negative direction.

229    JogXplusoff    Switches the X axis positive direction jogging off.
230    JogXminusoff   Switches the X axis negative direction jogging off.
231    JogYplusoff    Switches the Y axis positive direction jogging off.
232    JogYminusoff   Switches the Y axis negative direction jogging off.
*/

// ================================================================================================
 
CraftyCNC: Plugins for UCCNC (and other neat stuff): http://www.craftycnc.com/plugins-for-uccnc/
eabrust
 
Posts: 357
Joined: Fri Sep 16, 2016 2:32 am
Location: Near Shirland IL, USA

PreviousNext

Return to Feature Request

Who is online

Users browsing this forum: No registered users and 5 guests