pycom / pycom-micropython-sigfox

A fork of MicroPython with the ESP32 port customized to run on Pycom's IoT multi-network modules.
MIT License
196 stars 167 forks source link

BLE services limited to 3 #589

Closed robgar2001 closed 1 year ago

robgar2001 commented 2 years ago

Thank you!

msariisik commented 2 years ago

Hi @robgar2001 ,

I tried to reproduce your problem. Are you stating the number of characteristics with nbr_chars argument while creating service? srv1 = bluetooth.service(uuid=srv1_uuid, isprimary=True, nbr_chars=11)

If this is not the missing part, can you provide your basic code to reproduce the problem?

robgar2001 commented 2 years ago

Hi @msariisik ,

Thanks for the response! We located the issue. It was probably due to a strange memory problem with dictionaries. All our characteristics where present, the default values could be read. The new values could also be read server-side when changed. When we realised this, we starting thinking of a memory problem.

All services and characteristics are kept in a dictionary when the BLE object in them. The dictionary part for service A and B are created beforehand, the parts for services C,D,E,F are added dynamically. This was done by assigning parts of a template. The template was kept as a class variable.

When we created a new object instead of assigning a part of the template, it worked fine.

If you are still intresseted to find out why, I am willing to create a reproduceable script.

Kind regards, robgar2001