Skip to content

Commit f21bf4b

Browse files
committed
Fix boot button conflict with ethernet
1 parent 9411a3c commit f21bf4b

File tree

5 files changed

+37
-6
lines changed

5 files changed

+37
-6
lines changed

solutions/doorbell_demo/main/common.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ void query_webrtc(void);
4848
*/
4949
int stop_webrtc(void);
5050

51+
/**
52+
* @brief Send command to peer
53+
*/
54+
void send_cmd(char *cmd);
55+
5156
#ifdef __cplusplus
5257
}
5358
#endif

solutions/doorbell_demo/main/main.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ static int leave_room(int argc, char **argv)
6767
return 0;
6868
}
6969

70+
static int cmd_cli(int argc, char **argv)
71+
{
72+
send_cmd(argc > 1 ? argv[1] : "ring");
73+
return 0;
74+
}
75+
7076
static int assert_cli(int argc, char **argv)
7177
{
7278
*(int *)0 = 0;
@@ -138,6 +144,11 @@ static int init_console()
138144
.help = "Leave from room\n",
139145
.func = leave_room,
140146
},
147+
{
148+
.command = "cmd",
149+
.help = "Send command (ring etc)\n",
150+
.func = cmd_cli,
151+
},
141152
{
142153
.command = "i",
143154
.help = "Show system status\r\n",

solutions/doorbell_demo/main/settings.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ extern "C" {
4242

4343
/**
4444
* @brief GPIO for ring button
45+
*
46+
* @note When use ESP32P4-Fuction-Ev-Board, GPIO35(boot button) is connected RMII_TXD1
47+
* Which will cause socket error
48+
* User must replace it to a unused GPIO instead (like GPIO27)
4549
*/
4650
#define DOOR_BELL_RING_BUTTON 35
4751

solutions/doorbell_demo/main/webrtc.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,18 @@ static int webrtc_event_handler(esp_webrtc_event_t *event, void *ctx)
114114
return 0;
115115
}
116116

117+
void send_cmd(char *cmd)
118+
{
119+
if (SAME_STR(cmd, "ring")) {
120+
SEND_CMD(webrtc, DOOR_BELL_RING_CMD);
121+
ESP_LOGI(TAG, "Ring button on state %d", door_bell_state);
122+
if (door_bell_state < DOOR_BELL_STATE_CONNECTING) {
123+
door_bell_state = DOOR_BELL_STATE_RINGING;
124+
play_tone(DOOR_BELL_TONE_RING);
125+
}
126+
}
127+
}
128+
117129
static void key_monitor_thread(void *arg)
118130
{
119131
gpio_config_t io_conf;
@@ -134,12 +146,7 @@ static void key_monitor_thread(void *arg)
134146
if (level != last_level) {
135147
last_level = level;
136148
if (level != init_level) {
137-
SEND_CMD(webrtc, DOOR_BELL_RING_CMD);
138-
ESP_LOGI(TAG, "Ring button on state %d", door_bell_state);
139-
if (door_bell_state < DOOR_BELL_STATE_CONNECTING) {
140-
door_bell_state = DOOR_BELL_STATE_RINGING;
141-
play_tone(DOOR_BELL_TONE_RING);
142-
}
149+
send_cmd("ring");
143150
}
144151
}
145152
}

solutions/videocall_demo/main/settings.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ extern "C" {
4242

4343
/**
4444
* @brief GPIO for ring button
45+
*
46+
* @note When use ESP32P4-Fuction-Ev-Board, GPIO35(boot button) is connected RMII_TXD1
47+
* Which will cause socket error
48+
* User must replace it to a unused GPIO instead (like GPIO27)
4549
*/
4650
#define VIDEO_CALL_RING_BUTTON 35
4751

0 commit comments

Comments
 (0)