【已解决】esp8266/8285SDK,获取本地时间及配置上电配网问题

Wi-Fi 设备、Wi-Fi 低功耗设备、Wi-Fi BLE 双模设备、Ethernet设备、Ethernet+Wi-Fi设备等
Post Reply
cheng_JS
Posts: 117

1.我调用tuya_get_local_time函数获取时间,一旦获取就会出现重启,用的是8285芯片,log在附件中,帮忙看看;
struct tm *st_time;

if(my_wf_sta == STAT_STA_CONN)
if((get_time++) == 10)
{
PR_NOTICE("I GOT TIME!!!!");
get_time = 0;
tuya_get_local_time(st_time);
PR_NOTICE("tm_wday:%d tm_min:%d ", st_time->tm_wday,st_time->tm_min);
}
2.我想配置成上电配网模式,开了一个定时器,在定时器回调函数调用tuya_dev_reset_factory函数,让设备上电配网,但会出现一上电,灯闪烁异常,一直配不上;
op_ret = sys_add_timer(mysave_pw_cb, NULL, &my_pw_timer);
if (OPRT_OK != op_ret)
{
return op_ret;
} else
{
sys_start_timer(my_pw_timer, 5000, TIMER_ONCE);
}

STATIC VOID mysave_pw_cb(UINT timerID,PVOID pTimerArg)
{
tuya_dev_reset_factory();
}

Attachments
esp8258.txt
(9.21 KiB) Downloaded 91 times
35900.png
IoT_developer
Posts: 8

Re: esp8266/8285SDK,获取本地时间及配置上电配网问题

struct tm *st_time,需要分配内存空间;
或者修改为
struct tm st_time;
tuya_get_local_time(&st_time);

IoT_developer
Posts: 8

Re: esp8266/8285SDK,获取本地时间及配置上电配网问题

上电立即配网修改函数
VOID app_init(VOID) {
//set_console(FALSE); /* 设置日志打印IO 为 TX --- 注释此行则打印口 IO2 */

Code: Select all

/* 设置WIFI 模式 */
tuya_app_cfg_set(WCM_LOW_POWER, prod_test);

}
修改WCM_LOW_POWER为WCM_OLD

cheng_JS
Posts: 117

Re: esp8266/8285SDK,获取本地时间及配置上电配网问题

两个问题都解决了,感谢

Post Reply