From 9c74288ba9673c649d9692c4938cbc3d11712c5c Mon Sep 17 00:00:00 2001 From: John Date: Fri, 16 Jun 2023 19:23:32 +0200 Subject: [PATCH] delay check only if scan succeeded --- src/ebusd/mainloop.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ebusd/mainloop.cpp b/src/ebusd/mainloop.cpp index 4f426f03..ee5be00f 100644 --- a/src/ebusd/mainloop.cpp +++ b/src/ebusd/mainloop.cpp @@ -317,13 +317,13 @@ void MainLoop::run() { } } else { scanStatus = SCAN_STATUS_RUNNING; - nextCheckRun = now + CHECK_INITIAL_DELAY; result_t result = m_busHandler->scanAndWait(lastScanAddress, true); taskDelay = (result == RESULT_ERR_NO_SIGNAL) ? 10 : 1; if (result != RESULT_OK) { logError(lf_main, "scan config %2.2x: %s", lastScanAddress, getResultCode(result)); } else { logInfo(lf_main, "scan config %2.2x message received", lastScanAddress); + nextCheckRun = now + CHECK_INITIAL_DELAY; // delay update check due to new scan data } } } @@ -354,6 +354,7 @@ void MainLoop::run() { #endif PACKAGE_NAME "/" PACKAGE_VERSION)) { logError(lf_main, "update check connect error"); + nextCheckRun = now + CHECK_INITIAL_DELAY; } else { ostringstream ostr; ostr << "{\"v\":\"" PACKAGE_VERSION "\",\"r\":\"" REVISION << "\"" @@ -394,8 +395,8 @@ void MainLoop::run() { } } } + nextCheckRun = now + CHECK_DELAY; } - nextCheckRun = now + CHECK_DELAY; } time(&lastTaskRun); }