From d86a45680b500ebb8db0237b7c89213757d27efa Mon Sep 17 00:00:00 2001 From: luocai Date: Fri, 27 Dec 2024 18:10:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BC=82=E5=B8=B8=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E5=A4=84=E7=90=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DeviceConnection.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/DeviceConnection.cpp b/DeviceConnection.cpp index f998f16..413a26f 100644 --- a/DeviceConnection.cpp +++ b/DeviceConnection.cpp @@ -761,9 +761,15 @@ QString DeviceConnection::handleCommand(const std::string_view &replyText, const LOG(info) << "device factory reset"; } else if (function == "headdetectparam_getdata") { auto &data = reply.at("data").as_object(); - m_infomation.helmetThreshold = data.at("hatthreshold").as_int64(); - m_infomation.headThreshold = data.at("headthreshold").as_int64(); - m_infomation.detectFrameSize = data.at("detectframenum").as_int64(); + if (data.contains("hatthreshold")) { + m_infomation.helmetThreshold = data.at("hatthreshold").as_int64(); + } + if (data.contains("headthreshold")) { + m_infomation.headThreshold = data.at("headthreshold").as_int64(); + } + if (data.contains("detectframenum")) { + m_infomation.detectFrameSize = data.at("detectframenum").as_int64(); + } emit detectThresholdChanged(m_infomation.helmetThreshold, m_infomation.headThreshold, m_infomation.detectFrameSize); } else if (function == "thresholdwithhat_setdata") {