repeat failed scans
This commit is contained in:
+6
-4
@@ -1,12 +1,14 @@
|
||||
# 22.4 (tbd)
|
||||
## Bug Fixes
|
||||
* fix some smaller glitches
|
||||
* fix some smaller glitches (short argument names, compilation on small devices, argument help)
|
||||
* fix revision in gh build for update check
|
||||
* fix for include instruction without subdirectory
|
||||
* add timeout to network device connection
|
||||
|
||||
## Features
|
||||
* add continuation of initial scan until it succeeded
|
||||
* add restart of device state when connection was reset
|
||||
* add KNX integration directly via KNXnet/IP multicast routing as well as via knxd client
|
||||
* add continuation to initial scan until succeeded as well as repetition to incomplete regular scan
|
||||
* add restart of enhanced device state when connection was reset
|
||||
* add KNX integration via KNXnet/IP multicast routing and optionally via knxd client
|
||||
|
||||
|
||||
# 22.3 (2022-05-08)
|
||||
|
||||
@@ -1677,7 +1677,7 @@ void BusHandler::formatGrabResult(bool unknown, OutputFormat outputFormat, ostri
|
||||
}
|
||||
}
|
||||
|
||||
symbol_t BusHandler::getNextScanAddress(symbol_t lastAddress) const {
|
||||
symbol_t BusHandler::getNextScanAddress(symbol_t lastAddress, bool withUnfinished) const {
|
||||
if (lastAddress == SYN) {
|
||||
return SYN;
|
||||
}
|
||||
@@ -1685,14 +1685,16 @@ symbol_t BusHandler::getNextScanAddress(symbol_t lastAddress) const {
|
||||
if (!isValidAddress(lastAddress, false) || isMaster(lastAddress)) {
|
||||
continue;
|
||||
}
|
||||
if ((m_seenAddresses[lastAddress]&(SEEN|LOAD_INIT)) == SEEN) {
|
||||
if ((m_seenAddresses[lastAddress]&(SEEN|LOAD_INIT)) == SEEN
|
||||
|| (withUnfinished && (m_seenAddresses[lastAddress]&(SEEN|SCAN_INIT|LOAD_INIT)) == (SEEN|LOAD_INIT))) {
|
||||
return lastAddress;
|
||||
}
|
||||
symbol_t master = getMasterAddress(lastAddress);
|
||||
if (master == SYN || (m_seenAddresses[master]&SEEN) == 0) {
|
||||
continue;
|
||||
}
|
||||
if ((m_seenAddresses[lastAddress]&LOAD_INIT) == 0) {
|
||||
if ((m_seenAddresses[lastAddress]&LOAD_INIT) == 0
|
||||
|| (withUnfinished && (m_seenAddresses[lastAddress]&(SCAN_INIT|LOAD_INIT)) == LOAD_INIT)) {
|
||||
return lastAddress;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -603,9 +603,10 @@ class BusHandler : public WaitThread {
|
||||
/**
|
||||
* Get the next slave address that still needs to be scanned or loaded.
|
||||
* @param lastAddress the last returned slave address, or 0 for returning the first one.
|
||||
* @param withUnfinished whether to include slave addresses that were not scanned yet.
|
||||
* @return the next slave address that still needs to be scanned or loaded, or @a SYN.
|
||||
*/
|
||||
symbol_t getNextScanAddress(symbol_t lastAddress) const;
|
||||
symbol_t getNextScanAddress(symbol_t lastAddress, bool withUnfinished) const;
|
||||
|
||||
/**
|
||||
* Set the state of the participant to configuration @a LOADED.
|
||||
|
||||
@@ -213,12 +213,16 @@ MainLoop::~MainLoop() {
|
||||
/** the initial delay for running the update check. */
|
||||
#define CHECK_INITIAL_DELAY (2*60)
|
||||
|
||||
/** the number of completed scan runs after which to try again failed ones. */
|
||||
#define SCAN_REPEAT_COUNT 6
|
||||
|
||||
void MainLoop::run() {
|
||||
bool reload = true;
|
||||
time_t lastTaskRun, now, start, lastSignal = 0, since, sinkSince = 1, nextCheckRun;
|
||||
int taskDelay = 5;
|
||||
symbol_t lastScanAddress = 0; // 0 is known to be a master
|
||||
scanStatus_t lastScanStatus = SCAN_STATUS_NONE;
|
||||
int scanCompleted = 0;
|
||||
time(&now);
|
||||
start = now;
|
||||
lastTaskRun = now;
|
||||
@@ -296,11 +300,15 @@ void MainLoop::run() {
|
||||
}
|
||||
}
|
||||
if (!loadDelay) {
|
||||
lastScanAddress = m_busHandler->getNextScanAddress(lastScanAddress);
|
||||
lastScanAddress = m_busHandler->getNextScanAddress(lastScanAddress, scanCompleted >= SCAN_REPEAT_COUNT);
|
||||
if (lastScanAddress == SYN) {
|
||||
taskDelay = 5;
|
||||
lastScanAddress = 0;
|
||||
scanStatus = SCAN_STATUS_FINISHED;
|
||||
scanCompleted++;
|
||||
if (scanCompleted > SCAN_REPEAT_COUNT) { // repeat failed scan only every Nth time
|
||||
scanCompleted = 0;
|
||||
}
|
||||
} else {
|
||||
scanStatus = SCAN_STATUS_RUNNING;
|
||||
nextCheckRun = now + CHECK_INITIAL_DELAY;
|
||||
|
||||
Reference in New Issue
Block a user