I’m having some issues when I’m setting a characteristics value more than once.
The use case for this is where I want to send notifications to a client with different data.
I’m able to set the value the first time, but always on the second attempt, it crashes.
Have anyone encounter this before?
I’m running on an ESP32 DevKit-C
You can see the basic test code below:
import streams from espressif.esp32ble import esp32ble as bledrv from wireless import ble streams.serial() # initialize BLE driver bledrv.init() ble.gap("Zerynth") s = ble.Service(0xA001) c = ble.Characteristic(0xA003, ble.NOTIFY,35,"AP Details",ble.BYTES) s.add_characteristic(c) ble.add_service(s) ble.start() ble.start_advertising() while True: print(".") sleep(1000) b = bytearray([0xC8,0x03,0x03,0x44,0x26,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]) c.set_value(b)
On the first run in the while loop, it all goes well. But always on the second run, it crashed due to:
Thread 1 exited with exception IndexError at line 37 of __main__ raised at line 488 of wireless.ble.set_value