Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
car-controlserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenzhongjian
car-controlserver
Commits
96051595
Commit
96051595
authored
Feb 06, 2026
by
DESKTOP-MC5UL36\dell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加扫码配wifi功能
parent
1ff4fcfc
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
8 deletions
+30
-8
main.c
app/main/main.c
+20
-8
wifi_autoconfig.c
app/main/wifi_autoconfig.c
+0
-0
wifi_autoconfig.h
app/main/wifi_autoconfig.h
+10
-0
No files found.
app/main/main.c
View file @
96051595
#include "main.h"
#include "wifi_autoconfig.h"
int
main
()
{
...
...
@@ -25,6 +26,20 @@ int main()
return
-
4
;
}
// 初始化音频,确保配网时的提示音能听到
if
(
audio_config_init
()
!=
0
)
{
my_zlog_warn
(
"音频配置初始化失败"
);
}
if
(
audio_init
()
==
0
)
{
my_zlog_info
(
"音频命令执行初始化成功"
);
}
// 3. 在这里检查网络。如果没网 -> 进入扫码配网 (死循环直到成功)
check_and_autoconfig_wifi
();
if
(
request_date
()
!=
0
)
{
my_zlog_error
(
"请求数据失败"
);
...
...
@@ -50,10 +65,7 @@ int main()
return
-
8
;
}
if
(
audio_config_init
()
!=
0
)
{
my_zlog_warn
(
"音频配置初始化失败"
);
}
// 音频初始化已移至开头
if
(
hardware_iic_init
()
!=
0
)
{
...
...
@@ -66,10 +78,7 @@ int main()
my_zlog_warn
(
"该设备没有冷却"
);
}
if
(
audio_init
()
==
0
)
{
my_zlog_info
(
"音频命令执行初始化成功"
);
}
int
thread_rc
=
thread_start_init
(
thread_exit_time
,
thread_mqtt_beat
,
thread_open_browser
,
thread_mqtt_reconnect
,
thread_time_calculation
,
thread_play_mp3
);
...
...
@@ -79,6 +88,9 @@ int main()
return
-
7
;
}
// 初始化全部完成,播放“连接成功”提示音,作为系统就绪的标志
play_audio_file
(
"connectionSuccessful.mp3"
);
thread_end_close
();
device_end_close
(
g_device_type
);
self_control_thread_close
();
// 销毁自控的线程
...
...
app/main/wifi_autoconfig.c
0 → 100644
View file @
96051595
This diff is collapsed.
Click to expand it.
app/main/wifi_autoconfig.h
0 → 100644
View file @
96051595
#ifndef WIFI_AUTOCONFIG_H__
#define WIFI_AUTOCONFIG_H__
// 启动断网自动配网流程
void
check_and_autoconfig_wifi
();
// 播放指定名称的音频文件 (位于 ~/audio/ 目录下)
void
play_audio_file
(
const
char
*
filename
);
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment