Skip to content

Commit

Permalink
Retry immediately after processing incoming data after a CAN / NAK
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkGodwin committed Jan 30, 2021
1 parent b6f93e4 commit d1306a4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions cpp/src/Defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ namespace OpenZWave
#define MAX_TRIES 1 // set this to one, as I believe now that a ACK failure is indication that the device is offline, hence additional attempts will not work.
#define MAX_MAX_TRIES 7 // Don't exceed this retry limit
#define ACK_TIMEOUT 1000 // How long to wait for an ACK
#define CAN_NAK_TIMEOUT 0 // How long to wait before re-transmit after a CAN.
#define BYTE_TIMEOUT 150
//#define RETRY_TIMEOUT 40000 // Retry send after 40 seconds
#define RETRY_TIMEOUT 10000 // Retry send after 10 seconds (we might need to keep this below 10 for Security CC to function correctly)
Expand Down
4 changes: 3 additions & 1 deletion cpp/src/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,9 @@ void Driver::DriverThreadProc(Internal::Platform::Event* _exitEvent)
else if (m_waitingForAck || m_expectedCallbackId || m_expectedReply)
{
count = 4;
timeout = m_waitingForAck ? ACK_TIMEOUT : retryTimeStamp.TimeRemaining();
timeout = !m_waitingForAck ? retryTimeStamp.TimeRemaining() :
m_currentMsg != NULL && m_currentMsg->isResendDuetoCANorNAK() ? CAN_NAK_TIMEOUT :
ACK_TIMEOUT;
if (timeout < 0)
{
timeout = 0;
Expand Down

0 comments on commit d1306a4

Please sign in to comment.