fix in ota upstream to parent and other neighbours

This commit is contained in:
2021-01-26 23:55:53 +01:00
parent 9d23788ac8
commit 78dbbfaba5
7 changed files with 71 additions and 31 deletions

View File

@ -268,10 +268,9 @@ void vMeshOtaUtilPrintOtaProgress(const uint32_t* const cpcu32TotalImageSize, co
* @author Hendrik Schutter
* @date 21.01.2021
*/
void vMeshOtaUtilAddAllNeighboursToQueue(void)
void vMeshOtaUtilAddAllNeighboursToQueue(const mesh_addr_t* const cpcMeshNodeAddr)
{
esp_err_t err = ESP_OK;
mesh_addr_t addrParent; //addr of parent node
mesh_addr_t childrenAddr[CONFIG_MESH_ROUTE_TABLE_SIZE]; //array of children attached to this node
uint16_t u16ChildrenSize = 0U; //number of children attached to this node
@ -280,7 +279,22 @@ void vMeshOtaUtilAddAllNeighboursToQueue(void)
if(err == ESP_OK)
{
vMeshOtaUtilAddNodeToPossibleUpdatableQueue(addrParent.addr);
if (cpcMeshNodeAddr != NULL)
{
if((bMeshNetworkCheckMacEquality(addrParent.addr, cpcMeshNodeAddr->addr)))
{
//same node --> don't add
}
else
{
vMeshOtaUtilAddNodeToPossibleUpdatableQueue(addrParent.addr);
}
}
else
{
vMeshOtaUtilAddNodeToPossibleUpdatableQueue(addrParent.addr);
}
}
err = ESP_OK; //reset error code
@ -289,7 +303,21 @@ void vMeshOtaUtilAddAllNeighboursToQueue(void)
for (uint16_t u16Index = 0; ((u16Index < u16ChildrenSize) && (err == ESP_OK)); u16Index++)
{
vMeshOtaUtilAddNodeToPossibleUpdatableQueue(childrenAddr[u16Index].addr);
if (cpcMeshNodeAddr != NULL)
{
if((bMeshNetworkCheckMacEquality(childrenAddr[u16Index].addr, cpcMeshNodeAddr->addr)))
{
//same node --> don't add
}
else
{
vMeshOtaUtilAddNodeToPossibleUpdatableQueue(childrenAddr[u16Index].addr);
}
}
else
{
vMeshOtaUtilAddNodeToPossibleUpdatableQueue(childrenAddr[u16Index].addr);
}
}
}
@ -328,7 +356,7 @@ void vMeshOtaUtilClearOtaMessageQueue(const mesh_addr_t* const cpcMeshNodeAddr)
void vMeshOtaUtilClearNeighboursQueue(const mesh_addr_t* const cpcMeshNodeAddr)
{
mesh_addr_t sNode; //packet for sending and receiving
for (uint32_t u32Index = 0; (u32Index < QUEUE_NODES_SIZE); u32Index++) //loop through all node queue
for (uint32_t u32Index = 0; (u32Index < QUEUE_NODES_SIZE); u32Index++) //loop through all node queue
{
if (xQueueReceive(queueNodes, &sNode, 0) == pdTRUE)
{
@ -336,13 +364,15 @@ void vMeshOtaUtilClearNeighboursQueue(const mesh_addr_t* const cpcMeshNodeAddr)
{
ESP_LOGI(LOG_TAG, "REMOVE_NODE: remove node %x", sNode.addr[5]);
}
else
else
{
ESP_LOGI(LOG_TAG, "//node is NOT cpcMeshNodeAddr: %i --> keep it in queue", sNode.addr[5]);
vMeshOtaUtilAddNodeToPossibleUpdatableQueue(sNode.addr);
}
}else{
}
else
{
ESP_LOGI(LOG_TAG, "REMOVE_NODE: queue leer");
}
}//end nodes