kroimon / arduino-serialcommand Goto Github PK
View Code? Open in Web Editor NEWA Wiring/Arduino library to tokenize and parse commands received over a serial port.
A Wiring/Arduino library to tokenize and parse commands received over a serial port.
Hello,
Thank you for your project is nice as a project. I noticed a problem and I would like to know if it would come from a bug in your library.
So, I will try to explain the problem!
I have several functions that find calling by the sCmD menu and in two function works with a new menu that expects an argument.
As with your example. =
arg = sCmd.next ();
if (arg! = NULL) {
aNumber = atoi (arg);
If this function is last in my code it works fine.
On the other hand, as to explain, I have two function of this type ... So either one or the other does not work. By reversing the order, one works and the other does not work anymore. This translates as if it is not executing the code and returning the echo bits of the other function. It's really strange because suddenly, I can not use two function that uses sCmd.next () ... Do you think I have to rename the variables "aNumber" and "atoi" every time I use it in my functions which are calling by the menu?
Waiting for your help
Thank you in advance,
Félix
I've been tracing a problem with the command strings frequently being corrupted after using addCommand
several times. I believe that the following line in SerialCommand.cpp is a bug:
commandList = (SerialCommandCallback *) realloc(commandList, (commandCount + 1) * sizeof(SerialCommandCallback));
The C++ reference on realloc
states the following:
The content of the memory block is preserved up to the lesser of the new and old sizes, even if the block is moved to a new location. If the new size is larger, the value of the newly allocated portion is indeterminate.
A simple but inelegant fix would be to hard-code the size of commandList
in the header file and limit the maximum number of commands.
Perhaps a more flexible dynamic allocation approach could follow from a linked-list implementation.
I'm not sure if I'm being stupid but I can't get this to work.
I download the library, and install it as normal. I load up the example sketch and it compiles fine, but when I test it out using an Uno R3, nothing happens when I send the commands in the example sketch.
I've checked the baud rates and all the obvious stuff, so I'm guessing it's something to do with Arduino 1.0.3, which is the latest version that I'm using. Anyone else having the problem?
The original https://github.com/scogswell/ArduinoSerialCommand/ is licensed under GNU LGPLv2.1, though it's not very prominent. (I have submitted a Pull Request to fix this...)
The LGPLv2.1 requires that modifications be distributed under the same terms (§2(c) of the GNU Lesser General Public License, version 2.1)
The GPLv3 is actually a lot more restrictive, so I (and I am not a lawyer) do not know if it's compatible. However, I do know it's also completely legal for scogswell to license the library to you under GPLv3 anyway.
As someone who has a fork of this repo, I'm merely requesting this clarification for the sake of clarity, so I can add the appropriate LICENSE
file to my own repository.
Speaking of LICENSE
files, adding one to the root of your repository will allow GitHub to prominently display the license of the project along the top. You can add it with just a few clicks by going to https://choosealicense.com/licenses/
Thank you!
Hi!
I'm trying to use SerialCommand from inside another class (library).
But whenever I try to add a command I get the following compiler error:
addCommand(const char [10], )'
Any idea of how I can get around this error?
BR,
Martin
Hi kroimon,
Thank you for putting together a nice library. However I am having issues calling a command from serial multiple times. My command is Commands.addCommand("SET_ID", Command_SetId_Callback);
and my command callback is as below:
void Command_SetId_Callback() { Serial.println("Set Id Mode"); String Argument = String(Commands.next()); if (Argument != NULL) { Serial.println("New ID is: " + Argument); } }
It works fine when I for example enter SET_ID 20
the first time. But I get no response the second time onwards. Looking forward to your support.
Thanks.
I want to add command “pumb/pumb1”
This is work?
Thanks
This would give much more visibility to this project. Thanks
I want use like: sc.addCommand(&MPU::start, this); // why not ?
Hello,
I use your library on a RP2040 zero with success :-)
How can i check Carriage Return key with the addCommand.
I have tested sCmd.addCommand("0D", DisplayHelp); without success.
Thanks for your help,
Pierre
as desc in the title.
I cannot pass long parameter like "set_MLT_sensor 5E72631403A4FFFF"
because a buffer size is short
I think to change
from line 151 in SerialCommend.cpp
if (bufPos > SERIALCOMMANDBUFFER-1) {
bufPos=0; // wrap buffer around if full
Serial.println("Short SERIALCOMMANDBUFFER");
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.