Browse Source

Merge pull request 'Bugfixes: OTA-Update Upstream' (#4) from develop into master

Reviewed-on: #4
master
Hendrik Schutter 1 year ago
parent
commit
b4a750bda0
  1. 14
      components/mesh_ota/Mesh_Network.c
  2. 84
      components/mesh_ota/Mesh_OTA.c
  3. 14
      components/mesh_ota/Mesh_OTA_Partition_Access.c
  4. 54
      components/mesh_ota/Mesh_OTA_Util.c
  5. 2
      components/mesh_ota/include/Mesh_OTA.h
  6. 2
      components/mesh_ota/include/Mesh_OTA_Util.h
  7. 59
      components/mesh_ota/test/test_mesh_ota.c
  8. 7
      main/Blinky_LED.c
  9. 4
      main/Blinky_LED.h
  10. 2
      sdkconfig

14
components/mesh_ota/Mesh_Network.c

@ -308,7 +308,7 @@ bool bMeshNetworkIsNodeNeighbour(const mesh_addr_t* const cpcNode)
/**
* @fn bool bMeshNetworkCheckMacEquality(const uint8_t* const cpcu8aMAC, const uint8_t* const cpcu8bMAC)
* @brief returns true if MAC address is equal
* @brief returns true if MAC address is equal, compares only the first 5 bytes, the last is node specific
* @param cpcu8aMAC first MAC
* @param cpcu8bMAC second MAC
* @return boolean
@ -320,21 +320,12 @@ bool bMeshNetworkCheckMacEquality(const uint8_t* const cpcu8aMAC, const uint8_t*
bool bRet = true;
uint8_t index = 0;
while ((index < 6) && (bRet == true))
while ((index < 5) && (bRet == true))
{
if(cpcu8aMAC[index] != cpcu8bMAC[index])
{
bRet = false;
}
if(index == 5)
{
//last byte of mac
if(abs((cpcu8aMAC[index] - cpcu8bMAC[index])) <= 1)
{
bRet = true; //last byte differs 1 ore less
}
}
index++;
}
return bRet;
@ -399,7 +390,6 @@ esp_err_t errMeshNetworkGetChildren(mesh_addr_t* const cpChildren, uint16_t* con
if(! (bMeshNetworkCheckMacEquality(u8ownMAC, route_table[index].addr)) )
{
//child node
//ESP_LOGI(LOG_TAG, "adding Node: \"0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x\" ", route_table[index].addr[0], route_table[index].addr[1], route_table[index].addr[2], route_table[index].addr[3], route_table[index].addr[4], route_table[index].addr[5]);
cpChildren[*cpu16ChildrenSize] = route_table[index];
(*cpu16ChildrenSize) = (*cpu16ChildrenSize)+1;
}

84
components/mesh_ota/Mesh_OTA.c

@ -189,9 +189,9 @@ void vMeshOtaTaskOTAWorker(void *arg)
if((uxQueueSpacesAvailable(queueNodes) - QUEUE_NODES_SIZE) == 0)
{
ESP_LOGI(LOG_TAG, "//nodes queue is empty");
//nodes queue is empty
xReturned = xSemaphoreTake(bsOTAProcess, portMAX_DELAY); //wait for binary semaphore that allows to start the OTA process
xReturned = xSemaphoreTake(bsOTAProcess, portMAX_DELAY); //wait for binary semaphore that allows to start the OTA process
if((xReturned == pdTRUE) && (bWantReboot == true) && (OTA_ALLOW_REBOOT == 1))
{
ESP_LOGE(LOG_TAG, "ESP32 Reboot ...");
@ -200,19 +200,17 @@ void vMeshOtaTaskOTAWorker(void *arg)
}
xSemaphoreGive(bsOTAProcess); //free binary semaphore, this allows other tasks to start the OTA process
ERROR_CHECK(errMeshOtaSlaveEndpoint(&bNewOTAImage));
ERROR_CHECK(errMeshOtaSlaveEndpoint(&bNewOTAImage, &meshNodeAddr));
}
else
{
ESP_LOGI(LOG_TAG, "//queue not empty %i", (uxQueueSpacesAvailable(queueNodes) - QUEUE_NODES_SIZE));
//queue not empty
if (xQueueReceive(queueNodes, &meshNodeAddr, ((100) / portTICK_PERIOD_MS)) != pdTRUE)
{
ESP_LOGE(LOG_TAG, "Unable to receive OTA Messages from Queue");
err = ESP_FAIL;
}
ESP_LOGI(LOG_TAG, "//handle node %x", meshNodeAddr.addr[5]);
ERROR_CHECK(errMeshOtaMasterEndpoint(&bNewOTAImage, &meshNodeAddr));
if (err != ESP_OK)
@ -231,7 +229,8 @@ void vMeshOtaTaskOTAWorker(void *arg)
//set want reboot
ESP_LOGI(LOG_TAG, "Updated successfully via Mesh, set pending reboot");
bWantReboot = true;
vMeshOtaUtilAddAllNeighboursToQueue(); //add all existing neighbours to queue
vMeshOtaUtilAddAllNeighboursToQueue(&meshNodeAddr); //add all existing neighbours to queue
}
vTaskDelay( (1000) / portTICK_PERIOD_MS);
}
@ -241,6 +240,7 @@ void vMeshOtaTaskOTAWorker(void *arg)
* @fn esp_err_t errMeshOtaSlaveEndpoint(bool* const cpbNewOTAImage)
* @brief Endpoint for OTA process that is called from remote node
* @param cpbNewOTAImage pointer to boolean to signal if a new image was successfully received
* @param cpcMeshNodeAddr pointer to mesh node that transmitted the update
* @return ESP32 error code
* @author Hendrik Schutter
* @date 21.01.2021
@ -248,7 +248,7 @@ void vMeshOtaTaskOTAWorker(void *arg)
* Answers the OTA_Version_Request with OTA_Version_Response
* calls errMeshOtaPartitionAccessMeshReceive OR errMeshOtaPartitionAccessMeshTransmit based on version number
*/
esp_err_t errMeshOtaSlaveEndpoint(bool* const cpbNewOTAImage)
esp_err_t errMeshOtaSlaveEndpoint(bool* const cpbNewOTAImage, mesh_addr_t* const cpcMeshNodeAddr)
{
esp_err_t err = ESP_OK;
MESH_PACKET_t sOTAMessage;
@ -262,7 +262,6 @@ esp_err_t errMeshOtaSlaveEndpoint(bool* const cpbNewOTAImage)
//queue not empty
if (xQueueReceive(queueMessageOTA, &sOTAMessage, ((100) / portTICK_PERIOD_MS)) != pdTRUE)
{
ESP_LOGE(LOG_TAG, "Unable to receive OTA Messages from Queue");
err = ESP_FAIL;
}
@ -270,6 +269,8 @@ esp_err_t errMeshOtaSlaveEndpoint(bool* const cpbNewOTAImage)
{
xSemaphoreTake(bsOTAProcess, portMAX_DELAY); //wait for binary semaphore that allows to start the OTA process
memcpy(cpcMeshNodeAddr, &sOTAMessage.meshSenderAddr, sizeof(mesh_addr_t));
cpBootPartition = esp_ota_get_boot_partition(); //get boot partition (that will booted after reset), not the running partition
ERROR_CHECK(esp_ota_get_partition_description(cpBootPartition, &bootPartitionDesc)); //get metadata of partition
@ -317,6 +318,7 @@ esp_err_t errMeshOtaMasterEndpoint(bool* const cpbNewOTAImage, const mesh_addr_t
esp_app_desc_t bootPartitionDesc; //Metadata from boot partition
bool bNodeIsConnected = false;
bool bNodeIsResponding = false;
bool bSameVersion = false;
*cpbNewOTAImage = false; //set default false
@ -327,49 +329,47 @@ esp_err_t errMeshOtaMasterEndpoint(bool* const cpbNewOTAImage, const mesh_addr_t
ERROR_CHECK(errMeshOtaUtilSendOtaVersionRequest(cpcMeshNodeAddr)); //send OTA_VERSION_REQUEST with local version in payload
for (uint32_t u32Index = 0; u32Index < QUEUE_MESSAGE_OTA_SIZE; u32Index++) //loop through all OTA messages
for (uint32_t u32Index = 0; ((u32Index < QUEUE_MESSAGE_OTA_SIZE) && (bSameVersion == false)); u32Index++) //loop through all OTA messages
{
if(uxQueueSpacesAvailable(queueMessageOTA) < QUEUE_MESSAGE_OTA_SIZE)
//if(uxQueueSpacesAvailable(queueMessageOTA) < QUEUE_MESSAGE_OTA_SIZE)
// {
//queue not empty
if (xQueueReceive(queueMessageOTA, &sOTAMessage, ((3000) / portTICK_PERIOD_MS)) != pdTRUE)
{
//queue not empty
if (xQueueReceive(queueMessageOTA, &sOTAMessage, ((3000) / portTICK_PERIOD_MS)) != pdTRUE)
{
ESP_LOGE(LOG_TAG, "Unable to receive OTA Messages from queue");
err = ESP_FAIL;
}
ESP_LOGE(LOG_TAG, "Unable to receive OTA Messages from queue");
err = ESP_FAIL;
}
if((err == ESP_OK) && (sOTAMessage.type == OTA_Version_Response) && (bMeshNetworkCheckMacEquality(sOTAMessage.meshSenderAddr.addr, cpcMeshNodeAddr->addr))) //if OTA_Version_Request
if((err == ESP_OK) && (sOTAMessage.type == OTA_Version_Response) && (bMeshNetworkCheckMacEquality(sOTAMessage.meshSenderAddr.addr, cpcMeshNodeAddr->addr))) //if OTA_Version_Request
{
bSameVersion = true;
bNodeIsResponding = true;
cpBootPartition = esp_ota_get_boot_partition(); //get boot partition (that will booted after reset), not the running partition
ERROR_CHECK(esp_ota_get_partition_description(cpBootPartition, &bootPartitionDesc)); //get metadata of partition
if((bMeshOtaUtilNewerVersion((bootPartitionDesc).version, (char*) sOTAMessage.au8Payload)) && (err == ESP_OK)) //compare local and remote version
{
bNodeIsResponding = true;
cpBootPartition = esp_ota_get_boot_partition(); //get boot partition (that will booted after reset), not the running partition
ERROR_CHECK(esp_ota_get_partition_description(cpBootPartition, &bootPartitionDesc)); //get metadata of partition
if((bMeshOtaUtilNewerVersion((bootPartitionDesc).version, (char*) sOTAMessage.au8Payload)) && (err == ESP_OK)) //compare local and remote version
{
//remote newer as local
ESP_LOGI(LOG_TAG, "remote image on node is newer --> OTA update required from node \"%x:%x:%x:%x:%x:%x\"", sOTAMessage.meshSenderAddr.addr[0], sOTAMessage.meshSenderAddr.addr[1], sOTAMessage.meshSenderAddr.addr[2], sOTAMessage.meshSenderAddr.addr[3], sOTAMessage.meshSenderAddr.addr[4], sOTAMessage.meshSenderAddr.addr[5]);
// --> this version older --> start OTA_Rx --> set cpbNewOTAImage true
ERROR_CHECK(errMeshOtaPartitionAccessMeshReceive(cpbNewOTAImage, &sOTAMessage.meshSenderAddr));
}
if((bMeshOtaUtilNewerVersion((char*) sOTAMessage.au8Payload, (bootPartitionDesc).version)) && (err == ESP_OK)) //compare remote and local version
{
//local newer as remote
ESP_LOGI(LOG_TAG, "remote image on node is older --> OTA send required to node \"%x:%x:%x:%x:%x:%x\"", sOTAMessage.meshSenderAddr.addr[0], sOTAMessage.meshSenderAddr.addr[1], sOTAMessage.meshSenderAddr.addr[2], sOTAMessage.meshSenderAddr.addr[3], sOTAMessage.meshSenderAddr.addr[4], sOTAMessage.meshSenderAddr.addr[5]);
// --> this version newer --> start OTA_Tx
ERROR_CHECK(errMeshOtaPartitionAccessMeshTransmit(&sOTAMessage.meshSenderAddr));
}
//remote newer as local
bSameVersion = false;
ESP_LOGI(LOG_TAG, "remote image on node is newer --> OTA update required from node \"%x:%x:%x:%x:%x:%x\"", sOTAMessage.meshSenderAddr.addr[0], sOTAMessage.meshSenderAddr.addr[1], sOTAMessage.meshSenderAddr.addr[2], sOTAMessage.meshSenderAddr.addr[3], sOTAMessage.meshSenderAddr.addr[4], sOTAMessage.meshSenderAddr.addr[5]);
// --> this version older --> start OTA_Rx --> set cpbNewOTAImage true
ERROR_CHECK(errMeshOtaPartitionAccessMeshReceive(cpbNewOTAImage, &sOTAMessage.meshSenderAddr));
u32Index = QUEUE_MESSAGE_OTA_SIZE;
}
else if (err == ESP_OK)
if((bMeshOtaUtilNewerVersion((char*) sOTAMessage.au8Payload, (bootPartitionDesc).version)) && (err == ESP_OK)) //compare remote and local version
{
//received from wrong node or type --> back to queue
vMeshOtaUtilAddOtaMessageToQueue(&sOTAMessage);
//local newer as remote
bSameVersion = false;
ESP_LOGI(LOG_TAG, "remote image on node is older --> OTA send required to node \"%x:%x:%x:%x:%x:%x\"", sOTAMessage.meshSenderAddr.addr[0], sOTAMessage.meshSenderAddr.addr[1], sOTAMessage.meshSenderAddr.addr[2], sOTAMessage.meshSenderAddr.addr[3], sOTAMessage.meshSenderAddr.addr[4], sOTAMessage.meshSenderAddr.addr[5]);
// --> this version newer --> start OTA_Tx
ERROR_CHECK(errMeshOtaPartitionAccessMeshTransmit(&sOTAMessage.meshSenderAddr));
u32Index = QUEUE_MESSAGE_OTA_SIZE;
}
}
else
{
// OTA Message queue is empty --> wait some time
ESP_LOGD(LOG_TAG, "OTA-Master: OTA Message queue is empty --> wait some time");
vTaskDelay( (1000/QUEUE_MESSAGE_OTA_SIZE) / portTICK_PERIOD_MS);
}
}//end loop
@ -379,7 +379,7 @@ esp_err_t errMeshOtaMasterEndpoint(bool* const cpbNewOTAImage, const mesh_addr_t
if((bNodeIsResponding == false) && (bNodeIsConnected == true))
{
//add node back to queue if connected and NOT responding
ESP_LOGD(LOG_TAG, "OTA-Master: connected and NOT responding --> add node back to queue ");
ESP_LOGI(LOG_TAG, "OTA-Master: connected and NOT responding --> add node back to queue ");
vMeshOtaUtilAddNodeToPossibleUpdatableQueue(cpcMeshNodeAddr->addr);
}
return err;

14
components/mesh_ota/Mesh_OTA_Partition_Access.c

@ -89,7 +89,7 @@ esp_err_t errMeshOtaPartitionAccessHttps(bool* const cpbNewOTAImage)
if(err == ESP_OK)
{
*cpbNewOTAImage = true; //image validated
vMeshOtaUtilAddAllNeighboursToQueue(); //add all existing neighbours to queue (aparent will not be added because this node is the root)
vMeshOtaUtilAddAllNeighboursToQueue(NULL); //add all existing neighbours to queue (aparent will not be added because this node is the root)
}
}
else
@ -152,9 +152,10 @@ esp_err_t errMeshOtaPartitionAccessMeshTransmit(const mesh_addr_t* const cpcMesh
if((OTA_MESH_SEGMENT_SIZE * (u32SegmentCounter+1)) >= pBootPartition->size) //check if last segment
{
//last partition image segment --> send OTA_Complete
ESP_LOGD(LOG_TAG, "OTA-TX: last segment--> send Complete");
ESP_LOGI(LOG_TAG, "OTA-TX: last segment--> send Complete");
sMeshPacket.type = OTA_Complete;
}
err = errMeshNetworkSendMeshPacket(cpcMeshNodeAddr, &sMeshPacket);
}
else
@ -191,14 +192,10 @@ esp_err_t errMeshOtaPartitionAccessMeshTransmit(const mesh_addr_t* const cpcMesh
bNodeIsResponding = true;
break;
default:
ESP_LOGI(LOG_TAG, "OTA-TX: no ACK or ABORT message received");
break;
}
}
else if (err == ESP_OK)
{
//received from wrong node --> back to queue
vMeshOtaUtilAddOtaMessageToQueue(&sMeshPacket);
}
}//end OTA message loop
if(bNodeIsResponding == false)
@ -249,8 +246,6 @@ esp_err_t errMeshOtaPartitionAccessMeshReceive(bool* const cpbNewOTAImage, const
// loop through all OTA messages or until abort is called
for (uint32_t u32Index = 0; ((u32Index < QUEUE_MESSAGE_OTA_SIZE) && (bAbort == false)); u32Index++) //loop through all OTA messages
{
//if(uxQueueSpacesAvailable(queueMessageOTA) < QUEUE_MESSAGE_OTA_SIZE)
// {
//queue not empty
if (xQueueReceive(queueMessageOTA, &sMeshPacket, ((OTA_MESH_TIMEOUT) / portTICK_PERIOD_MS)) != pdTRUE)
{
@ -274,6 +269,7 @@ esp_err_t errMeshOtaPartitionAccessMeshReceive(bool* const cpbNewOTAImage, const
u32Index = QUEUE_MESSAGE_OTA_SIZE; //this will end the loop through all OTA messages
break;
case OTA_Abort: //abort this OTA process
ESP_LOGE(LOG_TAG, "OTA-RX: receives abort");
bAbort = true;
bNodeIsResponding = true;
ESP_LOGE(LOG_TAG, "OTA-RX: receives abort --> abort this OTA process on this node");

54
components/mesh_ota/Mesh_OTA_Util.c

@ -262,16 +262,15 @@ void vMeshOtaUtilPrintOtaProgress(const uint32_t* const cpcu32TotalImageSize, co
/**
* @fn void vMeshOtaUtilAddAllNeighboursToQueue(void)
* @brief add all neigbhours (children and parent) to queue
* @param void
* @brief add all neigbhours (children and parent) to queue, except node used in parameter
* @param const mesh_addr_t* const cpcMeshNodeAddr
* @return void
* @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,22 +356,20 @@ 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)
{
if((bMeshNetworkCheckMacEquality(sNode.addr, cpcMeshNodeAddr->addr)))
{
ESP_LOGI(LOG_TAG, "REMOVE_NODE: remove node %x", sNode.addr[5]);
//same node --> don't add again
}
else
else
{
ESP_LOGI(LOG_TAG, "//node is NOT cpcMeshNodeAddr: %i --> keep it in queue", sNode.addr[5]);
//node is NOT cpcMeshNodeAddr --> keep it in queue
vMeshOtaUtilAddNodeToPossibleUpdatableQueue(sNode.addr);
}
}else{
ESP_LOGI(LOG_TAG, "REMOVE_NODE: queue leer");
}
}//end nodes
}
@ -368,7 +394,7 @@ void vMeshOtaUtilAddNodeToPossibleUpdatableQueue(const uint8_t* const cpcu8MAC)
}
else
{
ESP_LOGI(LOG_TAG, "added node \"%x:%x:%x:%x:%x:%x\" to possible updatable queue", addrNode.addr[0], addrNode.addr[1], addrNode.addr[2], addrNode.addr[3], addrNode.addr[4], addrNode.addr[5]);
ESP_LOGD(LOG_TAG, "added node \"%x:%x:%x:%x:%x:%x\" to possible updatable queue", addrNode.addr[0], addrNode.addr[1], addrNode.addr[2], addrNode.addr[3], addrNode.addr[4], addrNode.addr[5]);
}
}

2
components/mesh_ota/include/Mesh_OTA.h

@ -43,7 +43,7 @@ void vMeshOtaTaskServerWorker(void *arg);
void vMeshOtaTaskOTAWorker(void *arg);
//OTA process endpoints
esp_err_t errMeshOtaSlaveEndpoint(bool* const cpbNewOTAImage);
esp_err_t errMeshOtaSlaveEndpoint(bool* const cpbNewOTAImage, mesh_addr_t* const cpcMeshNodeAddr);
esp_err_t errMeshOtaMasterEndpoint(bool* const cpbNewOTAImage, const mesh_addr_t* const cpcMeshNodeAddr);
#endif /* H_MESH_OTA */

2
components/mesh_ota/include/Mesh_OTA_Util.h

@ -31,7 +31,7 @@ esp_err_t errMeshOtaUtilFindImageStart(const char* const cpu8Data, const uint32
esp_err_t errMeshOtaUtilSendOtaVersionRequest(const mesh_addr_t* const cpcMeshReceiverAddr);
esp_err_t errMeshOtaUtilSendOtaVersionResponse(const mesh_addr_t* const cpcMeshReceiverAddr);
void vMeshOtaUtilPrintOtaProgress(const uint32_t* const cpcu32TotalImageSize, const uint32_t* const cpcu32BytesWritten, const OTA_MESH_ROLE_t ceRole);
void vMeshOtaUtilAddAllNeighboursToQueue(void);
void vMeshOtaUtilAddAllNeighboursToQueue(const mesh_addr_t* const cpcMeshNodeAddr);
void vMeshOtaUtilClearOtaMessageQueue(const mesh_addr_t* const cpcMeshNodeAddr);
void vMeshOtaUtilClearNeighboursQueue(const mesh_addr_t* const cpcMeshNodeAddr);

59
components/mesh_ota/test/test_mesh_ota.c

@ -3,6 +3,7 @@
#include "Mesh_OTA_Util.h"
#include "test_image_hex.h"
#include "Mesh_Network.h"
// ### ### ### distinguish newer image version ### ### ###
@ -206,11 +207,69 @@ TEST_CASE("extract version 999.99.999", "[extract image version number]")
}
TEST_CASE("same MACs", "[check MAC equality]")
{
unsigned char cMAC_A[] = "012345678901";
unsigned char cMAC_B[] = "012345678901";
TEST_ASSERT_TRUE( bMeshNetworkCheckMacEquality(cMAC_A,cMAC_B) );
}
TEST_CASE("different MACs", "[check MAC equality]")
{
unsigned char cMAC_A[] = "012345678901";
unsigned char cMAC_B[] = "087464874718";
TEST_ASSERT_FALSE( bMeshNetworkCheckMacEquality(cMAC_A,cMAC_B) );
}
TEST_CASE("same MACs last A_byte+1", "[check MAC equality]")
{
unsigned char cMAC_A[] = "012345678902";
unsigned char cMAC_B[] = "012345678901";
TEST_ASSERT_TRUE( bMeshNetworkCheckMacEquality(cMAC_A,cMAC_B) );
}
TEST_CASE("same MACs last B_byte+1", "[check MAC equality]")
{
unsigned char cMAC_A[] = "012345678901";
unsigned char cMAC_B[] = "012345678902";
TEST_ASSERT_TRUE( bMeshNetworkCheckMacEquality(cMAC_A,cMAC_B) );
}
TEST_CASE("same MACs last B_byte+2", "[check MAC equality]")
{
unsigned char cMAC_A[] = "012345678901";
unsigned char cMAC_B[] = "012345678903";
TEST_ASSERT_TRUE( bMeshNetworkCheckMacEquality(cMAC_A,cMAC_B) );
}
TEST_CASE("same Node0", "[check MAC equality]")
{
unsigned char cMAC_A[] = "ac67b27162b0";
unsigned char cMAC_B[] = "ac67b27162b0";
TEST_ASSERT_TRUE( bMeshNetworkCheckMacEquality(cMAC_A,cMAC_B) );
}
TEST_CASE("same Node0 first MAC+1", "[check MAC equality]")
{
unsigned char cMAC_A[] = "ac67b27162b1";
unsigned char cMAC_B[] = "ac67b27162b0";
TEST_ASSERT_TRUE( bMeshNetworkCheckMacEquality(cMAC_A,cMAC_B) );
}
TEST_CASE("same Node0 second MAC+1", "[check MAC equality]")
{
unsigned char cMAC_A[] = "ac67b27162b0";
unsigned char cMAC_B[] = "ac67b27162b1";
TEST_ASSERT_TRUE( bMeshNetworkCheckMacEquality(cMAC_A,cMAC_B) );
}

7
main/Blinky_LED.c

@ -66,6 +66,10 @@ esp_err_t errBlinkyLEDInitialize(void)
gpio_set_level(GPIO_LED_GREEN, 1); //switch on
#endif
#ifndef NEW_VERSION
gpio_set_level(GPIO_LED_GREEN, 0); //switch off
#endif
return err;
}
@ -86,11 +90,8 @@ void vGPIOInitialize(void)
//LED as Output
gpio_reset_pin(GPIO_LED_BLUE);
gpio_set_direction(GPIO_LED_BLUE, GPIO_MODE_OUTPUT);
#ifdef NEW_VERSION
gpio_reset_pin(GPIO_LED_GREEN);
gpio_set_direction(GPIO_LED_GREEN, GPIO_MODE_OUTPUT);
#endif
//BTN as Input
gpioConf.intr_type = GPIO_INTR_DISABLE;

4
main/Blinky_LED.h

@ -20,13 +20,11 @@
#include "Mesh_OTA.h"
//#define NEW_VERSION
#define NEW_VERSION
#define GPIO_BOOT_BTN 0 //GPIO0 (Boot BTN)
#define GPIO_LED_BLUE 2 //GPIO2 (internal blue LED in DevKit V1.0)
#ifdef NEW_VERSION
#define GPIO_LED_GREEN 13 //GPIO13
#endif
#define GPIO_INPUT_PIN_SEL (1ULL<<GPIO_BOOT_BTN)

2
sdkconfig

@ -32,7 +32,7 @@ CONFIG_APP_COMPILE_TIME_DATE=y
# CONFIG_APP_EXCLUDE_PROJECT_VER_VAR is not set
# CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR is not set
CONFIG_APP_PROJECT_VER_FROM_CONFIG=y
CONFIG_APP_PROJECT_VER="0.0.26"
CONFIG_APP_PROJECT_VER="0.1.3"
CONFIG_APP_RETRIEVE_LEN_ELF_SHA=16
# end of Application manager

Loading…
Cancel
Save

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close