Open benjdour opened 5 years ago
The extended ID puts the top nibble (4 bits) of the ID into the top nibble of the transmission type - see https://www.thisisant.com/developer/resources/tech-bulletin/pairing-to-devices-with-extended-device-numbers It looks like you would need to adapt the logic at https://github.com/dhague/vpower/blob/master/SpeedCadenceSensorRx.py#L22-L23 to handle this.
I had the same problem https://github.com/dhague/vpower/issues/9 Couldn't figure it out, only got it working with 60655 as device ID.
I use the same method as you
What sensor do you use and how you connect it to the raspi?
The doc linked by @dhague says
Please note that if a display shows the device number to the user, it may show either the 2 byte device number, or the 20 bit extended device number (if the upper nibble of transmission type is used), or possibly the device number and transmission type. These display options are all acceptable. If the display allows the user to key in the device number from the display keyboard, the display should consider there are two possible "device numbers" that could be keyed in.
In conclusion: The extended device number is not intended as a number that must be displayed - it is intended to increase a device's chance of pairing to the right device every time - even in crowded environments.
I understand we don't need to "implement long ID", we can just use the 2 bytes device number and disregard the extra 4 bits of the "extended device number".
speed_sensor = SpeedCadenceSensorRx(antnode, SENSOR_TYPE, SPEED_SENSOR_ID & 0xffff)
Tried to adapt the logic at https://github.com/dhague/vpower/blob/master/SpeedCadenceSensorRx.py#L22-L23 as suggested but with any value other than 0 for transmission_type I get no readings from speed sensor.
transmission_type = 1
long_id = sensor_id & 0xf0000
if long_id:
high = long_id >> 16
transmission_type += (high << 4)
self.channel.setID(sensor_type, sensor_id & 0xffff, transmission_type)
Tried the 4 options in bits 0-1
pi@raspberrypi:~ $ cd /boot/vpower
pi@raspberrypi:/boot/vpower $ sudo python vpower.py ../vpower.cfg
Traceback (most recent call last):
File "vpower.py", line 10, in
Are you using Python 3?
I'm using Python 3.9.2 on PC, Python 3 on raspberry and latest raspbian full version.
Please open another issue since this is not related to long sensor ID and post the full traceback. Do you get this error also on Windows? Edit: I don't have a Raspberry Pi to confirm, but I read the Raspbian comes with both Python 2 and 3 but 2 is default, so you should run python3 instead of just python.
Hi, I use new speed sensor and they have long ID but in the vpower.cfg file we must use short ID, have you a solution for me ? Thanks for your help