From 19b099270a5e71df8e23267074b9f329b2fd0e6d Mon Sep 17 00:00:00 2001 From: simon Date: Fri, 13 Sep 2024 12:37:50 +0200 Subject: [PATCH] Removed Magic number from MasterSlavePin --- main/main.c | 6 +++--- main/main.h | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/main/main.c b/main/main.c index af8729c..13119d1 100644 --- a/main/main.c +++ b/main/main.c @@ -379,9 +379,9 @@ static esp_err_t example_espnow_init(void) { } void app_main(void) { - gpio_reset_pin(23); - gpio_set_direction(23, GPIO_MODE_INPUT); - int checkMaster = gpio_get_level(23); + gpio_reset_pin(Master_SlavePin); + gpio_set_direction(Master_SlavePin, GPIO_MODE_INPUT); + int checkMaster = gpio_get_level(Master_SlavePin); if (checkMaster == 0) { isMaster = true; } diff --git a/main/main.h b/main/main.h index 3352976..4ce2d73 100644 --- a/main/main.h +++ b/main/main.h @@ -1,9 +1,13 @@ #ifndef MAIN_H #define MAIN_H +#define Master_SlavePin 23 + #define ESPNOW_QUEUE_SIZE 6 #define IS_BROADCAST_ADDR(addr) (memcmp(addr, s_example_broadcast_mac, ESP_NOW_ETH_ALEN) == 0) +static bool isMaster; + typedef enum { EXAMPLE_ESPNOW_SEND_CB, EXAMPLE_ESPNOW_RECV_CB,