From aae9d8da2f2c24c643cfc1b67064afefd0c21b36 Mon Sep 17 00:00:00 2001 From: krad Date: Fri, 25 Feb 2022 15:59:22 +0800 Subject: [PATCH] double check state for stop --- src/device/DeviceManager.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/device/DeviceManager.cpp b/src/device/DeviceManager.cpp index f947d6b..df1a367 100644 --- a/src/device/DeviceManager.cpp +++ b/src/device/DeviceManager.cpp @@ -85,8 +85,13 @@ void DeviceManager::initDevice() { // check device status========================================= //device is ready return if (inf.status != SCANNING) { - TRIGGER_EVENT(GUIEvents::ResponseStop, nullptr, nullptr); - return; + //double check + QThread::msleep(100); + inf = GetStatus(); + if (inf.status != SCANNING){ + TRIGGER_EVENT(GUIEvents::ResponseStop, nullptr, nullptr); + return; + } } // if (inf.status == BUSY) { // QString msg("Device is busy, Stop operation fail!"); @@ -293,7 +298,7 @@ void DeviceManager::processScan(const char* json, bool empty) { lastStatus = SCANNING; previewing = false; qDebug() << "Start progress timer"; - timerID = startTimer(300); + timerID = startTimer(500); return; } QString errmsg("ScanControl start fail!");