Uberi / Arduino-CommandParser

Complete command parser library for Arduino-compatibles.

Home Page:https://www.arduinolibraries.info/libraries/command-parser

Repository from Github https://github.comUberi/Arduino-CommandParserRepository from Github https://github.comUberi/Arduino-CommandParser

Double parameter type isn't deserialized properly

Kolterdyx opened this issue · comments

After registering a command like so:

void cmd_align(CmdParser::Argument *args, char *resp) {
  sprintf(resp, "%d %d", args[0].asDouble, args[1].asDouble);
}

parser.registerCommand("align", "dd", &cmd_align);

and then sending the command align 1 1, I get the following on the serial monitor:

? ?

Actually, it works properly, it's just sprintf being a d*ck

I managed to do it with:

sprintf(resp, "%s %s", String(args[0]).asDouble, String(args[1]).asDouble);

It doesn't look good but it does the trick