Removed Magic number from MasterSlavePin

This commit is contained in:
simon 2024-09-13 12:37:50 +02:00
parent e4fa55d03f
commit 19b099270a
2 changed files with 7 additions and 3 deletions

View File

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

View File

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