Removed Magic number from MasterSlavePin
This commit is contained in:
parent
e4fa55d03f
commit
19b099270a
@ -379,9 +379,9 @@ static esp_err_t example_espnow_init(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void app_main(void) {
|
void app_main(void) {
|
||||||
gpio_reset_pin(23);
|
gpio_reset_pin(Master_SlavePin);
|
||||||
gpio_set_direction(23, GPIO_MODE_INPUT);
|
gpio_set_direction(Master_SlavePin, GPIO_MODE_INPUT);
|
||||||
int checkMaster = gpio_get_level(23);
|
int checkMaster = gpio_get_level(Master_SlavePin);
|
||||||
if (checkMaster == 0) {
|
if (checkMaster == 0) {
|
||||||
isMaster = true;
|
isMaster = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,13 @@
|
|||||||
#ifndef MAIN_H
|
#ifndef MAIN_H
|
||||||
#define MAIN_H
|
#define MAIN_H
|
||||||
|
|
||||||
|
#define Master_SlavePin 23
|
||||||
|
|
||||||
#define ESPNOW_QUEUE_SIZE 6
|
#define ESPNOW_QUEUE_SIZE 6
|
||||||
#define IS_BROADCAST_ADDR(addr) (memcmp(addr, s_example_broadcast_mac, ESP_NOW_ETH_ALEN) == 0)
|
#define IS_BROADCAST_ADDR(addr) (memcmp(addr, s_example_broadcast_mac, ESP_NOW_ETH_ALEN) == 0)
|
||||||
|
|
||||||
|
static bool isMaster;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EXAMPLE_ESPNOW_SEND_CB,
|
EXAMPLE_ESPNOW_SEND_CB,
|
||||||
EXAMPLE_ESPNOW_RECV_CB,
|
EXAMPLE_ESPNOW_RECV_CB,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user