Issue with BLE on OSX
Closed this issue · 4 comments
Dear Support,
Thanks for the great toolset! I'm getting empty packets with my O2 sensor when using BLE, although it works fine via USB. The other go-sensor I have is working fine via BLE. Thanks for your help!
My code:
from GDX import gdx
gdx = gdx()
gdx.open_ble("GDX-O2 0R102597")
gdx.select_sensors([1])
gdx.start()
for i in range(0,20):
measurements = gdx.read()
if measurements == None:
break
print(measurements)
gdx.stop()
gdx.close()
Results in:
wait for bluetooth initialization...
number of ble devices found = 1
searching for device(s) ['GDX-O2 0R102597']
device_to_open_found = True
attempting to open 1 device(s)...
open device 0 = False
select period (ms): 500
sample rate = 2.0 samples/second
start device 0
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
stop device 0
close device 0
quit godirect
Via USB:
select sensors for GDX-O2 0R102597 USB
1: O₂ Gas (%)
2: O₂ Gas rTC (%)
3: Temperature (°C)
Enter sensor number. To select multiple sensors, separate with commas (no spaces): 1,2,3
select period (ms): 100
sample rate = 10.0 samples/second
start device 0
[20.89356231689453, 20.88532066345215, 25.274734497070312]
[20.891761779785156, 20.883520126342773, 25.274734497070312]
[20.888160705566406, 20.879919052124023, 25.274734497070312]
[20.888160705566406, 20.879919052124023, 25.274734497070312]
[20.891761779785156, 20.883520126342773, 25.274734497070312]
[20.89356231689453, 20.88532066345215, 25.274734497070312]
[20.891761779785156, 20.883520126342773, 25.274734497070312]
[20.89356231689453, 20.88532066345215, 25.274734497070312]
[20.891761779785156, 20.883520126342773, 25.274734497070312]
[20.891761779785156, 20.883567810058594, 25.27311134338379]
[20.891761779785156, 20.883567810058594, 25.27311134338379]
[20.89356231689453, 20.88532066345215, 25.274734497070312]
[20.89356231689453, 20.885173797607422, 25.279605865478516]
[20.891761779785156, 20.88132667541504, 25.347843170166016]
[20.891761779785156, 20.877084732055664, 25.489219665527344]
[20.89356231689453, 20.873762130737305, 25.66002082824707]
[20.891761779785156, 20.867321014404297, 25.814699172973633]
[20.88996124267578, 20.861658096313477, 25.943458557128906]
[20.891761779785156, 20.860767364501953, 26.033145904541016]
[20.891761779785156, 20.860570907592773, 26.0396671295166]
stop device 0
close device 0
quit godirect
@dderiso, I do not have a GDX-O2 device with me to test with, atm. Nor, do I not have any great notions as to why it would not behave like other Go Direct devices. I will try and get a hold of a GDX-O2, soon.
@dderiso Did you happen to try the example that does not use the gdx module, instead talks directly to the godirect module? This might be a good troubleshooting step to make sure the issue is not a bug in the gdx module. The example can be found here:
https://github.com/VernierST/godirect-examples/blob/master/python/godirect-module-examples/godirect-sensor-readout.py
@sswartley Thanks! This example was very helpful for getting the O2 sensor up and running.
I've renamed this issue because it turns out that the problem wasn't related to the O2 sensor; it was related to Bleak. In case it helps, I found that patching that library fixed the problem for me. hbldh/bleak#116 (comment)
Should be resolved with #20