From 97472108e31e8ac63a3a2e9a91d313c26dddc9de Mon Sep 17 00:00:00 2001 From: Andreas Karlsson Date: Mon, 7 Nov 2022 20:29:39 +0100 Subject: [PATCH] Add reference to objectlist in SM mappings Rationale, users might need more info on what object it is that is mapped. Having a reference to objectlist enable the user to know what index it is and got a reference to the entire object. The obj only know what subindex it is. fixes #137 --- soes/esc_coe.c | 9 +++++++++ soes/esc_coe.h | 1 + 2 files changed, 10 insertions(+) diff --git a/soes/esc_coe.c b/soes/esc_coe.c index 2e35391..9c61724 100644 --- a/soes/esc_coe.c +++ b/soes/esc_coe.c @@ -203,6 +203,15 @@ uint16_t sizeOfPDO (uint16_t index, int * nmappings, _SMmap * mappings, } mappings[mapIx].obj = mapping; + /* Save object list reference */ + if(mapping != NULL) + { + mappings[mapIx].objectlistitem = &SDOobjects[nidx]; + } + else + { + mappings[mapIx].objectlistitem = NULL; + } mappings[mapIx++].offset = offset; } diff --git a/soes/esc_coe.h b/soes/esc_coe.h index 109cb5f..4ba8b87 100644 --- a/soes/esc_coe.h +++ b/soes/esc_coe.h @@ -40,6 +40,7 @@ typedef struct typedef struct { const _objd * obj; + const _objectlist * objectlistitem; uint16_t offset; } _SMmap;