imurvai / brickcontroller2

Cross platform application for controlling Lego creations using a bluetooth gamepad.
107 stars 31 forks source link

Improve BuWizz 3.0 communication reliability #119

Open BrickExperimentChannel opened 2 months ago

BrickExperimentChannel commented 2 months ago

I have a suggestion on how to improve the BuWizz 3.0 communication reliability.

Re-send the last message after 200 ms of inactivity, then re-send it again after 600 ms of inactivity. I've tested this improves the reliability a little.

It reduces the worst cases, where you cannot stop your Lego vehicle from driving to a wall because the communication is having a 2 second halt.

Also, I noticed that the _sendAttemptsLeft implementation you've done is never used, because the sends always succeed, even when the communication is not working.

My reference implementation in BuWizz3Device::ProcessOutputsAsync https://www.dropbox.com/scl/fo/mr4h8oyet4d2gzv78ra3k/AAPulxX1pFI_cAGAQ5Howok?dl=0&e=1&preview=com.scn.BrickController2_source.zip&rlkey=5nmbh3femf4sto95rvriucnvn

imurvai commented 1 month ago

Thanks for the suggestion, I'll check it.