Just noticed that 'make a local copy' is ticked for PrintStr str.. This is not needed (and best avoided....)
This does seem to print reliably to BT
Martin
ESP32 Bluetooth sending a string crashes if string len >12char
-
- Valued Contributor
- Posts: 962
- http://meble-kuchenne.info.pl
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 104 times
- Been thanked: 511 times
-
- Valued Contributor
- Posts: 758
- Joined: Wed Dec 02, 2020 10:53 am
- Has thanked: 149 times
- Been thanked: 171 times
Re: ESP32 Bluetooth sending a string crashes if string len >12char
Hi Martin
Very good. I will gladly use your suggestion
For a slow data transfer I like to use the option with the string.
With Flowcode it is very easy to create a string that contains the values of several channels. A comma can also be inserted
Sendstring=ToString$(value1) + "," + ToString$(value2) + "," + ToString$(value3) + "\r\n"
But the values must first be brought to the same length. Simply add a leading "0" or leading space
This means that the value 50 becomes 050.
To get a new line on the end, add the characters for it "\r\n"
For example "150,050,300\r\n"
This sent string can be easily viewed with a terminal program and also logged into a text file. If you save the text file with .csv instead of .txt, you even have a simple Excel file
But the string can also be easily converted back into data. All you have to do is split the string back into integer values.
Value 1 = StringToInt$(string position 0 with length 3)
Value 2= StringToInt$(string position 4 with length 3)
Value 3= StringToInt$(string position 8 with length 3)
For fast data transfer I use blocks that are as large as possible and hold the integer value. With the ESP32 Bluetooth, sending 32Kbyte blocks work every 300mSec.it's not so fast.
I googled it, it has to do with DMA and cache(maybe). There is certainly room for improvement with Flowcode
I'll leave that to Ben
With the crash, I agree with you here too
I'll leave that to Ben
Stefan
Very good. I will gladly use your suggestion
For a slow data transfer I like to use the option with the string.
With Flowcode it is very easy to create a string that contains the values of several channels. A comma can also be inserted
Sendstring=ToString$(value1) + "," + ToString$(value2) + "," + ToString$(value3) + "\r\n"
But the values must first be brought to the same length. Simply add a leading "0" or leading space
This means that the value 50 becomes 050.
To get a new line on the end, add the characters for it "\r\n"
For example "150,050,300\r\n"
This sent string can be easily viewed with a terminal program and also logged into a text file. If you save the text file with .csv instead of .txt, you even have a simple Excel file
But the string can also be easily converted back into data. All you have to do is split the string back into integer values.
Value 1 = StringToInt$(string position 0 with length 3)
Value 2= StringToInt$(string position 4 with length 3)
Value 3= StringToInt$(string position 8 with length 3)
For fast data transfer I use blocks that are as large as possible and hold the integer value. With the ESP32 Bluetooth, sending 32Kbyte blocks work every 300mSec.it's not so fast.
I googled it, it has to do with DMA and cache(maybe). There is certainly room for improvement with Flowcode
I'll leave that to Ben
With the crash, I agree with you here too
I'll leave that to Ben
regardsHopefully Ben and co. can come up with a proper solution..
Stefan
-
- Valued Contributor
- Posts: 962
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 104 times
- Been thanked: 511 times
Re: ESP32 Bluetooth sending a string crashes if string len >12char
Hi Stefan,
Yes that's a neat way to make easily readable data streams - though it does limit the range of values a bit (0..999 for three digits) and also involve more data being transferred (4bytes instead of 2 so can only be 50% speed)
Easy to pull the data out on a loop as well..
Martin
Yes that's a neat way to make easily readable data streams - though it does limit the range of values a bit (0..999 for three digits) and also involve more data being transferred (4bytes instead of 2 so can only be 50% speed)
Easy to pull the data out on a loop as well..
- Value[. i] =StringToInt$(data[. i*4], 3)
Martin
-
- Matrix Staff
- Posts: 1742
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 442 times
- Been thanked: 604 times
Re: ESP32 Bluetooth sending a string crashes if string len >12char
Hi Guys,
Many thanks for working on this and posting your results. I've applied Martins workaround code to the SendString function and hopefully that will help to make it more reliable now.
Interesting the receive string is also having problems, I'll see if I can investigate this a bit more thoroughly.
Many thanks for working on this and posting your results. I've applied Martins workaround code to the SendString function and hopefully that will help to make it more reliable now.
Interesting the receive string is also having problems, I'll see if I can investigate this a bit more thoroughly.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
-
- Valued Contributor
- Posts: 758
- Joined: Wed Dec 02, 2020 10:53 am
- Has thanked: 149 times
- Been thanked: 171 times
Re: ESP32 Bluetooth sending a string crashes if string len >12char
Hi Ben
Sending long string is working now. Thanks a lot.
Receiving long string is working also if the receiving command and string is long enough.
But if the command is dimensioned too short, it can crash an it's need a hardware reset.
regards
Stefan
Sending long string is working now. Thanks a lot.
Receiving long string is working also if the receiving command and string is long enough.
But if the command is dimensioned too short, it can crash an it's need a hardware reset.
regards
Stefan