From 2819166dfd526412cdc5045131f3261bb5e0839b Mon Sep 17 00:00:00 2001 From: MistEO Date: Tue, 22 Nov 2022 00:46:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=B8=80=E7=A7=8D?= =?UTF-8?q?=E5=8F=AF=E8=83=BD=E7=9A=84minitouch=E6=96=B9=E5=90=91=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MeoAssistant/Controller.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/MeoAssistant/Controller.cpp b/src/MeoAssistant/Controller.cpp index d001b1001c..2f216f017c 100644 --- a/src/MeoAssistant/Controller.cpp +++ b/src/MeoAssistant/Controller.cpp @@ -1531,10 +1531,11 @@ bool asst::Controller::connect(const std::string& adb_path, const std::string& a call_and_hup_minitouch(m_adb.call_minitouch); std::string orientation_str = call_command(cmd_replace(adb_cfg.orientation)).value_or("0"); - auto [beg, end] = ranges::remove_if(orientation_str, [](char ch) -> bool { return !std::isdigit(ch); }); - orientation_str.erase(beg, end); if (!orientation_str.empty()) { - m_minitouch_props.orientation = std::stoi(orientation_str); + char first = orientation_str.front(); + if (first == '0' || first == '1' || first == '2' || first == '3') { + m_minitouch_props.orientation = static_cast(first - '0'); + } } // try to find the fastest way