option --auto-connect, connect automatically if one device detected (#645)

* option --auto-connect, connect automatically to the 1st detected device
* autoconnect only if there is exactly one device

Signed-off-by: Martin <Ho-Ro@users.noreply.github.com>
pull/653/head
Martin 2023-07-05 09:59:26 +02:00 zatwierdzone przez GitHub
rodzic a8ffbc3aee
commit 1f233819d2
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 9 dodań i 0 usunięć

Wyświetl plik

@ -473,6 +473,10 @@ class NanoVNASaver(QWidget):
logger.debug("Finished building interface")
def auto_connect( self ): # connect if there is exactly one detected serial device
if self.serial_control.inp_port.count() == 1:
self.serial_control.connect_device()
def _sweep_control(self, start: bool = True) -> None:
self.sweep_control.progress_bar.setValue(0 if start else 100)
self.sweep_control.btn_start.setDisabled(start)

Wyświetl plik

@ -46,6 +46,9 @@ def main():
parser.add_argument(
"-D", "--debug-file", help="File to write debug logging output to"
)
parser.add_argument(
"-a", "--auto-connect", action="store_true", help="Auto connect if one device detected"
)
parser.add_argument(
"-f",
"--file",
@ -92,6 +95,8 @@ def main():
window = NanoVNASaver()
window.show()
if args.auto_connect:
window.auto_connect()
if args.file:
t = Touchstone(args.file)
t.load()