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.
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.