Commiting because I have no clue why this is broken
This commit is contained in:
parent
6031ebae1d
commit
9bda79f380
2 changed files with 9 additions and 8 deletions
|
|
@ -40,7 +40,7 @@ while True:
|
|||
speed_cad_connection = pyloton.speed_cad_connect()
|
||||
if not radio:
|
||||
print("Running ams_connection")
|
||||
radio = ams_connection
|
||||
radio = pyloton.ams_connect()
|
||||
|
||||
if time.time()-start >= 45:
|
||||
pyloton.timeout()
|
||||
|
|
|
|||
|
|
@ -153,22 +153,23 @@ class Pyloton:
|
|||
return self.hr_connection
|
||||
|
||||
def ams_connect(self):
|
||||
self.radio = adafruit_ble.BLERadio()
|
||||
self._status_update("Connect your phone now")
|
||||
radio = adafruit_ble.BLERadio()
|
||||
a = SolicitServicesAdvertisement()
|
||||
a.solicited_services.append(AppleMediaService)
|
||||
self.radio.start_adversising(a)
|
||||
radio.start_advertising(a)
|
||||
|
||||
while not self.radio.connected:
|
||||
while not radio.connected:
|
||||
pass
|
||||
|
||||
print("connected")
|
||||
self._status_update("Connected")
|
||||
|
||||
for connection in self.radio.connections:
|
||||
for connection in radio.connections:
|
||||
if not connection.paired:
|
||||
connection.pair()
|
||||
print("paired")
|
||||
self._status_update("paired")
|
||||
known_notifications = set()
|
||||
|
||||
self.radio = radio
|
||||
return self.radio
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue