Skip to content

Commit 235f565

Browse files
vikrant8052jhedberg
authored andcommitted
samples: mesh: nrf52: removed unnecessary global vaiable
Removed unnecessary global variable & replaced them with different variable defined in struct light_ctl_state. Signed-off-by: Vikrant More <[email protected]>
1 parent fb439fd commit 235f565

File tree

4 files changed

+70
-85
lines changed

4 files changed

+70
-85
lines changed

samples/boards/nrf52/mesh/onoff_level_lighting_vnd_app/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ void update_light_state(void)
133133
{
134134
update_led_gpio();
135135

136-
if (*ptr_counter == 0 || reset == false) {
136+
if (ctl->transition->counter == 0 || reset == false) {
137137
reset = true;
138138
k_work_submit(&no_transition_work);
139139
}

samples/boards/nrf52/mesh/onoff_level_lighting_vnd_app/src/mesh/device_composition.c

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ static void gen_onoff_set_unack(struct bt_mesh_model *model,
185185
return;
186186
}
187187

188-
*ptr_counter = 0U;
189-
k_timer_stop(ptr_timer);
188+
state->transition->counter = 0U;
189+
k_timer_stop(&state->transition->timer);
190190

191191
state->last_tid = tid;
192192
state->last_src_addr = ctx->addr;
@@ -254,8 +254,8 @@ static void gen_onoff_set(struct bt_mesh_model *model,
254254
return;
255255
}
256256

257-
*ptr_counter = 0U;
258-
k_timer_stop(ptr_timer);
257+
state->transition->counter = 0U;
258+
k_timer_stop(&state->transition->timer);
259259

260260
state->last_tid = tid;
261261
state->last_src_addr = ctx->addr;
@@ -387,8 +387,8 @@ static void gen_level_set_unack(struct bt_mesh_model *model,
387387
return;
388388
}
389389

390-
*ptr_counter = 0U;
391-
k_timer_stop(ptr_timer);
390+
state->transition->counter = 0U;
391+
k_timer_stop(&state->transition->timer);
392392

393393
state->last_tid = tid;
394394
state->last_src_addr = ctx->addr;
@@ -453,8 +453,8 @@ static void gen_level_set(struct bt_mesh_model *model,
453453
return;
454454
}
455455

456-
*ptr_counter = 0U;
457-
k_timer_stop(ptr_timer);
456+
state->transition->counter = 0U;
457+
k_timer_stop(&state->transition->timer);
458458

459459
state->last_tid = tid;
460460
state->last_src_addr = ctx->addr;
@@ -529,8 +529,8 @@ static void gen_delta_set_unack(struct bt_mesh_model *model,
529529
return;
530530
}
531531

532-
*ptr_counter = 0U;
533-
k_timer_stop(ptr_timer);
532+
state->transition->counter = 0U;
533+
k_timer_stop(&state->transition->timer);
534534

535535
state->last_tid = tid;
536536
state->last_src_addr = ctx->addr;
@@ -611,8 +611,8 @@ static void gen_delta_set(struct bt_mesh_model *model,
611611
return;
612612
}
613613

614-
*ptr_counter = 0U;
615-
k_timer_stop(ptr_timer);
614+
state->transition->counter = 0U;
615+
k_timer_stop(&state->transition->timer);
616616

617617
state->last_tid = tid;
618618
state->last_src_addr = ctx->addr;
@@ -685,8 +685,8 @@ static void gen_move_set_unack(struct bt_mesh_model *model,
685685
return;
686686
}
687687

688-
*ptr_counter = 0U;
689-
k_timer_stop(ptr_timer);
688+
state->transition->counter = 0U;
689+
k_timer_stop(&state->transition->timer);
690690

691691
state->last_tid = tid;
692692
state->last_src_addr = ctx->addr;
@@ -760,8 +760,8 @@ static void gen_move_set(struct bt_mesh_model *model,
760760
return;
761761
}
762762

763-
*ptr_counter = 0U;
764-
k_timer_stop(ptr_timer);
763+
state->transition->counter = 0U;
764+
k_timer_stop(&state->transition->timer);
765765

766766
state->last_tid = tid;
767767
state->last_src_addr = ctx->addr;
@@ -1147,8 +1147,8 @@ static void light_lightness_set_unack(struct bt_mesh_model *model,
11471147
return;
11481148
}
11491149

1150-
*ptr_counter = 0U;
1151-
k_timer_stop(ptr_timer);
1150+
state->transition->counter = 0U;
1151+
k_timer_stop(&state->transition->timer);
11521152

11531153
state->last_tid = tid;
11541154
state->last_src_addr = ctx->addr;
@@ -1220,8 +1220,8 @@ static void light_lightness_set(struct bt_mesh_model *model,
12201220
return;
12211221
}
12221222

1223-
*ptr_counter = 0U;
1224-
k_timer_stop(ptr_timer);
1223+
state->transition->counter = 0U;
1224+
k_timer_stop(&state->transition->timer);
12251225

12261226
state->last_tid = tid;
12271227
state->last_src_addr = ctx->addr;
@@ -1347,8 +1347,8 @@ static void light_lightness_linear_set_unack(struct bt_mesh_model *model,
13471347
return;
13481348
}
13491349

1350-
*ptr_counter = 0U;
1351-
k_timer_stop(ptr_timer);
1350+
state->transition->counter = 0U;
1351+
k_timer_stop(&state->transition->timer);
13521352

13531353
state->last_tid = tid;
13541354
state->last_src_addr = ctx->addr;
@@ -1413,8 +1413,8 @@ static void light_lightness_linear_set(struct bt_mesh_model *model,
14131413
return;
14141414
}
14151415

1416-
*ptr_counter = 0U;
1417-
k_timer_stop(ptr_timer);
1416+
state->transition->counter = 0U;
1417+
k_timer_stop(&state->transition->timer);
14181418

14191419
state->last_tid = tid;
14201420
state->last_src_addr = ctx->addr;
@@ -1776,8 +1776,8 @@ static void light_ctl_set_unack(struct bt_mesh_model *model,
17761776
return;
17771777
}
17781778

1779-
*ptr_counter = 0U;
1780-
k_timer_stop(ptr_timer);
1779+
state->transition->counter = 0U;
1780+
k_timer_stop(&state->transition->timer);
17811781

17821782
state->last_tid = tid;
17831783
state->last_src_addr = ctx->addr;
@@ -1862,8 +1862,8 @@ static void light_ctl_set(struct bt_mesh_model *model,
18621862
return;
18631863
}
18641864

1865-
*ptr_counter = 0U;
1866-
k_timer_stop(ptr_timer);
1865+
state->transition->counter = 0U;
1866+
k_timer_stop(&state->transition->timer);
18671867

18681868
state->last_tid = tid;
18691869
state->last_src_addr = ctx->addr;
@@ -2251,8 +2251,8 @@ static void light_ctl_temp_set_unack(struct bt_mesh_model *model,
22512251
return;
22522252
}
22532253

2254-
*ptr_counter = 0U;
2255-
k_timer_stop(ptr_timer);
2254+
state->transition->counter = 0U;
2255+
k_timer_stop(&state->transition->timer);
22562256

22572257
state->last_tid = tid;
22582258
state->last_src_addr = ctx->addr;
@@ -2333,8 +2333,8 @@ static void light_ctl_temp_set(struct bt_mesh_model *model,
23332333
return;
23342334
}
23352335

2336-
*ptr_counter = 0U;
2337-
k_timer_stop(ptr_timer);
2336+
state->transition->counter = 0U;
2337+
k_timer_stop(&state->transition->timer);
23382338

23392339
state->last_tid = tid;
23402340
state->last_src_addr = ctx->addr;
@@ -2462,8 +2462,8 @@ static void gen_level_set_unack_temp(struct bt_mesh_model *model,
24622462
return;
24632463
}
24642464

2465-
*ptr_counter = 0U;
2466-
k_timer_stop(ptr_timer);
2465+
state->transition->counter = 0U;
2466+
k_timer_stop(&state->transition->timer);
24672467

24682468
state->last_tid = tid;
24692469
state->last_src_addr = ctx->addr;
@@ -2528,8 +2528,8 @@ static void gen_level_set_temp(struct bt_mesh_model *model,
25282528
return;
25292529
}
25302530

2531-
*ptr_counter = 0U;
2532-
k_timer_stop(ptr_timer);
2531+
state->transition->counter = 0U;
2532+
k_timer_stop(&state->transition->timer);
25332533

25342534
state->last_tid = tid;
25352535
state->last_src_addr = ctx->addr;
@@ -2604,8 +2604,8 @@ static void gen_delta_set_unack_temp(struct bt_mesh_model *model,
26042604
return;
26052605
}
26062606

2607-
*ptr_counter = 0U;
2608-
k_timer_stop(ptr_timer);
2607+
state->transition->counter = 0U;
2608+
k_timer_stop(&state->transition->timer);
26092609

26102610
state->last_tid = tid;
26112611
state->last_src_addr = ctx->addr;
@@ -2686,8 +2686,8 @@ static void gen_delta_set_temp(struct bt_mesh_model *model,
26862686
return;
26872687
}
26882688

2689-
*ptr_counter = 0U;
2690-
k_timer_stop(ptr_timer);
2689+
state->transition->counter = 0U;
2690+
k_timer_stop(&state->transition->timer);
26912691

26922692
state->last_tid = tid;
26932693
state->last_src_addr = ctx->addr;
@@ -2760,8 +2760,8 @@ static void gen_move_set_unack_temp(struct bt_mesh_model *model,
27602760
return;
27612761
}
27622762

2763-
*ptr_counter = 0U;
2764-
k_timer_stop(ptr_timer);
2763+
state->transition->counter = 0U;
2764+
k_timer_stop(&state->transition->timer);
27652765

27662766
state->last_tid = tid;
27672767
state->last_src_addr = ctx->addr;
@@ -2836,8 +2836,8 @@ static void gen_move_set_temp(struct bt_mesh_model *model,
28362836
return;
28372837
}
28382838

2839-
*ptr_counter = 0U;
2840-
k_timer_stop(ptr_timer);
2839+
state->transition->counter = 0U;
2840+
k_timer_stop(&state->transition->timer);
28412841

28422842
state->last_tid = tid;
28432843
state->last_src_addr = ctx->addr;

0 commit comments

Comments
 (0)