Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions configs/sim/axis/db_demo/db_panel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,6 @@
<anchor>"w"</anchor>
</label>
</hbox>
<hbox>
<sint>
<halpin>"tool-prep-index"</halpin>
<format>"4d"</format>
<width>"6"</width>
<bg>"black"</bg>
<fg>"cyan"</fg>
</sint>
<label>
<text>"tool-prep-index"</text>
<anchor>"w"</anchor>
</label>
</hbox>
<hbox>
<sint>
<halpin>"tool-prep-number"</halpin>
Expand Down
3 changes: 0 additions & 3 deletions configs/sim/axis/db_demo/db_postgui.hal
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ net db:tool-changed => pyvcp.tool-changed
net db:tool-number <= iocontrol.0.tool-number
net db:tool-number => pyvcp.tool-number

net db:tool-prep-index <= iocontrol.0.tool-prep-index
net db:tool-prep-index => pyvcp.tool-prep-index

net db:tool-prep-number <= iocontrol.0.tool-prep-number
net db:tool-prep-number => pyvcp.tool-prep-number

Expand Down
12 changes: 3 additions & 9 deletions docs/src/gcode/tool-compensation.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,12 @@ The HAL input pin, `iocontrol.0.tool-prepared`, must be set by external HAL logi
A G-code *M6* command asserts the HAL output pin `iocontrol.0.tool-change`.
The related HAL input pin, `iocontrol.0.tool-prepared`, must be set by external HAL logic to indicate completion of the tool change leading to a subsequent reset of the tool-change pin.

Tooldata is accessed by an ordered index (idx) that depends on the type of toolchanger specified by `[EMCIO]RANDOM_TOOLCHANGER=`__type__.

. For `RANDOM_TOOLCHANGER = 0`, (0 is default and specifies a non-random toolchanger) idx is a number indicating the sequence in which tooldata was loaded.
. For `RANDOM_TOOLCHANGER = 1`, idx is the *current* pocket number for the tool number specified by the G-code select tool command *T__n__*.
The type of toolchanger is specified by `[EMCIO]RANDOM_TOOLCHANGER=`__type__:
0 (the default) for a non-random toolchanger, 1 for a random toolchanger.

The io program provides HAL output pins to facilitate toolchanger management:

. *iocontrol.0.tool-prep-number*
. *iocontrol.0.tool-prep-index*
. *iocontrol.0.tool-prep-pocket*
. *iocontrol.0.tool-from-pocket*

Expand All @@ -169,11 +166,9 @@ The io program provides HAL output pins to facilitate toolchanger management:
. Tool number _n_==0 indicates no tool.
. The pocket number for a tool is set when tooldata is loaded/reloaded from its data source ([EMCIO]TOOL_TABLE or [EMCIO]DB_PROGRAM).
. At G-code *T__n__* (_n_ != 0) command:
.. *iocontrol.0.tool-prep-index* = _idx_ (index based on tooldata load sequence)
.. *iocontrol.0.tool-prep-number* = _n_
.. *iocontrol.0.tool-prep-pocket* = the pocket number for _n_
. At G-code *T0* (_n_ == 0 remove) command:
.. *iocontrol.0.tool-prep-index* = 0
.. *iocontrol.0.tool-prep-number* = 0
.. *iocontrol.0.tool-prep-pocket* = 0
. At M-code *M6* (following iocontrol.0.tool-changed pin 0-->1):
Expand All @@ -183,9 +178,8 @@ The io program provides HAL output pins to facilitate toolchanger management:

. Tool number _n_==0 is *not special*.
. Pocket number 0 is *special* as it indicates the *spindle*.
. The *current* pocket number for tool _n_ is the tooldata index (_idx_) for tool _n_.
. Tools move between pockets: the pocket number of tool _n_ is the pocket it is *currently* in.
. At G-code command *T__n__*:
.. *iocontrol.0.tool-prep-index* = tooldata index (idx) for tool _n_
.. *iocontrol.0.tool-prep-number* = _n_
.. *iocontrol.0.tool-prep-pocket* = pocket number for tool _n_
. At M-code *M6* (following iocontrol.0.tool-changed pin 0-->1):
Expand Down
7 changes: 7 additions & 0 deletions docs/src/getting-started/updating-linuxcnc.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,13 @@ between an integer source and the float pin, or a
link:../man/man9/conv_real_sint.9.html[conv_real_sint] component
between a float output and an integer input.

The *iocontrol.0.tool-prep-index* pin has been removed. It carried the
position of the prepared tool in LinuxCNC's internal copy of the tool
table, which on a non-random toolchanger has no meaning outside
LinuxCNC. Use *iocontrol.0.tool-prep-number* (the tool number) or
*iocontrol.0.tool-prep-pocket* (its pocket) instead. A HAL file that
still connects the pin fails to load.


== Preview renderer now requires OpenGL 3.3 core

Expand Down
7 changes: 0 additions & 7 deletions docs/src/man/man1/io.1.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@ unless an absolute path is specified.
FALSE when an internal E-stop condition exists.
*iocontrol.0.user-request-enable* (bool, out)::
TRUE when the user has requested that E-stop be cleared.
*iocontrol.0.tool-prep-index* (sint, out)::
IO's internal array index of the prepped tool requested by the most recent T-word.
0 if no tool is prepped. On Random toolchanger machines this is the tool's pocket number
(i.e., the same as the tool-prep-pocket pin),
on Non-random toolchanger machines this is a small integer corresponding to
the tool's location in the internal representation of the tool table.
This parameter returns to 0 after a successful tool change (M6).

== REPORTING BUGS

Expand Down
13 changes: 4 additions & 9 deletions src/emc/task/taskclass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ int Task::iocontrol_hal_init(void)
CHK(hal_pin_new_bool(comp_id, HAL_OUT, &iocontrol_data->coolant_flood, 0, IOC0".coolant-flood"));
CHK(hal_pin_new_sint(comp_id, HAL_OUT, &iocontrol_data->tool_prep_pocket, 0, IOC0".tool-prep-pocket"));
CHK(hal_pin_new_sint(comp_id, HAL_OUT, &iocontrol_data->tool_from_pocket, 0, IOC0".tool-from-pocket"));
CHK(hal_pin_new_sint(comp_id, HAL_OUT, &iocontrol_data->tool_prep_index, 0, IOC0".tool-prep-index"));
CHK(hal_pin_new_sint(comp_id, HAL_OUT, &iocontrol_data->tool_prep_number, 0, IOC0".tool-prep-number"));
CHK(hal_pin_new_sint(comp_id, HAL_OUT, &iocontrol_data->tool_number, 0, IOC0".tool-number"));
CHK(hal_pin_new_bool(comp_id, HAL_OUT, &iocontrol_data->tool_prepare, 0, IOC0".tool-prepare"));
Expand Down Expand Up @@ -90,7 +89,6 @@ void Task::hal_init_pins(void)
hal_set_sint(iocontrol_data->tool_prep_number, 0); /* output, pin that holds the tool number to be prepared, only valid when tool-prepare=TRUE */
hal_set_sint(iocontrol_data->tool_prep_pocket, 0); /* output, pin that holds the pocketno for the tool to be prepared, only valid when tool-prepare=TRUE */
hal_set_sint(iocontrol_data->tool_from_pocket, 0); /* output, always 0 at startup */
hal_set_sint(iocontrol_data->tool_prep_index, 0); /* output, pin that holds the internal index (idx) of the tool to be prepared, for debug */
hal_set_bool(iocontrol_data->tool_change, 0); /* output, notifies a tool-change should happen (emc should be in the tool-change position) */
hal_set_sint(iocontrol_data->tool_number, emcioStatus.tool.toolInSpindle);
}
Expand Down Expand Up @@ -467,11 +465,11 @@ int Task::emcToolPrepare(int toolno)
}
rtapi_print_msg(RTAPI_MSG_DBG, "EMC_TOOL_PREPARE tool=%d idx=%d\n", toolno, idx);

hal_set_sint(iocontrol_data->tool_prep_index, idx); // any type of changer
prep_index = idx; // any type of changer

// Note: some of the following logic could be simplified
// but is maintained to preserve runtests expectations
// Set HAL pins for tool number, pocket, and index.
// Set HAL pins for tool number and pocket.
if (random_toolchanger) {
// RANDOM_TOOLCHANGER
hal_set_sint(iocontrol_data->tool_prep_number, tdata.toolno);
Expand Down Expand Up @@ -638,10 +636,7 @@ int Task::emcToolSetNumber(int number)//EMC_TOOL_SET_NUMBER
int Task::read_tool_inputs(void)
{
if (hal_get_bool(iocontrol_data->tool_prepare) && hal_get_bool(iocontrol_data->tool_prepared)) {
// We get the clamped HAL value from tool_prep_index because it is
// assigned elsewhere to int and would be truncated. The content
// is a relative small index value anyway.
emcioStatus.tool.pocketPrepped = hal_get_si32_clamped(iocontrol_data->tool_prep_index); //check if tool has been (idx) prepared
emcioStatus.tool.pocketPrepped = prep_index; //check if tool has been (idx) prepared
hal_set_bool(iocontrol_data->tool_prepare, 0);
emcioStatus.status = RCS_STATUS::DONE; // we finally finished to do tool-changing, signal task with RCS_DONE
return 10; //prepped finished
Expand All @@ -668,7 +663,7 @@ int Task::read_tool_inputs(void)
emcioStatus.tool.pocketPrepped = -1; //reset the tool preped number, -1 to permit tool 0 to be loaded
hal_set_sint(iocontrol_data->tool_prep_number, 0); //likewise in HAL
hal_set_sint(iocontrol_data->tool_prep_pocket, 0); //likewise in HAL
hal_set_sint(iocontrol_data->tool_prep_index, 0); //likewise in HAL
prep_index = 0;
hal_set_bool(iocontrol_data->tool_change, 0); //also reset the tool change signal
emcioStatus.status = RCS_STATUS::DONE; // we finally finished to do tool-changing, signal task with RCS_DONE
return 11; //change finished
Expand Down
2 changes: 1 addition & 1 deletion src/emc/task/taskclass.hh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ struct iocontrol_str {
hal_sint_t tool_prep_pocket; /* output, pin that holds the pocketno for the tool table entry matching the tool to
be prepared, only valid when tool-prepare=TRUE */
hal_sint_t tool_from_pocket; /* output, pin indicating pocket current load tool retrieved from*/
hal_sint_t tool_prep_index; /* output, pin for internal index (idx) of prepped tool above */
hal_sint_t tool_prep_number; /* output, pin that holds the tool number to be prepared, only valid when tool-prepare=TRUE */
hal_sint_t tool_number; /* output, pin that holds the tool number currently in the spindle */
hal_bool_t tool_prepared; /* input, pin that notifies that the tool has been prepared */
Expand Down Expand Up @@ -90,6 +89,7 @@ public:
char db_program[LINELEN] {};
tooldb_t db_mode {tooldb_t::DB_NOTUSED};
int tool_status;
int prep_index {0}; // tooldata index of the tool being prepared
};

extern Task *task_methods;
Expand Down
Loading