samsta / BatteryController

GNU General Public License v3.0
0 stars 0 forks source link

Implement a non-blocking read in USBInteface.cpp #23

Open JimsterCoder opened 10 months ago

JimsterCoder commented 10 months ago

It would be better, it seems, to not block when reading the data from the Teensy. This was as issue when I slowed the LBC CAN messages down to about 5/sec from each battery, (instead of 200/sec), but had the buffer size set to 1024. (each message is 25 bytes). BC would hang for several seconds waiting for USB data. This has been remedied by changing the buffer size to 64. I'm led to believe that the OS (driver) is buffering anyway, so there's little chance of actually losing data but it would be more proper to not block when reading. A quick look for a solution reveals that it is not a trivial change so should be done soon-ish.