mirror of
https://github.com/DanielPollithy/bluetooth_drone.git
synced 2025-10-16 11:45:38 +00:00
change
This commit is contained in:
parent
4b64c3febf
commit
4ff34bd957
16
client.py
16
client.py
@ -80,7 +80,8 @@ def protocol(address):
|
|||||||
sock.close()
|
sock.close()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
while True:
|
connecting = True
|
||||||
|
while connecting:
|
||||||
nearby_devices = bluetooth.discover_devices(lookup_names=True)
|
nearby_devices = bluetooth.discover_devices(lookup_names=True)
|
||||||
print("found %d devices" % len(nearby_devices))
|
print("found %d devices" % len(nearby_devices))
|
||||||
|
|
||||||
@ -88,6 +89,15 @@ if __name__ == '__main__':
|
|||||||
print(" %s - %s" % (address, name))
|
print(" %s - %s" % (address, name))
|
||||||
if address == settings.PEER_BT_ADDRESS:
|
if address == settings.PEER_BT_ADDRESS:
|
||||||
print("PEERING PARTNER FOUND")
|
print("PEERING PARTNER FOUND")
|
||||||
protocol(address)
|
try:
|
||||||
|
protocol(address)
|
||||||
|
except bluetooth.btcommon.BluetoothError as (code, text):
|
||||||
|
if code == 104:
|
||||||
|
print(text)
|
||||||
|
print('That is o.k. I make a break and then we keep on')
|
||||||
|
time.sleep(settings.DRONE_REJECTED_RESTART_TIME)
|
||||||
|
else:
|
||||||
|
print('This error is not known. I stop connecting')
|
||||||
|
connecting = False
|
||||||
|
|
||||||
time.sleep(settings.BT_SLEEP)
|
time.sleep(settings.BT_SLEEP)
|
||||||
|
|||||||
@ -7,6 +7,7 @@ BT_SLEEP = 0.01 # seconds
|
|||||||
DISTANCE_SLEEP = 0.1
|
DISTANCE_SLEEP = 0.1
|
||||||
|
|
||||||
CHARGING_TIME = 10
|
CHARGING_TIME = 10
|
||||||
|
DRONE_REJECTED_RESTART_TIME = 10
|
||||||
|
|
||||||
# eth
|
# eth
|
||||||
CLIENT_ETHEREUM_ADDRESS = '0xde0b2sdsdsddddddddddddddddddddddddddddde'
|
CLIENT_ETHEREUM_ADDRESS = '0xde0b2sdsdsddddddddddddddddddddddddddddde'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user