mirror of
https://github.com/alexandrebobkov/ESP-Nodes.git
synced 2025-08-21 01:50:54 +00:00
ESP32-C3 RC & Receiver
This commit is contained in:
@@ -22,3 +22,23 @@ static void wifi_init(void)
|
|||||||
ESP_ERROR_CHECK( esp_wifi_set_protocol(ESPNOW_WIFI_IF, WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N|WIFI_PROTOCOL_LR) );
|
ESP_ERROR_CHECK( esp_wifi_set_protocol(ESPNOW_WIFI_IF, WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N|WIFI_PROTOCOL_LR) );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static esp_err_t rc_espnow_init (void) {
|
||||||
|
|
||||||
|
espnow_data_packet_t *send_packet;
|
||||||
|
|
||||||
|
send_packet = malloc(sizeof(espnow_data_packet_t));
|
||||||
|
if (send_packet == NULL) {
|
||||||
|
ESP_LOGE(TAG, "malloc fail.");
|
||||||
|
return ESP_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(send_packet, 0, sizeof(espnow_data_packet_t));
|
||||||
|
memcpy(send_packet->dest_mac, receiver_mac, ESP_NOW_ETH_ALEN);
|
||||||
|
send_packet->len = CONFIG_ESPNOW_SEND_LEN; // 128
|
||||||
|
send_packet->buffer = malloc(CONFIG_ESPNOW_SEND_LEN);
|
||||||
|
sensors_data_prepare(send_packet);
|
||||||
|
xTaskCreate(rc_send_data_task2, "controller data packets task", 2048, send_packet, 8, NULL);
|
||||||
|
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
Reference in New Issue
Block a user