mirror of
https://github.com/alexandrebobkov/ESP-Nodes.git
synced 2025-10-01 03:34:51 +00:00
ESP-NOW Transmitter comments
This commit is contained in:
0
ESP32-IDF_ESPNOW-Transmitter/build/.ninja_lock
Normal file
0
ESP32-IDF_ESPNOW-Transmitter/build/.ninja_lock
Normal file
@@ -1 +1 @@
|
|||||||
ref: refs/heads/main
|
4c2820d377d1375e787bcef612f0c32c1427d183
|
||||||
|
@@ -18,7 +18,7 @@ set(HEAD_HASH)
|
|||||||
file(READ "/home/abobkov/MyProjects/ESP-Nodes/ESP32-IDF_ESPNOW-Transmitter/build/CMakeFiles/git-data/HEAD" HEAD_CONTENTS LIMIT 1024)
|
file(READ "/home/abobkov/MyProjects/ESP-Nodes/ESP32-IDF_ESPNOW-Transmitter/build/CMakeFiles/git-data/HEAD" HEAD_CONTENTS LIMIT 1024)
|
||||||
|
|
||||||
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
|
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
|
||||||
set(GIT_DIR "/home/abobkov/MyProjects/ESP-Nodes/.git")
|
set(GIT_DIR "/home/abobkov/esp/v5.4.1/esp-idf/.git")
|
||||||
# handle git-worktree
|
# handle git-worktree
|
||||||
if(EXISTS "${GIT_DIR}/commondir")
|
if(EXISTS "${GIT_DIR}/commondir")
|
||||||
file(READ "${GIT_DIR}/commondir" GIT_DIR_NEW LIMIT 1024)
|
file(READ "${GIT_DIR}/commondir" GIT_DIR_NEW LIMIT 1024)
|
||||||
|
@@ -1 +1 @@
|
|||||||
77ff57c4fc34f963c63c2dd7a7bce6496277aa21
|
4c2820d377d1375e787bcef612f0c32c1427d183
|
||||||
|
@@ -23,8 +23,8 @@
|
|||||||
ESP32-C3 SuperMini MAC: 34:b7:da:f9:33:8d
|
ESP32-C3 SuperMini MAC: 34:b7:da:f9:33:8d
|
||||||
ESP32-C3 Breadboard MAC: e4:b0:63:17:9e:45
|
ESP32-C3 Breadboard MAC: e4:b0:63:17:9e:45
|
||||||
*/
|
*/
|
||||||
static uint8_t broadcast_mac[ESP_NOW_ETH_ALEN] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; // Broadcast MAC address
|
uint8_t broadcast_mac[ESP_NOW_ETH_ALEN] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; // Broadcast MAC address
|
||||||
static uint8_t receiver_mac[ESP_NOW_ETH_ALEN] = {0xE4, 0xB0, 0x63, 0x17, 0x9E, 0x45}; // MAC address of Robot
|
uint8_t receiver_mac[ESP_NOW_ETH_ALEN] = {0xE4, 0xB0, 0x63, 0x17, 0x9E, 0x45}; // MAC address of Robot
|
||||||
static uint8_t transmitter_mac[ESP_NOW_ETH_ALEN] = {0x34, 0xB7, 0xDA, 0xF9, 0x33, 0x8D}; // MAC address of Remote Control
|
uint8_t transmitter_mac[ESP_NOW_ETH_ALEN] = {0x34, 0xB7, 0xDA, 0xF9, 0x33, 0x8D}; // MAC address of Remote Control
|
||||||
|
|
||||||
#endif
|
#endif
|
@@ -36,11 +36,11 @@ typedef struct {
|
|||||||
uint8_t motor4_rpm_pcm;
|
uint8_t motor4_rpm_pcm;
|
||||||
} __attribute__((packed)) sensors_data_t;
|
} __attribute__((packed)) sensors_data_t;
|
||||||
|
|
||||||
static int x, y; // Joystick x and y positions
|
int x, y; // Joystick x and y positions
|
||||||
static adc_oneshot_unit_handle_t adc_xy_handle;
|
adc_oneshot_unit_handle_t adc_xy_handle;
|
||||||
static sensors_data_t buffer;
|
sensors_data_t buffer;
|
||||||
|
|
||||||
static esp_err_t joystick_adc_init() {
|
esp_err_t joystick_adc_init() {
|
||||||
adc_oneshot_unit_init_cfg_t adc_init_config_xy = {
|
adc_oneshot_unit_init_cfg_t adc_init_config_xy = {
|
||||||
.unit_id = ADC_UNIT_1,
|
.unit_id = ADC_UNIT_1,
|
||||||
.ulp_mode = ADC_ULP_MODE_DISABLE,
|
.ulp_mode = ADC_ULP_MODE_DISABLE,
|
||||||
@@ -61,18 +61,18 @@ static esp_err_t joystick_adc_init() {
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void joystick_show_raw_xy() {
|
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_0, &x));
|
||||||
ESP_ERROR_CHECK(adc_oneshot_read(adc_xy_handle, ADC1_CHANNEL_1, &y));
|
ESP_ERROR_CHECK(adc_oneshot_read(adc_xy_handle, ADC1_CHANNEL_1, &y));
|
||||||
ESP_LOGI(TAG, "( %d, %d )", x, y);
|
ESP_LOGI(TAG, "( %d, %d )", x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_joystick_xy(int *x_axis, int *y_axis) {
|
void get_joystick_xy(int *x_axis, int *y_axis) {
|
||||||
ESP_ERROR_CHECK(adc_oneshot_read(adc_xy_handle, ADC1_CHANNEL_0, x_axis));
|
ESP_ERROR_CHECK(adc_oneshot_read(adc_xy_handle, ADC1_CHANNEL_0, x_axis));
|
||||||
ESP_ERROR_CHECK(adc_oneshot_read(adc_xy_handle, ADC1_CHANNEL_1, y_axis));
|
ESP_ERROR_CHECK(adc_oneshot_read(adc_xy_handle, ADC1_CHANNEL_1, y_axis));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void joystick_task(void *arg) {
|
void joystick_task(void *arg) {
|
||||||
while (true) {
|
while (true) {
|
||||||
joystick_show_raw_xy();
|
joystick_show_raw_xy();
|
||||||
vTaskDelay (10 / portTICK_PERIOD_MS);
|
vTaskDelay (10 / portTICK_PERIOD_MS);
|
||||||
@@ -84,7 +84,7 @@ void deletePeer (void) {
|
|||||||
ESP_LOGE("ESP-NOW", "Could not delete peer");
|
ESP_LOGE("ESP-NOW", "Could not delete peer");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void statusDataSend(const uint8_t *mac_addr, esp_now_send_status_t status) {
|
void statusDataSend(const uint8_t *mac_addr, esp_now_send_status_t status) {
|
||||||
if (status == ESP_NOW_SEND_SUCCESS) {
|
if (status == ESP_NOW_SEND_SUCCESS) {
|
||||||
ESP_LOGI(TAG, "Data sent successfully to: %02X:%02X:%02X:%02X:%02X:%02X",
|
ESP_LOGI(TAG, "Data sent successfully to: %02X:%02X:%02X:%02X:%02X:%02X",
|
||||||
mac_addr[0], mac_addr[1], mac_addr[2],
|
mac_addr[0], mac_addr[1], mac_addr[2],
|
||||||
|
Reference in New Issue
Block a user