nathandunk / BetterSerialPlotter

A drop-in replacement for the arduino serial plotter
MIT License
162 stars 25 forks source link

Inconsistent port opening behavior #9

Closed alexw-im closed 1 year ago

alexw-im commented 1 year ago

I use BSP somewhat regularly but infrequently, maybe like once every few weeks or months. I'm suddenly running into a couple of possibly related issues trying to plot data from some CircuitPython/MicroPython devices (maybe related, maybe not).

The first I'm experiencing with a CircuitPython 7 PyPadge. I CAN open the serial port in BSP, but it'll only plot every few tens of samples, and the port looks closed the entire time until the sample that comes in that kicks off the plot. If I open SerialMonitor, you can see every line comes in on the half-second interval I've got programmed, but the data in the left sidebar rarely updates. When it does, the plot re-draws, and fills in all "missed" samples as well. Notably, the red serial port background flashes off as well, as if it "connected" for that one sample. I've recorded a video where the sawtooth should be filling in evenly, but we see that it jumps (without dropping samples), and the sidebar only every few samples. https://user-images.githubusercontent.com/107648830/188756263-022d7659-c365-4514-9755-b6102f20ae45.mp4

The second is that I simply CANNOT open devices with a high COM port number. For instance, one was assigned COM18. I can open this with Putty just fine, but BSP won't attach. If I attempt in BSP, I can still connect with Putty even after I've selected the port in BSP trying to open it.

If I open device manager and manually re-assign a lower port number (I've tried 6 and 5), that works.

nathandunk commented 1 year ago

Hi @alexw-im , I am glad you are getting some good use out of it!

The first point seems really strange. I can't imagine what would be causing that, but will definitely poke around and see what the issue might be. Have you tried reinstalling?

As far as the second issue, it should be a relatively simple change. The library I am using for COM ports by default goes to 16, but I should be able to increase that without a problem. By chance, do you know what might be the max comport number you would be using? The library has the numbers hardcoded, and I could either just add some more in by hard coding more numbers, but windows technically goes to 255, and I definitely don't want to hardcode that many, but might if up to 64 might be useful.

alexw-im commented 1 year ago

64 certainly seems like it should be enough, thanks!

cedl3 commented 1 year ago

I have the same first problem as @alexw-im. Also i get the following in the terminal i opened the BSP in when choosing the Port:

unable to set portstatus: Bad file descriptor

@nathandunk you already found a solution to this maybe?

nathandunk commented 1 year ago

Hi @cedl3 , sorry, I have been very busy and unable to look at this until now. Can you share code that you are using to arrive at the first problem? As well as any other relevant info - board you are using, OS, what port #. I haven't seen this problem, before, so I can hopefully try to recreate it with some of this info.

nathandunk commented 1 year ago

Higher numbers of comports have been added in this release. I haven't had a response with the strange behavior, so I will assume it is fixed unless I hear more.