App Wizard randomly fails
App Wizard fails in the beginning though the behaviour is random. The problem often happens when using bluetooth or TCP. I first thought this was the reason:
waitSignal(vesc->commands(), SIGNAL(fwVersionReceived(int,int,QString,QByteArray,bool)), 100);
But after changing to larger value (2000) the flow randomly fails in the different place
vesc->commands()->getAppConf();
if (!waitSignal(ap, SIGNAL(updated()), defaultTimeoutMs)) {
res = false; ⬅️ HERE
}
I don't know what is the reason, but I think blocking Utility::waitSignal with QEventLoop and QDialog::exec() do not play well together
Thanks for noticing, the 100 ms should have been 1000.
Running nested local event loops should not be a problem. QDialog::exec() opens a local event loop, which then in turn opens another one from waitSignal(). It might be better to use QDialog::open to avoid one of the event loops though.
It could be that packets get dropped in the communication now and then, as the UART does not use DMA and blocking the CPU for more than two bytes will drop the bytes. This can happen when storing the configuration to flash, as it completely blocks the CPU. Otherwise the UART interrupts should keep up easily at 115200 baudrate. One approach could be to make a utility function that reads and waits for the configuration with multiple retries. I will look into that soon.