Implementing controller for Serial Gateway
-
Hi,
I started to develop a simple controller in Java, implementing node ID assignment and the most basic stuff to let mysensors work. The sensor data is then mirrored to MQTT, similar to the way Openhab 1.6 tutorial shows.With MySensors 1.6 and 2.0, I had about the same problem: flow control between controller and gateway.
Now I have a system having 3 threads:
- sending
- receiving
- listening for ACK packets, resending messages after a timeout
I have 16 relays controlling my lights in my home. If I send a command to each of them too fast, some messages gets lost. (I'm connecting over USB-serial, reproduced on Windows 10 and Raspberry Pi).
It actually turned out, if I wait about 350 milliseconds after sending a command, the system gets pretty stable. But... slow as well.
Can you please advice on how to properly implement flow control on a serial gateway? I know this should have a simple solution and I must be doing something wrong : )About buffering from Java side, I'm flushing my output stream be deterministic when waiting for that 350 ms.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login