set minimum lock count to 3 as required by spec

This commit is contained in:
john30
2015-03-12 22:04:28 +01:00
parent 9fcda22ee5
commit cf17b7a93a
2 changed files with 5 additions and 5 deletions
+4 -4
View File
@@ -607,7 +607,7 @@ result_t BusHandler::setState(BusState state, result_t result, bool firstRepetit
if (master != SYN && !m_seenAddresses[master]) {
m_seenAddresses[master] = true;
m_masterCount++;
if (m_autoLockCount)
if (m_autoLockCount && m_masterCount>m_lockCount)
m_lockCount = m_masterCount;
logNotice(lf_bus, "new master %2.2x", master);
}
@@ -673,7 +673,7 @@ void BusHandler::receiveCompleted()
unsigned char srcAddress = m_command[0], dstAddress = m_command[1];
if (isMaster(srcAddress) && !m_seenAddresses[srcAddress]) {
m_masterCount++;
if (m_autoLockCount)
if (m_autoLockCount && m_masterCount>m_lockCount)
m_lockCount = m_masterCount;
logNotice(lf_bus, "new master %2.2x", srcAddress);
}
@@ -685,7 +685,7 @@ void BusHandler::receiveCompleted()
logInfo(lf_update, "update MM cmd: %s", m_command.getDataStr().c_str());
if (!m_seenAddresses[dstAddress]) {
m_masterCount++;
if (m_autoLockCount)
if (m_autoLockCount && m_masterCount>m_lockCount)
m_lockCount = m_masterCount;
logNotice(lf_bus, "new master %2.2x", dstAddress);
}
@@ -697,7 +697,7 @@ void BusHandler::receiveCompleted()
if (masterAddr != SYN && !m_seenAddresses[masterAddr]) {
m_seenAddresses[masterAddr] = true;
m_masterCount++;
if (m_autoLockCount)
if (m_autoLockCount && m_masterCount>m_lockCount)
m_lockCount = m_masterCount;
logNotice(lf_bus, "new master %2.2x", masterAddr);
}
+1 -1
View File
@@ -270,7 +270,7 @@ public:
m_ownMasterAddress(ownAddress), m_ownSlaveAddress((unsigned char)(ownAddress+5)), m_answer(answer),
m_busLostRetries(busLostRetries), m_failedSendRetries(failedSendRetries),
m_busAcquireTimeout(busAcquireTimeout), m_slaveRecvTimeout(slaveRecvTimeout),
m_masterCount(1), m_autoLockCount(lockCount==0), m_lockCount(lockCount==0 ? 1 : lockCount), m_remainLockCount(m_autoLockCount),
m_masterCount(1), m_autoLockCount(lockCount==0), m_lockCount(lockCount<=3 ? 3 : lockCount), m_remainLockCount(m_autoLockCount),
m_pollInterval(pollInterval), m_lastReceive(0), m_lastPoll(0),
m_currentRequest(NULL), m_nextSendPos(0),
m_symPerSec(0), m_maxSymPerSec(0),