Closed holgerlembke closed 6 years ago
The sendCommand method was introduced only for calibration purposes where no response. However, it has to be as general as possible so I'll merge your pull request. Also, I'll refactor the code a bit to save backward compatibility.
I'm not sure whether the sendCommand approach works as intended.
If you do a
it assumes that the sensor instantly starts to send after sending the command and does it continuously instantly and so fast, that the µC always has data to poll away.
I think a better approach would be to just count the 9 bytes and encapsulate it with a timeout. (I never assume that I get all the data due to all sorts of things that could happen...)
Reason I mention is that I implemented a new function
and this happily reads the returned data from sendCommand.
In the end I think there needs to be some sort of redesign, whether sendCommand eats the returned data or allows to get it via rawdataread. For my simple solution I removed the reading and let sendCommand only do a send.