thijse / Arduino-CmdMessenger

CmdMessenger Communication library for Arduino & .NET
Other
208 stars 87 forks source link

sendCmd can't wait for a response in a typical RS-485 configuration. #14

Closed miscbill closed 7 years ago

miscbill commented 8 years ago

I'm using RS-485 in a single-duplex, master-slave arrangement. After transmitting a command, the master must turn off its line driver to allow the slave to respond. This means that I can't use sendEndCmd()'s optional ackCmdId and timeout arguments, since the line driver will still be active when blockedTillReply() runs.

In my my copy, I've added a public waitForReply() that simply wraps the private blockedTillReply(). With that change, the master can sendCmdEnd(), turn off it's driver, and then waitForReply(). This works fine for me. But maybe you have a more creative solution.

thijse commented 7 years ago

I like that solution. Possibly it is only useful in rare cases, but it does not add much complexity.