diff --git a/src/MeoAssistant/Controller.cpp b/src/MeoAssistant/Controller.cpp index 285ea6294e..0fe21b49bf 100644 --- a/src/MeoAssistant/Controller.cpp +++ b/src/MeoAssistant/Controller.cpp @@ -497,17 +497,15 @@ bool asst::Controller::call_and_hup_minitouch(const std::string& cmd) std::string pipe_str; auto pipe_buffer = std::make_unique(PipeBuffSize); - DWORD peek_num = 0; - DWORD read_num = 0; - bool read_end = false; - auto start_time = std::chrono::steady_clock::now(); auto check_timeout = [&]() -> bool { using namespace std::chrono_literals; return std::chrono::steady_clock::now() - start_time < 10s; }; while (!need_exit() && !read_end && check_timeout()) { + DWORD peek_num = 0; + DWORD read_num = 0; while (PeekNamedPipe(m_minitouch_parent_wr, nullptr, 0, nullptr, &peek_num, nullptr) && peek_num > 0) { if (!ReadFile(m_minitouch_parent_wr, pipe_buffer.get(), PipeBuffSize, &read_num, nullptr)) { continue; @@ -517,7 +515,7 @@ bool asst::Controller::call_and_hup_minitouch(const std::string& cmd) continue; } Log.info("pipe str", Logger::separator::newline, pipe_str); - if (pipe_str.find('$') != std::string::npos) { + if (pipe_str.find('^') != std::string::npos) { read_end = true; break; } @@ -1032,7 +1030,7 @@ bool asst::Controller::swipe_without_scale(const Point& p1, const Point& p2, int x2 *= static_cast(m_minitouch_props.x_scaling); y2 *= static_cast(m_minitouch_props.y_scaling); - std::string minitouch_cmd = MinitouchCmd::down(x1, x2); + std::string minitouch_cmd = MinitouchCmd::down(x1, y2); if (duration == 0) { duration = 1000; } diff --git a/src/MeoAssistant/Controller.h b/src/MeoAssistant/Controller.h index 1ad941f9fd..7947b69b6c 100644 --- a/src/MeoAssistant/Controller.h +++ b/src/MeoAssistant/Controller.h @@ -204,7 +204,7 @@ namespace asst struct MinitouchCmd { - inline static constexpr int DefaultInterval = 50; + inline static constexpr int DefaultInterval = 10; inline static std::string reset() { return "r\n"; } inline static std::string commit() { return "c\n"; } inline static std::string down(int x, int y, bool with_commit = true, bool with_wait = true,