Skip to content
Snippets Groups Projects
Commit 09cb89cf authored by Moritz Perschke's avatar Moritz Perschke
Browse files

small change to espnow in client

parent 5bb3dc61
No related branches found
No related tags found
3 merge requests!39Merge Develop into Main,!19development into master,!17Inital Host, initial Client
{
"version": "0.1.0",
"version": "2.0.0",
"tasks": [
{
"taskName": "clang-format-everything",
"label": "clang-format-everything",
"type": "shell",
"command": "clang-format",
"args": ["-i", "*"],
"isShellCommand": true,
"isBackground": true
"args": [
"-i",
"*"
],
"isBackground": true,
"problemMatcher": []
}
]
}
......@@ -28,12 +28,12 @@ void get_host_mac(uint8_t *destination)
}
esp_err_t add_host_to_peers(config received){
esp_now_peer_info_t host;
memset(&host, 0, sizeof(host));
memcpy(host.peer_addr, received.host, sizeof(received.host));
host.encrypt = false;
host.channel = 0;
return esp_now_add_peer(&host);
esp_now_peer_info_t newHost = {};
memset(&newHost, 0, sizeof(newHost));
memcpy(newHost.peer_addr, received.host, sizeof(received.host));
newHost.encrypt = false;
newHost.channel = 0;
return esp_now_add_peer(&newHost);
}
void on_data_sent(const uint8_t *mac_addr, esp_now_send_status_t status)
......@@ -78,6 +78,7 @@ void on_data_recv(const uint8_t *mac, const uint8_t *incomingData, int len)
uint8_t old[6];
get_host_mac(old);
esp_now_del_peer(old);
preferences.putBytes("host", received_msg.host, sizeof(received_msg.host));
}
// add new host
add_host_to_peers(received_msg);
......
......@@ -102,13 +102,8 @@ Serial.println(dr26_channel0_power.readData(),5);
} catch (const NoDataAvailableException &e) {
std::cerr << e.what() << '\n';
}
Serial.print("This device: ");
Serial.println("\n");
gpio_set_level(GPIO_NUM_3, 0);
delay(5);
DeepSleep::deep_sleep(600);
gpio_set_level(GPIO_NUM_3, 0);
delay(5);
DeepSleep::deep_sleep(60);
}
......@@ -13,8 +13,8 @@ platform = espressif32
board = esp-wrover-kit
framework = arduino
monitor_speed = 115200
; monitor_port = /dev/ttyACM0
; upload_port = /dev/ttyACM0
monitor_port = /dev/ttyACM0
upload_port = /dev/ttyACM0
build_flags =
-I include
-DCORE_DEBUG_LEVEL=5
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment