zigpy / zigpy-znp

TI CC2531, CC13x2, CC26x2 radio support for Zigpy and ZHA
GNU General Public License v3.0
145 stars 40 forks source link

Connect multiple times on startup and speed up initial connect #104

Closed puddly closed 2 years ago

puddly commented 2 years ago

Instead of just sending the bootloader skip bytes and connecting a single time, zigpy-znp now connects multiple times (similar to the way Z2M currently does it):

  1. First just connect to the serial port.
  2. If that doesn't work, try sending the bootloader skip bytes and try again.
  3. If that doesn't work, try toggling the RTS pin and try once more.

This increases the chances of a connection attempt succeeding significantly while still taking the same amount of time as before.

A side effect of this change (and the original motivation) is that the CC2530 with an external USB-serial adapter is now fully supported.

To support custom coordinator boards (e.g. where RTS or DTR is mapped to RST), the pin toggling behavior is now configurable as well.