Browse Source

format log output

feature/mesh_network
Hendrik Schutter 1 year ago
parent
commit
d4182eddb2
  1. 2
      components/mesh_ota/include/mesh_network.h
  2. 2
      components/mesh_ota/mesh_network.c
  3. 32
      components/mesh_ota/mesh_network_handler.c

2
components/mesh_ota/include/mesh_network.h

@ -16,7 +16,7 @@
static bool bIsMeshConnected;
static int32_t i32MeshLayer;
static mesh_addr_t mesh_parent_addr;
static esp_netif_t* netif_sta;
static esp_netif_t *netif_sta = NULL;
esp_err_t errMeshNetworkInitialize();
esp_err_t errMeshNetworkInitializeWiFi();

2
components/mesh_ota/mesh_network.c

@ -13,7 +13,7 @@ esp_err_t errMeshNetworkInitialize()
esp_err_t err;
bIsMeshConnected = false;
i32MeshLayer = -1;
netif_sta = NULL;
//netif_sta = NULL;
err = nvs_flash_init(); //init non-volatile storage

32
components/mesh_ota/mesh_network_handler.c

@ -76,22 +76,19 @@ void vMeshEventHandler(void *arg, esp_event_base_t event_base, int32_t i32EventI
mesh_event_connected_t *connected = (mesh_event_connected_t *)vpEventData;
esp_mesh_get_id(&id);
i32MeshLayer = connected->self_layer;
memcpy(&mesh_parent_addr.addr, connected->connected.bssid, 6);
//WTF
memcpy(&mesh_parent_addr.addr, connected->connected.bssid, 6);
ESP_LOGI(LOG_TAG, "<MESH_EVENT_PARENT_CONNECTED>layer:%d-->%d, parent:"MACSTR"%s, ID:"MACSTR", duty:%d",
last_layer, i32MeshLayer, MAC2STR(mesh_parent_addr.addr),
esp_mesh_is_root() ? "<ROOT>" :
(i32MeshLayer == 2) ? "<layer2>" : "", MAC2STR(id.addr), connected->duty);
last_layer, i32MeshLayer, MAC2STR(mesh_parent_addr.addr),
esp_mesh_is_root() ? "<ROOT>" : (i32MeshLayer == 2) ? "<layer2>" : "", //print own node title
MAC2STR(id.addr), connected->duty);
last_layer = i32MeshLayer;
//mesh_connected_indicator(i32MeshLayer);
bIsMeshConnected = true;
if (esp_mesh_is_root())
{
esp_netif_dhcpc_start(netif_sta); //get a IP from router
ESP_LOGE(LOG_TAG, "addr %p", netif_sta);
//ESP_ERROR_CHECK(esp_netif_dhcpc_start(netif_sta)); //get a IP from router
}
errStartReceiveTask();//start receiving
}
@ -101,7 +98,6 @@ void vMeshEventHandler(void *arg, esp_event_base_t event_base, int32_t i32EventI
mesh_event_disconnected_t *disconnected = (mesh_event_disconnected_t *)vpEventData;
ESP_LOGI(LOG_TAG, "<MESH_EVENT_PARENT_DISCONNECTED>reason:%d", disconnected->reason);
bIsMeshConnected = false;
// mesh_disconnected_indicator();
i32MeshLayer = esp_mesh_get_layer();
}
break;
@ -109,16 +105,10 @@ void vMeshEventHandler(void *arg, esp_event_base_t event_base, int32_t i32EventI
{
mesh_event_layer_change_t *layer_change = (mesh_event_layer_change_t *)vpEventData;
i32MeshLayer = layer_change->new_layer;
//WTF
ESP_LOGI(LOG_TAG, "<MESH_EVENT_LAYER_CHANGE>layer:%d-->%d%s",
last_layer, i32MeshLayer,
esp_mesh_is_root() ? "<ROOT>" :
(i32MeshLayer == 2) ? "<layer2>" : "");
esp_mesh_is_root() ? "<ROOT>" : (i32MeshLayer == 2) ? "<layer2>" : "");
last_layer = i32MeshLayer;
//mesh_connected_indicator(i32MeshLayer);
}
break;
case MESH_EVENT_ROOT_ADDRESS:
@ -174,9 +164,7 @@ void vMeshEventHandler(void *arg, esp_event_base_t event_base, int32_t i32EventI
{
mesh_event_root_conflict_t *root_conflict = (mesh_event_root_conflict_t *)vpEventData;
ESP_LOGI(LOG_TAG, "<MESH_EVENT_ROOT_ASKED_YIELD>"MACSTR", rssi:%d, capacity:%d",
MAC2STR(root_conflict->addr),
root_conflict->rssi,
root_conflict->capacity);
MAC2STR(root_conflict->addr), root_conflict->rssi, root_conflict->capacity);
}
break;
case MESH_EVENT_CHANNEL_SWITCH:

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