esp32_ble_ota
esp32_ble_ota copied to clipboard
Python script not working
I am trying to test this but the python code doesn't write the characteristics of the esp. And the execution is stuck at this - Searching for ESP32... ESP32 found! Sending packet size: 253. Sending OTA request.
You need to add "response=True" when writing to the control characteristic too.
# write the request OP code to OTA Control
print("Sending OTA request.")
await client.write_gatt_char(
OTA_CONTROL_UUID,
SVR_CHR_OTA_CONTROL_REQUEST,
response=True
)
# wait for the response
await asyncio.sleep(1)
if await queue.get() == "ack":
# sequentially write all packets to OTA data
for i, pkg in enumerate(firmware):
print(f"Sending packet {i+1}/{len(firmware)}.")
await client.write_gatt_char(
OTA_DATA_UUID,
pkg,
response=True
)
# write done OP code to OTA Control
print("Sending OTA done.")
await client.write_gatt_char(
OTA_CONTROL_UUID,
SVR_CHR_OTA_CONTROL_DONE,
response=True
)