I'm building this sketch to control a DSRL camera using a microcontroller through normal/bluetooth serial. It uses CmdMessenger to communicate with the controller.
The plain serial version already works, however, as I received my new bluetooth serial module, I wanted to add a few methods to change the bluetooth settings remotely.
It works this way: the computer sends any of the chname, chpin, chbaud commands with the new value, which is stored in SRAM, and then sends the commit command, which puts the bt module in AT mode, stores the information and resets the MCU (watchdog reset).
The chpin and chbaud functions work, however when chname is called, the microcontroller prints "BAU" on serial and simply hangs (sending "cuccia" didn't work ).
This is the function: https://gist.github.com/Davideddu/2728fbb6cfcfd7f3d533#file-blueos-ino-L368
I believe this is caused by CmdMessenger.copyStringArg. The method accepts a pointer to a char array and an integer (len). It reads a string argument from serial then runs strlcpy on it to copy len bytes into my char array.
I tried checking the program over and over to reduce the SRAM usage, and I actually did reduce it, but the program still crashes at that point.
Thank you in advance for your help, I hope you have a nice day.