Page 1 of 2
ESP32 add more commands for Bluetooth
Posted: Thu Mar 24, 2022 3:49 pm
by stefan.erni
Hi Ben
Is it possible to add for the Bluetooth from the ESP32 some more commands also like the UART or App Developper comport already have it?
This both makes it easier for me:
SendINTArray and ReceiveINTArray
SendBinary32 and ReceiveBinary32
regards
Stefan
- array_2022-03-24_14-01-46.jpg (82.27 KiB) Viewed 2569 times
Re: ESP32 add more commands for Bluetooth
Posted: Mon Mar 28, 2022 12:11 pm
by BenR
Hi Stefan,
Ok I'll get those on the list for you.
Re: ESP32 add more commands for Bluetooth
Posted: Wed Sep 21, 2022 2:56 pm
by stefan.erni
Hi Ben
On various projects I have to use 24Bit data. This is not supportet in FC but 32Bit is very well supported. So I will use 32bit instead of 24bit
But not yet the 32-bit (Long) data transmission as Array in AppDeveloper comport, ESP32-Uart and ESP32-BT
Would it be possible to add this command as well:
ReceiveLongArray and SendLongArray
Maybe it would be possible to add this command for the ESP32-BT so the commands are the same.
ReceiveByteArray and SendByteArray
ReceiveIntArray and SendIntArray
The ESP SendArray already exists, you could leave it there so that old programs still work, but you know better than me how to do it.
regards
Stefan
overview commands
- commands_2022-09-21_15-06-10.jpg (89.7 KiB) Viewed 2031 times
Re: ESP32 add more commands for Bluetooth
Posted: Wed Nov 23, 2022 10:10 am
by stefan.erni
Hi Ben
Would it be possible already add for ESP32 Bluetooth
ReceiveIntArray and SendIntArray
regards
Stefan
Re: ESP32 add more commands for Bluetooth
Posted: Mon Nov 28, 2022 7:23 pm
by BenR
Hello,
I've looked at this before and it's tricky to do it well. I'll look again. Basically the esp32 does the queuing for you but expects a char array (shakes fist at strict compiler) and conversion requires an intermediate buffer which has to be of a big enough size to cope with anything a user might throw at it. Any fixed size I make it will probably be both needlessly big and too small. Or we do things piecemeal byte by byte to avoid the buffer but this incurs delays and or missed bytes. Hmm. I'll try again a nice solution may present itself and I do have an idea which is a halfway house. Piecemeal using a reasonable sized buffer.
Re: ESP32 add more commands for Bluetooth
Posted: Thu Dec 01, 2022 12:36 pm
by stefan.erni
Hi Ben
I mean these are just suggestions....
There is still a small improvements possible.
To write data to an SD disc relatively quickly, you can fill the buffer and write all at once. But buffer is only possible to fill per byte.
Couldn't this buffer also be filled with an integer? 256 integer will fill 512Byte.....
Could I make the USB/Bluetooth transmit aaray (buffer) to 256x integer and then write it to the sd card right away?
The other little problem.... I need to filter all integers with the DSP component.
I don't know yet whether in the ESP32 program or in the FC9 App or in both. In an array there will be 9 axes per sensor and there will be two sensors.
So 18 integers every 100Hz
All go through a DSP filter but not to the same filter. Once Kalmann, once low pass, possibly also a high pass
There could also be a DSP Component "IMU" where I read in all 9 axes and the DSP Component "IMU" gives me the roll pitch and yaw filtered......
(in the future)
regards
Stefan
SD Card
- File_Buffer.JPG (42.95 KiB) Viewed 1749 times
Re: ESP32 add more commands for Bluetooth
Posted: Thu Dec 01, 2022 1:46 pm
by mnfisher
For the int to char array in BT - can you just use a cast on the passed array?
Martin
Re: ESP32 add more commands for Bluetooth
Posted: Fri Dec 02, 2022 1:31 pm
by stefan.erni
Hi Martin
Yes that would be a possibility. At the moment I'm still using the USB. Maybe Ben will still add this to BT.
For file write/read I'm trying to use the app developer with built-in function File to write array and read it again as a simulationdata.
So I will create a movement file and read it again.
I chose the name "IMU.FMV".
Flowcode MoVment file
Also the 18 DSP filters with input output are much easier to create than I thought.
regards
Stefan
built-in function File in FC AppDevelopper
- Snag_288b16.png (25.24 KiB) Viewed 1732 times
Re: ESP32 add more commands for Bluetooth
Posted: Wed Jan 18, 2023 2:12 pm
by stefan.erni
Hi Ben
The use of ESP32 Bluetooth together with the APP developer is very easy, fast and a stable connection.
But two tiny wishes. With the ESP32 the sending (perhaps also receiving) of INTArray and with the App Developer a command like checkConnectionStatus.
Would this be possible to add?
regards
Stefan
Compare both commands ESP32 BT and APP developer comport:
- Check_and_IntArray_2023-01-18_14-50-42.jpg (70.7 KiB) Viewed 1535 times
Re: ESP32 add more commands for Bluetooth
Posted: Wed Jan 18, 2023 4:40 pm
by BenR
Hello,
Sorry I know this one has been on the request list for a while. I've added the INT array functions for you now and am interested as to how you get on with them.
As for the check connection status function this is tricky, I don't think Windows itself manages this one very well but I could be wrong. The way I do it is I put a simple comms check into the firmware, so for example the App sends out a specific combination of bytes, the embedded side checks for this and replies. If the reply doesn't come then the comms channel is assumed dead, the COM port is closed and the app stopped with an error message.