You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
88 lines
2.6 KiB
88 lines
2.6 KiB
4 months ago
|
////////////////////////////////////////////////////////////////////////////
|
||
|
///@copyright Copyright (c) 2018, 传控科技 All rights reserved.
|
||
|
///-------------------------------------------------------------------------
|
||
|
/// @file bsp_drv.c
|
||
|
/// @brief bsp @ driver config
|
||
|
///-------------------------------------------------------------------------
|
||
|
/// @version 1.0
|
||
|
/// @author CC
|
||
|
/// @date 20180331
|
||
|
/// @note cc_AS_stc02
|
||
|
//////////////////////////////////////////////////////////////////////////////
|
||
|
|
||
|
#include "../app/task_smartconfig.h"
|
||
|
#include "../app/app_config.h"
|
||
|
#include "../app/task_w600.h"
|
||
|
#include "../msp/uartx.h"
|
||
|
#include "../msp/uart0.h"
|
||
|
#include "../msp/uart2.h"
|
||
|
#include "../clib/clib.h"
|
||
|
|
||
|
|
||
|
S_TASK_SMART_CONFIG task_smartconfig;
|
||
|
|
||
|
|
||
|
void L3_task_SmartConfig_init(void)
|
||
|
{
|
||
|
L1_task_init(&task_smartconfig.task);
|
||
|
task_smartconfig.status = 0;
|
||
|
L3_task_s_go(task_smartconfig,D_task_init);
|
||
|
}
|
||
|
|
||
|
#define D_task_DETECTCHANGE 0x50
|
||
|
#define D_task_SAMRTCONFIG 0x51
|
||
|
#define D_task_SMARTCSUCCESS 0x52
|
||
|
#define D_task_SAMRTCSTOP 0x53
|
||
|
#define D_task_SAMRTCSTOPPED 0x54
|
||
|
|
||
|
|
||
|
void L3_task_SmartConfig_handler(S_TASK_SMART_CONFIG *s)
|
||
|
{
|
||
|
TTSS_Task_init()
|
||
|
L2_task_go(D_task_DETECTCHANGE);
|
||
|
L0_uart0_uc('*');
|
||
|
L0_uart0_uchex(task_smartconfig.status);
|
||
|
L0_uart0_uchex(s->status);
|
||
|
L0_uart0_0d0a();
|
||
|
L0_uart0_ulhex((U32)s);
|
||
|
|
||
|
TTSS_Task_step(D_task_DETECTCHANGE)
|
||
|
if(s->status != R.app_status)
|
||
|
{
|
||
|
|
||
|
task_smartconfig.status = R.app_status;
|
||
|
if(task_smartconfig.status == WIFI_CONFIG)
|
||
|
{
|
||
|
L0_uart0_sendstr("task_smartconfig.status == WIFI_CONFIG");
|
||
|
L3_gm35_send_str(AT_INS_ST_STARTSMART); //开启SmartC
|
||
|
L2_task_go_Tdelay(D_task_SAMRTCONFIG,D_Tdelay_500ms);
|
||
|
}
|
||
|
}
|
||
|
TTSS_Task_step(D_task_SAMRTCONFIG)
|
||
|
if(Lc_strStartsWith(ts_uart[uNum2].r.buf,"\r\nOK"))
|
||
|
{
|
||
|
L0_uart0_sendstr("SmartConfig Enter-->");
|
||
|
// 语音输出:进入配网模式,请配合手机
|
||
|
L2_task_go_Tdelay(D_task_SMARTCSUCCESS,D_Tdelay_300ms);
|
||
|
}
|
||
|
TTSS_Task_step(D_task_SMARTCSUCCESS)
|
||
|
if(Lc_strStartsWith(ts_uart[uNum2].r.buf,"\r\nsmartconfig type"))
|
||
|
{
|
||
|
L0_uart0_sendstr("SmartConfig Success!");
|
||
|
// 语音输出:配网模式成功,请重启设备
|
||
|
L2_task_go_Tdelay(D_task_SAMRTCSTOP,D_Tdelay_300ms);
|
||
|
}
|
||
|
TTSS_Task_step(D_task_SAMRTCSTOP)
|
||
|
L3_gm35_send_str(AT_INS_ST_STOPSMART);
|
||
|
L2_task_go_Tdelay(D_task_SAMRTCSTOPPED,D_Tdelay_300ms);
|
||
|
|
||
|
TTSS_Task_step(D_task_SAMRTCSTOPPED)
|
||
|
if (Lc_strStartsWith(ts_uart[uNum2].r.buf,"\r\nOK"))
|
||
|
{
|
||
|
L0_uart0_sendstr("SmartConfig Stop!");
|
||
|
R.app_status = WIFI_CONNECTED;
|
||
|
L2_task_go_Tdelay(D_task_DETECTCHANGE,D_Tdelay_300ms);
|
||
|
}
|
||
|
|
||
|
TTSS_Task_end();
|
||
|
}
|