INNER CODE UNIT · Python

_reader

Chanchaldhiman/CANviz · backend/canviz/cli.py:434

    def _reader() -> None:
        _no_frame_count = 0
        while _running:
            try:
                msg = bus.recv(timeout=0.1)
                if msg is not None:
                    _no_frame_count = 0
                    _on_message(msg)
                else:
                    _no_frame_count += 1
                    if _no_frame_count == 300 and interface == "slcan":
                        err_console.print(
                            f"\n  [yellow]Warning:[/] slcan: no frames in ~30 s. "
                            f"Check CAN bitrate ({bitrate} bps) matches the bus. "
                            f"Try --serial-baudrate 2000000 if needed."
                        )
            except Exception as exc:
                err_console.print(f"  [red]recv error:[/] {exc}")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…