Closed sam2b closed 6 years ago
Can you please provide the code to reproduce the issue? Thank you
Sure: see file here https://github.com/olympum/ant-cycling-power/blob/master/power-meter.js
PowerMeter.prototype.broadcast = function(power, cadence) {
if (!this.stick.is_present()) {
return;
}
...
}
I'm sorry but this project is a ANT+ client, used for receiving data from ANT+ devices (bikes, HR sensors, etc.), while the project you link is for simulating an ANT+ bike. This projects was never meant to be used like that, so I'm not surprised it doesn't work. I believe that simulating a device could be useful but must be a separate project: feel free to start it and take this project as a base if you find it useful.
Regardless of the usage, why does the stick object get into an unusable state when I call is_present( ) after stick.open( ) ? That is the issue I am raising, please.
is_present
does not change the state of the stick. open
does, and you must not call it twice (unless you call close
between the two calls)
When I call is_present( ), the stick seems to close... or otherwise put the object in a bad state such that write( ) fails and throws and exception.
if (!this.stick.is_present()) { .. }
I've verifiedopen()
returns true before callingis_present()
, and then after callingis_present()
I verifiedopen()
returns false.See
./src/ant.ts
file.