Skip to content

Commit 77589c7

Browse files
authored
Merge pull request #515 from LeeLeahy2/link-break
Use a single link break multiplier
2 parents 3fc2e62 + eb9171c commit 77589c7

File tree

4 files changed

+5
-7
lines changed

4 files changed

+5
-7
lines changed

Firmware/LoRaSerial/Commands.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ bool commandAT(const char * commandString)
8787
case ('B'): //ATB - Break the link
8888

8989
//Compute the time delay
90-
delayMillis = (VC_LINK_BREAK_MULTIPLIER + 2) * settings.heartbeatTimeout;
90+
delayMillis = (LINK_BREAK_MULTIPLIER + 2) * settings.heartbeatTimeout;
9191

9292
//Warn the user of the delay
9393
systemPrint("Delaying ");
@@ -111,7 +111,7 @@ bool commandAT(const char * commandString)
111111
//Idle the system to break the link
112112
//This is required on the server system which does not request an VC number assignment
113113
timer = millis();
114-
while ((millis() - timer) < ((VC_LINK_BREAK_MULTIPLIER + 2) * settings.heartbeatTimeout))
114+
while ((millis() - timer) < ((LINK_BREAK_MULTIPLIER + 2) * settings.heartbeatTimeout))
115115
petWDT();
116116
changeState(RADIO_RESET);
117117

Firmware/LoRaSerial/States.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,7 @@ void updateRadioState()
988988
//----------
989989
//Always check for link timeout
990990
//----------
991-
if ((millis() - linkDownTimer) >= (P2P_LINK_BREAK_MULTIPLIER * settings.heartbeatTimeout))
991+
if ((millis() - linkDownTimer) >= (LINK_BREAK_MULTIPLIER * settings.heartbeatTimeout))
992992
//Break the link
993993
breakLink();
994994
break;
@@ -2486,7 +2486,7 @@ void updateRadioState()
24862486
//Determine if the link has timed out
24872487
vc = &virtualCircuitList[index];
24882488
if ((vc->vcState != VC_STATE_LINK_DOWN) && (serverLinkBroken
2489-
|| ((currentMillis - vc->lastTrafficMillis) > (VC_LINK_BREAK_MULTIPLIER * settings.heartbeatTimeout))))
2489+
|| ((currentMillis - vc->lastTrafficMillis) > (LINK_BREAK_MULTIPLIER * settings.heartbeatTimeout))))
24902490
{
24912491
if (index == VC_SERVER)
24922492
{

Firmware/LoRaSerial/Virtual_Circuit_Protocol.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@
6464
#define VC_HB_CHANNEL (VC_HB_CHANNEL_TIMER + sizeof(uint16_t))
6565
#define VC_HB_END (VC_HB_CHANNEL + sizeof(uint8_t))
6666

67-
#define VC_LINK_BREAK_MULTIPLIER 3 //Number of missing HEARTBEAT timeouts
68-
6967
//ASCII characters
7068
#define START_OF_VC_SERIAL 0x02 //From ASCII table - Start of Text
7169

Firmware/LoRaSerial/settings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ typedef enum
4343

4444
RadioStates radioState = RADIO_RESET;
4545

46-
#define P2P_LINK_BREAK_MULTIPLIER 3
46+
#define LINK_BREAK_MULTIPLIER 3
4747

4848
typedef struct _RADIO_STATE_ENTRY
4949
{

0 commit comments

Comments
 (0)