Dear DevZone community,
I'm developing a Mesh application using nRF52840 Segger Embedded Studio (SES) onLinux. I'm using version 5.0.0 of the Mesh SDK. As desccribed in the Subject, i am trying to figure out how to set the #defines #define ACCESS_ELEMENT_COUNT and #define ACCESS_MODEL_COUNT in file nrf_mesh_config_app.h druing run-time and not compile time.
The point is, that depending on the room the model amount as well as the element amount will differ and since the room is set during run-time, i have to set those two defines during run-time.
When i set this to #defines in that way:
#define ACCESS_MODEL_COUNT_LIVING_ROOM (30) #define ACCESS_MODEL_COUNT_KITCHEN (5) #define ACCESS_MODEL_COUNT_BED_ROOM (8) #define ACCESS_ELEMENT_COUNT_LIVING_ROOM (30) #define ACCESS_ELEMENT_COUNT_KITCHEN (5) #define ACCESS_ELEMENT_COUNT_BED_ROOM (8) #define ACCESS_MODEL_COUNT ((room == LIVING_ROOM) ? (ACCESS_MODEL_COUNT_LIVING_ROOM) : \ ((room == KITCHEN) ? (ACCESS_MODEL_COUNT_KITCHEN) : (ACCESS_MODEL_COUNT_BED_ROOM))) #define ACCESS_ELEMENT_COUNT ((room == LIVING_ROOM) ? (ACCESS_ELEMENT_COUNT_LIVING_ROOM) : \ ((room == KITCHEN) ? (ACCESS_ELEMENT_COUNT_KITCHEN) : (ACCESS_ELEMENT_COUNT_BED_ROOM)))
I get always follwoing error message as soon as i compile it:
expression in static assertion is not constant
in following static_assert:
/** The composition data must fit within the Composition Data Status packet. If this assert fails, * there are too many models or too many elements defined. Note that the macro assumes all models to be vendor models. */ NRF_MESH_STATIC_ASSERT(CONFIG_COMPOSITION_DATA_SIZE <= (ACCESS_MESSAGE_LENGTH_MAX - ACCESS_UTILS_SIG_OPCODE_SIZE(CONFIG_OPCODE_COMPOSITION_DATA_STATUS) - sizeof(config_msg_composition_data_status_t)));
So my question is, is it possible to set it druing run-time? Is there a workoaround to overcome this problem?
Thanks in advance.
Rgerads,
MKarl