-
-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed GUI crashes on RaspberryPi. #221
Conversation
Fixed #216 |
Gijs, welkom! Before merging the request, I would like to understand what issue is being resolved. I will study your code suggestions asap; and do some other question-answering first. |
Hi Wouter, The problem arises because a separate Thread is started after the RunOff or Start button is pressed. In FortiusANTGui.py this results in calling callRunOff() in a "non-gui" thread and not the main wx thread (line 1193) the same issue is with callTacx2Dongle() (line 1233). This results in calling setValues() and setMessages() in GuiMessage2Main() from the "non-gui Thread", and in these functions all the updates to the GUI are executed. It took me quite a while to find this little nasty bug. |
Looking at your implementation I would prefer below code
because it allows "anybody" to call SetValues() and solve the problem once. I was not aware that wx had to be called from the main thread only. PS: Same construct to be done for SetMessages() and PedalStrokeAnalysis() |
Please check https://github.com/WouterJD/FortiusANT/blob/%23216-GUI-crash-on-raspberry/pythoncode/FortiusAntGui.py I have done a quick test, verifying functionality. Similar issues are resolved in [Stop] button after [Runoff] and [Start] |
@wouter, I totally agree with you, the solution you proposed is cleaner and more robust. I just tested it in simulation mode, and it runs just as smoothly as the fixes I tried before. And that makes sense. Thanks alot, I will close the PR. |
Hi Wouter,
I tested my fixes today with my Tacx and succesfully made my first trip on Zwift.
The mx.CallAfters() around the update of the gauges might not be absolutely necessary but for the responsiveness of the GUI buttons I think it is a huge improvement. All the other locations have the risk of being called from another than the GUI thread.