Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve EZSP connect logic. #869

Merged
merged 3 commits into from
Jan 13, 2024
Merged

Conversation

Nerivec
Copy link
Collaborator

@Nerivec Nerivec commented Jan 12, 2024

Don't rely on bubbling events to handle initial "connect" logic. On error, bail and cleanup to ensure port is always available (that is if nothing else is preventing access to it of course...) then retry.
Driver will reset and try again indefinitely on failure to connect (to serial).

An example flow would look like this:

- Adapter:start
- Driver:startup
- Ezsp:connect => Try ${MAX_SERIAL_CONNECT_ATTEMPTS} times
- Driver:startup => ERROR
  - Driver:reset => Try 0
  - Driver:stop
  - Ezsp:close
  - SerialDriver:close
  - Driver:onClose
  - Driver:startup
  - Ezsp:connect => Try ${MAX_SERIAL_CONNECT_ATTEMPTS} times
  - Driver:startup => ERROR
    - Driver:reset => Pause
    - Driver:reset => Try 1
    - Driver:stop
    - Ezsp:close
    - SerialDriver:close
    - Driver:onClose
    - Driver:startup
    - Ezsp:connect => Try ${MAX_SERIAL_CONNECT_ATTEMPTS} times
    - SerialDriver:connect
    - SerialDriver:reset
    - Driver:startup SUCCESS

@Koenkk
Copy link
Owner

Koenkk commented Jan 13, 2024

Awesome, thanks!

CC: @kirovilya

@Koenkk Koenkk merged commit a02a8e1 into Koenkk:master Jan 13, 2024
1 check passed
@Nerivec Nerivec deleted the improve-connection-logic branch January 13, 2024 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants