即使没有打开学习模式,如果是已有设备来组网,也应该给予响应

This commit is contained in:
nnhy 2015-12-16 10:06:08 +00:00
parent e3003bd140
commit 43b0bd7848
1 changed files with 6 additions and 6 deletions

View File

@ -187,12 +187,6 @@ bool TinyServer::OnJoin(const TinyMessage& msg)
TS("TinyServer::OnJoin");
if(!Study)
{
debug_printf("非学习模式禁止加入\r\n");
return false;
}
// 如果设备列表没有这个设备,那么加进去
byte id = msg.Src;
if(!id) return false;
@ -207,6 +201,12 @@ bool TinyServer::OnJoin(const TinyMessage& msg)
auto dv = FindDevice(dm.HardID);
if(!dv)
{
if(!Study)
{
debug_printf("非学习模式禁止加入\r\n");
return false;
}
// 从1开始派ID
id = 1;
while(FindDevice(++id) != NULL && id < 0xFF);