mirror of
https://github.com/alexandrebobkov/ESP-Nodes.git
synced 2025-08-07 22:56:11 +00:00
RC
This commit is contained in:
0
ESP-IDF_Robot_RC/build/.ninja_lock
Normal file
0
ESP-IDF_Robot_RC/build/.ninja_lock
Normal file
@@ -1 +1 @@
|
||||
0ada463cd84b020fd2ee7f3f8cb00f4158344ba4
|
||||
7371e5f56cc955db67da3b342bbb2dda98d50d8d
|
||||
|
1141
ESP-IDF_Robot_RC/build/CMakeFiles/rules.ninja.tmp0d467
Normal file
1141
ESP-IDF_Robot_RC/build/CMakeFiles/rules.ninja.tmp0d467
Normal file
File diff suppressed because it is too large
Load Diff
13525
ESP-IDF_Robot_RC/build/build.ninja.tmp4f6bc
Normal file
13525
ESP-IDF_Robot_RC/build/build.ninja.tmp4f6bc
Normal file
File diff suppressed because one or more lines are too long
4558
ESP-IDF_Robot_RC/build/compile_commands.json.tmp373fb
Normal file
4558
ESP-IDF_Robot_RC/build/compile_commands.json.tmp373fb
Normal file
File diff suppressed because one or more lines are too long
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"version": "1.1",
|
||||
"project_name": "ESP-IDF_Robot_RC",
|
||||
"project_version": "ESP32-Node_Switch-v2.7-3080-g0ada463cd-dirty",
|
||||
"project_version": "ESP32-Node_Switch-v2.7-3082-g7371e5f56-dirty",
|
||||
"project_path": "/home/alex/github/ESP-Nodes/ESP-IDF_Robot_RC",
|
||||
"idf_path": "/home/alex/esp/v5.3.2/esp-idf",
|
||||
"build_dir": "/home/alex/github/ESP-Nodes/ESP-IDF_Robot_RC/build",
|
||||
|
@@ -26,9 +26,6 @@
|
||||
|
||||
#include "joystick.h"
|
||||
|
||||
|
||||
//#define ESPNOW_MAXDELAY 512
|
||||
|
||||
// Struct holding sensors values
|
||||
typedef struct {
|
||||
uint16_t crc; // CRC16 value of ESPNOW data
|
||||
@@ -86,7 +83,6 @@ void deletePeer (void) {
|
||||
}
|
||||
// Function to send data to the receiver
|
||||
void sendData (void) {
|
||||
//sensors_data_t buffer; // Declare data struct
|
||||
|
||||
buffer.crc = 0;
|
||||
buffer.x_axis = 240;
|
||||
@@ -99,7 +95,6 @@ void sendData (void) {
|
||||
|
||||
get_joystick_xy(&x, &y);
|
||||
//ESP_LOGI("(x, y)", "[ %d, %d ]", x, y);
|
||||
//get_joystick_xy(&buffer.x_axis, &buffer.y_axis);
|
||||
buffer.x_axis = x;
|
||||
buffer.y_axis = y;
|
||||
|
||||
@@ -116,8 +111,6 @@ void sendData (void) {
|
||||
ESP_LOGE("ESP-NOW", "Error sending data! Error code: 0x%04X", result);
|
||||
deletePeer();
|
||||
}
|
||||
//else
|
||||
//ESP_LOGW("ESP-NOW", "Data was sent.");
|
||||
}
|
||||
|
||||
// Continous, periodic task that sends data.
|
||||
@@ -130,7 +123,6 @@ static void rc_send_data_task (void *arg) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
joystick_adc_init();
|
||||
@@ -154,12 +146,6 @@ void app_main(void)
|
||||
peerInfo.channel = 1; // Define communication channel
|
||||
peerInfo.encrypt = false; // Keep data unencrypted
|
||||
esp_now_add_peer(&peerInfo); // Add peer to the list of registered devices
|
||||
/*if (esp_now_is_peer_exist(receiver_mac)) {
|
||||
ESP_LOGI("ESP-NOW", "Receiver exists.");
|
||||
sendData();
|
||||
}
|
||||
else
|
||||
ESP_LOGE("ESP-NOW", "Receiver does not exists.");*/
|
||||
|
||||
// Define a task to periodically call function that sends data
|
||||
xTaskCreate (rc_send_data_task, "RC", 2048, NULL, 15, NULL);
|
||||
|
@@ -16,7 +16,7 @@ static esp_err_t joystick_adc_init() {
|
||||
};
|
||||
ESP_ERROR_CHECK(adc_oneshot_new_unit(&adc_init_config_xy, &adc_xy_handle));
|
||||
|
||||
/*adc_oneshot_chan_cfg_t config_x = {
|
||||
adc_oneshot_chan_cfg_t config_x = {
|
||||
.bitwidth = SOC_ADC_DIGI_MAX_BITWIDTH,
|
||||
.atten = ADC_ATTEN_DB_11,
|
||||
|
||||
@@ -25,7 +25,7 @@ static esp_err_t joystick_adc_init() {
|
||||
.bitwidth = SOC_ADC_DIGI_MAX_BITWIDTH,
|
||||
.atten = ADC_ATTEN_DB_11,
|
||||
|
||||
};*/
|
||||
};
|
||||
ESP_ERROR_CHECK(adc_oneshot_config_channel(adc_xy_handle, ADC1_CHANNEL_0, &config_x));
|
||||
ESP_ERROR_CHECK(adc_oneshot_config_channel(adc_xy_handle, ADC1_CHANNEL_1, &config_y));
|
||||
|
||||
@@ -33,7 +33,6 @@ static esp_err_t joystick_adc_init() {
|
||||
}
|
||||
|
||||
static void joystick_show_raw_xy() {
|
||||
|
||||
ESP_ERROR_CHECK(adc_oneshot_read(adc_xy_handle, ADC1_CHANNEL_0, &x));
|
||||
ESP_ERROR_CHECK(adc_oneshot_read(adc_xy_handle, ADC1_CHANNEL_1, &y));
|
||||
ESP_LOGI("(x,y)", "( %d, %d )", x, y);
|
||||
@@ -45,7 +44,6 @@ static void get_joystick_xy(int* x_axis, int* y_axis) {
|
||||
}
|
||||
|
||||
static void joystick_task(void *arg) {
|
||||
|
||||
while (true) {
|
||||
joystick_show_raw_xy();
|
||||
vTaskDelay (750 / portTICK_PERIOD_MS);
|
||||
|
Reference in New Issue
Block a user