I assume you pair - you have a connection - where you exchange data. So you would be able to even have handshake - ack / nack - to make sure your commands get thru.
On the sending side you can poll your controls and if do not notice any change (or change within boundaries) you do not send the information. When you send the information, you want to get it acknowledged - ack received for that command. If nack or any tampering has happened, you resend / retry. In addition to that you may also implement a heart bead. If your bolidJS does not get the beat anymore, it just stops. Ao you can make controler side a queue for outgoing commands. Feeding the queue you use the ui and handle it the same way: poll continuously and for each change you put a command into the buffer and trigger the working of the buffer. Just make sure you start every cycle with a setTimeout(... to break the JS execution streak (not hogging the only cpu you have). - Just some thoughts.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
@kri100s,
I assume you pair - you have a connection - where you exchange data. So you would be able to even have handshake - ack / nack - to make sure your commands get thru.
On the sending side you can poll your controls and if do not notice any change (or change within boundaries) you do not send the information. When you send the information, you want to get it acknowledged - ack received for that command. If nack or any tampering has happened, you resend / retry. In addition to that you may also implement a heart bead. If your bolidJS does not get the beat anymore, it just stops. Ao you can make controler side a queue for outgoing commands. Feeding the queue you use the ui and handle it the same way: poll continuously and for each change you put a command into the buffer and trigger the working of the buffer. Just make sure you start every cycle with a setTimeout(... to break the JS execution streak (not hogging the only cpu you have). - Just some thoughts.