mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-07-18 04:02:07 +08:00
5d440cf62a
The Sunnylink integration has been refactored to improve handling of scenarios where Sunnylink is enabled but the dongle is not registered. Added checks for the registration status of the Sunnylink dongle and updated related defaults and UI indicators correspondingly. Additionally, moved the execution of the sunnylink.py script to the background during launch to prevent blocking other tasks.
27 lines
645 B
Python
Executable File
27 lines
645 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
from openpilot.common.api.sunnylink import SunnylinkApi
|
|
from openpilot.common.params import Params
|
|
from openpilot.common.spinner import Spinner
|
|
from openpilot.system.version import is_prebuilt
|
|
|
|
|
|
if __name__ == "__main__":
|
|
# spinner = Spinner()
|
|
extra_args = {}
|
|
|
|
if not Params().get_bool("SunnylinkEnabled"):
|
|
print("Sunnylink is not enabled. Exiting.")
|
|
# spinner.close()
|
|
exit(0)
|
|
|
|
if not is_prebuilt():
|
|
extra_args = {
|
|
"verbose": True,
|
|
"timeout": 60
|
|
}
|
|
|
|
sunnylink_id = SunnylinkApi(None).register_device(None, **extra_args)
|
|
print(f"SunnyLinkId: {sunnylink_id}")
|
|
# spinner.close()
|