Код: Выделить всё
--- /home/linuxcnc/linuxcnc/src/emc/usr_intf/keystick.cc.old 2013-12-28 18:09:41.000000000 +0000
+++ /home/linuxcnc/linuxcnc/src/emc/usr_intf/keystick.cc 2014-01-26 17:02:38.593313741 +0000
@@ -123,12 +123,14 @@
static int xJogPol = 1;
static int yJogPol = 1;
static int zJogPol = 1;
+static int aJogPol = 1;
typedef enum {
AXIS_NONE = 1,
AXIS_X,
AXIS_Y,
- AXIS_Z
+ AXIS_Z,
+ AXIS_A
} AXIS_TYPE;
static AXIS_TYPE axisSelected = AXIS_X;
@@ -144,6 +146,9 @@
return " Y SELECTED ";
case AXIS_Z:
return " Z SELECTED ";
+ case AXIS_A:
+ return " A SELECTED ";
+
default:
return " ? SELECTED ";
}
@@ -157,6 +162,8 @@
return 1;
if (a == AXIS_Z)
return 2;
+ if (a == AXIS_A)
+ return 3;
return 0;
}
@@ -229,8 +236,7 @@
static int wmaxy, wmaxx;
static void printFkeys()
-{
- wattrset(window, A_BOLD);
+{ wattrset(window, A_BOLD);
mvwaddstr(window, 0, 1, "F1 ");
mvwaddstr(window, 1, 1, "F2 ");
mvwaddstr(window, 2, 1, "F3 ");
@@ -269,7 +275,6 @@
mvwaddstr(window, 2, 65, "Quits Display ");
mvwaddstr(window, 3, 65, "Toggles Help ");
}
-
#define ERR_Y ((wmaxy) - 2)
#define ERR_X (wbegx)
@@ -331,6 +336,7 @@
static void printStatus()
{
+//Кое что надо пораскрашивать
int savey, savex;
int t;
int line;
@@ -345,17 +351,18 @@
printFkeys();
wattrset(window, 0);
- mvwaddstr(window, 5, 1, "x/X y/Y z/Z");
+ mvwaddstr(window, 5, 1, "x/X y/Y z/Z a/A");
mvwaddstr(window, 6, 1, "HOME");
mvwaddstr(window, 7, 1, "< > or , .");
mvwaddstr(window, 8, 1, "1-9, 0");
mvwaddstr(window, 9, 1, "<- arrow keys ->");
mvwaddstr(window, 10, 1, "^ arrow keys V");
mvwaddstr(window, 11, 1, "PageUp/PageDown");
- mvwaddstr(window, 12, 1, "c/C");
- mvwaddstr(window, 13, 1, "i/I");
- mvwaddstr(window, 14, 1, "#");
- mvwaddstr(window, 15, 1, "@");
+ mvwaddstr(window, 12, 1, " + / - ");
+ mvwaddstr(window, 13, 1, "c/C");
+ mvwaddstr(window, 14, 1, "i/I");
+ mvwaddstr(window, 15, 1, "#");
+ mvwaddstr(window, 16, 1, "@");
wattrset(window, A_UNDERLINE);
mvwaddstr(window, 5, 19, "selects axis");
@@ -365,10 +372,11 @@
mvwaddstr(window, 9, 19, "jog X");
mvwaddstr(window, 10, 19, "jog Y");
mvwaddstr(window, 11, 19, "jog Z");
- mvwaddstr(window, 12, 19, "sets continuous jog");
- mvwaddstr(window, 13, 19, "toggles incr jog");
- mvwaddstr(window, 14, 19, "toggles abs/rel");
- mvwaddstr(window, 15, 19, "toggles cmd/act");
+ mvwaddstr(window, 12, 19, "jog A");
+ mvwaddstr(window, 13, 19, "sets continuous jog");
+ mvwaddstr(window, 14, 19, "toggles incr jog");
+ mvwaddstr(window, 15, 19, "toggles abs/rel");
+ mvwaddstr(window, 16, 19, "toggles cmd/act");
wattrset(window, 0);
mvwaddstr(window, 5, 41, "B");
@@ -377,7 +385,7 @@
mvwaddstr(window, 8, 41, "r/R");
mvwaddstr(window, 9, 41, "p/P");
mvwaddstr(window, 10, 41, "s/S");
- mvwaddstr(window, 11, 41, "quote/XYZGM");
+ mvwaddstr(window, 11, 41, "quote/XYZAGM");
mvwaddstr(window, 12, 41, "l/L");
mvwaddstr(window, 13, 41, "u/U");
@@ -434,6 +442,7 @@
mvwaddstr(window, 13, 1, "X Scale:");
mvwaddstr(window, 14, 1, "Y Scale:");
mvwaddstr(window, 15, 1, "Z Scale:");
+ mvwaddstr(window, 15, 1, "A Scale:");
mvwaddstr(window, 17, 1, "V/Max V:");
mvwaddstr(window, 18, 1, "A/Max A:");
@@ -497,13 +506,20 @@
line = 4;
for (t = 0; t < CANON_POCKETS_MAX; t++)
{
- if (emcStatus->io.tool.toolTable[t].toolno)
+ /* if (emcStatus->io.tool.toolTable[t].toolno)*/
+ if (emcStatus->io.tool.toolTable[t].toolno != -1) /* AIKE */
{
- sprintf(scratch_string, "%4d%10d%10.4f%10.4f",
+ //sprintf(scratch_string, "%4d%10d%10.4f%10.4f",
+ sprintf(scratch_string, "%2d%8d%11.4f%10.4f%13d%12.4f%12.4f",
t,
emcStatus->io.tool.toolTable[t].toolno,
emcStatus->io.tool.toolTable[t].offset.tran.z,
- emcStatus->io.tool.toolTable[t].diameter);
+ emcStatus->io.tool.toolTable[t].diameter,
+ //add nev
+ emcStatus->io.tool.toolTable[t].orientation,
+ emcStatus->io.tool.toolTable[t].frontangle,
+ emcStatus->io.tool.toolTable[t].backangle);
+ //end nev
mvwaddstr(window, line++, 3, scratch_string);
}
}
@@ -524,6 +540,11 @@
}
else if (window == progwin)
{
+// start_color();
+// init_pair(1, COLOR_YELLOW, COLOR_BLACK);
+// init_pair(2, COLOR_WHITE, COLOR_GREEN);
+// init_pair(3, COLOR_BLACK, COLOR_RED);
+
mvwaddstr(window, 0, 0, line_blank);
wattrset(window, A_BOLD);
if (emcStatus->task.file[0] == 0)
@@ -651,7 +672,7 @@
scratch_string[3] = '*';
if (emcStatus->motion.axis[0].maxHardLimit)
scratch_string[4] = '*';
- mvwaddstr(window, 10, 27, scratch_string);
+ mvwaddstr(window, 10, 23, scratch_string);
strcpy(scratch_string, "--Y--");
if (emcStatus->motion.axis[1].minHardLimit)
@@ -662,7 +683,7 @@
scratch_string[3] = '*';
if (emcStatus->motion.axis[1].maxHardLimit)
scratch_string[4] = '*';
- mvwaddstr(window, 10, 47, scratch_string);
+ mvwaddstr(window, 10, 39, scratch_string);
strcpy(scratch_string, "--Z--");
if (emcStatus->motion.axis[2].minHardLimit)
@@ -673,7 +694,18 @@
scratch_string[3] = '*';
if (emcStatus->motion.axis[2].maxHardLimit)
scratch_string[4] = '*';
- mvwaddstr(window, 10, 67, scratch_string);
+ mvwaddstr(window, 10, 55, scratch_string);
+
+ strcpy(scratch_string, "--A--");
+ if (emcStatus->motion.axis[3].minHardLimit)
+ scratch_string[0] = '*';
+ if (emcStatus->motion.axis[3].minSoftLimit)
+ scratch_string[1] = '*';
+ if (emcStatus->motion.axis[3].maxSoftLimit)
+ scratch_string[3] = '*';
+ if (emcStatus->motion.axis[3].maxHardLimit)
+ scratch_string[4] = '*';
+ mvwaddstr(window, 10, 70, scratch_string);
if (coords == COORD_ABSOLUTE)
{
@@ -729,18 +761,22 @@
switch(emcStatus->task.state)
{
- case EMC_TASK_STATE_OFF:
+
+ case EMC_TASK_STATE_OFF:
sprintf(state_string, " OFF ");
break;
case EMC_TASK_STATE_ON:
+ wattrset(window, COLOR_PAIR(2));
sprintf(state_string, " ON ");
+ wattrset(window, 0);
break;
case EMC_TASK_STATE_ESTOP:
sprintf(state_string, " ESTOP ");
break;
+//Сделать красным мигающим
case EMC_TASK_STATE_ESTOP_RESET:
- sprintf(state_string, " ESTOP RESET ");
- break;
+ sprintf(state_string, " ESTOP RESET ");
+ break;
default:
sprintf(state_string, " ? ");
break;
@@ -798,7 +834,7 @@
else
sprintf(lube_level_string, " LUBE LOW ");
- sprintf(home_string, " --- HOMED ");
+ sprintf(home_string, " ---- HOMED ");
if (emcStatus->motion.axis[0].homed)
{
home_string[4] = 'X';
@@ -811,22 +847,32 @@
{
home_string[6] = 'Z';
}
+ if (emcStatus->motion.axis[3].homed)
+ {
+ home_string[7] = 'A';
+ }
+/* if (emcStatus->motion.axis[2].homed)
+ {
+ home_string[6] = 'A';
+ } здесь надо основательно повозиться*/
if (coords == COORD_ABSOLUTE)
{
if (posDisplay == POS_DISPLAY_ACT)
{
- sprintf(pos_string, "%13.4f %18.4f %18.4f",
+ sprintf(pos_string, "%9.4f %14.4f %14.4f %14.4f",
emcStatus->motion.traj.actualPosition.tran.x,
emcStatus->motion.traj.actualPosition.tran.y,
- emcStatus->motion.traj.actualPosition.tran.z);
+ emcStatus->motion.traj.actualPosition.tran.z,
+ emcStatus->motion.traj.actualPosition.a);
}
else
{
- sprintf(pos_string, "%13.4f %18.4f %18.4f",
+ sprintf(pos_string, "%9.4f %14.4f %14.4f %14.4f",
emcStatus->motion.traj.position.tran.x,
emcStatus->motion.traj.position.tran.y,
- emcStatus->motion.traj.position.tran.z);
+ emcStatus->motion.traj.position.tran.z,
+ emcStatus->motion.traj.position.a);
}
}
else
@@ -834,24 +880,27 @@
coords = COORD_RELATIVE;
if (posDisplay == POS_DISPLAY_ACT)
{
- sprintf(pos_string, "%13.4f %18.4f %18.4f",
+ sprintf(pos_string, "%9.4f %14.4f %14.4f %14.4f",
emcStatus->motion.traj.actualPosition.tran.x - emcStatus->task.g5x_offset.tran.x - emcStatus->task.g92_offset.tran.x - emcStatus->task.toolOffset.tran.x,
emcStatus->motion.traj.actualPosition.tran.y - emcStatus->task.g5x_offset.tran.y - emcStatus->task.g92_offset.tran.x - emcStatus->task.toolOffset.tran.y,
- emcStatus->motion.traj.actualPosition.tran.z - emcStatus->task.g5x_offset.tran.z - emcStatus->task.g92_offset.tran.x - emcStatus->task.toolOffset.tran.z);
+ emcStatus->motion.traj.actualPosition.tran.z - emcStatus->task.g5x_offset.tran.z - emcStatus->task.g92_offset.tran.x - emcStatus->task.toolOffset.tran.z,
+ emcStatus->motion.traj.actualPosition.a - emcStatus->task.g5x_offset.a - emcStatus->task.g92_offset.tran.x - emcStatus->task.toolOffset.a);
}
else
{
- sprintf(pos_string, "%13.4f %18.4f %18.4f",
+ sprintf(pos_string, "%9.4f %14.4f %14.4f %14.4f",
emcStatus->motion.traj.position.tran.x - emcStatus->task.g5x_offset.tran.x - emcStatus->task.g92_offset.tran.x - emcStatus->task.toolOffset.tran.x,
emcStatus->motion.traj.position.tran.y - emcStatus->task.g5x_offset.tran.y - emcStatus->task.g92_offset.tran.x - emcStatus->task.toolOffset.tran.y,
- emcStatus->motion.traj.position.tran.z - emcStatus->task.g5x_offset.tran.z - emcStatus->task.g92_offset.tran.x - emcStatus->task.toolOffset.tran.z);
+ emcStatus->motion.traj.position.tran.z - emcStatus->task.g5x_offset.tran.z - emcStatus->task.g92_offset.tran.x - emcStatus->task.toolOffset.tran.z,
+ emcStatus->motion.traj.position.a - emcStatus->task.g5x_offset.a - emcStatus->task.g92_offset.tran.x - emcStatus->task.toolOffset.a);
}
}
- sprintf(origin_string, "%13.4f %18.4f %18.4f",
+ sprintf(origin_string, "%9.4f %14.4f %14.4f %14.4f",
emcStatus->task.g5x_offset.tran.x + emcStatus->task.g92_offset.tran.x,
emcStatus->task.g5x_offset.tran.y + emcStatus->task.g92_offset.tran.y,
- emcStatus->task.g5x_offset.tran.z + emcStatus->task.g92_offset.tran.z);
+ emcStatus->task.g5x_offset.tran.z + emcStatus->task.g92_offset.tran.z,
+ emcStatus->task.g5x_offset.a + emcStatus->task.g92_offset.a);
sprintf(speed_string, "%10.1f", jogSpeed);
if (jogMode == JOG_INCREMENTAL)
@@ -931,6 +980,7 @@
}
switch (emcStatus->task.interpState)
+// Надо раскрасить
{
case EMC_TASK_INTERP_IDLE:
sprintf(interp_string, "%s", "IDLE ");
@@ -985,6 +1035,7 @@
if (override < 100)
wattrset(window, A_BOLD);
else
+ start_color();
wattrset(window, A_UNDERLINE);
mvwaddstr(window, 6, 14, scratch_string);
@@ -997,7 +1048,6 @@
mvwaddstr(window, 8, 11, scratch_string);
wattrset(window, A_REVERSE);
-
mvwaddstr(window, 5, 1, state_string);
mvwaddstr(window, 5, 21, mode_string);
mvwaddstr(window, 6, 21, lube_on_string);
@@ -1225,7 +1275,8 @@
if (keyup_count < 0)
{
keyup_count = 0;
- oldch = 0;
+ /* oldch = 0;*/
+ ch = 0;
}
/*
@@ -1545,6 +1596,16 @@
zJogPol = 0;
}
+//надо добавить
+ aJogPol = 1; // set to default
+ if ((inistring = inifile.Find("JOGGING_POLARITY", "AXIS_3")) &&
+ 1 == sscanf(inistring, "%d", &jogPol) &&
+ jogPol == 0)
+ {
+ // it read as 0, so override default
+ aJogPol = 0;
+ }
+
// close it
inifile.Close();
@@ -1845,6 +1906,10 @@
else
{
keyup_count = NEXT_KEYUP_DELAY;
+ //**************************************************************
+ // read NML status */
+ updateStatus();
+ printStatus();
}
// set up a first switch on ch, for those characters that
@@ -2301,6 +2366,80 @@
axisSelected = AXIS_Z;
}
break;
+//и сюда кое чего дописать**********************************************/
+ case '+':
+ if (oldch != ch &&
+ axisJogging == AXIS_NONE)
+ {
+ if (jogMode == JOG_INCREMENTAL)
+ {
+ emc_axis_incr_jog_msg.serial_number = ++emcCommandSerialNumber;
+ emc_axis_incr_jog_msg.axis = axisIndex(AXIS_A);
+ if (aJogPol)
+ emc_axis_incr_jog_msg.vel = jogSpeed / 60.0;
+ else
+ emc_axis_incr_jog_msg.vel = - jogSpeed / 60.0;
+ emc_axis_incr_jog_msg.incr = jogIncrement;
+ emcCommandBuffer->write(emc_axis_incr_jog_msg);
+ emcCommandWait(emcCommandSerialNumber);
+ // don't set axisJogging, since key up will abort
+ }
+ else
+ {
+ jogMode = JOG_CONTINUOUS;
+ emc_axis_jog_msg.serial_number = ++emcCommandSerialNumber;
+ emc_axis_jog_msg.axis = axisIndex(AXIS_A);
+ if (aJogPol)
+ emc_axis_jog_msg.vel = jogSpeed / 60.0;
+ else
+ jogMode = JOG_CONTINUOUS;
+ emc_axis_jog_msg.serial_number = ++emcCommandSerialNumber;
+ emc_axis_jog_msg.axis = axisIndex(AXIS_A);
+ if (aJogPol)
+ emc_axis_jog_msg.vel = jogSpeed / 60.0;
+ else
+ emc_axis_jog_msg.vel = - jogSpeed / 60.0;
+ emcCommandBuffer->write(emc_axis_jog_msg);
+ emcCommandWait(emcCommandSerialNumber);
+ axisJogging = AXIS_A;
+ }
+ axisSelected = AXIS_A;
+ }
+ break;
+
+ case '-':
+ if (oldch != ch &&
+ axisJogging == AXIS_NONE)
+ {
+ if (jogMode == JOG_INCREMENTAL)
+ {
+ emc_axis_incr_jog_msg.serial_number = ++emcCommandSerialNumber;
+ emc_axis_incr_jog_msg.axis = axisIndex(AXIS_A);
+ if (aJogPol)
+ emc_axis_incr_jog_msg.vel = - jogSpeed / 60.0;
+ else
+ emc_axis_incr_jog_msg.vel = jogSpeed / 60.0;
+ emc_axis_incr_jog_msg.incr = jogIncrement;
+ emcCommandBuffer->write(emc_axis_incr_jog_msg);
+ emcCommandWait(emcCommandSerialNumber);
+ // don't set axisJogging, since key up will abort
+ }
+ else
+ {
+ jogMode = JOG_CONTINUOUS;
+ emc_axis_jog_msg.serial_number = ++emcCommandSerialNumber;
+ emc_axis_jog_msg.axis = axisIndex(AXIS_A);
+ if (aJogPol)
+ emc_axis_jog_msg.vel = - jogSpeed / 60.0;
+ else
+ emc_axis_jog_msg.vel = jogSpeed / 60.0;
+ emcCommandBuffer->write(emc_axis_jog_msg);
+ emcCommandWait(emcCommandSerialNumber);
+ axisJogging = AXIS_A;
+ }
+ axisSelected = AXIS_A;
+ }
+ break;
case KEY_HOME: // home selected axis
if (oldch != ch)
@@ -2610,6 +2749,32 @@
}
}
break;
+/* сюда дописать про А*/
+ case 'a':
+ case 'A':
+ if (oldch != ch)
+ {
+ if (emcStatus->task.mode == EMC_TASK_MODE_MDI)
+ {
+ typing = 1;
+ typeindex = 1;
+ typebuffer[0] = ch;
+ typebuffer[1] = 0;
+ interactive = IACT_MDI;
+
+ critFlag = 1;
+ mvwaddstr(window, wmaxy, wbegx, line_blank);
+ mvwaddstr(window, wmaxy, wbegx, "mdi command: ");
+ waddch(window, ch);
+ wrefresh(window);
+ critFlag = 0;
+ }
+ else
+ {
+ axisSelected = AXIS_A;
+ }
+ }
+ break;
case 'i': // incremental jog toggle
case 'I':
@@ -2695,7 +2860,7 @@
}
}
break;
-
+//надо по другому распределить скорости до 150%
case '0':
case '1':
case '2':
@@ -2804,9 +2969,13 @@
emcCommandWait(emcCommandSerialNumber);
}
break;
+/* И что удивительно в хелпе про это по другому
+ надо по другому переделать потому, что перекекаются хоткеи */
+// case 'a':
+// case 'A':
+ case 'f':
+ case 'F':
- case 'a':
- case 'A':
if (oldch != ch)
{
task_plan_step_msg.serial_number = ++emcCommandSerialNumber;