Browse Source

fix test proj; added MAC addr on log

pull/3/head
Hendrik Schutter 1 year ago
parent
commit
a62d3265ca
  1. 9
      components/mesh_ota/Mesh_OTA.c
  2. 2
      components/mesh_ota/include/Mesh_OTA.h
  3. 2
      components/mesh_ota/test/test_mesh_ota.c
  4. 14
      main/Blinky_LED.c
  5. 1
      main/Main.c
  6. 2
      sdkconfig

9
components/mesh_ota/Mesh_OTA.c

@ -114,7 +114,6 @@ esp_err_t errMeshOTAInitialize(void)
err = ESP_FAIL;
}
}
return err;
}
@ -275,7 +274,7 @@ esp_err_t errMeshOtaSlaveEndpoint(bool* const cpbNewOTAImage)
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");
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));
}
@ -283,7 +282,7 @@ esp_err_t errMeshOtaSlaveEndpoint(bool* const cpbNewOTAImage)
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");
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));
}
@ -343,7 +342,7 @@ esp_err_t errMeshOtaMasterEndpoint(bool* const cpbNewOTAImage, const mesh_addr_t
if((bMeshOtaUtilNewerVersion((bootPartitionDesc).version, (char*) sOTAMessage.au8Payload)) && (err == ESP_OK)) //compare local and remote version
{
//remote newer as local
ESP_LOGI(LOG_TAG, "Mesh: remote image on node is newer --> OTA update required");
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));
}
@ -351,7 +350,7 @@ esp_err_t errMeshOtaMasterEndpoint(bool* const cpbNewOTAImage, const mesh_addr_t
if((bMeshOtaUtilNewerVersion((char*) sOTAMessage.au8Payload, (bootPartitionDesc).version)) && (err == ESP_OK)) //compare remote and local version
{
//local newer as remote
ESP_LOGI(LOG_TAG, "Mesh: remote image on node is older --> OTA send required");
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));
}

2
components/mesh_ota/include/Mesh_OTA.h

@ -25,7 +25,7 @@
#define OTA_PROGRESS_LOG_INTERVAL 7U
#define OTA_MESH_SEGMENT_SIZE MESH_NETWORK_PAYLOAD_SIZE
#define OTA_MESH_TIMEOUT 20000U //in ms
#define OTA_ALLOW_REBOOT 0
#define OTA_ALLOW_REBOOT 1
#define ERROR_CHECK(x) if (err == ESP_OK) \
{ \

2
components/mesh_ota/test/test_mesh_ota.c

@ -1,7 +1,7 @@
#include <limits.h>
#include "unity.h"
#include "Mesh_OTA.h"
#include "Mesh_OTA_Util.h"
#include "test_image_hex.h"
// ### ### ### distinguish newer image version ### ### ###

14
main/Blinky_LED.c

@ -61,6 +61,11 @@ esp_err_t errBlinkyLEDInitialize(void)
err = ESP_FAIL;
}
}
#ifdef NEW_VERSION
gpio_set_level(GPIO_LED_GREEN, 1); //switch on
#endif
return err;
}
@ -218,27 +223,18 @@ void vTaskReceiveData(void *arg)
case LED_ON:
bLEDisOn = true;
gpio_set_level(GPIO_LED_BLUE, 1); //switch on
#ifdef NEW_VERSION
gpio_set_level(GPIO_LED_GREEN, 1); //switch on
#endif
ESP_LOGI(LOG_TAG,"switch LED ON");
break;
case LED_OFF:
bLEDisOn = false;
gpio_set_level(GPIO_LED_BLUE, 0); //switch off
#ifdef NEW_VERSION
gpio_set_level(GPIO_LED_GREEN, 0); //switch off
#endif
ESP_LOGI(LOG_TAG,"switch LED OFF");
break;
default:
bLEDisOn = false;
gpio_set_level(GPIO_LED_BLUE, 0); //switch off
#ifdef NEW_VERSION
gpio_set_level(GPIO_LED_GREEN, 0); //switch off
#endif
ESP_LOGI(LOG_TAG,"switch LED OFF");
break;
}

1
main/Main.c

@ -13,7 +13,6 @@ static const char *LOG_TAG = "esp_main";
void app_main(void)
{
esp_err_t err = ESP_OK;
ESP_LOGI(LOG_TAG, "hardcoded version: 0.0.1");
ESP_LOGI(LOG_TAG, "start mesh network");
err = errMeshNetworkInitialize();

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.1"
CONFIG_APP_PROJECT_VER="0.0.7"
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