Identical BLE Receive String Function Crashing

I have the following blocks. GetSpeed works without issue. GetBrightness crashes the app. The first step in the callbacks on the ESP32 is to print the read type. For example, when I call getSpeed, the ESP32 immediately prints SPEED READ Initialized, then it prints one mroe line with the value sent. When I call getBrightness, the BRIGHTNESS READ Initialized message isn’t output and the app crashes. I rebuilt the function using a different name with the same result when it is called.

My phone is still connected, otherwise I would see the device disconnected message so it seems that the app is crashing before the call to BLE Receive String transmits.


image
image

I think I’m just going to try rebuilding the app from scratch :rage:

Hello @michael.chaney3nptx
Before you make changes to the blocks, could you please ensure that you send the correct type of data?
In your case, esp32 should send a string
Are you sure that is the correct UUID?
If this is correct you can try to add the “Receive string” block inside of a when button click and connect the data response into a label

Thank you for the assistance!

I’ve made sure the data types are exactly the same from the ESP32. If you look at the last screenshot you can see the MODE and SPEED reads work but the BRIGHTNESS read isn’t even called. Printing that line is the first step in the callback on the ESP32.

I’m positive it’s the correct UUID. I swapped UUID’s for speed and brightness and speed still works. without issue.

I’m already calling Receive String and the brightness string is formatted exactly like the speed. XXX,XXX should be the value sent for either.

I have a when block for changing a label value. Speed or brightness can be a value between 0 and 100. The first value is for strip 1, the second for strip 2. The values XXX,XXX are split into a list when received. When the list variables are initialized or changed the label for each value is changed. There are seperate list variables for mode, speed and brightness.

Everything points to the app crashing when the Receive String call is made from the GetBrightness function, even though it’s identical to the GetSpeed function which works.

I added a notification box to the GetBrightness function before Receive String is called and it runs without issue, then the app immediately crashes on confirm when Receive string is called, but only in the GetBrightness function.

It wasn’t an issue in the blocks. By default there’s a limit on the number of characteristics handled. I changed the following ESP32 code and am now receiving the Brightness value without issue.

From:
BLEService *pService = pServer->createService(SERVICE_UUID);

To:
BLEService *pService = pServer->createService(BLEUUID(SERVICE_UUID), 30, 0);

2 Likes