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

cleanup

parent a0e5d84e
No related branches found
No related tags found
5 merge requests!39Merge Develop into Main,!19development into master,!17Inital Host, initial Client,!3Merge Branch `develop` into `sensor_readout`,!1Espnow
......@@ -4,8 +4,7 @@
#include "WiFi.h"
#include "espnow.hpp"
uint8_t A_MAC[] = {0x58, 0xCF, 0x79, 0x04, 0x37, 0x38};
bool host_defined = false;
uint8_t BROADCAST_MAC[] = {0x58, 0xCF, 0x79, 0x04, 0x37, 0x38};
esp_now_peer_info_t hostInfo;
Preferences preferences;
ESP32Time rtc;
......@@ -47,9 +46,9 @@ esp_err_t espnow_setup(){
Serial.println("Mac used from flash");
}
else{
memcpy(hostInfo.peer_addr, A_MAC, sizeof(hostInfo.peer_addr));
memcpy(hostInfo.peer_addr, BROADCAST_MAC, sizeof(hostInfo.peer_addr));
}
preferences.end();
preferences.end(); // check if there is a host saved in flash mem, broadcast otherwise
hostInfo.channel = 0;
hostInfo.encrypt = 0;
......@@ -95,7 +94,7 @@ Message :: Message(){
preferences.getBytes("host", recipient, sizeof(uint8_t) * 6);
}
else{
memcpy(recipient, A_MAC, sizeof(A_MAC));
memcpy(recipient, BROADCAST_MAC, sizeof(BROADCAST_MAC));
Serial.println("backup mac used");
}
preferences.end();
......
......@@ -17,10 +17,6 @@ void on_data_recv(const uint8_t *mac, const uint8_t *incomingData, int len){
data_struct lastData;
memcpy(&lastData, incomingData, sizeof(lastData));
Serial.println("message copied");
// for(int i=0; i<lastData.amountData; i++){
// Serial.print((String) lastData.identifiers[i] + ": ");
// Serial.println((String) lastData.values[i]);
// }
Serial.println((String) lastData.values[0]);
Serial.println((String) "sent time: " + lastData.timestamp);
Serial.println((String) "RTC time: " + rtc.getMillis());
......
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