samples: mesh: nrf52: considered delay even in case of inst. transition
User can set transition time as Zero & delay as non-zero value. In that case, we have to depend upon timer. Signed-off-by: Vikrant More <vikrant8051@gmail.com>
This commit is contained in:
parent
21e0d48750
commit
aab640698b
@ -158,7 +158,14 @@ static void onoff_work_handler(struct k_work *work)
|
||||
{
|
||||
if (ctl->transition->just_started) {
|
||||
ctl->transition->just_started = false;
|
||||
ctl->transition->start_timestamp = k_uptime_get();
|
||||
|
||||
if (ctl->transition->counter == 0U) {
|
||||
update_light_state();
|
||||
k_timer_stop(&ctl->transition->timer);
|
||||
} else {
|
||||
ctl->transition->start_timestamp = k_uptime_get();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -191,7 +198,14 @@ static void level_lightness_work_handler(struct k_work *work)
|
||||
{
|
||||
if (ctl->transition->just_started) {
|
||||
ctl->transition->just_started = false;
|
||||
ctl->transition->start_timestamp = k_uptime_get();
|
||||
|
||||
if (ctl->transition->counter == 0U) {
|
||||
update_light_state();
|
||||
k_timer_stop(&ctl->transition->timer);
|
||||
} else {
|
||||
ctl->transition->start_timestamp = k_uptime_get();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -229,7 +243,14 @@ static void level_temp_work_handler(struct k_work *work)
|
||||
{
|
||||
if (ctl->transition->just_started) {
|
||||
ctl->transition->just_started = false;
|
||||
ctl->transition->start_timestamp = k_uptime_get();
|
||||
|
||||
if (ctl->transition->counter == 0U) {
|
||||
update_light_state();
|
||||
k_timer_stop(&ctl->transition->timer);
|
||||
} else {
|
||||
ctl->transition->start_timestamp = k_uptime_get();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -257,7 +278,14 @@ static void light_lightness_actual_work_handler(struct k_work *work)
|
||||
{
|
||||
if (ctl->transition->just_started) {
|
||||
ctl->transition->just_started = false;
|
||||
ctl->transition->start_timestamp = k_uptime_get();
|
||||
|
||||
if (ctl->transition->counter == 0U) {
|
||||
update_light_state();
|
||||
k_timer_stop(&ctl->transition->timer);
|
||||
} else {
|
||||
ctl->transition->start_timestamp = k_uptime_get();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -280,7 +308,14 @@ static void light_lightness_linear_work_handler(struct k_work *work)
|
||||
{
|
||||
if (ctl->transition->just_started) {
|
||||
ctl->transition->just_started = false;
|
||||
ctl->transition->start_timestamp = k_uptime_get();
|
||||
|
||||
if (ctl->transition->counter == 0U) {
|
||||
update_light_state();
|
||||
k_timer_stop(&ctl->transition->timer);
|
||||
} else {
|
||||
ctl->transition->start_timestamp = k_uptime_get();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -303,7 +338,14 @@ static void light_ctl_work_handler(struct k_work *work)
|
||||
{
|
||||
if (ctl->transition->just_started) {
|
||||
ctl->transition->just_started = false;
|
||||
ctl->transition->start_timestamp = k_uptime_get();
|
||||
|
||||
if (ctl->transition->counter == 0U) {
|
||||
update_light_state();
|
||||
k_timer_stop(&ctl->transition->timer);
|
||||
} else {
|
||||
ctl->transition->start_timestamp = k_uptime_get();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -333,7 +375,14 @@ static void light_ctl_temp_work_handler(struct k_work *work)
|
||||
{
|
||||
if (ctl->transition->just_started) {
|
||||
ctl->transition->just_started = false;
|
||||
ctl->transition->start_timestamp = k_uptime_get();
|
||||
|
||||
if (ctl->transition->counter == 0U) {
|
||||
update_light_state();
|
||||
k_timer_stop(&ctl->transition->timer);
|
||||
} else {
|
||||
ctl->transition->start_timestamp = k_uptime_get();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -405,7 +454,7 @@ K_TIMER_DEFINE(dummy_timer, NULL, NULL);
|
||||
/* Messages handlers (Start) */
|
||||
void onoff_handler(struct light_ctl_state *state)
|
||||
{
|
||||
if (state->transition->counter == 0U) {
|
||||
if (state->transition->counter == 0U && state->transition->delay == 0) {
|
||||
update_light_state();
|
||||
return;
|
||||
}
|
||||
@ -419,7 +468,7 @@ void onoff_handler(struct light_ctl_state *state)
|
||||
|
||||
void level_lightness_handler(struct light_ctl_state *state)
|
||||
{
|
||||
if (state->transition->counter == 0U) {
|
||||
if (state->transition->counter == 0U && state->transition->delay == 0) {
|
||||
update_light_state();
|
||||
return;
|
||||
}
|
||||
@ -434,7 +483,7 @@ void level_lightness_handler(struct light_ctl_state *state)
|
||||
|
||||
void level_temp_handler(struct light_ctl_state *state)
|
||||
{
|
||||
if (state->transition->counter == 0U) {
|
||||
if (state->transition->counter == 0U && state->transition->delay == 0) {
|
||||
update_light_state();
|
||||
return;
|
||||
}
|
||||
@ -448,7 +497,7 @@ void level_temp_handler(struct light_ctl_state *state)
|
||||
|
||||
void light_lightness_actual_handler(struct light_ctl_state *state)
|
||||
{
|
||||
if (state->transition->counter == 0U) {
|
||||
if (state->transition->counter == 0U && state->transition->delay == 0) {
|
||||
update_light_state();
|
||||
return;
|
||||
}
|
||||
@ -463,7 +512,7 @@ void light_lightness_actual_handler(struct light_ctl_state *state)
|
||||
|
||||
void light_lightness_linear_handler(struct light_ctl_state *state)
|
||||
{
|
||||
if (state->transition->counter == 0U) {
|
||||
if (state->transition->counter == 0U && state->transition->delay == 0) {
|
||||
update_light_state();
|
||||
return;
|
||||
}
|
||||
@ -478,7 +527,7 @@ void light_lightness_linear_handler(struct light_ctl_state *state)
|
||||
|
||||
void light_ctl_handler(struct light_ctl_state *state)
|
||||
{
|
||||
if (state->transition->counter == 0U) {
|
||||
if (state->transition->counter == 0U && state->transition->delay == 0) {
|
||||
update_light_state();
|
||||
return;
|
||||
}
|
||||
@ -492,7 +541,7 @@ void light_ctl_handler(struct light_ctl_state *state)
|
||||
|
||||
void light_ctl_temp_handler(struct light_ctl_state *state)
|
||||
{
|
||||
if (state->transition->counter == 0U) {
|
||||
if (state->transition->counter == 0U && state->transition->delay == 0) {
|
||||
update_light_state();
|
||||
return;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user