Recollect sliced JSON in large bytearray() #16645
nastiliano
started this conversation in
General
Replies: 1 comment 6 replies
-
If you have a known absolute upper limit on the size of the received packet, pre-allocate an array of bytes, and copy the slices into it. Otherwise, python has to keep making copies of the bytearray, which results in heap fragmentation, and impossibility of allocating the extended rray. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello everyone!
I'm using the "Bleak" Python Library to transmit data to my ESP32 over bluetooth BLE UART (GATT service) as client.
In ESP32 I'm using the "aioble" Micropython Library to receive the data as server.
Due the limitations of BLE UART GATT protocol, the "aioble" buffer is limited to 256 bytes and "Bleak" too.
I already solved this sending an sliced JSON from "Bleak" (PC) and deslicing data in EP32 usin bytearray().extend() method but the problem now is the max siz data of a bytearray in Micropython...
PC code:
ESP32 code:
Is the a way to use a large bytearray() or use NVM memory or anather way?
Thank you very much!!
Beta Was this translation helpful? Give feedback.
All reactions