Delocalized serial text output to ui worker thread

This commit is contained in:
2026-05-16 12:59:51 +02:00
parent 7ad0917237
commit d56c7605a1
5 changed files with 26 additions and 7 deletions

View File

@@ -0,0 +1,12 @@
# Copyright (C) 2026 Hector van der Aa <hector@h3cx.dev>
# Copyright (C) 2026 Association Exergie <association.exergie@gmail.com>
# SPDX-License-Identifier: GPL-3.0-or-later
import dearpygui.dearpygui as dpg
from dataflux.tags import TEXT_SERIAL_CONSOLE
def append_text_to_console(text: str) -> None:
old = dpg.get_value(TEXT_SERIAL_CONSOLE)
dpg.set_value(TEXT_SERIAL_CONSOLE, old + text)

View File

@@ -2,6 +2,7 @@
# Copyright (C) 2026 Association Exergie <association.exergie@gmail.com>
# SPDX-License-Identifier: GPL-3.0-or-later
from queue import Empty
import dearpygui.dearpygui as dpg
import datetime
import time
@@ -19,6 +20,7 @@ from dataflux.tags import (
LIVE_DATA_VEHICLE_TIME_VALUE,
LIVE_DATA_SPEED_VALUE,
)
from dataflux.ui.routines.serial import append_text_to_console
def ui_worker(state: AppState):
@@ -36,6 +38,14 @@ def ui_worker(state: AppState):
dpg.set_value(LIVE_DATA_UTC_TIME_VALUE, formatted)
last_datetime = formatted
if state.serial_thread_running:
try:
text = state.serial_data_queue.get_nowait()
except Empty:
pass
else:
append_text_to_console(text)
if state.lora_thread_running and state.telemetry_valid:
x_common: list[float] | None = None
speed_y: list[float] | None = None