Commit 96051595 authored by DESKTOP-MC5UL36\dell's avatar DESKTOP-MC5UL36\dell

增加扫码配wifi功能

parent 1ff4fcfc
#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(); // 销毁自控的线程
......
This diff is collapsed.
#ifndef WIFI_AUTOCONFIG_H__
#define WIFI_AUTOCONFIG_H__
// 启动断网自动配网流程
void check_and_autoconfig_wifi();
// 播放指定名称的音频文件 (位于 ~/audio/ 目录下)
void play_audio_file(const char *filename);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment