📄 iosh.cc
字号:
Tcl_SetResult(interp, "emc_spindle_abort", TCL_VOLATILE); break; case EMC_SPINDLE_ON_TYPE: sprintf(string, "emc_spindle_on %f", ((EMC_SPINDLE_ON *) emcioCommand)->speed); Tcl_SetResult(interp, string, TCL_VOLATILE); break; case EMC_SPINDLE_OFF_TYPE: Tcl_SetResult(interp, "emc_spindle_off", TCL_VOLATILE); break; case EMC_SPINDLE_FORWARD_TYPE: Tcl_SetResult(interp, "emc_spindle_forward", TCL_VOLATILE); break; case EMC_SPINDLE_REVERSE_TYPE: Tcl_SetResult(interp, "emc_spindle_reverse", TCL_VOLATILE); break; case EMC_SPINDLE_STOP_TYPE: Tcl_SetResult(interp, "emc_spindle_stop", TCL_VOLATILE); break; case EMC_SPINDLE_INCREASE_TYPE: Tcl_SetResult(interp, "emc_spindle_increase", TCL_VOLATILE); break; case EMC_SPINDLE_DECREASE_TYPE: Tcl_SetResult(interp, "emc_spindle_decrease", TCL_VOLATILE); break; case EMC_SPINDLE_CONSTANT_TYPE: Tcl_SetResult(interp, "emc_spindle_constant", TCL_VOLATILE); break; case EMC_SPINDLE_BRAKE_RELEASE_TYPE: Tcl_SetResult(interp, "emc_spindle_brake_release", TCL_VOLATILE); break; case EMC_SPINDLE_BRAKE_ENGAGE_TYPE: Tcl_SetResult(interp, "emc_spindle_brake_engage", TCL_VOLATILE); break; case EMC_COOLANT_INIT_TYPE: Tcl_SetResult(interp, "emc_coolant_init", TCL_VOLATILE); break; case EMC_COOLANT_HALT_TYPE: Tcl_SetResult(interp, "emc_coolant_halt", TCL_VOLATILE); break; case EMC_COOLANT_ABORT_TYPE: Tcl_SetResult(interp, "emc_coolant_abort", TCL_VOLATILE); break; case EMC_COOLANT_MIST_ON_TYPE: Tcl_SetResult(interp, "emc_coolant_mist_on", TCL_VOLATILE); break; case EMC_COOLANT_MIST_OFF_TYPE: Tcl_SetResult(interp, "emc_coolant_mist_off", TCL_VOLATILE); break; case EMC_COOLANT_FLOOD_ON_TYPE: Tcl_SetResult(interp, "emc_coolant_flood_on", TCL_VOLATILE); break; case EMC_COOLANT_FLOOD_OFF_TYPE: Tcl_SetResult(interp, "emc_coolant_flood_off", TCL_VOLATILE); break; case EMC_AUX_INIT_TYPE: Tcl_SetResult(interp, "emc_aux_init", TCL_VOLATILE); break; case EMC_AUX_HALT_TYPE: Tcl_SetResult(interp, "emc_aux_halt", TCL_VOLATILE); break; case EMC_AUX_ABORT_TYPE: Tcl_SetResult(interp, "emc_aux_abort", TCL_VOLATILE); break; case EMC_AUX_ESTOP_ON_TYPE: Tcl_SetResult(interp, "emc_aux_estop_on", TCL_VOLATILE); break; case EMC_AUX_ESTOP_OFF_TYPE: Tcl_SetResult(interp, "emc_aux_estop_off", TCL_VOLATILE); break; case EMC_LUBE_INIT_TYPE: Tcl_SetResult(interp, "emc_lube_init", TCL_VOLATILE); break; case EMC_LUBE_HALT_TYPE: Tcl_SetResult(interp, "emc_lube_halt", TCL_VOLATILE); break; case EMC_LUBE_ABORT_TYPE: Tcl_SetResult(interp, "emc_lube_abort", TCL_VOLATILE); break; case EMC_LUBE_ON_TYPE: Tcl_SetResult(interp, "emc_lube_on", TCL_VOLATILE); break; case EMC_LUBE_OFF_TYPE: Tcl_SetResult(interp, "emc_lube_off", TCL_VOLATILE); break; default: Tcl_SetResult(interp, (char *) emcSymbolLookup(type), TCL_VOLATILE); break; } return TCL_OK;}/* Returns the NML command type number*/static int emc_io_get_command_type(ClientData clientdata, Tcl_Interp * interp, int objc, Tcl_Obj * CONST objv[]){ if (objc != 1) { Tcl_SetResult(interp, "emc_io_get_command_type: need no args\n", TCL_VOLATILE); return TCL_ERROR; } Tcl_SetObjResult(interp, Tcl_NewIntObj(emcioCommand->type)); return TCL_OK;}/* Returns the NML command serial number*/static int emc_io_get_serial_number(ClientData clientdata, Tcl_Interp * interp, int objc, Tcl_Obj * CONST objv[]){ if (objc != 1) { Tcl_SetResult(interp, "emc_io_get_serial_number: need no args\n", TCL_VOLATILE); return TCL_ERROR; } Tcl_SetObjResult(interp, Tcl_NewIntObj(emcioCommand->serial_number)); return TCL_OK;}static int emc_io_write_status(ClientData clientdata, Tcl_Interp * interp, int objc, Tcl_Obj * CONST objv[]){ if (objc != 1) { Tcl_SetResult(interp, "emc_io_write_status: need no args", TCL_VOLATILE); return TCL_ERROR; } if (0 == emcioStatusBuffer) { Tcl_SetObjResult(interp, Tcl_NewIntObj(-1)); return TCL_OK; } if (0 == emcioStatusBuffer->write(&emcioStatus)) { Tcl_SetObjResult(interp, Tcl_NewIntObj(0)); } else { Tcl_SetObjResult(interp, Tcl_NewIntObj(-1)); } return TCL_OK;}static int emc_io_write_error(ClientData clientdata, Tcl_Interp * interp, int objc, Tcl_Obj * CONST objv[]){ EMC_OPERATOR_ERROR error_msg; if (objc != 2) { Tcl_SetResult(interp, "emc_io_write_error: need error string", TCL_VOLATILE); return TCL_ERROR; } if (0 == emcErrorBuffer) { Tcl_SetObjResult(interp, Tcl_NewIntObj(-1)); return TCL_OK; } strncpy(error_msg.error, Tcl_GetStringFromObj(objv[1], 0), LINELEN); error_msg.error[LINELEN - 1] = 0; if (0 == emcErrorBuffer->write(&error_msg)) { Tcl_SetObjResult(interp, Tcl_NewIntObj(0)); } else { Tcl_SetObjResult(interp, Tcl_NewIntObj(-1)); } return TCL_OK;}// IO status/* set the status heartbeat */static int emc_io_status_heartbeat(ClientData clientdata, Tcl_Interp * interp, int objc, Tcl_Obj * CONST objv[]){ int heartbeat; if (objc != 2) { Tcl_SetResult(interp, "emc_io_status_heartbeat: need heartbeat", TCL_VOLATILE); return TCL_ERROR; } if (TCL_OK == Tcl_GetIntFromObj(0, objv[1], &heartbeat)) { emcioStatus.heartbeat = heartbeat; return TCL_OK; } Tcl_SetResult(interp, "emc_io_status_heartbeat: bad heartbeat", TCL_VOLATILE); return TCL_ERROR;}static int emc_io_status_command_type(ClientData clientdata, Tcl_Interp * interp, int objc, Tcl_Obj * CONST objv[]){ int command_type; if (objc != 2) { Tcl_SetResult(interp, "emc_io_status_command_type: need command type", TCL_VOLATILE); return TCL_ERROR; } if (TCL_OK == Tcl_GetIntFromObj(0, objv[1], &command_type)) { emcioStatus.command_type = command_type; return TCL_OK; } Tcl_SetResult(interp, "emc_io_status_command_type: need command type", TCL_VOLATILE); return TCL_ERROR;}static int emc_io_status_echo_serial_number(ClientData clientdata, Tcl_Interp * interp, int objc, Tcl_Obj * CONST objv[]){ int echo_serial_number; if (objc != 2) { Tcl_SetResult(interp, "emc_io_status_echo_serial_number: need echo serial number", TCL_VOLATILE); return TCL_ERROR; } if (TCL_OK == Tcl_GetIntFromObj(0, objv[1], &echo_serial_number)) { emcioStatus.echo_serial_number = echo_serial_number; return TCL_OK; } Tcl_SetResult(interp, "emc_io_status_echo_serial_number: need echo serial number", TCL_VOLATILE); return TCL_ERROR;}/* set the NML status to done, exec, error, or read it with no args.*/static int emc_io_status_status(ClientData clientdata, Tcl_Interp * interp, int objc, Tcl_Obj * CONST objv[]){ const char *objstr; if (objc != 2) { Tcl_SetResult(interp, "emc_io_status: need done | exec | error", TCL_VOLATILE); return TCL_ERROR; } objstr = Tcl_GetStringFromObj(objv[1], 0); if (!strcmp(objstr, "done")) { emcioStatus.status = RCS_DONE; return TCL_OK; } else if (!strcmp(objstr, "exec")) { emcioStatus.status = RCS_EXEC; return TCL_OK; } else if (!strcmp(objstr, "error")) { emcioStatus.status = RCS_ERROR; return TCL_OK; } Tcl_SetResult(interp, "emc_io_status: need done | exec | error", TCL_VOLATILE); return TCL_ERROR;}static int emc_io_status_estop(ClientData clientdata, Tcl_Interp * interp, int objc, Tcl_Obj * CONST objv[]){ const char *objstr; if (objc != 2) { Tcl_SetResult(interp, "emc_io_status_estop: need on | off", TCL_VOLATILE); return TCL_ERROR; } objstr = Tcl_GetStringFromObj(objv[1], 0); if (!strcmp(objstr, "on")) { emcioStatus.aux.estop = 1; return TCL_OK; } else if (!strcmp(objstr, "off")) { emcioStatus.aux.estop = 0; return TCL_OK; } Tcl_SetResult(interp, "emc_io_status_estop: need on | off", TCL_VOLATILE); return TCL_ERROR;}static int emc_io_status_mist(ClientData clientdata, Tcl_Interp * interp, int objc, Tcl_Obj * CONST objv[]){ const char *objstr; if (objc != 2) { Tcl_SetResult(interp, "emc_io_status_mist: need on | off", TCL_VOLATILE); return TCL_ERROR; } objstr = Tcl_GetStringFromObj(objv[1], 0); if (!strcmp(objstr, "on")) { emcioStatus.coolant.mist = 1; return TCL_OK; } else if (!strcmp(objstr, "off")) { emcioStatus.coolant.mist = 0; return TCL_OK; } Tcl_SetResult(interp, "emc_io_status_mist: need on | off", TCL_VOLATILE); return TCL_ERROR;}static int emc_io_status_flood(ClientData clientdata, Tcl_Interp * interp, int objc, Tcl_Obj * CONST objv[]){ const char *objstr; if (objc != 2) { Tcl_SetResult(interp, "emc_io_status_flood: need on | off", TCL_VOLATILE); return TCL_ERROR; } objstr = Tcl_GetStringFromObj(objv[1], 0); if (!strcmp(objstr, "on")) { emcioStatus.coolant.flood = 1; return TCL_OK; } else if (!strcmp(objstr, "off")) { emcioStatus.coolant.flood = 0; return TCL_OK; } Tcl_SetResult(interp, "emc_io_status_flood: need on | off", TCL_VOLATILE); return TCL_ERROR;}static int emc_io_status_lube(ClientData clientdata, Tcl_Interp * interp, int objc, Tcl_Obj * CONST objv[]){ const char *objstr; if (objc != 2) { Tcl_SetResult(interp, "emc_io_status_lube: need on | off", TCL_VOLATILE); return TCL_ERROR; } objstr = Tcl_GetStringFromObj(objv[1], 0); if (!strcmp(objstr, "on")) { emcioStatus.lube.on = 1; return TCL_OK; } else if (!strcmp(objstr, "off")) { emcioStatus.lube.on = 0; return TCL_OK; } Tcl_SetResult(interp, "emc_io_status_lube: need on | off", TCL_VOLATILE); return TCL_ERROR;}static int emc_io_status_lube_level(ClientData clientdata, Tcl_Interp * interp, int objc, Tcl_Obj * CONST objv[]){ const char *objstr; if (objc != 2) { Tcl_SetResult(interp, "emc_io_status_lube_level: need ok | low", TCL_VOLATILE); return TCL_ERROR; } objstr = Tcl_GetStringFromObj(objv[1], 0); if (!strcmp(objstr, "ok")) { emcioStatus.lube.level = 1; return TCL_OK; } else if (!strcmp(objstr, "low")) { emcioStatus.lube.level = 0; return TCL_OK; } Tcl_SetResult(interp, "emc_io_status_lube_level: need ok | low", TCL_VOLATILE); return TCL_ERROR;}static int emc_io_status_spindle_speed(ClientData clientdata, Tcl_Interp * interp, int objc, Tcl_Obj * CONST objv[]){ double speed; if (objc != 2) { Tcl_SetResult(interp, "emc_io_status_spindle_speed: need speed", TCL_VOLATILE); return TCL_ERROR; } if (TCL_OK == Tcl_GetDoubleFromObj(0, objv[1], &speed)) { emcioStatus.spindle.speed = speed; return TCL_OK; } Tcl_SetResult(interp, "emc_io_status_spindle_speed: need speed", TCL_VOLATILE); return TCL_ERROR;}static int emc_io_status_spindle_enabled(ClientData clientdata, Tcl_Interp * interp, int objc, Tcl_Obj * CONST objv[]){ const char *objstr; if (objc != 2) { Tcl_SetResult(interp, "emc_io_status_spindle_enabled: need on | off", TCL_VOLATILE); return TCL_ERROR; } objstr = Tcl_GetStringFromObj(objv[1], 0); if (!strcmp(objstr, "on")) { emcioStatus.spindle.enabled = 1; return TCL_OK; } else if (!strcmp(objstr, "off")) { emcioStatus.spindle.enabled = 0; return TCL_OK; } Tcl_SetResult(interp, "emc_io_status_spindle_enabled: need on | off", TCL_VOLATILE); return TCL_ERROR;}static int emc_io_status_spindle_direction(ClientData clientdata, Tcl_Interp * interp, int objc, Tcl_Obj * CONST objv[]){ int direction; if (objc != 2) { Tcl_SetResult(interp, "emc_io_status_spindle_direction: need direction", TCL_VOLATILE); return TCL_ERROR; } if (TCL_OK == Tcl_GetIntFromObj(0, objv[1], &direction)) { emcioStatus.spindle.direction = direction; return TCL_OK; } Tcl_SetResult(interp, "emc_io_status_spindle_direction: need direction", TCL_VOLATILE); return TCL_ERROR;}static int emc_io_status_spindle_increasing(ClientData clientdata, Tcl_Interp * interp, int objc, Tcl_Obj * CONST objv[]){ int increasing; if (objc != 2) { Tcl_SetResult(interp, "emc_io_status_spindle_increasing: need increasing", TCL_VOLATILE); return TCL_ERROR; } if (TCL_OK == Tcl_GetIntFromObj(0, objv[1], &increasing)) { emcioStatus.spindle.increasing = increasing; return TCL_OK; } Tcl_SetResult(interp, "emc_io_status_spindle_increasing: need increasing", TCL_VOLATILE); return TCL_ERROR;}static int emc_io_status_spindle_brake(ClientData clientdata, Tcl_Interp * interp, int objc, Tcl_Obj * CONST objv[]){ const char *objstr; if (objc != 2) { Tcl_SetResult(interp, "emc_io_status_spindle_brake: need on | off", TCL_VOLATILE); return TCL_ERROR; } objstr = Tcl_GetStringFromObj(objv[1], 0); if (!strcmp(objstr, "on")) { emcioStatus.spindle.brake = 1; return TCL_OK; } else if (!strcmp(objstr, "off")) { emcioStatus.spindle.brake = 0; return TCL_OK; } Tcl_SetResult(interp, "emc_io_status_spindle_brake: need on | off", TCL_VOLATILE); return TCL_ERROR;}static int emc_io_status_tool_prepped(ClientData clientdata, Tcl_Interp * interp, int objc, Tcl_Obj * CONST objv[]){ int toolPrepped; if (objc != 2) { Tcl_SetResult(interp, "emc_io_status_tool_prepped: need tool", TCL_VOLATILE); return TCL_ERROR; } if (TCL_OK == Tcl_GetIntFromObj(0, objv[1], &toolPrepped)) { emcioStatus.tool.toolPrepped = toolPrepped; return TCL_OK; } Tcl_SetResult(interp, "emc_io_status_tool_prepped: need tool", TCL_VOLATILE); return TCL_ERROR;}static int emc_io_status_tool_in_spindle(ClientData clientdata, Tcl_Interp * interp, int objc,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -