Tigge / openant

ANT and ANT-FS Python Library
MIT License
174 stars 80 forks source link

Fixed some minor issues to RxOpenScanMode #56

Closed drkingpo closed 1 year ago

drkingpo commented 3 years ago

There was a little fault in example\continous_scan.py I fixed.

As also a small failue in Line 180 of ant.py to "message._data[1] == 0x01", where the underline was missing.

Also added a check if OpenScanMode is running to disable than send option to Broadcast messages, as in this more no & never messages will be send. Without these change openScanMode will run after some seconds/minutes in a failure.

coveralls commented 3 years ago

Coverage Status

Coverage decreased (-0.07%) to 55.68% when pulling 8f092343e594f35e6ee15819633e8b286d055302 on drkingpo:master into 3b8dfc9f33e933f47c858a12273f65eeb76220f6 on Tigge:master.

tuna-f1sh commented 1 year ago

This is old but I looked into it since I've not used continuous scan before.

Reading ANT AP14 Continuous Scanning Mode for Asynchronous Topologies, one can RX in broadcast, ack and burst (all RX types) [Section 5.3]. So I don't see why the flag should be used to not act on the BROADCAST_DATA event.

I tried running it with multiple devices and sending data and it appeared to work without failure. The other fix for looking at the wrong _data has been fixed elsewhere so perhaps it was that.

Still, BIDIRECTIONAL_RECEIVE is not recommended for most use cases since it will ACK messages not necessarily targeted for the host. I've changed the example so there is more explanation and the default is UNIDIRECTIONAL_RECEIVE_ONLY (Rx only): https://github.com/Tigge/openant/commit/dcf08edcf8a84f7db7532f9af333eadd8185e219

Since all channels are required to do this, I feel like this should be a method of the Node class rather than performed manually, so that checks can be done for open channels and also the device capability for this - I'll leave this for now/for someone else however.