From c74a49e3aeb33a3cb0b8cefcac45d60dc8577ee3 Mon Sep 17 00:00:00 2001 From: Stone Date: Tue, 2 Aug 2016 04:36:33 +0000 Subject: [PATCH] =?UTF-8?q?=E9=9C=80=E8=A6=81=E5=A4=87=E4=BB=BD=E6=97=A7?= =?UTF-8?q?=E7=9A=84=E7=AD=89=E5=BE=85=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Drivers/Esp8266/Esp8266.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Drivers/Esp8266/Esp8266.cpp b/Drivers/Esp8266/Esp8266.cpp index 709708a0..e7f4c7e2 100644 --- a/Drivers/Esp8266/Esp8266.cpp +++ b/Drivers/Esp8266/Esp8266.cpp @@ -393,7 +393,7 @@ String Esp8266::Send(const String& cmd, cstring expect, cstring expect2, uint ms if(block) return rs; } - + // 在接收事件中拦截 WaitExpect we; we.TaskID = task.ID; @@ -404,6 +404,9 @@ String Esp8266::Send(const String& cmd, cstring expect, cstring expect2, uint ms we.Key1 = expect; we.Key2 = expect2; + // 保存旧任务 + auto old = _Expect; + _Expect = &we; #if NET_DEBUG @@ -430,7 +433,8 @@ String Esp8266::Send(const String& cmd, cstring expect, cstring expect2, uint ms } we.Wait(msTimeout); - if(_Expect == &we) _Expect = nullptr; + //if(_Expect == &we) _Expect = nullptr; + _Expect = old; //if(rs.Length() > 4) rs.Trim();