mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-08-05 06:55:43 +08:00
Refactor Sunnylink registration condition
The condition for Sunnylink registration has been simplified and refactored within the main loop. Previously, the "is_registered" variable was being set outside the registration loop. Now, the checking process of the dongle ID in regard to the registration status is directly integrated into the while condition. This makes the code more concise and the process flow clearer.
This commit is contained in:
@@ -190,8 +190,7 @@ def main(exit_event: threading.Event = None):
|
||||
except Exception:
|
||||
cloudlog.exception("failed to set core affinity")
|
||||
|
||||
is_registered = params.get("SunnylinkDongleId", encoding='utf-8') not in (None, UNREGISTERED_SUNNYLINK_DONGLE_ID)
|
||||
while params.get_bool("SunnylinkEnabled") and not is_registered:
|
||||
while params.get_bool("SunnylinkEnabled") and not params.get("SunnylinkDongleId", encoding='utf-8') not in (None, UNREGISTERED_SUNNYLINK_DONGLE_ID):
|
||||
cloudlog.info("Waiting for sunnylink registration to complete")
|
||||
time.sleep(10)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user