Skip to content

Commit 24c5c1d

Browse files
committedJan 22, 2025
update
1 parent bfbe1f9 commit 24c5c1d

File tree

7 files changed

+50
-15
lines changed

7 files changed

+50
-15
lines changed
 

‎client/esp-ai/library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=esp-ai
2-
version=2.41.30
2+
version=2.41.32
33
author=小明IO
44
maintainer=1746809408@qq.com
55
sentence=ESP32 connects to the AI scheme library

‎client/esp-ai/src/globals.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "globals.h"
2727
#include <vector>
2828

29-
String ESP_AI_VERSION = "2.41.30";
29+
String ESP_AI_VERSION = "2.41.32";
3030

3131
String esp_ai_start_ed = "0";
3232
bool esp_ai_ws_connected = false;

‎client/esp-ai/src/private/get_position.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ void ESP_AI::get_position()
5555
if (httpCode2 > 0)
5656
{
5757
String payload = esp_ai_get_position_http.getString();
58-
Serial.printf("[HTTPS] GET code: %d\n", httpCode2);
59-
Serial.printf("[HTTPS] GET res: %d\n", payload);
58+
Serial.printf("[HTTPS] GET code: %d\n", httpCode2);
6059
JSONVar parse_res = JSON.parse(payload);
6160
if (parse_res.hasOwnProperty("desc"))
6261
{

‎client/esp-ai/src/private/on_repeatedly_click.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ void ESP_AI::on_repeatedly_click()
3939

4040
long last_btn_time = 0;
4141
int click_count = 0;
42-
int click_max_delay = 1000;
42+
int click_max_delay = 1000;
4343

4444
while (true)
4545
{
4646
int reading = digitalRead(reset_btn_config.pin);
4747
long curTime = millis();
4848
int target_val = reset_btn_config.power == "high" ? 1 : 0;
4949
if (reading == target_val)
50-
{
50+
{
5151
if ((curTime - esp_ai_last_debounce_time) > esp_ai_debounce_delay)
5252
{
5353
esp_ai_last_debounce_time = curTime;

‎client/esp-ai/src/sdk/begin.cpp

+7-8
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,14 @@ void ESP_AI::begin(ESP_AI_CONFIG config)
8585
reset_btn_config = config.reset_btn_config;
8686
}
8787
if (reset_btn_config.power == "high")
88-
{
89-
pinMode(wake_up_config.pin, INPUT_PULLDOWN);
88+
{
89+
pinMode(reset_btn_config.pin, INPUT_PULLDOWN);
9090
}
9191
else if (reset_btn_config.power == "low")
9292
{
93-
pinMode(wake_up_config.pin, INPUT_PULLUP);
93+
pinMode(reset_btn_config.pin, INPUT_PULLUP);
9494
}
9595

96-
// wake_up_scheme
9796
if (strcmp(config.wake_up_config.wake_up_scheme, "") != 0)
9897
{
9998
wake_up_config = config.wake_up_config;
@@ -112,15 +111,15 @@ void ESP_AI::begin(ESP_AI_CONFIG config)
112111
wake_up_config.vad_first = 5000;
113112
}
114113
if (!wake_up_config.vad_course)
115-
{
116-
wake_up_config.vad_course = 1500;
114+
{
115+
wake_up_config.vad_course = 1500;
117116
}
118117
}
119118
esp_ai_is_listen_model = (wake_up_scheme == "pin_high_listen" || wake_up_scheme == "pin_low_listen");
120119

121120
// 将按钮默认拉低
122-
if (wake_up_scheme != "pin_high" && wake_up_scheme != "pin_low" && reset_btn_config.power != "high" && reset_btn_config.power != "low")
123-
{
121+
if (wake_up_scheme != "pin_high" && wake_up_scheme != "pin_low" && config.reset_btn_config.power != "high" && config.reset_btn_config.power != "low")
122+
{
124123
pinMode(wake_up_config.pin, INPUT_PULLDOWN);
125124
}
126125

‎client/esp-ai/src/wakeUp/edge-impulse/main.cpp

+38-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,44 @@ void ESP_AI::capture_samples()
198198
/* read data at once from i2s */
199199
i2s_read(MIC_i2s_num, (void *)mic_sample_buffer, i2s_bytes_to_read, &bytes_read, 100);
200200
_is_silence = is_silence(mic_sample_buffer, bytes_read);
201-
201+
202+
// test...
203+
// if (_is_silence)
204+
// {
205+
// // 不是静默环境
206+
// if (last_silence_time_wakeup == 0)
207+
// {
208+
// last_not_silence_time_wekeup = 0;
209+
// last_silence_time_wakeup = millis();
210+
// if (esp_ai_sleep)
211+
// {
212+
// esp_ai_sleep = false;
213+
// }
214+
// }
215+
// // 计算静默时间
216+
// else if ((millis() - last_silence_time_wakeup) > 500)
217+
// {
218+
// // Enter sleep ing...
219+
// if (!esp_ai_sleep && ((millis() - last_silence_time_wakeup) / 1000 > 1000 * 60 * 1))
220+
// {
221+
// esp_ai_sleep = true;
222+
// }
223+
// }
224+
// }
225+
// else
226+
// {
227+
// // 不是有声环境
228+
// if (last_not_silence_time_wekeup == 0)
229+
// {
230+
// last_not_silence_time_wekeup = millis();
231+
// }
232+
// // 计算有声时间
233+
// else if ((millis() - last_not_silence_time_wekeup) > 500)
234+
// {
235+
// last_silence_time_wakeup = 0;
236+
// }
237+
// }
238+
202239
if (esp_ai_start_get_audio)
203240
{
204241
int vad = esp_ai_user_has_spoken ? wake_up_config.vad_course : wake_up_config.vad_first;
Binary file not shown.

0 commit comments

Comments
 (0)
Please sign in to comment.