Files
BiogasControllerApp/BiogasControllerApp-V2.2/bin/lib/comport_search.py
simplePCBuilding e24f501bf5 Update to the backend and new Screen.
Features:
- Added a new settings page
- Laid out some backend stuff to integrate some new features
- prepared backend to include an option to have the previous values also displayed when updating them both screens where you may change configuration of the microcontroller
2022-02-21 18:26:03 +01:00

23 lines
785 B
Python

import serial.tools.list_ports
class ComportService:
def __init__(self):
self.__comport = []
self.__import = []
self.__working = []
def get_comport(self, special_port=""):
self.__comport = [comport.device for comport in serial.tools.list_ports.comports()]
self.__pos = 0
if special_port != "":
self.__working = special_port
else:
while self.__working == []:
self.__com_name = serial.tools.list_ports.comports()[self.__pos]
if "USB-Serial Controller" or "Prolific USB-Serial Controller" in self.__com_name:
self.__working = self.__comport.pop(self.__pos)
else:
self.__pos += 1
return self.__working