This commit is contained in:
2025-01-05 03:04:43 -05:00
parent 7371e5f56c
commit 8fdeab4ecb
8 changed files with 19228 additions and 20 deletions

View File

View File

@@ -1 +1 @@
0ada463cd84b020fd2ee7f3f8cb00f4158344ba4
7371e5f56cc955db67da3b342bbb2dda98d50d8d

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -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",

View File

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

View File

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