Skip to content

Commit 8aa45f1

Browse files
author
NoahAndrews
committed
Increase the SPARK heartbeat period to 20ms
1 parent 6e14197 commit 8aa45f1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/canWrapper.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
#define DEVICE_NOT_FOUND_ERROR "Device not found. Make sure to run getDevices()"
2424

25+
#define HEARTBEAT_PERIOD_MS 20
26+
2527
rev::usb::CandleWinUSBDriver* driver = new rev::usb::CandleWinUSBDriver();
2628

2729
std::set<std::string> devicesRegisteredToHal; // TODO(Noah): Protect with mutex
@@ -692,7 +694,7 @@ void startRevCommonHeartbeat(const Napi::CallbackInfo& info) {
692694
}
693695

694696
uint8_t payload[] = {1};
695-
_sendCANMessage(descriptor, 0x00502C0, payload, 1, 20);
697+
_sendCANMessage(descriptor, 0x00502C0, payload, 1, HEARTBEAT_PERIOD_MS);
696698

697699
std::scoped_lock lock{watchdogMtx};
698700

@@ -738,7 +740,7 @@ void setSparkMaxHeartbeatData(const Napi::CallbackInfo& info) {
738740
_sendCANMessage(descriptor, 0x2052C80, heartbeat, 8, -1);
739741
}
740742
else {
741-
_sendCANMessage(descriptor, 0x2052C80, heartbeat, 8, 10);
743+
_sendCANMessage(descriptor, 0x2052C80, heartbeat, 8, HEARTBEAT_PERIOD_MS);
742744

743745
std::scoped_lock lock{watchdogMtx};
744746

0 commit comments

Comments
 (0)