ESP32-C3 RC & Receiver

This commit is contained in:
2025-01-04 03:19:47 -05:00
parent 3d5b4fa410
commit bbd976b53f

View File

@@ -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;
}