RFExplorer / RFExplorer-for-Python

RF Explorer libraries and examples for Python 3
GNU Lesser General Public License v3.0
51 stars 25 forks source link

initialize m_arrValidCP2102Ports in GetConnectedPorts() #5

Closed aa1i closed 7 years ago

aa1i commented 7 years ago

self.m_arrValidCP2102Ports is only initialized in init GetConnectedPorts() appends valid ports to this array, but does not initialize it, so repeated calls to GetConnectedPorts() causes this array to grow each call with repeated copies of the same device.

This commit adds initialization of m_arrValidCP2102Ports to GetConnectedPorts() and keep it mangeable.

This probably wasn't noticed since the example scripts only called GetConnectedPorts() once per execution. I am working on a Python/tkinter GUI with a button to re-scan for connected serial ports. It is easier to notice on repeated button clicks.

There also appeared to be a missing newline at the end of the file. My editor put that in automatically, I hope that isn't an issue.