Timer triggers lighness setup server set_cb and set value to 6%

I have an issue with the Lightness setup server set cb being triggered without a connected device and is not internally called in my code. Yet for some reason the set cb is triggered every time my timer and the value is set to 6%.<br>
The idee behind the timer is to set the lightness to 100% and repeat this every 500ms for 10s.<br> The value is reset to the 6% every time. Could someone explain why?
Here is the code:<br>
The defines for the timer
```
/*The interval for the timer instance. */
#define INTERVAL_MS 500

/* The total duration of the timer instance. */
#define TOTAL_DURATION_MS 10000

/* The amount the timer will be reset. */
#define CALL_COUNT (TOTAL_DURATION_MS / INTERVAL_MS)
```
The timer instance
```
/**
* @brief The timer used at the start to set the dali to 254 and send the signal.
*/
APP_TIMER_DEF(m_start_timer);
```
The forward declaration of the functions
```
/*****************************************************************************
* Forward declaration of static functions
*****************************************************************************/
static void mesh_events_handle(const nrf_mesh_evt_t * p_evt);
static void light_ctl_set_cb(const app_light_ctl_setup_server_t * p_app, app_light_ctl_temperature_duv_hw_state_t * present_ctl_state);
static void light_ctl_get_cb(const app_light_ctl_setup_server_t * p_app, app_light_ctl_temperature_duv_hw_state_t * present_ctl_state);
static void ligth_ctl_transition_cb(const app_light_ctl_setup_server_t * p_server,
uint32_t transition_time_ms,
app_light_ctl_temperature_duv_hw_state_t target_ctl_state);
static void light_ctl_lightness_set_cb(const app_light_lightness_setup_server_t * p_app, uint16_t lightness);
static void light_ctl_lightness_get_cb(const app_light_lightness_setup_server_t * p_app, uint16_t * p_lightness);
static void temperature32_range_listener_cb(mesh_config_change_reason_t reason,
mesh_config_entry_id_t id,
const void * p_entry);
static void light_ctl_lightness_transition_cb(const app_light_lightness_setup_server_t * p_server,
uint32_t transition_time_ms, uint16_t target_lightness);
```
The setup:
```
/* CTL Setup Server and associated model structures' definition and initialization */
APP_LIGHT_CTL_SETUP_SERVER_DEF(m_light_ctl_server_0,
APP_FORCE_SEGMENTATION,
APP_MIC_SIZE,
light_ctl_set_cb,
light_ctl_get_cb,
ligth_ctl_transition_cb)
APP_LIGHT_LIGHTNESS_SETUP_SERVER_DEF(m_light_ctl_server_0_ll,
APP_FORCE_SEGMENTATION,
APP_MIC_SIZE,
light_ctl_lightness_set_cb,
light_ctl_lightness_get_cb,
light_ctl_lightness_transition_cb)
APP_LIGHT_LC_SETUP_SERVER_DEF(m_light_ctl_server_0_lc,
APP_FORCE_SEGMENTATION,
APP_MIC_SIZE)

/* Application variables for holding instantaneous CTL state values */
static app_light_ctl_temperature_duv_hw_state_t m_pwm0_present_ctl_value;
static uint16_t m_pwm0_present_actual_lightness;
```
The timer functions:
```
// App logic function (for timer, etc.)
static void set_actual_lightness_internal(uint16_t lightness)
{
// Modify ONLY the app-side variable and hardware
m_pwm0_present_actual_lightness = lightness;
}

void start_timer_timeout_handler(void * p_context) {
uint16_t internal_brightness = 0xFFFF;
set_actual_lightness_internal(internal_brightness);

__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "The timer current lightness = %d\n", m_pwm0_present_actual_lightness);
uint8_t requested_dali = m_pwm0_present_actual_lightness / 257;
dali_broadcast_level(requested_dali);
start_timer_calls++;
if (start_timer_calls >= CALL_COUNT) {
app_timer_stop(m_start_timer);
}
}

void start_timer_init(void) {
ret_code_t err_code;

APP_ERROR_CHECK(err_code);

// Create timer (repeated mode)
err_code = app_timer_create(&m_start_timer,
APP_TIMER_MODE_REPEATED,
start_timer_timeout_handler);
APP_ERROR_CHECK(err_code);

// Start timer
err_code = app_timer_start(m_start_timer, APP_TIMER_TICKS(INTERVAL_MS), NULL);
APP_ERROR_CHECK(err_code);
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Start timer started\n");
}
```
The mesh functions:
```
static void pwm_lightness_ctemp_duv_set(uint16_t lightness, uint16_t temperature, int16_t delta_uv)
{
/* Tunable white light demonstration is shown using two LEDs on the DK board. Assume that the
* LED1 represents a warm white light element, and the LED2 represents a cool white light
* element. These two LEDs are turned on with different PWM duty cycles corresponding to the
* given color temperature. Also, the overall light output is scaled by the given lightness
* level to achieve dimming.
*
* The photometrically accurate implementation of the tunable white light is out of scope of
* this example.
*/

uint32_t warm_factor;
uint16_t warm_level;
uint16_t cool_level;

if (m_range_max >= m_range_min && m_range_max >= temperature)
{
warm_factor = (m_range_max - temperature) * SCALE_FACTOR / (APP_TEMPERATURE_MAX - APP_TEMPERATURE_MIN);

warm_level = (uint16_t)((uint32_t)lightness * warm_factor / SCALE_FACTOR);
cool_level = (uint16_t)((uint32_t)lightness * (SCALE_FACTOR - warm_factor) / SCALE_FACTOR);

__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "warm: %05d cool: %05d duv: %05d (unused)\n",
warm_level, cool_level, delta_uv);

m_pwm.channel = 0;
(void)pwm_utils_level_set_unsigned(&m_pwm, warm_level);
m_pwm.channel = 1;
(void)pwm_utils_level_set_unsigned(&m_pwm, cool_level);
}
else
{
__LOG(LOG_SRC_APP, LOG_LEVEL_ERROR,
"Invalid inputs: range_max: %d range_min: %d temperature: %d\n",
m_range_max, m_range_min, temperature);
}
}

/* Callback for updating the hardware state */
static void light_ctl_set_cb(const app_light_ctl_setup_server_t * p_app,
app_light_ctl_temperature_duv_hw_state_t * p_present_ctl_state)
{
m_pwm0_present_ctl_value = *p_present_ctl_state;
pwm_lightness_ctemp_duv_set(m_pwm0_present_actual_lightness,
light_ctl_utils_temperature32_to_temperature(m_pwm0_present_ctl_value.temperature32),
m_pwm0_present_ctl_value.delta_uv);
}

/* Callback for reading the hardware state */
static void light_ctl_get_cb(const app_light_ctl_setup_server_t * p_app,
app_light_ctl_temperature_duv_hw_state_t * p_present_ctl_state)
{
p_present_ctl_state->temperature32 = m_pwm0_present_ctl_value.temperature32;
p_present_ctl_state->delta_uv = m_pwm0_present_ctl_value.delta_uv;
}

/* Callback for receiving transition time. */
static void ligth_ctl_transition_cb(const app_light_ctl_setup_server_t * p_server,
uint32_t transition_time_ms,
app_light_ctl_temperature_duv_hw_state_t target_ctl_state)
{
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Transition time: %d, Target temperature: %d, Target delta_uv: %d\n",
transition_time_ms, light_ctl_utils_temperature32_to_temperature(target_ctl_state.temperature32),
target_ctl_state.delta_uv);
}

/* Callback for updating the hardware state for lightness */
static void light_ctl_lightness_set_cb(const app_light_lightness_setup_server_t * p_app, uint16_t lightness)
{

__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "light_ctl_lightness_set_cb called with lightness: %d\n", lightness);
m_pwm0_present_actual_lightness = lightness;
uint8_t requested_dali = m_pwm0_present_actual_lightness / 257;
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "cb actual lightness = %d , dali = %d\n",m_pwm0_present_actual_lightness, requested_dali);

pwm_lightness_ctemp_duv_set(m_pwm0_present_actual_lightness,
light_ctl_utils_temperature32_to_temperature(m_pwm0_present_ctl_value.temperature32),
m_pwm0_present_ctl_value.delta_uv);

dali_broadcast_level(requested_dali);
}

/* Callback for reading the hardware state */
static void light_ctl_lightness_get_cb(const app_light_lightness_setup_server_t * p_app, uint16_t * p_lightness)
{
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "The current lightness = %d\n", m_pwm0_present_actual_lightness);
*p_lightness = m_pwm0_present_actual_lightness;
}

/* Callback for receiveing transition time. */
static void light_ctl_lightness_transition_cb(const app_light_lightness_setup_server_t * p_server,
uint32_t transition_time_ms, uint16_t target_lightness)
{
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Transition time: %d, Target lightness: %d\n",
transition_time_ms, target_lightness);
}

static void models_init_cb(void)
{
/* Initialize the CTL Setup Server and associated models */
/* Initialize the Light Lightness Setup Server - the CTL main element is shared with light lightness */
APP_ERROR_CHECK(app_light_lightness_model_init(&m_light_ctl_server_0_ll, APP_CTL_ELEMENT_INDEX));
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "App Light Lightness Model handle: %d, Element index: %d\n",
m_light_ctl_server_0_ll.light_lightness_setup_server.model_handle,
m_light_ctl_server_0_ll.light_lightness_setup_server.settings.element_index);
/* Initialize the CTL Setup Server */
APP_ERROR_CHECK(app_light_ctl_model_init(&m_light_ctl_server_0, APP_CTL_ELEMENT_INDEX, &m_light_ctl_server_0_ll));
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "App CTL Model Handle: %d, Element index: %d\n",
m_light_ctl_server_0.light_ctl_setup_srv.model_handle,
m_light_ctl_server_0.light_ctl_setup_srv.settings.element_index);
/* Initialize the LC server */
APP_ERROR_CHECK(app_light_lc_model_init(&m_light_ctl_server_0_lc, APP_LC_ELEMENT_INDEX, &m_light_ctl_server_0_ll));
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "App LC (%d, %d) = (Model Handle, element index)\n",
m_light_ctl_server_0_lc.light_lc_setup_srv.model_handle,
m_light_ctl_server_0_lc.light_lc_setup_srv.settings.element_index);
}


static void mesh_init(void)
{
/* Initialize the application storage for models */
model_config_file_init();

mesh_stack_init_params_t init_params =
{
.core.irq_priority = NRF_MESH_IRQ_PRIORITY_LOWEST,
.core.lfclksrc = DEV_BOARD_LF_CLK_CFG,
.core.p_uuid = NULL,
.models.models_init_cb = models_init_cb,
.models.config_server_cb = config_server_evt_cb
};

uint32_t status = mesh_stack_init(&init_params, &m_device_provisioned);

if (status == NRF_SUCCESS)
{
/* Check if application stored data is valid, if not clear all data and use default values. */
status = model_config_file_config_apply();
}

switch (status)
{
case NRF_ERROR_INVALID_DATA:
/* Clear model config file as loading failed */
model_config_file_clear();
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO,
"Data in the persistent memory was corrupted. Device starts as unprovisioned.\n");
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Reboot device before starting of the provisioning process.\n");
break;
case NRF_SUCCESS:
break;
default:
APP_ERROR_CHECK(status);
}
}


```

```

static void initialize(void)
{
__LOG_INIT(LOG_SRC_APP | LOG_SRC_ACCESS, LOG_LEVEL_INFO, LOG_CALLBACK_DEFAULT);
clear_persistent_storage();

pwm_utils_enable(&m_pwm);
APP_ERROR_CHECK(app_timer_init());
reset_input_init();
led_output_init();
ble_stack_init();

#if MESH_FEATURE_GATT_ENABLED
gap_params_init();
conn_params_init();
#endif

mesh_init();

dali_init(ELLAGE_H4T_DALI_RX, ELLAGE_H4T_DALI_TX);
__enable_irq();
start_timer_init();

APP_ERROR_CHECK(app_timer_create(&m_identify_timer, APP_TIMER_MODE_SINGLE_SHOT, identify_timeout_handler));
}
```

The log:
```
<t: 0>, pwm_utils.c, 88, PWM max ticks: 1600
<t: 546>, main.c, 341, App Light Lightness Model handle: 8, Element index: 0
<t: 555>, main.c, 346, App CTL Model Handle: 12, Element index: 0
<t: 560>, main.c, 351, App LC (15, 0) = (Model Handle, element index)
<t: 591>, main.c, 237, Start timer started
<t: 5392>, mesh_app_utils.c, 66, Device UUID (raw): 294F2C39CE374D99B9C620D42C1E0B36
<t: 5395>, mesh_app_utils.c, 67, Device UUID : 294F2C39-CE37-4D99-B9C6-20D42C1E0B36
<t: 5518>, main.c, 312, actual lightness = 0, dali = 0
<t: 5521>, main.c, 263, warm: 00000 cool: 00000 duv: 00000 (unused)
<t: 5557>, main.c, 332, Transition time: 0, Target lightness: 0
<t: 5568>, light_lc_setup_server.c, 822, LC FSM ON
<t: 5582>, light_lc_fsm.c, 995, mode status publish failed 7
<t: 5615>, app_light_ctl.c, 384, Temp SET: target temperature: 20000 duv: 0, delay: 0 tt: 0 req-delta: 20000
<t: 5620>, app_light_ctl.c, 976, Element 0: transition completed
<t: 5624>, main.c, 263, warm: 00000 cool: 00000 duv: 00000 (unused)
<t: 5627>, main.c, 302, Transition time: 0, Target temperature: 20000, Target delta_uv: 0
<t: 5644>, main.c, 324, The current lightness = 0
<t: 8847>, main.c, 324, The current lightness = 0
<t: 8854>, main.c, 312, actual lightness = 4103, dali = 15
<t: 8857>, main.c, 263, warm: 00000 cool: 04103 duv: 00000 (unused)
<t: 8893>, main.c, 332, Transition time: 0, Target lightness: 4103
<t: 12188>, main.c, 324, The current lightness = 4103
<t: 15469>, main.c, 324, The current lightness = 4103
<t: 16975>, main.c, 214, The timer current lightness = 65535
<t: 18750>, main.c, 324, The current lightness = 65535
<t: 18757>, main.c, 312, actual lightness = 4103, dali = 15
<t: 18763>, main.c, 263, warm: 00000 cool: 04103 duv: 00000 (unused)
<t: 18800>, main.c, 332, Transition time: 0, Target lightness: 4103
<t: 22095>, main.c, 324, The current lightness = 4103
<t: 25376>, main.c, 324, The current lightness = 4103
<t: 28657>, main.c, 324, The current lightness = 4103
<t: 31938>, main.c, 324, The current lightness = 4103
<t: 33359>, main.c, 214, The timer current lightness = 65535
<t: 35219>, main.c, 324, The current lightness = 65535
<t: 35226>, main.c, 312, actual lightness = 4103, dali = 15
<t: 35229>, main.c, 263, warm: 00000 cool: 04103 duv: 00000 (unused)
<t: 35266>, main.c, 332, Transition time: 0, Target lightness: 4103
<t: 38561>, main.c, 324, The current lightness = 4103
<t: 41842>, main.c, 324, The current lightness = 4103
<t: 45123>, main.c, 324, The current lightness = 4103
<t: 48404>, main.c, 324, The current lightness = 4103
<t: 49743>, main.c, 214, The timer current lightness = 65535
<t: 51685>, main.c, 324, The current lightness = 65535
<t: 51692>, main.c, 312, actual lightness = 4103, dali = 15
<t: 51695>, main.c, 263, warm: 00000 cool: 04103 duv: 00000 (unused)
<t: 51732>, main.c, 332, Transition time: 0, Target lightness: 4103
<t: 55027>, main.c, 324, The current lightness = 4103
<t: 58308>, main.c, 324, The current lightness = 4103
<t: 61589>, main.c, 324, The current lightness = 4103
<t: 64870>, main.c, 324, The current lightness = 4103
<t: 66127>, main.c, 214, The timer current lightness = 65535
<t: 68151>, main.c, 324, The current lightness = 65535
<t: 68158>, main.c, 312, actual lightness = 4103, dali = 15
<t: 68161>, main.c, 263, warm: 00000 cool: 04103 duv: 00000 (unused)
<t: 68198>, main.c, 332, Transition time: 0, Target lightness: 4103
<t: 71493>, main.c, 324, The current lightness = 4103
<t: 74774>, main.c, 324, The current lightness = 4103
<t: 78055>, main.c, 324, The current lightness = 4103
<t: 81336>, main.c, 324, The current lightness = 4103
<t: 82511>, main.c, 214, The timer current lightness = 65535
<t: 84617>, main.c, 324, The current lightness = 65535
<t: 84624>, main.c, 312, actual lightness = 4103, dali = 15
<t: 84627>, main.c, 263, warm: 00000 cool: 04103 duv: 00000 (unused)
<t: 84664>, main.c, 332, Transition time: 0, Target lightness: 4103
<t: 87959>, main.c, 324, The current lightness = 4103
<t: 91240>, main.c, 324, The current lightness = 4103
<t: 94521>, main.c, 324, The current lightness = 4103
<t: 97802>, main.c, 324, The current lightness = 4103
<t: 98895>, main.c, 214, The timer current lightness = 65535
<t: 101083>, main.c, 324, The current lightness = 65535
<t: 101090>, main.c, 312, actual lightness = 4103, dali = 15
<t: 101093>, main.c, 263, warm: 00000 cool: 04103 duv: 00000 (unused)
<t: 101130>, main.c, 332, Transition time: 0, Target lightness: 4103
<t: 104425>, main.c, 324, The current lightness = 4103
<t: 107706>, main.c, 324, The current lightness = 4103
<t: 110987>, main.c, 324, The current lightness = 4103
<t: 114268>, main.c, 324, The current lightness = 4103
<t: 115279>, main.c, 214, The timer current lightness = 65535
<t: 117549>, main.c, 324, The current lightness = 65535
<t: 117556>, main.c, 312, actual lightness = 4103, dali = 15
<t: 117559>, main.c, 263, warm: 00000 cool: 04103 duv: 00000 (unused)
<t: 117596>, main.c, 332, Transition time: 0, Target lightness: 4103
<t: 120891>, main.c, 324, The current lightness = 4103
<t: 124172>, main.c, 324, The current lightness = 4103
<t: 127453>, main.c, 324, The current lightness = 4103
<t: 130734>, main.c, 324, The current lightness = 4103
<t: 131663>, main.c, 214, The timer current lightness = 65535
<t: 134015>, main.c, 324, The current lightness = 65535
<t: 134022>, main.c, 312, actual lightness = 4103, dali = 15
<t: 134025>, main.c, 263, warm: 00000 cool: 04103 duv: 00000 (unused)
<t: 134062>, main.c, 332, Transition time: 0, Target lightness: 4103
<t: 137357>, main.c, 324, The current lightness = 4103
<t: 140638>, main.c, 324, The current lightness = 4103
<t: 143919>, main.c, 324, The current lightness = 4103
<t: 147200>, main.c, 324, The current lightness = 4103
<t: 148047>, main.c, 214, The timer current lightness = 65535
<t: 150481>, main.c, 324, The current lightness = 65535
<t: 150488>, main.c, 312, actual lightness = 4103, dali = 15
<t: 150491>, main.c, 263, warm: 00000 cool: 04103 duv: 00000 (unused)
<t: 150528>, main.c, 332, Transition time: 0, Target lightness: 4103
<t: 153823>, main.c, 324, The current lightness = 4103
<t: 157104>, main.c, 324, The current lightness = 4103
<t: 160385>, main.c, 324, The current lightness = 4103
<t: 163666>, main.c, 324, The current lightness = 4103
<t: 164431>, main.c, 214, The timer current lightness = 65535
<t: 166948>, main.c, 324, The current lightness = 65535
<t: 166956>, main.c, 312, actual lightness = 4103, dali = 15
<t: 166958>, main.c, 263, warm: 00000 cool: 04103 duv: 00000 (unused)
<t: 166995>, main.c, 332, Transition time: 0, Target lightness: 4103
<t: 170290>, main.c, 324, The current lightness = 4103
<t: 173571>, main.c, 324, The current lightness = 4103
<t: 176852>, main.c, 324, The current lightness = 4103
<t: 180133>, main.c, 324, The current lightness = 4103
<t: 180815>, main.c, 214, The timer current lightness = 65535
<t: 183414>, main.c, 324, The current lightness = 65535
<t: 183421>, main.c, 312, actual lightness = 4103, dali = 15
<t: 183424>, main.c, 263, warm: 00000 cool: 04103 duv: 00000 (unused)
<t: 183461>, main.c, 332, Transition time: 0, Target lightness: 4103
<t: 186756>, main.c, 324, The current lightness = 4103
<t: 190037>, main.c, 324, The current lightness = 4103
<t: 193318>, main.c, 324, The current lightness = 4103
<t: 196599>, main.c, 324, The current lightness = 4103
<t: 197199>, main.c, 214, The timer current lightness = 65535
<t: 199880>, main.c, 324, The current lightness = 65535
<t: 199887>, main.c, 312, actual lightness = 4103, dali = 15
<t: 199891>, main.c, 263, warm: 00000 cool: 04103 duv: 00000 (unused)
<t: 199927>, main.c, 332, Transition time: 0, Target lightness: 4103
<t: 203222>, main.c, 324, The current lightness = 4103
<t: 206503>, main.c, 324, The current lightness = 4103
<t: 209784>, main.c, 324, The current lightness = 4103
<t: 213065>, main.c, 324, The current lightness = 4103
<t: 213583>, main.c, 214, The timer current lightness = 65535
<t: 216346>, main.c, 324, The current lightness = 65535
<t: 216353>, main.c, 312, actual lightness = 4103, dali = 15
<t: 216356>, main.c, 263, warm: 00000 cool: 04103 duv: 00000 (unused)
<t: 216393>, main.c, 332, Transition time: 0, Target lightness: 4103
<t: 219688>, main.c, 324, The current lightness = 4103
<t: 222969>, main.c, 324, The current lightness = 4103
<t: 226250>, main.c, 324, The current lightness = 4103
<t: 229531>, main.c, 324, The current lightness = 4103
<t: 229967>, main.c, 214, The timer current lightness = 65535
<t: 232812>, main.c, 324, The current lightness = 65535
<t: 232819>, main.c, 312, actual lightness = 4103, dali = 15
<t: 232822>, main.c, 263, warm: 00000 cool: 04103 duv: 00000 (unused)
<t: 232859>, main.c, 332, Transition time: 0, Target lightness: 4103
<t: 236154>, main.c, 324, The current lightness = 4103
<t: 239435>, main.c, 324, The current lightness = 4103
<t: 242716>, main.c, 324, The current lightness = 4103
<t: 245997>, main.c, 324, The current lightness = 4103
<t: 246351>, main.c, 214, The timer current lightness = 65535
<t: 249278>, main.c, 324, The current lightness = 65535
<t: 249285>, main.c, 312, actual lightness = 4103, dali = 15
<t: 249288>, main.c, 263, warm: 00000 cool: 04103 duv: 00000 (unused)
<t: 249325>, main.c, 332, Transition time: 0, Target lightness: 4103
<t: 252620>, main.c, 324, The current lightness = 4103
<t: 255901>, main.c, 324, The current lightness = 4103
<t: 259182>, main.c, 324, The current lightness = 4103
<t: 262463>, main.c, 324, The current lightness = 4103
<t: 262735>, main.c, 214, The timer current lightness = 65535
<t: 265744>, main.c, 324, The current lightness = 65535
<t: 265751>, main.c, 312, actual lightness = 4103, dali = 15
<t: 265754>, main.c, 263, warm: 00000 cool: 04103 duv: 00000 (unused)
<t: 265791>, main.c, 332, Transition time: 0, Target lightness: 4103
<t: 269086>, main.c, 324, The current lightness = 4103
<t: 272367>, main.c, 324, The current lightness = 4103
<t: 275648>, main.c, 324, The current lightness = 4103
<t: 278929>, main.c, 324, The current lightness = 4103
<t: 279119>, main.c, 214, The timer current lightness = 65535
<t: 282210>, main.c, 324, The current lightness = 65535
<t: 282217>, main.c, 312, actual lightness = 4103, dali = 15
<t: 282220>, main.c, 263, warm: 00000 cool: 04103 duv: 00000 (unused)
<t: 282257>, main.c, 332, Transition time: 0, Target lightness: 4103
<t: 285552>, main.c, 324, The current lightness = 4103
<t: 288833>, main.c, 324, The current lightness = 4103
<t: 292114>, main.c, 324, The current lightness = 4103
<t: 295395>, main.c, 324, The current lightness = 4103
<t: 295503>, main.c, 214, The timer current lightness = 65535
<t: 298676>, main.c, 324, The current lightness = 65535
<t: 298683>, main.c, 312, actual lightness = 4103, dali = 15
<t: 298686>, main.c, 263, warm: 00000 cool: 04103 duv: 00000 (unused)
<t: 298723>, main.c, 332, Transition time: 0, Target lightness: 4103
```

Parents
  • Hi,

    This might be a long shot, but if you see issues with the variable m_pwm0_present_actual_lightness getting changed in one callback function is not reflected in another callback function, then that might have to do with optimization. In particular, if a variable is accessed from different contexts, from different interrupt levels, they should typically be declared volatile, e.g. "static volatile uint16_t m_pwm0_present_actual_lightness;". Without this, the value of the variable is assumed to not be changed from other contexts, and optimization may keep the variable in a CPU register rather than actually read and write it from and to RAM for every access. I do not quite see why this should matter in this instance, though, so the issue that you see might be something completely different.

    I do see that the log output doesn't quite match the code. For instance, the log message "actual lightness = 4103, dali = 15" should have started with "cb actual lightness" according to your code excerpts. Since the code has changed before or after the session resulting in the log, it is difficult to provide further feedback (has anything else changed as well?) But: The 6 % seems to come from some calculation on providing the "cool" level, and that level somehow seems to end up in m_pwm0_present_actual_lightness. Might something be happening in the function pwm_utils_level_set_unsigned(), which you have not shared the code for?

    Regards,
    Terje

  • Hello

    Changing m_pwm0_present_actual_lightness i just need it to do to 100% from the start

    When i connect i can change the value and i stays on the value but when i do it in the timer function it fails.

    I have not yet changed it to static volatile uin16_t.

    The m_pwm0_present_actual_lightness is from the pwm_utils here is the funciton.

    ```

    uint32_t pwm_utils_level_set_unsigned(pwm_utils_contex_t * p_ctx, uint16_t level)
    {
    /* The pwm peripheral is enabled. */
    NRF_MESH_ASSERT(p_ctx->pwm_ticks_max);
    return (app_pwm_channel_duty_ticks_set(p_ctx->p_pwm, p_ctx->channel, pwm_unsigned_level_to_ticks(p_ctx, level)));
    }

    ```

    Yes the 6% comes from the a calculation it seems i just do not understand why its doing this.

    Best regards

    Dries

  • Hi,

    Right, so the 6%, I assume you then refer to the value 4103, since 4106 / 25536 = 0.0626..., which is close to 6%.

    I do see that the value appears first in the following log lines:

    <t: 8854>, main.c, 312, actual lightness = 4103, dali = 15
    <t: 8857>, main.c, 263, warm: 00000 cool: 04103 duv: 00000 (unused)
    <t: 8893>, main.c, 332, Transition time: 0, Target lightness: 4103
    <t: 12188>, main.c, 324, The current lightness = 4103

    After that, the value is shortly 65535, before you get back to the lines above again.
    Thus, code running before and after the log lines above, would be good places to look for when the value changes (and why/how).
    Have you done a debug session, trying to pinpoint where that is?
    One place to start, would for instance be to watch m_pwm0_present_actual_lightness.

    Regards,
    Terje

Reply
  • Hi,

    Right, so the 6%, I assume you then refer to the value 4103, since 4106 / 25536 = 0.0626..., which is close to 6%.

    I do see that the value appears first in the following log lines:

    <t: 8854>, main.c, 312, actual lightness = 4103, dali = 15
    <t: 8857>, main.c, 263, warm: 00000 cool: 04103 duv: 00000 (unused)
    <t: 8893>, main.c, 332, Transition time: 0, Target lightness: 4103
    <t: 12188>, main.c, 324, The current lightness = 4103

    After that, the value is shortly 65535, before you get back to the lines above again.
    Thus, code running before and after the log lines above, would be good places to look for when the value changes (and why/how).
    Have you done a debug session, trying to pinpoint where that is?
    One place to start, would for instance be to watch m_pwm0_present_actual_lightness.

    Regards,
    Terje

Children
No Data
Related