Skip to content
Snippets Groups Projects
Verified Commit ad91360c authored by Zoe Michaela Dietmar Pfister's avatar Zoe Michaela Dietmar Pfister :gay_pride_flag:
Browse files

Minor changes as suggested by markus

parent fe26453f
No related branches found
No related tags found
3 merge requests!39Merge Develop into Main,!25Minor additions to host,!24Refactor of Host ESP32
This commit is part of merge request !24. Comments created here will be created in the context of that merge request.
......@@ -60,7 +60,7 @@ void on_data_sent(const uint8_t *mac_addr, esp_now_send_status_t status) {
}
void on_data_recv(const uint8_t *mac, const uint8_t *incomingData, int len) {
esp_log_write(ESP_LOG_INFO, TAG_ESPNOW, "Message recieved\n");
esp_log_write(ESP_LOG_INFO, TAG_ESPNOW, "Message received\n");
// copy received data to a char array
char data[len];
memcpy(data, incomingData, len);
......@@ -78,9 +78,7 @@ void on_data_recv(const uint8_t *mac, const uint8_t *incomingData, int len) {
}
}
DynamicJsonDocument doc = parseReceivedJsonData(data);
// TODO: Respond to the client. Maybe do that before parsing anything
// TODO: Think if response to client may contain error messages
response response = {};
response.type = dataAck;
esp_read_mac(response.mac, ESP_MAC_WIFI_STA);
......@@ -88,6 +86,8 @@ void on_data_recv(const uint8_t *mac, const uint8_t *incomingData, int len) {
esp_err_t success = esp_now_send(mac, (uint8_t *)&response, sizeof(response));
esp_log_write(ESP_LOG_DEBUG, TAG_ESPNOW, (success == ESP_OK) ? "Response sent\n" : "Failed to respond\n");
DynamicJsonDocument doc = parseReceivedJsonData(data);
String macAddress = getMacAddressAsString(mac);
// add timestamp and mac address
......@@ -190,9 +190,6 @@ void setup() {
0); /* Core where the task should run */
SerialAT.begin(UART_BAUD, SERIAL_8N1, PIN_RX, PIN_TX);
// Restart takes quite some time
// To skip it, call init() instead of restart()
}
void loop() {
......
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