mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-01 03:34:32 +02:00
ble_mesh: fix MESH/NODE/CFG/GPXY/BV-02-C & MESH/NODE/CFG/NID/BV-02-C related bug
This commit is contained in:
@@ -1144,14 +1144,25 @@ static bool advertise_subnet(struct bt_mesh_subnet *sub)
|
|||||||
|
|
||||||
static struct bt_mesh_subnet *next_sub(void)
|
static struct bt_mesh_subnet *next_sub(void)
|
||||||
{
|
{
|
||||||
|
struct bt_mesh_subnet *sub = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(bt_mesh.sub); i++) {
|
for (i = next_idx; i < ARRAY_SIZE(bt_mesh.sub); i++) {
|
||||||
struct bt_mesh_subnet *sub;
|
sub = &bt_mesh.sub[i];
|
||||||
|
|
||||||
sub = &bt_mesh.sub[(i + next_idx) % ARRAY_SIZE(bt_mesh.sub)];
|
|
||||||
if (advertise_subnet(sub)) {
|
if (advertise_subnet(sub)) {
|
||||||
next_idx = (next_idx + 1) % ARRAY_SIZE(bt_mesh.sub);
|
next_idx = (i + 1) % ARRAY_SIZE(bt_mesh.sub);
|
||||||
|
return sub;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If among [next_idx, ARRAY_SIZE(bt_mesh.sub)], there is no subnet
|
||||||
|
* to advertise, then try to start advertising from Primary subnet.
|
||||||
|
*/
|
||||||
|
for (i = 0; i < next_idx; i++) {
|
||||||
|
sub = &bt_mesh.sub[i];
|
||||||
|
if (advertise_subnet(sub)) {
|
||||||
|
next_idx = (i + 1) % ARRAY_SIZE(bt_mesh.sub);
|
||||||
return sub;
|
return sub;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user