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

Python script not working #7

Open
arpitsahu0740 opened this issue Jun 22, 2023 · 1 comment
Open

Python script not working #7

arpitsahu0740 opened this issue Jun 22, 2023 · 1 comment

Comments

@arpitsahu0740
Copy link

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.

@magicmicros
Copy link

magicmicros commented Aug 26, 2023

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
            )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants