Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 3.16 KB | None | 0 0
  1. From bda04772753a6410a8c6c2832fb8ade483460ea0 Mon Sep 17 00:00:00 2001
  2. From: Jason Penn <jpenn@tormach.com>
  3. Date: Wed, 22 Oct 2014 17:14:13 -0500
  4. Subject: [PATCH] Added missing hooks for unloading gcode NML call.
  5.  
  6. ---
  7. src/emc/task/emctaskmain.cc                   | 15 +++++++++++++++
  8.  src/emc/usr_intf/axis/extensions/emcmodule.cc | 15 +++++++++++++++
  9.  2 files changed, 30 insertions(+)
  10.  
  11. diff --git a/src/emc/task/emctaskmain.cc b/src/emc/task/emctaskmain.cc
  12. index b880c35..ff5efe2 100644
  13. --- a/src/emc/task/emctaskmain.cc
  14. +++ b/src/emc/task/emctaskmain.cc
  15. @@ -857,6 +857,7 @@ static int emcTaskPlan(void)
  16.         case EMC_TASK_SET_STATE_TYPE:
  17.         case EMC_TASK_PLAN_INIT_TYPE:
  18.         case EMC_TASK_PLAN_OPEN_TYPE:
  19. +       case EMC_TASK_PLAN_CLOSE_TYPE:
  20.         case EMC_TASK_PLAN_SET_OPTIONAL_STOP_TYPE:
  21.         case EMC_TASK_PLAN_SET_BLOCK_DELETE_TYPE:
  22.         case EMC_TASK_ABORT_TYPE:
  23. @@ -1076,6 +1077,7 @@ static int emcTaskPlan(void)
  24.         case EMC_TASK_ABORT_TYPE:
  25.         case EMC_TASK_PLAN_INIT_TYPE:
  26.         case EMC_TASK_PLAN_OPEN_TYPE:
  27. +       case EMC_TASK_PLAN_CLOSE_TYPE:
  28.         case EMC_TASK_PLAN_RUN_TYPE:
  29.         case EMC_TASK_PLAN_EXECUTE_TYPE:
  30.         case EMC_TASK_PLAN_PAUSE_TYPE:
  31. @@ -1407,6 +1409,7 @@ static int emcTaskPlan(void)
  32.         case EMC_TASK_SET_STATE_TYPE:
  33.         case EMC_TASK_PLAN_INIT_TYPE:
  34.         case EMC_TASK_PLAN_OPEN_TYPE:
  35. +       case EMC_TASK_PLAN_CLOSE_TYPE:
  36.         case EMC_TASK_PLAN_PAUSE_TYPE:
  37.         case EMC_TASK_PLAN_SET_OPTIONAL_STOP_TYPE:
  38.         case EMC_TASK_PLAN_SET_BLOCK_DELETE_TYPE:
  39. @@ -2194,6 +2197,18 @@ static int emcTaskIssueCommand(NMLmsg * cmd)
  40.     }
  41.     break;
  42.  
  43. +    case EMC_TASK_PLAN_CLOSE_TYPE:
  44. +   //close_msg = (EMC_TASK_PLAN_CLOSE *) cmd;
  45. +   retval = emcTaskPlanClose();
  46. +   if (retval > INTERP_MIN_ERROR) {
  47. +       retval = -1;
  48. +   }
  49. +   retval = emcTaskPlanInit();
  50. +   if (retval > INTERP_MIN_ERROR) {
  51. +       retval = -1;
  52. +   }
  53. +   break;
  54. +
  55.      case EMC_TASK_PLAN_EXECUTE_TYPE:
  56.     stepping = 0;
  57.     steppingWait = 0;
  58. diff --git a/src/emc/usr_intf/axis/extensions/emcmodule.cc b/src/emc/usr_intf/axis/extensions/emcmodule.cc
  59. index b42f78a..8a62769 100644
  60. --- a/src/emc/usr_intf/axis/extensions/emcmodule.cc
  61. +++ b/src/emc/usr_intf/axis/extensions/emcmodule.cc
  62. @@ -1172,6 +1172,20 @@ static PyObject *program_open(pyCommandChannel *s, PyObject *o) {
  63.      return Py_None;
  64.  }
  65.  
  66. +static PyObject *program_close(pyCommandChannel *s, PyObject *o) {
  67. +    EMC_TASK_PLAN_CLOSE m;
  68. +    char *file;
  69. +    int len;
  70. +
  71. +    //if(!PyArg_ParseTuple(o, "s#", &file, &len)) return NULL;
  72. +    m.serial_number = next_serial(s);
  73. +    //strcpy(m.file, file);
  74. +    s->c->write(m);
  75. +    emcWaitCommandReceived(s->serial, s->s);
  76. +    Py_INCREF(Py_None);
  77. +    return Py_None;
  78. +}
  79. +
  80.  static PyObject *emcauto(pyCommandChannel *s, PyObject *o) {
  81.      int fn;
  82.      EMC_TASK_PLAN_RUN run;
  83. @@ -1449,6 +1463,7 @@ static PyMethodDef Command_methods[] = {
  84.      {"set_analog_output", (PyCFunction)set_analog_output, METH_VARARGS},
  85.      {"set_homing_params", (PyCFunction)set_homing_params, METH_VARARGS},
  86.      {"set_axis_max_velocity", (PyCFunction)set_axis_max_velocity, METH_VARARGS},
  87. +    {"program_close", (PyCFunction)program_close, METH_NOARGS},
  88.      {NULL}
  89.  };
  90.  
  91. --
  92. 1.9.2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement