Skip to content
Permalink
Browse files

samples: mesh: removed bugs in on-off transition

If Node Lightness is in downward transition & received Generic
onoff message to set state equal to 1 then Node transaction get
stopped in between. Ideally it should reach to default lightness
value if it is non-zero. This commit has solved this bug.

Signed-off-by: Vikrant More <vikrant8051@gmail.com>
  • Loading branch information...
vikrant8051 authored and jhedberg committed May 9, 2019
1 parent 2430443 commit 4835c0f2019433835ba233f411edd3980c945b57
@@ -213,8 +213,13 @@ static void gen_onoff_set_unack(struct bt_mesh_model *model,
if (state->target_onoff != state->onoff) {
onoff_tt_values(state);
} else {
gen_onoff_publish(model);
return;
if (lightness != light_lightness_srv_user_data.def &&
state->onoff == STATE_ON) {
onoff_tt_values(state);
} else {
gen_onoff_publish(model);
return;
}
}

/* For Instantaneous Transition */
@@ -282,9 +287,14 @@ static void gen_onoff_set(struct bt_mesh_model *model,
if (state->target_onoff != state->onoff) {
onoff_tt_values(state);
} else {
gen_onoff_get(model, ctx, buf);
gen_onoff_publish(model);
return;
if (lightness != light_lightness_srv_user_data.def &&
state->onoff == STATE_ON) {
onoff_tt_values(state);
} else {
gen_onoff_get(model, ctx, buf);
gen_onoff_publish(model);
return;
}
}

/* For Instantaneous Transition */
@@ -2149,6 +2159,8 @@ static bool light_ctl_default_setunack(struct bt_mesh_model *model,
state->temp_def = temp;
state->delta_uv_def = delta_uv;

light_lightness_srv_user_data.def = lightness;

save_on_flash(LIGHTNESS_TEMP_DEF_STATE);
}

0 comments on commit 4835c0f

Please sign in to comment.
You can’t perform that action at this time.