Hi,
I have a project where we want to setup 3 PWM channels for dimming LED strings in a mesh configuration. So the mesh dimming server is a perfect starting point. I did run into a few issues that I "fixed" but I don't really now what other implications that might have.
-#define ACCESS_MODEL_COUNT (3) +#define ACCESS_MODEL_COUNT (ACCESS_ELEMENT_COUNT + 2) -#define ACCESS_ELEMENT_COUNT (1) +#define ACCESS_ELEMENT_COUNT (3) -#define DSM_APP_MAX (8) +#define DSM_APP_MAX (4) -#define DSM_VIRTUAL_ADDR_MAX (2) +#define DSM_VIRTUAL_ADDR_MAX (10) -#define DSM_NONVIRTUAL_ADDR_MAX (3) +#define DSM_NONVIRTUAL_ADDR_MAX (10)
I might have overdone some but at least it worked.
Adding the extra servers and PWM channels to the main.c was pretty straight forward, not gonna quote it here. Now comes the hairy stuff: whenever the Mesh App arrived at "sending provisioning data..." the firmware conked out with error 5 (something not found). It turns out the culprit was the ACCESS_INTERNAL_STATE_ALLOCATED in access.c . Whenever loading config from flash failed, it will be reset to 0 resulting in the error 5. So I modified mesh_stack.c:
- access_clear(); + //access_clear();
That solves it but with what side effect?
Next I figured even though my node now worked that the mesh configuration doesn't get stored (or better, not reloaded at boot) Thats because the metadata still contained the old values of ACCESS_MODEL_COUNT etc. So I did modification to device_state_manager.c and access.c
if (!!m_status.is_load_failed) { + metadata_store(); return NRF_ERROR_INVALID_DATA; }
So if you can't load it, overwrite with something valid. That solved the problem. Again: with what side effect?