// ================================================================================================
// 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.
*/
// ================================================================================================
// ================================================================================================
// 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.
*/
// ================================================================================================
Users browsing this forum: No registered users and 4 guests