需要备份旧的等待事件

This commit is contained in:
Stone 2016-08-02 04:36:33 +00:00
parent d698501b40
commit c74a49e3ae
1 changed files with 6 additions and 2 deletions

View File

@ -393,7 +393,7 @@ String Esp8266::Send(const String& cmd, cstring expect, cstring expect2, uint ms
if(block) return rs; if(block) return rs;
} }
// 在接收事件中拦截 // 在接收事件中拦截
WaitExpect we; WaitExpect we;
we.TaskID = task.ID; we.TaskID = task.ID;
@ -404,6 +404,9 @@ String Esp8266::Send(const String& cmd, cstring expect, cstring expect2, uint ms
we.Key1 = expect; we.Key1 = expect;
we.Key2 = expect2; we.Key2 = expect2;
// 保存旧任务
auto old = _Expect;
_Expect = &we; _Expect = &we;
#if NET_DEBUG #if NET_DEBUG
@ -430,7 +433,8 @@ String Esp8266::Send(const String& cmd, cstring expect, cstring expect2, uint ms
} }
we.Wait(msTimeout); we.Wait(msTimeout);
if(_Expect == &we) _Expect = nullptr; //if(_Expect == &we) _Expect = nullptr;
_Expect = old;
//if(rs.Length() > 4) rs.Trim(); //if(rs.Length() > 4) rs.Trim();