REVrobotics / CANBridge

Generic CAN Bridge emulating FRC netcomm CAN driver for connecting a PC to the CAN Bus with WPILib 2020+ and SPARK MAX (FW 1.5.0 or higher) or other drivers, currently only supported in Windows.
Other
11 stars 5 forks source link

Only remove elements matching the id we're throwing out #25

Closed LandryNorris closed 6 months ago

LandryNorris commented 6 months ago

We shouldn't clear all frames, just the one we wanted to, when setting interval to -1

LandryNorris commented 6 months ago

Tested with the following ts:


console.log("Starting CAN Message")
CanBridge.sendCANMessage(descriptor, 0xCBA321, [0x12, 0x34, 0x56, 0x78], 150)
await new Promise((resolve) => setTimeout(resolve, 2000));

console.log("Starting second message")
CanBridge.sendCANMessage(descriptor, 0xABC321, [0x12, 0x34, 0x56, 0x78], 100)
await new Promise((resolve) => setTimeout(resolve, 2000));

console.log("Stopping non-existent")
CanBridge.sendCANMessage(descriptor, 0x1234, [0x12, 0x34, 0x56, 0x78], -1)
await new Promise((resolve) => setTimeout(resolve, 2000));

console.log("Starting third message")
CanBridge.sendCANMessage(descriptor, 0x1234, [0x12, 0x34, 0x56, 0x78], 100)
await new Promise((resolve) => setTimeout(resolve, 2000));

console.log("Stopping existing")
CanBridge.sendCANMessage(descriptor, 0xABC321, [0x12, 0x34, 0x56, 0x78], -1)
await new Promise((resolve) => setTimeout(resolve, 2000));