-
Notifications
You must be signed in to change notification settings - Fork 438
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
Improve performance of incoming serial processing #447
Comments
I imagine it's in every version, I don't believe the REPL for m:b/cp has a separate thread so it will take the GUI with it Raw thoughts: Serial comms thread? |
+1 on serial comms thread (and it shouldn't be too hard to implement with Qt's message passing). |
The serial data in and out is managed by QSerialPort and propagated via signals, and it's probably a fair assumption to say that Qt has designed that to be non-blocking (although it's an assumption worth contesting). |
I've replicated this with my CPE and micro:bit on Linux. I was under the same impression as @carlosperate when it came to QSerialPort's use of signals etc... but this still appears to block the UI thread. I'm going to take a look and try to work out what's going on. |
So, AFAICT the problem is that the Two solutions:
Thoughts on the best approach? The first is simple, the second (much) less so. |
Hmmm... of course, it works on Mac, but not Linux. sigh Perhaps my assumption above isn't correct after all. :-/ Suggestions welcome. |
2 is potentially the better solution, I think the main problem is I/O is evil 🙂 If we had a background worker it could detect a flood and deliver data to UI in batches perhaps sending a warning after a period? |
Quite... sounds like a recipe for spaghetti code. ;-) |
A fast microcontroller as STM32F4 (on Adafruit Feather board) is fast enough to send log messages fast as 100Hz or quicker without a problem. I quickly block the GUI and lock the Mu Editor only with 20Hz logging frequency. This behavior isn't right! I can use another program to communicate with the board, but then I can't use Mu editor to debug errors or something because it hangs. edit: Oh gosh, I realize this problem is more than a year old. Hasn't anyone solved this yet? Normal console behavior is to buffer incoming messages and write them out as fast as possible. If writing out every message is slow, then write out part or entire buffer. If this is slow, notify the user about flooding of serial input so messages can not be written out. User can enlarge buffer to write out messages after when flooding ends or simply buffer messages and write then in file. |
@dybber is any of this affected by your recent merges? |
Hi all. I looked a lot at the REPL in the spring, those changes are yet to be merged. So far I haven't looked much at optimizing the REPL, but just getting it in a state where it handles the input correctly and doesn't output garbage. Those fixes are in PR #1026. I agree that it should be optimized, it also annoys me sometimes, and I'd be happy to look at it at some point in the future, but I think other things in Mu have even higher priority. For example, being able to build and notarize for Mac, so we can actually release new versions of Mu again. Things are slowly, but steadily moving forward right now, so hopefully it will be something we can get to in the near future. |
Original title (edited by @carlosperate): Program hangs unresponsive during loop in REPL.
Steps to reproduce
Plug in CircuitPlayground Express
Open REPL
Generate a infinate loop:
while True:
Ctrl+C will not kill loop in REPL and GUI hangs. This is in linux on version 1.0.0.beta.14 and 1.0.0.beta.15
The text was updated successfully, but these errors were encountered: