Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bluetooth/aioble/examples/temp_sensor.py: Properly notifies on update. #835

Merged
merged 2 commits into from
May 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions micropython/bluetooth/aioble/examples/temp_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def _encode_temperature(temp_deg_c):
async def sensor_task():
t = 24.5
while True:
temp_characteristic.write(_encode_temperature(t))
temp_characteristic.write(_encode_temperature(t), send_update=True)
t += random.uniform(-0.5, 0.5)
await asyncio.sleep_ms(1000)

Expand All @@ -56,7 +56,7 @@ async def peripheral_task():
appearance=_ADV_APPEARANCE_GENERIC_THERMOMETER,
) as connection:
print("Connection from", connection.device)
await connection.disconnected()
await connection.disconnected(timeout_ms=None)


# Run both tasks.
Expand Down