Tool table access interface

More
12 Nov 2023 19:00 #285190 by lkavan
Hallo,
please, can you help me how to access to tooltable in latest LCNC master version? In past, I have used emcStatus->io.tool.tooltable[pocket]... , but it seems, it is obsolette.
I have tried to compile LCNC with --enable-toolnml, but it is not possible to compile:
/usr/bin/ld: objects/emc/usr_intf/halui.o: in function `main':
/home/lkavan/linuxcnc/linuxcnc-dev/src/emc/usr_intf/halui.cc:2314: undefined reference to `tool_mmap_user()'

I have tried to access tooltable with new mmap, but when I have tried this:

CANON_TOOL_TABLE tdata;
tooldata_get(&tdata,1);

GUI crashes with result: 290056 tooldata_get() not mmapped BYE

I cannot find any docs for how to use new tooltable interface.
Thanx for your help.

 

Please Log in or Create an account to join the conversation.

More
15 Nov 2023 13:18 #285506 by lkavan
Replied by lkavan on topic Tool table access interface
So, after some research I have found these functions:
toolidx_t tooldata_put(struct CANON_TOOL_TABLE tdata,int idx);
toolidx_t tooldata_get(CANON_TOOL_TABLE* pdata,int idx);

void tooldata_init(bool random_tool_changer);
void tooldata_reset(void);
void tooldata_last_index_set(int idx);
int tooldata_last_index_get(void);
int tooldata_find_index_for_tool(int toolno);
//mmap specific
int tool_mmap_creator(EMC_TOOL_STAT const *ptr,int random_toolchanger);
int tool_mmap_user(void);
void tool_mmap_close(void);
bool tool_mmap_is_random_toolchanger(void);

But I am not sure how to use them right. When I call tooldata_init(0) and then tool_mmap_user() then I am able to read and write from/to tooltable with tooldata_put and tooldata_get Should I call tool_mmap_close() when finished with tooltable access? After this, next access to tooltable crashes GUI.

Please Log in or Create an account to join the conversation.

Time to create page: 0.067 seconds
Powered by Kunena Forum