@@ -680,9 +680,15 @@ void heartbeatsWatchdog() {
680
680
uint8_t disabledRevCommonHeartbeat[] = {0 };
681
681
for (int i = 0 ; i < heartbeatsRunning.size (); i++) {
682
682
if (sparkHeartbeatMap.contains (heartbeatsRunning[i])) {
683
+ // Clear the scheduled heartbeat that has outdated data so that the updated one gets sent out immediately
684
+ _sendCANMessage (descriptor, SPARK_HEARTBEAT_ID, disabledSparkHeartbeat, 8 , -1 );
685
+
683
686
_sendCANMessage (heartbeatsRunning[i], SPARK_HEARTBEAT_ID, disabledSparkHeartbeat, 8 , HEARTBEAT_PERIOD_MS);
684
687
}
685
688
if (revCommonHeartbeatMap.contains (heartbeatsRunning[i])) {
689
+ // Clear the scheduled heartbeat that has outdated data so that the updated one gets sent out immediately
690
+ _sendCANMessage (descriptor, REV_COMMON_HEARTBEAT_ID, disabledRevCommonHeartbeat, 1 , -1 );
691
+
686
692
_sendCANMessage (heartbeatsRunning[i], REV_COMMON_HEARTBEAT_ID, disabledRevCommonHeartbeat, 1 , HEARTBEAT_PERIOD_MS);
687
693
}
688
694
}
@@ -691,9 +697,15 @@ void heartbeatsWatchdog() {
691
697
heartbeatTimeoutExpired = false ;
692
698
for (int i = 0 ; i < heartbeatsRunning.size (); i++) {
693
699
if (auto heartbeatEntry = sparkHeartbeatMap.find (heartbeatsRunning[i]); heartbeatEntry != sparkHeartbeatMap.end ()) {
700
+ // Clear the scheduled heartbeat that has outdated data so that the updated one gets sent out immediately
701
+ _sendCANMessage (descriptor, SPARK_HEARTBEAT_ID, heartbeatEntry->second .data (), 8 , -1 );
702
+
694
703
_sendCANMessage (heartbeatsRunning[i], SPARK_HEARTBEAT_ID, heartbeatEntry->second .data (), 8 , HEARTBEAT_PERIOD_MS);
695
704
}
696
705
if (auto heartbeatEntry = revCommonHeartbeatMap.find (heartbeatsRunning[i]); heartbeatEntry != revCommonHeartbeatMap.end ()) {
706
+ // Clear the scheduled heartbeat that has outdated data so that the updated one gets sent out immediately
707
+ _sendCANMessage (descriptor, REV_COMMON_HEARTBEAT_ID, heartbeatEntry->second .data (), 1 , -1 );
708
+
697
709
_sendCANMessage (heartbeatsRunning[i], REV_COMMON_HEARTBEAT_ID, heartbeatEntry->second .data (), 1 , HEARTBEAT_PERIOD_MS);
698
710
}
699
711
}
0 commit comments